soc/intel: Allow zero values for PMC GPE0 DW registers

The `pmc_gpe0_different_values` function previously asserted if any
two of the GPE0 DW registers (DW0, DW1, DW2) had the same value, as
introduced in commit 640a41f3ee ("soc/intel: Assert if
`pmc_/gpe0_dwX` values are not unique"). This prevented platforms from
configuring GPE routing via PMC as per default register (MISCCFG) value.

This commit modifies the check to allow all DW registers to be zero.
This enables platforms that rely on MISCCFG register for
PMC-controlled GPE routing to boot without triggering the assertion.

The change was verified by testing the following scenarios:

- All DWs zero: The system boots using the default GPE route.
    No assertion occurs.
- Duplicate DWs (e.g., DW0=1, DW1=2, DW2=2): The existing assertion
    is triggered as expected.
- Unique DWs (e.g., DW0=1, DW1=2, DW2=3): No errors occur.

TEST=Built and booted normally. No assertion failure observed.

Change-Id: Ie66d6dbcf49d5400b3fc3e4da113a569fe52dd51
Signed-off-by: Subrata Banik <subratabanik@google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/86164
Reviewed-by: Jérémy Compostella <jeremy.compostella@intel.com>
Reviewed-by: Matt DeVillier <matt.devillier@gmail.com>
Reviewed-by: Dinesh Gehlot <digehlot@google.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
Subrata Banik 2025-01-27 06:31:19 +00:00 committed by Sean Rhodes
commit bfb0475386
9 changed files with 63 additions and 18 deletions

View file

@ -156,11 +156,16 @@ uint32_t *soc_pmc_etr_addr(void)
static void pmc_gpe0_different_values(const struct soc_intel_alderlake_config *config)
{
bool result = (config->pmc_gpe0_dw0 != config->pmc_gpe0_dw1) &&
bool all_zero = (config->pmc_gpe0_dw0 == 0) &&
(config->pmc_gpe0_dw1 == 0) &&
(config->pmc_gpe0_dw2 == 0);
/* Check if all values are different AND not all zero */
bool all_different = (config->pmc_gpe0_dw0 != config->pmc_gpe0_dw1) &&
(config->pmc_gpe0_dw0 != config->pmc_gpe0_dw2) &&
(config->pmc_gpe0_dw1 != config->pmc_gpe0_dw2);
assert(result);
assert(all_different || all_zero);
}
void soc_get_gpi_gpe_configs(uint8_t *dw0, uint8_t *dw1, uint8_t *dw2)

View file

@ -140,11 +140,16 @@ void soc_clear_pm_registers(uintptr_t pmc_bar)
static void gpe0_different_values(const struct soc_intel_apollolake_config *config)
{
bool result = (config->gpe0_dw1 != config->gpe0_dw2) &&
bool all_zero = (config->gpe0_dw1 == 0) &&
(config->gpe0_dw2 == 0) &&
(config->gpe0_dw3 == 0);
/* Check if all values are different AND not all zero */
bool all_different = (config->gpe0_dw1 != config->gpe0_dw2) &&
(config->gpe0_dw1 != config->gpe0_dw3) &&
(config->gpe0_dw2 != config->gpe0_dw3);
assert(result);
assert(all_different || all_zero);
}
void soc_get_gpi_gpe_configs(uint8_t *dw0, uint8_t *dw1, uint8_t *dw2)

View file

@ -150,11 +150,16 @@ uint32_t *soc_pmc_etr_addr(void)
static void gpe0_different_values(const struct soc_intel_cannonlake_config *config)
{
bool result = (config->gpe0_dw0 != config->gpe0_dw1) &&
bool all_zero = (config->gpe0_dw0 == 0) &&
(config->gpe0_dw1 == 0) &&
(config->gpe0_dw2 == 0);
/* Check if all values are different AND not all zero */
bool all_different = (config->gpe0_dw0 != config->gpe0_dw1) &&
(config->gpe0_dw0 != config->gpe0_dw2) &&
(config->gpe0_dw1 != config->gpe0_dw2);
assert(result);
assert(all_different || all_zero);
}
void soc_get_gpi_gpe_configs(uint8_t *dw0, uint8_t *dw1, uint8_t *dw2)

View file

@ -149,11 +149,16 @@ uint32_t *soc_pmc_etr_addr(void)
static void pmc_gpe0_different_values(const struct soc_intel_elkhartlake_config *config)
{
bool result = (config->pmc_gpe0_dw0 != config->pmc_gpe0_dw1) &&
bool all_zero = (config->pmc_gpe0_dw0 == 0) &&
(config->pmc_gpe0_dw1 == 0) &&
(config->pmc_gpe0_dw2 == 0);
/* Check if all values are different AND not all zero */
bool all_different = (config->pmc_gpe0_dw0 != config->pmc_gpe0_dw1) &&
(config->pmc_gpe0_dw0 != config->pmc_gpe0_dw2) &&
(config->pmc_gpe0_dw1 != config->pmc_gpe0_dw2);
assert(result);
assert(all_different || all_zero);
}
void soc_get_gpi_gpe_configs(uint8_t *dw0, uint8_t *dw1, uint8_t *dw2)

View file

@ -149,11 +149,16 @@ uint32_t *soc_pmc_etr_addr(void)
static void pmc_gpe0_different_values(const struct soc_intel_jasperlake_config *config)
{
bool result = (config->pmc_gpe0_dw0 != config->pmc_gpe0_dw1) &&
bool all_zero = (config->pmc_gpe0_dw0 == 0) &&
(config->pmc_gpe0_dw1 == 0) &&
(config->pmc_gpe0_dw2 == 0);
/* Check if all values are different AND not all zero */
bool all_different = (config->pmc_gpe0_dw0 != config->pmc_gpe0_dw1) &&
(config->pmc_gpe0_dw0 != config->pmc_gpe0_dw2) &&
(config->pmc_gpe0_dw1 != config->pmc_gpe0_dw2);
assert(result);
assert(all_different || all_zero);
}
void soc_get_gpi_gpe_configs(uint8_t *dw0, uint8_t *dw1, uint8_t *dw2)

View file

@ -152,11 +152,16 @@ uint32_t *soc_pmc_etr_addr(void)
static void pmc_gpe0_different_values(const struct soc_intel_meteorlake_config *config)
{
bool result = (config->pmc_gpe0_dw0 != config->pmc_gpe0_dw1) &&
bool all_zero = (config->pmc_gpe0_dw0 == 0) &&
(config->pmc_gpe0_dw1 == 0) &&
(config->pmc_gpe0_dw2 == 0);
/* Check if all values are different AND not all zero */
bool all_different = (config->pmc_gpe0_dw0 != config->pmc_gpe0_dw1) &&
(config->pmc_gpe0_dw0 != config->pmc_gpe0_dw2) &&
(config->pmc_gpe0_dw1 != config->pmc_gpe0_dw2);
assert(result);
assert(all_different || all_zero);
}
void soc_get_gpi_gpe_configs(uint8_t *dw0, uint8_t *dw1, uint8_t *dw2)

View file

@ -147,11 +147,16 @@ uint32_t *soc_pmc_etr_addr(void)
static void pmc_gpe0_different_values(const struct soc_intel_pantherlake_config *config)
{
bool result = (config->pmc_gpe0_dw0 != config->pmc_gpe0_dw1) &&
bool all_zero = (config->pmc_gpe0_dw0 == 0) &&
(config->pmc_gpe0_dw1 == 0) &&
(config->pmc_gpe0_dw2 == 0);
/* Check if all values are different AND not all zero */
bool all_different = (config->pmc_gpe0_dw0 != config->pmc_gpe0_dw1) &&
(config->pmc_gpe0_dw0 != config->pmc_gpe0_dw2) &&
(config->pmc_gpe0_dw1 != config->pmc_gpe0_dw2);
assert(result);
assert(all_different || all_zero);
}
void soc_get_gpi_gpe_configs(uint8_t *dw0, uint8_t *dw1, uint8_t *dw2)

View file

@ -156,11 +156,16 @@ uint32_t *soc_pmc_etr_addr(void)
static void gpe0_different_values(const struct soc_intel_skylake_config *config)
{
bool result = (config->gpe0_dw0 != config->gpe0_dw1) &&
bool all_zero = (config->gpe0_dw0 == 0) &&
(config->gpe0_dw1 == 0) &&
(config->gpe0_dw2 == 0);
/* Check if all values are different AND not all zero */
bool all_different = (config->gpe0_dw0 != config->gpe0_dw1) &&
(config->gpe0_dw0 != config->gpe0_dw2) &&
(config->gpe0_dw1 != config->gpe0_dw2);
assert(result);
assert(all_different || all_zero);
}
void soc_get_gpi_gpe_configs(uint8_t *dw0, uint8_t *dw1, uint8_t *dw2)

View file

@ -155,11 +155,16 @@ uint32_t *soc_pmc_etr_addr(void)
static void pmc_gpe0_different_values(const struct soc_intel_tigerlake_config *config)
{
bool result = (config->pmc_gpe0_dw0 != config->pmc_gpe0_dw1) &&
bool all_zero = (config->pmc_gpe0_dw0 == 0) &&
(config->pmc_gpe0_dw1 == 0) &&
(config->pmc_gpe0_dw2 == 0);
/* Check if all values are different AND not all zero */
bool all_different = (config->pmc_gpe0_dw0 != config->pmc_gpe0_dw1) &&
(config->pmc_gpe0_dw0 != config->pmc_gpe0_dw2) &&
(config->pmc_gpe0_dw1 != config->pmc_gpe0_dw2);
assert(result);
assert(all_different || all_zero);
}
void soc_get_gpi_gpe_configs(uint8_t *dw0, uint8_t *dw1, uint8_t *dw2)