lib/bootmem: allow architecture specific bootmem ranges

A architecture-specific function, named bootmem_arch_add_ranges(),
is added so that each architecture can add entries into the bootmem
memory map. This allows for a common write_tables() implementation
to avoid code duplication.

Change-Id: I834c82eae212869cad8bb02c7abcd9254d120735
Signed-off-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-on: https://review.coreboot.org/14434
Tested-by: build bot (Jenkins)
Reviewed-by: Patrick Georgi <pgeorgi@google.com>
This commit is contained in:
Aaron Durbin 2016-04-19 17:25:59 -05:00
parent 8984af89b8
commit d4afa938c3
8 changed files with 35 additions and 0 deletions

View File

@ -17,12 +17,17 @@
#include <console/console.h>
#include <cpu/cpu.h>
#include <bootmem.h>
#include <boot/tables.h>
#include <boot/coreboot_tables.h>
#include <string.h>
#include <cbmem.h>
#include <lib.h>
void bootmem_arch_add_ranges(void)
{
}
#define MAX_COREBOOT_TABLE_SIZE CONFIG_COREBOOT_TABLE_SIZE
void write_tables(void)

View File

@ -17,12 +17,17 @@
#include <console/console.h>
#include <cpu/cpu.h>
#include <bootmem.h>
#include <boot/tables.h>
#include <boot/coreboot_tables.h>
#include <string.h>
#include <cbmem.h>
#include <lib.h>
void bootmem_arch_add_ranges(void)
{
}
#define MAX_COREBOOT_TABLE_SIZE CONFIG_COREBOOT_TABLE_SIZE
void write_tables(void)

View File

@ -18,12 +18,17 @@
#include <console/console.h>
#include <cpu/cpu.h>
#include <bootmem.h>
#include <boot/tables.h>
#include <boot/coreboot_tables.h>
#include <string.h>
#include <cbmem.h>
#include <lib.h>
void bootmem_arch_add_ranges(void)
{
}
#define MAX_COREBOOT_TABLE_SIZE CONFIG_COREBOOT_TABLE_SIZE
void write_tables(void)

View File

@ -17,12 +17,17 @@
#include <console/console.h>
#include <cpu/cpu.h>
#include <bootmem.h>
#include <boot/tables.h>
#include <boot/coreboot_tables.h>
#include <string.h>
#include <cbmem.h>
#include <lib.h>
void bootmem_arch_add_ranges(void)
{
}
#define MAX_COREBOOT_TABLE_SIZE CONFIG_COREBOOT_TABLE_SIZE
void write_tables(void)

View File

@ -17,12 +17,17 @@
#include <console/console.h>
#include <cpu/cpu.h>
#include <bootmem.h>
#include <boot/tables.h>
#include <boot/coreboot_tables.h>
#include <string.h>
#include <cbmem.h>
#include <lib.h>
void bootmem_arch_add_ranges(void)
{
}
#define MAX_COREBOOT_TABLE_SIZE CONFIG_COREBOOT_TABLE_SIZE
void write_tables(void)

View File

@ -17,6 +17,7 @@
#include <console/console.h>
#include <cpu/cpu.h>
#include <bootmem.h>
#include <boot/tables.h>
#include <boot/coreboot_tables.h>
#include <arch/pirq_routing.h>
@ -180,6 +181,10 @@ static unsigned long write_smbios_table(unsigned long rom_table_end)
return rom_table_end;
}
void bootmem_arch_add_ranges(void)
{
}
void write_tables(void)
{
unsigned long low_table_start, low_table_end;

View File

@ -26,6 +26,9 @@
*/
void bootmem_init(void);
/* Architecture hook to add bootmem areas the architecture controls. */
void bootmem_arch_add_ranges(void);
/* Add a range of a given type to the bootmem address space. */
void bootmem_add_range(uint64_t start, uint64_t size, uint32_t type);

View File

@ -39,6 +39,8 @@ void bootmem_init(void)
/* Add memory used by CBMEM. */
cbmem_add_bootmem();
bootmem_arch_add_ranges();
}
void bootmem_add_range(uint64_t start, uint64_t size, uint32_t type)