summaryrefslogtreecommitdiff
path: root/src/cpu/x86/lapic
diff options
context:
space:
mode:
Diffstat (limited to 'src/cpu/x86/lapic')
-rw-r--r--src/cpu/x86/lapic/lapic_cpu_init.c38
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
}