From e9f10ff38bf95000115d7c0a45cb0e6323cc61c8 Mon Sep 17 00:00:00 2001 From: Angel Pons Date: Sun, 17 Oct 2021 13:28:23 +0200 Subject: [PATCH] soc/intel: Constify `soc_get_cstate_map()` Return a read-only pointer from the `soc_get_cstate_map()` function. Also, constify the actual data where applicable. Change-Id: I7d46f1e373971c789eaf1eb582e9aa2d3f661785 Signed-off-by: Angel Pons Reviewed-on: https://review.coreboot.org/c/coreboot/+/58392 Tested-by: build bot (Jenkins) Reviewed-by: Raul Rangel --- src/soc/intel/alderlake/acpi.c | 2 +- src/soc/intel/apollolake/acpi.c | 4 ++-- src/soc/intel/cannonlake/acpi.c | 2 +- src/soc/intel/common/block/acpi/acpi.c | 2 +- src/soc/intel/common/block/include/intelblocks/acpi.h | 2 +- src/soc/intel/denverton_ns/acpi.c | 4 ++-- src/soc/intel/elkhartlake/acpi.c | 2 +- src/soc/intel/icelake/acpi.c | 2 +- src/soc/intel/jasperlake/acpi.c | 2 +- src/soc/intel/tigerlake/acpi.c | 2 +- src/soc/intel/xeon_sp/acpi.c | 2 +- 11 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/soc/intel/alderlake/acpi.c b/src/soc/intel/alderlake/acpi.c index 075b4d6623..ab25646f87 100644 --- a/src/soc/intel/alderlake/acpi.c +++ b/src/soc/intel/alderlake/acpi.c @@ -111,7 +111,7 @@ static int cstate_set_s0ix[] = { C_STATE_C10 }; -acpi_cstate_t *soc_get_cstate_map(size_t *entries) +const acpi_cstate_t *soc_get_cstate_map(size_t *entries) { static acpi_cstate_t map[MAX(ARRAY_SIZE(cstate_set_s0ix), ARRAY_SIZE(cstate_set_non_s0ix))]; diff --git a/src/soc/intel/apollolake/acpi.c b/src/soc/intel/apollolake/acpi.c index 8f5dd12459..6e3bde4bb9 100644 --- a/src/soc/intel/apollolake/acpi.c +++ b/src/soc/intel/apollolake/acpi.c @@ -30,7 +30,7 @@ .addrl = address, \ } -static acpi_cstate_t cstate_map[] = { +static const acpi_cstate_t cstate_map[] = { { /* C1 */ .ctype = 1, /* ACPI C1 */ @@ -62,7 +62,7 @@ void soc_write_sci_irq_select(uint32_t scis) write32p(soc_read_pmc_base() + IRQ_REG, scis); } -acpi_cstate_t *soc_get_cstate_map(size_t *entries) +const acpi_cstate_t *soc_get_cstate_map(size_t *entries) { *entries = ARRAY_SIZE(cstate_map); return cstate_map; diff --git a/src/soc/intel/cannonlake/acpi.c b/src/soc/intel/cannonlake/acpi.c index 5e2d1425d3..fa84ea8ef4 100644 --- a/src/soc/intel/cannonlake/acpi.c +++ b/src/soc/intel/cannonlake/acpi.c @@ -111,7 +111,7 @@ static int cstate_set_s0ix[] = { C_STATE_C10 }; -acpi_cstate_t *soc_get_cstate_map(size_t *entries) +const acpi_cstate_t *soc_get_cstate_map(size_t *entries) { static acpi_cstate_t map[MAX(ARRAY_SIZE(cstate_set_s0ix), ARRAY_SIZE(cstate_set_non_s0ix))]; diff --git a/src/soc/intel/common/block/acpi/acpi.c b/src/soc/intel/common/block/acpi/acpi.c index f144a6d5fa..af7212e70e 100644 --- a/src/soc/intel/common/block/acpi/acpi.c +++ b/src/soc/intel/common/block/acpi/acpi.c @@ -248,7 +248,7 @@ int common_calculate_power_ratio(int tdp, int p1_ratio, int ratio) static void generate_c_state_entries(void) { - acpi_cstate_t *c_state_map; + const acpi_cstate_t *c_state_map; size_t entries; c_state_map = soc_get_cstate_map(&entries); diff --git a/src/soc/intel/common/block/include/intelblocks/acpi.h b/src/soc/intel/common/block/include/intelblocks/acpi.h index 5497275d23..02a9da58cf 100644 --- a/src/soc/intel/common/block/include/intelblocks/acpi.h +++ b/src/soc/intel/common/block/include/intelblocks/acpi.h @@ -38,7 +38,7 @@ void soc_write_sci_irq_select(uint32_t scis); * get_cstate_map returns a table of processor specific acpi_cstate_t entries * and number of entries in the table */ -acpi_cstate_t *soc_get_cstate_map(size_t *num_entries); +const acpi_cstate_t *soc_get_cstate_map(size_t *num_entries); /* * get_tstate_map returns a table of processor specific acpi_tstate_t entries diff --git a/src/soc/intel/denverton_ns/acpi.c b/src/soc/intel/denverton_ns/acpi.c index b8b793e4df..82b8cf111f 100644 --- a/src/soc/intel/denverton_ns/acpi.c +++ b/src/soc/intel/denverton_ns/acpi.c @@ -27,7 +27,7 @@ .addrl = address, \ } -static acpi_cstate_t cstate_map[] = { +static const acpi_cstate_t cstate_map[] = { { /* C1 */ .ctype = 1, /* ACPI C1 */ @@ -75,7 +75,7 @@ uint32_t soc_read_sci_irq_select(void) return pci_read_config32(dev, PMC_ACPI_CNT); } -acpi_cstate_t *soc_get_cstate_map(size_t *entries) +const acpi_cstate_t *soc_get_cstate_map(size_t *entries) { *entries = ARRAY_SIZE(cstate_map); return cstate_map; diff --git a/src/soc/intel/elkhartlake/acpi.c b/src/soc/intel/elkhartlake/acpi.c index e44a5d4eba..44387ea3f4 100644 --- a/src/soc/intel/elkhartlake/acpi.c +++ b/src/soc/intel/elkhartlake/acpi.c @@ -110,7 +110,7 @@ static int cstate_set_s0ix[] = { C_STATE_C10 }; -acpi_cstate_t *soc_get_cstate_map(size_t *entries) +const acpi_cstate_t *soc_get_cstate_map(size_t *entries) { static acpi_cstate_t map[MAX(ARRAY_SIZE(cstate_set_s0ix), ARRAY_SIZE(cstate_set_non_s0ix))]; diff --git a/src/soc/intel/icelake/acpi.c b/src/soc/intel/icelake/acpi.c index f822e8323b..d11f3ca8ff 100644 --- a/src/soc/intel/icelake/acpi.c +++ b/src/soc/intel/icelake/acpi.c @@ -107,7 +107,7 @@ static int cstate_set_s0ix[] = { C_STATE_C10 }; -acpi_cstate_t *soc_get_cstate_map(size_t *entries) +const acpi_cstate_t *soc_get_cstate_map(size_t *entries) { static acpi_cstate_t map[MAX(ARRAY_SIZE(cstate_set_s0ix), ARRAY_SIZE(cstate_set_non_s0ix))]; diff --git a/src/soc/intel/jasperlake/acpi.c b/src/soc/intel/jasperlake/acpi.c index 28ed1f1970..ad6a79cba6 100644 --- a/src/soc/intel/jasperlake/acpi.c +++ b/src/soc/intel/jasperlake/acpi.c @@ -110,7 +110,7 @@ static int cstate_set_s0ix[] = { C_STATE_C10 }; -acpi_cstate_t *soc_get_cstate_map(size_t *entries) +const acpi_cstate_t *soc_get_cstate_map(size_t *entries) { static acpi_cstate_t map[MAX(ARRAY_SIZE(cstate_set_s0ix), ARRAY_SIZE(cstate_set_non_s0ix))]; diff --git a/src/soc/intel/tigerlake/acpi.c b/src/soc/intel/tigerlake/acpi.c index bf03269344..36fb679749 100644 --- a/src/soc/intel/tigerlake/acpi.c +++ b/src/soc/intel/tigerlake/acpi.c @@ -110,7 +110,7 @@ static int cstate_set_s0ix[] = { C_STATE_C10 }; -acpi_cstate_t *soc_get_cstate_map(size_t *entries) +const acpi_cstate_t *soc_get_cstate_map(size_t *entries) { static acpi_cstate_t map[MAX(ARRAY_SIZE(cstate_set_s0ix), ARRAY_SIZE(cstate_set_non_s0ix))]; diff --git a/src/soc/intel/xeon_sp/acpi.c b/src/soc/intel/xeon_sp/acpi.c index 9da1b14595..de9db88bad 100644 --- a/src/soc/intel/xeon_sp/acpi.c +++ b/src/soc/intel/xeon_sp/acpi.c @@ -58,7 +58,7 @@ static int cstate_set_c1_c6[] = { C_STATE_C6, }; -acpi_cstate_t *soc_get_cstate_map(size_t *entries) +const acpi_cstate_t *soc_get_cstate_map(size_t *entries) { static acpi_cstate_t map[ARRAY_SIZE(cstate_set_all)]; int *cstate_set;