Revision: 17985
http://sourceforge.net/p/edk2/code/17985
Author: hwu1225
Date: 2015-07-15 03:16:42 +0000 (Wed, 15 Jul 2015)
Log Message:
-----------
MdePkg: Add BMC device path definition and its node/text conversion
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hao Wu <[email protected]>
Reviewed-by: Feng Tian <[email protected]>
Modified Paths:
--------------
trunk/edk2/MdePkg/Include/Protocol/DevicePath.h
trunk/edk2/MdePkg/Library/UefiDevicePathLib/DevicePathFromText.c
trunk/edk2/MdePkg/Library/UefiDevicePathLib/DevicePathToText.c
Modified: trunk/edk2/MdePkg/Include/Protocol/DevicePath.h
===================================================================
--- trunk/edk2/MdePkg/Include/Protocol/DevicePath.h 2015-07-15 03:15:49 UTC
(rev 17984)
+++ trunk/edk2/MdePkg/Include/Protocol/DevicePath.h 2015-07-15 03:16:42 UTC
(rev 17985)
@@ -172,6 +172,26 @@
} CONTROLLER_DEVICE_PATH;
///
+/// BMC Device Path SubType.
+///
+#define HW_BMC_DP 0x06
+
+///
+/// BMC Device Path.
+///
+typedef struct {
+ EFI_DEVICE_PATH_PROTOCOL Header;
+ ///
+ /// Interface Type.
+ ///
+ UINT8 InterfaceType;
+ ///
+ /// Base Address.
+ ///
+ UINT8 BaseAddress[8];
+} BMC_DEVICE_PATH;
+
+///
/// ACPI Device Paths.
///
#define ACPI_DEVICE_PATH 0x02
@@ -1186,6 +1206,7 @@
VENDOR_DEVICE_PATH Vendor;
CONTROLLER_DEVICE_PATH Controller;
+ BMC_DEVICE_PATH Bmc;
ACPI_HID_DEVICE_PATH Acpi;
ACPI_EXTENDED_HID_DEVICE_PATH ExtendedAcpi;
ACPI_ADR_DEVICE_PATH AcpiAdr;
@@ -1241,6 +1262,7 @@
VENDOR_DEVICE_PATH *Vendor;
CONTROLLER_DEVICE_PATH *Controller;
+ BMC_DEVICE_PATH *Bmc;
ACPI_HID_DEVICE_PATH *Acpi;
ACPI_EXTENDED_HID_DEVICE_PATH *ExtendedAcpi;
ACPI_ADR_DEVICE_PATH *AcpiAdr;
Modified: trunk/edk2/MdePkg/Library/UefiDevicePathLib/DevicePathFromText.c
===================================================================
--- trunk/edk2/MdePkg/Library/UefiDevicePathLib/DevicePathFromText.c
2015-07-15 03:15:49 UTC (rev 17984)
+++ trunk/edk2/MdePkg/Library/UefiDevicePathLib/DevicePathFromText.c
2015-07-15 03:16:42 UTC (rev 17985)
@@ -794,6 +794,40 @@
}
/**
+ Converts a text device path node to BMC device path structure.
+
+ @param TextDeviceNode The input Text device path node.
+
+ @return A pointer to the newly-created BMC device path structure.
+
+**/
+EFI_DEVICE_PATH_PROTOCOL *
+DevPathFromTextBmc (
+ IN CHAR16 *TextDeviceNode
+ )
+{
+ CHAR16 *InterfaceTypeStr;
+ CHAR16 *BaseAddressStr;
+ BMC_DEVICE_PATH *BmcDp;
+
+ InterfaceTypeStr = GetNextParamStr (&TextDeviceNode);
+ BaseAddressStr = GetNextParamStr (&TextDeviceNode);
+ BmcDp = (BMC_DEVICE_PATH *) CreateDeviceNode (
+ HARDWARE_DEVICE_PATH,
+ HW_BMC_DP,
+ (UINT16) sizeof (BMC_DEVICE_PATH)
+ );
+
+ BmcDp->InterfaceType = (UINT8) Strtoi (InterfaceTypeStr);
+ WriteUnaligned64 (
+ (UINT64 *) (&BmcDp->BaseAddress),
+ StrHexToUint64 (BaseAddressStr)
+ );
+
+ return (EFI_DEVICE_PATH_PROTOCOL *) BmcDp;
+}
+
+/**
Converts a generic ACPI text device path node to ACPI device path structure.
@param TextDeviceNode The input Text device path node.
@@ -3423,6 +3457,7 @@
{L"MemoryMapped", DevPathFromTextMemoryMapped },
{L"VenHw", DevPathFromTextVenHw },
{L"Ctrl", DevPathFromTextCtrl },
+ {L"Bmc", DevPathFromTextBmc },
{L"AcpiPath", DevPathFromTextAcpiPath },
{L"Acpi", DevPathFromTextAcpi },
Modified: trunk/edk2/MdePkg/Library/UefiDevicePathLib/DevicePathToText.c
===================================================================
--- trunk/edk2/MdePkg/Library/UefiDevicePathLib/DevicePathToText.c
2015-07-15 03:15:49 UTC (rev 17984)
+++ trunk/edk2/MdePkg/Library/UefiDevicePathLib/DevicePathToText.c
2015-07-15 03:16:42 UTC (rev 17985)
@@ -307,6 +307,38 @@
}
/**
+ Converts a BMC device path structure to its string representative.
+
+ @param Str The string representative of input device.
+ @param DevPath The input device path structure.
+ @param DisplayOnly If DisplayOnly is TRUE, then the shorter text
representation
+ of the display node is used, where applicable. If
DisplayOnly
+ is FALSE, then the longer text representation of the
display node
+ is used.
+ @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of
text
+ representation for a device node can be used, where
applicable.
+
+**/
+VOID
+DevPathToTextBmc (
+ IN OUT POOL_PRINT *Str,
+ IN VOID *DevPath,
+ IN BOOLEAN DisplayOnly,
+ IN BOOLEAN AllowShortcuts
+ )
+{
+ BMC_DEVICE_PATH *Bmc;
+
+ Bmc = DevPath;
+ UefiDevicePathLibCatPrint (
+ Str,
+ L"Bmc(0x%x,0x%lx)",
+ Bmc->InterfaceType,
+ ReadUnaligned64 ((UINT64 *) (&Bmc->BaseAddress))
+ );
+}
+
+/**
Converts a ACPI device path structure to its string representative.
@param Str The string representative of input device.
@@ -2089,6 +2121,7 @@
{HARDWARE_DEVICE_PATH, HW_MEMMAP_DP,
DevPathToTextMemMap },
{HARDWARE_DEVICE_PATH, HW_VENDOR_DP,
DevPathToTextVendor },
{HARDWARE_DEVICE_PATH, HW_CONTROLLER_DP,
DevPathToTextController },
+ {HARDWARE_DEVICE_PATH, HW_BMC_DP, DevPathToTextBmc
},
{ACPI_DEVICE_PATH, ACPI_DP, DevPathToTextAcpi
},
{ACPI_DEVICE_PATH, ACPI_EXTENDED_DP,
DevPathToTextAcpiEx },
{ACPI_DEVICE_PATH, ACPI_ADR_DP,
DevPathToTextAcpiAdr },
------------------------------------------------------------------------------
Don't Limit Your Business. Reach for the Cloud.
GigeNET's Cloud Solutions provide you with the tools and support that
you need to offload your IT needs and focus on growing your business.
Configured For All Businesses. Start Your Cloud Today.
https://www.gigenetcloud.com/
_______________________________________________
edk2-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-commits