Felix Singer submitted this change.

View Change

Approvals: Felix Singer: Looks good to me, approved build bot (Jenkins): Verified Eric Lai: Looks good to me, approved
soc/intel/common/block/sata: Add ACPI stub for SATA device

Add an ACPI stub containing the SATA device in proper scope, along with
the device status, so that there exists a device to be referenced from
the PEPD LPI constraint list. Fixes a Windows BSOD INTERNAL_POWER_ERROR
on devices with enabled SATA ports.

TEST=build/boot Win11 on google/puff (kaisa).

Change-Id: I951c62d09609ed73079fe97ea9ce49fdee333272
Signed-off-by: Matt DeVillier <matt.devillier@gmail.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/80058
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Felix Singer <service+coreboot-gerrit@felixsinger.de>
Reviewed-by: Eric Lai <ericllai@google.com>
---
M src/soc/intel/common/block/sata/sata.c
1 file changed, 21 insertions(+), 0 deletions(-)

diff --git a/src/soc/intel/common/block/sata/sata.c b/src/soc/intel/common/block/sata/sata.c
index 41e31fe..96c33ef 100644
--- a/src/soc/intel/common/block/sata/sata.c
+++ b/src/soc/intel/common/block/sata/sata.c
@@ -1,8 +1,26 @@
/* SPDX-License-Identifier: GPL-2.0-only */

+#include <acpi/acpigen.h>
+#include <acpi/acpigen_pci.h>
#include <device/device.h>
#include <device/pci.h>
#include <device/pci_ids.h>
+#include <intelblocks/acpi.h>
+
+static void sata_acpi_fill_ssdt(const struct device *dev)
+{
+ const char *scope = acpi_device_path(dev);
+
+ if (!scope)
+ return;
+
+ acpigen_write_scope(scope);
+ acpigen_write_device(soc_acpi_name(dev));
+ acpigen_write_ADR_pci_device(dev);
+ acpigen_write_STA(acpi_device_status(dev));
+ acpigen_pop_len(); /* Device */
+ acpigen_pop_len(); /* Scope */
+}

struct device_operations sata_ops = {
.read_resources = pci_dev_read_resources,
@@ -10,6 +28,9 @@
.enable_resources = pci_dev_enable_resources,
.final = pci_dev_request_bus_master,
.ops_pci = &pci_dev_ops_pci,
+#if CONFIG(HAVE_ACPI_TABLES)
+ .acpi_fill_ssdt = sata_acpi_fill_ssdt,
+#endif
};

static const unsigned short pci_device_ids[] = {

To view, visit change 80058. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: coreboot
Gerrit-Branch: main
Gerrit-Change-Id: I951c62d09609ed73079fe97ea9ce49fdee333272
Gerrit-Change-Number: 80058
Gerrit-PatchSet: 5
Gerrit-Owner: Matt DeVillier <matt.devillier@gmail.com>
Gerrit-Reviewer: Eric Lai <ericllai@google.com>
Gerrit-Reviewer: Felix Singer <service+coreboot-gerrit@felixsinger.de>
Gerrit-Reviewer: build bot (Jenkins) <no-reply@coreboot.org>
Gerrit-MessageType: merged