1 | /** @file
|
---|
2 | DevicePathToText protocol as defined in the UEFI 2.0 specification.
|
---|
3 |
|
---|
4 | (C) Copyright 2015 Hewlett-Packard Development Company, L.P.<BR>
|
---|
5 | Copyright (c) 2013 - 2018, Intel Corporation. All rights reserved.<BR>
|
---|
6 | SPDX-License-Identifier: BSD-2-Clause-Patent
|
---|
7 |
|
---|
8 | **/
|
---|
9 |
|
---|
10 | #include "UefiDevicePathLib.h"
|
---|
11 |
|
---|
12 | /**
|
---|
13 | Concatenates a formatted unicode string to allocated pool. The caller must
|
---|
14 | free the resulting buffer.
|
---|
15 |
|
---|
16 | @param Str Tracks the allocated pool, size in use, and
|
---|
17 | amount of pool allocated.
|
---|
18 | @param Fmt The format string
|
---|
19 | @param ... Variable arguments based on the format string.
|
---|
20 |
|
---|
21 | @return Allocated buffer with the formatted string printed in it.
|
---|
22 | The caller must free the allocated buffer. The buffer
|
---|
23 | allocation is not packed.
|
---|
24 |
|
---|
25 | **/
|
---|
26 | CHAR16 *
|
---|
27 | EFIAPI
|
---|
28 | UefiDevicePathLibCatPrint (
|
---|
29 | IN OUT POOL_PRINT *Str,
|
---|
30 | IN CHAR16 *Fmt,
|
---|
31 | ...
|
---|
32 | )
|
---|
33 | {
|
---|
34 | UINTN Count;
|
---|
35 | VA_LIST Args;
|
---|
36 |
|
---|
37 | VA_START (Args, Fmt);
|
---|
38 | Count = SPrintLength (Fmt, Args);
|
---|
39 | VA_END (Args);
|
---|
40 |
|
---|
41 | if ((Str->Count + (Count + 1)) * sizeof (CHAR16) > Str->Capacity) {
|
---|
42 | Str->Capacity = (Str->Count + (Count + 1) * 2) * sizeof (CHAR16);
|
---|
43 | Str->Str = ReallocatePool (
|
---|
44 | Str->Count * sizeof (CHAR16),
|
---|
45 | Str->Capacity,
|
---|
46 | Str->Str
|
---|
47 | );
|
---|
48 | ASSERT (Str->Str != NULL);
|
---|
49 | }
|
---|
50 |
|
---|
51 | VA_START (Args, Fmt);
|
---|
52 | UnicodeVSPrint (&Str->Str[Str->Count], Str->Capacity - Str->Count * sizeof (CHAR16), Fmt, Args);
|
---|
53 | Str->Count += Count;
|
---|
54 |
|
---|
55 | VA_END (Args);
|
---|
56 | return Str->Str;
|
---|
57 | }
|
---|
58 |
|
---|
59 | /**
|
---|
60 | Converts a PCI device path structure to its string representative.
|
---|
61 |
|
---|
62 | @param Str The string representative of input device.
|
---|
63 | @param DevPath The input device path structure.
|
---|
64 | @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
|
---|
65 | of the display node is used, where applicable. If DisplayOnly
|
---|
66 | is FALSE, then the longer text representation of the display node
|
---|
67 | is used.
|
---|
68 | @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
|
---|
69 | representation for a device node can be used, where applicable.
|
---|
70 |
|
---|
71 | **/
|
---|
72 | VOID
|
---|
73 | DevPathToTextPci (
|
---|
74 | IN OUT POOL_PRINT *Str,
|
---|
75 | IN VOID *DevPath,
|
---|
76 | IN BOOLEAN DisplayOnly,
|
---|
77 | IN BOOLEAN AllowShortcuts
|
---|
78 | )
|
---|
79 | {
|
---|
80 | PCI_DEVICE_PATH *Pci;
|
---|
81 |
|
---|
82 | Pci = DevPath;
|
---|
83 | UefiDevicePathLibCatPrint (Str, L"Pci(0x%x,0x%x)", Pci->Device, Pci->Function);
|
---|
84 | }
|
---|
85 |
|
---|
86 | /**
|
---|
87 | Converts a PC Card device path structure to its string representative.
|
---|
88 |
|
---|
89 | @param Str The string representative of input device.
|
---|
90 | @param DevPath The input device path structure.
|
---|
91 | @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
|
---|
92 | of the display node is used, where applicable. If DisplayOnly
|
---|
93 | is FALSE, then the longer text representation of the display node
|
---|
94 | is used.
|
---|
95 | @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
|
---|
96 | representation for a device node can be used, where applicable.
|
---|
97 |
|
---|
98 | **/
|
---|
99 | VOID
|
---|
100 | DevPathToTextPccard (
|
---|
101 | IN OUT POOL_PRINT *Str,
|
---|
102 | IN VOID *DevPath,
|
---|
103 | IN BOOLEAN DisplayOnly,
|
---|
104 | IN BOOLEAN AllowShortcuts
|
---|
105 | )
|
---|
106 | {
|
---|
107 | PCCARD_DEVICE_PATH *Pccard;
|
---|
108 |
|
---|
109 | Pccard = DevPath;
|
---|
110 | UefiDevicePathLibCatPrint (Str, L"PcCard(0x%x)", Pccard->FunctionNumber);
|
---|
111 | }
|
---|
112 |
|
---|
113 | /**
|
---|
114 | Converts a Memory Map device path structure to its string representative.
|
---|
115 |
|
---|
116 | @param Str The string representative of input device.
|
---|
117 | @param DevPath The input device path structure.
|
---|
118 | @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
|
---|
119 | of the display node is used, where applicable. If DisplayOnly
|
---|
120 | is FALSE, then the longer text representation of the display node
|
---|
121 | is used.
|
---|
122 | @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
|
---|
123 | representation for a device node can be used, where applicable.
|
---|
124 |
|
---|
125 | **/
|
---|
126 | VOID
|
---|
127 | DevPathToTextMemMap (
|
---|
128 | IN OUT POOL_PRINT *Str,
|
---|
129 | IN VOID *DevPath,
|
---|
130 | IN BOOLEAN DisplayOnly,
|
---|
131 | IN BOOLEAN AllowShortcuts
|
---|
132 | )
|
---|
133 | {
|
---|
134 | MEMMAP_DEVICE_PATH *MemMap;
|
---|
135 |
|
---|
136 | MemMap = DevPath;
|
---|
137 | UefiDevicePathLibCatPrint (
|
---|
138 | Str,
|
---|
139 | L"MemoryMapped(0x%x,0x%lx,0x%lx)",
|
---|
140 | MemMap->MemoryType,
|
---|
141 | MemMap->StartingAddress,
|
---|
142 | MemMap->EndingAddress
|
---|
143 | );
|
---|
144 | }
|
---|
145 |
|
---|
146 | /**
|
---|
147 | Converts a Vendor device path structure to its string representative.
|
---|
148 |
|
---|
149 | @param Str The string representative of input device.
|
---|
150 | @param DevPath The input device path structure.
|
---|
151 | @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
|
---|
152 | of the display node is used, where applicable. If DisplayOnly
|
---|
153 | is FALSE, then the longer text representation of the display node
|
---|
154 | is used.
|
---|
155 | @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
|
---|
156 | representation for a device node can be used, where applicable.
|
---|
157 |
|
---|
158 | **/
|
---|
159 | VOID
|
---|
160 | DevPathToTextVendor (
|
---|
161 | IN OUT POOL_PRINT *Str,
|
---|
162 | IN VOID *DevPath,
|
---|
163 | IN BOOLEAN DisplayOnly,
|
---|
164 | IN BOOLEAN AllowShortcuts
|
---|
165 | )
|
---|
166 | {
|
---|
167 | VENDOR_DEVICE_PATH *Vendor;
|
---|
168 | CHAR16 *Type;
|
---|
169 | UINTN Index;
|
---|
170 | UINTN DataLength;
|
---|
171 | UINT32 FlowControlMap;
|
---|
172 | UINT16 Info;
|
---|
173 |
|
---|
174 | Vendor = (VENDOR_DEVICE_PATH *)DevPath;
|
---|
175 | switch (DevicePathType (&Vendor->Header)) {
|
---|
176 | case HARDWARE_DEVICE_PATH:
|
---|
177 | Type = L"Hw";
|
---|
178 | break;
|
---|
179 |
|
---|
180 | case MESSAGING_DEVICE_PATH:
|
---|
181 | Type = L"Msg";
|
---|
182 | if (AllowShortcuts) {
|
---|
183 | if (CompareGuid (&Vendor->Guid, &gEfiPcAnsiGuid)) {
|
---|
184 | UefiDevicePathLibCatPrint (Str, L"VenPcAnsi()");
|
---|
185 | return;
|
---|
186 | } else if (CompareGuid (&Vendor->Guid, &gEfiVT100Guid)) {
|
---|
187 | UefiDevicePathLibCatPrint (Str, L"VenVt100()");
|
---|
188 | return;
|
---|
189 | } else if (CompareGuid (&Vendor->Guid, &gEfiVT100PlusGuid)) {
|
---|
190 | UefiDevicePathLibCatPrint (Str, L"VenVt100Plus()");
|
---|
191 | return;
|
---|
192 | } else if (CompareGuid (&Vendor->Guid, &gEfiVTUTF8Guid)) {
|
---|
193 | UefiDevicePathLibCatPrint (Str, L"VenUtf8()");
|
---|
194 | return;
|
---|
195 | } else if (CompareGuid (&Vendor->Guid, &gEfiUartDevicePathGuid)) {
|
---|
196 | FlowControlMap = (((UART_FLOW_CONTROL_DEVICE_PATH *)Vendor)->FlowControlMap);
|
---|
197 | switch (FlowControlMap & 0x00000003) {
|
---|
198 | case 0:
|
---|
199 | UefiDevicePathLibCatPrint (Str, L"UartFlowCtrl(%s)", L"None");
|
---|
200 | break;
|
---|
201 |
|
---|
202 | case 1:
|
---|
203 | UefiDevicePathLibCatPrint (Str, L"UartFlowCtrl(%s)", L"Hardware");
|
---|
204 | break;
|
---|
205 |
|
---|
206 | case 2:
|
---|
207 | UefiDevicePathLibCatPrint (Str, L"UartFlowCtrl(%s)", L"XonXoff");
|
---|
208 | break;
|
---|
209 |
|
---|
210 | default:
|
---|
211 | break;
|
---|
212 | }
|
---|
213 |
|
---|
214 | return;
|
---|
215 | } else if (CompareGuid (&Vendor->Guid, &gEfiSasDevicePathGuid)) {
|
---|
216 | UefiDevicePathLibCatPrint (
|
---|
217 | Str,
|
---|
218 | L"SAS(0x%lx,0x%lx,0x%x,",
|
---|
219 | ((SAS_DEVICE_PATH *)Vendor)->SasAddress,
|
---|
220 | ((SAS_DEVICE_PATH *)Vendor)->Lun,
|
---|
221 | ((SAS_DEVICE_PATH *)Vendor)->RelativeTargetPort
|
---|
222 | );
|
---|
223 | Info = (((SAS_DEVICE_PATH *)Vendor)->DeviceTopology);
|
---|
224 | if (((Info & 0x0f) == 0) && ((Info & BIT7) == 0)) {
|
---|
225 | UefiDevicePathLibCatPrint (Str, L"NoTopology,0,0,0,");
|
---|
226 | } else if (((Info & 0x0f) <= 2) && ((Info & BIT7) == 0)) {
|
---|
227 | UefiDevicePathLibCatPrint (
|
---|
228 | Str,
|
---|
229 | L"%s,%s,%s,",
|
---|
230 | ((Info & BIT4) != 0) ? L"SATA" : L"SAS",
|
---|
231 | ((Info & BIT5) != 0) ? L"External" : L"Internal",
|
---|
232 | ((Info & BIT6) != 0) ? L"Expanded" : L"Direct"
|
---|
233 | );
|
---|
234 | if ((Info & 0x0f) == 1) {
|
---|
235 | UefiDevicePathLibCatPrint (Str, L"0,");
|
---|
236 | } else {
|
---|
237 | //
|
---|
238 | // Value 0x0 thru 0xFF -> Drive 1 thru Drive 256
|
---|
239 | //
|
---|
240 | UefiDevicePathLibCatPrint (Str, L"0x%x,", ((Info >> 8) & 0xff) + 1);
|
---|
241 | }
|
---|
242 | } else {
|
---|
243 | UefiDevicePathLibCatPrint (Str, L"0x%x,0,0,0,", Info);
|
---|
244 | }
|
---|
245 |
|
---|
246 | UefiDevicePathLibCatPrint (Str, L"0x%x)", ((SAS_DEVICE_PATH *)Vendor)->Reserved);
|
---|
247 | return;
|
---|
248 | } else if (CompareGuid (&Vendor->Guid, &gEfiDebugPortProtocolGuid)) {
|
---|
249 | UefiDevicePathLibCatPrint (Str, L"DebugPort()");
|
---|
250 | return;
|
---|
251 | }
|
---|
252 | }
|
---|
253 |
|
---|
254 | break;
|
---|
255 |
|
---|
256 | case MEDIA_DEVICE_PATH:
|
---|
257 | Type = L"Media";
|
---|
258 | break;
|
---|
259 |
|
---|
260 | default:
|
---|
261 | Type = L"?";
|
---|
262 | break;
|
---|
263 | }
|
---|
264 |
|
---|
265 | DataLength = DevicePathNodeLength (&Vendor->Header) - sizeof (VENDOR_DEVICE_PATH);
|
---|
266 | UefiDevicePathLibCatPrint (Str, L"Ven%s(%g", Type, &Vendor->Guid);
|
---|
267 | if (DataLength != 0) {
|
---|
268 | UefiDevicePathLibCatPrint (Str, L",");
|
---|
269 | for (Index = 0; Index < DataLength; Index++) {
|
---|
270 | UefiDevicePathLibCatPrint (Str, L"%02x", ((VENDOR_DEVICE_PATH_WITH_DATA *)Vendor)->VendorDefinedData[Index]);
|
---|
271 | }
|
---|
272 | }
|
---|
273 |
|
---|
274 | UefiDevicePathLibCatPrint (Str, L")");
|
---|
275 | }
|
---|
276 |
|
---|
277 | /**
|
---|
278 | Converts a Controller device path structure to its string representative.
|
---|
279 |
|
---|
280 | @param Str The string representative of input device.
|
---|
281 | @param DevPath The input device path structure.
|
---|
282 | @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
|
---|
283 | of the display node is used, where applicable. If DisplayOnly
|
---|
284 | is FALSE, then the longer text representation of the display node
|
---|
285 | is used.
|
---|
286 | @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
|
---|
287 | representation for a device node can be used, where applicable.
|
---|
288 |
|
---|
289 | **/
|
---|
290 | VOID
|
---|
291 | DevPathToTextController (
|
---|
292 | IN OUT POOL_PRINT *Str,
|
---|
293 | IN VOID *DevPath,
|
---|
294 | IN BOOLEAN DisplayOnly,
|
---|
295 | IN BOOLEAN AllowShortcuts
|
---|
296 | )
|
---|
297 | {
|
---|
298 | CONTROLLER_DEVICE_PATH *Controller;
|
---|
299 |
|
---|
300 | Controller = DevPath;
|
---|
301 | UefiDevicePathLibCatPrint (
|
---|
302 | Str,
|
---|
303 | L"Ctrl(0x%x)",
|
---|
304 | Controller->ControllerNumber
|
---|
305 | );
|
---|
306 | }
|
---|
307 |
|
---|
308 | /**
|
---|
309 | Converts a BMC device path structure to its string representative.
|
---|
310 |
|
---|
311 | @param Str The string representative of input device.
|
---|
312 | @param DevPath The input device path structure.
|
---|
313 | @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
|
---|
314 | of the display node is used, where applicable. If DisplayOnly
|
---|
315 | is FALSE, then the longer text representation of the display node
|
---|
316 | is used.
|
---|
317 | @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
|
---|
318 | representation for a device node can be used, where applicable.
|
---|
319 |
|
---|
320 | **/
|
---|
321 | VOID
|
---|
322 | DevPathToTextBmc (
|
---|
323 | IN OUT POOL_PRINT *Str,
|
---|
324 | IN VOID *DevPath,
|
---|
325 | IN BOOLEAN DisplayOnly,
|
---|
326 | IN BOOLEAN AllowShortcuts
|
---|
327 | )
|
---|
328 | {
|
---|
329 | BMC_DEVICE_PATH *Bmc;
|
---|
330 |
|
---|
331 | Bmc = DevPath;
|
---|
332 | UefiDevicePathLibCatPrint (
|
---|
333 | Str,
|
---|
334 | L"BMC(0x%x,0x%lx)",
|
---|
335 | Bmc->InterfaceType,
|
---|
336 | ReadUnaligned64 ((UINT64 *)(&Bmc->BaseAddress))
|
---|
337 | );
|
---|
338 | }
|
---|
339 |
|
---|
340 | /**
|
---|
341 | Converts a ACPI device path structure to its string representative.
|
---|
342 |
|
---|
343 | @param Str The string representative of input device.
|
---|
344 | @param DevPath The input device path structure.
|
---|
345 | @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
|
---|
346 | of the display node is used, where applicable. If DisplayOnly
|
---|
347 | is FALSE, then the longer text representation of the display node
|
---|
348 | is used.
|
---|
349 | @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
|
---|
350 | representation for a device node can be used, where applicable.
|
---|
351 |
|
---|
352 | **/
|
---|
353 | VOID
|
---|
354 | DevPathToTextAcpi (
|
---|
355 | IN OUT POOL_PRINT *Str,
|
---|
356 | IN VOID *DevPath,
|
---|
357 | IN BOOLEAN DisplayOnly,
|
---|
358 | IN BOOLEAN AllowShortcuts
|
---|
359 | )
|
---|
360 | {
|
---|
361 | ACPI_HID_DEVICE_PATH *Acpi;
|
---|
362 |
|
---|
363 | Acpi = DevPath;
|
---|
364 | if ((Acpi->HID & PNP_EISA_ID_MASK) == PNP_EISA_ID_CONST) {
|
---|
365 | switch (EISA_ID_TO_NUM (Acpi->HID)) {
|
---|
366 | case 0x0a03:
|
---|
367 | UefiDevicePathLibCatPrint (Str, L"PciRoot(0x%x)", Acpi->UID);
|
---|
368 | break;
|
---|
369 |
|
---|
370 | case 0x0a08:
|
---|
371 | UefiDevicePathLibCatPrint (Str, L"PcieRoot(0x%x)", Acpi->UID);
|
---|
372 | break;
|
---|
373 |
|
---|
374 | case 0x0604:
|
---|
375 | UefiDevicePathLibCatPrint (Str, L"Floppy(0x%x)", Acpi->UID);
|
---|
376 | break;
|
---|
377 |
|
---|
378 | case 0x0301:
|
---|
379 | UefiDevicePathLibCatPrint (Str, L"Keyboard(0x%x)", Acpi->UID);
|
---|
380 | break;
|
---|
381 |
|
---|
382 | case 0x0501:
|
---|
383 | UefiDevicePathLibCatPrint (Str, L"Serial(0x%x)", Acpi->UID);
|
---|
384 | break;
|
---|
385 |
|
---|
386 | case 0x0401:
|
---|
387 | UefiDevicePathLibCatPrint (Str, L"ParallelPort(0x%x)", Acpi->UID);
|
---|
388 | break;
|
---|
389 |
|
---|
390 | default:
|
---|
391 | UefiDevicePathLibCatPrint (Str, L"Acpi(PNP%04x,0x%x)", EISA_ID_TO_NUM (Acpi->HID), Acpi->UID);
|
---|
392 | break;
|
---|
393 | }
|
---|
394 | } else {
|
---|
395 | UefiDevicePathLibCatPrint (Str, L"Acpi(0x%08x,0x%x)", Acpi->HID, Acpi->UID);
|
---|
396 | }
|
---|
397 | }
|
---|
398 |
|
---|
399 | /**
|
---|
400 | Converts a ACPI extended HID device path structure to its string representative.
|
---|
401 |
|
---|
402 | @param Str The string representative of input device.
|
---|
403 | @param DevPath The input device path structure.
|
---|
404 | @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
|
---|
405 | of the display node is used, where applicable. If DisplayOnly
|
---|
406 | is FALSE, then the longer text representation of the display node
|
---|
407 | is used.
|
---|
408 | @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
|
---|
409 | representation for a device node can be used, where applicable.
|
---|
410 |
|
---|
411 | **/
|
---|
412 | VOID
|
---|
413 | DevPathToTextAcpiEx (
|
---|
414 | IN OUT POOL_PRINT *Str,
|
---|
415 | IN VOID *DevPath,
|
---|
416 | IN BOOLEAN DisplayOnly,
|
---|
417 | IN BOOLEAN AllowShortcuts
|
---|
418 | )
|
---|
419 | {
|
---|
420 | ACPI_EXTENDED_HID_DEVICE_PATH *AcpiEx;
|
---|
421 | CHAR8 *HIDStr;
|
---|
422 | CHAR8 *UIDStr;
|
---|
423 | CHAR8 *CIDStr;
|
---|
424 | CHAR16 HIDText[11];
|
---|
425 | CHAR16 CIDText[11];
|
---|
426 |
|
---|
427 | AcpiEx = DevPath;
|
---|
428 | HIDStr = (CHAR8 *)(((UINT8 *)AcpiEx) + sizeof (ACPI_EXTENDED_HID_DEVICE_PATH));
|
---|
429 | UIDStr = HIDStr + AsciiStrLen (HIDStr) + 1;
|
---|
430 | CIDStr = UIDStr + AsciiStrLen (UIDStr) + 1;
|
---|
431 |
|
---|
432 | if (DisplayOnly) {
|
---|
433 | if ((EISA_ID_TO_NUM (AcpiEx->HID) == 0x0A03) ||
|
---|
434 | ((EISA_ID_TO_NUM (AcpiEx->CID) == 0x0A03) && (EISA_ID_TO_NUM (AcpiEx->HID) != 0x0A08)))
|
---|
435 | {
|
---|
436 | if (AcpiEx->UID == 0) {
|
---|
437 | UefiDevicePathLibCatPrint (Str, L"PciRoot(%a)", UIDStr);
|
---|
438 | } else {
|
---|
439 | UefiDevicePathLibCatPrint (Str, L"PciRoot(0x%x)", AcpiEx->UID);
|
---|
440 | }
|
---|
441 |
|
---|
442 | return;
|
---|
443 | }
|
---|
444 |
|
---|
445 | if ((EISA_ID_TO_NUM (AcpiEx->HID) == 0x0A08) || (EISA_ID_TO_NUM (AcpiEx->CID) == 0x0A08)) {
|
---|
446 | if (AcpiEx->UID == 0) {
|
---|
447 | UefiDevicePathLibCatPrint (Str, L"PcieRoot(%a)", UIDStr);
|
---|
448 | } else {
|
---|
449 | UefiDevicePathLibCatPrint (Str, L"PcieRoot(0x%x)", AcpiEx->UID);
|
---|
450 | }
|
---|
451 |
|
---|
452 | return;
|
---|
453 | }
|
---|
454 | }
|
---|
455 |
|
---|
456 | //
|
---|
457 | // Converts EISA identification to string.
|
---|
458 | //
|
---|
459 | UnicodeSPrint (
|
---|
460 | HIDText,
|
---|
461 | sizeof (HIDText),
|
---|
462 | L"%c%c%c%04X",
|
---|
463 | ((AcpiEx->HID >> 10) & 0x1f) + 'A' - 1,
|
---|
464 | ((AcpiEx->HID >> 5) & 0x1f) + 'A' - 1,
|
---|
465 | ((AcpiEx->HID >> 0) & 0x1f) + 'A' - 1,
|
---|
466 | (AcpiEx->HID >> 16) & 0xFFFF
|
---|
467 | );
|
---|
468 | UnicodeSPrint (
|
---|
469 | CIDText,
|
---|
470 | sizeof (CIDText),
|
---|
471 | L"%c%c%c%04X",
|
---|
472 | ((AcpiEx->CID >> 10) & 0x1f) + 'A' - 1,
|
---|
473 | ((AcpiEx->CID >> 5) & 0x1f) + 'A' - 1,
|
---|
474 | ((AcpiEx->CID >> 0) & 0x1f) + 'A' - 1,
|
---|
475 | (AcpiEx->CID >> 16) & 0xFFFF
|
---|
476 | );
|
---|
477 |
|
---|
478 | if ((*HIDStr == '\0') && (*CIDStr == '\0') && (*UIDStr != '\0')) {
|
---|
479 | //
|
---|
480 | // use AcpiExp()
|
---|
481 | //
|
---|
482 | if (AcpiEx->CID == 0) {
|
---|
483 | UefiDevicePathLibCatPrint (
|
---|
484 | Str,
|
---|
485 | L"AcpiExp(%s,0,%a)",
|
---|
486 | HIDText,
|
---|
487 | UIDStr
|
---|
488 | );
|
---|
489 | } else {
|
---|
490 | UefiDevicePathLibCatPrint (
|
---|
491 | Str,
|
---|
492 | L"AcpiExp(%s,%s,%a)",
|
---|
493 | HIDText,
|
---|
494 | CIDText,
|
---|
495 | UIDStr
|
---|
496 | );
|
---|
497 | }
|
---|
498 | } else {
|
---|
499 | if (DisplayOnly) {
|
---|
500 | //
|
---|
501 | // display only
|
---|
502 | //
|
---|
503 | if (AcpiEx->HID == 0) {
|
---|
504 | UefiDevicePathLibCatPrint (Str, L"AcpiEx(%a,", HIDStr);
|
---|
505 | } else {
|
---|
506 | UefiDevicePathLibCatPrint (Str, L"AcpiEx(%s,", HIDText);
|
---|
507 | }
|
---|
508 |
|
---|
509 | if (AcpiEx->CID == 0) {
|
---|
510 | UefiDevicePathLibCatPrint (Str, L"%a,", CIDStr);
|
---|
511 | } else {
|
---|
512 | UefiDevicePathLibCatPrint (Str, L"%s,", CIDText);
|
---|
513 | }
|
---|
514 |
|
---|
515 | if (AcpiEx->UID == 0) {
|
---|
516 | UefiDevicePathLibCatPrint (Str, L"%a)", UIDStr);
|
---|
517 | } else {
|
---|
518 | UefiDevicePathLibCatPrint (Str, L"0x%x)", AcpiEx->UID);
|
---|
519 | }
|
---|
520 | } else {
|
---|
521 | UefiDevicePathLibCatPrint (
|
---|
522 | Str,
|
---|
523 | L"AcpiEx(%s,%s,0x%x,%a,%a,%a)",
|
---|
524 | HIDText,
|
---|
525 | CIDText,
|
---|
526 | AcpiEx->UID,
|
---|
527 | HIDStr,
|
---|
528 | CIDStr,
|
---|
529 | UIDStr
|
---|
530 | );
|
---|
531 | }
|
---|
532 | }
|
---|
533 | }
|
---|
534 |
|
---|
535 | /**
|
---|
536 | Converts a ACPI address device path structure to its string representative.
|
---|
537 |
|
---|
538 | @param Str The string representative of input device.
|
---|
539 | @param DevPath The input device path structure.
|
---|
540 | @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
|
---|
541 | of the display node is used, where applicable. If DisplayOnly
|
---|
542 | is FALSE, then the longer text representation of the display node
|
---|
543 | is used.
|
---|
544 | @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
|
---|
545 | representation for a device node can be used, where applicable.
|
---|
546 |
|
---|
547 | **/
|
---|
548 | VOID
|
---|
549 | DevPathToTextAcpiAdr (
|
---|
550 | IN OUT POOL_PRINT *Str,
|
---|
551 | IN VOID *DevPath,
|
---|
552 | IN BOOLEAN DisplayOnly,
|
---|
553 | IN BOOLEAN AllowShortcuts
|
---|
554 | )
|
---|
555 | {
|
---|
556 | ACPI_ADR_DEVICE_PATH *AcpiAdr;
|
---|
557 | UINT16 Index;
|
---|
558 | UINT16 Length;
|
---|
559 | UINT16 AdditionalAdrCount;
|
---|
560 |
|
---|
561 | AcpiAdr = DevPath;
|
---|
562 | Length = (UINT16)DevicePathNodeLength ((EFI_DEVICE_PATH_PROTOCOL *)AcpiAdr);
|
---|
563 | AdditionalAdrCount = (UINT16)((Length - 8) / 4);
|
---|
564 |
|
---|
565 | UefiDevicePathLibCatPrint (Str, L"AcpiAdr(0x%x", AcpiAdr->ADR);
|
---|
566 | for (Index = 0; Index < AdditionalAdrCount; Index++) {
|
---|
567 | UefiDevicePathLibCatPrint (Str, L",0x%x", *(UINT32 *)((UINT8 *)AcpiAdr + 8 + Index * 4));
|
---|
568 | }
|
---|
569 |
|
---|
570 | UefiDevicePathLibCatPrint (Str, L")");
|
---|
571 | }
|
---|
572 |
|
---|
573 | /**
|
---|
574 | Converts a ATAPI device path structure to its string representative.
|
---|
575 |
|
---|
576 | @param Str The string representative of input device.
|
---|
577 | @param DevPath The input device path structure.
|
---|
578 | @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
|
---|
579 | of the display node is used, where applicable. If DisplayOnly
|
---|
580 | is FALSE, then the longer text representation of the display node
|
---|
581 | is used.
|
---|
582 | @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
|
---|
583 | representation for a device node can be used, where applicable.
|
---|
584 |
|
---|
585 | **/
|
---|
586 | VOID
|
---|
587 | DevPathToTextAtapi (
|
---|
588 | IN OUT POOL_PRINT *Str,
|
---|
589 | IN VOID *DevPath,
|
---|
590 | IN BOOLEAN DisplayOnly,
|
---|
591 | IN BOOLEAN AllowShortcuts
|
---|
592 | )
|
---|
593 | {
|
---|
594 | ATAPI_DEVICE_PATH *Atapi;
|
---|
595 |
|
---|
596 | Atapi = DevPath;
|
---|
597 |
|
---|
598 | if (DisplayOnly) {
|
---|
599 | UefiDevicePathLibCatPrint (Str, L"Ata(0x%x)", Atapi->Lun);
|
---|
600 | } else {
|
---|
601 | UefiDevicePathLibCatPrint (
|
---|
602 | Str,
|
---|
603 | L"Ata(%s,%s,0x%x)",
|
---|
604 | (Atapi->PrimarySecondary == 1) ? L"Secondary" : L"Primary",
|
---|
605 | (Atapi->SlaveMaster == 1) ? L"Slave" : L"Master",
|
---|
606 | Atapi->Lun
|
---|
607 | );
|
---|
608 | }
|
---|
609 | }
|
---|
610 |
|
---|
611 | /**
|
---|
612 | Converts a SCSI device path structure to its string representative.
|
---|
613 |
|
---|
614 | @param Str The string representative of input device.
|
---|
615 | @param DevPath The input device path structure.
|
---|
616 | @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
|
---|
617 | of the display node is used, where applicable. If DisplayOnly
|
---|
618 | is FALSE, then the longer text representation of the display node
|
---|
619 | is used.
|
---|
620 | @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
|
---|
621 | representation for a device node can be used, where applicable.
|
---|
622 |
|
---|
623 | **/
|
---|
624 | VOID
|
---|
625 | DevPathToTextScsi (
|
---|
626 | IN OUT POOL_PRINT *Str,
|
---|
627 | IN VOID *DevPath,
|
---|
628 | IN BOOLEAN DisplayOnly,
|
---|
629 | IN BOOLEAN AllowShortcuts
|
---|
630 | )
|
---|
631 | {
|
---|
632 | SCSI_DEVICE_PATH *Scsi;
|
---|
633 |
|
---|
634 | Scsi = DevPath;
|
---|
635 | UefiDevicePathLibCatPrint (Str, L"Scsi(0x%x,0x%x)", Scsi->Pun, Scsi->Lun);
|
---|
636 | }
|
---|
637 |
|
---|
638 | /**
|
---|
639 | Converts a Fibre device path structure to its string representative.
|
---|
640 |
|
---|
641 | @param Str The string representative of input device.
|
---|
642 | @param DevPath The input device path structure.
|
---|
643 | @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
|
---|
644 | of the display node is used, where applicable. If DisplayOnly
|
---|
645 | is FALSE, then the longer text representation of the display node
|
---|
646 | is used.
|
---|
647 | @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
|
---|
648 | representation for a device node can be used, where applicable.
|
---|
649 |
|
---|
650 | **/
|
---|
651 | VOID
|
---|
652 | DevPathToTextFibre (
|
---|
653 | IN OUT POOL_PRINT *Str,
|
---|
654 | IN VOID *DevPath,
|
---|
655 | IN BOOLEAN DisplayOnly,
|
---|
656 | IN BOOLEAN AllowShortcuts
|
---|
657 | )
|
---|
658 | {
|
---|
659 | FIBRECHANNEL_DEVICE_PATH *Fibre;
|
---|
660 |
|
---|
661 | Fibre = DevPath;
|
---|
662 | UefiDevicePathLibCatPrint (Str, L"Fibre(0x%lx,0x%lx)", Fibre->WWN, Fibre->Lun);
|
---|
663 | }
|
---|
664 |
|
---|
665 | /**
|
---|
666 | Converts a FibreEx device path structure to its string representative.
|
---|
667 |
|
---|
668 | @param Str The string representative of input device.
|
---|
669 | @param DevPath The input device path structure.
|
---|
670 | @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
|
---|
671 | of the display node is used, where applicable. If DisplayOnly
|
---|
672 | is FALSE, then the longer text representation of the display node
|
---|
673 | is used.
|
---|
674 | @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
|
---|
675 | representation for a device node can be used, where applicable.
|
---|
676 |
|
---|
677 | **/
|
---|
678 | VOID
|
---|
679 | DevPathToTextFibreEx (
|
---|
680 | IN OUT POOL_PRINT *Str,
|
---|
681 | IN VOID *DevPath,
|
---|
682 | IN BOOLEAN DisplayOnly,
|
---|
683 | IN BOOLEAN AllowShortcuts
|
---|
684 | )
|
---|
685 | {
|
---|
686 | FIBRECHANNELEX_DEVICE_PATH *FibreEx;
|
---|
687 | UINTN Index;
|
---|
688 |
|
---|
689 | FibreEx = DevPath;
|
---|
690 | UefiDevicePathLibCatPrint (Str, L"FibreEx(0x");
|
---|
691 | for (Index = 0; Index < sizeof (FibreEx->WWN) / sizeof (FibreEx->WWN[0]); Index++) {
|
---|
692 | UefiDevicePathLibCatPrint (Str, L"%02x", FibreEx->WWN[Index]);
|
---|
693 | }
|
---|
694 |
|
---|
695 | UefiDevicePathLibCatPrint (Str, L",0x");
|
---|
696 | for (Index = 0; Index < sizeof (FibreEx->Lun) / sizeof (FibreEx->Lun[0]); Index++) {
|
---|
697 | UefiDevicePathLibCatPrint (Str, L"%02x", FibreEx->Lun[Index]);
|
---|
698 | }
|
---|
699 |
|
---|
700 | UefiDevicePathLibCatPrint (Str, L")");
|
---|
701 | }
|
---|
702 |
|
---|
703 | /**
|
---|
704 | Converts a Sas Ex device path structure to its string representative.
|
---|
705 |
|
---|
706 | @param Str The string representative of input device.
|
---|
707 | @param DevPath The input device path structure.
|
---|
708 | @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
|
---|
709 | of the display node is used, where applicable. If DisplayOnly
|
---|
710 | is FALSE, then the longer text representation of the display node
|
---|
711 | is used.
|
---|
712 | @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
|
---|
713 | representation for a device node can be used, where applicable.
|
---|
714 |
|
---|
715 | **/
|
---|
716 | VOID
|
---|
717 | DevPathToTextSasEx (
|
---|
718 | IN OUT POOL_PRINT *Str,
|
---|
719 | IN VOID *DevPath,
|
---|
720 | IN BOOLEAN DisplayOnly,
|
---|
721 | IN BOOLEAN AllowShortcuts
|
---|
722 | )
|
---|
723 | {
|
---|
724 | SASEX_DEVICE_PATH *SasEx;
|
---|
725 | UINTN Index;
|
---|
726 |
|
---|
727 | SasEx = DevPath;
|
---|
728 | UefiDevicePathLibCatPrint (Str, L"SasEx(0x");
|
---|
729 |
|
---|
730 | for (Index = 0; Index < sizeof (SasEx->SasAddress) / sizeof (SasEx->SasAddress[0]); Index++) {
|
---|
731 | UefiDevicePathLibCatPrint (Str, L"%02x", SasEx->SasAddress[Index]);
|
---|
732 | }
|
---|
733 |
|
---|
734 | UefiDevicePathLibCatPrint (Str, L",0x");
|
---|
735 | for (Index = 0; Index < sizeof (SasEx->Lun) / sizeof (SasEx->Lun[0]); Index++) {
|
---|
736 | UefiDevicePathLibCatPrint (Str, L"%02x", SasEx->Lun[Index]);
|
---|
737 | }
|
---|
738 |
|
---|
739 | UefiDevicePathLibCatPrint (Str, L",0x%x,", SasEx->RelativeTargetPort);
|
---|
740 |
|
---|
741 | if (((SasEx->DeviceTopology & 0x0f) == 0) && ((SasEx->DeviceTopology & BIT7) == 0)) {
|
---|
742 | UefiDevicePathLibCatPrint (Str, L"NoTopology,0,0,0");
|
---|
743 | } else if (((SasEx->DeviceTopology & 0x0f) <= 2) && ((SasEx->DeviceTopology & BIT7) == 0)) {
|
---|
744 | UefiDevicePathLibCatPrint (
|
---|
745 | Str,
|
---|
746 | L"%s,%s,%s,",
|
---|
747 | ((SasEx->DeviceTopology & BIT4) != 0) ? L"SATA" : L"SAS",
|
---|
748 | ((SasEx->DeviceTopology & BIT5) != 0) ? L"External" : L"Internal",
|
---|
749 | ((SasEx->DeviceTopology & BIT6) != 0) ? L"Expanded" : L"Direct"
|
---|
750 | );
|
---|
751 | if ((SasEx->DeviceTopology & 0x0f) == 1) {
|
---|
752 | UefiDevicePathLibCatPrint (Str, L"0");
|
---|
753 | } else {
|
---|
754 | //
|
---|
755 | // Value 0x0 thru 0xFF -> Drive 1 thru Drive 256
|
---|
756 | //
|
---|
757 | UefiDevicePathLibCatPrint (Str, L"0x%x", ((SasEx->DeviceTopology >> 8) & 0xff) + 1);
|
---|
758 | }
|
---|
759 | } else {
|
---|
760 | UefiDevicePathLibCatPrint (Str, L"0x%x,0,0,0", SasEx->DeviceTopology);
|
---|
761 | }
|
---|
762 |
|
---|
763 | UefiDevicePathLibCatPrint (Str, L")");
|
---|
764 | return;
|
---|
765 | }
|
---|
766 |
|
---|
767 | /**
|
---|
768 | Converts a NVM Express Namespace device path structure to its string representative.
|
---|
769 |
|
---|
770 | @param Str The string representative of input device.
|
---|
771 | @param DevPath The input device path structure.
|
---|
772 | @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
|
---|
773 | of the display node is used, where applicable. If DisplayOnly
|
---|
774 | is FALSE, then the longer text representation of the display node
|
---|
775 | is used.
|
---|
776 | @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
|
---|
777 | representation for a device node can be used, where applicable.
|
---|
778 |
|
---|
779 | **/
|
---|
780 | VOID
|
---|
781 | DevPathToTextNVMe (
|
---|
782 | IN OUT POOL_PRINT *Str,
|
---|
783 | IN VOID *DevPath,
|
---|
784 | IN BOOLEAN DisplayOnly,
|
---|
785 | IN BOOLEAN AllowShortcuts
|
---|
786 | )
|
---|
787 | {
|
---|
788 | NVME_NAMESPACE_DEVICE_PATH *Nvme;
|
---|
789 | UINT8 *Uuid;
|
---|
790 |
|
---|
791 | Nvme = DevPath;
|
---|
792 | Uuid = (UINT8 *)&Nvme->NamespaceUuid;
|
---|
793 | UefiDevicePathLibCatPrint (
|
---|
794 | Str,
|
---|
795 | L"NVMe(0x%x,%02x-%02x-%02x-%02x-%02x-%02x-%02x-%02x)",
|
---|
796 | Nvme->NamespaceId,
|
---|
797 | Uuid[7],
|
---|
798 | Uuid[6],
|
---|
799 | Uuid[5],
|
---|
800 | Uuid[4],
|
---|
801 | Uuid[3],
|
---|
802 | Uuid[2],
|
---|
803 | Uuid[1],
|
---|
804 | Uuid[0]
|
---|
805 | );
|
---|
806 | }
|
---|
807 |
|
---|
808 | /**
|
---|
809 | Converts a UFS device path structure to its string representative.
|
---|
810 |
|
---|
811 | @param Str The string representative of input device.
|
---|
812 | @param DevPath The input device path structure.
|
---|
813 | @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
|
---|
814 | of the display node is used, where applicable. If DisplayOnly
|
---|
815 | is FALSE, then the longer text representation of the display node
|
---|
816 | is used.
|
---|
817 | @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
|
---|
818 | representation for a device node can be used, where applicable.
|
---|
819 |
|
---|
820 | **/
|
---|
821 | VOID
|
---|
822 | DevPathToTextUfs (
|
---|
823 | IN OUT POOL_PRINT *Str,
|
---|
824 | IN VOID *DevPath,
|
---|
825 | IN BOOLEAN DisplayOnly,
|
---|
826 | IN BOOLEAN AllowShortcuts
|
---|
827 | )
|
---|
828 | {
|
---|
829 | UFS_DEVICE_PATH *Ufs;
|
---|
830 |
|
---|
831 | Ufs = DevPath;
|
---|
832 | UefiDevicePathLibCatPrint (Str, L"UFS(0x%x,0x%x)", Ufs->Pun, Ufs->Lun);
|
---|
833 | }
|
---|
834 |
|
---|
835 | /**
|
---|
836 | Converts a SD (Secure Digital) device path structure to its string representative.
|
---|
837 |
|
---|
838 | @param Str The string representative of input device.
|
---|
839 | @param DevPath The input device path structure.
|
---|
840 | @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
|
---|
841 | of the display node is used, where applicable. If DisplayOnly
|
---|
842 | is FALSE, then the longer text representation of the display node
|
---|
843 | is used.
|
---|
844 | @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
|
---|
845 | representation for a device node can be used, where applicable.
|
---|
846 |
|
---|
847 | **/
|
---|
848 | VOID
|
---|
849 | DevPathToTextSd (
|
---|
850 | IN OUT POOL_PRINT *Str,
|
---|
851 | IN VOID *DevPath,
|
---|
852 | IN BOOLEAN DisplayOnly,
|
---|
853 | IN BOOLEAN AllowShortcuts
|
---|
854 | )
|
---|
855 | {
|
---|
856 | SD_DEVICE_PATH *Sd;
|
---|
857 |
|
---|
858 | Sd = DevPath;
|
---|
859 | UefiDevicePathLibCatPrint (
|
---|
860 | Str,
|
---|
861 | L"SD(0x%x)",
|
---|
862 | Sd->SlotNumber
|
---|
863 | );
|
---|
864 | }
|
---|
865 |
|
---|
866 | /**
|
---|
867 | Converts a EMMC (Embedded MMC) device path structure to its string representative.
|
---|
868 |
|
---|
869 | @param Str The string representative of input device.
|
---|
870 | @param DevPath The input device path structure.
|
---|
871 | @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
|
---|
872 | of the display node is used, where applicable. If DisplayOnly
|
---|
873 | is FALSE, then the longer text representation of the display node
|
---|
874 | is used.
|
---|
875 | @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
|
---|
876 | representation for a device node can be used, where applicable.
|
---|
877 |
|
---|
878 | **/
|
---|
879 | VOID
|
---|
880 | DevPathToTextEmmc (
|
---|
881 | IN OUT POOL_PRINT *Str,
|
---|
882 | IN VOID *DevPath,
|
---|
883 | IN BOOLEAN DisplayOnly,
|
---|
884 | IN BOOLEAN AllowShortcuts
|
---|
885 | )
|
---|
886 | {
|
---|
887 | EMMC_DEVICE_PATH *Emmc;
|
---|
888 |
|
---|
889 | Emmc = DevPath;
|
---|
890 | UefiDevicePathLibCatPrint (
|
---|
891 | Str,
|
---|
892 | L"eMMC(0x%x)",
|
---|
893 | Emmc->SlotNumber
|
---|
894 | );
|
---|
895 | }
|
---|
896 |
|
---|
897 | /**
|
---|
898 | Converts a 1394 device path structure to its string representative.
|
---|
899 |
|
---|
900 | @param Str The string representative of input device.
|
---|
901 | @param DevPath The input device path structure.
|
---|
902 | @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
|
---|
903 | of the display node is used, where applicable. If DisplayOnly
|
---|
904 | is FALSE, then the longer text representation of the display node
|
---|
905 | is used.
|
---|
906 | @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
|
---|
907 | representation for a device node can be used, where applicable.
|
---|
908 |
|
---|
909 | **/
|
---|
910 | VOID
|
---|
911 | DevPathToText1394 (
|
---|
912 | IN OUT POOL_PRINT *Str,
|
---|
913 | IN VOID *DevPath,
|
---|
914 | IN BOOLEAN DisplayOnly,
|
---|
915 | IN BOOLEAN AllowShortcuts
|
---|
916 | )
|
---|
917 | {
|
---|
918 | F1394_DEVICE_PATH *F1394DevPath;
|
---|
919 |
|
---|
920 | F1394DevPath = DevPath;
|
---|
921 | //
|
---|
922 | // Guid has format of IEEE-EUI64
|
---|
923 | //
|
---|
924 | UefiDevicePathLibCatPrint (Str, L"I1394(%016lx)", F1394DevPath->Guid);
|
---|
925 | }
|
---|
926 |
|
---|
927 | /**
|
---|
928 | Converts a USB device path structure to its string representative.
|
---|
929 |
|
---|
930 | @param Str The string representative of input device.
|
---|
931 | @param DevPath The input device path structure.
|
---|
932 | @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
|
---|
933 | of the display node is used, where applicable. If DisplayOnly
|
---|
934 | is FALSE, then the longer text representation of the display node
|
---|
935 | is used.
|
---|
936 | @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
|
---|
937 | representation for a device node can be used, where applicable.
|
---|
938 |
|
---|
939 | **/
|
---|
940 | VOID
|
---|
941 | DevPathToTextUsb (
|
---|
942 | IN OUT POOL_PRINT *Str,
|
---|
943 | IN VOID *DevPath,
|
---|
944 | IN BOOLEAN DisplayOnly,
|
---|
945 | IN BOOLEAN AllowShortcuts
|
---|
946 | )
|
---|
947 | {
|
---|
948 | USB_DEVICE_PATH *Usb;
|
---|
949 |
|
---|
950 | Usb = DevPath;
|
---|
951 | UefiDevicePathLibCatPrint (Str, L"USB(0x%x,0x%x)", Usb->ParentPortNumber, Usb->InterfaceNumber);
|
---|
952 | }
|
---|
953 |
|
---|
954 | /**
|
---|
955 | Converts a USB WWID device path structure to its string representative.
|
---|
956 |
|
---|
957 | @param Str The string representative of input device.
|
---|
958 | @param DevPath The input device path structure.
|
---|
959 | @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
|
---|
960 | of the display node is used, where applicable. If DisplayOnly
|
---|
961 | is FALSE, then the longer text representation of the display node
|
---|
962 | is used.
|
---|
963 | @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
|
---|
964 | representation for a device node can be used, where applicable.
|
---|
965 |
|
---|
966 | **/
|
---|
967 | VOID
|
---|
968 | DevPathToTextUsbWWID (
|
---|
969 | IN OUT POOL_PRINT *Str,
|
---|
970 | IN VOID *DevPath,
|
---|
971 | IN BOOLEAN DisplayOnly,
|
---|
972 | IN BOOLEAN AllowShortcuts
|
---|
973 | )
|
---|
974 | {
|
---|
975 | USB_WWID_DEVICE_PATH *UsbWWId;
|
---|
976 | CHAR16 *SerialNumberStr;
|
---|
977 | CHAR16 *NewStr;
|
---|
978 | UINT16 Length;
|
---|
979 |
|
---|
980 | UsbWWId = DevPath;
|
---|
981 |
|
---|
982 | SerialNumberStr = (CHAR16 *)((UINT8 *)UsbWWId + sizeof (USB_WWID_DEVICE_PATH));
|
---|
983 | Length = (UINT16)((DevicePathNodeLength ((EFI_DEVICE_PATH_PROTOCOL *)UsbWWId) - sizeof (USB_WWID_DEVICE_PATH)) / sizeof (CHAR16));
|
---|
984 | if ((Length >= 1) && (SerialNumberStr[Length - 1] != 0)) {
|
---|
985 | //
|
---|
986 | // In case no NULL terminator in SerialNumber, create a new one with NULL terminator
|
---|
987 | //
|
---|
988 | NewStr = AllocateCopyPool ((Length + 1) * sizeof (CHAR16), SerialNumberStr);
|
---|
989 | ASSERT (NewStr != NULL);
|
---|
990 | NewStr[Length] = 0;
|
---|
991 | SerialNumberStr = NewStr;
|
---|
992 | }
|
---|
993 |
|
---|
994 | UefiDevicePathLibCatPrint (
|
---|
995 | Str,
|
---|
996 | L"UsbWwid(0x%x,0x%x,0x%x,\"%s\")",
|
---|
997 | UsbWWId->VendorId,
|
---|
998 | UsbWWId->ProductId,
|
---|
999 | UsbWWId->InterfaceNumber,
|
---|
1000 | SerialNumberStr
|
---|
1001 | );
|
---|
1002 | }
|
---|
1003 |
|
---|
1004 | /**
|
---|
1005 | Converts a Logic Unit device path structure to its string representative.
|
---|
1006 |
|
---|
1007 | @param Str The string representative of input device.
|
---|
1008 | @param DevPath The input device path structure.
|
---|
1009 | @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
|
---|
1010 | of the display node is used, where applicable. If DisplayOnly
|
---|
1011 | is FALSE, then the longer text representation of the display node
|
---|
1012 | is used.
|
---|
1013 | @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
|
---|
1014 | representation for a device node can be used, where applicable.
|
---|
1015 |
|
---|
1016 | **/
|
---|
1017 | VOID
|
---|
1018 | DevPathToTextLogicalUnit (
|
---|
1019 | IN OUT POOL_PRINT *Str,
|
---|
1020 | IN VOID *DevPath,
|
---|
1021 | IN BOOLEAN DisplayOnly,
|
---|
1022 | IN BOOLEAN AllowShortcuts
|
---|
1023 | )
|
---|
1024 | {
|
---|
1025 | DEVICE_LOGICAL_UNIT_DEVICE_PATH *LogicalUnit;
|
---|
1026 |
|
---|
1027 | LogicalUnit = DevPath;
|
---|
1028 | UefiDevicePathLibCatPrint (Str, L"Unit(0x%x)", LogicalUnit->Lun);
|
---|
1029 | }
|
---|
1030 |
|
---|
1031 | /**
|
---|
1032 | Converts a USB class device path structure to its string representative.
|
---|
1033 |
|
---|
1034 | @param Str The string representative of input device.
|
---|
1035 | @param DevPath The input device path structure.
|
---|
1036 | @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
|
---|
1037 | of the display node is used, where applicable. If DisplayOnly
|
---|
1038 | is FALSE, then the longer text representation of the display node
|
---|
1039 | is used.
|
---|
1040 | @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
|
---|
1041 | representation for a device node can be used, where applicable.
|
---|
1042 |
|
---|
1043 | **/
|
---|
1044 | VOID
|
---|
1045 | DevPathToTextUsbClass (
|
---|
1046 | IN OUT POOL_PRINT *Str,
|
---|
1047 | IN VOID *DevPath,
|
---|
1048 | IN BOOLEAN DisplayOnly,
|
---|
1049 | IN BOOLEAN AllowShortcuts
|
---|
1050 | )
|
---|
1051 | {
|
---|
1052 | USB_CLASS_DEVICE_PATH *UsbClass;
|
---|
1053 | BOOLEAN IsKnownSubClass;
|
---|
1054 |
|
---|
1055 | UsbClass = DevPath;
|
---|
1056 |
|
---|
1057 | IsKnownSubClass = TRUE;
|
---|
1058 | switch (UsbClass->DeviceClass) {
|
---|
1059 | case USB_CLASS_AUDIO:
|
---|
1060 | UefiDevicePathLibCatPrint (Str, L"UsbAudio");
|
---|
1061 | break;
|
---|
1062 |
|
---|
1063 | case USB_CLASS_CDCCONTROL:
|
---|
1064 | UefiDevicePathLibCatPrint (Str, L"UsbCDCControl");
|
---|
1065 | break;
|
---|
1066 |
|
---|
1067 | case USB_CLASS_HID:
|
---|
1068 | UefiDevicePathLibCatPrint (Str, L"UsbHID");
|
---|
1069 | break;
|
---|
1070 |
|
---|
1071 | case USB_CLASS_IMAGE:
|
---|
1072 | UefiDevicePathLibCatPrint (Str, L"UsbImage");
|
---|
1073 | break;
|
---|
1074 |
|
---|
1075 | case USB_CLASS_PRINTER:
|
---|
1076 | UefiDevicePathLibCatPrint (Str, L"UsbPrinter");
|
---|
1077 | break;
|
---|
1078 |
|
---|
1079 | case USB_CLASS_MASS_STORAGE:
|
---|
1080 | UefiDevicePathLibCatPrint (Str, L"UsbMassStorage");
|
---|
1081 | break;
|
---|
1082 |
|
---|
1083 | case USB_CLASS_HUB:
|
---|
1084 | UefiDevicePathLibCatPrint (Str, L"UsbHub");
|
---|
1085 | break;
|
---|
1086 |
|
---|
1087 | case USB_CLASS_CDCDATA:
|
---|
1088 | UefiDevicePathLibCatPrint (Str, L"UsbCDCData");
|
---|
1089 | break;
|
---|
1090 |
|
---|
1091 | case USB_CLASS_SMART_CARD:
|
---|
1092 | UefiDevicePathLibCatPrint (Str, L"UsbSmartCard");
|
---|
1093 | break;
|
---|
1094 |
|
---|
1095 | case USB_CLASS_VIDEO:
|
---|
1096 | UefiDevicePathLibCatPrint (Str, L"UsbVideo");
|
---|
1097 | break;
|
---|
1098 |
|
---|
1099 | case USB_CLASS_DIAGNOSTIC:
|
---|
1100 | UefiDevicePathLibCatPrint (Str, L"UsbDiagnostic");
|
---|
1101 | break;
|
---|
1102 |
|
---|
1103 | case USB_CLASS_WIRELESS:
|
---|
1104 | UefiDevicePathLibCatPrint (Str, L"UsbWireless");
|
---|
1105 | break;
|
---|
1106 |
|
---|
1107 | default:
|
---|
1108 | IsKnownSubClass = FALSE;
|
---|
1109 | break;
|
---|
1110 | }
|
---|
1111 |
|
---|
1112 | if (IsKnownSubClass) {
|
---|
1113 | UefiDevicePathLibCatPrint (
|
---|
1114 | Str,
|
---|
1115 | L"(0x%x,0x%x,0x%x,0x%x)",
|
---|
1116 | UsbClass->VendorId,
|
---|
1117 | UsbClass->ProductId,
|
---|
1118 | UsbClass->DeviceSubClass,
|
---|
1119 | UsbClass->DeviceProtocol
|
---|
1120 | );
|
---|
1121 | return;
|
---|
1122 | }
|
---|
1123 |
|
---|
1124 | if (UsbClass->DeviceClass == USB_CLASS_RESERVE) {
|
---|
1125 | if (UsbClass->DeviceSubClass == USB_SUBCLASS_FW_UPDATE) {
|
---|
1126 | UefiDevicePathLibCatPrint (
|
---|
1127 | Str,
|
---|
1128 | L"UsbDeviceFirmwareUpdate(0x%x,0x%x,0x%x)",
|
---|
1129 | UsbClass->VendorId,
|
---|
1130 | UsbClass->ProductId,
|
---|
1131 | UsbClass->DeviceProtocol
|
---|
1132 | );
|
---|
1133 | return;
|
---|
1134 | } else if (UsbClass->DeviceSubClass == USB_SUBCLASS_IRDA_BRIDGE) {
|
---|
1135 | UefiDevicePathLibCatPrint (
|
---|
1136 | Str,
|
---|
1137 | L"UsbIrdaBridge(0x%x,0x%x,0x%x)",
|
---|
1138 | UsbClass->VendorId,
|
---|
1139 | UsbClass->ProductId,
|
---|
1140 | UsbClass->DeviceProtocol
|
---|
1141 | );
|
---|
1142 | return;
|
---|
1143 | } else if (UsbClass->DeviceSubClass == USB_SUBCLASS_TEST) {
|
---|
1144 | UefiDevicePathLibCatPrint (
|
---|
1145 | Str,
|
---|
1146 | L"UsbTestAndMeasurement(0x%x,0x%x,0x%x)",
|
---|
1147 | UsbClass->VendorId,
|
---|
1148 | UsbClass->ProductId,
|
---|
1149 | UsbClass->DeviceProtocol
|
---|
1150 | );
|
---|
1151 | return;
|
---|
1152 | }
|
---|
1153 | }
|
---|
1154 |
|
---|
1155 | UefiDevicePathLibCatPrint (
|
---|
1156 | Str,
|
---|
1157 | L"UsbClass(0x%x,0x%x,0x%x,0x%x,0x%x)",
|
---|
1158 | UsbClass->VendorId,
|
---|
1159 | UsbClass->ProductId,
|
---|
1160 | UsbClass->DeviceClass,
|
---|
1161 | UsbClass->DeviceSubClass,
|
---|
1162 | UsbClass->DeviceProtocol
|
---|
1163 | );
|
---|
1164 | }
|
---|
1165 |
|
---|
1166 | /**
|
---|
1167 | Converts a SATA device path structure to its string representative.
|
---|
1168 |
|
---|
1169 | @param Str The string representative of input device.
|
---|
1170 | @param DevPath The input device path structure.
|
---|
1171 | @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
|
---|
1172 | of the display node is used, where applicable. If DisplayOnly
|
---|
1173 | is FALSE, then the longer text representation of the display node
|
---|
1174 | is used.
|
---|
1175 | @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
|
---|
1176 | representation for a device node can be used, where applicable.
|
---|
1177 |
|
---|
1178 | **/
|
---|
1179 | VOID
|
---|
1180 | DevPathToTextSata (
|
---|
1181 | IN OUT POOL_PRINT *Str,
|
---|
1182 | IN VOID *DevPath,
|
---|
1183 | IN BOOLEAN DisplayOnly,
|
---|
1184 | IN BOOLEAN AllowShortcuts
|
---|
1185 | )
|
---|
1186 | {
|
---|
1187 | SATA_DEVICE_PATH *Sata;
|
---|
1188 |
|
---|
1189 | Sata = DevPath;
|
---|
1190 | UefiDevicePathLibCatPrint (
|
---|
1191 | Str,
|
---|
1192 | L"Sata(0x%x,0x%x,0x%x)",
|
---|
1193 | Sata->HBAPortNumber,
|
---|
1194 | Sata->PortMultiplierPortNumber,
|
---|
1195 | Sata->Lun
|
---|
1196 | );
|
---|
1197 | }
|
---|
1198 |
|
---|
1199 | /**
|
---|
1200 | Converts a I20 device path structure to its string representative.
|
---|
1201 |
|
---|
1202 | @param Str The string representative of input device.
|
---|
1203 | @param DevPath The input device path structure.
|
---|
1204 | @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
|
---|
1205 | of the display node is used, where applicable. If DisplayOnly
|
---|
1206 | is FALSE, then the longer text representation of the display node
|
---|
1207 | is used.
|
---|
1208 | @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
|
---|
1209 | representation for a device node can be used, where applicable.
|
---|
1210 |
|
---|
1211 | **/
|
---|
1212 | VOID
|
---|
1213 | DevPathToTextI2O (
|
---|
1214 | IN OUT POOL_PRINT *Str,
|
---|
1215 | IN VOID *DevPath,
|
---|
1216 | IN BOOLEAN DisplayOnly,
|
---|
1217 | IN BOOLEAN AllowShortcuts
|
---|
1218 | )
|
---|
1219 | {
|
---|
1220 | I2O_DEVICE_PATH *I2ODevPath;
|
---|
1221 |
|
---|
1222 | I2ODevPath = DevPath;
|
---|
1223 | UefiDevicePathLibCatPrint (Str, L"I2O(0x%x)", I2ODevPath->Tid);
|
---|
1224 | }
|
---|
1225 |
|
---|
1226 | /**
|
---|
1227 | Converts a MAC address device path structure to its string representative.
|
---|
1228 |
|
---|
1229 | @param Str The string representative of input device.
|
---|
1230 | @param DevPath The input device path structure.
|
---|
1231 | @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
|
---|
1232 | of the display node is used, where applicable. If DisplayOnly
|
---|
1233 | is FALSE, then the longer text representation of the display node
|
---|
1234 | is used.
|
---|
1235 | @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
|
---|
1236 | representation for a device node can be used, where applicable.
|
---|
1237 |
|
---|
1238 | **/
|
---|
1239 | VOID
|
---|
1240 | DevPathToTextMacAddr (
|
---|
1241 | IN OUT POOL_PRINT *Str,
|
---|
1242 | IN VOID *DevPath,
|
---|
1243 | IN BOOLEAN DisplayOnly,
|
---|
1244 | IN BOOLEAN AllowShortcuts
|
---|
1245 | )
|
---|
1246 | {
|
---|
1247 | MAC_ADDR_DEVICE_PATH *MacDevPath;
|
---|
1248 | UINTN HwAddressSize;
|
---|
1249 | UINTN Index;
|
---|
1250 |
|
---|
1251 | MacDevPath = DevPath;
|
---|
1252 |
|
---|
1253 | HwAddressSize = sizeof (EFI_MAC_ADDRESS);
|
---|
1254 | if ((MacDevPath->IfType == 0x01) || (MacDevPath->IfType == 0x00)) {
|
---|
1255 | HwAddressSize = 6;
|
---|
1256 | }
|
---|
1257 |
|
---|
1258 | UefiDevicePathLibCatPrint (Str, L"MAC(");
|
---|
1259 |
|
---|
1260 | for (Index = 0; Index < HwAddressSize; Index++) {
|
---|
1261 | UefiDevicePathLibCatPrint (Str, L"%02x", MacDevPath->MacAddress.Addr[Index]);
|
---|
1262 | }
|
---|
1263 |
|
---|
1264 | UefiDevicePathLibCatPrint (Str, L",0x%x)", MacDevPath->IfType);
|
---|
1265 | }
|
---|
1266 |
|
---|
1267 | /**
|
---|
1268 | Converts network protocol string to its text representation.
|
---|
1269 |
|
---|
1270 | @param Str The string representative of input device.
|
---|
1271 | @param Protocol The network protocol ID.
|
---|
1272 |
|
---|
1273 | **/
|
---|
1274 | VOID
|
---|
1275 | CatNetworkProtocol (
|
---|
1276 | IN OUT POOL_PRINT *Str,
|
---|
1277 | IN UINT16 Protocol
|
---|
1278 | )
|
---|
1279 | {
|
---|
1280 | if (Protocol == RFC_1700_TCP_PROTOCOL) {
|
---|
1281 | UefiDevicePathLibCatPrint (Str, L"TCP");
|
---|
1282 | } else if (Protocol == RFC_1700_UDP_PROTOCOL) {
|
---|
1283 | UefiDevicePathLibCatPrint (Str, L"UDP");
|
---|
1284 | } else {
|
---|
1285 | UefiDevicePathLibCatPrint (Str, L"0x%x", Protocol);
|
---|
1286 | }
|
---|
1287 | }
|
---|
1288 |
|
---|
1289 | /**
|
---|
1290 | Converts IP v4 address to its text representation.
|
---|
1291 |
|
---|
1292 | @param Str The string representative of input device.
|
---|
1293 | @param Address The IP v4 address.
|
---|
1294 | **/
|
---|
1295 | VOID
|
---|
1296 | CatIPv4Address (
|
---|
1297 | IN OUT POOL_PRINT *Str,
|
---|
1298 | IN EFI_IPv4_ADDRESS *Address
|
---|
1299 | )
|
---|
1300 | {
|
---|
1301 | UefiDevicePathLibCatPrint (Str, L"%d.%d.%d.%d", Address->Addr[0], Address->Addr[1], Address->Addr[2], Address->Addr[3]);
|
---|
1302 | }
|
---|
1303 |
|
---|
1304 | /**
|
---|
1305 | Converts IP v6 address to its text representation.
|
---|
1306 |
|
---|
1307 | @param Str The string representative of input device.
|
---|
1308 | @param Address The IP v6 address.
|
---|
1309 | **/
|
---|
1310 | VOID
|
---|
1311 | CatIPv6Address (
|
---|
1312 | IN OUT POOL_PRINT *Str,
|
---|
1313 | IN EFI_IPv6_ADDRESS *Address
|
---|
1314 | )
|
---|
1315 | {
|
---|
1316 | UefiDevicePathLibCatPrint (
|
---|
1317 | Str,
|
---|
1318 | L"%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x",
|
---|
1319 | Address->Addr[0],
|
---|
1320 | Address->Addr[1],
|
---|
1321 | Address->Addr[2],
|
---|
1322 | Address->Addr[3],
|
---|
1323 | Address->Addr[4],
|
---|
1324 | Address->Addr[5],
|
---|
1325 | Address->Addr[6],
|
---|
1326 | Address->Addr[7],
|
---|
1327 | Address->Addr[8],
|
---|
1328 | Address->Addr[9],
|
---|
1329 | Address->Addr[10],
|
---|
1330 | Address->Addr[11],
|
---|
1331 | Address->Addr[12],
|
---|
1332 | Address->Addr[13],
|
---|
1333 | Address->Addr[14],
|
---|
1334 | Address->Addr[15]
|
---|
1335 | );
|
---|
1336 | }
|
---|
1337 |
|
---|
1338 | /**
|
---|
1339 | Converts a IPv4 device path structure to its string representative.
|
---|
1340 |
|
---|
1341 | @param Str The string representative of input device.
|
---|
1342 | @param DevPath The input device path structure.
|
---|
1343 | @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
|
---|
1344 | of the display node is used, where applicable. If DisplayOnly
|
---|
1345 | is FALSE, then the longer text representation of the display node
|
---|
1346 | is used.
|
---|
1347 | @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
|
---|
1348 | representation for a device node can be used, where applicable.
|
---|
1349 |
|
---|
1350 | **/
|
---|
1351 | VOID
|
---|
1352 | DevPathToTextIPv4 (
|
---|
1353 | IN OUT POOL_PRINT *Str,
|
---|
1354 | IN VOID *DevPath,
|
---|
1355 | IN BOOLEAN DisplayOnly,
|
---|
1356 | IN BOOLEAN AllowShortcuts
|
---|
1357 | )
|
---|
1358 | {
|
---|
1359 | IPv4_DEVICE_PATH *IPDevPath;
|
---|
1360 |
|
---|
1361 | IPDevPath = DevPath;
|
---|
1362 | UefiDevicePathLibCatPrint (Str, L"IPv4(");
|
---|
1363 | CatIPv4Address (Str, &IPDevPath->RemoteIpAddress);
|
---|
1364 |
|
---|
1365 | if (DisplayOnly) {
|
---|
1366 | UefiDevicePathLibCatPrint (Str, L")");
|
---|
1367 | return;
|
---|
1368 | }
|
---|
1369 |
|
---|
1370 | UefiDevicePathLibCatPrint (Str, L",");
|
---|
1371 | CatNetworkProtocol (Str, IPDevPath->Protocol);
|
---|
1372 |
|
---|
1373 | UefiDevicePathLibCatPrint (Str, L",%s,", IPDevPath->StaticIpAddress ? L"Static" : L"DHCP");
|
---|
1374 | CatIPv4Address (Str, &IPDevPath->LocalIpAddress);
|
---|
1375 | if (DevicePathNodeLength (IPDevPath) == sizeof (IPv4_DEVICE_PATH)) {
|
---|
1376 | UefiDevicePathLibCatPrint (Str, L",");
|
---|
1377 | CatIPv4Address (Str, &IPDevPath->GatewayIpAddress);
|
---|
1378 | UefiDevicePathLibCatPrint (Str, L",");
|
---|
1379 | CatIPv4Address (Str, &IPDevPath->SubnetMask);
|
---|
1380 | }
|
---|
1381 |
|
---|
1382 | UefiDevicePathLibCatPrint (Str, L")");
|
---|
1383 | }
|
---|
1384 |
|
---|
1385 | /**
|
---|
1386 | Converts a IPv6 device path structure to its string representative.
|
---|
1387 |
|
---|
1388 | @param Str The string representative of input device.
|
---|
1389 | @param DevPath The input device path structure.
|
---|
1390 | @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
|
---|
1391 | of the display node is used, where applicable. If DisplayOnly
|
---|
1392 | is FALSE, then the longer text representation of the display node
|
---|
1393 | is used.
|
---|
1394 | @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
|
---|
1395 | representation for a device node can be used, where applicable.
|
---|
1396 |
|
---|
1397 | **/
|
---|
1398 | VOID
|
---|
1399 | DevPathToTextIPv6 (
|
---|
1400 | IN OUT POOL_PRINT *Str,
|
---|
1401 | IN VOID *DevPath,
|
---|
1402 | IN BOOLEAN DisplayOnly,
|
---|
1403 | IN BOOLEAN AllowShortcuts
|
---|
1404 | )
|
---|
1405 | {
|
---|
1406 | IPv6_DEVICE_PATH *IPDevPath;
|
---|
1407 |
|
---|
1408 | IPDevPath = DevPath;
|
---|
1409 | UefiDevicePathLibCatPrint (Str, L"IPv6(");
|
---|
1410 | CatIPv6Address (Str, &IPDevPath->RemoteIpAddress);
|
---|
1411 | if (DisplayOnly) {
|
---|
1412 | UefiDevicePathLibCatPrint (Str, L")");
|
---|
1413 | return;
|
---|
1414 | }
|
---|
1415 |
|
---|
1416 | UefiDevicePathLibCatPrint (Str, L",");
|
---|
1417 | CatNetworkProtocol (Str, IPDevPath->Protocol);
|
---|
1418 |
|
---|
1419 | switch (IPDevPath->IpAddressOrigin) {
|
---|
1420 | case 0:
|
---|
1421 | UefiDevicePathLibCatPrint (Str, L",Static,");
|
---|
1422 | break;
|
---|
1423 | case 1:
|
---|
1424 | UefiDevicePathLibCatPrint (Str, L",StatelessAutoConfigure,");
|
---|
1425 | break;
|
---|
1426 | default:
|
---|
1427 | UefiDevicePathLibCatPrint (Str, L",StatefulAutoConfigure,");
|
---|
1428 | break;
|
---|
1429 | }
|
---|
1430 |
|
---|
1431 | CatIPv6Address (Str, &IPDevPath->LocalIpAddress);
|
---|
1432 |
|
---|
1433 | if (DevicePathNodeLength (IPDevPath) == sizeof (IPv6_DEVICE_PATH)) {
|
---|
1434 | UefiDevicePathLibCatPrint (Str, L",0x%x,", IPDevPath->PrefixLength);
|
---|
1435 | CatIPv6Address (Str, &IPDevPath->GatewayIpAddress);
|
---|
1436 | }
|
---|
1437 |
|
---|
1438 | UefiDevicePathLibCatPrint (Str, L")");
|
---|
1439 | }
|
---|
1440 |
|
---|
1441 | /**
|
---|
1442 | Converts an Infini Band device path structure to its string representative.
|
---|
1443 |
|
---|
1444 | @param Str The string representative of input device.
|
---|
1445 | @param DevPath The input device path structure.
|
---|
1446 | @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
|
---|
1447 | of the display node is used, where applicable. If DisplayOnly
|
---|
1448 | is FALSE, then the longer text representation of the display node
|
---|
1449 | is used.
|
---|
1450 | @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
|
---|
1451 | representation for a device node can be used, where applicable.
|
---|
1452 |
|
---|
1453 | **/
|
---|
1454 | VOID
|
---|
1455 | DevPathToTextInfiniBand (
|
---|
1456 | IN OUT POOL_PRINT *Str,
|
---|
1457 | IN VOID *DevPath,
|
---|
1458 | IN BOOLEAN DisplayOnly,
|
---|
1459 | IN BOOLEAN AllowShortcuts
|
---|
1460 | )
|
---|
1461 | {
|
---|
1462 | INFINIBAND_DEVICE_PATH *InfiniBand;
|
---|
1463 |
|
---|
1464 | InfiniBand = DevPath;
|
---|
1465 | UefiDevicePathLibCatPrint (
|
---|
1466 | Str,
|
---|
1467 | L"Infiniband(0x%x,%g,0x%lx,0x%lx,0x%lx)",
|
---|
1468 | InfiniBand->ResourceFlags,
|
---|
1469 | InfiniBand->PortGid,
|
---|
1470 | InfiniBand->ServiceId,
|
---|
1471 | InfiniBand->TargetPortId,
|
---|
1472 | InfiniBand->DeviceId
|
---|
1473 | );
|
---|
1474 | }
|
---|
1475 |
|
---|
1476 | /**
|
---|
1477 | Converts a UART device path structure to its string representative.
|
---|
1478 |
|
---|
1479 | @param Str The string representative of input device.
|
---|
1480 | @param DevPath The input device path structure.
|
---|
1481 | @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
|
---|
1482 | of the display node is used, where applicable. If DisplayOnly
|
---|
1483 | is FALSE, then the longer text representation of the display node
|
---|
1484 | is used.
|
---|
1485 | @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
|
---|
1486 | representation for a device node can be used, where applicable.
|
---|
1487 |
|
---|
1488 | **/
|
---|
1489 | VOID
|
---|
1490 | DevPathToTextUart (
|
---|
1491 | IN OUT POOL_PRINT *Str,
|
---|
1492 | IN VOID *DevPath,
|
---|
1493 | IN BOOLEAN DisplayOnly,
|
---|
1494 | IN BOOLEAN AllowShortcuts
|
---|
1495 | )
|
---|
1496 | {
|
---|
1497 | UART_DEVICE_PATH *Uart;
|
---|
1498 | CHAR8 Parity;
|
---|
1499 |
|
---|
1500 | Uart = DevPath;
|
---|
1501 | switch (Uart->Parity) {
|
---|
1502 | case 0:
|
---|
1503 | Parity = 'D';
|
---|
1504 | break;
|
---|
1505 |
|
---|
1506 | case 1:
|
---|
1507 | Parity = 'N';
|
---|
1508 | break;
|
---|
1509 |
|
---|
1510 | case 2:
|
---|
1511 | Parity = 'E';
|
---|
1512 | break;
|
---|
1513 |
|
---|
1514 | case 3:
|
---|
1515 | Parity = 'O';
|
---|
1516 | break;
|
---|
1517 |
|
---|
1518 | case 4:
|
---|
1519 | Parity = 'M';
|
---|
1520 | break;
|
---|
1521 |
|
---|
1522 | case 5:
|
---|
1523 | Parity = 'S';
|
---|
1524 | break;
|
---|
1525 |
|
---|
1526 | default:
|
---|
1527 | Parity = 'x';
|
---|
1528 | break;
|
---|
1529 | }
|
---|
1530 |
|
---|
1531 | if (Uart->BaudRate == 0) {
|
---|
1532 | UefiDevicePathLibCatPrint (Str, L"Uart(DEFAULT,");
|
---|
1533 | } else {
|
---|
1534 | UefiDevicePathLibCatPrint (Str, L"Uart(%ld,", Uart->BaudRate);
|
---|
1535 | }
|
---|
1536 |
|
---|
1537 | if (Uart->DataBits == 0) {
|
---|
1538 | UefiDevicePathLibCatPrint (Str, L"DEFAULT,");
|
---|
1539 | } else {
|
---|
1540 | UefiDevicePathLibCatPrint (Str, L"%d,", Uart->DataBits);
|
---|
1541 | }
|
---|
1542 |
|
---|
1543 | UefiDevicePathLibCatPrint (Str, L"%c,", Parity);
|
---|
1544 |
|
---|
1545 | switch (Uart->StopBits) {
|
---|
1546 | case 0:
|
---|
1547 | UefiDevicePathLibCatPrint (Str, L"D)");
|
---|
1548 | break;
|
---|
1549 |
|
---|
1550 | case 1:
|
---|
1551 | UefiDevicePathLibCatPrint (Str, L"1)");
|
---|
1552 | break;
|
---|
1553 |
|
---|
1554 | case 2:
|
---|
1555 | UefiDevicePathLibCatPrint (Str, L"1.5)");
|
---|
1556 | break;
|
---|
1557 |
|
---|
1558 | case 3:
|
---|
1559 | UefiDevicePathLibCatPrint (Str, L"2)");
|
---|
1560 | break;
|
---|
1561 |
|
---|
1562 | default:
|
---|
1563 | UefiDevicePathLibCatPrint (Str, L"x)");
|
---|
1564 | break;
|
---|
1565 | }
|
---|
1566 | }
|
---|
1567 |
|
---|
1568 | /**
|
---|
1569 | Converts an iSCSI device path structure to its string representative.
|
---|
1570 |
|
---|
1571 | @param Str The string representative of input device.
|
---|
1572 | @param DevPath The input device path structure.
|
---|
1573 | @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
|
---|
1574 | of the display node is used, where applicable. If DisplayOnly
|
---|
1575 | is FALSE, then the longer text representation of the display node
|
---|
1576 | is used.
|
---|
1577 | @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
|
---|
1578 | representation for a device node can be used, where applicable.
|
---|
1579 |
|
---|
1580 | **/
|
---|
1581 | VOID
|
---|
1582 | DevPathToTextiSCSI (
|
---|
1583 | IN OUT POOL_PRINT *Str,
|
---|
1584 | IN VOID *DevPath,
|
---|
1585 | IN BOOLEAN DisplayOnly,
|
---|
1586 | IN BOOLEAN AllowShortcuts
|
---|
1587 | )
|
---|
1588 | {
|
---|
1589 | ISCSI_DEVICE_PATH_WITH_NAME *ISCSIDevPath;
|
---|
1590 | UINT16 Options;
|
---|
1591 | UINTN Index;
|
---|
1592 |
|
---|
1593 | ISCSIDevPath = DevPath;
|
---|
1594 | UefiDevicePathLibCatPrint (
|
---|
1595 | Str,
|
---|
1596 | L"iSCSI(%a,0x%x,0x",
|
---|
1597 | ISCSIDevPath->TargetName,
|
---|
1598 | ISCSIDevPath->TargetPortalGroupTag
|
---|
1599 | );
|
---|
1600 | for (Index = 0; Index < sizeof (ISCSIDevPath->Lun) / sizeof (UINT8); Index++) {
|
---|
1601 | UefiDevicePathLibCatPrint (Str, L"%02x", ((UINT8 *)&ISCSIDevPath->Lun)[Index]);
|
---|
1602 | }
|
---|
1603 |
|
---|
1604 | Options = ISCSIDevPath->LoginOption;
|
---|
1605 | UefiDevicePathLibCatPrint (Str, L",%s,", (((Options >> 1) & 0x0001) != 0) ? L"CRC32C" : L"None");
|
---|
1606 | UefiDevicePathLibCatPrint (Str, L"%s,", (((Options >> 3) & 0x0001) != 0) ? L"CRC32C" : L"None");
|
---|
1607 | if (((Options >> 11) & 0x0001) != 0) {
|
---|
1608 | UefiDevicePathLibCatPrint (Str, L"%s,", L"None");
|
---|
1609 | } else if (((Options >> 12) & 0x0001) != 0) {
|
---|
1610 | UefiDevicePathLibCatPrint (Str, L"%s,", L"CHAP_UNI");
|
---|
1611 | } else {
|
---|
1612 | UefiDevicePathLibCatPrint (Str, L"%s,", L"CHAP_BI");
|
---|
1613 | }
|
---|
1614 |
|
---|
1615 | UefiDevicePathLibCatPrint (Str, L"%s)", (ISCSIDevPath->NetworkProtocol == 0) ? L"TCP" : L"reserved");
|
---|
1616 | }
|
---|
1617 |
|
---|
1618 | /**
|
---|
1619 | Converts a VLAN device path structure to its string representative.
|
---|
1620 |
|
---|
1621 | @param Str The string representative of input device.
|
---|
1622 | @param DevPath The input device path structure.
|
---|
1623 | @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
|
---|
1624 | of the display node is used, where applicable. If DisplayOnly
|
---|
1625 | is FALSE, then the longer text representation of the display node
|
---|
1626 | is used.
|
---|
1627 | @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
|
---|
1628 | representation for a device node can be used, where applicable.
|
---|
1629 |
|
---|
1630 | **/
|
---|
1631 | VOID
|
---|
1632 | DevPathToTextVlan (
|
---|
1633 | IN OUT POOL_PRINT *Str,
|
---|
1634 | IN VOID *DevPath,
|
---|
1635 | IN BOOLEAN DisplayOnly,
|
---|
1636 | IN BOOLEAN AllowShortcuts
|
---|
1637 | )
|
---|
1638 | {
|
---|
1639 | VLAN_DEVICE_PATH *Vlan;
|
---|
1640 |
|
---|
1641 | Vlan = DevPath;
|
---|
1642 | UefiDevicePathLibCatPrint (Str, L"Vlan(%d)", Vlan->VlanId);
|
---|
1643 | }
|
---|
1644 |
|
---|
1645 | /**
|
---|
1646 | Converts a Bluetooth device path structure to its string representative.
|
---|
1647 |
|
---|
1648 | @param Str The string representative of input device.
|
---|
1649 | @param DevPath The input device path structure.
|
---|
1650 | @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
|
---|
1651 | of the display node is used, where applicable. If DisplayOnly
|
---|
1652 | is FALSE, then the longer text representation of the display node
|
---|
1653 | is used.
|
---|
1654 | @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
|
---|
1655 | representation for a device node can be used, where applicable.
|
---|
1656 |
|
---|
1657 | **/
|
---|
1658 | VOID
|
---|
1659 | DevPathToTextBluetooth (
|
---|
1660 | IN OUT POOL_PRINT *Str,
|
---|
1661 | IN VOID *DevPath,
|
---|
1662 | IN BOOLEAN DisplayOnly,
|
---|
1663 | IN BOOLEAN AllowShortcuts
|
---|
1664 | )
|
---|
1665 | {
|
---|
1666 | BLUETOOTH_DEVICE_PATH *Bluetooth;
|
---|
1667 |
|
---|
1668 | Bluetooth = DevPath;
|
---|
1669 | UefiDevicePathLibCatPrint (
|
---|
1670 | Str,
|
---|
1671 | L"Bluetooth(%02x%02x%02x%02x%02x%02x)",
|
---|
1672 | Bluetooth->BD_ADDR.Address[0],
|
---|
1673 | Bluetooth->BD_ADDR.Address[1],
|
---|
1674 | Bluetooth->BD_ADDR.Address[2],
|
---|
1675 | Bluetooth->BD_ADDR.Address[3],
|
---|
1676 | Bluetooth->BD_ADDR.Address[4],
|
---|
1677 | Bluetooth->BD_ADDR.Address[5]
|
---|
1678 | );
|
---|
1679 | }
|
---|
1680 |
|
---|
1681 | /**
|
---|
1682 | Converts a Wi-Fi device path structure to its string representative.
|
---|
1683 |
|
---|
1684 | @param Str The string representative of input device.
|
---|
1685 | @param DevPath The input device path structure.
|
---|
1686 | @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
|
---|
1687 | of the display node is used, where applicable. If DisplayOnly
|
---|
1688 | is FALSE, then the longer text representation of the display node
|
---|
1689 | is used.
|
---|
1690 | @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
|
---|
1691 | representation for a device node can be used, where applicable.
|
---|
1692 |
|
---|
1693 | **/
|
---|
1694 | VOID
|
---|
1695 | DevPathToTextWiFi (
|
---|
1696 | IN OUT POOL_PRINT *Str,
|
---|
1697 | IN VOID *DevPath,
|
---|
1698 | IN BOOLEAN DisplayOnly,
|
---|
1699 | IN BOOLEAN AllowShortcuts
|
---|
1700 | )
|
---|
1701 | {
|
---|
1702 | WIFI_DEVICE_PATH *WiFi;
|
---|
1703 | UINT8 SSId[33];
|
---|
1704 |
|
---|
1705 | WiFi = DevPath;
|
---|
1706 |
|
---|
1707 | SSId[32] = '\0';
|
---|
1708 | CopyMem (SSId, WiFi->SSId, 32);
|
---|
1709 |
|
---|
1710 | UefiDevicePathLibCatPrint (Str, L"Wi-Fi(%a)", SSId);
|
---|
1711 | }
|
---|
1712 |
|
---|
1713 | /**
|
---|
1714 | Converts a Bluetooth device path structure to its string representative.
|
---|
1715 |
|
---|
1716 | @param Str The string representative of input device.
|
---|
1717 | @param DevPath The input device path structure.
|
---|
1718 | @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
|
---|
1719 | of the display node is used, where applicable. If DisplayOnly
|
---|
1720 | is FALSE, then the longer text representation of the display node
|
---|
1721 | is used.
|
---|
1722 | @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
|
---|
1723 | representation for a device node can be used, where applicable.
|
---|
1724 |
|
---|
1725 | **/
|
---|
1726 | VOID
|
---|
1727 | DevPathToTextBluetoothLE (
|
---|
1728 | IN OUT POOL_PRINT *Str,
|
---|
1729 | IN VOID *DevPath,
|
---|
1730 | IN BOOLEAN DisplayOnly,
|
---|
1731 | IN BOOLEAN AllowShortcuts
|
---|
1732 | )
|
---|
1733 | {
|
---|
1734 | BLUETOOTH_LE_DEVICE_PATH *BluetoothLE;
|
---|
1735 |
|
---|
1736 | BluetoothLE = DevPath;
|
---|
1737 | UefiDevicePathLibCatPrint (
|
---|
1738 | Str,
|
---|
1739 | L"BluetoothLE(%02x%02x%02x%02x%02x%02x,0x%02x)",
|
---|
1740 | BluetoothLE->Address.Address[0],
|
---|
1741 | BluetoothLE->Address.Address[1],
|
---|
1742 | BluetoothLE->Address.Address[2],
|
---|
1743 | BluetoothLE->Address.Address[3],
|
---|
1744 | BluetoothLE->Address.Address[4],
|
---|
1745 | BluetoothLE->Address.Address[5],
|
---|
1746 | BluetoothLE->Address.Type
|
---|
1747 | );
|
---|
1748 | }
|
---|
1749 |
|
---|
1750 | /**
|
---|
1751 | Converts a DNS device path structure to its string representative.
|
---|
1752 |
|
---|
1753 | @param Str The string representative of input device.
|
---|
1754 | @param DevPath The input device path structure.
|
---|
1755 | @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
|
---|
1756 | of the display node is used, where applicable. If DisplayOnly
|
---|
1757 | is FALSE, then the longer text representation of the display node
|
---|
1758 | is used.
|
---|
1759 | @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
|
---|
1760 | representation for a device node can be used, where applicable.
|
---|
1761 |
|
---|
1762 | **/
|
---|
1763 | VOID
|
---|
1764 | DevPathToTextDns (
|
---|
1765 | IN OUT POOL_PRINT *Str,
|
---|
1766 | IN VOID *DevPath,
|
---|
1767 | IN BOOLEAN DisplayOnly,
|
---|
1768 | IN BOOLEAN AllowShortcuts
|
---|
1769 | )
|
---|
1770 | {
|
---|
1771 | DNS_DEVICE_PATH *DnsDevPath;
|
---|
1772 | UINT32 DnsServerIpCount;
|
---|
1773 | UINT32 DnsServerIpIndex;
|
---|
1774 |
|
---|
1775 | DnsDevPath = DevPath;
|
---|
1776 | DnsServerIpCount = (UINT32)(DevicePathNodeLength (DnsDevPath) - sizeof (EFI_DEVICE_PATH_PROTOCOL) - sizeof (DnsDevPath->IsIPv6)) / sizeof (EFI_IP_ADDRESS);
|
---|
1777 |
|
---|
1778 | UefiDevicePathLibCatPrint (Str, L"Dns(");
|
---|
1779 |
|
---|
1780 | for (DnsServerIpIndex = 0; DnsServerIpIndex < DnsServerIpCount; DnsServerIpIndex++) {
|
---|
1781 | if (DnsDevPath->IsIPv6 == 0x00) {
|
---|
1782 | CatIPv4Address (Str, &(DnsDevPath->DnsServerIp[DnsServerIpIndex].v4));
|
---|
1783 | } else {
|
---|
1784 | CatIPv6Address (Str, &(DnsDevPath->DnsServerIp[DnsServerIpIndex].v6));
|
---|
1785 | }
|
---|
1786 |
|
---|
1787 | if (DnsServerIpIndex < DnsServerIpCount - 1) {
|
---|
1788 | UefiDevicePathLibCatPrint (Str, L",");
|
---|
1789 | }
|
---|
1790 | }
|
---|
1791 |
|
---|
1792 | UefiDevicePathLibCatPrint (Str, L")");
|
---|
1793 | }
|
---|
1794 |
|
---|
1795 | /**
|
---|
1796 | Converts a URI device path structure to its string representative.
|
---|
1797 |
|
---|
1798 | @param Str The string representative of input device.
|
---|
1799 | @param DevPath The input device path structure.
|
---|
1800 | @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
|
---|
1801 | of the display node is used, where applicable. If DisplayOnly
|
---|
1802 | is FALSE, then the longer text representation of the display node
|
---|
1803 | is used.
|
---|
1804 | @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
|
---|
1805 | representation for a device node can be used, where applicable.
|
---|
1806 |
|
---|
1807 | **/
|
---|
1808 | VOID
|
---|
1809 | DevPathToTextUri (
|
---|
1810 | IN OUT POOL_PRINT *Str,
|
---|
1811 | IN VOID *DevPath,
|
---|
1812 | IN BOOLEAN DisplayOnly,
|
---|
1813 | IN BOOLEAN AllowShortcuts
|
---|
1814 | )
|
---|
1815 | {
|
---|
1816 | URI_DEVICE_PATH *Uri;
|
---|
1817 | UINTN UriLength;
|
---|
1818 | CHAR8 *UriStr;
|
---|
1819 |
|
---|
1820 | //
|
---|
1821 | // Uri in the device path may not be null terminated.
|
---|
1822 | //
|
---|
1823 | Uri = DevPath;
|
---|
1824 | UriLength = DevicePathNodeLength (Uri) - sizeof (URI_DEVICE_PATH);
|
---|
1825 | UriStr = AllocatePool (UriLength + 1);
|
---|
1826 | ASSERT (UriStr != NULL);
|
---|
1827 |
|
---|
1828 | CopyMem (UriStr, Uri->Uri, UriLength);
|
---|
1829 | UriStr[UriLength] = '\0';
|
---|
1830 | UefiDevicePathLibCatPrint (Str, L"Uri(%a)", UriStr);
|
---|
1831 | FreePool (UriStr);
|
---|
1832 | }
|
---|
1833 |
|
---|
1834 | /**
|
---|
1835 | Converts a Hard drive device path structure to its string representative.
|
---|
1836 |
|
---|
1837 | @param Str The string representative of input device.
|
---|
1838 | @param DevPath The input device path structure.
|
---|
1839 | @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
|
---|
1840 | of the display node is used, where applicable. If DisplayOnly
|
---|
1841 | is FALSE, then the longer text representation of the display node
|
---|
1842 | is used.
|
---|
1843 | @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
|
---|
1844 | representation for a device node can be used, where applicable.
|
---|
1845 |
|
---|
1846 | **/
|
---|
1847 | VOID
|
---|
1848 | DevPathToTextHardDrive (
|
---|
1849 | IN OUT POOL_PRINT *Str,
|
---|
1850 | IN VOID *DevPath,
|
---|
1851 | IN BOOLEAN DisplayOnly,
|
---|
1852 | IN BOOLEAN AllowShortcuts
|
---|
1853 | )
|
---|
1854 | {
|
---|
1855 | HARDDRIVE_DEVICE_PATH *Hd;
|
---|
1856 |
|
---|
1857 | Hd = DevPath;
|
---|
1858 | switch (Hd->SignatureType) {
|
---|
1859 | case SIGNATURE_TYPE_MBR:
|
---|
1860 | UefiDevicePathLibCatPrint (
|
---|
1861 | Str,
|
---|
1862 | L"HD(%d,%s,0x%08x,",
|
---|
1863 | Hd->PartitionNumber,
|
---|
1864 | L"MBR",
|
---|
1865 | *((UINT32 *)(&(Hd->Signature[0])))
|
---|
1866 | );
|
---|
1867 | break;
|
---|
1868 |
|
---|
1869 | case SIGNATURE_TYPE_GUID:
|
---|
1870 | UefiDevicePathLibCatPrint (
|
---|
1871 | Str,
|
---|
1872 | L"HD(%d,%s,%g,",
|
---|
1873 | Hd->PartitionNumber,
|
---|
1874 | L"GPT",
|
---|
1875 | (EFI_GUID *)&(Hd->Signature[0])
|
---|
1876 | );
|
---|
1877 | break;
|
---|
1878 |
|
---|
1879 | default:
|
---|
1880 | UefiDevicePathLibCatPrint (
|
---|
1881 | Str,
|
---|
1882 | L"HD(%d,%d,0,",
|
---|
1883 | Hd->PartitionNumber,
|
---|
1884 | Hd->SignatureType
|
---|
1885 | );
|
---|
1886 | break;
|
---|
1887 | }
|
---|
1888 |
|
---|
1889 | UefiDevicePathLibCatPrint (Str, L"0x%lx,0x%lx)", Hd->PartitionStart, Hd->PartitionSize);
|
---|
1890 | }
|
---|
1891 |
|
---|
1892 | /**
|
---|
1893 | Converts a CDROM device path structure to its string representative.
|
---|
1894 |
|
---|
1895 | @param Str The string representative of input device.
|
---|
1896 | @param DevPath The input device path structure.
|
---|
1897 | @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
|
---|
1898 | of the display node is used, where applicable. If DisplayOnly
|
---|
1899 | is FALSE, then the longer text representation of the display node
|
---|
1900 | is used.
|
---|
1901 | @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
|
---|
1902 | representation for a device node can be used, where applicable.
|
---|
1903 |
|
---|
1904 | **/
|
---|
1905 | VOID
|
---|
1906 | DevPathToTextCDROM (
|
---|
1907 | IN OUT POOL_PRINT *Str,
|
---|
1908 | IN VOID *DevPath,
|
---|
1909 | IN BOOLEAN DisplayOnly,
|
---|
1910 | IN BOOLEAN AllowShortcuts
|
---|
1911 | )
|
---|
1912 | {
|
---|
1913 | CDROM_DEVICE_PATH *Cd;
|
---|
1914 |
|
---|
1915 | Cd = DevPath;
|
---|
1916 | if (DisplayOnly) {
|
---|
1917 | UefiDevicePathLibCatPrint (Str, L"CDROM(0x%x)", Cd->BootEntry);
|
---|
1918 | return;
|
---|
1919 | }
|
---|
1920 |
|
---|
1921 | UefiDevicePathLibCatPrint (Str, L"CDROM(0x%x,0x%lx,0x%lx)", Cd->BootEntry, Cd->PartitionStart, Cd->PartitionSize);
|
---|
1922 | }
|
---|
1923 |
|
---|
1924 | /**
|
---|
1925 | Converts a File device path structure to its string representative.
|
---|
1926 |
|
---|
1927 | @param Str The string representative of input device.
|
---|
1928 | @param DevPath The input device path structure.
|
---|
1929 | @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
|
---|
1930 | of the display node is used, where applicable. If DisplayOnly
|
---|
1931 | is FALSE, then the longer text representation of the display node
|
---|
1932 | is used.
|
---|
1933 | @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
|
---|
1934 | representation for a device node can be used, where applicable.
|
---|
1935 |
|
---|
1936 | **/
|
---|
1937 | VOID
|
---|
1938 | DevPathToTextFilePath (
|
---|
1939 | IN OUT POOL_PRINT *Str,
|
---|
1940 | IN VOID *DevPath,
|
---|
1941 | IN BOOLEAN DisplayOnly,
|
---|
1942 | IN BOOLEAN AllowShortcuts
|
---|
1943 | )
|
---|
1944 | {
|
---|
1945 | FILEPATH_DEVICE_PATH *Fp;
|
---|
1946 |
|
---|
1947 | Fp = DevPath;
|
---|
1948 | UefiDevicePathLibCatPrint (Str, L"%s", Fp->PathName);
|
---|
1949 | }
|
---|
1950 |
|
---|
1951 | /**
|
---|
1952 | Converts a Media protocol device path structure to its string representative.
|
---|
1953 |
|
---|
1954 | @param Str The string representative of input device.
|
---|
1955 | @param DevPath The input device path structure.
|
---|
1956 | @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
|
---|
1957 | of the display node is used, where applicable. If DisplayOnly
|
---|
1958 | is FALSE, then the longer text representation of the display node
|
---|
1959 | is used.
|
---|
1960 | @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
|
---|
1961 | representation for a device node can be used, where applicable.
|
---|
1962 |
|
---|
1963 | **/
|
---|
1964 | VOID
|
---|
1965 | DevPathToTextMediaProtocol (
|
---|
1966 | IN OUT POOL_PRINT *Str,
|
---|
1967 | IN VOID *DevPath,
|
---|
1968 | IN BOOLEAN DisplayOnly,
|
---|
1969 | IN BOOLEAN AllowShortcuts
|
---|
1970 | )
|
---|
1971 | {
|
---|
1972 | MEDIA_PROTOCOL_DEVICE_PATH *MediaProt;
|
---|
1973 |
|
---|
1974 | MediaProt = DevPath;
|
---|
1975 | UefiDevicePathLibCatPrint (Str, L"Media(%g)", &MediaProt->Protocol);
|
---|
1976 | }
|
---|
1977 |
|
---|
1978 | /**
|
---|
1979 | Converts a Firmware Volume device path structure to its string representative.
|
---|
1980 |
|
---|
1981 | @param Str The string representative of input device.
|
---|
1982 | @param DevPath The input device path structure.
|
---|
1983 | @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
|
---|
1984 | of the display node is used, where applicable. If DisplayOnly
|
---|
1985 | is FALSE, then the longer text representation of the display node
|
---|
1986 | is used.
|
---|
1987 | @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
|
---|
1988 | representation for a device node can be used, where applicable.
|
---|
1989 |
|
---|
1990 | **/
|
---|
1991 | VOID
|
---|
1992 | DevPathToTextFv (
|
---|
1993 | IN OUT POOL_PRINT *Str,
|
---|
1994 | IN VOID *DevPath,
|
---|
1995 | IN BOOLEAN DisplayOnly,
|
---|
1996 | IN BOOLEAN AllowShortcuts
|
---|
1997 | )
|
---|
1998 | {
|
---|
1999 | MEDIA_FW_VOL_DEVICE_PATH *Fv;
|
---|
2000 |
|
---|
2001 | Fv = DevPath;
|
---|
2002 | UefiDevicePathLibCatPrint (Str, L"Fv(%g)", &Fv->FvName);
|
---|
2003 | }
|
---|
2004 |
|
---|
2005 | /**
|
---|
2006 | Converts a Firmware Volume File device path structure to its string representative.
|
---|
2007 |
|
---|
2008 | @param Str The string representative of input device.
|
---|
2009 | @param DevPath The input device path structure.
|
---|
2010 | @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
|
---|
2011 | of the display node is used, where applicable. If DisplayOnly
|
---|
2012 | is FALSE, then the longer text representation of the display node
|
---|
2013 | is used.
|
---|
2014 | @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
|
---|
2015 | representation for a device node can be used, where applicable.
|
---|
2016 |
|
---|
2017 | **/
|
---|
2018 | VOID
|
---|
2019 | DevPathToTextFvFile (
|
---|
2020 | IN OUT POOL_PRINT *Str,
|
---|
2021 | IN VOID *DevPath,
|
---|
2022 | IN BOOLEAN DisplayOnly,
|
---|
2023 | IN BOOLEAN AllowShortcuts
|
---|
2024 | )
|
---|
2025 | {
|
---|
2026 | MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *FvFile;
|
---|
2027 |
|
---|
2028 | FvFile = DevPath;
|
---|
2029 | UefiDevicePathLibCatPrint (Str, L"FvFile(%g)", &FvFile->FvFileName);
|
---|
2030 | }
|
---|
2031 |
|
---|
2032 | /**
|
---|
2033 | Converts a Relative Offset device path structure to its string representative.
|
---|
2034 |
|
---|
2035 | @param Str The string representative of input device.
|
---|
2036 | @param DevPath The input device path structure.
|
---|
2037 | @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
|
---|
2038 | of the display node is used, where applicable. If DisplayOnly
|
---|
2039 | is FALSE, then the longer text representation of the display node
|
---|
2040 | is used.
|
---|
2041 | @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
|
---|
2042 | representation for a device node can be used, where applicable.
|
---|
2043 |
|
---|
2044 | **/
|
---|
2045 | VOID
|
---|
2046 | DevPathRelativeOffsetRange (
|
---|
2047 | IN OUT POOL_PRINT *Str,
|
---|
2048 | IN VOID *DevPath,
|
---|
2049 | IN BOOLEAN DisplayOnly,
|
---|
2050 | IN BOOLEAN AllowShortcuts
|
---|
2051 | )
|
---|
2052 | {
|
---|
2053 | MEDIA_RELATIVE_OFFSET_RANGE_DEVICE_PATH *Offset;
|
---|
2054 |
|
---|
2055 | Offset = DevPath;
|
---|
2056 | UefiDevicePathLibCatPrint (
|
---|
2057 | Str,
|
---|
2058 | L"Offset(0x%lx,0x%lx)",
|
---|
2059 | Offset->StartingOffset,
|
---|
2060 | Offset->EndingOffset
|
---|
2061 | );
|
---|
2062 | }
|
---|
2063 |
|
---|
2064 | /**
|
---|
2065 | Converts a Ram Disk device path structure to its string representative.
|
---|
2066 |
|
---|
2067 | @param Str The string representative of input device.
|
---|
2068 | @param DevPath The input device path structure.
|
---|
2069 | @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
|
---|
2070 | of the display node is used, where applicable. If DisplayOnly
|
---|
2071 | is FALSE, then the longer text representation of the display node
|
---|
2072 | is used.
|
---|
2073 | @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
|
---|
2074 | representation for a device node can be used, where applicable.
|
---|
2075 |
|
---|
2076 | **/
|
---|
2077 | VOID
|
---|
2078 | DevPathToTextRamDisk (
|
---|
2079 | IN OUT POOL_PRINT *Str,
|
---|
2080 | IN VOID *DevPath,
|
---|
2081 | IN BOOLEAN DisplayOnly,
|
---|
2082 | IN BOOLEAN AllowShortcuts
|
---|
2083 | )
|
---|
2084 | {
|
---|
2085 | MEDIA_RAM_DISK_DEVICE_PATH *RamDisk;
|
---|
2086 |
|
---|
2087 | RamDisk = DevPath;
|
---|
2088 |
|
---|
2089 | if (CompareGuid (&RamDisk->TypeGuid, &gEfiVirtualDiskGuid)) {
|
---|
2090 | UefiDevicePathLibCatPrint (
|
---|
2091 | Str,
|
---|
2092 | L"VirtualDisk(0x%lx,0x%lx,%d)",
|
---|
2093 | LShiftU64 ((UINT64)RamDisk->StartingAddr[1], 32) | RamDisk->StartingAddr[0],
|
---|
2094 | LShiftU64 ((UINT64)RamDisk->EndingAddr[1], 32) | RamDisk->EndingAddr[0],
|
---|
2095 | RamDisk->Instance
|
---|
2096 | );
|
---|
2097 | } else if (CompareGuid (&RamDisk->TypeGuid, &gEfiVirtualCdGuid)) {
|
---|
2098 | UefiDevicePathLibCatPrint (
|
---|
2099 | Str,
|
---|
2100 | L"VirtualCD(0x%lx,0x%lx,%d)",
|
---|
2101 | LShiftU64 ((UINT64)RamDisk->StartingAddr[1], 32) | RamDisk->StartingAddr[0],
|
---|
2102 | LShiftU64 ((UINT64)RamDisk->EndingAddr[1], 32) | RamDisk->EndingAddr[0],
|
---|
2103 | RamDisk->Instance
|
---|
2104 | );
|
---|
2105 | } else if (CompareGuid (&RamDisk->TypeGuid, &gEfiPersistentVirtualDiskGuid)) {
|
---|
2106 | UefiDevicePathLibCatPrint (
|
---|
2107 | Str,
|
---|
2108 | L"PersistentVirtualDisk(0x%lx,0x%lx,%d)",
|
---|
2109 | LShiftU64 ((UINT64)RamDisk->StartingAddr[1], 32) | RamDisk->StartingAddr[0],
|
---|
2110 | LShiftU64 ((UINT64)RamDisk->EndingAddr[1], 32) | RamDisk->EndingAddr[0],
|
---|
2111 | RamDisk->Instance
|
---|
2112 | );
|
---|
2113 | } else if (CompareGuid (&RamDisk->TypeGuid, &gEfiPersistentVirtualCdGuid)) {
|
---|
2114 | UefiDevicePathLibCatPrint (
|
---|
2115 | Str,
|
---|
2116 | L"PersistentVirtualCD(0x%lx,0x%lx,%d)",
|
---|
2117 | LShiftU64 ((UINT64)RamDisk->StartingAddr[1], 32) | RamDisk->StartingAddr[0],
|
---|
2118 | LShiftU64 ((UINT64)RamDisk->EndingAddr[1], 32) | RamDisk->EndingAddr[0],
|
---|
2119 | RamDisk->Instance
|
---|
2120 | );
|
---|
2121 | } else {
|
---|
2122 | UefiDevicePathLibCatPrint (
|
---|
2123 | Str,
|
---|
2124 | L"RamDisk(0x%lx,0x%lx,%d,%g)",
|
---|
2125 | LShiftU64 ((UINT64)RamDisk->StartingAddr[1], 32) | RamDisk->StartingAddr[0],
|
---|
2126 | LShiftU64 ((UINT64)RamDisk->EndingAddr[1], 32) | RamDisk->EndingAddr[0],
|
---|
2127 | RamDisk->Instance,
|
---|
2128 | &RamDisk->TypeGuid
|
---|
2129 | );
|
---|
2130 | }
|
---|
2131 | }
|
---|
2132 |
|
---|
2133 | /**
|
---|
2134 | Converts a BIOS Boot Specification device path structure to its string representative.
|
---|
2135 |
|
---|
2136 | @param Str The string representative of input device.
|
---|
2137 | @param DevPath The input device path structure.
|
---|
2138 | @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
|
---|
2139 | of the display node is used, where applicable. If DisplayOnly
|
---|
2140 | is FALSE, then the longer text representation of the display node
|
---|
2141 | is used.
|
---|
2142 | @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
|
---|
2143 | representation for a device node can be used, where applicable.
|
---|
2144 |
|
---|
2145 | **/
|
---|
2146 | VOID
|
---|
2147 | DevPathToTextBBS (
|
---|
2148 | IN OUT POOL_PRINT *Str,
|
---|
2149 | IN VOID *DevPath,
|
---|
2150 | IN BOOLEAN DisplayOnly,
|
---|
2151 | IN BOOLEAN AllowShortcuts
|
---|
2152 | )
|
---|
2153 | {
|
---|
2154 | BBS_BBS_DEVICE_PATH *Bbs;
|
---|
2155 | CHAR16 *Type;
|
---|
2156 |
|
---|
2157 | Bbs = DevPath;
|
---|
2158 | switch (Bbs->DeviceType) {
|
---|
2159 | case BBS_TYPE_FLOPPY:
|
---|
2160 | Type = L"Floppy";
|
---|
2161 | break;
|
---|
2162 |
|
---|
2163 | case BBS_TYPE_HARDDRIVE:
|
---|
2164 | Type = L"HD";
|
---|
2165 | break;
|
---|
2166 |
|
---|
2167 | case BBS_TYPE_CDROM:
|
---|
2168 | Type = L"CDROM";
|
---|
2169 | break;
|
---|
2170 |
|
---|
2171 | case BBS_TYPE_PCMCIA:
|
---|
2172 | Type = L"PCMCIA";
|
---|
2173 | break;
|
---|
2174 |
|
---|
2175 | case BBS_TYPE_USB:
|
---|
2176 | Type = L"USB";
|
---|
2177 | break;
|
---|
2178 |
|
---|
2179 | case BBS_TYPE_EMBEDDED_NETWORK:
|
---|
2180 | Type = L"Network";
|
---|
2181 | break;
|
---|
2182 |
|
---|
2183 | default:
|
---|
2184 | Type = NULL;
|
---|
2185 | break;
|
---|
2186 | }
|
---|
2187 |
|
---|
2188 | if (Type != NULL) {
|
---|
2189 | UefiDevicePathLibCatPrint (Str, L"BBS(%s,%a", Type, Bbs->String);
|
---|
2190 | } else {
|
---|
2191 | UefiDevicePathLibCatPrint (Str, L"BBS(0x%x,%a", Bbs->DeviceType, Bbs->String);
|
---|
2192 | }
|
---|
2193 |
|
---|
2194 | if (DisplayOnly) {
|
---|
2195 | UefiDevicePathLibCatPrint (Str, L")");
|
---|
2196 | return;
|
---|
2197 | }
|
---|
2198 |
|
---|
2199 | UefiDevicePathLibCatPrint (Str, L",0x%x)", Bbs->StatusFlag);
|
---|
2200 | }
|
---|
2201 |
|
---|
2202 | /**
|
---|
2203 | Converts an End-of-Device-Path structure to its string representative.
|
---|
2204 |
|
---|
2205 | @param Str The string representative of input device.
|
---|
2206 | @param DevPath The input device path structure.
|
---|
2207 | @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
|
---|
2208 | of the display node is used, where applicable. If DisplayOnly
|
---|
2209 | is FALSE, then the longer text representation of the display node
|
---|
2210 | is used.
|
---|
2211 | @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
|
---|
2212 | representation for a device node can be used, where applicable.
|
---|
2213 |
|
---|
2214 | **/
|
---|
2215 | VOID
|
---|
2216 | DevPathToTextEndInstance (
|
---|
2217 | IN OUT POOL_PRINT *Str,
|
---|
2218 | IN VOID *DevPath,
|
---|
2219 | IN BOOLEAN DisplayOnly,
|
---|
2220 | IN BOOLEAN AllowShortcuts
|
---|
2221 | )
|
---|
2222 | {
|
---|
2223 | UefiDevicePathLibCatPrint (Str, L",");
|
---|
2224 | }
|
---|
2225 |
|
---|
2226 | GLOBAL_REMOVE_IF_UNREFERENCED const DEVICE_PATH_TO_TEXT_GENERIC_TABLE mUefiDevicePathLibToTextTableGeneric[] = {
|
---|
2227 | { HARDWARE_DEVICE_PATH, L"HardwarePath" },
|
---|
2228 | { ACPI_DEVICE_PATH, L"AcpiPath" },
|
---|
2229 | { MESSAGING_DEVICE_PATH, L"Msg" },
|
---|
2230 | { MEDIA_DEVICE_PATH, L"MediaPath" },
|
---|
2231 | { BBS_DEVICE_PATH, L"BbsPath" },
|
---|
2232 | { 0, NULL }
|
---|
2233 | };
|
---|
2234 |
|
---|
2235 | /**
|
---|
2236 | Converts an unknown device path structure to its string representative.
|
---|
2237 |
|
---|
2238 | @param Str The string representative of input device.
|
---|
2239 | @param DevPath The input device path structure.
|
---|
2240 | @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
|
---|
2241 | of the display node is used, where applicable. If DisplayOnly
|
---|
2242 | is FALSE, then the longer text representation of the display node
|
---|
2243 | is used.
|
---|
2244 | @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
|
---|
2245 | representation for a device node can be used, where applicable.
|
---|
2246 |
|
---|
2247 | **/
|
---|
2248 | VOID
|
---|
2249 | DevPathToTextNodeGeneric (
|
---|
2250 | IN OUT POOL_PRINT *Str,
|
---|
2251 | IN VOID *DevPath,
|
---|
2252 | IN BOOLEAN DisplayOnly,
|
---|
2253 | IN BOOLEAN AllowShortcuts
|
---|
2254 | )
|
---|
2255 | {
|
---|
2256 | EFI_DEVICE_PATH_PROTOCOL *Node;
|
---|
2257 | UINTN Index;
|
---|
2258 |
|
---|
2259 | Node = DevPath;
|
---|
2260 |
|
---|
2261 | for (Index = 0; mUefiDevicePathLibToTextTableGeneric[Index].Text != NULL; Index++) {
|
---|
2262 | if (DevicePathType (Node) == mUefiDevicePathLibToTextTableGeneric[Index].Type) {
|
---|
2263 | break;
|
---|
2264 | }
|
---|
2265 | }
|
---|
2266 |
|
---|
2267 | if (mUefiDevicePathLibToTextTableGeneric[Index].Text == NULL) {
|
---|
2268 | //
|
---|
2269 | // It's a node whose type cannot be recognized
|
---|
2270 | //
|
---|
2271 | UefiDevicePathLibCatPrint (Str, L"Path(%d,%d", DevicePathType (Node), DevicePathSubType (Node));
|
---|
2272 | } else {
|
---|
2273 | //
|
---|
2274 | // It's a node whose type can be recognized
|
---|
2275 | //
|
---|
2276 | UefiDevicePathLibCatPrint (Str, L"%s(%d", mUefiDevicePathLibToTextTableGeneric[Index].Text, DevicePathSubType (Node));
|
---|
2277 | }
|
---|
2278 |
|
---|
2279 | Index = sizeof (EFI_DEVICE_PATH_PROTOCOL);
|
---|
2280 | if (Index < DevicePathNodeLength (Node)) {
|
---|
2281 | UefiDevicePathLibCatPrint (Str, L",");
|
---|
2282 | for ( ; Index < DevicePathNodeLength (Node); Index++) {
|
---|
2283 | UefiDevicePathLibCatPrint (Str, L"%02x", ((UINT8 *)Node)[Index]);
|
---|
2284 | }
|
---|
2285 | }
|
---|
2286 |
|
---|
2287 | UefiDevicePathLibCatPrint (Str, L")");
|
---|
2288 | }
|
---|
2289 |
|
---|
2290 | GLOBAL_REMOVE_IF_UNREFERENCED const DEVICE_PATH_TO_TEXT_TABLE mUefiDevicePathLibToTextTable[] = {
|
---|
2291 | { HARDWARE_DEVICE_PATH, HW_PCI_DP, DevPathToTextPci },
|
---|
2292 | { HARDWARE_DEVICE_PATH, HW_PCCARD_DP, DevPathToTextPccard },
|
---|
2293 | { HARDWARE_DEVICE_PATH, HW_MEMMAP_DP, DevPathToTextMemMap },
|
---|
2294 | { HARDWARE_DEVICE_PATH, HW_VENDOR_DP, DevPathToTextVendor },
|
---|
2295 | { HARDWARE_DEVICE_PATH, HW_CONTROLLER_DP, DevPathToTextController },
|
---|
2296 | { HARDWARE_DEVICE_PATH, HW_BMC_DP, DevPathToTextBmc },
|
---|
2297 | { ACPI_DEVICE_PATH, ACPI_DP, DevPathToTextAcpi },
|
---|
2298 | { ACPI_DEVICE_PATH, ACPI_EXTENDED_DP, DevPathToTextAcpiEx },
|
---|
2299 | { ACPI_DEVICE_PATH, ACPI_ADR_DP, DevPathToTextAcpiAdr },
|
---|
2300 | { MESSAGING_DEVICE_PATH, MSG_ATAPI_DP, DevPathToTextAtapi },
|
---|
2301 | { MESSAGING_DEVICE_PATH, MSG_SCSI_DP, DevPathToTextScsi },
|
---|
2302 | { MESSAGING_DEVICE_PATH, MSG_FIBRECHANNEL_DP, DevPathToTextFibre },
|
---|
2303 | { MESSAGING_DEVICE_PATH, MSG_FIBRECHANNELEX_DP, DevPathToTextFibreEx },
|
---|
2304 | #ifndef VBOX
|
---|
2305 | { MESSAGING_DEVICE_PATH, MSG_SASEX_DP, DevPathToTextSasEx },
|
---|
2306 | #else
|
---|
2307 | { MESSAGING_DEVICE_PATH, MSG_SASEX_DP, DevPathToTextNVMe },
|
---|
2308 | #endif
|
---|
2309 | { MESSAGING_DEVICE_PATH, MSG_NVME_NAMESPACE_DP, DevPathToTextNVMe },
|
---|
2310 | { MESSAGING_DEVICE_PATH, MSG_UFS_DP, DevPathToTextUfs },
|
---|
2311 | { MESSAGING_DEVICE_PATH, MSG_SD_DP, DevPathToTextSd },
|
---|
2312 | { MESSAGING_DEVICE_PATH, MSG_EMMC_DP, DevPathToTextEmmc },
|
---|
2313 | { MESSAGING_DEVICE_PATH, MSG_1394_DP, DevPathToText1394 },
|
---|
2314 | { MESSAGING_DEVICE_PATH, MSG_USB_DP, DevPathToTextUsb },
|
---|
2315 | { MESSAGING_DEVICE_PATH, MSG_USB_WWID_DP, DevPathToTextUsbWWID },
|
---|
2316 | { MESSAGING_DEVICE_PATH, MSG_DEVICE_LOGICAL_UNIT_DP, DevPathToTextLogicalUnit },
|
---|
2317 | { MESSAGING_DEVICE_PATH, MSG_USB_CLASS_DP, DevPathToTextUsbClass },
|
---|
2318 | { MESSAGING_DEVICE_PATH, MSG_SATA_DP, DevPathToTextSata },
|
---|
2319 | { MESSAGING_DEVICE_PATH, MSG_I2O_DP, DevPathToTextI2O },
|
---|
2320 | { MESSAGING_DEVICE_PATH, MSG_MAC_ADDR_DP, DevPathToTextMacAddr },
|
---|
2321 | { MESSAGING_DEVICE_PATH, MSG_IPv4_DP, DevPathToTextIPv4 },
|
---|
2322 | { MESSAGING_DEVICE_PATH, MSG_IPv6_DP, DevPathToTextIPv6 },
|
---|
2323 | { MESSAGING_DEVICE_PATH, MSG_INFINIBAND_DP, DevPathToTextInfiniBand },
|
---|
2324 | { MESSAGING_DEVICE_PATH, MSG_UART_DP, DevPathToTextUart },
|
---|
2325 | { MESSAGING_DEVICE_PATH, MSG_VENDOR_DP, DevPathToTextVendor },
|
---|
2326 | { MESSAGING_DEVICE_PATH, MSG_ISCSI_DP, DevPathToTextiSCSI },
|
---|
2327 | { MESSAGING_DEVICE_PATH, MSG_VLAN_DP, DevPathToTextVlan },
|
---|
2328 | { MESSAGING_DEVICE_PATH, MSG_DNS_DP, DevPathToTextDns },
|
---|
2329 | { MESSAGING_DEVICE_PATH, MSG_URI_DP, DevPathToTextUri },
|
---|
2330 | { MESSAGING_DEVICE_PATH, MSG_BLUETOOTH_DP, DevPathToTextBluetooth },
|
---|
2331 | { MESSAGING_DEVICE_PATH, MSG_WIFI_DP, DevPathToTextWiFi },
|
---|
2332 | { MESSAGING_DEVICE_PATH, MSG_BLUETOOTH_LE_DP, DevPathToTextBluetoothLE },
|
---|
2333 | { MEDIA_DEVICE_PATH, MEDIA_HARDDRIVE_DP, DevPathToTextHardDrive },
|
---|
2334 | { MEDIA_DEVICE_PATH, MEDIA_CDROM_DP, DevPathToTextCDROM },
|
---|
2335 | { MEDIA_DEVICE_PATH, MEDIA_VENDOR_DP, DevPathToTextVendor },
|
---|
2336 | { MEDIA_DEVICE_PATH, MEDIA_PROTOCOL_DP, DevPathToTextMediaProtocol },
|
---|
2337 | { MEDIA_DEVICE_PATH, MEDIA_FILEPATH_DP, DevPathToTextFilePath },
|
---|
2338 | { MEDIA_DEVICE_PATH, MEDIA_PIWG_FW_VOL_DP, DevPathToTextFv },
|
---|
2339 | { MEDIA_DEVICE_PATH, MEDIA_PIWG_FW_FILE_DP, DevPathToTextFvFile },
|
---|
2340 | { MEDIA_DEVICE_PATH, MEDIA_RELATIVE_OFFSET_RANGE_DP, DevPathRelativeOffsetRange },
|
---|
2341 | { MEDIA_DEVICE_PATH, MEDIA_RAM_DISK_DP, DevPathToTextRamDisk },
|
---|
2342 | { BBS_DEVICE_PATH, BBS_BBS_DP, DevPathToTextBBS },
|
---|
2343 | { END_DEVICE_PATH_TYPE, END_INSTANCE_DEVICE_PATH_SUBTYPE, DevPathToTextEndInstance },
|
---|
2344 | { 0, 0, NULL }
|
---|
2345 | };
|
---|
2346 |
|
---|
2347 | /**
|
---|
2348 | Converts a device node to its string representation.
|
---|
2349 |
|
---|
2350 | @param DeviceNode A Pointer to the device node to be converted.
|
---|
2351 | @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
|
---|
2352 | of the display node is used, where applicable. If DisplayOnly
|
---|
2353 | is FALSE, then the longer text representation of the display node
|
---|
2354 | is used.
|
---|
2355 | @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
|
---|
2356 | representation for a device node can be used, where applicable.
|
---|
2357 |
|
---|
2358 | @return A pointer to the allocated text representation of the device node or NULL if DeviceNode
|
---|
2359 | is NULL or there was insufficient memory.
|
---|
2360 |
|
---|
2361 | **/
|
---|
2362 | CHAR16 *
|
---|
2363 | EFIAPI
|
---|
2364 | UefiDevicePathLibConvertDeviceNodeToText (
|
---|
2365 | IN CONST EFI_DEVICE_PATH_PROTOCOL *DeviceNode,
|
---|
2366 | IN BOOLEAN DisplayOnly,
|
---|
2367 | IN BOOLEAN AllowShortcuts
|
---|
2368 | )
|
---|
2369 | {
|
---|
2370 | POOL_PRINT Str;
|
---|
2371 | UINTN Index;
|
---|
2372 | DEVICE_PATH_TO_TEXT ToText;
|
---|
2373 |
|
---|
2374 | if (DeviceNode == NULL) {
|
---|
2375 | return NULL;
|
---|
2376 | }
|
---|
2377 |
|
---|
2378 | ZeroMem (&Str, sizeof (Str));
|
---|
2379 |
|
---|
2380 | //
|
---|
2381 | // Process the device path node
|
---|
2382 | // If not found, use a generic function
|
---|
2383 | //
|
---|
2384 | ToText = DevPathToTextNodeGeneric;
|
---|
2385 | for (Index = 0; mUefiDevicePathLibToTextTable[Index].Function != NULL; Index++) {
|
---|
2386 | if ((DevicePathType (DeviceNode) == mUefiDevicePathLibToTextTable[Index].Type) &&
|
---|
2387 | (DevicePathSubType (DeviceNode) == mUefiDevicePathLibToTextTable[Index].SubType)
|
---|
2388 | )
|
---|
2389 | {
|
---|
2390 | ToText = mUefiDevicePathLibToTextTable[Index].Function;
|
---|
2391 | break;
|
---|
2392 | }
|
---|
2393 | }
|
---|
2394 |
|
---|
2395 | //
|
---|
2396 | // Print this node
|
---|
2397 | //
|
---|
2398 | ToText (&Str, (VOID *)DeviceNode, DisplayOnly, AllowShortcuts);
|
---|
2399 |
|
---|
2400 | ASSERT (Str.Str != NULL);
|
---|
2401 | return Str.Str;
|
---|
2402 | }
|
---|
2403 |
|
---|
2404 | /**
|
---|
2405 | Converts a device path to its text representation.
|
---|
2406 |
|
---|
2407 | @param DevicePath A Pointer to the device to be converted.
|
---|
2408 | @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation
|
---|
2409 | of the display node is used, where applicable. If DisplayOnly
|
---|
2410 | is FALSE, then the longer text representation of the display node
|
---|
2411 | is used.
|
---|
2412 | @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text
|
---|
2413 | representation for a device node can be used, where applicable.
|
---|
2414 |
|
---|
2415 | @return A pointer to the allocated text representation of the device path or
|
---|
2416 | NULL if DeviceNode is NULL or there was insufficient memory.
|
---|
2417 |
|
---|
2418 | **/
|
---|
2419 | CHAR16 *
|
---|
2420 | EFIAPI
|
---|
2421 | UefiDevicePathLibConvertDevicePathToText (
|
---|
2422 | IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath,
|
---|
2423 | IN BOOLEAN DisplayOnly,
|
---|
2424 | IN BOOLEAN AllowShortcuts
|
---|
2425 | )
|
---|
2426 | {
|
---|
2427 | POOL_PRINT Str;
|
---|
2428 | EFI_DEVICE_PATH_PROTOCOL *Node;
|
---|
2429 | EFI_DEVICE_PATH_PROTOCOL *AlignedNode;
|
---|
2430 | UINTN Index;
|
---|
2431 | DEVICE_PATH_TO_TEXT ToText;
|
---|
2432 |
|
---|
2433 | if (DevicePath == NULL) {
|
---|
2434 | return NULL;
|
---|
2435 | }
|
---|
2436 |
|
---|
2437 | ZeroMem (&Str, sizeof (Str));
|
---|
2438 |
|
---|
2439 | //
|
---|
2440 | // Process each device path node
|
---|
2441 | //
|
---|
2442 | Node = (EFI_DEVICE_PATH_PROTOCOL *)DevicePath;
|
---|
2443 | while (!IsDevicePathEnd (Node)) {
|
---|
2444 | //
|
---|
2445 | // Find the handler to dump this device path node
|
---|
2446 | // If not found, use a generic function
|
---|
2447 | //
|
---|
2448 | ToText = DevPathToTextNodeGeneric;
|
---|
2449 | for (Index = 0; mUefiDevicePathLibToTextTable[Index].Function != NULL; Index += 1) {
|
---|
2450 | if ((DevicePathType (Node) == mUefiDevicePathLibToTextTable[Index].Type) &&
|
---|
2451 | (DevicePathSubType (Node) == mUefiDevicePathLibToTextTable[Index].SubType)
|
---|
2452 | )
|
---|
2453 | {
|
---|
2454 | ToText = mUefiDevicePathLibToTextTable[Index].Function;
|
---|
2455 | break;
|
---|
2456 | }
|
---|
2457 | }
|
---|
2458 |
|
---|
2459 | //
|
---|
2460 | // Put a path separator in if needed
|
---|
2461 | //
|
---|
2462 | if ((Str.Count != 0) && (ToText != DevPathToTextEndInstance)) {
|
---|
2463 | if (Str.Str[Str.Count] != L',') {
|
---|
2464 | UefiDevicePathLibCatPrint (&Str, L"/");
|
---|
2465 | }
|
---|
2466 | }
|
---|
2467 |
|
---|
2468 | AlignedNode = AllocateCopyPool (DevicePathNodeLength (Node), Node);
|
---|
2469 | //
|
---|
2470 | // Print this node of the device path
|
---|
2471 | //
|
---|
2472 | ToText (&Str, AlignedNode, DisplayOnly, AllowShortcuts);
|
---|
2473 | FreePool (AlignedNode);
|
---|
2474 |
|
---|
2475 | //
|
---|
2476 | // Next device path node
|
---|
2477 | //
|
---|
2478 | Node = NextDevicePathNode (Node);
|
---|
2479 | }
|
---|
2480 |
|
---|
2481 | if (Str.Str == NULL) {
|
---|
2482 | return AllocateZeroPool (sizeof (CHAR16));
|
---|
2483 | } else {
|
---|
2484 | return Str.Str;
|
---|
2485 | }
|
---|
2486 | }
|
---|