summaryrefslogtreecommitdiffstats
path: root/MdePkg/Library/UefiDevicePathLib
diff options
context:
space:
mode:
authorHao Wu <hao.a.wu@intel.com>2015-07-15 03:16:42 +0000
committerhwu1225 <hwu1225@Edk2>2015-07-15 03:16:42 +0000
commit624f017e1756338c89326bc2dd9a2ba07e4ec5bb (patch)
treee11f3977e081c40253cf2478ac98ed021d445920 /MdePkg/Library/UefiDevicePathLib
parentc8c2815802f335fd6cfe971d984762e479142879 (diff)
downloadedk2-624f017e1756338c89326bc2dd9a2ba07e4ec5bb.tar.gz
edk2-624f017e1756338c89326bc2dd9a2ba07e4ec5bb.tar.bz2
edk2-624f017e1756338c89326bc2dd9a2ba07e4ec5bb.zip
MdePkg: Add BMC device path definition and its node/text conversion
Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Hao Wu <hao.a.wu@intel.com> Reviewed-by: Feng Tian <feng.tian@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17985 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdePkg/Library/UefiDevicePathLib')
-rw-r--r--MdePkg/Library/UefiDevicePathLib/DevicePathFromText.c35
-rw-r--r--MdePkg/Library/UefiDevicePathLib/DevicePathToText.c33
2 files changed, 68 insertions, 0 deletions
diff --git a/MdePkg/Library/UefiDevicePathLib/DevicePathFromText.c b/MdePkg/Library/UefiDevicePathLib/DevicePathFromText.c
index bbfff213ef..b8966854b2 100644
--- a/MdePkg/Library/UefiDevicePathLib/DevicePathFromText.c
+++ b/MdePkg/Library/UefiDevicePathLib/DevicePathFromText.c
@@ -794,6 +794,40 @@ DevPathFromTextCtrl (
}
/**
+ 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 @@ GLOBAL_REMOVE_IF_UNREFERENCED DEVICE_PATH_FROM_TEXT_TABLE mUefiDevicePathLibDevP
{L"MemoryMapped", DevPathFromTextMemoryMapped },
{L"VenHw", DevPathFromTextVenHw },
{L"Ctrl", DevPathFromTextCtrl },
+ {L"Bmc", DevPathFromTextBmc },
{L"AcpiPath", DevPathFromTextAcpiPath },
{L"Acpi", DevPathFromTextAcpi },
diff --git a/MdePkg/Library/UefiDevicePathLib/DevicePathToText.c b/MdePkg/Library/UefiDevicePathLib/DevicePathToText.c
index e82a70484c..8428c1cb7e 100644
--- a/MdePkg/Library/UefiDevicePathLib/DevicePathToText.c
+++ b/MdePkg/Library/UefiDevicePathLib/DevicePathToText.c
@@ -307,6 +307,38 @@ DevPathToTextController (
}
/**
+ 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 @@ GLOBAL_REMOVE_IF_UNREFERENCED const DEVICE_PATH_TO_TEXT_TABLE mUefiDevicePathLib
{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 },