aboutsummaryrefslogtreecommitdiff
path: root/src/soc/intel/xeon_sp/acpi.c
diff options
context:
space:
mode:
authorMarc Jones <marcjones@sysproconsulting.com>2021-01-15 13:29:14 -0700
committerPatrick Georgi <pgeorgi@google.com>2021-01-26 10:34:56 +0000
commit31ed8856f9c6f06b8594f80b4abc39952ee84247 (patch)
tree90404fbd39f6a6c452854d5b5b5c839bb487e677 /src/soc/intel/xeon_sp/acpi.c
parent08de06ad6dc5530c23eced8363b15f5324ec41b1 (diff)
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 <marcjones@sysproconsulting.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/49494 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Angel Pons <th3fanbus@gmail.com> Reviewed-by: Jay Talbott <JayTalbott@sysproconsulting.com>
Diffstat (limited to 'src/soc/intel/xeon_sp/acpi.c')
-rw-r--r--src/soc/intel/xeon_sp/acpi.c80
1 files changed, 78 insertions, 2 deletions
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 <soc/util.h>
#include <string.h>
+#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,