[S] Change in coreboot[main]: ec/google/chromeec: Consolidate CREC preprocessor conditions
Attention is currently required from: Boris Mittelberg, Caveh Jalali. Matt DeVillier has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/95900?usp=email ) Change subject: ec/google/chromeec: Consolidate CREC preprocessor conditions ...................................................................... ec/google/chromeec: Consolidate CREC preprocessor conditions The CREC device used nested #ifdef blocks and defined the mainboard EC_SYNC_IRQ_WAKE_CAPABLE macro inline to select the interrupt share type. Evaluate each condition once at the top of the file into CREC_HAS_* flags, leaving the mainboard macros untouched, so the guards within the device are simple checks. TEST=Build dsdt.aml for all 339 boards in the mainboard directories using the ChromeEC ASL, both with and without CONFIG_CHROMEOS; all are byte-identical. Change-Id: Ifee260b713c2cb06ac224560899ccb2209d72596 Signed-off-by: Matt DeVillier <matt.devillier@gmail.com> --- M src/ec/google/chromeec/acpi/cros_ec.asl 1 file changed, 25 insertions(+), 17 deletions(-) git pull ssh://review.coreboot.org:29418/coreboot refs/changes/00/95900/1 diff --git a/src/ec/google/chromeec/acpi/cros_ec.asl b/src/ec/google/chromeec/acpi/cros_ec.asl index cb1e514..6c2d9bd 100644 --- a/src/ec/google/chromeec/acpi/cros_ec.asl +++ b/src/ec/google/chromeec/acpi/cros_ec.asl @@ -1,7 +1,26 @@ /* SPDX-License-Identifier: GPL-2.0-only */ -#if CONFIG(EC_GOOGLE_CHROMEEC_LPC_GENERIC_MEMORY_RANGE) -#define LPC_GMR_SIZE 0x10000 +#define CREC_HAS_GMR CONFIG(EC_GOOGLE_CHROMEEC_LPC_GENERIC_MEMORY_RANGE) +#define LPC_GMR_SIZE 0x10000 + +#if defined(EC_ENABLE_SYNC_IRQ) || defined(EC_ENABLE_SYNC_IRQ_GPIO) || CREC_HAS_GMR +#define CREC_HAS_CRS 1 +#else +#define CREC_HAS_CRS 0 +#endif + +/* With a GPIO sync interrupt, the interrupt itself is the wake source instead of _PRW. */ +#if defined(EC_ENABLE_WAKE_PIN) && !defined(EC_ENABLE_SYNC_IRQ_GPIO) +#define CREC_HAS_PRW 1 +#else +#define CREC_HAS_PRW 0 +#endif + +#if defined(EC_SYNC_IRQ_WAKE_CAPABLE) || \ + (defined(EC_ENABLE_SYNC_IRQ_GPIO) && defined(EC_ENABLE_WAKE_PIN)) +#define EC_SYNC_SHARE_TYPE ExclusiveAndWake +#else +#define EC_SYNC_SHARE_TYPE Exclusive #endif Device (CREC) @@ -9,22 +28,11 @@ Name (_HID, CONFIG_EC_GOOGLE_CHROMEEC_ACPI_HID) Name (_UID, 1) Name (_DDN, "EC Command Device") -#ifdef EC_ENABLE_WAKE_PIN -#ifndef EC_ENABLE_SYNC_IRQ_GPIO +#if CREC_HAS_PRW Name (_PRW, Package () { EC_ENABLE_WAKE_PIN, 0x5 }) -#else -#define EC_SYNC_IRQ_WAKE_CAPABLE -#endif #endif -#ifdef EC_SYNC_IRQ_WAKE_CAPABLE - #define EC_SYNC_SHARE_TYPE ExclusiveAndWake -#else - #define EC_SYNC_SHARE_TYPE Exclusive -#endif - -#if defined(EC_ENABLE_SYNC_IRQ) || defined(EC_ENABLE_SYNC_IRQ_GPIO) || \ -CONFIG(EC_GOOGLE_CHROMEEC_LPC_GENERIC_MEMORY_RANGE) +#if CREC_HAS_CRS Method (_CRS, 0x0, NotSerialized) { Name (RBUF, ResourceTemplate() @@ -41,12 +49,12 @@ } #endif -#if CONFIG(EC_GOOGLE_CHROMEEC_LPC_GENERIC_MEMORY_RANGE) +#if CREC_HAS_GMR Memory32Fixed (ReadWrite, 0, 0, MADR) #endif }) -#if CONFIG(EC_GOOGLE_CHROMEEC_LPC_GENERIC_MEMORY_RANGE) +#if CREC_HAS_GMR CreateDWordField (RBUF, MADR._BAS, BAS0) CreateDWordField (RBUF, MADR._LEN, LEN0) BAS0 = \_SB.PCI0.LPCB.GLGM() -- To view, visit https://review.coreboot.org/c/coreboot/+/95900?usp=email To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings?usp=email Gerrit-MessageType: newchange Gerrit-Project: coreboot Gerrit-Branch: main Gerrit-Change-Id: Ifee260b713c2cb06ac224560899ccb2209d72596 Gerrit-Change-Number: 95900 Gerrit-PatchSet: 1 Gerrit-Owner: Matt DeVillier <matt.devillier@gmail.com> Gerrit-Reviewer: Boris Mittelberg <bmbm@google.com> Gerrit-Reviewer: Caveh Jalali <caveh@chromium.org> Gerrit-Attention: Boris Mittelberg <bmbm@google.com> Gerrit-Attention: Caveh Jalali <caveh@chromium.org>
participants (1)
-
Matt DeVillier (Code Review)