From fa0d58ff68b924d2c3b9134f9fb4324124ac751f Mon Sep 17 00:00:00 2001 From: Arthur Heymans Date: Sun, 26 Feb 2017 23:04:51 +0100 Subject: [PATCH] UPSTREAM: nb/x4x: Add ramstage IGD disable function This disables VGA cycles on IGD when an external VGA device is found. This allows PCI or PCIe devices to be the 'main' VGA device if found, while the IGD is still available. TESTED on ga-g41m-es2l: SeaBIOS shows payload on external GPU while linux (4.10) can use both as a framebuffer simultaneously without any extra configuration. BUG=none BRANCH=none TEST=none Change-Id: I31fa03ca83a31ec741bd0dff3c4cffe57021581d Signed-off-by: Patrick Georgi Original-Commit-Id: c80748c2d04faf7313faf43bdbcde72a3ad9ee21 Original-Change-Id: I74890918feb0f1ff6b971c4aaa96f1f7b75266ac Original-Signed-off-by: Arthur Heymans Original-Reviewed-on: https://review.coreboot.org/18504 Original-Tested-by: build bot (Jenkins) Original-Reviewed-by: Nico Huber Original-Reviewed-by: Patrick Rudolph Reviewed-on: https://chromium-review.googlesource.com/501155 --- src/northbridge/intel/x4x/gma.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/northbridge/intel/x4x/gma.c b/src/northbridge/intel/x4x/gma.c index f4b2b2efca..c2df07424e 100644 --- a/src/northbridge/intel/x4x/gma.c +++ b/src/northbridge/intel/x4x/gma.c @@ -376,6 +376,16 @@ 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(0, 0)); + u16 ggc; + + ggc = pci_read_config16(dev_host, D0F0_GGC); + ggc |= (1 << 1); /* VGA cycles to discrete GPU */ + pci_write_config16(dev_host, D0F0_GGC, ggc); +} + static void gma_set_subsystem(device_t dev, unsigned int vendor, unsigned int device) { @@ -419,6 +429,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[] = {