[coreboot-gerrit] Change in coreboot[master]: drvs/intel/gma: Add common ACPI table generator

Patrick Rudolph (Code Review) gerrit at coreboot.org
Sat Apr 15 12:55:26 CEST 2017


Patrick Rudolph has uploaded a new change for review. ( https://review.coreboot.org/19316 )

Change subject: drvs/intel/gma: Add common ACPI table generator
......................................................................

drvs/intel/gma: Add common ACPI table generator

Add a common ACPI IGD table generator, that is to be
used on all platforms.

Change-Id: Icb244ef0c9c9dad390369210978ac8e6e1b5d829
Signed-off-by: Patrick Rudolph <siro at das-labor.org>
---
M src/drivers/intel/gma/acpi.c
M src/drivers/intel/gma/i915.h
2 files changed, 50 insertions(+), 0 deletions(-)


  git pull ssh://review.coreboot.org:29418/coreboot refs/changes/16/19316/1

diff --git a/src/drivers/intel/gma/acpi.c b/src/drivers/intel/gma/acpi.c
index c3a9b8a..82cb56c 100644
--- a/src/drivers/intel/gma/acpi.c
+++ b/src/drivers/intel/gma/acpi.c
@@ -6,7 +6,9 @@
 #include <arch/acpi.h>
 #include <arch/acpigen.h>
 #include <string.h>
+#include <device/pci.h>
 #include "i915.h"
+#include "opregion.h"
 
 void
 drivers_intel_gma_displays_ssdt_generate(const struct i915_gpu_controller_info *conf)
@@ -133,3 +135,46 @@
 
 	acpigen_pop_len();
 }
+
+unsigned long drivers_intel_gma_acpi_write_tables(device_t dev,
+		unsigned long current, struct acpi_rsdp *rsdp)
+{
+	igd_opregion_t *opregion;
+	uint16_t reg16;
+
+	printk(BIOS_DEBUG, "ACPI:    * IGD OpRegion\n");
+	opregion = (igd_opregion_t *)current;
+
+	if (!init_igd_opregion(opregion))
+		return current;
+
+	current += sizeof(igd_opregion_t);
+
+	/*
+	 * Required on all platforms.
+	 * Make sure to set it after S3 resume too,
+	 * as this code won't be called again.
+	 */
+	pci_write_config32(dev, ASLS, (uintptr_t)opregion);
+	reg16 = pci_read_config16(dev, SWSCI);
+	reg16 &= ~(1 << 0);
+	reg16 |= (1 << 15);
+	pci_write_config16(dev, SWSCI, reg16);
+
+	return acpi_align_current(current);
+}
+
+void drivers_intel_gma_acpi_setup_reg(device_t dev, u32 opregion)
+{
+	uint16_t reg16;
+
+	/*
+	 * Required on all platforms.
+	 * Make sure to set it after S3 resume, too !
+	 */
+	pci_write_config32(dev, ASLS, opregion);
+	reg16 = pci_read_config16(dev, SWSCI);
+	reg16 &= ~(1 << 0);
+	reg16 |= (1 << 15);
+	pci_write_config16(dev, SWSCI, reg16);
+}
diff --git a/src/drivers/intel/gma/i915.h b/src/drivers/intel/gma/i915.h
index 1b3c479..28da592 100644
--- a/src/drivers/intel/gma/i915.h
+++ b/src/drivers/intel/gma/i915.h
@@ -19,6 +19,7 @@
 #include <drivers/intel/gma/i915_reg.h>
 #include <drivers/intel/gma/drm_dp_helper.h>
 #include <commonlib/region.h>
+#include <arch/acpi.h>
 #include <edid.h>
 
 /* port types. We stick with the same defines as the kernel */
@@ -291,10 +292,14 @@
 	u32 did[5];
 };
 
+/* acpi.c */
 void
 drivers_intel_gma_displays_ssdt_generate(const struct i915_gpu_controller_info *conf);
 const struct i915_gpu_controller_info *
 intel_gma_get_controller_info(void);
+unsigned long drivers_intel_gma_acpi_write_tables(device_t dev,
+		unsigned long current, struct acpi_rsdp *rsdp);
+void drivers_intel_gma_acpi_setup_reg(device_t dev, u32 opregion);
 
 int i915lightup(unsigned int physbase, unsigned int mmio,
 		unsigned int gfx, unsigned int init_fb);

-- 
To view, visit https://review.coreboot.org/19316
To unsubscribe, visit https://review.coreboot.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Icb244ef0c9c9dad390369210978ac8e6e1b5d829
Gerrit-PatchSet: 1
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Owner: Patrick Rudolph <siro at das-labor.org>



More information about the coreboot-gerrit mailing list