[coreboot-gerrit] Patch set updated for coreboot: ACPI S3: Remove HIGH_MEMORY_SAVE

Kyösti Mälkki (kyosti.malkki@gmail.com) gerrit at coreboot.org
Sat Jun 18 19:47:24 CEST 2016


Kyösti Mälkki (kyosti.malkki at gmail.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/15255

-gerrit

commit 1840a70f06ec4911e852badb9e9b35c83cf09e5b
Author: Kyösti Mälkki <kyosti.malkki at gmail.com>
Date:   Sat Jun 18 16:28:42 2016 +0300

    ACPI S3: Remove HIGH_MEMORY_SAVE
    
    Calculation will be replaced with actual requirements
    of the ramstage.
    
    Change-Id: Ide7ce013f3727c2928cdb00fbcc7e7e84e859ff1
    Signed-off-by: Kyösti Mälkki <kyosti.malkki at gmail.com>
---
 src/arch/x86/acpi_s3.c              | 15 +++++++++------
 src/arch/x86/include/arch/acpi.h    |  9 ++-------
 src/cpu/amd/car/post_cache_as_ram.c |  8 +++++---
 3 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/src/arch/x86/acpi_s3.c b/src/arch/x86/acpi_s3.c
index dadce84..d95bfd5 100644
--- a/src/arch/x86/acpi_s3.c
+++ b/src/arch/x86/acpi_s3.c
@@ -110,6 +110,11 @@ void acpi_prepare_resume_backup(void) { };
 
 #else
 
+size_t acpi_resume_backup_size(void)
+{
+	return (CONFIG_RAMTOP - CONFIG_RAMBASE);
+}
+
 #if ENV_ROMSTAGE
 void acpi_prepare_for_resume(void)
 {
@@ -117,7 +122,7 @@ void acpi_prepare_for_resume(void)
 	void *src = (void *)CONFIG_RAMBASE;
 	void *dest = cbmem_find(CBMEM_ID_RESUME);
 	if (dest != NULL)
-		memcpy(dest, src, HIGH_MEMORY_SAVE);
+		memcpy(dest, src, acpi_resume_backup_size());
 }
 #elif ENV_RAMSTAGE
 void acpi_prepare_resume_backup(void)
@@ -129,9 +134,7 @@ void acpi_prepare_resume_backup(void)
 	 * it being there during reboot time. We don't need the pointer, nor
 	 * the result right now. If it fails, ACPI resume will be disabled.
 	 */
-
-	if (HIGH_MEMORY_SAVE)
-		cbmem_add(CBMEM_ID_RESUME, HIGH_MEMORY_SAVE);
+	cbmem_add(CBMEM_ID_RESUME, acpi_resume_backup_size());
 }
 #endif
 
@@ -171,7 +174,7 @@ void acpi_jump_to_wakeup(void *vector)
 {
 	uintptr_t acpi_backup_memory = 0;
 
-	if (HIGH_MEMORY_SAVE && acpi_s3_resume_allowed()) {
+	if (acpi_s3_resume_allowed()) {
 		acpi_backup_memory = (uintptr_t)cbmem_find(CBMEM_ID_RESUME);
 
 		if (!acpi_backup_memory) {
@@ -181,7 +184,7 @@ void acpi_jump_to_wakeup(void *vector)
 		}
 	}
 	__acpi_jump_to_wakeup((uintptr_t)vector, acpi_backup_memory, CONFIG_RAMBASE,
-		       HIGH_MEMORY_SAVE);
+		       acpi_resume_backup_size());
 }
 #endif
 
diff --git a/src/arch/x86/include/arch/acpi.h b/src/arch/x86/include/arch/acpi.h
index ff0672e..f1f83e1 100644
--- a/src/arch/x86/include/arch/acpi.h
+++ b/src/arch/x86/include/arch/acpi.h
@@ -24,13 +24,6 @@
 #ifndef __ASM_ACPI_H
 #define __ASM_ACPI_H
 
-#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
-
 #ifndef __ASSEMBLER__
 #include <stdint.h>
 #include <rules.h>
@@ -638,6 +631,7 @@ int acpi_is_wakeup_s3(void);
 int acpi_is_wakeup_s4(void);
 #endif
 void acpi_prepare_for_resume(void);
+size_t acpi_resume_backup_size(void);
 
 #else
 #define acpi_slp_type 0
@@ -645,6 +639,7 @@ static inline int acpi_is_wakeup(void) { return 0; }
 static inline int acpi_is_wakeup_s3(void) { return 0; }
 static inline int acpi_is_wakeup_s4(void) { return 0; }
 static inline void acpi_prepare_for_resume(void) { }
+static inline size_t acpi_resume_backup_size(void) { return 0; }
 #endif
 
 static inline uintptr_t acpi_align_current(uintptr_t current)
diff --git a/src/cpu/amd/car/post_cache_as_ram.c b/src/cpu/amd/car/post_cache_as_ram.c
index 0a59696..7d02dc6 100644
--- a/src/cpu/amd/car/post_cache_as_ram.c
+++ b/src/cpu/amd/car/post_cache_as_ram.c
@@ -69,7 +69,8 @@ static void prepare_romstage_ramstack(void *resume_backup_memory)
 	print_car_debug("Prepare CAR migration and stack regions...");
 
 	if (resume_backup_memory) {
-		memcpy_(resume_backup_memory + HIGH_MEMORY_SAVE - backup_top,
+		size_t high_memory_save = acpi_resume_backup_size() - backup_top;
+		memcpy_(resume_backup_memory + high_memory_save,
 			(void *)(CONFIG_RAMTOP - backup_top), backup_top);
 	}
 	memset_((void *)(CONFIG_RAMTOP - backup_top), 0, backup_top);
@@ -83,8 +84,9 @@ static void prepare_ramstage_region(void *resume_backup_memory)
 	print_car_debug("Prepare ramstage memory region...");
 
 	if (resume_backup_memory) {
-		memcpy_(resume_backup_memory, (void *) CONFIG_RAMBASE, HIGH_MEMORY_SAVE - backup_top);
-		memset_((void*) CONFIG_RAMBASE, 0, HIGH_MEMORY_SAVE - backup_top);
+		size_t high_memory_save = acpi_resume_backup_size() - backup_top;
+		memcpy_(resume_backup_memory, (void *) CONFIG_RAMBASE, high_memory_save);
+		memset_((void*) CONFIG_RAMBASE, 0, high_memory_save);
 	} else {
 		memset_((void*)0, 0, CONFIG_RAMTOP - backup_top);
 	}



More information about the coreboot-gerrit mailing list