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>
This commit is contained in:
parent
65cc526f6f
commit
a16cd9cdda
|
@ -1127,12 +1127,6 @@ void *acpi_find_wakeup_vector(void)
|
||||||
return wake_vec;
|
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
|
#define WAKEUP_BASE 0x600
|
||||||
|
|
||||||
void (*acpi_do_wakeup)(uintptr_t vector, u32 backup_source, u32 backup_target,
|
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. */
|
/* Copy wakeup trampoline in place. */
|
||||||
memcpy((void *)WAKEUP_BASE, &__wakeup, __wakeup_size);
|
memcpy((void *)WAKEUP_BASE, &__wakeup, __wakeup_size);
|
||||||
|
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
#include <cpu/x86/cr.h>
|
#include <cpu/x86/cr.h>
|
||||||
#include <cpu/x86/gdt.h>
|
#include <cpu/x86/gdt.h>
|
||||||
#include <cpu/x86/lapic.h>
|
#include <cpu/x86/lapic.h>
|
||||||
|
#include <arch/acpi.h>
|
||||||
#include <delay.h>
|
#include <delay.h>
|
||||||
#include <halt.h>
|
#include <halt.h>
|
||||||
#include <lib.h>
|
#include <lib.h>
|
||||||
|
@ -46,11 +47,9 @@
|
||||||
/* Start-UP IPI vector must be 4kB aligned and below 1MB. */
|
/* Start-UP IPI vector must be 4kB aligned and below 1MB. */
|
||||||
#define AP_SIPI_VECTOR 0x1000
|
#define AP_SIPI_VECTOR 0x1000
|
||||||
|
|
||||||
#if CONFIG_HAVE_ACPI_RESUME
|
static char *lowmem_backup;
|
||||||
char *lowmem_backup;
|
static char *lowmem_backup_ptr;
|
||||||
char *lowmem_backup_ptr;
|
static int lowmem_backup_size;
|
||||||
int lowmem_backup_size;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static inline void setup_secondary_gdt(void)
|
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;
|
code_size = (unsigned long)_secondary_start_end - (unsigned long)_secondary_start;
|
||||||
|
|
||||||
#if CONFIG_HAVE_ACPI_RESUME
|
if (acpi_is_wakeup_s3()) {
|
||||||
/* need to save it for RAM resume */
|
/* need to save it for RAM resume */
|
||||||
lowmem_backup_size = code_size;
|
lowmem_backup_size = code_size;
|
||||||
lowmem_backup = malloc(code_size);
|
lowmem_backup = malloc(code_size);
|
||||||
lowmem_backup_ptr = (char *)AP_SIPI_VECTOR;
|
lowmem_backup_ptr = (char *)AP_SIPI_VECTOR;
|
||||||
|
|
||||||
if (lowmem_backup == NULL)
|
if (lowmem_backup == NULL)
|
||||||
die("Out of backup memory\n");
|
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*/
|
/* copy the _secondary_start to the ram below 1M*/
|
||||||
memcpy((unsigned char *)AP_SIPI_VECTOR, (unsigned char *)_secondary_start, code_size);
|
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);
|
(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)
|
static int lapic_start_cpu(unsigned long apicid)
|
||||||
{
|
{
|
||||||
int timeout;
|
int timeout;
|
||||||
|
@ -592,4 +598,8 @@ void initialize_cpus(struct bus *cpu_bus)
|
||||||
smm_other_cpus(cpu_bus, info->cpu);
|
smm_other_cpus(cpu_bus, info->cpu);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if CONFIG_SMP && CONFIG_MAX_CPUS > 1
|
||||||
|
recover_lowest_1M();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue