drivers/system76/dgpu: Support GPU device on different PEG
Change-Id: I4386e89c6af8b1c0a2512f96f1c972685400d006
This commit is contained in:
committed by
Jeremy Soller
parent
688d22d133
commit
ead3af013e
@@ -3,3 +3,10 @@ config DRIVERS_SYSTEM76_DGPU
|
|||||||
default n
|
default n
|
||||||
help
|
help
|
||||||
System76 switchable graphics support
|
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
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
/* SPDX-License-Identifier: GPL-2.0-only */
|
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||||
|
|
||||||
Device (\_SB.PCI0.PEGP) {
|
Device (\_SB.PCI0.PEGP) {
|
||||||
Name (_ADR, 0x00010000)
|
Name (_ADR, CONFIG_DRIVERS_SYSTEM76_DGPU_DEVICE << 16)
|
||||||
|
|
||||||
PowerResource (PWRR, 0, 0) {
|
PowerResource (PWRR, 0, 0) {
|
||||||
Name (_STA, 1)
|
Name (_STA, 1)
|
||||||
@@ -35,7 +35,8 @@ Device (\_SB.PCI0.PEGP.DEV0) {
|
|||||||
|
|
||||||
// Memory mapped PCI express registers
|
// Memory mapped PCI express registers
|
||||||
// Not sure what this stuff is, but it is used to get into GC6
|
// Not sure what this stuff is, but it is used to get into GC6
|
||||||
OperationRegion (RPCX, SystemMemory, 0xE0008000, 0x1000)
|
//TODO: use DGPU_DEVICE to generate address
|
||||||
|
OperationRegion (RPCX, SystemMemory, CONFIG_MMCONF_BASE_ADDRESS + 0x8000, 0x1000)
|
||||||
Field (RPCX, ByteAcc, NoLock, Preserve) {
|
Field (RPCX, ByteAcc, NoLock, Preserve) {
|
||||||
PVID, 16,
|
PVID, 16,
|
||||||
PDID, 16,
|
PDID, 16,
|
||||||
|
@@ -55,13 +55,13 @@ static struct device_operations dgpu_pci_ops_dev = {
|
|||||||
static void dgpu_above_4g(void *unused) {
|
static void dgpu_above_4g(void *unused) {
|
||||||
struct device *pdev;
|
struct device *pdev;
|
||||||
|
|
||||||
// Find PEG0
|
// Find PEGP
|
||||||
pdev = pcidev_on_root(1, 0);
|
pdev = pcidev_on_root(CONFIG_DRIVERS_SYSTEM76_DGPU_DEVICE, 0);
|
||||||
if (!pdev) {
|
if (!pdev) {
|
||||||
printk(BIOS_ERR, "system76: failed to find PEG0\n");
|
printk(BIOS_ERR, "system76: failed to find PEGP\n");
|
||||||
return;
|
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;
|
int fn;
|
||||||
for (fn = 0; fn < 8; fn++) {
|
for (fn = 0; fn < 8; fn++) {
|
||||||
|
Reference in New Issue
Block a user