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