From 64ba070fd164fc307fe02051e8480db573fc1ac6 Mon Sep 17 00:00:00 2001 From: CoolStar Date: Sun, 15 Oct 2023 10:02:56 -0500 Subject: drivers/generic/bayhub: Add ACPI for BH720 The Bayhub BH720 eMMC bridge is a fixed internal device, and needs to me marked as non-removable in order for Windows to properly recognize/ utilize the device. Add the necessary ACPI to be generated at runtime. TEST=build/boot/install Win11 on google/kahlee (liara) Change-Id: I0815abf1d2dc5cfe785dc04670ab91f2a6a1af23 Signed-off-by: CoolStar Signed-off-by: Matt DeVillier Reviewed-on: https://review.coreboot.org/c/coreboot/+/78403 Tested-by: build bot (Jenkins) Reviewed-by: Eric Lai --- src/drivers/generic/bayhub/bh720.c | 47 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) (limited to 'src/drivers') diff --git a/src/drivers/generic/bayhub/bh720.c b/src/drivers/generic/bayhub/bh720.c index 03c3b46f39..02abc222bd 100644 --- a/src/drivers/generic/bayhub/bh720.c +++ b/src/drivers/generic/bayhub/bh720.c @@ -9,9 +9,13 @@ #include #include #include +#include +#include #include "chip.h" #include "bh720.h" +#define BH720_ACPI_NAME "BHUB" + static u32 bh720_read_pcr(u32 sdbar, u32 addr) { write32p(sdbar + BH720_MEM_RW_ADR, BH720_MEM_RW_READ | addr); @@ -99,12 +103,55 @@ static void bh720_init(struct device *dev) } } +static void bh720_fill_ssdt(const struct device *dev) +{ + if (dev->path.type != DEVICE_PATH_PCI) { + return; + } + + const char *scope = acpi_device_scope(dev); + const char *name = acpi_device_name(dev); + if (!scope || !name) + return; + + /* Device */ + acpigen_write_scope(scope); + acpigen_write_device(name); + + acpigen_write_ADR_pci_device(dev); + acpigen_write_STA(acpi_device_status(dev)); + + /* Card */ + acpigen_write_device("CARD"); + acpigen_write_ADR(0x08); //eMMC is always on address 0x8 + + /* + * Method (_RMV, 0, NotSerialized) { Return (0) } + */ + acpigen_write_method("_RMV", 0); /* Method */ + acpigen_emit_byte(RETURN_OP); + acpigen_write_byte(0); + acpigen_pop_len(); /* Method */ + + acpigen_pop_len(); /* Card */ + + acpigen_pop_len(); /* Device */ + acpigen_pop_len(); /* Scope */ +} + +static const char *bh720_acpi_name(const struct device *dev) +{ + return BH720_ACPI_NAME; +} + static struct device_operations bh720_ops = { .read_resources = pci_dev_read_resources, .set_resources = pci_dev_set_resources, .enable_resources = pci_dev_enable_resources, .ops_pci = &pci_dev_ops_pci, .init = bh720_init, + .acpi_name = bh720_acpi_name, + .acpi_fill_ssdt = bh720_fill_ssdt }; static const unsigned short pci_device_ids[] = { -- cgit v1.2.3