TianoCore EDK2 master
Loading...
Searching...
No Matches
ConsistMapping.c
Go to the documentation of this file.
1
10#include <Library/SortLib.h>
11#include <Library/UefiLib.h>
12#include <Protocol/UsbIo.h>
13#include <Protocol/BlockIo.h>
15
16typedef enum {
17 MTDTypeUnknown,
18 MTDTypeFloppy,
19 MTDTypeHardDisk,
20 MTDTypeCDRom,
21 MTDTypeEnd
22} MTD_TYPE;
23
24typedef struct {
25 CHAR16 *Str;
26 UINTN Len;
28
29typedef struct {
30 UINTN Hi;
31 MTD_TYPE Mtd;
32 POOL_PRINT Csd;
33 BOOLEAN Digital;
35
36typedef struct {
37 MTD_TYPE MTDType;
38 CHAR16 *Name;
39} MTD_NAME;
40
51typedef
56 EFI_DEVICE_PATH_PROTOCOL *OrigDevPath
57 );
58
59typedef struct {
60 UINT8 Type;
61 UINT8 SubType;
62 SERIAL_DECODE_FUNCTION SerialFun;
63 INTN (EFIAPI *CompareFun)(EFI_DEVICE_PATH_PROTOCOL *DevPath, EFI_DEVICE_PATH_PROTOCOL *DevPath2);
65
79EFIAPI
81 IN OUT POOL_PRINT *Str,
82 IN CHAR16 *Fmt,
83 ...
84 )
85{
86 UINT16 *AppendStr;
87 VA_LIST Args;
88 UINTN StringSize;
89 CHAR16 *NewStr;
90
91 AppendStr = AllocateZeroPool (0x1000);
92 if (AppendStr == NULL) {
93 return EFI_OUT_OF_RESOURCES;
94 }
95
96 VA_START (Args, Fmt);
97 UnicodeVSPrint (AppendStr, 0x1000, Fmt, Args);
98 VA_END (Args);
99 if (NULL == Str->Str) {
100 StringSize = StrSize (AppendStr);
101 NewStr = AllocateZeroPool (StringSize);
102 } else {
103 StringSize = StrSize (AppendStr);
104 StringSize += (StrSize (Str->Str) - sizeof (UINT16));
105
106 NewStr = ReallocatePool (
107 StrSize (Str->Str),
108 StringSize,
109 Str->Str
110 );
111 }
112
113 if (NewStr == NULL) {
114 FreePool (AppendStr);
115 return EFI_OUT_OF_RESOURCES;
116 }
117
118 Str->Str = NewStr;
119 StrCatS (Str->Str, StringSize/sizeof (CHAR16), AppendStr);
120 Str->Len = StringSize;
121
122 FreePool (AppendStr);
123 return EFI_SUCCESS;
124}
125
126MTD_NAME mMTDName[] = {
127 {
128 MTDTypeUnknown,
129 L"F"
130 },
131 {
132 MTDTypeFloppy,
133 L"FP"
134 },
135 {
136 MTDTypeHardDisk,
137 L"HD"
138 },
139 {
140 MTDTypeCDRom,
141 L"CD"
142 },
143 {
144 MTDTypeEnd,
145 NULL
146 }
147};
148
160 IN OUT POOL_PRINT *Str,
161 IN UINT64 Num
162 )
163{
164 EFI_STATUS Status;
165 UINT64 Result;
166 UINT32 Rem;
167
168 ASSERT (Str != NULL);
169
170 Result = DivU64x32Remainder (Num, 25, &Rem);
171 if (Result > 0) {
172 Status = AppendCSDNum2 (Str, Result);
173 if (EFI_ERROR (Status)) {
174 return Status;
175 }
176 }
177
178 return CatPrint (Str, L"%c", Rem + 'a');
179}
180
194 IN UINT64 Num
195 )
196{
197 EFI_STATUS Status;
198
199 ASSERT (MappingItem != NULL);
200
201 if (MappingItem->Digital) {
202 Status = CatPrint (&MappingItem->Csd, L"%ld", Num);
203 } else {
204 Status = AppendCSDNum2 (&MappingItem->Csd, Num);
205 }
206
207 if (!EFI_ERROR (Status)) {
208 MappingItem->Digital = (BOOLEAN) !(MappingItem->Digital);
209 }
210
211 return Status;
212}
213
226 IN CHAR16 *Str
227 )
228{
229 CHAR16 *Index;
230 EFI_STATUS Status;
231
232 ASSERT (Str != NULL && MappingItem != NULL);
233
234 Status = EFI_SUCCESS;
235
236 if (MappingItem->Digital) {
237 //
238 // To aVOID mult-meaning, the mapping is:
239 // 0 1 2 3 4 5 6 7 8 9 a b c d e f
240 // 0 16 2 3 4 5 6 7 8 9 10 11 12 13 14 15
241 //
242 for (Index = Str; *Index != 0; Index++) {
243 switch (*Index) {
244 case '0':
245 case '2':
246 case '3':
247 case '4':
248 case '5':
249 case '6':
250 case '7':
251 case '8':
252 case '9':
253 Status = CatPrint (&MappingItem->Csd, L"%c", *Index);
254 break;
255
256 case '1':
257 Status = CatPrint (&MappingItem->Csd, L"16");
258 break;
259
260 case 'a':
261 case 'b':
262 case 'c':
263 case 'd':
264 case 'e':
265 case 'f':
266 Status = CatPrint (&MappingItem->Csd, L"1%c", *Index - 'a' + '0');
267 break;
268
269 case 'A':
270 case 'B':
271 case 'C':
272 case 'D':
273 case 'E':
274 case 'F':
275 Status = CatPrint (&MappingItem->Csd, L"1%c", *Index - 'A' + '0');
276 break;
277 }
278
279 if (EFI_ERROR (Status)) {
280 return Status;
281 }
282 }
283 } else {
284 for (Index = Str; *Index != 0; Index++) {
285 //
286 // The mapping is:
287 // 0 1 2 3 4 5 6 7 8 9 a b c d e f
288 // a b c d e f g h i j k l m n o p
289 //
290 if ((*Index >= '0') && (*Index <= '9')) {
291 Status = CatPrint (&MappingItem->Csd, L"%c", *Index - '0' + 'a');
292 } else if ((*Index >= 'a') && (*Index <= 'f')) {
293 Status = CatPrint (&MappingItem->Csd, L"%c", *Index - 'a' + 'k');
294 } else if ((*Index >= 'A') && (*Index <= 'F')) {
295 Status = CatPrint (&MappingItem->Csd, L"%c", *Index - 'A' + 'k');
296 }
297
298 if (EFI_ERROR (Status)) {
299 return Status;
300 }
301 }
302 }
303
304 MappingItem->Digital = (BOOLEAN) !(MappingItem->Digital);
305
306 return (EFI_SUCCESS);
307}
308
320 DEVICE_CONSIST_MAPPING_INFO *MappingItem,
321 EFI_GUID *Guid
322 )
323{
324 CHAR16 Buffer[64];
325
326 ASSERT (Guid != NULL && MappingItem != NULL);
327
329 Buffer,
330 0,
331 L"%g",
332 Guid
333 );
334
335 return AppendCSDStr (MappingItem, Buffer);
336}
337
347INTN
348EFIAPI
350 IN EFI_DEVICE_PATH_PROTOCOL *DevicePath1,
351 IN EFI_DEVICE_PATH_PROTOCOL *DevicePath2
352 )
353{
356
357 if ((DevicePath1 == NULL) || (DevicePath2 == NULL)) {
358 return (-2);
359 }
360
361 Acpi1 = (ACPI_HID_DEVICE_PATH *)DevicePath1;
362 Acpi2 = (ACPI_HID_DEVICE_PATH *)DevicePath2;
363 if ((Acpi1->HID > Acpi2->HID) || ((Acpi1->HID == Acpi2->HID) && (Acpi1->UID > Acpi2->UID))) {
364 return 1;
365 }
366
367 if ((Acpi1->HID == Acpi2->HID) && (Acpi1->UID == Acpi2->UID)) {
368 return 0;
369 }
370
371 return -1;
372}
373
383INTN
384EFIAPI
386 IN EFI_DEVICE_PATH_PROTOCOL *DevicePath1,
387 IN EFI_DEVICE_PATH_PROTOCOL *DevicePath2
388 )
389{
390 PCI_DEVICE_PATH *Pci1;
391 PCI_DEVICE_PATH *Pci2;
392
393 ASSERT (DevicePath1 != NULL);
394 ASSERT (DevicePath2 != NULL);
395
396 Pci1 = (PCI_DEVICE_PATH *)DevicePath1;
397 Pci2 = (PCI_DEVICE_PATH *)DevicePath2;
398 if ((Pci1->Device > Pci2->Device) || ((Pci1->Device == Pci2->Device) && (Pci1->Function > Pci2->Function))) {
399 return 1;
400 }
401
402 if ((Pci1->Device == Pci2->Device) && (Pci1->Function == Pci2->Function)) {
403 return 0;
404 }
405
406 return -1;
407}
408
419INTN
420EFIAPI
422 IN EFI_DEVICE_PATH_PROTOCOL *DevicePath1,
423 IN EFI_DEVICE_PATH_PROTOCOL *DevicePath2
424 )
425{
426 UINTN DevPathSize1;
427 UINTN DevPathSize2;
428
429 ASSERT (DevicePath1 != NULL);
430 ASSERT (DevicePath2 != NULL);
431
432 DevPathSize1 = DevicePathNodeLength (DevicePath1);
433 DevPathSize2 = DevicePathNodeLength (DevicePath2);
434 if (DevPathSize1 > DevPathSize2) {
435 return 1;
436 } else if (DevPathSize1 < DevPathSize2) {
437 return -1;
438 } else {
439 return CompareMem (DevicePath1, DevicePath2, DevPathSize1);
440 }
441}
442
455 IN EFI_DEVICE_PATH_PROTOCOL *DevicePathNode,
456 IN DEVICE_CONSIST_MAPPING_INFO *MappingItem,
457 IN EFI_DEVICE_PATH_PROTOCOL *DevicePath
458 )
459{
461
462 ASSERT (DevicePathNode != NULL);
463 ASSERT (MappingItem != NULL);
464
465 Hd = (HARDDRIVE_DEVICE_PATH *)DevicePathNode;
466 if (MappingItem->Mtd == MTDTypeUnknown) {
467 MappingItem->Mtd = MTDTypeHardDisk;
468 }
469
470 return AppendCSDNum (MappingItem, Hd->PartitionNumber);
471}
472
485 IN EFI_DEVICE_PATH_PROTOCOL *DevicePathNode,
486 IN DEVICE_CONSIST_MAPPING_INFO *MappingItem,
487 IN EFI_DEVICE_PATH_PROTOCOL *DevicePath
488 )
489{
490 ATAPI_DEVICE_PATH *Atapi;
491
492 ASSERT (DevicePathNode != NULL);
493 ASSERT (MappingItem != NULL);
494
495 Atapi = (ATAPI_DEVICE_PATH *)DevicePathNode;
496 return AppendCSDNum (MappingItem, (Atapi->PrimarySecondary * 2 + Atapi->SlaveMaster));
497}
498
511 IN EFI_DEVICE_PATH_PROTOCOL *DevicePathNode,
512 IN DEVICE_CONSIST_MAPPING_INFO *MappingItem,
513 IN EFI_DEVICE_PATH_PROTOCOL *DevicePath
514 )
515{
517
518 ASSERT (DevicePathNode != NULL);
519 ASSERT (MappingItem != NULL);
520
521 Cd = (CDROM_DEVICE_PATH *)DevicePathNode;
522 MappingItem->Mtd = MTDTypeCDRom;
523 return AppendCSDNum (MappingItem, Cd->BootEntry);
524}
525
538 IN EFI_DEVICE_PATH_PROTOCOL *DevicePathNode,
539 IN DEVICE_CONSIST_MAPPING_INFO *MappingItem,
540 IN EFI_DEVICE_PATH_PROTOCOL *DevicePath
541 )
542{
543 EFI_STATUS Status;
545
546 ASSERT (DevicePathNode != NULL);
547 ASSERT (MappingItem != NULL);
548
549 Fibre = (FIBRECHANNEL_DEVICE_PATH *)DevicePathNode;
550 Status = AppendCSDNum (MappingItem, Fibre->WWN);
551 if (!EFI_ERROR (Status)) {
552 Status = AppendCSDNum (MappingItem, Fibre->Lun);
553 }
554
555 return Status;
556}
557
570 IN EFI_DEVICE_PATH_PROTOCOL *DevicePathNode,
571 IN DEVICE_CONSIST_MAPPING_INFO *MappingItem,
572 IN EFI_DEVICE_PATH_PROTOCOL *DevicePath
573 )
574{
575 EFI_STATUS Status;
576 UART_DEVICE_PATH *Uart;
577
578 ASSERT (DevicePathNode != NULL);
579 ASSERT (MappingItem != NULL);
580
581 Uart = (UART_DEVICE_PATH *)DevicePathNode;
582 Status = AppendCSDNum (MappingItem, Uart->BaudRate);
583 if (!EFI_ERROR (Status)) {
584 Status = AppendCSDNum (MappingItem, Uart->DataBits);
585 }
586
587 if (!EFI_ERROR (Status)) {
588 Status = AppendCSDNum (MappingItem, Uart->Parity);
589 }
590
591 if (!EFI_ERROR (Status)) {
592 Status = AppendCSDNum (MappingItem, Uart->StopBits);
593 }
594
595 return Status;
596}
597
610 IN EFI_DEVICE_PATH_PROTOCOL *DevicePathNode,
611 IN DEVICE_CONSIST_MAPPING_INFO *MappingItem,
612 IN EFI_DEVICE_PATH_PROTOCOL *DevicePath
613 )
614{
615 USB_DEVICE_PATH *Usb;
616 EFI_USB_IO_PROTOCOL *UsbIo;
617 EFI_HANDLE TempHandle;
618 EFI_STATUS Status;
619 USB_INTERFACE_DESCRIPTOR InterfaceDesc;
620
621 ASSERT (DevicePathNode != NULL);
622 ASSERT (MappingItem != NULL);
623
624 Usb = (USB_DEVICE_PATH *)DevicePathNode;
625 Status = AppendCSDNum (MappingItem, Usb->ParentPortNumber);
626 if (!EFI_ERROR (Status)) {
627 Status = AppendCSDNum (MappingItem, Usb->InterfaceNumber);
628 }
629
630 if (EFI_ERROR (Status)) {
631 return Status;
632 }
633
634 if (PcdGetBool (PcdUsbExtendedDecode)) {
635 Status = gBS->LocateDevicePath (&gEfiUsbIoProtocolGuid, &DevicePath, &TempHandle);
636 UsbIo = NULL;
637 if (!EFI_ERROR (Status)) {
638 Status = gBS->OpenProtocol (TempHandle, &gEfiUsbIoProtocolGuid, (VOID **)&UsbIo, gImageHandle, NULL, EFI_OPEN_PROTOCOL_GET_PROTOCOL);
639 }
640
641 if (!EFI_ERROR (Status)) {
642 ASSERT (UsbIo != NULL);
643 Status = UsbIo->UsbGetInterfaceDescriptor (UsbIo, &InterfaceDesc);
644 if (!EFI_ERROR (Status)) {
645 if ((InterfaceDesc.InterfaceClass == USB_MASS_STORE_CLASS) && (MappingItem->Mtd == MTDTypeUnknown)) {
646 switch (InterfaceDesc.InterfaceSubClass) {
648 MappingItem->Mtd = MTDTypeHardDisk;
649 break;
652 MappingItem->Mtd = MTDTypeFloppy;
653 break;
655 MappingItem->Mtd = MTDTypeCDRom;
656 break;
657 }
658 }
659 }
660 }
661 }
662
663 return Status;
664}
665
678 IN EFI_DEVICE_PATH_PROTOCOL *DevicePathNode,
679 IN DEVICE_CONSIST_MAPPING_INFO *MappingItem,
680 IN EFI_DEVICE_PATH_PROTOCOL *DevicePath
681 )
682{
683 EFI_STATUS Status;
684 VENDOR_DEVICE_PATH *Vendor;
685 SAS_DEVICE_PATH *Sas;
686 UINTN TargetNameLength;
687 UINTN Index;
688 CHAR16 *Buffer;
689 CHAR16 *NewBuffer;
690
691 ASSERT (DevicePathNode != NULL);
692 ASSERT (MappingItem != NULL);
693
694 Vendor = (VENDOR_DEVICE_PATH *)DevicePathNode;
695 Status = AppendCSDGuid (MappingItem, &Vendor->Guid);
696 if (EFI_ERROR (Status)) {
697 return Status;
698 }
699
700 if (CompareGuid (&gEfiSasDevicePathGuid, &Vendor->Guid)) {
701 Sas = (SAS_DEVICE_PATH *)Vendor;
702 Status = AppendCSDNum (MappingItem, Sas->SasAddress);
703 if (!EFI_ERROR (Status)) {
704 Status = AppendCSDNum (MappingItem, Sas->Lun);
705 }
706
707 if (!EFI_ERROR (Status)) {
708 Status = AppendCSDNum (MappingItem, Sas->DeviceTopology);
709 }
710
711 if (!EFI_ERROR (Status)) {
712 Status = AppendCSDNum (MappingItem, Sas->RelativeTargetPort);
713 }
714 } else {
715 TargetNameLength = MIN (DevicePathNodeLength (DevicePathNode) - sizeof (VENDOR_DEVICE_PATH), PcdGet32 (PcdShellVendorExtendedDecode));
716 if (TargetNameLength != 0) {
717 //
718 // String is 2 chars per data byte, plus NULL terminator
719 //
720 Buffer = AllocateZeroPool (((TargetNameLength * 2) + 1) * sizeof (CHAR16));
721 if (Buffer == NULL) {
722 return EFI_OUT_OF_RESOURCES;
723 }
724
725 //
726 // Build the string data
727 //
728 for (Index = 0; Index < TargetNameLength; Index++) {
729 NewBuffer = CatSPrint (Buffer, L"%02x", *((UINT8 *)Vendor + sizeof (VENDOR_DEVICE_PATH) + Index));
730 if (NewBuffer == NULL) {
731 Status = EFI_OUT_OF_RESOURCES;
732 break;
733 }
734
735 Buffer = NewBuffer;
736 }
737
738 //
739 // Append the new data block
740 //
741 if (!EFI_ERROR (Status)) {
742 Status = AppendCSDStr (MappingItem, Buffer);
743 }
744
745 FreePool (Buffer);
746 }
747 }
748
749 return Status;
750}
751
764 IN EFI_DEVICE_PATH_PROTOCOL *DevicePathNode,
765 IN DEVICE_CONSIST_MAPPING_INFO *MappingItem,
766 IN EFI_DEVICE_PATH_PROTOCOL *DevicePath
767 )
768{
770
771 ASSERT (DevicePathNode != NULL);
772 ASSERT (MappingItem != NULL);
773
774 Lun = (DEVICE_LOGICAL_UNIT_DEVICE_PATH *)DevicePathNode;
775 return AppendCSDNum (MappingItem, Lun->Lun);
776}
777
790 IN EFI_DEVICE_PATH_PROTOCOL *DevicePathNode,
791 IN DEVICE_CONSIST_MAPPING_INFO *MappingItem,
792 IN EFI_DEVICE_PATH_PROTOCOL *DevicePath
793 )
794{
795 EFI_STATUS Status;
796 SATA_DEVICE_PATH *Sata;
797
798 ASSERT (DevicePathNode != NULL);
799 ASSERT (MappingItem != NULL);
800
801 Sata = (SATA_DEVICE_PATH *)DevicePathNode;
802 Status = AppendCSDNum (MappingItem, Sata->HBAPortNumber);
803 if (!EFI_ERROR (Status)) {
804 Status = AppendCSDNum (MappingItem, Sata->PortMultiplierPortNumber);
805 }
806
807 if (!EFI_ERROR (Status)) {
808 Status = AppendCSDNum (MappingItem, Sata->Lun);
809 }
810
811 return Status;
812}
813
826 IN EFI_DEVICE_PATH_PROTOCOL *DevicePathNode,
827 IN DEVICE_CONSIST_MAPPING_INFO *MappingItem,
828 IN EFI_DEVICE_PATH_PROTOCOL *DevicePath
829 )
830{
831 EFI_STATUS Status;
832 ISCSI_DEVICE_PATH *IScsi;
833 UINT8 *IScsiTargetName;
834 CHAR16 *TargetName;
835 UINTN TargetNameLength;
836 UINTN Index;
837
838 ASSERT (DevicePathNode != NULL);
839 ASSERT (MappingItem != NULL);
840
841 Status = EFI_SUCCESS;
842
843 if (PcdGetBool (PcdShellDecodeIScsiMapNames)) {
844 IScsi = (ISCSI_DEVICE_PATH *)DevicePathNode;
845 Status = AppendCSDNum (MappingItem, IScsi->NetworkProtocol);
846 if (!EFI_ERROR (Status)) {
847 Status = AppendCSDNum (MappingItem, IScsi->LoginOption);
848 }
849
850 if (!EFI_ERROR (Status)) {
851 Status = AppendCSDNum (MappingItem, IScsi->Lun);
852 }
853
854 if (!EFI_ERROR (Status)) {
855 Status = AppendCSDNum (MappingItem, IScsi->TargetPortalGroupTag);
856 }
857
858 if (EFI_ERROR (Status)) {
859 return Status;
860 }
861
862 TargetNameLength = DevicePathNodeLength (DevicePathNode) - sizeof (ISCSI_DEVICE_PATH);
863 if (TargetNameLength > 0) {
864 TargetName = AllocateZeroPool ((TargetNameLength + 1) * sizeof (CHAR16));
865 if (TargetName == NULL) {
866 Status = EFI_OUT_OF_RESOURCES;
867 } else {
868 IScsiTargetName = (UINT8 *)(IScsi + 1);
869 for (Index = 0; Index < TargetNameLength; Index++) {
870 TargetName[Index] = (CHAR16)IScsiTargetName[Index];
871 }
872
873 Status = AppendCSDStr (MappingItem, TargetName);
874 FreePool (TargetName);
875 }
876 }
877 }
878
879 return Status;
880}
881
894 IN EFI_DEVICE_PATH_PROTOCOL *DevicePathNode,
895 IN DEVICE_CONSIST_MAPPING_INFO *MappingItem,
896 IN EFI_DEVICE_PATH_PROTOCOL *DevicePath
897 )
898{
899 I2O_DEVICE_PATH *DevicePath_I20;
900
901 ASSERT (DevicePathNode != NULL);
902 ASSERT (MappingItem != NULL);
903
904 DevicePath_I20 = (I2O_DEVICE_PATH *)DevicePathNode;
905 return AppendCSDNum (MappingItem, DevicePath_I20->Tid);
906}
907
920 IN EFI_DEVICE_PATH_PROTOCOL *DevicePathNode,
921 IN DEVICE_CONSIST_MAPPING_INFO *MappingItem,
922 IN EFI_DEVICE_PATH_PROTOCOL *DevicePath
923 )
924{
926 UINTN HwAddressSize;
927 UINTN Index;
928 CHAR16 Buffer[64];
929 CHAR16 *PBuffer;
930
931 ASSERT (DevicePathNode != NULL);
932 ASSERT (MappingItem != NULL);
933
934 Mac = (MAC_ADDR_DEVICE_PATH *)DevicePathNode;
935
936 HwAddressSize = sizeof (EFI_MAC_ADDRESS);
937 if ((Mac->IfType == 0x01) || (Mac->IfType == 0x00)) {
938 HwAddressSize = 6;
939 }
940
941 for (Index = 0, PBuffer = Buffer; Index < HwAddressSize; Index++, PBuffer += 2) {
942 UnicodeSPrint (PBuffer, 0, L"%02x", (UINTN)Mac->MacAddress.Addr[Index]);
943 }
944
945 return AppendCSDStr (MappingItem, Buffer);
946}
947
960 IN EFI_DEVICE_PATH_PROTOCOL *DevicePathNode,
961 IN DEVICE_CONSIST_MAPPING_INFO *MappingItem,
962 IN EFI_DEVICE_PATH_PROTOCOL *DevicePath
963 )
964{
965 EFI_STATUS Status;
966 INFINIBAND_DEVICE_PATH *InfiniBand;
967 UINTN Index;
968 CHAR16 Buffer[64];
969 CHAR16 *PBuffer;
970
971 ASSERT (DevicePathNode != NULL);
972 ASSERT (MappingItem != NULL);
973
974 InfiniBand = (INFINIBAND_DEVICE_PATH *)DevicePathNode;
975 for (Index = 0, PBuffer = Buffer; Index < 16; Index++, PBuffer += 2) {
976 UnicodeSPrint (PBuffer, 0, L"%02x", (UINTN)InfiniBand->PortGid[Index]);
977 }
978
979 Status = AppendCSDStr (MappingItem, Buffer);
980 if (!EFI_ERROR (Status)) {
981 Status = AppendCSDNum (MappingItem, InfiniBand->ServiceId);
982 }
983
984 if (!EFI_ERROR (Status)) {
985 Status = AppendCSDNum (MappingItem, InfiniBand->TargetPortId);
986 }
987
988 if (!EFI_ERROR (Status)) {
989 Status = AppendCSDNum (MappingItem, InfiniBand->DeviceId);
990 }
991
992 return Status;
993}
994
1007 IN EFI_DEVICE_PATH_PROTOCOL *DevicePathNode,
1008 IN DEVICE_CONSIST_MAPPING_INFO *MappingItem,
1009 IN EFI_DEVICE_PATH_PROTOCOL *DevicePath
1010 )
1011{
1012 EFI_STATUS Status;
1013 IPv4_DEVICE_PATH *Ip;
1014 CHAR16 Buffer[10];
1015
1016 ASSERT (DevicePathNode != NULL);
1017 ASSERT (MappingItem != NULL);
1018
1019 Ip = (IPv4_DEVICE_PATH *)DevicePathNode;
1021 Buffer,
1022 0,
1023 L"%02x%02x%02x%02x",
1024 (UINTN)Ip->LocalIpAddress.Addr[0],
1025 (UINTN)Ip->LocalIpAddress.Addr[1],
1026 (UINTN)Ip->LocalIpAddress.Addr[2],
1027 (UINTN)Ip->LocalIpAddress.Addr[3]
1028 );
1029 Status = AppendCSDStr (MappingItem, Buffer);
1030 if (!EFI_ERROR (Status)) {
1031 Status = AppendCSDNum (MappingItem, Ip->LocalPort);
1032 }
1033
1034 if (!EFI_ERROR (Status)) {
1036 Buffer,
1037 0,
1038 L"%02x%02x%02x%02x",
1039 (UINTN)Ip->RemoteIpAddress.Addr[0],
1040 (UINTN)Ip->RemoteIpAddress.Addr[1],
1041 (UINTN)Ip->RemoteIpAddress.Addr[2],
1042 (UINTN)Ip->RemoteIpAddress.Addr[3]
1043 );
1044 Status = AppendCSDStr (MappingItem, Buffer);
1045 }
1046
1047 if (!EFI_ERROR (Status)) {
1048 Status = AppendCSDNum (MappingItem, Ip->RemotePort);
1049 }
1050
1051 return Status;
1052}
1053
1066 IN EFI_DEVICE_PATH_PROTOCOL *DevicePathNode,
1067 IN DEVICE_CONSIST_MAPPING_INFO *MappingItem,
1068 IN EFI_DEVICE_PATH_PROTOCOL *DevicePath
1069 )
1070{
1071 EFI_STATUS Status;
1072 IPv6_DEVICE_PATH *Ip;
1073 UINTN Index;
1074 CHAR16 Buffer[64];
1075 CHAR16 *PBuffer;
1076
1077 ASSERT (DevicePathNode != NULL);
1078 ASSERT (MappingItem != NULL);
1079
1080 Ip = (IPv6_DEVICE_PATH *)DevicePathNode;
1081 for (Index = 0, PBuffer = Buffer; Index < 16; Index++, PBuffer += 2) {
1082 UnicodeSPrint (PBuffer, 0, L"%02x", (UINTN)Ip->LocalIpAddress.Addr[Index]);
1083 }
1084
1085 Status = AppendCSDStr (MappingItem, Buffer);
1086 if (!EFI_ERROR (Status)) {
1087 Status = AppendCSDNum (MappingItem, Ip->LocalPort);
1088 }
1089
1090 if (!EFI_ERROR (Status)) {
1091 for (Index = 0, PBuffer = Buffer; Index < 16; Index++, PBuffer += 2) {
1092 UnicodeSPrint (PBuffer, 0, L"%02x", (UINTN)Ip->RemoteIpAddress.Addr[Index]);
1093 }
1094
1095 Status = AppendCSDStr (MappingItem, Buffer);
1096 }
1097
1098 if (!EFI_ERROR (Status)) {
1099 Status = AppendCSDNum (MappingItem, Ip->RemotePort);
1100 }
1101
1102 return Status;
1103}
1104
1117 IN EFI_DEVICE_PATH_PROTOCOL *DevicePathNode,
1118 IN DEVICE_CONSIST_MAPPING_INFO *MappingItem,
1119 IN EFI_DEVICE_PATH_PROTOCOL *DevicePath
1120 )
1121{
1122 EFI_STATUS Status;
1123 SCSI_DEVICE_PATH *Scsi;
1124
1125 ASSERT (DevicePathNode != NULL);
1126 ASSERT (MappingItem != NULL);
1127
1128 Scsi = (SCSI_DEVICE_PATH *)DevicePathNode;
1129 Status = AppendCSDNum (MappingItem, Scsi->Pun);
1130 if (!EFI_ERROR (Status)) {
1131 Status = AppendCSDNum (MappingItem, Scsi->Lun);
1132 }
1133
1134 return Status;
1135}
1136
1149 IN EFI_DEVICE_PATH_PROTOCOL *DevicePathNode,
1150 IN DEVICE_CONSIST_MAPPING_INFO *MappingItem,
1151 IN EFI_DEVICE_PATH_PROTOCOL *DevicePath
1152 )
1153{
1154 F1394_DEVICE_PATH *DevicePath_F1394;
1155 CHAR16 Buffer[20];
1156
1157 ASSERT (DevicePathNode != NULL);
1158 ASSERT (MappingItem != NULL);
1159
1160 DevicePath_F1394 = (F1394_DEVICE_PATH *)DevicePathNode;
1161 UnicodeSPrint (Buffer, 0, L"%lx", DevicePath_F1394->Guid);
1162 return AppendCSDStr (MappingItem, Buffer);
1163}
1164
1177 IN EFI_DEVICE_PATH_PROTOCOL *DevicePathNode,
1178 IN DEVICE_CONSIST_MAPPING_INFO *MappingItem,
1179 IN EFI_DEVICE_PATH_PROTOCOL *DevicePath
1180 )
1181{
1183
1184 ASSERT (DevicePathNode != NULL);
1185 ASSERT (MappingItem != NULL);
1186
1187 Acpi = (ACPI_HID_DEVICE_PATH *)DevicePathNode;
1188 if ((Acpi->HID & PNP_EISA_ID_MASK) == PNP_EISA_ID_CONST) {
1189 if (EISA_ID_TO_NUM (Acpi->HID) == 0x0604) {
1190 MappingItem->Mtd = MTDTypeFloppy;
1191 return AppendCSDNum (MappingItem, Acpi->UID);
1192 }
1193 }
1194
1195 return EFI_SUCCESS;
1196}
1197
1210 IN EFI_DEVICE_PATH_PROTOCOL *DevicePathNode,
1211 IN DEVICE_CONSIST_MAPPING_INFO *MappingItem,
1212 IN EFI_DEVICE_PATH_PROTOCOL *DevicePath
1213 )
1214{
1215 return EFI_SUCCESS;
1216}
1217
1218DEV_PATH_CONSIST_MAPPING_TABLE DevPathConsistMappingTable[] = {
1219 {
1221 HW_PCI_DP,
1224 },
1225 {
1227 ACPI_DP,
1230 },
1231 {
1236 },
1237 {
1242 },
1243 {
1248 },
1249 {
1254 },
1255 {
1257 MSG_USB_DP,
1260 },
1261 {
1263 MSG_I2O_DP,
1266 },
1267 {
1272 },
1273 {
1278 },
1279 {
1284 },
1285 {
1290 },
1291 {
1296 },
1297 {
1299 MSG_VENDOR_DP,
1302 },
1303 {
1308 },
1309 {
1314 },
1315 {
1320 },
1321 {
1322 MEDIA_DEVICE_PATH,
1326 },
1327 {
1328 MEDIA_DEVICE_PATH,
1332 },
1333 {
1334 MEDIA_DEVICE_PATH,
1338 },
1339 {
1340 0,
1341 0,
1342 NULL,
1343 NULL
1344 }
1345};
1346
1355BOOLEAN
1357 IN EFI_DEVICE_PATH_PROTOCOL *DevicePathNode
1358 )
1359{
1361
1362 ASSERT (DevicePathNode != NULL);
1363
1364 if (DevicePathNode->Type == HARDWARE_DEVICE_PATH) {
1365 return TRUE;
1366 }
1367
1368 if (DevicePathNode->Type == ACPI_DEVICE_PATH) {
1369 Acpi = (ACPI_HID_DEVICE_PATH *)DevicePathNode;
1370 switch (EISA_ID_TO_NUM (Acpi->HID)) {
1371 case 0x0301:
1372 case 0x0401:
1373 case 0x0501:
1374 case 0x0604:
1375 return FALSE;
1376 }
1377
1378 return TRUE;
1379 }
1380
1381 return FALSE;
1382}
1383
1393 IN EFI_DEVICE_PATH_PROTOCOL *DevicePath
1394 )
1395{
1396 UINTN NonHIDevicePathNodeCount;
1397 UINTN Index;
1398 EFI_DEV_PATH Node;
1399 EFI_DEVICE_PATH_PROTOCOL *HIDevicePath;
1400 EFI_DEVICE_PATH_PROTOCOL *TempDevicePath;
1401
1402 ASSERT (DevicePath != NULL);
1403
1404 NonHIDevicePathNodeCount = 0;
1405
1406 HIDevicePath = AllocateZeroPool (sizeof (EFI_DEVICE_PATH_PROTOCOL));
1407 if (HIDevicePath == NULL) {
1408 return NULL;
1409 }
1410
1411 SetDevicePathEndNode (HIDevicePath);
1412
1413 Node.DevPath.Type = END_DEVICE_PATH_TYPE;
1414 Node.DevPath.SubType = END_INSTANCE_DEVICE_PATH_SUBTYPE;
1415 Node.DevPath.Length[0] = (UINT8)sizeof (EFI_DEVICE_PATH_PROTOCOL);
1416 Node.DevPath.Length[1] = 0;
1417
1418 while (!IsDevicePathEnd (DevicePath)) {
1419 if (IsHIDevicePathNode (DevicePath)) {
1420 for (Index = 0; Index < NonHIDevicePathNodeCount; Index++) {
1421 TempDevicePath = AppendDevicePathNode (HIDevicePath, &Node.DevPath);
1422 FreePool (HIDevicePath);
1423 HIDevicePath = TempDevicePath;
1424 }
1425
1426 TempDevicePath = AppendDevicePathNode (HIDevicePath, DevicePath);
1427 FreePool (HIDevicePath);
1428 HIDevicePath = TempDevicePath;
1429 } else {
1430 NonHIDevicePathNodeCount++;
1431 }
1432
1433 //
1434 // Next device path node
1435 //
1436 DevicePath = (EFI_DEVICE_PATH_PROTOCOL *)NextDevicePathNode (DevicePath);
1437 }
1438
1439 return HIDevicePath;
1440}
1441
1452 IN DEVICE_CONSIST_MAPPING_INFO *MappingItem,
1453 IN EFI_DEVICE_PATH_PROTOCOL *DevicePath
1454 )
1455{
1456 EFI_STATUS Status;
1457 SERIAL_DECODE_FUNCTION SerialFun;
1458 UINTN Index;
1459 EFI_DEVICE_PATH_PROTOCOL *OriginalDevicePath;
1460
1461 ASSERT (DevicePath != NULL);
1462 ASSERT (MappingItem != NULL);
1463
1464 SetMem (&MappingItem->Csd, sizeof (POOL_PRINT), 0);
1465 OriginalDevicePath = DevicePath;
1466
1467 while (!IsDevicePathEnd (DevicePath)) {
1468 //
1469 // Find the handler to dump this device path node and
1470 // initialize with generic function in case nothing is found
1471 //
1472 for (SerialFun = DevPathSerialDefault, Index = 0; DevPathConsistMappingTable[Index].SerialFun != NULL; Index += 1) {
1473 if ((DevicePathType (DevicePath) == DevPathConsistMappingTable[Index].Type) &&
1474 (DevicePathSubType (DevicePath) == DevPathConsistMappingTable[Index].SubType)
1475 )
1476 {
1477 SerialFun = DevPathConsistMappingTable[Index].SerialFun;
1478 break;
1479 }
1480 }
1481
1482 Status = SerialFun (DevicePath, MappingItem, OriginalDevicePath);
1483 if (EFI_ERROR (Status)) {
1484 SHELL_FREE_NON_NULL (MappingItem->Csd.Str);
1485 return Status;
1486 }
1487
1488 //
1489 // Next device path node
1490 //
1491 DevicePath = (EFI_DEVICE_PATH_PROTOCOL *)NextDevicePathNode (DevicePath);
1492 }
1493
1494 return EFI_SUCCESS;
1495}
1496
1505EFIAPI
1508 )
1509{
1510 EFI_HANDLE *HandleBuffer;
1511 UINTN HandleNum;
1512 UINTN HandleLoop;
1513 EFI_DEVICE_PATH_PROTOCOL **TempTable;
1514 EFI_DEVICE_PATH_PROTOCOL *DevicePath;
1515 EFI_DEVICE_PATH_PROTOCOL *HIDevicePath;
1516 EFI_BLOCK_IO_PROTOCOL *BlockIo;
1517 EFI_SIMPLE_FILE_SYSTEM_PROTOCOL *SimpleFileSystem;
1518 UINTN Index;
1519 EFI_STATUS Status;
1520
1521 HandleBuffer = NULL;
1522
1523 Status = gBS->LocateHandleBuffer (
1524 ByProtocol,
1525 &gEfiDevicePathProtocolGuid,
1526 NULL,
1527 &HandleNum,
1528 &HandleBuffer
1529 );
1530 ASSERT_EFI_ERROR (Status);
1531
1532 TempTable = AllocateZeroPool ((HandleNum + 1) * sizeof (EFI_DEVICE_PATH_PROTOCOL *));
1533 if (TempTable == NULL) {
1534 return EFI_OUT_OF_RESOURCES;
1535 }
1536
1537 for (HandleLoop = 0; HandleLoop < HandleNum; HandleLoop++) {
1538 DevicePath = DevicePathFromHandle (HandleBuffer[HandleLoop]);
1539 if (DevicePath == NULL) {
1540 continue;
1541 }
1542
1543 HIDevicePath = GetHIDevicePath (DevicePath);
1544 if (HIDevicePath == NULL) {
1545 continue;
1546 }
1547
1548 Status = gBS->HandleProtocol (
1549 HandleBuffer[HandleLoop],
1550 &gEfiBlockIoProtocolGuid,
1551 (VOID **)&BlockIo
1552 );
1553 if (EFI_ERROR (Status)) {
1554 Status = gBS->HandleProtocol (
1555 HandleBuffer[HandleLoop],
1556 &gEfiSimpleFileSystemProtocolGuid,
1557 (VOID **)&SimpleFileSystem
1558 );
1559 if (EFI_ERROR (Status)) {
1560 FreePool (HIDevicePath);
1561 continue;
1562 }
1563 }
1564
1565 for (Index = 0; TempTable[Index] != NULL; Index++) {
1566 if (DevicePathCompare (&TempTable[Index], &HIDevicePath) == 0) {
1567 FreePool (HIDevicePath);
1568 break;
1569 }
1570 }
1571
1572 if (TempTable[Index] == NULL) {
1573 TempTable[Index] = HIDevicePath;
1574 }
1575 }
1576
1577 for (Index = 0; TempTable[Index] != NULL; Index++) {
1578 }
1579
1580 PerformQuickSort (TempTable, Index, sizeof (EFI_DEVICE_PATH_PROTOCOL *), DevicePathCompare);
1581 *Table = TempTable;
1582
1583 if (HandleBuffer != NULL) {
1584 FreePool (HandleBuffer);
1585 }
1586
1587 return EFI_SUCCESS;
1588}
1589
1600EFIAPI
1603 )
1604{
1605 UINTN Index;
1606
1607 ASSERT (Table != NULL);
1608
1609 for (Index = 0; Table[Index] != NULL; Index++) {
1610 FreePool (Table[Index]);
1611 }
1612
1613 FreePool (Table);
1614 return EFI_SUCCESS;
1615}
1616
1630CHAR16 *
1631EFIAPI
1633 IN EFI_DEVICE_PATH_PROTOCOL *DevicePath,
1635 )
1636{
1637 EFI_STATUS Status;
1638 POOL_PRINT Str;
1639 DEVICE_CONSIST_MAPPING_INFO MappingInfo;
1640 EFI_DEVICE_PATH_PROTOCOL *HIDevicePath;
1641 UINTN Index;
1642
1643 ASSERT (DevicePath != NULL);
1644 ASSERT (Table != NULL);
1645
1646 HIDevicePath = GetHIDevicePath (DevicePath);
1647 if (HIDevicePath == NULL) {
1648 return NULL;
1649 }
1650
1651 for (Index = 0; Table[Index] != NULL; Index++) {
1652 if (DevicePathCompare (&Table[Index], &HIDevicePath) == 0) {
1653 break;
1654 }
1655 }
1656
1657 FreePool (HIDevicePath);
1658 if (Table[Index] == NULL) {
1659 return NULL;
1660 }
1661
1662 MappingInfo.Hi = Index;
1663 MappingInfo.Mtd = MTDTypeUnknown;
1664 MappingInfo.Digital = FALSE;
1665
1666 Status = GetDeviceConsistMappingInfo (&MappingInfo, DevicePath);
1667 if (EFI_ERROR (Status)) {
1668 return NULL;
1669 }
1670
1671 SetMem (&Str, sizeof (Str), 0);
1672 for (Index = 0; mMTDName[Index].MTDType != MTDTypeEnd; Index++) {
1673 if (MappingInfo.Mtd == mMTDName[Index].MTDType) {
1674 break;
1675 }
1676 }
1677
1678 if (mMTDName[Index].MTDType != MTDTypeEnd) {
1679 Status = CatPrint (&Str, L"%s", mMTDName[Index].Name);
1680 }
1681
1682 if (!EFI_ERROR (Status)) {
1683 Status = CatPrint (&Str, L"%d", (UINTN)MappingInfo.Hi);
1684 }
1685
1686 if (!EFI_ERROR (Status) && (MappingInfo.Csd.Str != NULL)) {
1687 Status = CatPrint (&Str, L"%s", MappingInfo.Csd.Str);
1688 FreePool (MappingInfo.Csd.Str);
1689 }
1690
1691 if (!EFI_ERROR (Status) && (Str.Str != NULL)) {
1692 Status = CatPrint (&Str, L":");
1693 }
1694
1695 if (EFI_ERROR (Status)) {
1696 SHELL_FREE_NON_NULL (Str.Str);
1697 return NULL;
1698 }
1699
1700 return Str.Str;
1701}
1702
1711EFIAPI
1713 IN CONST CHAR16 *MapKey
1714 )
1715{
1716 SHELL_MAP_LIST *MapListItem;
1717
1718 for ( MapListItem = (SHELL_MAP_LIST *)GetFirstNode (&gShellMapList.Link)
1719 ; !IsNull (&gShellMapList.Link, &MapListItem->Link)
1720 ; MapListItem = (SHELL_MAP_LIST *)GetNextNode (&gShellMapList.Link, &MapListItem->Link)
1721 )
1722 {
1723 if (gUnicodeCollation->StriColl (gUnicodeCollation, MapListItem->MapName, (CHAR16 *)MapKey) == 0) {
1724 return (MapListItem);
1725 }
1726 }
1727
1728 return (NULL);
1729}
UINT64 UINTN
INT64 INTN
BOOLEAN EFIAPI IsNull(IN CONST LIST_ENTRY *List, IN CONST LIST_ENTRY *Node)
Definition: LinkedList.c:443
UINTN EFIAPI StrSize(IN CONST CHAR16 *String)
Definition: String.c:72
LIST_ENTRY *EFIAPI GetNextNode(IN CONST LIST_ENTRY *List, IN CONST LIST_ENTRY *Node)
Definition: LinkedList.c:333
LIST_ENTRY *EFIAPI GetFirstNode(IN CONST LIST_ENTRY *List)
Definition: LinkedList.c:298
RETURN_STATUS EFIAPI StrCatS(IN OUT CHAR16 *Destination, IN UINTN DestMax, IN CONST CHAR16 *Source)
Definition: SafeString.c:405
UINT64 EFIAPI DivU64x32Remainder(IN UINT64 Dividend, IN UINT32 Divisor, OUT UINT32 *Remainder OPTIONAL)
INTN EFIAPI CompareMem(IN CONST VOID *DestinationBuffer, IN CONST VOID *SourceBuffer, IN UINTN Length)
VOID *EFIAPI SetMem(OUT VOID *Buffer, IN UINTN Length, IN UINT8 Value)
Definition: SetMemWrapper.c:38
BOOLEAN EFIAPI CompareGuid(IN CONST GUID *Guid1, IN CONST GUID *Guid2)
Definition: MemLibGuid.c:73
EFI_STATUS AppendCSDNum2(IN OUT POOL_PRINT *Str, IN UINT64 Num)
EFI_STATUS DevPathSerialInfiniBand(IN EFI_DEVICE_PATH_PROTOCOL *DevicePathNode, IN DEVICE_CONSIST_MAPPING_INFO *MappingItem, IN EFI_DEVICE_PATH_PROTOCOL *DevicePath)
EFI_STATUS AppendCSDGuid(DEVICE_CONSIST_MAPPING_INFO *MappingItem, EFI_GUID *Guid)
INTN EFIAPI DevPathComparePci(IN EFI_DEVICE_PATH_PROTOCOL *DevicePath1, IN EFI_DEVICE_PATH_PROTOCOL *DevicePath2)
EFI_STATUS DevPathSerial1394(IN EFI_DEVICE_PATH_PROTOCOL *DevicePathNode, IN DEVICE_CONSIST_MAPPING_INFO *MappingItem, IN EFI_DEVICE_PATH_PROTOCOL *DevicePath)
INTN EFIAPI DevPathCompareAcpi(IN EFI_DEVICE_PATH_PROTOCOL *DevicePath1, IN EFI_DEVICE_PATH_PROTOCOL *DevicePath2)
EFI_STATUS DevPathSerialAcpi(IN EFI_DEVICE_PATH_PROTOCOL *DevicePathNode, IN DEVICE_CONSIST_MAPPING_INFO *MappingItem, IN EFI_DEVICE_PATH_PROTOCOL *DevicePath)
SHELL_MAP_LIST *EFIAPI ShellCommandFindMapItem(IN CONST CHAR16 *MapKey)
EFI_STATUS AppendCSDNum(IN OUT DEVICE_CONSIST_MAPPING_INFO *MappingItem, IN UINT64 Num)
EFI_STATUS(* SERIAL_DECODE_FUNCTION)(EFI_DEVICE_PATH_PROTOCOL *DevPath, DEVICE_CONSIST_MAPPING_INFO *MapInfo, EFI_DEVICE_PATH_PROTOCOL *OrigDevPath)
EFI_STATUS EFIAPI CatPrint(IN OUT POOL_PRINT *Str, IN CHAR16 *Fmt,...)
EFI_STATUS DevPathSerialLun(IN EFI_DEVICE_PATH_PROTOCOL *DevicePathNode, IN DEVICE_CONSIST_MAPPING_INFO *MappingItem, IN EFI_DEVICE_PATH_PROTOCOL *DevicePath)
EFI_STATUS AppendCSDStr(IN OUT DEVICE_CONSIST_MAPPING_INFO *MappingItem, IN CHAR16 *Str)
EFI_STATUS DevPathSerialCdRom(IN EFI_DEVICE_PATH_PROTOCOL *DevicePathNode, IN DEVICE_CONSIST_MAPPING_INFO *MappingItem, IN EFI_DEVICE_PATH_PROTOCOL *DevicePath)
EFI_STATUS DevPathSerialIPv4(IN EFI_DEVICE_PATH_PROTOCOL *DevicePathNode, IN DEVICE_CONSIST_MAPPING_INFO *MappingItem, IN EFI_DEVICE_PATH_PROTOCOL *DevicePath)
EFI_STATUS DevPathSerialVendor(IN EFI_DEVICE_PATH_PROTOCOL *DevicePathNode, IN DEVICE_CONSIST_MAPPING_INFO *MappingItem, IN EFI_DEVICE_PATH_PROTOCOL *DevicePath)
EFI_STATUS EFIAPI ShellCommandConsistMappingUnInitialize(EFI_DEVICE_PATH_PROTOCOL **Table)
EFI_STATUS DevPathSerialI2O(IN EFI_DEVICE_PATH_PROTOCOL *DevicePathNode, IN DEVICE_CONSIST_MAPPING_INFO *MappingItem, IN EFI_DEVICE_PATH_PROTOCOL *DevicePath)
CHAR16 *EFIAPI ShellCommandConsistMappingGenMappingName(IN EFI_DEVICE_PATH_PROTOCOL *DevicePath, IN EFI_DEVICE_PATH_PROTOCOL **Table)
EFI_STATUS DevPathSerialIPv6(IN EFI_DEVICE_PATH_PROTOCOL *DevicePathNode, IN DEVICE_CONSIST_MAPPING_INFO *MappingItem, IN EFI_DEVICE_PATH_PROTOCOL *DevicePath)
BOOLEAN IsHIDevicePathNode(IN EFI_DEVICE_PATH_PROTOCOL *DevicePathNode)
EFI_STATUS DevPathSerialAtapi(IN EFI_DEVICE_PATH_PROTOCOL *DevicePathNode, IN DEVICE_CONSIST_MAPPING_INFO *MappingItem, IN EFI_DEVICE_PATH_PROTOCOL *DevicePath)
EFI_STATUS DevPathSerialScsi(IN EFI_DEVICE_PATH_PROTOCOL *DevicePathNode, IN DEVICE_CONSIST_MAPPING_INFO *MappingItem, IN EFI_DEVICE_PATH_PROTOCOL *DevicePath)
EFI_STATUS EFIAPI ShellCommandConsistMappingInitialize(OUT EFI_DEVICE_PATH_PROTOCOL ***Table)
INTN EFIAPI DevPathCompareDefault(IN EFI_DEVICE_PATH_PROTOCOL *DevicePath1, IN EFI_DEVICE_PATH_PROTOCOL *DevicePath2)
EFI_STATUS DevPathSerialFibre(IN EFI_DEVICE_PATH_PROTOCOL *DevicePathNode, IN DEVICE_CONSIST_MAPPING_INFO *MappingItem, IN EFI_DEVICE_PATH_PROTOCOL *DevicePath)
EFI_STATUS DevPathSerialDefault(IN EFI_DEVICE_PATH_PROTOCOL *DevicePathNode, IN DEVICE_CONSIST_MAPPING_INFO *MappingItem, IN EFI_DEVICE_PATH_PROTOCOL *DevicePath)
EFI_STATUS DevPathSerialUart(IN EFI_DEVICE_PATH_PROTOCOL *DevicePathNode, IN DEVICE_CONSIST_MAPPING_INFO *MappingItem, IN EFI_DEVICE_PATH_PROTOCOL *DevicePath)
EFI_STATUS DevPathSerialMacAddr(IN EFI_DEVICE_PATH_PROTOCOL *DevicePathNode, IN DEVICE_CONSIST_MAPPING_INFO *MappingItem, IN EFI_DEVICE_PATH_PROTOCOL *DevicePath)
EFI_STATUS DevPathSerialIScsi(IN EFI_DEVICE_PATH_PROTOCOL *DevicePathNode, IN DEVICE_CONSIST_MAPPING_INFO *MappingItem, IN EFI_DEVICE_PATH_PROTOCOL *DevicePath)
EFI_STATUS DevPathSerialUsb(IN EFI_DEVICE_PATH_PROTOCOL *DevicePathNode, IN DEVICE_CONSIST_MAPPING_INFO *MappingItem, IN EFI_DEVICE_PATH_PROTOCOL *DevicePath)
EFI_STATUS DevPathSerialSata(IN EFI_DEVICE_PATH_PROTOCOL *DevicePathNode, IN DEVICE_CONSIST_MAPPING_INFO *MappingItem, IN EFI_DEVICE_PATH_PROTOCOL *DevicePath)
EFI_STATUS DevPathSerialHardDrive(IN EFI_DEVICE_PATH_PROTOCOL *DevicePathNode, IN DEVICE_CONSIST_MAPPING_INFO *MappingItem, IN EFI_DEVICE_PATH_PROTOCOL *DevicePath)
EFI_DEVICE_PATH_PROTOCOL * GetHIDevicePath(IN EFI_DEVICE_PATH_PROTOCOL *DevicePath)
EFI_STATUS GetDeviceConsistMappingInfo(IN DEVICE_CONSIST_MAPPING_INFO *MappingItem, IN EFI_DEVICE_PATH_PROTOCOL *DevicePath)
#define MSG_IPv6_DP
Definition: DevicePath.h:607
#define MSG_IPv4_DP
Definition: DevicePath.h:566
#define HARDWARE_DEVICE_PATH
Definition: DevicePath.h:68
#define MSG_INFINIBAND_DP
Definition: DevicePath.h:651
#define MSG_SCSI_DP
Definition: DevicePath.h:346
#define MSG_DEVICE_LOGICAL_UNIT_DP
Definition: DevicePath.h:498
#define MEDIA_CDROM_DP
Definition: DevicePath.h:1069
#define MSG_ATAPI_DP
Definition: DevicePath.h:326
#define ACPI_DEVICE_PATH
Definition: DevicePath.h:190
#define MSG_I2O_DP
Definition: DevicePath.h:538
#define MEDIA_HARDDRIVE_DP
Definition: DevicePath.h:1014
#define MSG_USB_DP
Definition: DevicePath.h:418
#define MSG_ISCSI_DP
Definition: DevicePath.h:925
#define MSG_MAC_ADDR_DP
Definition: DevicePath.h:550
#define ACPI_DP
Definition: DevicePath.h:195
#define MSG_UART_DP
Definition: DevicePath.h:692
#define MSG_SATA_DP
Definition: DevicePath.h:510
#define HW_PCI_DP
Definition: DevicePath.h:73
#define MSG_1394_DP
Definition: DevicePath.h:402
#define MESSAGING_DEVICE_PATH
Definition: DevicePath.h:321
#define MEDIA_VENDOR_DP
Media vendor device path subtype.
Definition: DevicePath.h:1093
#define MSG_FIBRECHANNEL_DP
Definition: DevicePath.h:362
UINT8 EFIAPI DevicePathType(IN CONST VOID *Node)
UINTN EFIAPI DevicePathNodeLength(IN CONST VOID *Node)
UINT8 EFIAPI DevicePathSubType(IN CONST VOID *Node)
EFI_DEVICE_PATH_PROTOCOL *EFIAPI AppendDevicePathNode(IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath OPTIONAL, IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePathNode OPTIONAL)
BOOLEAN EFIAPI IsDevicePathEnd(IN CONST VOID *Node)
EFI_DEVICE_PATH_PROTOCOL *EFIAPI NextDevicePathNode(IN CONST VOID *Node)
EFI_DEVICE_PATH_PROTOCOL *EFIAPI DevicePathFromHandle(IN EFI_HANDLE Handle)
VOID EFIAPI SetDevicePathEndNode(OUT VOID *Node)
VOID *EFIAPI ReallocatePool(IN UINTN OldSize, IN UINTN NewSize, IN VOID *OldBuffer OPTIONAL)
VOID *EFIAPI AllocateZeroPool(IN UINTN AllocationSize)
VOID EFIAPI FreePool(IN VOID *Buffer)
UINTN EFIAPI UnicodeVSPrint(OUT CHAR16 *StartOfBuffer, IN UINTN BufferSize, IN CONST CHAR16 *FormatString, IN VA_LIST Marker)
Definition: PrintLib.c:287
UINTN EFIAPI UnicodeSPrint(OUT CHAR16 *StartOfBuffer, IN UINTN BufferSize, IN CONST CHAR16 *FormatString,...)
Definition: PrintLib.c:408
#define NULL
Definition: Base.h:319
#define CONST
Definition: Base.h:259
#define MIN(a, b)
Definition: Base.h:1007
#define VA_START(Marker, Parameter)
Definition: Base.h:661
#define TRUE
Definition: Base.h:301
#define FALSE
Definition: Base.h:307
CHAR8 * VA_LIST
Definition: Base.h:643
#define IN
Definition: Base.h:279
#define OUT
Definition: Base.h:284
#define VA_END(Marker)
Definition: Base.h:691
#define ASSERT_EFI_ERROR(StatusParameter)
Definition: DebugLib.h:462
#define PcdGet32(TokenName)
Definition: PcdLib.h:362
#define PcdGetBool(TokenName)
Definition: PcdLib.h:401
SHELL_MAP_LIST gShellMapList
List of Mappings - DeviceName and Drive Letter(ism).
VOID EFIAPI PerformQuickSort(IN OUT VOID *BufferToSort, IN CONST UINTN Count, IN CONST UINTN ElementSize, IN SORT_COMPARE CompareFunction)
Definition: BaseSortLib.c:36
INTN EFIAPI DevicePathCompare(IN CONST VOID *Buffer1, IN CONST VOID *Buffer2)
Definition: BaseSortLib.c:73
RETURN_STATUS EFI_STATUS
Definition: UefiBaseType.h:29
VOID * EFI_HANDLE
Definition: UefiBaseType.h:33
#define EFI_SUCCESS
Definition: UefiBaseType.h:112
EFI_HANDLE gImageHandle
EFI_BOOT_SERVICES * gBS
CHAR16 *EFIAPI CatSPrint(IN CHAR16 *String OPTIONAL, IN CONST CHAR16 *FormatString,...)
Definition: UefiLibPrint.c:827
@ ByProtocol
Definition: UefiSpec.h:1518
#define USB_MASS_STORE_8020I
SFF-8020i, typically a CD/DVD device.
Definition: Usb.h:27
#define USB_MASS_STORE_8070I
SFF-8070i, typically a floppy disk driver device.
Definition: Usb.h:30
#define USB_MASS_STORE_UFI
Typically a floppy disk driver device.
Definition: Usb.h:29
#define USB_MASS_STORE_SCSI
SCSI transparent command set.
Definition: Usb.h:31
UINT8 PrimarySecondary
Definition: DevicePath.h:332
Definition: Base.h:213
EFI_IPv4_ADDRESS LocalIpAddress
Definition: DevicePath.h:572
EFI_IPv4_ADDRESS RemoteIpAddress
Definition: DevicePath.h:576
EFI_IPv6_ADDRESS LocalIpAddress
Definition: DevicePath.h:613
EFI_IPv6_ADDRESS RemoteIpAddress
Definition: DevicePath.h:617
UINT16 TargetPortalGroupTag
Definition: DevicePath.h:944
UINT16 NetworkProtocol
Definition: DevicePath.h:931
EFI_MAC_ADDRESS MacAddress
Definition: DevicePath.h:556
UINT16 RelativeTargetPort
Definition: DevicePath.h:803
UINT64 SasAddress
Definition: DevicePath.h:791
UINT16 DeviceTopology
Definition: DevicePath.h:799
UINT16 PortMultiplierPortNumber
Definition: DevicePath.h:523
UINT16 HBAPortNumber
Definition: DevicePath.h:517
UINT8 InterfaceNumber
Definition: DevicePath.h:428
UINT8 ParentPortNumber
Definition: DevicePath.h:424