From 2e7efe65a23570ba654187412052e7eb7583858f Mon Sep 17 00:00:00 2001 From: Arthur Heymans Date: Sat, 6 May 2017 18:05:57 +0200 Subject: [PATCH] nb/intel/x4x: Don't run NGI if IGD has not been assigned VGA cycles The NGI writes to legacy VGA registers which should not happen when VGA cycles are assigned to a different device. TESTED on ga-g41m-es2l Change-Id: I0a03e35c0d7f2532edd6cc5e62d1cf07dab57f60 Signed-off-by: Arthur Heymans Reviewed-on: https://review.coreboot.org/19607 Tested-by: build bot (Jenkins) Reviewed-by: Patrick Rudolph Reviewed-by: Nico Huber --- src/northbridge/intel/x4x/gma.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/northbridge/intel/x4x/gma.c b/src/northbridge/intel/x4x/gma.c index c2df07424e..f53320a040 100644 --- a/src/northbridge/intel/x4x/gma.c +++ b/src/northbridge/intel/x4x/gma.c @@ -356,7 +356,7 @@ static void native_init(struct device *dev) static void gma_func0_init(struct device *dev) { - u16 reg16; + u16 reg16, ggc; u32 reg32; /* IGD needs to be Bus Master */ @@ -370,10 +370,18 @@ static void gma_func0_init(struct device *dev) reg16 |= 0xbc; pci_write_config16(dev_find_slot(0, PCI_DEVFN(0x2, 0)), 0xcc, reg16); - if (IS_ENABLED(CONFIG_MAINBOARD_DO_NATIVE_VGA_INIT)) + ggc = pci_read_config16(dev_find_slot(0, PCI_DEVFN(0, 0)), D0F0_GGC); + + if (IS_ENABLED(CONFIG_MAINBOARD_DO_NATIVE_VGA_INIT)) { + if (ggc & (1 << 1)) { + printk(BIOS_DEBUG, "VGA cycles not assigned to IGD. " + "Not running native graphic init.\n"); + return; + } native_init(dev); - else + } else { pci_dev_init(dev); + } } static void gma_func0_disable(struct device *dev)