Configurable GPU root port

Change-Id: Iae1641a407e075087179f11e186092b40c0c3022
This commit is contained in:
Jeremy Soller
2020-10-16 12:42:57 -06:00
parent a1aaca8cc8
commit 4714bc94b1
6 changed files with 18 additions and 7 deletions

View File

@@ -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

View File

@@ -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)

View File

@@ -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++) {

View File

@@ -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

View File

@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: GPL-2.0-only */
#include "../gpio.h"
// TODO: use correct scope #include <drivers/system76/dgpu/acpi/dgpu.asl>
#include <drivers/system76/dgpu/acpi/dgpu.asl>
#define EC_GPE_SCI 0x6E
#define EC_GPE_SWI 0x6B

View File

@@ -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 */