summaryrefslogtreecommitdiff
path: root/src/drivers
diff options
context:
space:
mode:
authorCoolStar <coolstarorganization@gmail.com>2023-10-15 10:02:56 -0500
committerMatt DeVillier <matt.devillier@amd.corp-partner.google.com>2023-10-20 14:26:11 +0000
commit64ba070fd164fc307fe02051e8480db573fc1ac6 (patch)
treecce4532f33fc56b5d968ef0a52a4209dd8acee2f /src/drivers
parentf2e14fbb40da7a402aefdb1480644f51ba84bd84 (diff)
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 <coolstarorganization@gmail.com> Signed-off-by: Matt DeVillier <matt.devillier@gmail.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/78403 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Eric Lai <ericllai@google.com>
Diffstat (limited to 'src/drivers')
-rw-r--r--src/drivers/generic/bayhub/bh720.c47
1 files changed, 47 insertions, 0 deletions
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 <device/pci.h>
#include <device/pci_ops.h>
#include <device/pci_ids.h>
+#include <acpi/acpigen.h>
+#include <acpi/acpigen_pci.h>
#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[] = {