Stefan Reinauer (stefan.reinauer@coreboot.org) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/1765
-gerrit
commit 8cb0d9205061729d8ac1f686719efa42fb8ae2e3 Author: Duncan Laurie dlaurie@chromium.org Date: Wed Oct 3 19:07:05 2012 -0700
SMM: Restore GNVS pointer in the resume path
The SMM GNVS pointer is normally updated only when the ACPI tables are created, which does not happen in the resume path.
In order to restore this pointer it needs to be available at resume time. The method used to locate it at creation time cannot be used again as that magic signature is overwritten with the address itself. So a new CBMEM ID is added to store the 32bit address so it can be found again easily.
A new function is defined to save this pointer in CBMEM which needs to be called when the ACPI tables are created in each mainboard when write_acpi_tables() is called.
The cpu_index variable had to be renamed due to a conflict when cpu/cpu.h is added for the smm_setup_structures() prototype.
Change-Id: Ic764ff54525e12b617c1dd8d6a3e5c4f547c3e6b Signed-off-by: Duncan Laurie dlaurie@chromium.org --- src/arch/x86/boot/acpi.c | 23 ++++++++++++++++++++--- src/arch/x86/include/arch/acpi.h | 1 + src/include/cbmem.h | 1 + 3 files changed, 22 insertions(+), 3 deletions(-)
diff --git a/src/arch/x86/boot/acpi.c b/src/arch/x86/boot/acpi.c index ff903cf..5c3d664 100644 --- a/src/arch/x86/boot/acpi.c +++ b/src/arch/x86/boot/acpi.c @@ -32,6 +32,7 @@ #include <device/pci.h> #include <cbmem.h> #include <cpu/x86/lapic_def.h> +#include <cpu/cpu.h> #if CONFIG_COLLECT_TIMESTAMPS #include <timestamp.h> #endif @@ -140,7 +141,7 @@ int acpi_create_madt_lapic(acpi_madt_lapic_t *lapic, u8 cpu, u8 apic) unsigned long acpi_create_madt_lapics(unsigned long current) { device_t cpu; - int cpu_index = 0; + int index = 0;
for (cpu = all_devices; cpu; cpu = cpu->next) { if ((cpu->path.type != DEVICE_PATH_APIC) || @@ -150,8 +151,8 @@ unsigned long acpi_create_madt_lapics(unsigned long current) if (!cpu->enabled) continue; current += acpi_create_madt_lapic((acpi_madt_lapic_t *)current, - cpu_index, cpu->path.apic.apic_id); - cpu_index++; + index, cpu->path.apic.apic_id); + index++; }
return current; @@ -562,6 +563,15 @@ void suspend_resume(void) /* If we happen to be resuming find wakeup vector and jump to OS. */ wake_vec = acpi_find_wakeup_vector(); if (wake_vec) { + u32 *gnvs_address = cbmem_find(CBMEM_ID_ACPI_GNVS); + + /* Restore GNVS pointer in SMM if found */ + if (gnvs_address && *gnvs_address) { + printk(BIOS_DEBUG, "Restore GNVS pointer to 0x%08x\n", + *gnvs_address); + smm_setup_structures((void *)*gnvs_address, NULL, NULL); + } + /* Call mainboard resume handler first, if defined. */ if (mainboard_suspend_resume) mainboard_suspend_resume(); @@ -705,3 +715,10 @@ void acpi_jump_to_wakeup(void *vector) HIGH_MEMORY_SAVE); } #endif + +void acpi_save_gnvs(u32 gnvs_address) +{ + u32 *gnvs = cbmem_add(CBMEM_ID_ACPI_GNVS, sizeof(*gnvs)); + if (gnvs) + *gnvs = gnvs_address; +} diff --git a/src/arch/x86/include/arch/acpi.h b/src/arch/x86/include/arch/acpi.h index 0b2cbf4..2ff51f3 100644 --- a/src/arch/x86/include/arch/acpi.h +++ b/src/arch/x86/include/arch/acpi.h @@ -504,6 +504,7 @@ void __attribute__((weak)) mainboard_suspend_resume(void); void *acpi_find_wakeup_vector(void); void *acpi_get_wakeup_rsdp(void); void acpi_jump_to_wakeup(void *wakeup_addr); +void acpi_save_gnvs(u32 gnvs_address);
int acpi_get_sleep_type(void); #else /* CONFIG_HAVE_ACPI_RESUME */ diff --git a/src/include/cbmem.h b/src/include/cbmem.h index a245232..a55aa51 100644 --- a/src/include/cbmem.h +++ b/src/include/cbmem.h @@ -44,6 +44,7 @@ #define CBMEM_ID_FREESPACE 0x46524545 #define CBMEM_ID_GDT 0x4c474454 #define CBMEM_ID_ACPI 0x41435049 +#define CBMEM_ID_ACPI_GNVS 0x474e5653 #define CBMEM_ID_CBTABLE 0x43425442 #define CBMEM_ID_PIRQ 0x49525154 #define CBMEM_ID_MPTABLE 0x534d5054