diff options
author | Meera Ravindranath <meera.ravindranath@intel.com> | 2021-04-29 20:30:27 +0530 |
---|---|---|
committer | Patrick Georgi <pgeorgi@google.com> | 2021-07-17 13:48:00 +0000 |
commit | 1b8159b3a1783694e4f53050f805c73bf158ab99 (patch) | |
tree | 129be1523892801a2562bfd9f8f4170993d9eac5 | |
parent | 8d4e67da2046a5a6f55cd803c77b32d0c621cbc5 (diff) |
drivers/intel/gma: Support IGD Opregion 2.1
List of changes:
1. Define new configs for Opregion versions.
2. Assign RVDA to relative address of the Opregion buffer
in case of opregion 2.1+.
BUG=b:190019970
BRANCH=None
Signed-off-by: Meera Ravindranath <meera.ravindranath@intel.com>
Change-Id: I95a9f3df185002a4e38faa910f867ace0b97ac2b
Reviewed-on: https://review.coreboot.org/c/coreboot/+/52758
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Furquan Shaikh <furquan@google.com>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
-rw-r--r-- | src/drivers/intel/gma/Kconfig | 9 | ||||
-rw-r--r-- | src/drivers/intel/gma/opregion.c | 31 | ||||
-rw-r--r-- | src/drivers/intel/gma/opregion.h | 3 |
3 files changed, 37 insertions, 6 deletions
diff --git a/src/drivers/intel/gma/Kconfig b/src/drivers/intel/gma/Kconfig index 56afedfcc8..87f6d125d2 100644 --- a/src/drivers/intel/gma/Kconfig +++ b/src/drivers/intel/gma/Kconfig @@ -102,6 +102,15 @@ config GFX_GMA_PANEL_1_ON_LVDS default y if NORTHBRIDGE_INTEL_GM45 || NORTHBRIDGE_INTEL_IRONLAKE default n +config INTEL_GMA_OPREGION_2_0 + bool + default n if INTEL_GMA_OPREGION_2_1 + default y + +config INTEL_GMA_OPREGION_2_1 + bool + default n + 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 13850923eb..430bda35b1 100644 --- a/src/drivers/intel/gma/opregion.c +++ b/src/drivers/intel/gma/opregion.c @@ -258,6 +258,9 @@ static enum cb_err find_vbt_location(struct region_device *rdev) /* 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 }; } @@ -271,6 +274,15 @@ static inline bool is_ext_vbt_required(igd_opregion_t *opregion, optionrom_vbt_t return (vbt->hdr_vbt_size > sizeof(opregion->vbt.gvd1)); } +/* Function to determine if the VBT uses a relative address */ +static inline bool uses_relative_vbt_addr(opregion_header_t *header) +{ + if (header->opver.major > 2) + return true; + + return header->opver.major >= 2 && header->opver.minor >= 1; +} + /* * Copy extended VBT at the end of opregion and fill rvda and rvds * values correctly for the opregion. @@ -278,11 +290,19 @@ static inline bool is_ext_vbt_required(igd_opregion_t *opregion, optionrom_vbt_t static void opregion_add_ext_vbt(igd_opregion_t *opregion, uint8_t *ext_vbt, optionrom_vbt_t *vbt) { + + opregion_header_t *header = &opregion->header; /* Copy VBT into extended VBT region (at offset 8 KiB) */ memcpy(ext_vbt, vbt, vbt->hdr_vbt_size); - /* Fill RVDA value with address of physical pointer */ - opregion->mailbox3.rvda = (uintptr_t)ext_vbt; + /* Fill RVDA value with relative address of the opregion buffer in case of + IGD Opregion version 2.1+ and physical address otherwise */ + + if (uses_relative_vbt_addr(header)) + opregion->mailbox3.rvda = sizeof(*opregion); + else + opregion->mailbox3.rvda = (uintptr_t)ext_vbt; + opregion->mailbox3.rvds = vbt->hdr_vbt_size; } @@ -327,6 +347,10 @@ enum cb_err intel_gma_init_igd_opregion(void) sizeof(opregion->header.signature)); memcpy(opregion->header.vbios_version, vbt->coreblock_biosbuild, ARRAY_SIZE(vbt->coreblock_biosbuild)); + + /* Get the opregion version information */ + opregion->header.opver = opregion_get_version(); + /* Extended VBT support */ if (is_ext_vbt_required(opregion, vbt)) { /* Place extended VBT just after opregion */ @@ -339,9 +363,6 @@ 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; diff --git a/src/drivers/intel/gma/opregion.h b/src/drivers/intel/gma/opregion.h index e363921d66..1dd177c2db 100644 --- a/src/drivers/intel/gma/opregion.h +++ b/src/drivers/intel/gma/opregion.h @@ -147,7 +147,8 @@ typedef struct { u32 fdss; /* Offset 178 FFS Display Size */ u32 stat; /* Offset 182 State Indicator */ u64 rvda; /* Offset 186 (Igd opregion offset 0x3BAh) - * Physical address of Raw VBT data + * Physical(2.0) or relative opregion + * (2.1+) address of Raw VBT data */ u32 rvds; /* Offset 194 (Igd opregion offset 0x3C2h) * Size of Raw VBT data |