diff --git a/payloads/libpayload/arch/arm/Config.in b/payloads/libpayload/arch/arm/Config.in index b2ee527ab7..b1f2bb4a80 100644 --- a/payloads/libpayload/arch/arm/Config.in +++ b/payloads/libpayload/arch/arm/Config.in @@ -33,12 +33,4 @@ config ARCH_SPECIFIC_OPTIONS # dummy def_bool y select LITTLE_ENDIAN -config COREBOOT_INFO_RANGE_BASE - hex "Base of the range to search for the coreboot tables" - -config COREBOOT_INFO_RANGE_SIZE - hex "Size of the range to search for the coreboot tables" - default 0x4000000 - - endif diff --git a/payloads/libpayload/arch/arm/coreboot.c b/payloads/libpayload/arch/arm/coreboot.c index b91db3255c..c7f371e908 100644 --- a/payloads/libpayload/arch/arm/coreboot.c +++ b/payloads/libpayload/arch/arm/coreboot.c @@ -32,6 +32,9 @@ #include #include +/* This pointer gets set in head.S and is passed in from coreboot. */ +void *cb_header_ptr; + /* * Some of this is x86 specific, and the rest of it is generic. Right now, * since we only support x86, we'll avoid trying to make lots of infrastructure @@ -169,22 +172,16 @@ static void cb_parse_string(unsigned char *ptr, char **info) *info = (char *)((struct cb_string *)ptr)->string; } -static int cb_parse_header(void *addr, int len, struct sysinfo_t *info) +static int cb_parse_header(void *addr, struct sysinfo_t *info) { - struct cb_header *header; + struct cb_header *header = addr; unsigned char *ptr = addr; void *forward; int i; - for (i = 0; i < len; i += 16, ptr += 16) { - header = (struct cb_header *)ptr; - if (!strncmp((const char *)header->signature, "LBIO", 4)) - break; - } - - /* We walked the entire space and didn't find anything. */ - if (i >= len) - return -1; + /* No signature found. */ + if (strncmp((const char *)header->signature, "LBIO", 4)) + return -1; if (!header->table_bytes) return 0; @@ -209,7 +206,7 @@ static int cb_parse_header(void *addr, int len, struct sysinfo_t *info) switch (rec->tag) { case CB_TAG_FORWARD: forward = phys_to_virt((void *)(unsigned long)((struct cb_forward *)rec)->forward); - return cb_parse_header(forward, len, info); + return cb_parse_header(forward, info); continue; case CB_TAG_MEMORY: cb_parse_memory(ptr, info); @@ -304,9 +301,7 @@ static int cb_parse_header(void *addr, int len, struct sysinfo_t *info) int get_coreboot_info(struct sysinfo_t *info) { - int ret = cb_parse_header( - phys_to_virt(CONFIG_LP_COREBOOT_INFO_RANGE_BASE), - CONFIG_LP_COREBOOT_INFO_RANGE_SIZE, info); + int ret = cb_parse_header(cb_header_ptr, info); return (ret == 1) ? 0 : -1; } diff --git a/payloads/libpayload/arch/arm/head.S b/payloads/libpayload/arch/arm/head.S index 54fdb5defd..c5c96ea38f 100644 --- a/payloads/libpayload/arch/arm/head.S +++ b/payloads/libpayload/arch/arm/head.S @@ -34,12 +34,16 @@ */ ENTRY(_entry) + /* Save off the location of the coreboot tables */ + ldr r1, 1f + str r0, [r1] + /* TODO: disable interrupts */ /* TODO: Clear BSS */ /* Setup new stack */ - ldr sp, 1f + ldr sp, 2f /* TODO: Save old stack pointer and link register */ @@ -56,4 +60,6 @@ ENDPROC(_entry) .align 4 1: +.word cb_header_ptr +2: .word _stack diff --git a/src/arch/arm/boot.c b/src/arch/arm/boot.c index d872a79151..85b2cce95f 100644 --- a/src/arch/arm/boot.c +++ b/src/arch/arm/boot.c @@ -17,12 +17,18 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include +#include #include +#include +#include #include void arch_payload_run(const struct payload *payload) { + void (*doit)(void *) = payload->entry; + void *cb_tables = cbmem_find(CBMEM_ID_CBTABLE); + printk(BIOS_SPEW, "entry = %p\n", payload->entry); - stage_exit(payload->entry); + cache_sync_instructions(); + doit(cb_tables); }