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