diff options
Diffstat (limited to 'EdkModulePkg/Universal/DevicePath')
6 files changed, 139 insertions, 491 deletions
diff --git a/EdkModulePkg/Universal/DevicePath/Dxe/DevicePath.c b/EdkModulePkg/Universal/DevicePath/Dxe/DevicePath.c index 79741a4615..78c5defe3a 100644 --- a/EdkModulePkg/Universal/DevicePath/Dxe/DevicePath.c +++ b/EdkModulePkg/Universal/DevicePath/Dxe/DevicePath.c @@ -20,8 +20,6 @@ Abstract: --*/ -#include <Uefi/UefiSpec.h> -#include <Protocol/DevicePath.h> #include "DevicePath.h" DEVICE_PATH_DRIVER_PRIVATE_DATA mPrivateData; @@ -29,27 +27,6 @@ DEVICE_PATH_DRIVER_PRIVATE_DATA mPrivateData; EFI_GUID mEfiDevicePathMessagingUartFlowControlGuid = DEVICE_PATH_MESSAGING_UART_FLOW_CONTROL; EFI_GUID mEfiDevicePathMessagingSASGuid = DEVICE_PATH_MESSAGING_SAS; -STATIC EFI_DEVICE_PATH_UTILITIES_PROTOCOL mDevicePathUtilitiesProtocol = { - GetDevicePathSize, - DuplicateDevicePath, - AppendDevicePath, - AppendDeviceNode, - AppendDevicePathInstance, - GetNextDevicePathInstance, - IsDevicePathMultiInstance, - CreateDeviceNode -}; - -STATIC EFI_DEVICE_PATH_TO_TEXT_PROTOCOL mDevicePathToTextProtocol = { - ConvertDeviceNodeToText, - ConvertDevicePathToText -}; - -STATIC EFI_DEVICE_PATH_FROM_TEXT_PROTOCOL mDevicePathFromTextProtocol = { - ConvertTextToDeviceNode, - ConvertTextToDevicePath -}; - EFI_STATUS EFIAPI DevicePathEntryPoint ( @@ -75,14 +52,14 @@ DevicePathEntryPoint ( mPrivateData.Signature = DEVICE_PATH_DRIVER_SIGNATURE; - mPrivateData.DevicePathUtilities.GetDevicePathSize = GetDevicePathSize; - mPrivateData.DevicePathUtilities.DuplicateDevicePath = DuplicateDevicePath; - mPrivateData.DevicePathUtilities.AppendDevicePath = AppendDevicePath; - mPrivateData.DevicePathUtilities.AppendDeviceNode = AppendDeviceNode; - mPrivateData.DevicePathUtilities.AppendDevicePathInstance = AppendDevicePathInstance; - mPrivateData.DevicePathUtilities.GetNextDevicePathInstance = GetNextDevicePathInstance; - mPrivateData.DevicePathUtilities.IsDevicePathMultiInstance = IsDevicePathMultiInstance; - mPrivateData.DevicePathUtilities.CreateDeviceNode = CreateDeviceNode; + mPrivateData.DevicePathUtilities.GetDevicePathSize = GetDevicePathSizeProtocolInterface; + mPrivateData.DevicePathUtilities.DuplicateDevicePath = DuplicateDevicePathProtocolInterface; + mPrivateData.DevicePathUtilities.AppendDevicePath = AppendDevicePathProtocolInterface; + mPrivateData.DevicePathUtilities.AppendDeviceNode = AppendDeviceNodeProtocolInterface; + mPrivateData.DevicePathUtilities.AppendDevicePathInstance = AppendDevicePathInstanceProtocolInterface; + mPrivateData.DevicePathUtilities.GetNextDevicePathInstance = GetNextDevicePathInstanceProtocolInterface; + mPrivateData.DevicePathUtilities.IsDevicePathMultiInstance = IsDevicePathMultiInstanceProtocolInterface; + mPrivateData.DevicePathUtilities.CreateDeviceNode = CreateDeviceNodeProtocolInterface; mPrivateData.DevicePathToText.ConvertDeviceNodeToText = ConvertDeviceNodeToText; mPrivateData.DevicePathToText.ConvertDevicePathToText = ConvertDevicePathToText; diff --git a/EdkModulePkg/Universal/DevicePath/Dxe/DevicePath.h b/EdkModulePkg/Universal/DevicePath/Dxe/DevicePath.h index aa333453ea..8e9072417e 100644 --- a/EdkModulePkg/Universal/DevicePath/Dxe/DevicePath.h +++ b/EdkModulePkg/Universal/DevicePath/Dxe/DevicePath.h @@ -247,7 +247,7 @@ ConvertTextToDevicePath ( ;
UINTN
-GetDevicePathSize (
+GetDevicePathSizeProtocolInterface (
IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath
)
/*++
@@ -265,7 +265,7 @@ GetDevicePathSize ( ;
EFI_DEVICE_PATH_PROTOCOL *
-DuplicateDevicePath (
+DuplicateDevicePathProtocolInterface (
IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath
)
/*++
@@ -284,7 +284,7 @@ DuplicateDevicePath ( ;
EFI_DEVICE_PATH_PROTOCOL *
-AppendDevicePath (
+AppendDevicePathProtocolInterface (
IN CONST EFI_DEVICE_PATH_PROTOCOL *Src1,
IN CONST EFI_DEVICE_PATH_PROTOCOL *Src2
)
@@ -306,7 +306,7 @@ AppendDevicePath ( ;
EFI_DEVICE_PATH_PROTOCOL *
-AppendDeviceNode (
+AppendDeviceNodeProtocolInterface (
IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath,
IN CONST EFI_DEVICE_PATH_PROTOCOL *DeviceNode
)
@@ -328,7 +328,7 @@ AppendDeviceNode ( ;
EFI_DEVICE_PATH_PROTOCOL *
-AppendDevicePathInstance (
+AppendDevicePathInstanceProtocolInterface (
IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath,
IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePathInstance
)
@@ -349,7 +349,7 @@ AppendDevicePathInstance ( ;
EFI_DEVICE_PATH_PROTOCOL *
-GetNextDevicePathInstance (
+GetNextDevicePathInstanceProtocolInterface (
IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePathInstance,
OUT UINTN *DevicePathInstanceSize
)
@@ -374,7 +374,7 @@ GetNextDevicePathInstance ( ;
BOOLEAN
-IsDevicePathMultiInstance (
+IsDevicePathMultiInstanceProtocolInterface (
IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath
)
/*++
@@ -393,7 +393,7 @@ IsDevicePathMultiInstance ( ;
EFI_DEVICE_PATH_PROTOCOL *
-CreateDeviceNode (
+CreateDeviceNodeProtocolInterface (
IN UINT8 NodeType,
IN UINT8 NodeSubType,
IN UINT16 NodeLength
diff --git a/EdkModulePkg/Universal/DevicePath/Dxe/DevicePath.msa b/EdkModulePkg/Universal/DevicePath/Dxe/DevicePath.msa index 20dd59848f..c5440ef530 100644 --- a/EdkModulePkg/Universal/DevicePath/Dxe/DevicePath.msa +++ b/EdkModulePkg/Universal/DevicePath/Dxe/DevicePath.msa @@ -56,6 +56,9 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.--> <LibraryClass Usage="ALWAYS_CONSUMED">
<Keyword>UefiBootServicesTableLib</Keyword>
</LibraryClass>
+ <LibraryClass Usage="ALWAYS_CONSUMED">
+ <Keyword>DevicePathLib</Keyword>
+ </LibraryClass>
</LibraryClassDefinitions>
<SourceFiles>
<Filename>DevicePath.c</Filename>
diff --git a/EdkModulePkg/Universal/DevicePath/Dxe/DevicePathFromText.c b/EdkModulePkg/Universal/DevicePath/Dxe/DevicePathFromText.c index e0864da6f0..d611b39f61 100644 --- a/EdkModulePkg/Universal/DevicePath/Dxe/DevicePathFromText.c +++ b/EdkModulePkg/Universal/DevicePath/Dxe/DevicePathFromText.c @@ -19,7 +19,6 @@ Abstract: --*/ -#include <protocol/DevicePathFromText.h> #include "DevicePath.h" CHAR16 * @@ -574,6 +573,7 @@ Returns: { UINTN Length; + *Data = 0; Length = sizeof (UINT64); HexStringToBuf ((UINT8 *) Data, &Length, TrimHexStr (Str), NULL); } @@ -618,7 +618,7 @@ Returns: Char = *(str++); while (Char) { if (Char >= '0' && Char <= '9') { - if (Rvalue > High || Rvalue == High && Char - '0' > (INTN) Low) { + if ((Rvalue > High || Rvalue == High) && (Char - '0' > (INTN) Low)) { return (UINTN) -1; } @@ -1298,7 +1298,7 @@ DevPathFromTextVenPcAnsi ( MESSAGING_DEVICE_PATH, MSG_VENDOR_DP, sizeof (VENDOR_DEVICE_PATH)); - Vendor->Guid = gEfiPcAnsiGuid; + CopyGuid (&Vendor->Guid, &gEfiPcAnsiGuid); return (EFI_DEVICE_PATH_PROTOCOL *) Vendor; } @@ -1314,7 +1314,7 @@ DevPathFromTextVenVt100 ( MESSAGING_DEVICE_PATH, MSG_VENDOR_DP, sizeof (VENDOR_DEVICE_PATH)); - Vendor->Guid = gEfiVT100Guid; + CopyGuid (&Vendor->Guid, &gEfiVT100Guid); return (EFI_DEVICE_PATH_PROTOCOL *) Vendor; } @@ -1330,7 +1330,7 @@ DevPathFromTextVenVt100Plus ( MESSAGING_DEVICE_PATH, MSG_VENDOR_DP, sizeof (VENDOR_DEVICE_PATH)); - Vendor->Guid = gEfiVT100PlusGuid; + CopyGuid (&Vendor->Guid, &gEfiVT100PlusGuid); return (EFI_DEVICE_PATH_PROTOCOL *) Vendor; } @@ -1346,7 +1346,7 @@ DevPathFromTextVenUtf8 ( MESSAGING_DEVICE_PATH, MSG_VENDOR_DP, sizeof (VENDOR_DEVICE_PATH)); - Vendor->Guid = gEfiVTUTF8Guid; + CopyGuid (&Vendor->Guid, &gEfiVTUTF8Guid); return (EFI_DEVICE_PATH_PROTOCOL *) Vendor; } @@ -1366,7 +1366,7 @@ DevPathFromTextUartFlowCtrl ( sizeof (UART_FLOW_CONTROL_DEVICE_PATH) ); - UartFlowControl->Guid = mEfiDevicePathMessagingUartFlowControlGuid; + CopyGuid (&UartFlowControl->Guid, &mEfiDevicePathMessagingUartFlowControlGuid); if (StrCmp (ValueStr, L"XonXoff") == 0) { UartFlowControl->FlowControlMap = 2; } else if (StrCmp (ValueStr, L"Hardware") == 0) { @@ -1409,7 +1409,7 @@ DevPathFromTextSAS ( sizeof (SAS_DEVICE_PATH) ); - Sas->Guid = mEfiDevicePathMessagingSASGuid; + CopyGuid (&Sas->Guid, &mEfiDevicePathMessagingSASGuid); Xtoi64 (AddressStr, &Sas->SasAddress); Xtoi64 (LunStr, &Sas->Lun); Sas->RelativeTargetPort = (UINT16) Xtoi (RTPStr); @@ -1455,7 +1455,7 @@ DevPathFromTextDebugPort ( sizeof (VENDOR_DEFINED_MESSAGING_DEVICE_PATH) ); - Vend->Guid = gEfiDebugPortProtocolGuid; + CopyGuid (&Vend->Guid, &gEfiDebugPortProtocolGuid); return (EFI_DEVICE_PATH_PROTOCOL *) Vend; } @@ -2166,8 +2166,8 @@ DevPathFromTextBBS ( Bbs->DeviceType = BBS_TYPE_UNKNOWN; } - AsciiStr = Bbs->String; - StrToAscii (IdStr, &AsciiStr); + AsciiStr = (UINT8 *) Bbs->String; + StrToAscii (IdStr, (CHAR8 **) &AsciiStr); Bbs->StatusFlag = (UINT16) Xtoi (FlagsStr); @@ -2175,120 +2175,63 @@ DevPathFromTextBBS ( } DEVICE_PATH_FROM_TEXT_TABLE DevPathFromTextTable[] = { - L"Pci", - DevPathFromTextPci, - L"PcCard", - DevPathFromTextPcCard, - L"MemoryMapped", - DevPathFromTextMemoryMapped, - L"VenHw", - DevPathFromTextVenHw, - L"Ctrl", - DevPathFromTextCtrl, - L"Acpi", - DevPathFromTextAcpi, - L"PciRoot", - DevPathFromTextPciRoot, - L"Floppy", - DevPathFromTextFloppy, - L"Keyboard", - DevPathFromTextKeyboard, - L"Serial", - DevPathFromTextSerial, - L"ParallelPort", - DevPathFromTextParallelPort, - L"AcpiEx", - DevPathFromTextAcpiEx, - L"AcpiExp", - DevPathFromTextAcpiExp, - L"Ata", - DevPathFromTextAta, - L"Scsi", - DevPathFromTextScsi, - L"Fibre", - DevPathFromTextFibre, - L"I1394", - DevPathFromText1394, - L"USB", - DevPathFromTextUsb, - L"I2O", - DevPathFromTextI2O, - L"Infiniband", - DevPathFromTextInfiniband, - L"VenMsg", - DevPathFromTextVenMsg, - L"VenPcAnsi", - DevPathFromTextVenPcAnsi, - L"VenVt100", - DevPathFromTextVenVt100, - L"VenVt100Plus", - DevPathFromTextVenVt100Plus, - L"VenUtf8", - DevPathFromTextVenUtf8, - L"UartFlowCtrl", - DevPathFromTextUartFlowCtrl, - L"SAS", - DevPathFromTextSAS, - L"DebugPort", - DevPathFromTextDebugPort, - L"MAC", - DevPathFromTextMAC, - L"IPv4", - DevPathFromTextIPv4, - L"IPv6", - DevPathFromTextIPv6, - L"Uart", - DevPathFromTextUart, - L"UsbClass", - DevPathFromTextUsbClass, - L"UsbAudio", - DevPathFromTextUsbAudio, - L"UsbCDCControl", - DevPathFromTextUsbCDCControl, - L"UsbHID", - DevPathFromTextUsbHID, - L"UsbImage", - DevPathFromTextUsbImage, - L"UsbPrinter", - DevPathFromTextUsbPrinter, - L"UsbMassStorage", - DevPathFromTextUsbMassStorage, - L"UsbHub", - DevPathFromTextUsbHub, - L"UsbCDCData", - DevPathFromTextUsbCDCData, - L"UsbSmartCard", - DevPathFromTextUsbSmartCard, - L"UsbVideo", - DevPathFromTextUsbVideo, - L"UsbDiagnostic", - DevPathFromTextUsbDiagnostic, - L"UsbWireless", - DevPathFromTextUsbWireless, - L"UsbDeviceFirmwareUpdate", - DevPathFromTextUsbDeviceFirmwareUpdate, - L"UsbIrdaBridge", - DevPathFromTextUsbIrdaBridge, - L"UsbTestAndMeasurement", - DevPathFromTextUsbTestAndMeasurement, - L"UsbWwid", - DevPathFromTextUsbWwid, - L"Unit", - DevPathFromTextUnit, - L"iSCSI", - DevPathFromTextiSCSI, - L"HD", - DevPathFromTextHD, - L"CDROM", - DevPathFromTextCDROM, - L"VenMEDIA", - DevPathFromTextVenMEDIA, - L"Media", - DevPathFromTextMedia, - L"BBS", - DevPathFromTextBBS, - NULL, - NULL + {L"Pci", DevPathFromTextPci}, + {L"PcCard", DevPathFromTextPcCard}, + {L"MemoryMapped", DevPathFromTextMemoryMapped}, + {L"VenHw", DevPathFromTextVenHw}, + {L"Ctrl", DevPathFromTextCtrl}, + {L"Acpi", DevPathFromTextAcpi}, + {L"PciRoot", DevPathFromTextPciRoot}, + {L"Floppy", DevPathFromTextFloppy}, + {L"Keyboard", DevPathFromTextKeyboard}, + {L"Serial", DevPathFromTextSerial}, + {L"ParallelPort", DevPathFromTextParallelPort}, + {L"AcpiEx", DevPathFromTextAcpiEx}, + {L"AcpiExp", DevPathFromTextAcpiExp}, + {L"Ata", DevPathFromTextAta}, + {L"Scsi", DevPathFromTextScsi}, + {L"Fibre", DevPathFromTextFibre}, + {L"I1394", DevPathFromText1394}, + {L"USB", DevPathFromTextUsb}, + {L"I2O", DevPathFromTextI2O}, + {L"Infiniband", DevPathFromTextInfiniband}, + {L"VenMsg", DevPathFromTextVenMsg}, + {L"VenPcAnsi", DevPathFromTextVenPcAnsi}, + {L"VenVt100", DevPathFromTextVenVt100}, + {L"VenVt100Plus", DevPathFromTextVenVt100Plus}, + {L"VenUtf8", DevPathFromTextVenUtf8}, + {L"UartFlowCtrl", DevPathFromTextUartFlowCtrl}, + {L"SAS", DevPathFromTextSAS}, + {L"DebugPort", DevPathFromTextDebugPort}, + {L"MAC", DevPathFromTextMAC}, + {L"IPv4", DevPathFromTextIPv4}, + {L"IPv6", DevPathFromTextIPv6}, + {L"Uart", DevPathFromTextUart}, + {L"UsbClass", DevPathFromTextUsbClass}, + {L"UsbAudio", DevPathFromTextUsbAudio}, + {L"UsbCDCControl", DevPathFromTextUsbCDCControl}, + {L"UsbHID", DevPathFromTextUsbHID}, + {L"UsbImage", DevPathFromTextUsbImage}, + {L"UsbPrinter", DevPathFromTextUsbPrinter}, + {L"UsbMassStorage", DevPathFromTextUsbMassStorage}, + {L"UsbHub", DevPathFromTextUsbHub}, + {L"UsbCDCData", DevPathFromTextUsbCDCData}, + {L"UsbSmartCard", DevPathFromTextUsbSmartCard}, + {L"UsbVideo", DevPathFromTextUsbVideo}, + {L"UsbDiagnostic", DevPathFromTextUsbDiagnostic}, + {L"UsbWireless", DevPathFromTextUsbWireless}, + {L"UsbDeviceFirmwareUpdate", DevPathFromTextUsbDeviceFirmwareUpdate}, + {L"UsbIrdaBridge", DevPathFromTextUsbIrdaBridge}, + {L"UsbTestAndMeasurement", DevPathFromTextUsbTestAndMeasurement}, + {L"UsbWwid", DevPathFromTextUsbWwid}, + {L"Unit", DevPathFromTextUnit}, + {L"iSCSI", DevPathFromTextiSCSI}, + {L"HD", DevPathFromTextHD}, + {L"CDROM", DevPathFromTextCDROM}, + {L"VenMEDIA", DevPathFromTextVenMEDIA}, + {L"Media", DevPathFromTextMedia}, + {L"BBS", DevPathFromTextBBS}, + {NULL, NULL} }; EFI_DEVICE_PATH_PROTOCOL * @@ -2413,7 +2356,7 @@ ConvertTextToDevicePath ( gBS->FreePool (ParamStr); } - NewDevicePath = AppendDeviceNode (DevicePath, DeviceNode); + NewDevicePath = AppendDeviceNodeProtocolInterface (DevicePath, DeviceNode); gBS->FreePool (DevicePath); gBS->FreePool (DeviceNode); DevicePath = NewDevicePath; @@ -2422,7 +2365,7 @@ ConvertTextToDevicePath ( DeviceNode = (EFI_DEVICE_PATH_PROTOCOL *) AllocatePool (END_DEVICE_PATH_LENGTH); SetDevicePathInstanceEndNode (DeviceNode); - NewDevicePath = AppendDeviceNode (DevicePath, DeviceNode); + NewDevicePath = AppendDeviceNodeProtocolInterface (DevicePath, DeviceNode); gBS->FreePool (DevicePath); gBS->FreePool (DeviceNode); DevicePath = NewDevicePath; diff --git a/EdkModulePkg/Universal/DevicePath/Dxe/DevicePathToText.c b/EdkModulePkg/Universal/DevicePath/Dxe/DevicePathToText.c index 64fd5658fd..f38f2ea110 100644 --- a/EdkModulePkg/Universal/DevicePath/Dxe/DevicePathToText.c +++ b/EdkModulePkg/Universal/DevicePath/Dxe/DevicePathToText.c @@ -19,7 +19,6 @@ Abstract: --*/
-#include <protocol/DevicePathToText.h>
#include "DevicePath.h"
EFI_DEVICE_PATH_PROTOCOL *
@@ -372,7 +371,7 @@ DevPathToTextController ( CatPrint (
Str,
L"Ctrl(%x)",
- (UINT16 *)Controller->ControllerNumber
+ Controller->ControllerNumber
);
}
@@ -423,7 +422,7 @@ DevPathToTextAcpi ( }
}
-#define NextStrA(a) ((UINT8 *) (((UINT8 *) (a)) + AsciiStrLen (a) + 1))
+#define NextStrA(a) ((UINT8 *) (((UINT8 *) (a)) + AsciiStrLen ((CHAR8 *) (a)) + 1))
VOID
DevPathToTextExtAcpi (
@@ -1257,102 +1256,38 @@ DevPathToTextNodeUnknown ( }
DEVICE_PATH_TO_TEXT_TABLE DevPathToTextTable[] = {
- HARDWARE_DEVICE_PATH,
- HW_PCI_DP,
- DevPathToTextPci,
- HARDWARE_DEVICE_PATH,
- HW_PCCARD_DP,
- DevPathToTextPccard,
- HARDWARE_DEVICE_PATH,
- HW_MEMMAP_DP,
- DevPathToTextMemMap,
- HARDWARE_DEVICE_PATH,
- HW_VENDOR_DP,
- DevPathToTextVendor,
- HARDWARE_DEVICE_PATH,
- HW_CONTROLLER_DP,
- DevPathToTextController,
- ACPI_DEVICE_PATH,
- ACPI_DP,
- DevPathToTextAcpi,
- ACPI_DEVICE_PATH,
- ACPI_EXTENDED_DP,
- DevPathToTextExtAcpi,
- MESSAGING_DEVICE_PATH,
- MSG_ATAPI_DP,
- DevPathToTextAtapi,
- MESSAGING_DEVICE_PATH,
- MSG_SCSI_DP,
- DevPathToTextScsi,
- MESSAGING_DEVICE_PATH,
- MSG_FIBRECHANNEL_DP,
- DevPathToTextFibre,
- MESSAGING_DEVICE_PATH,
- MSG_1394_DP,
- DevPathToText1394,
- MESSAGING_DEVICE_PATH,
- MSG_USB_DP,
- DevPathToTextUsb,
- MESSAGING_DEVICE_PATH,
- MSG_USB_WWID_DP,
- DevPathToTextUsbWWID,
- MESSAGING_DEVICE_PATH,
- MSG_DEVICE_LOGICAL_UNIT_DP,
- DevPathToTextLogicalUnit,
- MESSAGING_DEVICE_PATH,
- MSG_USB_CLASS_DP,
- DevPathToTextUsbClass,
- MESSAGING_DEVICE_PATH,
- MSG_I2O_DP,
- DevPathToTextI2O,
- MESSAGING_DEVICE_PATH,
- MSG_MAC_ADDR_DP,
- DevPathToTextMacAddr,
- MESSAGING_DEVICE_PATH,
- MSG_IPv4_DP,
- DevPathToTextIPv4,
- MESSAGING_DEVICE_PATH,
- MSG_IPv6_DP,
- DevPathToTextIPv6,
- MESSAGING_DEVICE_PATH,
- MSG_INFINIBAND_DP,
- DevPathToTextInfiniBand,
- MESSAGING_DEVICE_PATH,
- MSG_UART_DP,
- DevPathToTextUart,
- MESSAGING_DEVICE_PATH,
- MSG_VENDOR_DP,
- DevPathToTextVendor,
- MESSAGING_DEVICE_PATH,
- MSG_ISCSI_DP,
- DevPathToTextiSCSI,
- MEDIA_DEVICE_PATH,
- MEDIA_HARDDRIVE_DP,
- DevPathToTextHardDrive,
- MEDIA_DEVICE_PATH,
- MEDIA_CDROM_DP,
- DevPathToTextCDROM,
- MEDIA_DEVICE_PATH,
- MEDIA_VENDOR_DP,
- DevPathToTextVendor,
- MEDIA_DEVICE_PATH,
- MEDIA_FILEPATH_DP,
- DevPathToTextFilePath,
- MEDIA_DEVICE_PATH,
- MEDIA_PROTOCOL_DP,
- DevPathToTextMediaProtocol,
- MEDIA_DEVICE_PATH,
- MEDIA_FILEPATH_DP,
- DevPathToTextFilePath,
- BBS_DEVICE_PATH,
- BBS_BBS_DP,
- DevPathToTextBBS,
- END_DEVICE_PATH_TYPE,
- END_INSTANCE_DEVICE_PATH_SUBTYPE,
- DevPathToTextEndInstance,
- 0,
- 0,
- NULL
+ {HARDWARE_DEVICE_PATH, HW_PCI_DP, DevPathToTextPci},
+ {HARDWARE_DEVICE_PATH, HW_PCCARD_DP, DevPathToTextPccard},
+ {HARDWARE_DEVICE_PATH, HW_MEMMAP_DP, DevPathToTextMemMap},
+ {HARDWARE_DEVICE_PATH, HW_VENDOR_DP, DevPathToTextVendor},
+ {HARDWARE_DEVICE_PATH, HW_CONTROLLER_DP, DevPathToTextController},
+ {ACPI_DEVICE_PATH, ACPI_DP, DevPathToTextAcpi},
+ {ACPI_DEVICE_PATH, ACPI_EXTENDED_DP, DevPathToTextExtAcpi},
+ {MESSAGING_DEVICE_PATH, MSG_ATAPI_DP, DevPathToTextAtapi},
+ {MESSAGING_DEVICE_PATH, MSG_SCSI_DP, DevPathToTextScsi},
+ {MESSAGING_DEVICE_PATH, MSG_FIBRECHANNEL_DP, DevPathToTextFibre},
+ {MESSAGING_DEVICE_PATH, MSG_1394_DP, DevPathToText1394},
+ {MESSAGING_DEVICE_PATH, MSG_USB_DP, DevPathToTextUsb},
+ {MESSAGING_DEVICE_PATH, MSG_USB_WWID_DP, DevPathToTextUsbWWID},
+ {MESSAGING_DEVICE_PATH, MSG_DEVICE_LOGICAL_UNIT_DP, DevPathToTextLogicalUnit},
+ {MESSAGING_DEVICE_PATH, MSG_USB_CLASS_DP, DevPathToTextUsbClass},
+ {MESSAGING_DEVICE_PATH, MSG_I2O_DP, DevPathToTextI2O},
+ {MESSAGING_DEVICE_PATH, MSG_MAC_ADDR_DP, DevPathToTextMacAddr},
+ {MESSAGING_DEVICE_PATH, MSG_IPv4_DP, DevPathToTextIPv4},
+ {MESSAGING_DEVICE_PATH, MSG_IPv6_DP, DevPathToTextIPv6},
+ {MESSAGING_DEVICE_PATH, MSG_INFINIBAND_DP, DevPathToTextInfiniBand},
+ {MESSAGING_DEVICE_PATH, MSG_UART_DP, DevPathToTextUart},
+ {MESSAGING_DEVICE_PATH, MSG_VENDOR_DP, DevPathToTextVendor},
+ {MESSAGING_DEVICE_PATH, MSG_ISCSI_DP, DevPathToTextiSCSI},
+ {MEDIA_DEVICE_PATH, MEDIA_HARDDRIVE_DP, DevPathToTextHardDrive},
+ {MEDIA_DEVICE_PATH, MEDIA_CDROM_DP, DevPathToTextCDROM},
+ {MEDIA_DEVICE_PATH, MEDIA_VENDOR_DP, DevPathToTextVendor},
+ {MEDIA_DEVICE_PATH, MEDIA_FILEPATH_DP, DevPathToTextFilePath},
+ {MEDIA_DEVICE_PATH, MEDIA_PROTOCOL_DP, DevPathToTextMediaProtocol},
+ {MEDIA_DEVICE_PATH, MEDIA_FILEPATH_DP, DevPathToTextFilePath},
+ {BBS_DEVICE_PATH, BBS_BBS_DP, DevPathToTextBBS},
+ {END_DEVICE_PATH_TYPE, END_INSTANCE_DEVICE_PATH_SUBTYPE, DevPathToTextEndInstance},
+ {0, 0, NULL}
};
CHAR16 *
diff --git a/EdkModulePkg/Universal/DevicePath/Dxe/DevicePathUtilities.c b/EdkModulePkg/Universal/DevicePath/Dxe/DevicePathUtilities.c index 2b54c76832..a702595225 100644 --- a/EdkModulePkg/Universal/DevicePath/Dxe/DevicePathUtilities.c +++ b/EdkModulePkg/Universal/DevicePath/Dxe/DevicePathUtilities.c @@ -19,12 +19,10 @@ Abstract: --*/ -#include <protocol/DevicePathUtilities.h> -#include <protocol/DevicePath.h> #include "DevicePath.h" UINTN -GetDevicePathSize ( +GetDevicePathSizeProtocolInterface ( IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath ) /*++ @@ -40,28 +38,11 @@ GetDevicePathSize ( --*/ { - CONST EFI_DEVICE_PATH_PROTOCOL *Start; - - if (DevicePath == NULL) { - return 0; - } - - // - // Search for the end of the device path structure - // - Start = (EFI_DEVICE_PATH_PROTOCOL *) DevicePath; - while (!IsDevicePathEnd (DevicePath)) { - DevicePath = NextDevicePathNode (DevicePath); - } - - // - // Compute the size and add back in the size of the end device path structure - // - return ((UINTN) DevicePath - (UINTN) Start) + sizeof (EFI_DEVICE_PATH_PROTOCOL); + return GetDevicePathSize (DevicePath); } EFI_DEVICE_PATH_PROTOCOL * -DuplicateDevicePath ( +DuplicateDevicePathProtocolInterface ( IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath ) /*++ @@ -78,31 +59,11 @@ DuplicateDevicePath ( --*/ { - EFI_DEVICE_PATH_PROTOCOL *NewDevicePath; - UINTN Size; - - if (DevicePath == NULL) { - return NULL; - } - - // - // Compute the size - // - Size = GetDevicePathSize (DevicePath); - if (Size == 0) { - return NULL; - } - - // - // Allocate space for duplicate device path - // - NewDevicePath = AllocateCopyPool (Size, (VOID *) DevicePath); - - return NewDevicePath; + return DuplicateDevicePath (DevicePath); } EFI_DEVICE_PATH_PROTOCOL * -AppendDevicePath ( +AppendDevicePathProtocolInterface ( IN CONST EFI_DEVICE_PATH_PROTOCOL *Src1, IN CONST EFI_DEVICE_PATH_PROTOCOL *Src2 ) @@ -122,48 +83,11 @@ AppendDevicePath ( --*/ { - UINTN Size; - UINTN Size1; - UINTN Size2; - EFI_DEVICE_PATH_PROTOCOL *NewDevicePath; - EFI_DEVICE_PATH_PROTOCOL *SecondDevicePath; - - // - // If there's only 1 path, just duplicate it - // - if (Src1 == NULL) { - ASSERT (!IsDevicePathUnpacked (Src2)); - return DuplicateDevicePath (Src2); - } - - if (Src2 == NULL) { - ASSERT (!IsDevicePathUnpacked (Src1)); - return DuplicateDevicePath (Src1); - } - - // - // Allocate space for the combined device path. It only has one end node of - // length EFI_DEVICE_PATH_PROTOCOL - // - Size1 = GetDevicePathSize (Src1); - Size2 = GetDevicePathSize (Src2); - Size = Size1 + Size2 - sizeof (EFI_DEVICE_PATH_PROTOCOL); - - NewDevicePath = AllocateCopyPool (Size, (VOID *) Src1); - - if (NewDevicePath != NULL) { - // - // Over write Src1 EndNode and do the copy - // - SecondDevicePath = (EFI_DEVICE_PATH_PROTOCOL *) ((CHAR8 *) NewDevicePath + (Size1 - sizeof (EFI_DEVICE_PATH_PROTOCOL))); - CopyMem (SecondDevicePath, (VOID *) Src2, Size2); - } - - return NewDevicePath; + return AppendDevicePath (Src1, Src2); } EFI_DEVICE_PATH_PROTOCOL * -AppendDeviceNode ( +AppendDeviceNodeProtocolInterface ( IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath, IN CONST EFI_DEVICE_PATH_PROTOCOL *DeviceNode ) @@ -183,41 +107,11 @@ AppendDeviceNode ( --*/ { - EFI_DEVICE_PATH_PROTOCOL *Temp; - EFI_DEVICE_PATH_PROTOCOL *NextNode; - EFI_DEVICE_PATH_PROTOCOL *NewDevicePath; - UINTN NodeLength; - - if ((DevicePath == NULL) || (DeviceNode == NULL)) { - return NULL; - } - - // - // Build a Node that has a terminator on it - // - NodeLength = DevicePathNodeLength (DeviceNode); - - Temp = AllocateCopyPool (NodeLength + sizeof (EFI_DEVICE_PATH_PROTOCOL), (VOID *) DeviceNode); - if (Temp == NULL) { - return NULL; - } - - // - // Add and end device path node to convert Node to device path - // - NextNode = NextDevicePathNode (Temp); - SetDevicePathEndNode (NextNode); - - // - // Append device paths - // - NewDevicePath = AppendDevicePath (DevicePath, Temp); - gBS->FreePool (Temp); - return NewDevicePath; + return AppendDevicePathNode (DevicePath, DeviceNode); } EFI_DEVICE_PATH_PROTOCOL * -AppendDevicePathInstance ( +AppendDevicePathInstanceProtocolInterface ( IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath, IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePathInstance ) @@ -236,42 +130,11 @@ AppendDevicePathInstance ( --*/ { - UINT8 *Ptr; - EFI_DEVICE_PATH_PROTOCOL *DevPath; - UINTN SrcSize; - UINTN InstanceSize; - - if (DevicePathInstance == NULL) { - return NULL; - } - - if (DevicePath == NULL) { - return DuplicateDevicePath (DevicePathInstance); - } - - SrcSize = GetDevicePathSize (DevicePath); - InstanceSize = GetDevicePathSize (DevicePathInstance); - - Ptr = AllocateCopyPool (SrcSize + InstanceSize, (VOID *) DevicePath); - if (Ptr != NULL) { - - DevPath = (EFI_DEVICE_PATH_PROTOCOL *) (Ptr + (SrcSize - sizeof (EFI_DEVICE_PATH_PROTOCOL))); - // - // Convert the End to an End Instance, since we are - // appending another instacne after this one its a good - // idea. - // - DevPath->SubType = END_INSTANCE_DEVICE_PATH_SUBTYPE; - - DevPath = NextDevicePathNode (DevPath); - CopyMem (DevPath, (VOID *) DevicePathInstance, InstanceSize); - } - - return (EFI_DEVICE_PATH_PROTOCOL *) Ptr; + return AppendDevicePathInstance (DevicePath, DevicePathInstance); } EFI_DEVICE_PATH_PROTOCOL * -GetNextDevicePathInstance ( +GetNextDevicePathInstanceProtocolInterface ( IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePathInstance, OUT UINTN *DevicePathInstanceSize ) @@ -294,56 +157,11 @@ GetNextDevicePathInstance ( --*/ { - EFI_DEVICE_PATH_PROTOCOL *DevPath; - EFI_DEVICE_PATH_PROTOCOL *ReturnValue; - UINT8 Temp; - - if (*DevicePathInstance == NULL) { - if (DevicePathInstanceSize != NULL) { - *DevicePathInstanceSize = 0; - } - - return NULL; - } - - // - // Find the end of the device path instance - // - DevPath = *DevicePathInstance; - while (!IsDevicePathEndType (DevPath)) { - DevPath = NextDevicePathNode (DevPath); - } - - // - // Compute the size of the device path instance - // - if (DevicePathInstanceSize != NULL) { - *DevicePathInstanceSize = ((UINTN) DevPath - (UINTN) (*DevicePathInstance)) + sizeof (EFI_DEVICE_PATH_PROTOCOL); - } - - // - // Make a copy and return the device path instance - // - Temp = DevPath->SubType; - DevPath->SubType = END_ENTIRE_DEVICE_PATH_SUBTYPE; - ReturnValue = DuplicateDevicePath (*DevicePathInstance); - DevPath->SubType = Temp; - - // - // If DevPath is the end of an entire device path, then another instance - // does not follow, so *DevicePath is set to NULL. - // - if (DevicePathSubType (DevPath) == END_ENTIRE_DEVICE_PATH_SUBTYPE) { - *DevicePathInstance = NULL; - } else { - *DevicePathInstance = NextDevicePathNode (DevPath); - } - - return ReturnValue; + return GetNextDevicePathInstance (DevicePathInstance, DevicePathInstanceSize); } BOOLEAN -IsDevicePathMultiInstance ( +IsDevicePathMultiInstanceProtocolInterface ( IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath ) /*++ @@ -360,26 +178,11 @@ IsDevicePathMultiInstance ( --*/ { - CONST EFI_DEVICE_PATH_PROTOCOL *Node; - - if (DevicePath == NULL) { - return FALSE; - } - - Node = DevicePath; - while (!IsDevicePathEnd (Node)) { - if (EfiIsDevicePathEndInstance (Node)) { - return TRUE; - } - - Node = NextDevicePathNode (Node); - } - - return FALSE; + return IsDevicePathMultiInstance (DevicePath); } EFI_DEVICE_PATH_PROTOCOL * -CreateDeviceNode ( +CreateDeviceNodeProtocolInterface ( IN UINT8 NodeType, IN UINT8 NodeSubType, IN UINT16 NodeLength @@ -404,18 +207,5 @@ CreateDeviceNode ( --*/ { - EFI_DEVICE_PATH_PROTOCOL *Node; - - if (NodeLength < sizeof (EFI_DEVICE_PATH_PROTOCOL)) { - return NULL; - } - - Node = (EFI_DEVICE_PATH_PROTOCOL *) AllocateZeroPool ((UINTN) NodeLength); - if (Node != NULL) { - Node->Type = NodeType; - Node->SubType = NodeSubType; - SetDevicePathNodeLength (Node, NodeLength); - } - - return Node; + return CreateDeviceNode (NodeType, NodeSubType, NodeLength); } |