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