From 2e50142f62c20c437100ac3a1a1a50720a31a9d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ky=C3=B6sti=20M=C3=A4lkki?= Date: Fri, 21 Apr 2017 08:43:09 +0300 Subject: i82801dx/gx/ix/jx: Add low-memory backup for S3 path MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit SMM relocation code overwrite low memory owned by OS. Change-Id: Ifa3d28bed3d3db65b0707bde62ae2b424a231f1a Signed-off-by: Kyösti Mälkki Reviewed-on: https://review.coreboot.org/19405 Reviewed-by: Arthur Heymans Tested-by: build bot (Jenkins) Reviewed-by: Aaron Durbin --- src/arch/x86/include/arch/cpu.h | 1 + src/cpu/x86/lapic/lapic_cpu_init.c | 6 ++++++ src/southbridge/intel/i82801dx/smi.c | 9 +++++++++ src/southbridge/intel/i82801gx/smi.c | 8 ++++++++ src/southbridge/intel/i82801ix/smi.c | 8 ++++++++ src/southbridge/intel/i82801jx/smi.c | 8 ++++++++ 6 files changed, 40 insertions(+) (limited to 'src') diff --git a/src/arch/x86/include/arch/cpu.h b/src/arch/x86/include/arch/cpu.h index 4327abed55..ceee7f8366 100644 --- a/src/arch/x86/include/arch/cpu.h +++ b/src/arch/x86/include/arch/cpu.h @@ -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); diff --git a/src/cpu/x86/lapic/lapic_cpu_init.c b/src/cpu/x86/lapic/lapic_cpu_init.c index 3500a8ac93..c2ac51374d 100644 --- a/src/cpu/x86/lapic/lapic_cpu_init.c +++ b/src/cpu/x86/lapic/lapic_cpu_init.c @@ -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) +{ +} diff --git a/src/southbridge/intel/i82801dx/smi.c b/src/southbridge/intel/i82801dx/smi.c index 93e28452e0..945fcf2db8 100644 --- a/src/southbridge/intel/i82801dx/smi.c +++ b/src/southbridge/intel/i82801dx/smi.c @@ -18,6 +18,7 @@ #include #include #include +#include #include #include #include @@ -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. diff --git a/src/southbridge/intel/i82801gx/smi.c b/src/southbridge/intel/i82801gx/smi.c index 17a81c1757..7355d117a4 100644 --- a/src/southbridge/intel/i82801gx/smi.c +++ b/src/southbridge/intel/i82801gx/smi.c @@ -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. diff --git a/src/southbridge/intel/i82801ix/smi.c b/src/southbridge/intel/i82801ix/smi.c index a6c28cbbc2..bf3aa6b0d5 100644 --- a/src/southbridge/intel/i82801ix/smi.c +++ b/src/southbridge/intel/i82801ix/smi.c @@ -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. diff --git a/src/southbridge/intel/i82801jx/smi.c b/src/southbridge/intel/i82801jx/smi.c index 06fa5856c6..8d87291d68 100644 --- a/src/southbridge/intel/i82801jx/smi.c +++ b/src/southbridge/intel/i82801jx/smi.c @@ -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. -- cgit v1.2.3