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