summaryrefslogtreecommitdiff
path: root/arch/x86/lib/coreboot_table.c
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2016-05-23 18:32:47 -0400
committerTom Rini <trini@konsulko.com>2016-05-23 18:32:47 -0400
commit6d54868eeb2697c9a905c4d3521efbacc44c5258 (patch)
tree6ad3ae03a0083d1a50a6152bd6dcad5630ce7823 /arch/x86/lib/coreboot_table.c
parentd7d000311285e4b8d11e089ca13ea456a01be3b8 (diff)
parent8216b11cdd50515fbc423a4b2709a00865b8621d (diff)
Merge branch 'master' of git://git.denx.de/u-boot-x86
Diffstat (limited to 'arch/x86/lib/coreboot_table.c')
-rw-r--r--arch/x86/lib/coreboot_table.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/arch/x86/lib/coreboot_table.c b/arch/x86/lib/coreboot_table.c
index cb45a798575..ceab3cf5e4f 100644
--- a/arch/x86/lib/coreboot_table.c
+++ b/arch/x86/lib/coreboot_table.c
@@ -9,6 +9,37 @@
#include <asm/coreboot_tables.h>
#include <asm/e820.h>
+DECLARE_GLOBAL_DATA_PTR;
+
+int high_table_reserve(void)
+{
+ /* adjust stack pointer to reserve space for configuration tables */
+ gd->arch.high_table_limit = gd->start_addr_sp;
+ gd->start_addr_sp -= CONFIG_HIGH_TABLE_SIZE;
+ gd->arch.high_table_ptr = gd->start_addr_sp;
+
+ /* clear the memory */
+ memset((void *)gd->arch.high_table_ptr, 0, CONFIG_HIGH_TABLE_SIZE);
+
+ gd->start_addr_sp &= ~0xf;
+
+ return 0;
+}
+
+void *high_table_malloc(size_t bytes)
+{
+ u32 new_ptr;
+ void *ptr;
+
+ new_ptr = gd->arch.high_table_ptr + bytes;
+ if (new_ptr >= gd->arch.high_table_limit)
+ return NULL;
+ ptr = (void *)gd->arch.high_table_ptr;
+ gd->arch.high_table_ptr = new_ptr;
+
+ return ptr;
+}
+
/**
* cb_table_init() - initialize a coreboot table header
*