Arthur Heymans (arthur@aheymans.xyz) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/18504
-gerrit
commit 98712338435cafbcd359de7cbe31f332348e82dc Author: Arthur Heymans arthur@aheymans.xyz Date: Sun Feb 26 23:04:51 2017 +0100
nb/x4x: Disable IGD when external GPU is found
This disables IGD before raminit if an external GPU is found unless CONFIG_ONBOARD_VGA_IS_PRIMARY is set. This adds a disable function for IGD to allow set_vga_bridge_bits() in device.c to disable the integrated GPU when an external GPU is detected.
TESTED on ga-g41m-es2l
Change-Id: I74890918feb0f1ff6b971c4aaa96f1f7b75266ac Signed-off-by: Arthur Heymans arthur@aheymans.xyz --- src/northbridge/intel/x4x/early_init.c | 21 +++++++++++++++++++++ src/northbridge/intel/x4x/gma.c | 17 +++++++++++++++++ 2 files changed, 38 insertions(+)
diff --git a/src/northbridge/intel/x4x/early_init.c b/src/northbridge/intel/x4x/early_init.c index 7d6afc9..b455324 100644 --- a/src/northbridge/intel/x4x/early_init.c +++ b/src/northbridge/intel/x4x/early_init.c @@ -28,6 +28,7 @@ void x4x_early_init(void) { const pci_devfn_t d0f0 = PCI_DEV(0, 0, 0); + u32 reg32;
/* Setup MCHBAR. */ pci_write_config32(d0f0, D0F0_MCHBAR_LO, (uintptr_t)DEFAULT_MCHBAR | 1); @@ -64,6 +65,26 @@ void x4x_early_init(void) gfxsize = 6; } pci_write_config16(d0f0, D0F0_GGC, 0x0100 | ((gfxsize + 1) << 4)); + + /* + * Disabling IGD later is possible but somehow reclaiming its UMA + * resources fails so enable/disable IGD before raminit if external + * GPU is found. + */ + if (pci_read_config16(PCI_DEV(0, 0x01, 0), 0xba) & (1 << 6) && + !IS_ENABLED(CONFIG_ONBOARD_VGA_IS_PRIMARY)) { + pci_write_config8(PCI_DEV(0, 0x01, 0), 0x19, 0x0a); + pci_write_config8(PCI_DEV(0, 0x01, 0), 0x1a, 0x0a); + reg32 = (pci_read_config32(PCI_DEV(0xa, 0, 0), 0x8) >> 8); + if (reg32 == 0x030000) { + printk(BIOS_DEBUG,"External GPU is found." + " xDisabling IGD before raminit\n"); + reg32 = pci_read_config32(d0f0, D0F0_DEVEN); + pci_write_config32(d0f0, D0F0_DEVEN, + reg32 & ~(IGD0EN | IGD1EN)); + pci_write_config16(d0f0, D0F0_GGC, (1 << 1)); + } + } }
static void init_egress(void) diff --git a/src/northbridge/intel/x4x/gma.c b/src/northbridge/intel/x4x/gma.c index 74250fe..4bf8125 100644 --- a/src/northbridge/intel/x4x/gma.c +++ b/src/northbridge/intel/x4x/gma.c @@ -376,6 +376,22 @@ static void gma_func0_init(struct device *dev) pci_dev_init(dev); }
+static void gma_func0_disable(struct device *dev) +{ + struct device *dev_host = dev_find_slot(0, PCI_DEVFN(0x0, 0)); + u16 ggc; + + ggc = pci_read_config16(dev_host, D0F0_GGC); + ggc |= (1 << 1); + pci_write_config16(dev_host, D0F0_GGC, ggc); + + unsigned int reg32 = pci_read_config32(dev_host, D0F0_DEVEN); + reg32 &= ~(IGD0EN | IGD1EN); + pci_write_config32(dev_host, D0F0_DEVEN, reg32); + + dev->enabled = 0; +} + static void gma_set_subsystem(device_t dev, unsigned vendor, unsigned device) { if (!vendor || !device) { @@ -420,6 +436,7 @@ static struct device_operations gma_func0_ops = { .acpi_fill_ssdt_generator = gma_ssdt, .init = gma_func0_init, .ops_pci = &gma_pci_ops, + .disable = gma_func0_disable, };
static const unsigned short pci_device_ids[] =