diff options
author | Kyösti Mälkki <kyosti.malkki@gmail.com> | 2016-06-16 00:40:16 +0300 |
---|---|---|
committer | Kyösti Mälkki <kyosti.malkki@gmail.com> | 2016-06-22 11:31:35 +0200 |
commit | a16cd9cddaf254d3141cb098ab9d1d4b365799d4 (patch) | |
tree | 6788d389ded84cf1cee27b9ebb437fb022bf0f1e /src/cpu | |
parent | 65cc526f6f47755b4492cd9fc2134fb2dd067e90 (diff) |
ACPI S3: Move SMP trampoline recovery
No need to make low memory backup unless we are on
S3 resume path.
Hide those details from ACPI.
Change-Id: Ic08b6d70c7895b094afdb3c77e020ff37ad632a1
Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com>
Reviewed-on: https://review.coreboot.org/15241
Tested-by: build bot (Jenkins)
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Diffstat (limited to 'src/cpu')
-rw-r--r-- | src/cpu/x86/lapic/lapic_cpu_init.c | 38 |
1 files changed, 24 insertions, 14 deletions
diff --git a/src/cpu/x86/lapic/lapic_cpu_init.c b/src/cpu/x86/lapic/lapic_cpu_init.c index bf63517384..77e5ba8e52 100644 --- a/src/cpu/x86/lapic/lapic_cpu_init.c +++ b/src/cpu/x86/lapic/lapic_cpu_init.c @@ -20,6 +20,7 @@ #include <cpu/x86/cr.h> #include <cpu/x86/gdt.h> #include <cpu/x86/lapic.h> +#include <arch/acpi.h> #include <delay.h> #include <halt.h> #include <lib.h> @@ -46,11 +47,9 @@ /* Start-UP IPI vector must be 4kB aligned and below 1MB. */ #define AP_SIPI_VECTOR 0x1000 -#if CONFIG_HAVE_ACPI_RESUME -char *lowmem_backup; -char *lowmem_backup_ptr; -int lowmem_backup_size; -#endif +static char *lowmem_backup; +static char *lowmem_backup_ptr; +static int lowmem_backup_size; static inline void setup_secondary_gdt(void) { @@ -77,17 +76,18 @@ static void copy_secondary_start_to_lowest_1M(void) code_size = (unsigned long)_secondary_start_end - (unsigned long)_secondary_start; -#if CONFIG_HAVE_ACPI_RESUME - /* need to save it for RAM resume */ - lowmem_backup_size = code_size; - lowmem_backup = malloc(code_size); - lowmem_backup_ptr = (char *)AP_SIPI_VECTOR; + if (acpi_is_wakeup_s3()) { + /* need to save it for RAM resume */ + lowmem_backup_size = code_size; + lowmem_backup = malloc(code_size); + lowmem_backup_ptr = (char *)AP_SIPI_VECTOR; - if (lowmem_backup == NULL) - die("Out of backup memory\n"); + if (lowmem_backup == NULL) + die("Out of backup memory\n"); + + memcpy(lowmem_backup, lowmem_backup_ptr, lowmem_backup_size); + } - memcpy(lowmem_backup, lowmem_backup_ptr, lowmem_backup_size); -#endif /* copy the _secondary_start to the ram below 1M*/ memcpy((unsigned char *)AP_SIPI_VECTOR, (unsigned char *)_secondary_start, code_size); @@ -95,6 +95,12 @@ static void copy_secondary_start_to_lowest_1M(void) (long unsigned int)AP_SIPI_VECTOR, code_size); } +static void recover_lowest_1M(void) +{ + if (acpi_is_wakeup_s3()) + memcpy(lowmem_backup_ptr, lowmem_backup, lowmem_backup_size); +} + static int lapic_start_cpu(unsigned long apicid) { int timeout; @@ -592,4 +598,8 @@ void initialize_cpus(struct bus *cpu_bus) smm_other_cpus(cpu_bus, info->cpu); #endif } + +#if CONFIG_SMP && CONFIG_MAX_CPUS > 1 + recover_lowest_1M(); +#endif } |