Subrata Banik has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/56303 )
Change subject: drivers/intel/gma: Refactor IGD opregion 2.1 support code ......................................................................
drivers/intel/gma: Refactor IGD opregion 2.1 support code
This patch ensures SoC users to select supported IGD opregion specification Kconfig example: INTEL_GMA_OPREGION_2_1 and GMA driver code would be able to detect the opregion version.
The opregion version can be used to uniquely identify the spec and fill the required filled as RVDA for opregion 2.1 spec differently compared to previous version.
Also, drop the opregion_get_version() function as CONFIG_OPREGION_VERSION is enough to assign the opregion version into the header structure.
Expectauon from user to add new Kconfig as OPREGION_X_x_VERSION (X: Major and x: Minor version) and specify the opregion structure version as spec demands as Bits[31:24] for Major Version, Bits[23:16] for Minor version, Bits[15:8] for Revision and Bits[7:0] Reserved. For example: Opregion 2.1 specificatin would use Kconfig as below:
config OPREGION_2_1_VERSION hex default 0x02010000
TEST=Able to verify OPREGION_VERSION Kconfig default is changing as per SoC selects of opregion Kconfig.
Change-Id: I2ba7b64473781ac67c8958241bf5149fe0c009ba Signed-off-by: Subrata Banik subrata.banik@intel.com --- M src/drivers/intel/gma/Kconfig M src/drivers/intel/gma/opregion.c M src/drivers/intel/gma/opregion.h 3 files changed, 33 insertions(+), 18 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/03/56303/1
diff --git a/src/drivers/intel/gma/Kconfig b/src/drivers/intel/gma/Kconfig index 87f6d12..9857561 100644 --- a/src/drivers/intel/gma/Kconfig +++ b/src/drivers/intel/gma/Kconfig @@ -111,6 +111,25 @@ bool default n
+config OPREGION_2_0_VERSION + hex + default 0x02000000 + +config OPREGION_2_1_VERSION + hex + default 0x02010000 + +config OPREGION_VERSION + hex + default OPREGION_2_1_VERSION if INTEL_GMA_OPREGION_2_1 + default OPREGION_2_0_VERSION + help + Opregion Structure Version can be decoded as Bits[31:24] for + Major Version, Bits[23:16] for Minor version, Bits[15:8] for + Revision and Bits[7:0] are Reserved. For example: 0x02010000 + can be read as Major Version as 2, Minor Version as 1 and + Revision as 0. + if GFX_GMA
config GFX_GMA_DYN_CPU diff --git a/src/drivers/intel/gma/opregion.c b/src/drivers/intel/gma/opregion.c index f675987..6d0ffe9 100644 --- a/src/drivers/intel/gma/opregion.c +++ b/src/drivers/intel/gma/opregion.c @@ -255,15 +255,6 @@ return CB_ERR; }
-/* Function to get the IGD Opregion version */ -static struct opregion_version opregion_get_version(void) -{ - if (CONFIG(INTEL_GMA_OPREGION_2_1)) - return (struct opregion_version) { .major = 2, .minor = 1 }; - - 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 @@ -277,8 +268,10 @@ /* Function to determine if the VBT uses a relative address */ static inline bool uses_relative_vbt_addr(opregion_header_t *header) { - return (header->opver.major >= 2 && header->opver.minor >= 1) || - (header->opver.major > 2); + if (header->opver.version >= CONFIG_OPREGION_2_1_VERSION) + return true; + + return false; }
/* @@ -347,7 +340,7 @@ ARRAY_SIZE(vbt->coreblock_biosbuild));
/* Get the opregion version information */ - opregion->header.opver = opregion_get_version(); + opregion->header.opver.version = CONFIG_OPREGION_VERSION;
/* Extended VBT support */ if (is_ext_vbt_required(opregion, vbt)) { diff --git a/src/drivers/intel/gma/opregion.h b/src/drivers/intel/gma/opregion.h index 1dd177c..4debe2c 100644 --- a/src/drivers/intel/gma/opregion.h +++ b/src/drivers/intel/gma/opregion.h @@ -17,12 +17,15 @@ typedef struct { u8 signature[16]; /* Offset 0 OpRegion signature */ u32 size; /* Offset 16 OpRegion size */ - struct opregion_version { - u8 rsvd; - u8 revision; - u8 minor; - u8 major; - } opver; /* Offset 20 OpRegion version structure */ + union opreg_version { + u32 version; + struct opregion_version { + u8 rsvd; + u8 revision; + u8 minor; + u8 major; + } fields; + } 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 */