summaryrefslogtreecommitdiffstats
path: root/src/include/bootmem.h
diff options
context:
space:
mode:
authorAaron Durbin <adurbin@chromium.org>2018-04-03 00:08:12 -0600
committerPatrick Georgi <pgeorgi@google.com>2018-04-16 08:39:21 +0000
commit4677f6bbfa412bbdaa6f2fdf65e45e83eb9f6fb3 (patch)
treef32f28f3c3ab815adf4672c15bef203e59be7269 /src/include/bootmem.h
parent99b65668f990a04ef524c2303e2894d783aa1730 (diff)
downloadcoreboot-4677f6bbfa412bbdaa6f2fdf65e45e83eb9f6fb3.tar.gz
coreboot-4677f6bbfa412bbdaa6f2fdf65e45e83eb9f6fb3.tar.bz2
coreboot-4677f6bbfa412bbdaa6f2fdf65e45e83eb9f6fb3.zip
lib/bootmem: tightly couple bootmem_init to bootmem_write_memory_table
In https://review.coreboot.org/25383 people were confused about the ordering of bootmem calls w.r.t. when entries are exposed to the OS. To alleviate this add a notion of bootmem being initialized. In addition to that, only mark bootmem initialized when bootmem_write_memory_table() is called. Any other calls to bootmem before that will report an error on the console. Change-Id: I5bc31f555038ccabb82d902c54f95858679b1695 Signed-off-by: Aaron Durbin <adurbin@chromium.org> Reviewed-on: https://review.coreboot.org/25503 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Julius Werner <jwerner@chromium.org>
Diffstat (limited to 'src/include/bootmem.h')
-rw-r--r--src/include/bootmem.h15
1 files changed, 6 insertions, 9 deletions
diff --git a/src/include/bootmem.h b/src/include/bootmem.h
index 10c8d51b77ce..6e7d127f622e 100644
--- a/src/include/bootmem.h
+++ b/src/include/bootmem.h
@@ -20,21 +20,18 @@
#include <stdint.h>
#include <boot/coreboot_tables.h>
-/*
- * Initialize the memory address space prior to payload loading. The bootmem
- * serves as the source for the lb_mem table.
- */
-void bootmem_init(void);
+/* 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. */
+void bootmem_write_memory_table(struct lb_memory *mem);
-/* Architecture hook to add bootmem areas the architecture controls. */
+/* Architecture hook to add bootmem areas the architecture controls when
+ * bootmem_write_memory_table() is called. */
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);
-/* Write memory coreboot table. */
-void bootmem_write_memory_table(struct lb_memory *mem);
-
/* Print current range map of boot memory. */
void bootmem_dump_ranges(void);