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