From 2ca2afe760bf1f78ee410749332d85f9413a9f3a Mon Sep 17 00:00:00 2001 From: Kyösti Mälkki Date: Tue, 17 Jun 2014 15:41:37 +0300 Subject: ACPI S3 support: Add acpi_s3_resume_allowed() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add this to reduce the amount of preprocessor conditionals used in the source, compiler currently resolves this to a constant. Once we have gone through all #if CONFIG_HAVE_ACPI_RESUME cases, we may change the implementation to enable/disable S3 support runtime. Change-Id: I0e2d9f81e2ab87c2376a04fab38a7c951cac7a07 Signed-off-by: Kyösti Mälkki Reviewed-on: http://review.coreboot.org/6060 Tested-by: build bot (Jenkins) --- src/include/cbmem.h | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) (limited to 'src/include') diff --git a/src/include/cbmem.h b/src/include/cbmem.h index beb626b9dc..e88c2f71af 100644 --- a/src/include/cbmem.h +++ b/src/include/cbmem.h @@ -21,11 +21,18 @@ #ifndef _CBMEM_H_ #define _CBMEM_H_ -#if CONFIG_HAVE_ACPI_RESUME -#if CONFIG_RELOCATABLE_RAMSTAGE +#if IS_ENABLED(CONFIG_HAVE_ACPI_RESUME) && \ + ! IS_ENABLED(CONFIG_RELOCATABLE_RAMSTAGE) +#define HIGH_MEMORY_SAVE (CONFIG_RAMTOP - CONFIG_RAMBASE) +#else #define HIGH_MEMORY_SAVE 0 +#endif + +#if IS_ENABLED(CONFIG_HAVE_ACPI_RESUME) && \ + IS_ENABLED(CONFIG_HIGH_SCRATCH_MEMORY_SIZE) +#define HIGH_MEMORY_SCRATCH CONFIG_HIGH_SCRATCH_MEMORY_SIZE #else -#define HIGH_MEMORY_SAVE (CONFIG_RAMTOP - CONFIG_RAMBASE) +#define HIGH_MEMORY_SCRATCH 0 #endif /* Delegation of resume backup memory so we don't have to @@ -33,7 +40,6 @@ */ #define CBMEM_BOOT_MODE 0x610 #define CBMEM_RESUME_BACKUP 0x614 -#endif /* CONFIG_HAVE_ACPI_RESUME */ #define CBMEM_ID_FREESPACE 0x46524545 #define CBMEM_ID_GDT 0x4c474454 @@ -133,14 +139,9 @@ u64 cbmem_entry_size(const struct cbmem_entry *entry); */ #define _CBMEM_SZ_MINIMAL ( 128 * 1024 ) -#if CONFIG_HAVE_ACPI_RESUME -#define _CBMEM_SZ_RESUME (HIGH_MEMORY_SAVE + CONFIG_HIGH_SCRATCH_MEMORY_SIZE) -#else -#define _CBMEM_SZ_RESUME 0 -#endif - #define _CBMEM_SZ_TOTAL \ - (_CBMEM_SZ_MINIMAL + _CBMEM_SZ_RESUME + CONFIG_CONSOLE_CBMEM_BUFFER_SIZE) + (_CBMEM_SZ_MINIMAL + CONFIG_CONSOLE_CBMEM_BUFFER_SIZE + \ + HIGH_MEMORY_SAVE + HIGH_MEMORY_SCRATCH) #define HIGH_MEMORY_SIZE ALIGN_UP(_CBMEM_SZ_TOTAL, 0x10000) -- cgit v1.2.3