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 <arthur@aheymans.xyz>
Reviewed-on: https://review.coreboot.org/19607
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Patrick Rudolph <siro@das-labor.org>
Reviewed-by: Nico Huber <nico.h@gmx.de>
diff --git a/src/northbridge/intel/x4x/gma.c b/src/northbridge/intel/x4x/gma.c
index c2df074..f53320a 100644
--- a/src/northbridge/intel/x4x/gma.c
+++ b/src/northbridge/intel/x4x/gma.c
@@ -356,7 +356,7 @@
 
 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 @@
 	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)