From 9ab9db0bc5a1bf8bb35980068a840691d54aa5dd Mon Sep 17 00:00:00 2001 From: Patrick Rudolph Date: Thu, 5 Apr 2018 09:14:51 +0200 Subject: lib/bootmem: Introduce custom bootmem tags Introduce bootmem custom memory tags and use them instead of reusing LB_MEM tags. Use asserts in bootmem_add_range to verify parameters. Tested with uImage payload on Cavium SoC. Change-Id: I7be8fa792fc7933ca218ecd43d250d3a9c55caa6 Signed-off-by: Patrick Rudolph Reviewed-on: https://review.coreboot.org/25633 Tested-by: build bot (Jenkins) Reviewed-by: Aaron Durbin Reviewed-by: Julius Werner --- src/include/bootmem.h | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'src/include/bootmem.h') diff --git a/src/include/bootmem.h b/src/include/bootmem.h index 6e7d127f62..df2233f202 100644 --- a/src/include/bootmem.h +++ b/src/include/bootmem.h @@ -20,6 +20,22 @@ #include #include +/** + * Bootmem types match to LB_MEM tags. + * Start at 0x10000 to make sure that the caller doesn't provide LB_MEM tags. + */ +enum bootmem_type { + BM_MEM_FIRST = 0x10000, /* First entry in this list */ + BM_MEM_RAM, /* Memory anyone can use */ + BM_MEM_RESERVED, /* Don't use this memory region */ + BM_MEM_ACPI, /* ACPI Tables */ + BM_MEM_NVS, /* ACPI NVS Memory */ + BM_MEM_UNUSABLE, /* Unusable address space */ + BM_MEM_VENDOR_RSVD, /* Vendor Reserved */ + BM_MEM_TABLE, /* Ram configuration tables are kept in */ + BM_MEM_LAST, /* Last entry in this list */ +}; + /* Write memory coreboot table. Current resource map is serialized into * memtable (LB_MEM_* types). bootmem library is unusable until this function * is called first in the write tables path before payload is loaded. */ @@ -30,7 +46,8 @@ void bootmem_write_memory_table(struct lb_memory *mem); 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); +void bootmem_add_range(uint64_t start, uint64_t size, + const enum bootmem_type tag); /* Print current range map of boot memory. */ void bootmem_dump_ranges(void); -- cgit v1.2.3