acpi: Be more ACPI compliant when generating _UID

* Add function to generate unique _UID using CRC32
* Add function to write the _UID based on a device's ACPI path

ACPI devices that have the same _HID must use different _UID.
Linux doesn't care about _UID if it's not used.
Windows 10 verifies the ACPI code on boot and BSODs if two devices
with the same _HID share the same _UID.

Fixes BSOD seen on Windows 10.

Change-Id: I47cd5396060d325f9ce338afced6af021e7ff2b4
Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/37695
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Philipp Deppenwiese <zaolin.daisuki@gmail.com>
This commit is contained in:
Patrick Rudolph
2019-12-13 12:16:06 +01:00
committed by Felix Held
parent 5c8ff794a8
commit c83bab62b3
9 changed files with 48 additions and 5 deletions

View File

@@ -117,7 +117,7 @@ static void crb_tpm_fill_ssdt(struct device *dev)
acpigen_write_name_string("_HID", "MSFT0101");
acpigen_write_name_string("_CID", "MSFT0101");
acpigen_write_name_integer("_UID", 1);
acpi_device_write_uid(dev);
acpigen_write_STA(ACPI_STATUS_DEVICE_ALL_ON);

View File

@@ -312,7 +312,8 @@ static void r8168_net_fill_ssdt(struct device *dev)
acpigen_write_scope(path);
acpigen_write_device(acpi_device_name(dev));
acpigen_write_name_string("_HID", R8168_ACPI_HID);
acpigen_write_name_integer("_UID", 0);
acpi_device_write_uid(dev);
if (dev->chip_ops)
acpigen_write_name_string("_DDN", dev->chip_ops->name);

View File

@@ -902,7 +902,7 @@ static void lpc_tpm_fill_ssdt(struct device *dev)
acpigen_write_name("_CID");
acpigen_emit_eisaid("PNP0C31");
acpigen_write_name_integer("_UID", 1);
acpi_device_write_uid(dev);
u32 did_vid = tpm_read_did_vid(0);
if (did_vid > 0 && did_vid < 0xffffffff)

View File

@@ -187,7 +187,8 @@ void generic_wifi_fill_ssdt(struct device *dev,
/* Device */
acpigen_write_scope(path);
acpigen_write_device(acpi_device_name(dev));
acpigen_write_name_integer("_UID", 0);
acpi_device_write_uid(dev);
if (dev->chip_ops)
acpigen_write_name_string("_DDN", dev->chip_ops->name);