summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--MdePkg/Library/UefiDevicePathLib/DevicePathFromText.c11
-rw-r--r--MdePkg/Library/UefiDevicePathLib/DevicePathToText.c23
2 files changed, 26 insertions, 8 deletions
diff --git a/MdePkg/Library/UefiDevicePathLib/DevicePathFromText.c b/MdePkg/Library/UefiDevicePathLib/DevicePathFromText.c
index 128eb70139..a852fb486f 100644
--- a/MdePkg/Library/UefiDevicePathLib/DevicePathFromText.c
+++ b/MdePkg/Library/UefiDevicePathLib/DevicePathFromText.c
@@ -919,7 +919,16 @@ DevPathFromTextAcpiExp (
);
AcpiEx->HID = EisaIdFromText (HIDStr);
- AcpiEx->CID = EisaIdFromText (CIDStr);
+ //
+ // According to UEFI spec, the CID parametr is optional and has a default value of 0.
+ // So when the CID parametr is not specified or specified as 0 in the text device node.
+ // Set the CID to 0 in the ACPI extension device path structure.
+ //
+ if (*CIDStr == L'\0' || *CIDStr == L'0') {
+ AcpiEx->CID = 0;
+ } else {
+ AcpiEx->CID = EisaIdFromText (CIDStr);
+ }
AcpiEx->UID = 0;
AsciiStr = (CHAR8 *) ((UINT8 *)AcpiEx + sizeof (ACPI_EXTENDED_HID_DEVICE_PATH));
diff --git a/MdePkg/Library/UefiDevicePathLib/DevicePathToText.c b/MdePkg/Library/UefiDevicePathLib/DevicePathToText.c
index 7ad9eadf6c..cdcdb3623a 100644
--- a/MdePkg/Library/UefiDevicePathLib/DevicePathToText.c
+++ b/MdePkg/Library/UefiDevicePathLib/DevicePathToText.c
@@ -480,13 +480,22 @@ DevPathToTextAcpiEx (
//
// use AcpiExp()
//
- UefiDevicePathLibCatPrint (
- Str,
- L"AcpiExp(%s,%s,%a)",
- HIDText,
- CIDText,
- UIDStr
- );
+ if (AcpiEx->CID == 0) {
+ UefiDevicePathLibCatPrint (
+ Str,
+ L"AcpiExp(%s,0,%a)",
+ HIDText,
+ UIDStr
+ );
+ } else {
+ UefiDevicePathLibCatPrint (
+ Str,
+ L"AcpiExp(%s,%s,%a)",
+ HIDText,
+ CIDText,
+ UIDStr
+ );
+ }
} else {
if (AllowShortcuts) {
//