Kyösti Mälkki (kyosti.malkki@gmail.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/15474
-gerrit
commit 996e2edb9f34d1615312f2362102d0f9419a7ad6 Author: Kyösti Mälkki kyosti.malkki@gmail.com Date: Mon Jun 27 12:53:00 2016 +0300
AMD k8 fam10: Use common ACPI S3 recovery
Change-Id: I62bbba8cfe515b3cae413582ff8d062a20e6741b Signed-off-by: Kyösti Mälkki kyosti.malkki@gmail.com --- src/arch/x86/acpi_s3.c | 21 --------------- src/arch/x86/include/arch/acpi.h | 3 --- src/cpu/amd/car/post_cache_as_ram.c | 43 +++++++------------------------ src/cpu/amd/family_10h-family_15h/Kconfig | 1 - src/cpu/amd/model_fxx/Kconfig | 1 - 5 files changed, 9 insertions(+), 60 deletions(-)
diff --git a/src/arch/x86/acpi_s3.c b/src/arch/x86/acpi_s3.c index 9d56c82..b804c6c 100644 --- a/src/arch/x86/acpi_s3.c +++ b/src/arch/x86/acpi_s3.c @@ -129,27 +129,6 @@ void acpi_prepare_for_resume(void) backup_ramstage_section(0, 0); }
-void *acpi_backup_container(void) -{ - struct resume_backup *backup_mem = cbmem_find(CBMEM_ID_RESUME); - if (backup_mem == NULL) - return NULL; - - backup_mem->magic = 0; - return (void*)&backup_mem->buf; -} - -void acpi_backup_validate(u32 base, u32 size) -{ - struct resume_backup *backup_mem = cbmem_find(CBMEM_ID_RESUME); - if (backup_mem == NULL) - return; - - backup_mem->base = base; - backup_mem->size = size; - backup_mem->magic = RESUME_BACKUP_MAGIC; -} - extern unsigned char _program, _eprogram;
void acpi_prepare_resume_backup(void) diff --git a/src/arch/x86/include/arch/acpi.h b/src/arch/x86/include/arch/acpi.h index 6bb1a8c..babb50b 100644 --- a/src/arch/x86/include/arch/acpi.h +++ b/src/arch/x86/include/arch/acpi.h @@ -618,9 +618,6 @@ static inline int acpi_s3_resume_allowed(void) return IS_ENABLED(CONFIG_HAVE_ACPI_RESUME); }
-void *acpi_backup_container(void); -void acpi_backup_validate(u32 base, u32 size); - #if IS_ENABLED(CONFIG_HAVE_ACPI_RESUME) extern int acpi_slp_type;
diff --git a/src/cpu/amd/car/post_cache_as_ram.c b/src/cpu/amd/car/post_cache_as_ram.c index 0ec58cd..db10071 100644 --- a/src/cpu/amd/car/post_cache_as_ram.c +++ b/src/cpu/amd/car/post_cache_as_ram.c @@ -45,12 +45,6 @@ static void memcpy_(void *d, const void *s, size_t len) memcpy(d, s, len); }
-static void memset_(void *d, int val, size_t len) -{ - print_car_debug(" Fill [%08x-%08x] ...", (uint32_t) d, (uint32_t) (d + len - 1)); - memset(d, val, len); -} - static int memcmp_(void *d, const void *s, size_t len) { print_car_debug(" Compare [%08x-%08x] with [%08x - %08x] ...", @@ -58,33 +52,6 @@ static int memcmp_(void *d, const void *s, size_t len) return memcmp(d, s, len); }
-static void prepare_ramstage_region(int s3resume) -{ - print_car_debug("Prepare ramstage memory region..."); - - if (s3resume) { - void *resume_backup_memory = acpi_backup_container(); - if (resume_backup_memory) - 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); - } - -#if IS_ENABLED(CONFIG_HAVE_ROMSTAGE_CONSOLE_SPINLOCK) - initialize_romstage_console_lock(); -#endif -#if IS_ENABLED(CONFIG_HAVE_ROMSTAGE_NVRAM_CBFS_SPINLOCK) - initialize_romstage_nvram_cbfs_lock(); -#endif - - print_car_debug(" Done\n"); - - if (s3resume) - acpi_backup_validate(CONFIG_RAMBASE, HIGH_MEMORY_SAVE); -} - /* Disable Erratum 343 Workaround, see RevGuide for Fam10h, Pub#41322 Rev 3.33 * and RevGuide for Fam12h, Pub#44739 Rev 3.10 */ @@ -164,7 +131,15 @@ void cache_as_ram_new_stack (void) set_var_mtrr(0, 0x00000000, CACHE_TMP_RAMTOP, MTRR_TYPE_WRBACK); enable_cache();
- prepare_ramstage_region(acpi_is_wakeup_s3()); + if (acpi_is_wakeup_s3()) + acpi_prepare_for_resume(); + +#if IS_ENABLED(CONFIG_HAVE_ROMSTAGE_CONSOLE_SPINLOCK) + initialize_romstage_console_lock(); +#endif +#if IS_ENABLED(CONFIG_HAVE_ROMSTAGE_NVRAM_CBFS_SPINLOCK) + initialize_romstage_nvram_cbfs_lock(); +#endif
set_sysinfo_in_ram(1); // So other core0 could start to train mem
diff --git a/src/cpu/amd/family_10h-family_15h/Kconfig b/src/cpu/amd/family_10h-family_15h/Kconfig index 30c7dee..fda7fc8 100644 --- a/src/cpu/amd/family_10h-family_15h/Kconfig +++ b/src/cpu/amd/family_10h-family_15h/Kconfig @@ -10,7 +10,6 @@ config CPU_AMD_MODEL_10XXX select TSC_SYNC_LFENCE select UDELAY_LAPIC select HAVE_MONOTONIC_TIMER - select ACPI_HUGE_LOWMEM_BACKUP select SUPPORT_CPU_UCODE_IN_CBFS select CPU_MICROCODE_MULTIPLE_FILES if !CPU_MICROCODE_CBFS_NONE
diff --git a/src/cpu/amd/model_fxx/Kconfig b/src/cpu/amd/model_fxx/Kconfig index 3eb5b94..c8bae33 100644 --- a/src/cpu/amd/model_fxx/Kconfig +++ b/src/cpu/amd/model_fxx/Kconfig @@ -9,7 +9,6 @@ config CPU_AMD_MODEL_FXX select SSE2 select TSC_SYNC_LFENCE select UDELAY_LAPIC - select ACPI_HUGE_LOWMEM_BACKUP select SUPPORT_CPU_UCODE_IN_CBFS
if CPU_AMD_MODEL_FXX