From 92637df79ab14cca151af00b8ab2de4dd9a98a68 Mon Sep 17 00:00:00 2001 From: Meera Ravindranath Date: Fri, 9 Jul 2021 12:40:28 +0530 Subject: [PATCH] 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 Change-Id: I93a9f2df186002a4e38caa910f867bce0b97ac2b Reviewed-on: https://review.coreboot.org/c/coreboot/+/56168 Tested-by: build bot (Jenkins) Reviewed-by: Furquan Shaikh Reviewed-by: Maulik V Vaghela Reviewed-by: Angel Pons --- src/drivers/intel/gma/opregion.c | 29 +++++++++-------------------- src/drivers/intel/gma/opregion.h | 8 ++++++-- 2 files changed, 15 insertions(+), 22 deletions(-) diff --git a/src/drivers/intel/gma/opregion.c b/src/drivers/intel/gma/opregion.c index 799c7fdfaf..13850923eb 100644 --- a/src/drivers/intel/gma/opregion.c +++ b/src/drivers/intel/gma/opregion.c @@ -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; diff --git a/src/drivers/intel/gma/opregion.h b/src/drivers/intel/gma/opregion.h index 879017b6a2..e363921d66 100644 --- a/src/drivers/intel/gma/opregion.h +++ b/src/drivers/intel/gma/opregion.h @@ -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)