diff --git a/src/drivers/system76/dgpu/Kconfig b/src/drivers/system76/dgpu/Kconfig index 5096671472..6baea52efd 100644 --- a/src/drivers/system76/dgpu/Kconfig +++ b/src/drivers/system76/dgpu/Kconfig @@ -3,3 +3,10 @@ config DRIVERS_SYSTEM76_DGPU default n help System76 switchable graphics support + +#TODO: make this cleaner, use device tree? +config DRIVERS_SYSTEM76_DGPU_DEVICE + hex + default 0x01 + help + System76 switchable graphics root device number diff --git a/src/drivers/system76/dgpu/acpi/dgpu.asl b/src/drivers/system76/dgpu/acpi/dgpu.asl index a721934b71..c1eeda0536 100644 --- a/src/drivers/system76/dgpu/acpi/dgpu.asl +++ b/src/drivers/system76/dgpu/acpi/dgpu.asl @@ -1,7 +1,7 @@ /* SPDX-License-Identifier: GPL-2.0-only */ Device (\_SB.PCI0.PEGP) { - Name (_ADR, 0x00010000) + Name (_ADR, CONFIG(DRIVERS_SYSTEM76_DGPU_DEVICE) << 16) PowerResource (PWRR, 0, 0) { Name (_STA, 1) diff --git a/src/drivers/system76/dgpu/ramstage.c b/src/drivers/system76/dgpu/ramstage.c index eeb1607ed4..a17bdb9505 100644 --- a/src/drivers/system76/dgpu/ramstage.c +++ b/src/drivers/system76/dgpu/ramstage.c @@ -55,13 +55,13 @@ static struct device_operations dgpu_pci_ops_dev = { static void dgpu_above_4g(void *unused) { struct device *pdev; - // Find PEG0 - pdev = pcidev_on_root(1, 0); + // Find PEGP + pdev = pcidev_on_root(CONFIG(DRIVERS_SYSTEM76_DGPU_DEVICE), 0); if (!pdev) { - printk(BIOS_ERR, "system76: failed to find PEG0\n"); + printk(BIOS_ERR, "system76: failed to find PEGP\n"); return; } - printk(BIOS_INFO, "system76: PEG0 at %p, %04x:%04x\n", pdev, pdev->vendor, pdev->device); + printk(BIOS_INFO, "system76: PEGP at %p, %04x:%04x\n", pdev, pdev->vendor, pdev->device); int fn; for (fn = 0; fn < 8; fn++) { diff --git a/src/mainboard/system76/galp5/Kconfig b/src/mainboard/system76/galp5/Kconfig index bd54b04de3..1bf7c33213 100644 --- a/src/mainboard/system76/galp5/Kconfig +++ b/src/mainboard/system76/galp5/Kconfig @@ -53,6 +53,10 @@ config CONSOLE_POST bool default y +config DRIVERS_SYSTEM76_DGPU_DEVICE + hex + default 0x06 + config ONBOARD_VGA_IS_PRIMARY bool default y diff --git a/src/mainboard/system76/galp5/acpi/mainboard.asl b/src/mainboard/system76/galp5/acpi/mainboard.asl index a5cae6d655..fe94f92c45 100644 --- a/src/mainboard/system76/galp5/acpi/mainboard.asl +++ b/src/mainboard/system76/galp5/acpi/mainboard.asl @@ -1,7 +1,7 @@ /* SPDX-License-Identifier: GPL-2.0-only */ #include "../gpio.h" -// TODO: use correct scope #include +#include #define EC_GPE_SCI 0x6E #define EC_GPE_SWI 0x6B diff --git a/src/mainboard/system76/galp5/acpi/sleep.asl b/src/mainboard/system76/galp5/acpi/sleep.asl index e6705f6cd9..cd8ffefa38 100644 --- a/src/mainboard/system76/galp5/acpi/sleep.asl +++ b/src/mainboard/system76/galp5/acpi/sleep.asl @@ -5,7 +5,7 @@ Method (MPTS, 1) { \_SB.PCI0.LPCB.EC0.PTS (Arg0) // Turn DGPU on before sleeping - //TODO: use correct scope \_SB.PCI0.PEGP.DEV0._ON() + \_SB.PCI0.PEGP.DEV0._ON() } /* Method called from _WAK prior to wakeup */