Kyösti Mälkki (kyosti.malkki@gmail.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/3559
-gerrit
commit 2e0573abfa7a815365246e0f6105c90f76ea59d8 Author: Kyösti Mälkki kyosti.malkki@gmail.com Date: Wed Sep 4 14:11:08 2013 +0300
CBMEM tables: Remove references to global high_tables_base
Unify checks and writing of CBMEM tables for x86 and ARMv7.
Change-Id: I89c012bce1b86d0710748719a8840ec532ce6939 Signed-off-by: Kyösti Mälkki kyosti.malkki@gmail.com --- src/arch/armv7/tables.c | 6 +----- src/arch/x86/boot/tables.c | 19 +++++++++++-------- src/include/cbmem.h | 9 ++++----- src/lib/cbmem.c | 17 +++++++++++++++++ src/lib/coreboot_table.c | 5 ----- 5 files changed, 33 insertions(+), 23 deletions(-)
diff --git a/src/arch/armv7/tables.c b/src/arch/armv7/tables.c index 0f174d3..de6b6fa 100644 --- a/src/arch/armv7/tables.c +++ b/src/arch/armv7/tables.c @@ -37,11 +37,7 @@ struct lb_memory *write_tables(void) { unsigned long table_pointer, new_table_pointer;
- if (!high_tables_base) { - printk(BIOS_ERR, "ERROR: high_tables_base is not set.\n"); - } - - printk(BIOS_DEBUG, "high_tables_base: %llx.\n", high_tables_base); + cbmem_base_check();
post_code(0x9d);
diff --git a/src/arch/x86/boot/tables.c b/src/arch/x86/boot/tables.c index 81d5453..970bd40 100644 --- a/src/arch/x86/boot/tables.c +++ b/src/arch/x86/boot/tables.c @@ -51,13 +51,7 @@ struct lb_memory *write_tables(void) unsigned long high_table_pointer;
#if !CONFIG_DYNAMIC_CBMEM - if (!high_tables_base) { - printk(BIOS_ERR, "ERROR: High Tables Base is not set.\n"); - // Are there any boards without? - // Stepan thinks we should die() here! - } - - printk(BIOS_DEBUG, "High Tables Base is %llx.\n", high_tables_base); + cbmem_base_check(); #endif
rom_table_start = 0xf0000; @@ -225,9 +219,18 @@ struct lb_memory *write_tables(void) if (high_table_pointer) { unsigned long new_high_table_pointer;
+ /* FIXME: The high_table_base parameter is not reference when tables are high, + * or high_table_pointer >1 MB. + */ +#if !CONFIG_DYNAMIC_CBMEM + u64 high_table_base = (u32)get_cbmem_toc(); +#else + u64 high_table_base = 0; +#endif + /* Also put a forwarder entry into 0-4K */ new_high_table_pointer = write_coreboot_table(low_table_start, low_table_end, - high_tables_base, high_table_pointer); + high_table_base, high_table_pointer);
if (new_high_table_pointer > (high_table_pointer + MAX_COREBOOT_TABLE_SIZE)) diff --git a/src/include/cbmem.h b/src/include/cbmem.h index 3d04763..d81335f 100644 --- a/src/include/cbmem.h +++ b/src/include/cbmem.h @@ -126,11 +126,6 @@ int cbmem_entry_remove(const struct cbmem_entry *entry); void *cbmem_entry_start(const struct cbmem_entry *entry); u64 cbmem_entry_size(const struct cbmem_entry *entry);
-#ifndef __PRE_RAM__ -/* Add the cbmem memory used to the memory tables. */ -struct lb_memory; -void cbmem_add_lb_mem(struct lb_memory *mem); -#endif /* __PRE_RAM__ */
#else /* !CONFIG_DYNAMIC_CBMEM */
@@ -139,6 +134,7 @@ extern uint64_t high_tables_base, high_tables_size; void set_top_of_ram(uint64_t ramtop); void cbmem_late_set_table(uint64_t base, uint64_t size); void set_cbmem_toc(struct cbmem_entry *); +int cbmem_base_check(void); #endif
void cbmem_init(u64 baseaddr, u64 size); @@ -162,6 +158,9 @@ void *cbmem_find(u32 id);
#ifndef __PRE_RAM__ /* Ramstage only functions. */ +/* Add the cbmem memory used to the memory tables. */ +struct lb_memory; +void cbmem_add_lb_mem(struct lb_memory *mem); void cbmem_list(void); void cbmem_arch_init(void); void cbmem_print_entry(int n, u32 id, u64 start, u64 size); diff --git a/src/lib/cbmem.c b/src/lib/cbmem.c index 206fdbf..32a4614 100644 --- a/src/lib/cbmem.c +++ b/src/lib/cbmem.c @@ -21,6 +21,7 @@ #include <string.h> #include <bootstate.h> #include <cbmem.h> +#include <boot/coreboot_tables.h> #include <console/console.h> #include <cpu/x86/car.h> #if CONFIG_HAVE_ACPI_RESUME && !defined(__PRE_RAM__) @@ -260,6 +261,22 @@ BOOT_STATE_INIT_ENTRIES(cbmem_bscb) = { init_cbmem_post_device, NULL), };
+int cbmem_base_check(void) +{ + if (!high_tables_base) { + printk(BIOS_ERR, "ERROR: CBMEM Base is not set.\n"); + // Are there any boards without? + // Stepan thinks we should die() here! + } + printk(BIOS_DEBUG, "CBMEM Base is %llx.\n", high_tables_base); + return !!high_tables_base; +} + +void cbmem_add_lb_mem(struct lb_memory *mem) +{ + lb_add_memory_range(mem, LB_MEM_TABLE, high_tables_base, high_tables_size); +} + void cbmem_list(void) { struct cbmem_entry *cbmem_toc; diff --git a/src/lib/coreboot_table.c b/src/lib/coreboot_table.c index 3fad4c7..e5729ba 100644 --- a/src/lib/coreboot_table.c +++ b/src/lib/coreboot_table.c @@ -539,12 +539,7 @@ unsigned long write_coreboot_table( lb_add_memory_range(mem, LB_MEM_TABLE, rom_table_start, rom_table_end - rom_table_start);
-#if CONFIG_DYNAMIC_CBMEM cbmem_add_lb_mem(mem); -#else /* CONFIG_DYNAMIC_CBMEM */ - lb_add_memory_range(mem, LB_MEM_TABLE, - high_tables_base, high_tables_size); -#endif /* CONFIG_DYNAMIC_CBMEM */
/* No other memory areas can be added after the memory table has been * committed as the entries won't show up in the serialize mem table. */