drv/intel/gma/opregion: fix opregion version for Windows

Although Intel's current spec[1] shows the OpRegion structure version 
as being the top 16 bits of the field, Intel's Windows drivers
require the OpRegion structure version to be in the top 8 bits of
the field when not using a VGA BIOS (eg, NGI or GOP driver).

As the Linux i915 driver only checks that the version is >= 2,
there is no change in functionality there.

This change effectively matches Intel's implementation in TianoCore,
where the version is set to 0x0200 << 16.

[1] https://01.org/sites/default/files/documentation/skl_opregion_rev0p5.pdf

TEST: Boot Windows [8.1,10] in UEFI mode w/GOP graphics init and
Legacy mode with libgfxinit, observe Intel GPU driver functional.

Change-Id: Ic2903ee4829689ec4117aec93dce0b87cec6f313
Signed-off-by: Matt DeVillier <matt.devillier@gmail.com>
Reviewed-on: https://review.coreboot.org/22118
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Nico Huber <nico.h@gmx.de>
diff --git a/src/drivers/intel/gma/opregion.c b/src/drivers/intel/gma/opregion.c
index 84bca9b..b6d4e07 100644
--- a/src/drivers/intel/gma/opregion.c
+++ b/src/drivers/intel/gma/opregion.c
@@ -260,7 +260,26 @@
 
 	/* 8kb */
 	opregion->header.size = sizeof(igd_opregion_t) / 1024;
-	opregion->header.version = IGD_OPREGION_VERSION;
+
+	/*
+	 * Left-shift version field to accomodate Intel Windows driver quirk
+	 * when not using a VBIOS.
+	 * Required for Legacy boot + NGI, UEFI + NGI, and UEFI + GOP driver.
+	 *
+	 * Tested on: (platform, GPU, windows driver version)
+	 * samsung/stumpy (SNB, GT2, 9.17.10.4459)
+	 * google/link (IVB, GT2, 15.33.4653)
+	 * google/wolf (HSW, GT1, 15.40.36.4703)
+	 * google/panther (HSW, GT2, 15.40.36.4703)
+	 * google/rikku (BDW, GT1, 15.40.36.4703)
+	 * google/lulu (BDW, GT2, 15.40.36.4703)
+	 * google/chell (SKL-Y, GT2, 15.45.21.4821)
+	 * google/sentry (SKL-U, GT1, 15.45.21.4821)
+	 * purism/librem13v2 (SKL-U, GT2, 15.45.21.4821)
+	 *
+	 * No adverse effects when using VBIOS or booting Linux.
+	 */
+	opregion->header.version = IGD_OPREGION_VERSION << 24;
 
 	// FIXME We just assume we're mobile for now
 	opregion->header.mailboxes = MAILBOXES_MOBILE;