drivers/intel/gma: Restructure Opregion version info code

Define a structure for opregion version information to align
with spec/kernel.

BUG=b:190019970
BRANCH=None

Signed-off-by: Meera Ravindranath <meera.ravindranath@intel.com>
Change-Id: I93a9f2df186002a4e38caa910f867bce0b97ac2b
Reviewed-on: https://review.coreboot.org/c/coreboot/+/56168
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Furquan Shaikh <furquan@google.com>
Reviewed-by: Maulik V Vaghela <maulik.v.vaghela@intel.com>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
This commit is contained in:
Meera Ravindranath 2021-07-09 12:40:28 +05:30 committed by Patrick Georgi
parent 7d3e57d7a3
commit 92637df79a
2 changed files with 15 additions and 22 deletions

View File

@ -255,6 +255,12 @@ static enum cb_err find_vbt_location(struct region_device *rdev)
return CB_ERR;
}
/* Function to get the IGD Opregion version */
static struct opregion_version opregion_get_version(void)
{
return (struct opregion_version) { .major = 2, .minor = 0 };
}
/*
* Function to determine if we need to use extended VBT region to pass
* VBT pointer. If VBT size > 6 KiB then we need to use extended VBT
@ -333,29 +339,12 @@ enum cb_err intel_gma_init_igd_opregion(void)
rdev_munmap(&rdev, vbt);
/* Get the opregion version information */
opregion->header.opver = opregion_get_version();
/* 8kb */
opregion->header.size = sizeof(igd_opregion_t) / 1024;
/*
* Left-shift version field to accommodate 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;

View File

@ -17,7 +17,12 @@
typedef struct {
u8 signature[16]; /* Offset 0 OpRegion signature */
u32 size; /* Offset 16 OpRegion size */
u32 version; /* Offset 20 OpRegion structure version */
struct opregion_version {
u8 rsvd;
u8 revision;
u8 minor;
u8 major;
} opver; /* Offset 20 OpRegion version structure */
u8 sbios_version[32]; /* Offset 24 System BIOS build version */
u8 vbios_version[16]; /* Offset 56 Video BIOS build version */
u8 driver_version[16]; /* Offset 72 Graphic drvr build version */
@ -29,7 +34,6 @@ typedef struct {
} __packed opregion_header_t;
#define IGD_OPREGION_SIGNATURE "IntelGraphicsMem"
#define IGD_OPREGION_VERSION 2
#define IGD_MBOX1 (1 << 0)
#define IGD_MBOX2 (1 << 1)