From 60b55cc70b5026f644d50ee8014182ac44c8240d Mon Sep 17 00:00:00 2001 From: Subrata Banik Date: Tue, 28 Jan 2025 12:49:20 +0530 Subject: [PATCH] soc/intel/common/pmc: Fix duplicate GPE DW register check MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The `pmc_gpe_init` function's check for duplicate GPE DW register values was incomplete. It only checked for duplicates between DW0 and DW1, and DW1 and DW2, but failed to check if DW0 and DW2 were the same. This could lead to incorrect GPE routing if DW0 and DW2 happened to have the same value, even if DW1 was different. This commit corrects the check to ensure that all three DW registers (DW0, DW1, and DW2) are compared against each other. If any two registers have the same value, a message is printed indicating that the default GPE route will be used. Change-Id: I0a52e6aeee619fbc2f712c9c976b067d080ca591 Signed-off-by: Subrata Banik Reviewed-on: https://review.coreboot.org/c/coreboot/+/86173 Tested-by: build bot (Jenkins) Reviewed-by: Jérémy Compostella Reviewed-by: Matt DeVillier --- src/soc/intel/common/block/pmc/pmclib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/soc/intel/common/block/pmc/pmclib.c b/src/soc/intel/common/block/pmc/pmclib.c index 0fadd6e409..18a527a86b 100644 --- a/src/soc/intel/common/block/pmc/pmclib.c +++ b/src/soc/intel/common/block/pmc/pmclib.c @@ -656,7 +656,7 @@ void pmc_gpe_init(void) * Route the GPIOs to the GPE0 block. Determine that all values * are different, and if they aren't use the reset values. */ - if (dw0 == dw1 || dw1 == dw2) { + if (dw0 == dw1 || dw1 == dw2 || dw0 == dw2) { printk(BIOS_INFO, "PMC: Using default GPE route.\n"); gpio_cfg = read32p(pmc_bar + GPIO_GPE_CFG);