diff options
author | Dandan Bi <dandan.bi@intel.com> | 2018-10-12 10:18:28 +0800 |
---|---|---|
committer | Liming Gao <liming.gao@intel.com> | 2018-10-24 22:15:57 +0800 |
commit | a8b5750901faa63ff5570634851e648b8e335e5a (patch) | |
tree | 25ac7b1518c4204f49ed086794361d0ec4ed6513 /MdePkg/Library | |
parent | 3874108034eb3f1d5d5180df33a5dfdd5fab5d25 (diff) | |
download | edk2-a8b5750901faa63ff5570634851e648b8e335e5a.tar.gz edk2-a8b5750901faa63ff5570634851e648b8e335e5a.tar.bz2 edk2-a8b5750901faa63ff5570634851e648b8e335e5a.zip |
MdePkg: Handle AcpiExp device path when optional para is not specified
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1243
AcpiExp text device path: AcpiExp(HID,CID,UIDSTR)
And according to UEFI spec, the CID parameter is optional
and has a default value of 0. But current implementation
miss to check following cases for the AcpiExp.
FromText:when text device is AcpiExp(HID,,UIDSTR)/AcpiExp(HID,0,UIDSTR)
ToText: when the CID is 0 in the node structure
This commit is to do the enhancement.
Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
Diffstat (limited to 'MdePkg/Library')
-rw-r--r-- | MdePkg/Library/UefiDevicePathLib/DevicePathFromText.c | 11 | ||||
-rw-r--r-- | MdePkg/Library/UefiDevicePathLib/DevicePathToText.c | 23 |
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) {
//
|