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>
);\r
\r
AcpiEx->HID = EisaIdFromText (HIDStr);\r
- AcpiEx->CID = EisaIdFromText (CIDStr);\r
+ //\r
+ // According to UEFI spec, the CID parametr is optional and has a default value of 0.\r
+ // So when the CID parametr is not specified or specified as 0 in the text device node.\r
+ // Set the CID to 0 in the ACPI extension device path structure.\r
+ //\r
+ if (*CIDStr == L'\0' || *CIDStr == L'0') {\r
+ AcpiEx->CID = 0;\r
+ } else {\r
+ AcpiEx->CID = EisaIdFromText (CIDStr);\r
+ }\r
AcpiEx->UID = 0;\r
\r
AsciiStr = (CHAR8 *) ((UINT8 *)AcpiEx + sizeof (ACPI_EXTENDED_HID_DEVICE_PATH));\r
//\r
// use AcpiExp()\r
//\r
- UefiDevicePathLibCatPrint (\r
- Str,\r
- L"AcpiExp(%s,%s,%a)",\r
- HIDText,\r
- CIDText,\r
- UIDStr\r
- );\r
+ if (AcpiEx->CID == 0) {\r
+ UefiDevicePathLibCatPrint (\r
+ Str,\r
+ L"AcpiExp(%s,0,%a)",\r
+ HIDText,\r
+ UIDStr\r
+ );\r
+ } else {\r
+ UefiDevicePathLibCatPrint (\r
+ Str,\r
+ L"AcpiExp(%s,%s,%a)",\r
+ HIDText,\r
+ CIDText,\r
+ UIDStr\r
+ );\r
+ }\r
} else {\r
if (AllowShortcuts) {\r
//\r