From 31ed8856f9c6f06b8594f80b4abc39952ee84247 Mon Sep 17 00:00:00 2001 From: Marc Jones Date: Fri, 15 Jan 2021 13:29:14 -0700 Subject: soc/intel/xeon_sp/acpi.c: Add ACPI C-State table Add the soc ACPI _CST table. The table may be customized to support the different state combinations and set by the mainboard config. Tested on deltalake with acpi_idle driver. Note, intel_idle may not use ACPI _CST table. Change-Id: I359daa9556edbe263ab0a7f1849c96c8fe1a0da0 Signed-off-by: Marc Jones Reviewed-on: https://review.coreboot.org/c/coreboot/+/49494 Tested-by: build bot (Jenkins) Reviewed-by: Angel Pons Reviewed-by: Jay Talbott --- src/soc/intel/xeon_sp/acpi.c | 80 ++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 78 insertions(+), 2 deletions(-) (limited to 'src/soc/intel/xeon_sp/acpi.c') diff --git a/src/soc/intel/xeon_sp/acpi.c b/src/soc/intel/xeon_sp/acpi.c index b271264b07..5e5267de8a 100644 --- a/src/soc/intel/xeon_sp/acpi.c +++ b/src/soc/intel/xeon_sp/acpi.c @@ -6,10 +6,86 @@ #include #include +#include "chip.h" + +/* + * List of supported C-states in this processor. + */ +enum { + C_STATE_C1, /* 0 */ + C_STATE_C3, /* 1 */ + C_STATE_C6, /* 2 */ + C_STATE_C7, /* 3 */ + NUM_C_STATES +}; + +static const acpi_cstate_t cstate_map[NUM_C_STATES] = { + [C_STATE_C1] = { + /* C1 */ + .latency = 1, + .power = 0x3e8, + .resource = MWAIT_RES(0, 0), + }, + [C_STATE_C3] = { + /* C3 */ + .latency = 15, + .power = 0x1f4, + .resource = MWAIT_RES(1, 0), + }, + [C_STATE_C6] = { + /* C6 */ + .latency = 41, + .power = 0x15e, + .resource = MWAIT_RES(2, 0), + }, + [C_STATE_C7] = { + /* C7 */ + .latency = 41, + .power = 0x0c8, + .resource = MWAIT_RES(3, 0), + } +}; + +/* Max states supported */ +static int cstate_set_all[] = { + C_STATE_C1, + C_STATE_C3, + C_STATE_C6, + C_STATE_C7 +}; + +static int cstate_set_c1_c6[] = { + C_STATE_C1, + C_STATE_C6, +}; + acpi_cstate_t *soc_get_cstate_map(size_t *entries) { - *entries = 0; - return NULL; + static acpi_cstate_t map[ARRAY_SIZE(cstate_set_all)]; + int *cstate_set; + int i; + + const config_t *config = config_of_soc(); + + const enum acpi_cstate_mode states = config->cstate_states; + + switch (states) { + case CSTATES_C1C6: + *entries = ARRAY_SIZE(cstate_set_c1_c6); + cstate_set = cstate_set_c1_c6; + break; + case CSTATES_ALL: + default: + *entries = ARRAY_SIZE(cstate_set_all); + cstate_set = cstate_set_all; + break; + } + + for (i = 0; i < *entries; i++) { + map[i] = cstate_map[cstate_set[i]]; + map[i].ctype = i + 1; + } + return map; } static void print_madt_ioapic(int socket, int stack, -- cgit v1.2.3