]>
Commit | Line | Data |
---|---|---|
5c08e117 | 1 | /** @file\r |
2 | BDS internal function define the default device path string, it can be\r | |
3 | replaced by platform device path.\r | |
4 | \r | |
5 | Copyright (c) 2004 - 2008, Intel Corporation. <BR>\r | |
6 | All rights reserved. This program and the accompanying materials\r | |
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 | |
10 | \r | |
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 | |
13 | \r | |
14 | **/\r | |
15 | \r | |
16 | #include "InternalBdsLib.h"\r | |
17 | \r | |
18 | /**\r | |
19 | Concatenates a formatted unicode string to allocated pool.\r | |
20 | The caller must free the resulting buffer.\r | |
21 | \r | |
22 | @param Str Tracks the allocated pool, size in use, and amount of pool allocated.\r | |
b4b6c8de | 23 | @param Fmt The format string\r |
5c08e117 | 24 | @param ... The data will be printed.\r |
25 | \r | |
26 | @return Allocated buffer with the formatted string printed in it.\r | |
27 | The caller must free the allocated buffer.\r | |
28 | The buffer allocation is not packed.\r | |
29 | \r | |
30 | **/\r | |
31 | CHAR16 *\r | |
32 | EFIAPI\r | |
33 | CatPrint (\r | |
34 | IN OUT POOL_PRINT *Str,\r | |
b4b6c8de | 35 | IN CHAR16 *Fmt,\r |
5c08e117 | 36 | ...\r |
37 | )\r | |
38 | {\r | |
39 | UINT16 *AppendStr;\r | |
40 | VA_LIST Args;\r | |
41 | UINTN StringSize;\r | |
42 | \r | |
43 | AppendStr = AllocateZeroPool (0x1000);\r | |
44 | if (AppendStr == NULL) {\r | |
b4b6c8de | 45 | return Str->Str;\r |
5c08e117 | 46 | }\r |
47 | \r | |
b4b6c8de LG |
48 | VA_START (Args, Fmt);\r |
49 | UnicodeVSPrint (AppendStr, 0x1000, Fmt, Args);\r | |
5c08e117 | 50 | VA_END (Args);\r |
b4b6c8de | 51 | if (NULL == Str->Str) {\r |
5c08e117 | 52 | StringSize = StrSize (AppendStr);\r |
b4b6c8de LG |
53 | Str->Str = AllocateZeroPool (StringSize);\r |
54 | ASSERT (Str->Str != NULL);\r | |
5c08e117 | 55 | } else {\r |
56 | StringSize = StrSize (AppendStr);\r | |
b4b6c8de | 57 | StringSize += (StrSize (Str->Str) - sizeof (UINT16));\r |
5c08e117 | 58 | \r |
b4b6c8de LG |
59 | Str->Str = ReallocatePool (\r |
60 | StrSize (Str->Str),\r | |
5c08e117 | 61 | StringSize,\r |
b4b6c8de | 62 | Str->Str\r |
5c08e117 | 63 | );\r |
b4b6c8de | 64 | ASSERT (Str->Str != NULL);\r |
5c08e117 | 65 | }\r |
66 | \r | |
b4b6c8de LG |
67 | Str->Maxlen = MAX_CHAR * sizeof (UINT16);\r |
68 | if (StringSize < Str->Maxlen) {\r | |
69 | StrCat (Str->Str, AppendStr);\r | |
70 | Str->Len = StringSize - sizeof (UINT16);\r | |
5c08e117 | 71 | }\r |
72 | \r | |
73 | FreePool (AppendStr);\r | |
b4b6c8de | 74 | return Str->Str;\r |
5c08e117 | 75 | }\r |
76 | \r | |
77 | /**\r | |
78 | Convert Device Path to a Unicode string for printing.\r | |
79 | \r | |
80 | @param Str The buffer holding the output string.\r | |
81 | This buffer contains the length of the\r | |
82 | string and the maixmum length reserved\r | |
83 | for the string buffer.\r | |
84 | @param DevPath The device path.\r | |
85 | \r | |
86 | **/\r | |
87 | VOID\r | |
88 | DevPathPci (\r | |
89 | IN OUT POOL_PRINT *Str,\r | |
90 | IN VOID *DevPath\r | |
91 | )\r | |
92 | {\r | |
93 | PCI_DEVICE_PATH *Pci;\r | |
94 | \r | |
95 | Pci = DevPath;\r | |
96 | CatPrint (Str, L"Pci(%x|%x)", (UINTN) Pci->Device, (UINTN) Pci->Function);\r | |
97 | }\r | |
98 | \r | |
99 | /**\r | |
100 | Convert Device Path to a Unicode string for printing.\r | |
101 | \r | |
102 | @param Str The buffer holding the output string.\r | |
103 | This buffer contains the length of the\r | |
104 | string and the maixmum length reserved\r | |
105 | for the string buffer.\r | |
106 | @param DevPath The device path.\r | |
107 | \r | |
108 | **/\r | |
109 | VOID\r | |
110 | DevPathPccard (\r | |
111 | IN OUT POOL_PRINT *Str,\r | |
112 | IN VOID *DevPath\r | |
113 | )\r | |
114 | {\r | |
115 | PCCARD_DEVICE_PATH *Pccard;\r | |
116 | \r | |
117 | Pccard = DevPath;\r | |
118 | CatPrint (Str, L"Pcmcia(Function%x)", (UINTN) Pccard->FunctionNumber);\r | |
119 | }\r | |
120 | \r | |
121 | /**\r | |
122 | Convert Device Path to a Unicode string for printing.\r | |
123 | \r | |
124 | @param Str The buffer holding the output string.\r | |
125 | This buffer contains the length of the\r | |
126 | string and the maixmum length reserved\r | |
127 | for the string buffer.\r | |
128 | @param DevPath The device path.\r | |
129 | \r | |
130 | **/\r | |
131 | VOID\r | |
132 | DevPathMemMap (\r | |
133 | IN OUT POOL_PRINT *Str,\r | |
134 | IN VOID *DevPath\r | |
135 | )\r | |
136 | {\r | |
137 | MEMMAP_DEVICE_PATH *MemMap;\r | |
138 | \r | |
139 | MemMap = DevPath;\r | |
140 | CatPrint (\r | |
141 | Str,\r | |
142 | L"MemMap(%d:%lx-%lx)",\r | |
9aaaeb28 | 143 | (UINTN) MemMap->MemoryType,\r |
5c08e117 | 144 | MemMap->StartingAddress,\r |
145 | MemMap->EndingAddress\r | |
146 | );\r | |
147 | }\r | |
148 | \r | |
149 | /**\r | |
150 | Convert Device Path to a Unicode string for printing.\r | |
151 | \r | |
152 | @param Str The buffer holding the output string.\r | |
153 | This buffer contains the length of the\r | |
154 | string and the maixmum length reserved\r | |
155 | for the string buffer.\r | |
156 | @param DevPath The device path.\r | |
157 | \r | |
158 | **/\r | |
159 | VOID\r | |
160 | DevPathController (\r | |
161 | IN OUT POOL_PRINT *Str,\r | |
162 | IN VOID *DevPath\r | |
163 | )\r | |
164 | {\r | |
165 | CONTROLLER_DEVICE_PATH *Controller;\r | |
166 | \r | |
167 | Controller = DevPath;\r | |
168 | CatPrint (Str, L"Ctrl(%d)", (UINTN) Controller->ControllerNumber);\r | |
169 | }\r | |
170 | \r | |
171 | \r | |
172 | /**\r | |
173 | Convert Vendor device path to device name.\r | |
174 | \r | |
175 | @param Str The buffer store device name\r | |
176 | @param DevPath Pointer to vendor device path\r | |
177 | \r | |
178 | **/\r | |
179 | VOID\r | |
5c08e117 | 180 | DevPathVendor (\r |
181 | IN OUT POOL_PRINT *Str,\r | |
182 | IN VOID *DevPath\r | |
183 | )\r | |
184 | {\r | |
185 | VENDOR_DEVICE_PATH *Vendor;\r | |
186 | CHAR16 *Type;\r | |
187 | UINTN DataLength;\r | |
188 | UINTN Index;\r | |
189 | UINT32 FlowControlMap;\r | |
190 | \r | |
191 | UINT16 Info;\r | |
192 | \r | |
193 | Vendor = DevPath;\r | |
194 | \r | |
195 | switch (DevicePathType (&Vendor->Header)) {\r | |
196 | case HARDWARE_DEVICE_PATH:\r | |
197 | Type = L"Hw";\r | |
198 | break;\r | |
199 | \r | |
200 | case MESSAGING_DEVICE_PATH:\r | |
201 | Type = L"Msg";\r | |
202 | if (CompareGuid (&Vendor->Guid, &gEfiPcAnsiGuid)) {\r | |
203 | CatPrint (Str, L"VenPcAnsi()");\r | |
204 | return ;\r | |
205 | } else if (CompareGuid (&Vendor->Guid, &gEfiVT100Guid)) {\r | |
206 | CatPrint (Str, L"VenVt100()");\r | |
207 | return ;\r | |
208 | } else if (CompareGuid (&Vendor->Guid, &gEfiVT100PlusGuid)) {\r | |
209 | CatPrint (Str, L"VenVt100Plus()");\r | |
210 | return ;\r | |
211 | } else if (CompareGuid (&Vendor->Guid, &gEfiVTUTF8Guid)) {\r | |
212 | CatPrint (Str, L"VenUft8()");\r | |
213 | return ;\r | |
214 | } else if (CompareGuid (&Vendor->Guid, &gEfiUartDevicePathGuid )) {\r | |
215 | FlowControlMap = (((UART_FLOW_CONTROL_DEVICE_PATH *) Vendor)->FlowControlMap);\r | |
216 | switch (FlowControlMap & 0x00000003) {\r | |
217 | case 0:\r | |
218 | CatPrint (Str, L"UartFlowCtrl(%s)", L"None");\r | |
219 | break;\r | |
220 | \r | |
221 | case 1:\r | |
222 | CatPrint (Str, L"UartFlowCtrl(%s)", L"Hardware");\r | |
223 | break;\r | |
224 | \r | |
225 | case 2:\r | |
226 | CatPrint (Str, L"UartFlowCtrl(%s)", L"XonXoff");\r | |
227 | break;\r | |
228 | \r | |
229 | default:\r | |
230 | break;\r | |
231 | }\r | |
232 | \r | |
233 | return ;\r | |
234 | \r | |
235 | } else if (CompareGuid (&Vendor->Guid, &gEfiSasDevicePathGuid)) {\r | |
236 | CatPrint (\r | |
237 | Str,\r | |
238 | L"SAS(%lx,%lx,%x,",\r | |
239 | ((SAS_DEVICE_PATH *) Vendor)->SasAddress,\r | |
240 | ((SAS_DEVICE_PATH *) Vendor)->Lun,\r | |
9aaaeb28 | 241 | (UINTN) ((SAS_DEVICE_PATH *) Vendor)->RelativeTargetPort\r |
5c08e117 | 242 | );\r |
243 | Info = (((SAS_DEVICE_PATH *) Vendor)->DeviceTopology);\r | |
244 | if ((Info & 0x0f) == 0) {\r | |
245 | CatPrint (Str, L"NoTopology,0,0,0,");\r | |
246 | } else if (((Info & 0x0f) == 1) || ((Info & 0x0f) == 2)) {\r | |
247 | CatPrint (\r | |
248 | Str,\r | |
249 | L"%s,%s,%s,",\r | |
250 | ((Info & (0x1 << 4)) != 0) ? L"SATA" : L"SAS",\r | |
251 | ((Info & (0x1 << 5)) != 0) ? L"External" : L"Internal",\r | |
252 | ((Info & (0x1 << 6)) != 0) ? L"Expanded" : L"Direct"\r | |
253 | );\r | |
254 | if ((Info & 0x0f) == 1) {\r | |
255 | CatPrint (Str, L"0,");\r | |
256 | } else {\r | |
257 | CatPrint (Str, L"%x,", (UINTN) ((Info >> 8) & 0xff));\r | |
258 | }\r | |
259 | } else {\r | |
260 | CatPrint (Str, L"0,0,0,0,");\r | |
261 | }\r | |
262 | \r | |
263 | CatPrint (Str, L"%x)", (UINTN) ((SAS_DEVICE_PATH *) Vendor)->Reserved);\r | |
264 | return ;\r | |
265 | \r | |
266 | } else if (CompareGuid (&Vendor->Guid, &gEfiDebugPortProtocolGuid)) {\r | |
267 | CatPrint (Str, L"DebugPort()");\r | |
268 | return ;\r | |
269 | }\r | |
270 | break;\r | |
271 | \r | |
272 | case MEDIA_DEVICE_PATH:\r | |
273 | Type = L"Media";\r | |
274 | break;\r | |
275 | \r | |
276 | default:\r | |
277 | Type = L"?";\r | |
278 | break;\r | |
279 | }\r | |
280 | \r | |
281 | CatPrint (Str, L"Ven%s(%g", Type, &Vendor->Guid);\r | |
282 | DataLength = DevicePathNodeLength (&Vendor->Header) - sizeof (VENDOR_DEVICE_PATH);\r | |
283 | if (DataLength > 0) {\r | |
284 | CatPrint (Str, L",");\r | |
285 | for (Index = 0; Index < DataLength; Index++) {\r | |
286 | CatPrint (Str, L"%02x", (UINTN) ((VENDOR_DEVICE_PATH_WITH_DATA *) Vendor)->VendorDefinedData[Index]);\r | |
287 | }\r | |
288 | }\r | |
289 | CatPrint (Str, L")");\r | |
290 | }\r | |
291 | \r | |
292 | /**\r | |
293 | Convert Device Path to a Unicode string for printing.\r | |
294 | \r | |
295 | @param Str The buffer holding the output string.\r | |
296 | This buffer contains the length of the\r | |
297 | string and the maixmum length reserved\r | |
298 | for the string buffer.\r | |
299 | @param DevPath The device path.\r | |
300 | \r | |
301 | **/\r | |
302 | VOID\r | |
303 | DevPathAcpi (\r | |
304 | IN OUT POOL_PRINT *Str,\r | |
305 | IN VOID *DevPath\r | |
306 | )\r | |
307 | {\r | |
308 | ACPI_HID_DEVICE_PATH *Acpi;\r | |
309 | \r | |
310 | Acpi = DevPath;\r | |
311 | if ((Acpi->HID & PNP_EISA_ID_MASK) == PNP_EISA_ID_CONST) {\r | |
312 | CatPrint (Str, L"Acpi(PNP%04x,%x)", (UINTN) EISA_ID_TO_NUM (Acpi->HID), (UINTN) Acpi->UID);\r | |
313 | } else {\r | |
314 | CatPrint (Str, L"Acpi(%08x,%x)", (UINTN) Acpi->HID, (UINTN) Acpi->UID);\r | |
315 | }\r | |
316 | }\r | |
317 | \r | |
318 | /**\r | |
319 | Convert Device Path to a Unicode string for printing.\r | |
320 | \r | |
321 | @param Str The buffer holding the output string.\r | |
322 | This buffer contains the length of the\r | |
323 | string and the maixmum length reserved\r | |
324 | for the string buffer.\r | |
325 | @param DevPath The device path.\r | |
326 | \r | |
327 | **/\r | |
328 | VOID\r | |
329 | DevPathExtendedAcpi (\r | |
330 | IN OUT POOL_PRINT *Str,\r | |
331 | IN VOID *DevPath\r | |
332 | )\r | |
333 | {\r | |
334 | ACPI_EXTENDED_HID_DEVICE_PATH *ExtendedAcpi;\r | |
335 | \r | |
336 | //\r | |
337 | // Index for HID, UID and CID strings, 0 for non-exist\r | |
338 | //\r | |
339 | UINT16 HIDSTRIdx;\r | |
340 | UINT16 UIDSTRIdx;\r | |
341 | UINT16 CIDSTRIdx;\r | |
342 | UINT16 Index;\r | |
343 | UINT16 Length;\r | |
344 | UINT16 Anchor;\r | |
345 | CHAR8 *AsChar8Array;\r | |
346 | \r | |
5c08e117 | 347 | HIDSTRIdx = 0;\r |
348 | UIDSTRIdx = 0;\r | |
349 | CIDSTRIdx = 0;\r | |
350 | ExtendedAcpi = DevPath;\r | |
351 | Length = (UINT16) DevicePathNodeLength ((EFI_DEVICE_PATH_PROTOCOL *) ExtendedAcpi);\r | |
352 | \r | |
5c08e117 | 353 | AsChar8Array = (CHAR8 *) ExtendedAcpi;\r |
354 | \r | |
355 | //\r | |
356 | // find HIDSTR\r | |
357 | //\r | |
358 | Anchor = 16;\r | |
359 | for (Index = Anchor; Index < Length && AsChar8Array[Index] != '\0'; Index++) {\r | |
360 | ;\r | |
361 | }\r | |
362 | if (Index > Anchor) {\r | |
363 | HIDSTRIdx = Anchor;\r | |
364 | }\r | |
365 | //\r | |
366 | // find UIDSTR\r | |
367 | //\r | |
368 | Anchor = (UINT16) (Index + 1);\r | |
369 | for (Index = Anchor; Index < Length && AsChar8Array[Index] != '\0'; Index++) {\r | |
370 | ;\r | |
371 | }\r | |
372 | if (Index > Anchor) {\r | |
373 | UIDSTRIdx = Anchor;\r | |
374 | }\r | |
375 | //\r | |
376 | // find CIDSTR\r | |
377 | //\r | |
378 | Anchor = (UINT16) (Index + 1);\r | |
379 | for (Index = Anchor; Index < Length && AsChar8Array[Index] != '\0'; Index++) {\r | |
380 | ;\r | |
381 | }\r | |
382 | if (Index > Anchor) {\r | |
383 | CIDSTRIdx = Anchor;\r | |
384 | }\r | |
385 | \r | |
386 | if (HIDSTRIdx == 0 && CIDSTRIdx == 0 && ExtendedAcpi->UID == 0) {\r | |
387 | CatPrint (Str, L"AcpiExp(");\r | |
388 | if ((ExtendedAcpi->HID & PNP_EISA_ID_MASK) == PNP_EISA_ID_CONST) {\r | |
389 | CatPrint (Str, L"PNP%04x,", (UINTN) EISA_ID_TO_NUM (ExtendedAcpi->HID));\r | |
390 | } else {\r | |
391 | CatPrint (Str, L"%08x,", (UINTN) ExtendedAcpi->HID);\r | |
392 | }\r | |
393 | if ((ExtendedAcpi->CID & PNP_EISA_ID_MASK) == PNP_EISA_ID_CONST) {\r | |
394 | CatPrint (Str, L"PNP%04x,", (UINTN) EISA_ID_TO_NUM (ExtendedAcpi->CID));\r | |
395 | } else {\r | |
396 | CatPrint (Str, L"%08x,", (UINTN) ExtendedAcpi->CID);\r | |
397 | }\r | |
398 | if (UIDSTRIdx != 0) {\r | |
399 | CatPrint (Str, L"%a)", AsChar8Array + UIDSTRIdx);\r | |
400 | } else {\r | |
401 | CatPrint (Str, L"\"\")");\r | |
402 | }\r | |
403 | } else {\r | |
404 | CatPrint (Str, L"AcpiEx(");\r | |
405 | if ((ExtendedAcpi->HID & PNP_EISA_ID_MASK) == PNP_EISA_ID_CONST) {\r | |
406 | CatPrint (Str, L"PNP%04x,", (UINTN) EISA_ID_TO_NUM (ExtendedAcpi->HID));\r | |
407 | } else {\r | |
408 | CatPrint (Str, L"%08x,", (UINTN) ExtendedAcpi->HID);\r | |
409 | }\r | |
410 | if ((ExtendedAcpi->CID & PNP_EISA_ID_MASK) == PNP_EISA_ID_CONST) {\r | |
411 | CatPrint (Str, L"PNP%04x,", (UINTN) EISA_ID_TO_NUM (ExtendedAcpi->CID));\r | |
412 | } else {\r | |
413 | CatPrint (Str, L"%08x,", (UINTN) ExtendedAcpi->CID);\r | |
414 | }\r | |
415 | CatPrint (Str, L"%x,", (UINTN) ExtendedAcpi->UID);\r | |
416 | \r | |
417 | if (HIDSTRIdx != 0) {\r | |
418 | CatPrint (Str, L"%a,", AsChar8Array + HIDSTRIdx);\r | |
419 | } else {\r | |
420 | CatPrint (Str, L"\"\",");\r | |
421 | }\r | |
422 | if (CIDSTRIdx != 0) {\r | |
423 | CatPrint (Str, L"%a,", AsChar8Array + CIDSTRIdx);\r | |
424 | } else {\r | |
425 | CatPrint (Str, L"\"\",");\r | |
426 | }\r | |
427 | if (UIDSTRIdx != 0) {\r | |
428 | CatPrint (Str, L"%a)", AsChar8Array + UIDSTRIdx);\r | |
429 | } else {\r | |
430 | CatPrint (Str, L"\"\")");\r | |
431 | }\r | |
432 | }\r | |
433 | \r | |
434 | }\r | |
435 | \r | |
436 | /**\r | |
437 | Convert Device Path to a Unicode string for printing.\r | |
438 | \r | |
439 | @param Str The buffer holding the output string.\r | |
440 | This buffer contains the length of the\r | |
441 | string and the maixmum length reserved\r | |
442 | for the string buffer.\r | |
443 | @param DevPath The device path.\r | |
444 | \r | |
445 | **/\r | |
446 | VOID\r | |
447 | DevPathAdrAcpi (\r | |
448 | IN OUT POOL_PRINT *Str,\r | |
449 | IN VOID *DevPath\r | |
450 | )\r | |
451 | {\r | |
452 | ACPI_ADR_DEVICE_PATH *AcpiAdr;\r | |
453 | UINT16 Index;\r | |
454 | UINT16 Length;\r | |
455 | UINT16 AdditionalAdrCount;\r | |
456 | \r | |
457 | AcpiAdr = DevPath;\r | |
458 | Length = (UINT16) DevicePathNodeLength ((EFI_DEVICE_PATH_PROTOCOL *) AcpiAdr);\r | |
459 | AdditionalAdrCount = (UINT16) ((Length - 8) / 4);\r | |
460 | \r | |
461 | CatPrint (Str, L"AcpiAdr(%x", (UINTN) AcpiAdr->ADR);\r | |
462 | for (Index = 0; Index < AdditionalAdrCount; Index++) {\r | |
463 | CatPrint (Str, L",%x", (UINTN) *(UINT32 *) ((UINT8 *) AcpiAdr + 8 + Index * 4));\r | |
464 | }\r | |
465 | CatPrint (Str, L")");\r | |
466 | }\r | |
467 | \r | |
468 | /**\r | |
469 | Convert Device Path to a Unicode string for printing.\r | |
470 | \r | |
471 | @param Str The buffer holding the output string.\r | |
472 | This buffer contains the length of the\r | |
473 | string and the maixmum length reserved\r | |
474 | for the string buffer.\r | |
475 | @param DevPath The device path.\r | |
476 | \r | |
477 | **/\r | |
478 | VOID\r | |
479 | DevPathAtapi (\r | |
480 | IN OUT POOL_PRINT *Str,\r | |
481 | IN VOID *DevPath\r | |
482 | )\r | |
483 | {\r | |
484 | ATAPI_DEVICE_PATH *Atapi;\r | |
485 | \r | |
486 | Atapi = DevPath;\r | |
487 | CatPrint (\r | |
488 | Str,\r | |
489 | L"Ata(%s,%s)",\r | |
5540f4aa | 490 | (Atapi->PrimarySecondary != 0)? L"Secondary" : L"Primary",\r |
491 | (Atapi->SlaveMaster != 0)? L"Slave" : L"Master"\r | |
5c08e117 | 492 | );\r |
493 | }\r | |
494 | \r | |
495 | /**\r | |
496 | Convert Device Path to a Unicode string for printing.\r | |
497 | \r | |
498 | @param Str The buffer holding the output string.\r | |
499 | This buffer contains the length of the\r | |
500 | string and the maixmum length reserved\r | |
501 | for the string buffer.\r | |
502 | @param DevPath The device path.\r | |
503 | \r | |
504 | **/\r | |
505 | VOID\r | |
506 | DevPathScsi (\r | |
507 | IN OUT POOL_PRINT *Str,\r | |
508 | IN VOID *DevPath\r | |
509 | )\r | |
510 | {\r | |
511 | SCSI_DEVICE_PATH *Scsi;\r | |
512 | \r | |
513 | Scsi = DevPath;\r | |
514 | CatPrint (Str, L"Scsi(Pun%x,Lun%x)", (UINTN) Scsi->Pun, (UINTN) Scsi->Lun);\r | |
515 | }\r | |
516 | \r | |
517 | /**\r | |
518 | Convert Device Path to a Unicode string for printing.\r | |
519 | \r | |
520 | @param Str The buffer holding the output string.\r | |
521 | This buffer contains the length of the\r | |
522 | string and the maixmum length reserved\r | |
523 | for the string buffer.\r | |
524 | @param DevPath The device path.\r | |
525 | \r | |
526 | **/\r | |
527 | VOID\r | |
528 | DevPathFibre (\r | |
529 | IN OUT POOL_PRINT *Str,\r | |
530 | IN VOID *DevPath\r | |
531 | )\r | |
532 | {\r | |
533 | FIBRECHANNEL_DEVICE_PATH *Fibre;\r | |
534 | \r | |
535 | Fibre = DevPath;\r | |
536 | CatPrint (Str, L"Fibre(Wwn%lx,Lun%x)", Fibre->WWN, Fibre->Lun);\r | |
537 | }\r | |
538 | \r | |
539 | /**\r | |
540 | Convert Device Path to a Unicode string for printing.\r | |
541 | \r | |
542 | @param Str The buffer holding the output string.\r | |
543 | This buffer contains the length of the\r | |
544 | string and the maixmum length reserved\r | |
545 | for the string buffer.\r | |
546 | @param DevPath The device path.\r | |
547 | \r | |
548 | **/\r | |
549 | VOID\r | |
550 | DevPath1394 (\r | |
551 | IN OUT POOL_PRINT *Str,\r | |
552 | IN VOID *DevPath\r | |
553 | )\r | |
554 | {\r | |
555 | F1394_DEVICE_PATH *F1394Path;\r | |
556 | \r | |
557 | F1394Path = DevPath;\r | |
9aaaeb28 | 558 | CatPrint (Str, L"1394(%lx)", &F1394Path->Guid);\r |
5c08e117 | 559 | }\r |
560 | \r | |
561 | /**\r | |
562 | Convert Device Path to a Unicode string for printing.\r | |
563 | \r | |
564 | @param Str The buffer holding the output string.\r | |
565 | This buffer contains the length of the\r | |
566 | string and the maixmum length reserved\r | |
567 | for the string buffer.\r | |
568 | @param DevPath The device path.\r | |
569 | \r | |
570 | **/\r | |
571 | VOID\r | |
572 | DevPathUsb (\r | |
573 | IN OUT POOL_PRINT *Str,\r | |
574 | IN VOID *DevPath\r | |
575 | )\r | |
576 | {\r | |
577 | USB_DEVICE_PATH *Usb;\r | |
578 | \r | |
579 | Usb = DevPath;\r | |
580 | CatPrint (Str, L"Usb(%x,%x)", (UINTN) Usb->ParentPortNumber, (UINTN) Usb->InterfaceNumber);\r | |
581 | }\r | |
582 | \r | |
583 | /**\r | |
584 | Convert Device Path to a Unicode string for printing.\r | |
585 | \r | |
586 | @param Str The buffer holding the output string.\r | |
587 | This buffer contains the length of the\r | |
588 | string and the maixmum length reserved\r | |
589 | for the string buffer.\r | |
590 | @param DevPath The device path.\r | |
591 | \r | |
592 | **/\r | |
593 | VOID\r | |
594 | DevPathUsbWWID (\r | |
595 | IN OUT POOL_PRINT *Str,\r | |
596 | IN VOID *DevPath\r | |
597 | )\r | |
598 | {\r | |
599 | USB_WWID_DEVICE_PATH *UsbWWId;\r | |
600 | \r | |
601 | UsbWWId = DevPath;\r | |
602 | CatPrint (\r | |
603 | Str,\r | |
604 | L"UsbWwid(%x,%x,%x,\"WWID\")",\r | |
605 | (UINTN) UsbWWId->VendorId,\r | |
606 | (UINTN) UsbWWId->ProductId,\r | |
607 | (UINTN) UsbWWId->InterfaceNumber\r | |
608 | );\r | |
609 | }\r | |
610 | \r | |
611 | /**\r | |
612 | Convert Device Path to a Unicode string for printing.\r | |
613 | \r | |
614 | @param Str The buffer holding the output string.\r | |
615 | This buffer contains the length of the\r | |
616 | string and the maixmum length reserved\r | |
617 | for the string buffer.\r | |
618 | @param DevPath The device path.\r | |
619 | \r | |
620 | **/\r | |
621 | VOID\r | |
622 | DevPathLogicalUnit (\r | |
623 | IN OUT POOL_PRINT *Str,\r | |
624 | IN VOID *DevPath\r | |
625 | )\r | |
626 | {\r | |
627 | DEVICE_LOGICAL_UNIT_DEVICE_PATH *LogicalUnit;\r | |
628 | \r | |
629 | LogicalUnit = DevPath;\r | |
630 | CatPrint (Str, L"Unit(%x)", (UINTN) LogicalUnit->Lun);\r | |
631 | }\r | |
632 | \r | |
633 | /**\r | |
634 | Convert Device Path to a Unicode string for printing.\r | |
635 | \r | |
636 | @param Str The buffer holding the output string.\r | |
637 | This buffer contains the length of the\r | |
638 | string and the maixmum length reserved\r | |
639 | for the string buffer.\r | |
640 | @param DevPath The device path.\r | |
641 | \r | |
642 | **/\r | |
643 | VOID\r | |
644 | DevPathUsbClass (\r | |
645 | IN OUT POOL_PRINT *Str,\r | |
646 | IN VOID *DevPath\r | |
647 | )\r | |
648 | {\r | |
649 | USB_CLASS_DEVICE_PATH *UsbClass;\r | |
650 | \r | |
651 | UsbClass = DevPath;\r | |
652 | CatPrint (\r | |
653 | Str,\r | |
654 | L"Usb Class(%x,%x,%x,%x,%x)",\r | |
655 | (UINTN) UsbClass->VendorId,\r | |
656 | (UINTN) UsbClass->ProductId,\r | |
657 | (UINTN) UsbClass->DeviceClass,\r | |
658 | (UINTN) UsbClass->DeviceSubClass,\r | |
659 | (UINTN) UsbClass->DeviceProtocol\r | |
660 | );\r | |
661 | }\r | |
662 | \r | |
663 | /**\r | |
664 | Convert Device Path to a Unicode string for printing.\r | |
665 | \r | |
666 | @param Str The buffer holding the output string.\r | |
667 | This buffer contains the length of the\r | |
668 | string and the maixmum length reserved\r | |
669 | for the string buffer.\r | |
670 | @param DevPath The device path.\r | |
671 | \r | |
672 | **/\r | |
673 | VOID\r | |
674 | DevPathSata (\r | |
675 | IN OUT POOL_PRINT *Str,\r | |
676 | IN VOID *DevPath\r | |
677 | )\r | |
678 | {\r | |
679 | SATA_DEVICE_PATH *Sata;\r | |
680 | \r | |
681 | Sata = DevPath;\r | |
5540f4aa | 682 | if ((Sata->PortMultiplierPortNumber & SATA_HBA_DIRECT_CONNECT_FLAG) != 0) {\r |
9aaaeb28 | 683 | CatPrint (\r |
684 | Str,\r | |
685 | L"Sata(%x,%x)",\r | |
686 | (UINTN) Sata->HBAPortNumber,\r | |
687 | (UINTN) Sata->Lun\r | |
688 | );\r | |
689 | } else {\r | |
690 | CatPrint (\r | |
691 | Str,\r | |
692 | L"Sata(%x,%x,%x)",\r | |
693 | (UINTN) Sata->HBAPortNumber,\r | |
694 | (UINTN) Sata->PortMultiplierPortNumber,\r | |
695 | (UINTN) Sata->Lun\r | |
696 | );\r | |
697 | }\r | |
5c08e117 | 698 | }\r |
699 | \r | |
700 | /**\r | |
701 | Convert Device Path to a Unicode string for printing.\r | |
702 | \r | |
703 | @param Str The buffer holding the output string.\r | |
704 | This buffer contains the length of the\r | |
705 | string and the maixmum length reserved\r | |
706 | for the string buffer.\r | |
707 | @param DevPath The device path.\r | |
708 | \r | |
709 | **/\r | |
710 | VOID\r | |
711 | DevPathI2O (\r | |
712 | IN OUT POOL_PRINT *Str,\r | |
713 | IN VOID *DevPath\r | |
714 | )\r | |
715 | {\r | |
716 | I2O_DEVICE_PATH *I2OPath;\r | |
717 | \r | |
718 | I2OPath = DevPath;\r | |
719 | CatPrint (Str, L"I2O(%x)", (UINTN) I2OPath->Tid);\r | |
720 | }\r | |
721 | \r | |
722 | /**\r | |
723 | Convert Device Path to a Unicode string for printing.\r | |
724 | \r | |
725 | @param Str The buffer holding the output string.\r | |
726 | This buffer contains the length of the\r | |
727 | string and the maixmum length reserved\r | |
728 | for the string buffer.\r | |
729 | @param DevPath The device path.\r | |
730 | \r | |
731 | **/\r | |
732 | VOID\r | |
733 | DevPathMacAddr (\r | |
734 | IN OUT POOL_PRINT *Str,\r | |
735 | IN VOID *DevPath\r | |
736 | )\r | |
737 | {\r | |
738 | MAC_ADDR_DEVICE_PATH *MACDevPath;\r | |
739 | UINTN HwAddressSize;\r | |
740 | UINTN Index;\r | |
741 | \r | |
742 | MACDevPath = DevPath;\r | |
743 | \r | |
744 | HwAddressSize = sizeof (EFI_MAC_ADDRESS);\r | |
745 | if (MACDevPath->IfType == 0x01 || MACDevPath->IfType == 0x00) {\r | |
746 | HwAddressSize = 6;\r | |
747 | }\r | |
748 | \r | |
749 | CatPrint (Str, L"Mac(");\r | |
750 | \r | |
751 | for (Index = 0; Index < HwAddressSize; Index++) {\r | |
752 | CatPrint (Str, L"%02x", (UINTN) MACDevPath->MacAddress.Addr[Index]);\r | |
753 | }\r | |
754 | \r | |
755 | CatPrint (Str, L")");\r | |
756 | }\r | |
757 | \r | |
758 | /**\r | |
759 | Convert Device Path to a Unicode string for printing.\r | |
760 | \r | |
761 | @param Str The buffer holding the output string.\r | |
762 | This buffer contains the length of the\r | |
763 | string and the maixmum length reserved\r | |
764 | for the string buffer.\r | |
765 | @param DevPath The device path.\r | |
766 | \r | |
767 | **/\r | |
768 | VOID\r | |
769 | DevPathIPv4 (\r | |
770 | IN OUT POOL_PRINT *Str,\r | |
771 | IN VOID *DevPath\r | |
772 | )\r | |
773 | {\r | |
774 | IPv4_DEVICE_PATH *IPDevPath;\r | |
775 | \r | |
776 | IPDevPath = DevPath;\r | |
777 | CatPrint (\r | |
778 | Str,\r | |
779 | L"IPv4(%d.%d.%d.%d:%d)",\r | |
780 | (UINTN) IPDevPath->RemoteIpAddress.Addr[0],\r | |
781 | (UINTN) IPDevPath->RemoteIpAddress.Addr[1],\r | |
782 | (UINTN) IPDevPath->RemoteIpAddress.Addr[2],\r | |
783 | (UINTN) IPDevPath->RemoteIpAddress.Addr[3],\r | |
784 | (UINTN) IPDevPath->RemotePort\r | |
785 | );\r | |
786 | }\r | |
787 | \r | |
788 | /**\r | |
789 | Convert Device Path to a Unicode string for printing.\r | |
790 | \r | |
791 | @param Str The buffer holding the output string.\r | |
792 | This buffer contains the length of the\r | |
793 | string and the maixmum length reserved\r | |
794 | for the string buffer.\r | |
795 | @param DevPath The device path.\r | |
796 | \r | |
797 | **/\r | |
798 | VOID\r | |
799 | DevPathIPv6 (\r | |
800 | IN OUT POOL_PRINT *Str,\r | |
801 | IN VOID *DevPath\r | |
802 | )\r | |
803 | {\r | |
804 | IPv6_DEVICE_PATH *IPv6DevPath;\r | |
805 | \r | |
806 | IPv6DevPath = DevPath;\r | |
807 | CatPrint (\r | |
808 | Str,\r | |
809 | L"IPv6(%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x)",\r | |
810 | (UINTN) IPv6DevPath->RemoteIpAddress.Addr[0],\r | |
811 | (UINTN) IPv6DevPath->RemoteIpAddress.Addr[1],\r | |
812 | (UINTN) IPv6DevPath->RemoteIpAddress.Addr[2],\r | |
813 | (UINTN) IPv6DevPath->RemoteIpAddress.Addr[3],\r | |
814 | (UINTN) IPv6DevPath->RemoteIpAddress.Addr[4],\r | |
815 | (UINTN) IPv6DevPath->RemoteIpAddress.Addr[5],\r | |
816 | (UINTN) IPv6DevPath->RemoteIpAddress.Addr[6],\r | |
817 | (UINTN) IPv6DevPath->RemoteIpAddress.Addr[7],\r | |
818 | (UINTN) IPv6DevPath->RemoteIpAddress.Addr[8],\r | |
819 | (UINTN) IPv6DevPath->RemoteIpAddress.Addr[9],\r | |
820 | (UINTN) IPv6DevPath->RemoteIpAddress.Addr[10],\r | |
821 | (UINTN) IPv6DevPath->RemoteIpAddress.Addr[11],\r | |
822 | (UINTN) IPv6DevPath->RemoteIpAddress.Addr[12],\r | |
823 | (UINTN) IPv6DevPath->RemoteIpAddress.Addr[13],\r | |
824 | (UINTN) IPv6DevPath->RemoteIpAddress.Addr[14],\r | |
825 | (UINTN) IPv6DevPath->RemoteIpAddress.Addr[15]\r | |
826 | );\r | |
827 | }\r | |
828 | \r | |
829 | /**\r | |
830 | Convert Device Path to a Unicode string for printing.\r | |
831 | \r | |
832 | @param Str The buffer holding the output string.\r | |
833 | This buffer contains the length of the\r | |
834 | string and the maixmum length reserved\r | |
835 | for the string buffer.\r | |
836 | @param DevPath The device path.\r | |
837 | \r | |
838 | **/\r | |
839 | VOID\r | |
840 | DevPathInfiniBand (\r | |
841 | IN OUT POOL_PRINT *Str,\r | |
842 | IN VOID *DevPath\r | |
843 | )\r | |
844 | {\r | |
845 | INFINIBAND_DEVICE_PATH *InfiniBand;\r | |
846 | \r | |
847 | InfiniBand = DevPath;\r | |
848 | CatPrint (\r | |
849 | Str,\r | |
850 | L"Infiniband(%x,%g,%lx,%lx,%lx)",\r | |
851 | (UINTN) InfiniBand->ResourceFlags,\r | |
852 | InfiniBand->PortGid,\r | |
853 | InfiniBand->ServiceId,\r | |
854 | InfiniBand->TargetPortId,\r | |
855 | InfiniBand->DeviceId\r | |
856 | );\r | |
857 | }\r | |
858 | \r | |
859 | /**\r | |
860 | Convert Device Path to a Unicode string for printing.\r | |
861 | \r | |
862 | @param Str The buffer holding the output string.\r | |
863 | This buffer contains the length of the\r | |
864 | string and the maixmum length reserved\r | |
865 | for the string buffer.\r | |
866 | @param DevPath The device path.\r | |
867 | \r | |
868 | **/\r | |
869 | VOID\r | |
870 | DevPathUart (\r | |
871 | IN OUT POOL_PRINT *Str,\r | |
872 | IN VOID *DevPath\r | |
873 | )\r | |
874 | {\r | |
875 | UART_DEVICE_PATH *Uart;\r | |
876 | CHAR8 Parity;\r | |
877 | \r | |
878 | Uart = DevPath;\r | |
879 | switch (Uart->Parity) {\r | |
880 | case 0:\r | |
881 | Parity = 'D';\r | |
882 | break;\r | |
883 | \r | |
884 | case 1:\r | |
885 | Parity = 'N';\r | |
886 | break;\r | |
887 | \r | |
888 | case 2:\r | |
889 | Parity = 'E';\r | |
890 | break;\r | |
891 | \r | |
892 | case 3:\r | |
893 | Parity = 'O';\r | |
894 | break;\r | |
895 | \r | |
896 | case 4:\r | |
897 | Parity = 'M';\r | |
898 | break;\r | |
899 | \r | |
900 | case 5:\r | |
901 | Parity = 'S';\r | |
902 | break;\r | |
903 | \r | |
904 | default:\r | |
905 | Parity = 'x';\r | |
906 | break;\r | |
907 | }\r | |
908 | \r | |
909 | if (Uart->BaudRate == 0) {\r | |
910 | CatPrint (Str, L"Uart(DEFAULT,%c,", Parity);\r | |
911 | } else {\r | |
9aaaeb28 | 912 | CatPrint (Str, L"Uart(%ld,%c,", Uart->BaudRate, Parity);\r |
5c08e117 | 913 | }\r |
914 | \r | |
915 | if (Uart->DataBits == 0) {\r | |
916 | CatPrint (Str, L"D,");\r | |
917 | } else {\r | |
918 | CatPrint (Str, L"%d,", (UINTN) Uart->DataBits);\r | |
919 | }\r | |
920 | \r | |
921 | switch (Uart->StopBits) {\r | |
922 | case 0:\r | |
923 | CatPrint (Str, L"D)");\r | |
924 | break;\r | |
925 | \r | |
926 | case 1:\r | |
927 | CatPrint (Str, L"1)");\r | |
928 | break;\r | |
929 | \r | |
930 | case 2:\r | |
931 | CatPrint (Str, L"1.5)");\r | |
932 | break;\r | |
933 | \r | |
934 | case 3:\r | |
935 | CatPrint (Str, L"2)");\r | |
936 | break;\r | |
937 | \r | |
938 | default:\r | |
939 | CatPrint (Str, L"x)");\r | |
940 | break;\r | |
941 | }\r | |
942 | }\r | |
943 | \r | |
944 | /**\r | |
945 | Convert Device Path to a Unicode string for printing.\r | |
946 | \r | |
947 | @param Str The buffer holding the output string.\r | |
948 | This buffer contains the length of the\r | |
949 | string and the maixmum length reserved\r | |
950 | for the string buffer.\r | |
951 | @param DevPath The device path.\r | |
952 | \r | |
953 | **/\r | |
954 | VOID\r | |
955 | DevPathiSCSI (\r | |
956 | IN OUT POOL_PRINT *Str,\r | |
957 | IN VOID *DevPath\r | |
958 | )\r | |
959 | {\r | |
960 | ISCSI_DEVICE_PATH_WITH_NAME *IScsi;\r | |
961 | UINT16 Options;\r | |
962 | \r | |
5c08e117 | 963 | IScsi = DevPath;\r |
964 | CatPrint (\r | |
965 | Str,\r | |
9aaaeb28 | 966 | L"iSCSI(%a,%x,%lx,",\r |
201e4066 | 967 | IScsi->TargetName,\r |
9aaaeb28 | 968 | (UINTN) IScsi->TargetPortalGroupTag,\r |
5c08e117 | 969 | IScsi->Lun\r |
970 | );\r | |
971 | \r | |
972 | Options = IScsi->LoginOption;\r | |
973 | CatPrint (Str, L"%s,", (((Options >> 1) & 0x0001) != 0) ? L"CRC32C" : L"None");\r | |
974 | CatPrint (Str, L"%s,", (((Options >> 3) & 0x0001) != 0) ? L"CRC32C" : L"None");\r | |
975 | if (((Options >> 11) & 0x0001) != 0) {\r | |
976 | CatPrint (Str, L"%s,", L"None");\r | |
977 | } else if (((Options >> 12) & 0x0001) != 0) {\r | |
978 | CatPrint (Str, L"%s,", L"CHAP_UNI");\r | |
979 | } else {\r | |
980 | CatPrint (Str, L"%s,", L"CHAP_BI");\r | |
981 | \r | |
982 | }\r | |
983 | \r | |
984 | CatPrint (Str, L"%s)", (IScsi->NetworkProtocol == 0) ? L"TCP" : L"reserved");\r | |
985 | }\r | |
986 | \r | |
987 | /**\r | |
988 | Convert Device Path to a Unicode string for printing.\r | |
989 | \r | |
990 | @param Str The buffer holding the output string.\r | |
991 | This buffer contains the length of the\r | |
992 | string and the maixmum length reserved\r | |
993 | for the string buffer.\r | |
994 | @param DevPath The device path.\r | |
995 | \r | |
996 | **/\r | |
997 | VOID\r | |
998 | DevPathHardDrive (\r | |
999 | IN OUT POOL_PRINT *Str,\r | |
1000 | IN VOID *DevPath\r | |
1001 | )\r | |
1002 | {\r | |
1003 | HARDDRIVE_DEVICE_PATH *Hd;\r | |
1004 | \r | |
1005 | Hd = DevPath;\r | |
1006 | switch (Hd->SignatureType) {\r | |
1007 | case SIGNATURE_TYPE_MBR:\r | |
1008 | CatPrint (\r | |
1009 | Str,\r | |
1010 | L"HD(Part%d,Sig%08x)",\r | |
1011 | (UINTN) Hd->PartitionNumber,\r | |
1012 | (UINTN) *((UINT32 *) (&(Hd->Signature[0])))\r | |
1013 | );\r | |
1014 | break;\r | |
1015 | \r | |
1016 | case SIGNATURE_TYPE_GUID:\r | |
1017 | CatPrint (\r | |
1018 | Str,\r | |
1019 | L"HD(Part%d,Sig%g)",\r | |
1020 | (UINTN) Hd->PartitionNumber,\r | |
1021 | (EFI_GUID *) &(Hd->Signature[0])\r | |
1022 | );\r | |
1023 | break;\r | |
1024 | \r | |
1025 | default:\r | |
1026 | CatPrint (\r | |
1027 | Str,\r | |
1028 | L"HD(Part%d,MBRType=%02x,SigType=%02x)",\r | |
1029 | (UINTN) Hd->PartitionNumber,\r | |
1030 | (UINTN) Hd->MBRType,\r | |
1031 | (UINTN) Hd->SignatureType\r | |
1032 | );\r | |
1033 | break;\r | |
1034 | }\r | |
1035 | }\r | |
1036 | \r | |
1037 | /**\r | |
1038 | Convert Device Path to a Unicode string for printing.\r | |
1039 | \r | |
1040 | @param Str The buffer holding the output string.\r | |
1041 | This buffer contains the length of the\r | |
1042 | string and the maixmum length reserved\r | |
1043 | for the string buffer.\r | |
1044 | @param DevPath The device path.\r | |
1045 | \r | |
1046 | **/\r | |
1047 | VOID\r | |
1048 | DevPathCDROM (\r | |
1049 | IN OUT POOL_PRINT *Str,\r | |
1050 | IN VOID *DevPath\r | |
1051 | )\r | |
1052 | {\r | |
1053 | CDROM_DEVICE_PATH *Cd;\r | |
1054 | \r | |
1055 | Cd = DevPath;\r | |
1056 | CatPrint (Str, L"CDROM(Entry%x)", (UINTN) Cd->BootEntry);\r | |
1057 | }\r | |
1058 | \r | |
1059 | /**\r | |
1060 | Convert Device Path to a Unicode string for printing.\r | |
1061 | \r | |
1062 | @param Str The buffer holding the output string.\r | |
1063 | This buffer contains the length of the\r | |
1064 | string and the maixmum length reserved\r | |
1065 | for the string buffer.\r | |
1066 | @param DevPath The device path.\r | |
1067 | \r | |
1068 | **/\r | |
1069 | VOID\r | |
1070 | DevPathFilePath (\r | |
1071 | IN OUT POOL_PRINT *Str,\r | |
1072 | IN VOID *DevPath\r | |
1073 | )\r | |
1074 | {\r | |
1075 | FILEPATH_DEVICE_PATH *Fp;\r | |
1076 | \r | |
1077 | Fp = DevPath;\r | |
1078 | CatPrint (Str, L"%s", Fp->PathName);\r | |
1079 | }\r | |
1080 | \r | |
1081 | /**\r | |
1082 | Convert Device Path to a Unicode string for printing.\r | |
1083 | \r | |
1084 | @param Str The buffer holding the output string.\r | |
1085 | This buffer contains the length of the\r | |
1086 | string and the maixmum length reserved\r | |
1087 | for the string buffer.\r | |
1088 | @param DevPath The device path.\r | |
1089 | \r | |
1090 | **/\r | |
1091 | VOID\r | |
1092 | DevPathMediaProtocol (\r | |
1093 | IN OUT POOL_PRINT *Str,\r | |
1094 | IN VOID *DevPath\r | |
1095 | )\r | |
1096 | {\r | |
1097 | MEDIA_PROTOCOL_DEVICE_PATH *MediaProt;\r | |
1098 | \r | |
1099 | MediaProt = DevPath;\r | |
1100 | CatPrint (Str, L"Media(%g)", &MediaProt->Protocol);\r | |
1101 | }\r | |
1102 | \r | |
1103 | /**\r | |
1104 | Convert Device Path to a Unicode string for printing.\r | |
1105 | \r | |
1106 | @param Str The buffer holding the output string.\r | |
1107 | This buffer contains the length of the\r | |
1108 | string and the maixmum length reserved\r | |
1109 | for the string buffer.\r | |
1110 | @param DevPath The device path.\r | |
1111 | \r | |
1112 | **/\r | |
1113 | VOID\r | |
1114 | DevPathFvFilePath (\r | |
1115 | IN OUT POOL_PRINT *Str,\r | |
1116 | IN VOID *DevPath\r | |
1117 | )\r | |
1118 | {\r | |
1119 | MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *FvFilePath;\r | |
1120 | \r | |
1121 | FvFilePath = DevPath;\r | |
1122 | CatPrint (Str, L"%g", &FvFilePath->FvFileName);\r | |
1123 | }\r | |
1124 | \r | |
8e6b0dcb | 1125 | /**\r |
1126 | Convert Device Path to a Unicode string for printing.\r | |
1127 | \r | |
1128 | @param Str The buffer holding the output string.\r | |
1129 | This buffer contains the length of the\r | |
1130 | string and the maixmum length reserved\r | |
1131 | for the string buffer.\r | |
1132 | @param DevPath The device path.\r | |
1133 | \r | |
1134 | **/\r | |
1135 | VOID\r | |
1136 | DevPathRelativeOffsetRange (\r | |
1137 | IN OUT POOL_PRINT *Str,\r | |
1138 | IN VOID *DevPath\r | |
1139 | )\r | |
1140 | {\r | |
1141 | MEDIA_RELATIVE_OFFSET_RANGE_DEVICE_PATH *Offset;\r | |
1142 | \r | |
1143 | Offset = DevPath;\r | |
1144 | CatPrint (\r | |
1145 | Str,\r | |
1146 | L"Offset(%lx,%lx)",\r | |
1147 | Offset->StartingOffset,\r | |
1148 | Offset->EndingOffset\r | |
1149 | );\r | |
1150 | }\r | |
1151 | \r | |
5c08e117 | 1152 | /**\r |
1153 | Convert Device Path to a Unicode string for printing.\r | |
1154 | \r | |
1155 | @param Str The buffer holding the output string.\r | |
1156 | This buffer contains the length of the\r | |
1157 | string and the maixmum length reserved\r | |
1158 | for the string buffer.\r | |
1159 | @param DevPath The device path.\r | |
1160 | \r | |
1161 | **/\r | |
1162 | VOID\r | |
1163 | DevPathBssBss (\r | |
1164 | IN OUT POOL_PRINT *Str,\r | |
1165 | IN VOID *DevPath\r | |
1166 | )\r | |
1167 | {\r | |
1168 | BBS_BBS_DEVICE_PATH *Bbs;\r | |
1169 | CHAR16 *Type;\r | |
1170 | \r | |
1171 | Bbs = DevPath;\r | |
1172 | switch (Bbs->DeviceType) {\r | |
1173 | case BBS_TYPE_FLOPPY:\r | |
1174 | Type = L"Floppy";\r | |
1175 | break;\r | |
1176 | \r | |
1177 | case BBS_TYPE_HARDDRIVE:\r | |
1178 | Type = L"Harddrive";\r | |
1179 | break;\r | |
1180 | \r | |
1181 | case BBS_TYPE_CDROM:\r | |
1182 | Type = L"CDROM";\r | |
1183 | break;\r | |
1184 | \r | |
1185 | case BBS_TYPE_PCMCIA:\r | |
1186 | Type = L"PCMCIA";\r | |
1187 | break;\r | |
1188 | \r | |
1189 | case BBS_TYPE_USB:\r | |
1190 | Type = L"Usb";\r | |
1191 | break;\r | |
1192 | \r | |
1193 | case BBS_TYPE_EMBEDDED_NETWORK:\r | |
1194 | Type = L"Net";\r | |
1195 | break;\r | |
1196 | \r | |
1197 | case BBS_TYPE_BEV:\r | |
1198 | Type = L"BEV";\r | |
1199 | break;\r | |
1200 | \r | |
1201 | default:\r | |
1202 | Type = L"?";\r | |
1203 | break;\r | |
1204 | }\r | |
1205 | CatPrint (Str, L"Legacy-%s", Type);\r | |
1206 | }\r | |
1207 | \r | |
1208 | /**\r | |
1209 | Convert Device Path to a Unicode string for printing.\r | |
1210 | \r | |
1211 | @param Str The buffer holding the output string.\r | |
1212 | This buffer contains the length of the\r | |
1213 | string and the maixmum length reserved\r | |
1214 | for the string buffer.\r | |
1215 | @param DevPath The device path.\r | |
1216 | \r | |
1217 | **/\r | |
1218 | VOID\r | |
1219 | DevPathEndInstance (\r | |
1220 | IN OUT POOL_PRINT *Str,\r | |
1221 | IN VOID *DevPath\r | |
1222 | )\r | |
1223 | {\r | |
1224 | CatPrint (Str, L",");\r | |
1225 | }\r | |
1226 | \r | |
1227 | /**\r | |
1228 | Convert Device Path to a Unicode string for printing.\r | |
1229 | \r | |
1230 | @param Str The buffer holding the output string.\r | |
1231 | This buffer contains the length of the\r | |
1232 | string and the maixmum length reserved\r | |
1233 | for the string buffer.\r | |
1234 | @param DevPath The device path.\r | |
1235 | \r | |
1236 | **/\r | |
1237 | VOID\r | |
1238 | DevPathNodeUnknown (\r | |
1239 | IN OUT POOL_PRINT *Str,\r | |
1240 | IN VOID *DevPath\r | |
1241 | )\r | |
1242 | {\r | |
1243 | CatPrint (Str, L"?");\r | |
1244 | }\r | |
9aaaeb28 | 1245 | /**\r |
1246 | Convert Device Path to a Unicode string for printing.\r | |
1247 | \r | |
1248 | @param Str The buffer holding the output string.\r | |
1249 | This buffer contains the length of the\r | |
1250 | string and the maximum length reserved\r | |
1251 | for the string buffer.\r | |
1252 | @param DevPath The device path.\r | |
1253 | \r | |
1254 | **/\r | |
1255 | VOID\r | |
1256 | DevPathFvPath (\r | |
1257 | IN OUT POOL_PRINT *Str,\r | |
1258 | IN VOID *DevPath\r | |
1259 | )\r | |
1260 | {\r | |
1261 | MEDIA_FW_VOL_DEVICE_PATH *FvPath;\r | |
1262 | \r | |
1263 | FvPath = DevPath;\r | |
1264 | CatPrint (Str, L"Fv(%g)", &FvPath->FvName);\r | |
1265 | }\r | |
5c08e117 | 1266 | \r |
1267 | DEVICE_PATH_STRING_TABLE DevPathTable[] = {\r | |
1268 | {\r | |
1269 | HARDWARE_DEVICE_PATH,\r | |
1270 | HW_PCI_DP,\r | |
1271 | DevPathPci\r | |
1272 | },\r | |
1273 | {\r | |
1274 | HARDWARE_DEVICE_PATH,\r | |
1275 | HW_PCCARD_DP,\r | |
1276 | DevPathPccard\r | |
1277 | },\r | |
1278 | {\r | |
1279 | HARDWARE_DEVICE_PATH,\r | |
1280 | HW_MEMMAP_DP,\r | |
1281 | DevPathMemMap\r | |
1282 | },\r | |
1283 | {\r | |
1284 | HARDWARE_DEVICE_PATH,\r | |
1285 | HW_VENDOR_DP,\r | |
1286 | DevPathVendor\r | |
1287 | },\r | |
1288 | {\r | |
1289 | HARDWARE_DEVICE_PATH,\r | |
1290 | HW_CONTROLLER_DP,\r | |
1291 | DevPathController\r | |
1292 | },\r | |
1293 | {\r | |
1294 | ACPI_DEVICE_PATH,\r | |
1295 | ACPI_DP,\r | |
1296 | DevPathAcpi\r | |
1297 | },\r | |
1298 | {\r | |
1299 | ACPI_DEVICE_PATH,\r | |
1300 | ACPI_EXTENDED_DP,\r | |
1301 | DevPathExtendedAcpi\r | |
1302 | },\r | |
1303 | {\r | |
1304 | ACPI_DEVICE_PATH,\r | |
1305 | ACPI_ADR_DP,\r | |
1306 | DevPathAdrAcpi\r | |
1307 | },\r | |
1308 | {\r | |
1309 | MESSAGING_DEVICE_PATH,\r | |
1310 | MSG_ATAPI_DP,\r | |
1311 | DevPathAtapi\r | |
1312 | },\r | |
1313 | {\r | |
1314 | MESSAGING_DEVICE_PATH,\r | |
1315 | MSG_SCSI_DP,\r | |
1316 | DevPathScsi\r | |
1317 | },\r | |
1318 | {\r | |
1319 | MESSAGING_DEVICE_PATH,\r | |
1320 | MSG_FIBRECHANNEL_DP,\r | |
1321 | DevPathFibre\r | |
1322 | },\r | |
1323 | {\r | |
1324 | MESSAGING_DEVICE_PATH,\r | |
1325 | MSG_1394_DP,\r | |
1326 | DevPath1394\r | |
1327 | },\r | |
1328 | {\r | |
1329 | MESSAGING_DEVICE_PATH,\r | |
1330 | MSG_USB_DP,\r | |
1331 | DevPathUsb\r | |
1332 | },\r | |
1333 | {\r | |
1334 | MESSAGING_DEVICE_PATH,\r | |
1335 | MSG_USB_WWID_DP,\r | |
1336 | DevPathUsbWWID\r | |
1337 | },\r | |
1338 | {\r | |
1339 | MESSAGING_DEVICE_PATH,\r | |
1340 | MSG_DEVICE_LOGICAL_UNIT_DP,\r | |
1341 | DevPathLogicalUnit\r | |
1342 | },\r | |
1343 | {\r | |
1344 | MESSAGING_DEVICE_PATH,\r | |
1345 | MSG_USB_CLASS_DP,\r | |
1346 | DevPathUsbClass\r | |
1347 | },\r | |
1348 | {\r | |
1349 | MESSAGING_DEVICE_PATH,\r | |
1350 | MSG_SATA_DP,\r | |
1351 | DevPathSata\r | |
1352 | },\r | |
1353 | {\r | |
1354 | MESSAGING_DEVICE_PATH,\r | |
1355 | MSG_I2O_DP,\r | |
1356 | DevPathI2O\r | |
1357 | },\r | |
1358 | {\r | |
1359 | MESSAGING_DEVICE_PATH,\r | |
1360 | MSG_MAC_ADDR_DP,\r | |
1361 | DevPathMacAddr\r | |
1362 | },\r | |
1363 | {\r | |
1364 | MESSAGING_DEVICE_PATH,\r | |
1365 | MSG_IPv4_DP,\r | |
1366 | DevPathIPv4\r | |
1367 | },\r | |
1368 | {\r | |
1369 | MESSAGING_DEVICE_PATH,\r | |
1370 | MSG_IPv6_DP,\r | |
1371 | DevPathIPv6\r | |
1372 | },\r | |
1373 | {\r | |
1374 | MESSAGING_DEVICE_PATH,\r | |
1375 | MSG_INFINIBAND_DP,\r | |
1376 | DevPathInfiniBand\r | |
1377 | },\r | |
1378 | {\r | |
1379 | MESSAGING_DEVICE_PATH,\r | |
1380 | MSG_UART_DP,\r | |
1381 | DevPathUart\r | |
1382 | },\r | |
1383 | {\r | |
1384 | MESSAGING_DEVICE_PATH,\r | |
1385 | MSG_VENDOR_DP,\r | |
1386 | DevPathVendor\r | |
1387 | },\r | |
1388 | {\r | |
1389 | MESSAGING_DEVICE_PATH,\r | |
1390 | MSG_ISCSI_DP,\r | |
1391 | DevPathiSCSI\r | |
1392 | },\r | |
1393 | {\r | |
1394 | MEDIA_DEVICE_PATH,\r | |
1395 | MEDIA_HARDDRIVE_DP,\r | |
1396 | DevPathHardDrive\r | |
1397 | },\r | |
1398 | {\r | |
1399 | MEDIA_DEVICE_PATH,\r | |
1400 | MEDIA_CDROM_DP,\r | |
1401 | DevPathCDROM\r | |
1402 | },\r | |
1403 | {\r | |
1404 | MEDIA_DEVICE_PATH,\r | |
1405 | MEDIA_VENDOR_DP,\r | |
1406 | DevPathVendor\r | |
1407 | },\r | |
1408 | {\r | |
1409 | MEDIA_DEVICE_PATH,\r | |
1410 | MEDIA_FILEPATH_DP,\r | |
1411 | DevPathFilePath\r | |
1412 | },\r | |
1413 | {\r | |
1414 | MEDIA_DEVICE_PATH,\r | |
1415 | MEDIA_PROTOCOL_DP,\r | |
1416 | DevPathMediaProtocol\r | |
1417 | },\r | |
9aaaeb28 | 1418 | {\r |
1419 | MEDIA_DEVICE_PATH,\r | |
1420 | MEDIA_PIWG_FW_VOL_DP,\r | |
1421 | DevPathFvPath,\r | |
1422 | },\r | |
5c08e117 | 1423 | {\r |
1424 | MEDIA_DEVICE_PATH,\r | |
1425 | MEDIA_PIWG_FW_FILE_DP,\r | |
1426 | DevPathFvFilePath\r | |
1427 | },\r | |
8e6b0dcb | 1428 | {\r |
1429 | MEDIA_DEVICE_PATH,\r | |
1430 | MEDIA_RELATIVE_OFFSET_RANGE_DP,\r | |
1431 | DevPathRelativeOffsetRange,\r | |
1432 | },\r | |
5c08e117 | 1433 | {\r |
1434 | BBS_DEVICE_PATH,\r | |
1435 | BBS_BBS_DP,\r | |
1436 | DevPathBssBss\r | |
1437 | },\r | |
1438 | {\r | |
1439 | END_DEVICE_PATH_TYPE,\r | |
1440 | END_INSTANCE_DEVICE_PATH_SUBTYPE,\r | |
1441 | DevPathEndInstance\r | |
1442 | },\r | |
1443 | {\r | |
1444 | 0,\r | |
1445 | 0,\r | |
1446 | NULL\r | |
1447 | }\r | |
1448 | };\r | |
1449 | \r | |
1450 | \r | |
1451 | /**\r | |
1452 | This function converts an input device structure to a Unicode string.\r | |
1453 | \r | |
1454 | @param DevPath A pointer to the device path structure.\r | |
1455 | \r | |
1456 | @return A new allocated Unicode string that represents the device path.\r | |
1457 | \r | |
1458 | **/\r | |
1459 | CHAR16 *\r | |
1460 | EFIAPI\r | |
1461 | DevicePathToStr (\r | |
1462 | IN EFI_DEVICE_PATH_PROTOCOL *DevPath\r | |
1463 | )\r | |
1464 | {\r | |
1465 | POOL_PRINT Str;\r | |
1466 | EFI_DEVICE_PATH_PROTOCOL *DevPathNode;\r | |
1467 | VOID (*DumpNode) (POOL_PRINT *, VOID *);\r | |
1468 | \r | |
1469 | UINTN Index;\r | |
1470 | UINTN NewSize;\r | |
1471 | \r | |
1472 | EFI_STATUS Status;\r | |
1473 | CHAR16 *ToText;\r | |
1474 | EFI_DEVICE_PATH_TO_TEXT_PROTOCOL *DevPathToText;\r | |
1475 | \r | |
1476 | ZeroMem (&Str, sizeof (Str));\r | |
1477 | \r | |
1478 | if (DevPath == NULL) {\r | |
1479 | goto Done;\r | |
1480 | }\r | |
1481 | \r | |
1482 | Status = gBS->LocateProtocol (\r | |
1483 | &gEfiDevicePathToTextProtocolGuid,\r | |
1484 | NULL,\r | |
1485 | (VOID **) &DevPathToText\r | |
1486 | );\r | |
1487 | if (!EFI_ERROR (Status)) {\r | |
1488 | ToText = DevPathToText->ConvertDevicePathToText (\r | |
1489 | DevPath,\r | |
1490 | FALSE,\r | |
1491 | TRUE\r | |
1492 | );\r | |
1493 | ASSERT (ToText != NULL);\r | |
1494 | return ToText;\r | |
1495 | }\r | |
1496 | \r | |
1497 | //\r | |
1498 | // Process each device path node\r | |
1499 | //\r | |
1500 | DevPathNode = DevPath;\r | |
1501 | while (!IsDevicePathEnd (DevPathNode)) {\r | |
1502 | //\r | |
1503 | // Find the handler to dump this device path node\r | |
1504 | //\r | |
1505 | DumpNode = NULL;\r | |
5540f4aa | 1506 | for (Index = 0; DevPathTable[Index].Function != NULL; Index += 1) {\r |
5c08e117 | 1507 | \r |
1508 | if (DevicePathType (DevPathNode) == DevPathTable[Index].Type &&\r | |
1509 | DevicePathSubType (DevPathNode) == DevPathTable[Index].SubType\r | |
1510 | ) {\r | |
1511 | DumpNode = DevPathTable[Index].Function;\r | |
1512 | break;\r | |
1513 | }\r | |
1514 | }\r | |
1515 | //\r | |
1516 | // If not found, use a generic function\r | |
1517 | //\r | |
1518 | if (!DumpNode) {\r | |
1519 | DumpNode = DevPathNodeUnknown;\r | |
1520 | }\r | |
1521 | //\r | |
1522 | // Put a path seperator in if needed\r | |
1523 | //\r | |
5540f4aa | 1524 | if ((Str.Len != 0) && (DumpNode != DevPathEndInstance)) {\r |
5c08e117 | 1525 | CatPrint (&Str, L"/");\r |
1526 | }\r | |
1527 | //\r | |
1528 | // Print this node of the device path\r | |
1529 | //\r | |
1530 | DumpNode (&Str, DevPathNode);\r | |
1531 | \r | |
1532 | //\r | |
1533 | // Next device path node\r | |
1534 | //\r | |
1535 | DevPathNode = NextDevicePathNode (DevPathNode);\r | |
1536 | }\r | |
1537 | \r | |
1538 | Done:\r | |
b4b6c8de LG |
1539 | NewSize = (Str.Len + 1) * sizeof (CHAR16);\r |
1540 | Str.Str = ReallocatePool (NewSize, NewSize, Str.Str);\r | |
1541 | ASSERT (Str.Str != NULL);\r | |
1542 | Str.Str[Str.Len] = 0;\r | |
1543 | return Str.Str;\r | |
5c08e117 | 1544 | }\r |