x86: Add initial video device init for Intel GMA

Intel's Graphics Media Accelerator (GMA) is a generic name for a wide range
of video devices. Add code to set up the hardware on ivybridge. Part of the
init happens in native code, part of it happens in a 16-bit option ROM for
those nostalgic for the 1970s.

Signed-off-by: Simon Glass <sjg@chromium.org>
diff --git a/arch/x86/cpu/ivybridge/bd82x6x.c b/arch/x86/cpu/ivybridge/bd82x6x.c
index 739f979..65a17d3 100644
--- a/arch/x86/cpu/ivybridge/bd82x6x.c
+++ b/arch/x86/cpu/ivybridge/bd82x6x.c
@@ -91,7 +91,8 @@
 	const void *blob = gd->fdt_blob;
 	struct pci_controller *hose;
 	struct x86_cpu_priv *cpu;
-	int sata_node;
+	int sata_node, gma_node;
+	int ret;
 
 	hose = pci_bus_to_hose(0);
 	lpc_enable(PCH_LPC_DEV);
@@ -111,6 +112,16 @@
 		return -ENOMEM;
 	model_206ax_init(cpu);
 
+	gma_node = fdtdec_next_compatible(blob, 0, COMPAT_INTEL_GMA);
+	if (gma_node < 0) {
+		debug("%s: Cannot find GMA node\n", __func__);
+		return -EINVAL;
+	}
+	ret = gma_func0_init(PCH_VIDEO_DEV, pci_bus_to_hose(0), blob,
+			     gma_node);
+	if (ret)
+		return ret;
+
 	return 0;
 }