]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdePkg/Library/UefiDevicePathLib/DevicePathFromText.c
MdePkg: Handle AcpiExp device path when optional para is not specified
[mirror_edk2.git] / MdePkg / Library / UefiDevicePathLib / DevicePathFromText.c
index 128eb70139d43728041d1539951530d6237d4075..a852fb486f7d3e8ab7fde304364ba7d78cc7cc44 100644 (file)
@@ -919,7 +919,16 @@ DevPathFromTextAcpiExp (
                                                   );\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