i82801dx/gx/ix/jx: Add low-memory backup for S3 path

SMM relocation code overwrite low memory owned by OS.

Change-Id: Ifa3d28bed3d3db65b0707bde62ae2b424a231f1a
Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com>
Reviewed-on: https://review.coreboot.org/19405
Reviewed-by: Arthur Heymans <arthur@aheymans.xyz>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
This commit is contained in:
Kyösti Mälkki 2017-04-21 08:43:09 +03:00
parent 0cc2ce4327
commit 2e50142f62
6 changed files with 40 additions and 0 deletions

View File

@ -163,6 +163,7 @@ int cpu_cpuid_extended_level(void);
int cpu_have_cpuid(void);
void smm_init(void);
void smm_init_completion(void);
void smm_lock(void);
void smm_setup_structures(void *gnvs, void *tcg, void *smi1);

View File

@ -587,6 +587,8 @@ void initialize_cpus(struct bus *cpu_bus)
}
}
smm_init_completion();
if (is_smp_boot())
recover_lowest_1M();
}
@ -595,3 +597,7 @@ void initialize_cpus(struct bus *cpu_bus)
__attribute__((weak)) void smm_init(void)
{
}
__attribute__((weak)) void smm_init_completion(void)
{
}

View File

@ -18,6 +18,7 @@
#include <device/device.h>
#include <device/pci.h>
#include <console/console.h>
#include <arch/acpi.h>
#include <arch/io.h>
#include <cpu/cpu.h>
#include <cpu/x86/cache.h>
@ -229,6 +230,7 @@ static void smi_set_eos(void)
}
extern uint8_t smm_relocation_start, smm_relocation_end;
static void *default_smm_area = NULL;
static void smm_relocate(void)
{
@ -246,6 +248,8 @@ static void smm_relocate(void)
return;
}
default_smm_area = backup_default_smm_area();
/* copy the SMM relocation code */
memcpy((void *)0x38000, &smm_relocation_start,
&smm_relocation_end - &smm_relocation_start);
@ -339,6 +343,11 @@ void smm_init(void)
smi_set_eos();
}
void smm_init_completion(void)
{
restore_default_smm_area(default_smm_area);
}
void smm_lock(void)
{
/* LOCK the SMM memory window and enable normal SMM.

View File

@ -287,6 +287,7 @@ static void smi_set_eos(void)
}
extern uint8_t smm_relocation_start, smm_relocation_end;
static void *default_smm_area = NULL;
static void smm_relocate(void)
{
@ -304,6 +305,8 @@ static void smm_relocate(void)
return;
}
default_smm_area = backup_default_smm_area();
/* copy the SMM relocation code */
memcpy((void *)0x38000, &smm_relocation_start,
&smm_relocation_end - &smm_relocation_start);
@ -412,6 +415,11 @@ void smm_init(void)
smi_set_eos();
}
void smm_init_completion(void)
{
restore_default_smm_area(default_smm_area);
}
void smm_lock(void)
{
/* LOCK the SMM memory window and enable normal SMM.

View File

@ -234,6 +234,7 @@ static void smi_set_eos(void)
}
extern uint8_t smm_relocation_start, smm_relocation_end;
static void *default_smm_area = NULL;
static void smm_relocate(void)
{
@ -251,6 +252,8 @@ static void smm_relocate(void)
return;
}
default_smm_area = backup_default_smm_area();
/* copy the SMM relocation code */
memcpy((void *)0x38000, &smm_relocation_start,
&smm_relocation_end - &smm_relocation_start);
@ -354,6 +357,11 @@ void smm_init(void)
smi_set_eos();
}
void smm_init_completion(void)
{
restore_default_smm_area(default_smm_area);
}
void smm_lock(void)
{
/* LOCK the SMM memory window and enable normal SMM.

View File

@ -234,6 +234,7 @@ static void smi_set_eos(void)
}
extern uint8_t smm_relocation_start, smm_relocation_end;
static void *default_smm_area = NULL;
static void smm_relocate(void)
{
@ -251,6 +252,8 @@ static void smm_relocate(void)
return;
}
default_smm_area = backup_default_smm_area();
/* copy the SMM relocation code */
memcpy((void *)0x38000, &smm_relocation_start,
&smm_relocation_end - &smm_relocation_start);
@ -354,6 +357,11 @@ void smm_init(void)
smi_set_eos();
}
void smm_init_completion(void)
{
restore_default_smm_area(default_smm_area);
}
void smm_lock(void)
{
/* LOCK the SMM memory window and enable normal SMM.