CBMEM: Implement cbmem_run_init_hooks() stub
Until we completely can unify early_variables, use these to handle CBMEM update hooks for both romstage and ramstage. For x86, CAR_MIGRATE serves the purpose of romstage hooks. Change-Id: I100ebc0e35e1b7091b4f287ca37f539fd7c9fa7a Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com> Reviewed-on: http://review.coreboot.org/7876 Reviewed-by: Aaron Durbin <adurbin@google.com> Tested-by: build bot (Jenkins)
This commit is contained in:
parent
05369de639
commit
823edda98e
|
@ -29,14 +29,6 @@
|
||||||
|
|
||||||
#define MAX_COREBOOT_TABLE_SIZE (8 * 1024)
|
#define MAX_COREBOOT_TABLE_SIZE (8 * 1024)
|
||||||
|
|
||||||
void cbmem_arch_init(void)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void cbmem_fail_resume(void)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void write_tables(void)
|
void write_tables(void)
|
||||||
{
|
{
|
||||||
unsigned long table_pointer, new_table_pointer;
|
unsigned long table_pointer, new_table_pointer;
|
||||||
|
|
|
@ -29,14 +29,6 @@
|
||||||
|
|
||||||
#define MAX_COREBOOT_TABLE_SIZE (8 * 1024)
|
#define MAX_COREBOOT_TABLE_SIZE (8 * 1024)
|
||||||
|
|
||||||
void cbmem_arch_init(void)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void cbmem_fail_resume(void)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void write_tables(void)
|
void write_tables(void)
|
||||||
{
|
{
|
||||||
unsigned long table_pointer, new_table_pointer;
|
unsigned long table_pointer, new_table_pointer;
|
||||||
|
|
|
@ -29,10 +29,6 @@
|
||||||
|
|
||||||
#define MAX_COREBOOT_TABLE_SIZE (8 * 1024)
|
#define MAX_COREBOOT_TABLE_SIZE (8 * 1024)
|
||||||
|
|
||||||
void cbmem_arch_init(void)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
// WTF. this does not agre with the prototype!
|
// WTF. this does not agre with the prototype!
|
||||||
static struct lb_memory *wtf_write_tables(void)
|
static struct lb_memory *wtf_write_tables(void)
|
||||||
{
|
{
|
||||||
|
@ -70,7 +66,3 @@ void write_tables(void)
|
||||||
{
|
{
|
||||||
wtf_write_tables();
|
wtf_write_tables();
|
||||||
}
|
}
|
||||||
|
|
||||||
void cbmem_fail_resume(void)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
|
@ -20,6 +20,9 @@
|
||||||
#include <cbmem.h>
|
#include <cbmem.h>
|
||||||
#include <arch/acpi.h>
|
#include <arch/acpi.h>
|
||||||
|
|
||||||
|
/* FIXME: Remove after CBMEM_INIT_HOOKS. */
|
||||||
|
#include <cpu/x86/gdt.h>
|
||||||
|
|
||||||
#if !CONFIG_DYNAMIC_CBMEM
|
#if !CONFIG_DYNAMIC_CBMEM
|
||||||
void get_cbmem_table(uint64_t *base, uint64_t *size)
|
void get_cbmem_table(uint64_t *base, uint64_t *size)
|
||||||
{
|
{
|
||||||
|
@ -69,16 +72,19 @@ void *cbmem_top(void)
|
||||||
|
|
||||||
#endif /* DYNAMIC_CBMEM */
|
#endif /* DYNAMIC_CBMEM */
|
||||||
|
|
||||||
#if !defined(__PRE_RAM__)
|
void cbmem_run_init_hooks(void)
|
||||||
|
|
||||||
/* ACPI resume needs to be cleared in the fail-to-recover case, but that
|
|
||||||
* condition is only handled during ramstage. */
|
|
||||||
void cbmem_fail_resume(void)
|
|
||||||
{
|
{
|
||||||
#if CONFIG_HAVE_ACPI_RESUME
|
#if !defined(__PRE_RAM__)
|
||||||
/* Something went wrong, our high memory area got wiped */
|
move_gdt();
|
||||||
acpi_fail_wakeup();
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* !__PRE_RAM__ */
|
/* Something went wrong, our high memory area got wiped */
|
||||||
|
void cbmem_fail_resume(void)
|
||||||
|
{
|
||||||
|
#if !defined(__PRE_RAM__) && IS_ENABLED(CONFIG_HAVE_ACPI_RESUME)
|
||||||
|
/* ACPI resume needs to be cleared in the fail-to-recover case, but that
|
||||||
|
* condition is only handled during ramstage. */
|
||||||
|
acpi_fail_wakeup();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
|
@ -21,7 +21,6 @@
|
||||||
|
|
||||||
#include <console/console.h>
|
#include <console/console.h>
|
||||||
#include <cpu/cpu.h>
|
#include <cpu/cpu.h>
|
||||||
#include <cpu/x86/gdt.h>
|
|
||||||
#include <boot/tables.h>
|
#include <boot/tables.h>
|
||||||
#include <boot/coreboot_tables.h>
|
#include <boot/coreboot_tables.h>
|
||||||
#include <arch/pirq_routing.h>
|
#include <arch/pirq_routing.h>
|
||||||
|
@ -31,13 +30,6 @@
|
||||||
#include <cbmem.h>
|
#include <cbmem.h>
|
||||||
#include <smbios.h>
|
#include <smbios.h>
|
||||||
|
|
||||||
|
|
||||||
void cbmem_arch_init(void)
|
|
||||||
{
|
|
||||||
/* defined in gdt.c */
|
|
||||||
move_gdt();
|
|
||||||
}
|
|
||||||
|
|
||||||
void write_tables(void)
|
void write_tables(void)
|
||||||
{
|
{
|
||||||
unsigned long low_table_start, low_table_end;
|
unsigned long low_table_start, low_table_end;
|
||||||
|
|
|
@ -213,17 +213,15 @@ void *cbmem_add(u32 id, u64 size);
|
||||||
/* Find a cbmem entry of a given id. These return NULL on failure. */
|
/* Find a cbmem entry of a given id. These return NULL on failure. */
|
||||||
void *cbmem_find(u32 id);
|
void *cbmem_find(u32 id);
|
||||||
|
|
||||||
|
void cbmem_run_init_hooks(void);
|
||||||
|
void cbmem_fail_resume(void);
|
||||||
|
|
||||||
#ifndef __PRE_RAM__
|
#ifndef __PRE_RAM__
|
||||||
/* Ramstage only functions. */
|
/* Ramstage only functions. */
|
||||||
/* Add the cbmem memory used to the memory map at boot. */
|
/* Add the cbmem memory used to the memory map at boot. */
|
||||||
void cbmem_add_bootmem(void);
|
void cbmem_add_bootmem(void);
|
||||||
void cbmem_list(void);
|
void cbmem_list(void);
|
||||||
void cbmem_arch_init(void);
|
|
||||||
void cbmem_print_entry(int n, u32 id, u64 start, u64 size);
|
void cbmem_print_entry(int n, u32 id, u64 start, u64 size);
|
||||||
void cbmem_fail_resume(void);
|
|
||||||
#else
|
|
||||||
static inline void cbmem_arch_init(void) {}
|
|
||||||
static inline void cbmem_fail_resume(void) {}
|
|
||||||
#endif /* __PRE_RAM__ */
|
#endif /* __PRE_RAM__ */
|
||||||
|
|
||||||
#endif /* __ASSEMBLER__ */
|
#endif /* __ASSEMBLER__ */
|
||||||
|
|
|
@ -243,7 +243,7 @@ int cbmem_recovery(int is_wakeup)
|
||||||
cbmem_fail_resume();
|
cbmem_fail_resume();
|
||||||
}
|
}
|
||||||
|
|
||||||
cbmem_arch_init();
|
cbmem_run_init_hooks();
|
||||||
car_migrate_variables();
|
car_migrate_variables();
|
||||||
return !found;
|
return !found;
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,3 +47,14 @@ void cbmem_print_entry(int n, u32 id, u64 base, u64 size)
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* !__PRE_RAM__ */
|
#endif /* !__PRE_RAM__ */
|
||||||
|
|
||||||
|
/* FIXME: Replace with CBMEM_INIT_HOOKS API. */
|
||||||
|
#if !IS_ENABLED(CONFIG_ARCH_X86)
|
||||||
|
void cbmem_run_init_hooks(void)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void __attribute__((weak)) cbmem_fail_resume(void)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
|
@ -171,7 +171,7 @@ void cbmem_initialize_empty(void)
|
||||||
printk(BIOS_DEBUG, "CBMEM: root @ %p %d entries.\n",
|
printk(BIOS_DEBUG, "CBMEM: root @ %p %d entries.\n",
|
||||||
root, root->max_entries);
|
root, root->max_entries);
|
||||||
|
|
||||||
cbmem_arch_init();
|
cbmem_run_init_hooks();
|
||||||
|
|
||||||
/* Migrate cache-as-ram variables. */
|
/* Migrate cache-as-ram variables. */
|
||||||
car_migrate_variables();
|
car_migrate_variables();
|
||||||
|
@ -249,7 +249,7 @@ int cbmem_initialize(void)
|
||||||
root->locked = 1;
|
root->locked = 1;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
cbmem_arch_init();
|
cbmem_run_init_hooks();
|
||||||
|
|
||||||
/* Migrate cache-as-ram variables. */
|
/* Migrate cache-as-ram variables. */
|
||||||
car_migrate_variables();
|
car_migrate_variables();
|
||||||
|
|
Loading…
Reference in New Issue