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