summaryrefslogtreecommitdiff
path: root/src/drivers/intel/gma
diff options
context:
space:
mode:
Diffstat (limited to 'src/drivers/intel/gma')
-rw-r--r--src/drivers/intel/gma/opregion.c32
-rw-r--r--src/drivers/intel/gma/opregion.h6
2 files changed, 21 insertions, 17 deletions
diff --git a/src/drivers/intel/gma/opregion.c b/src/drivers/intel/gma/opregion.c
index 566f35101d..7682af199b 100644
--- a/src/drivers/intel/gma/opregion.c
+++ b/src/drivers/intel/gma/opregion.c
@@ -57,7 +57,7 @@ void *locate_vbt(size_t *vbt_size)
}
/* Write ASLS PCI register and prepare SWSCI register. */
-void intel_gma_opregion_register(uintptr_t opregion)
+static void intel_gma_opregion_register(uintptr_t opregion)
{
struct device *igd;
u16 reg16;
@@ -94,17 +94,16 @@ void intel_gma_opregion_register(uintptr_t opregion)
}
/* Restore ASLS register on S3 resume and prepare SWSCI. */
-void intel_gma_restore_opregion(void)
+static enum cb_err intel_gma_restore_opregion(void)
{
- if (acpi_is_wakeup_s3()) {
- const void *const gnvs = cbmem_find(CBMEM_ID_ACPI_GNVS);
- uintptr_t aslb;
-
- if (gnvs && (aslb = gma_get_gnvs_aslb(gnvs)))
- intel_gma_opregion_register(aslb);
- else
- printk(BIOS_ERR, "Error: GNVS or ASLB not set.\n");
+ const igd_opregion_t *const opregion = cbmem_find(CBMEM_ID_IGD_OPREGION);
+ if (!opregion) {
+ printk(BIOS_ERR, "GMA: Failed to find IGD OpRegion.\n");
+ return CB_ERR;
}
+ /* Write ASLS PCI register and prepare SWSCI register. */
+ intel_gma_opregion_register((uintptr_t)opregion);
+ return CB_SUCCESS;
}
static enum cb_err vbt_validate(struct region_device *rdev)
@@ -224,14 +223,17 @@ static enum cb_err locate_vbt_vbios_cbfs(struct region_device *rdev)
}
/* Initialize IGD OpRegion, called from ACPI code and OS drivers */
-enum cb_err
-intel_gma_init_igd_opregion(igd_opregion_t *opregion)
+enum cb_err intel_gma_init_igd_opregion(void)
{
+ igd_opregion_t *opregion;
struct region_device rdev;
optionrom_vbt_t *vbt = NULL;
optionrom_vbt_t *ext_vbt;
bool found = false;
+ if (acpi_is_wakeup_s3())
+ return intel_gma_restore_opregion();
+
/* Search for vbt.bin in CBFS. */
if (locate_vbt_cbfs(&rdev) == CB_SUCCESS &&
vbt_validate(&rdev) == CB_SUCCESS) {
@@ -273,6 +275,12 @@ intel_gma_init_igd_opregion(igd_opregion_t *opregion)
return CB_ERR;
}
+ opregion = cbmem_add(CBMEM_ID_IGD_OPREGION, sizeof(*opregion));
+ if (!opregion) {
+ printk(BIOS_ERR, "GMA: Failed to add IGD OpRegion to CBMEM.\n");
+ return CB_ERR;
+ }
+
memset(opregion, 0, sizeof(igd_opregion_t));
memcpy(&opregion->header.signature, IGD_OPREGION_SIGNATURE,
diff --git a/src/drivers/intel/gma/opregion.h b/src/drivers/intel/gma/opregion.h
index 079d08fa4e..879017b6a2 100644
--- a/src/drivers/intel/gma/opregion.h
+++ b/src/drivers/intel/gma/opregion.h
@@ -231,11 +231,7 @@ typedef struct {
u8 coreblock_biossignon[155];
} __packed optionrom_vbt_t;
-void intel_gma_opregion_register(uintptr_t opregion);
-void intel_gma_restore_opregion(void);
-uintptr_t gma_get_gnvs_aslb(const void *gnvs);
-void gma_set_gnvs_aslb(void *gnvs, uintptr_t aslb);
-enum cb_err intel_gma_init_igd_opregion(igd_opregion_t *opregion);
+enum cb_err intel_gma_init_igd_opregion(void);
/*
* Returns the CBFS filename of the VBT blob.