summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKyösti Mälkki <kyosti.malkki@gmail.com>2016-06-16 00:40:16 +0300
committerKyösti Mälkki <kyosti.malkki@gmail.com>2016-06-22 11:31:35 +0200
commita16cd9cddaf254d3141cb098ab9d1d4b365799d4 (patch)
tree6788d389ded84cf1cee27b9ebb437fb022bf0f1e
parent65cc526f6f47755b4492cd9fc2134fb2dd067e90 (diff)
downloadcoreboot-a16cd9cddaf254d3141cb098ab9d1d4b365799d4.tar.xz
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>
-rw-r--r--src/arch/x86/acpi.c15
-rw-r--r--src/cpu/x86/lapic/lapic_cpu_init.c38
2 files changed, 24 insertions, 29 deletions
diff --git a/src/arch/x86/acpi.c b/src/arch/x86/acpi.c
index cc6d2ad55e..d75f969619 100644
--- a/src/arch/x86/acpi.c
+++ b/src/arch/x86/acpi.c
@@ -1127,12 +1127,6 @@ void *acpi_find_wakeup_vector(void)
return wake_vec;
}
-#if CONFIG_SMP
-extern char *lowmem_backup;
-extern char *lowmem_backup_ptr;
-extern int lowmem_backup_size;
-#endif
-
#define WAKEUP_BASE 0x600
void (*acpi_do_wakeup)(uintptr_t vector, u32 backup_source, u32 backup_target,
@@ -1155,15 +1149,6 @@ void acpi_jump_to_wakeup(void *vector)
}
}
-#if CONFIG_SMP
- // FIXME: This should go into the ACPI backup memory, too. No pork sausages.
- /*
- * Just restore the SMP trampoline and continue with wakeup on
- * assembly level.
- */
- memcpy(lowmem_backup_ptr, lowmem_backup, lowmem_backup_size);
-#endif
-
/* Copy wakeup trampoline in place. */
memcpy((void *)WAKEUP_BASE, &__wakeup, __wakeup_size);
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
}