summaryrefslogtreecommitdiff
path: root/src/soc/intel/broadwell/pch/acpi.c
diff options
context:
space:
mode:
authorAngel Pons <th3fanbus@gmail.com>2021-04-19 22:38:55 +0200
committerAngel Pons <th3fanbus@gmail.com>2021-06-14 09:59:52 +0000
commit34bd6ba97917b0bc54bb1f1e106a56b5c03e19ac (patch)
treeee709d4ee9a572c4826eb50405262387c0f8a02d /src/soc/intel/broadwell/pch/acpi.c
parent68d8357dab55660058ad1ab8dca34fd03e0adbb5 (diff)
soc/intel/broadwell/pch: Drop device NVS remainders
Now that device NVS is no longer used as such, stop using it to store ACPI device settings consumed by the SSDT generator. Instead, provide the get_acpi_device_state() function to allow saving ACPI device BARs and activation state from other compilation units. Also, introduce an enum and a struct to ease handling device state. Tested on out-of-tree Compal LA-A992P, SerialIO SSDT does not change. Change-Id: I9e70bf71e808651cb504399dcee489a4d1a70e67 Signed-off-by: Angel Pons <th3fanbus@gmail.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/52521 Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'src/soc/intel/broadwell/pch/acpi.c')
-rw-r--r--src/soc/intel/broadwell/pch/acpi.c42
1 files changed, 24 insertions, 18 deletions
diff --git a/src/soc/intel/broadwell/pch/acpi.c b/src/soc/intel/broadwell/pch/acpi.c
index 85726b06e4..8c435d6f47 100644
--- a/src/soc/intel/broadwell/pch/acpi.c
+++ b/src/soc/intel/broadwell/pch/acpi.c
@@ -1,9 +1,8 @@
/* SPDX-License-Identifier: GPL-2.0-only */
#include <acpi/acpi.h>
-#include <acpi/acpi_gnvs.h>
#include <acpi/acpigen.h>
-#include <soc/device_nvs.h>
+#include <assert.h>
#include <soc/pch.h>
#include <types.h>
#include <version.h>
@@ -55,25 +54,32 @@ static void acpi_write_serialio_psx_methods(const char *const name, const uint32
acpigen_pop_len();
}
-static void acpi_create_serialio_ssdt_entry(int sio_index, struct device_nvs *dev_nvs)
+static struct pch_acpi_device_state device_state[NUM_PCH_ACPI_DEVICES] = { 0 };
+
+struct pch_acpi_device_state *get_acpi_device_state(enum pch_acpi_device dev_index)
{
- const char idx = '0' + sio_index;
+ assert(dev_index < ARRAY_SIZE(device_state));
+ return &device_state[dev_index];
+}
+
+static void acpi_create_serialio_ssdt_entry(enum pch_acpi_device dev_index)
+{
+ const struct pch_acpi_device_state *state = get_acpi_device_state(dev_index);
+
+ const char idx = '0' + dev_index;
const char sxen[5] = { 'S', idx, 'E', 'N', '\0' };
- acpigen_write_name_byte(sxen, dev_nvs->enable[sio_index]);
+ acpigen_write_name_byte(sxen, state->enable);
const char sxb0[5] = { 'S', idx, 'B', '0', '\0' };
- acpigen_write_name_dword(sxb0, dev_nvs->bar0[sio_index]);
+ acpigen_write_name_dword(sxb0, state->bar0);
const char sxb1[5] = { 'S', idx, 'B', '1', '\0' };
- acpigen_write_name_dword(sxb1, dev_nvs->bar1[sio_index]);
+ acpigen_write_name_dword(sxb1, state->bar1);
}
void acpi_create_serialio_ssdt(acpi_header_t *ssdt)
{
unsigned long current = (unsigned long)ssdt + sizeof(acpi_header_t);
- struct device_nvs *dev_nvs = acpi_get_device_nvs();
- if (!dev_nvs)
- return;
/* Fill the SSDT header */
memset((void *)ssdt, 0, sizeof(acpi_header_t));
@@ -88,17 +94,17 @@ void acpi_create_serialio_ssdt(acpi_header_t *ssdt)
acpigen_set_current((char *)current);
/* Fill the SSDT with an entry for each SerialIO device */
- for (int id = 0; id < 9; id++)
- acpi_create_serialio_ssdt_entry(id, dev_nvs);
+ for (enum pch_acpi_device dev_index = 0; dev_index < NUM_PCH_ACPI_DEVICES; dev_index++)
+ acpi_create_serialio_ssdt_entry(dev_index);
acpigen_write_scope("\\_SB.PCI0");
{
- acpi_write_serialio_psx_methods("I2C0", dev_nvs->bar1[SIO_NVS_I2C0]);
- acpi_write_serialio_psx_methods("I2C1", dev_nvs->bar1[SIO_NVS_I2C1]);
- acpi_write_serialio_psx_methods("SPI0", dev_nvs->bar1[SIO_NVS_SPI0]);
- acpi_write_serialio_psx_methods("SPI1", dev_nvs->bar1[SIO_NVS_SPI1]);
- acpi_write_serialio_psx_methods("UAR0", dev_nvs->bar1[SIO_NVS_UART0]);
- acpi_write_serialio_psx_methods("UAR1", dev_nvs->bar1[SIO_NVS_UART1]);
+ acpi_write_serialio_psx_methods("I2C0", device_state[PCH_ACPI_I2C0].bar1);
+ acpi_write_serialio_psx_methods("I2C1", device_state[PCH_ACPI_I2C1].bar1);
+ acpi_write_serialio_psx_methods("SPI0", device_state[PCH_ACPI_GSPI0].bar1);
+ acpi_write_serialio_psx_methods("SPI1", device_state[PCH_ACPI_GSPI1].bar1);
+ acpi_write_serialio_psx_methods("UAR0", device_state[PCH_ACPI_UART0].bar1);
+ acpi_write_serialio_psx_methods("UAR1", device_state[PCH_ACPI_UART1].bar1);
}
acpigen_pop_len();