diff options
author | Aaron Durbin <adurbin@chromium.org> | 2014-02-24 22:11:45 -0600 |
---|---|---|
committer | Aaron Durbin <adurbin@google.com> | 2014-03-03 19:50:10 +0100 |
commit | e58a24b1b598383eab918dac03be4d7122bf0ac5 (patch) | |
tree | 993d1a0ce4e8c95db5db102eb8f2ffcb1268e56d | |
parent | 6086e63a79576a1c7d8d06c2413fef34a65c94ba (diff) | |
download | coreboot-e58a24b1b598383eab918dac03be4d7122bf0ac5.tar.xz |
selfboot: store bounce buffer in struct payload
In order to break the dependency on selfboot for jumping to
payload the bounce buffer location needs to be communicated.
Therefore, add the bounce buffer to struct payload.
Change-Id: I9d9396e5c5bfba7a63940227ee0bdce6cba39578
Signed-off-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-on: http://review.coreboot.org/5299
Tested-by: build bot (Jenkins)
Reviewed-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
Reviewed-by: Edward O'Callaghan <eocallaghan@alterapraxis.com>
Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
-rw-r--r-- | src/include/payload_loader.h | 6 | ||||
-rw-r--r-- | src/lib/selfboot.c | 26 |
2 files changed, 19 insertions, 13 deletions
diff --git a/src/include/payload_loader.h b/src/include/payload_loader.h index 3dde2f7626..73b28bff8f 100644 --- a/src/include/payload_loader.h +++ b/src/include/payload_loader.h @@ -22,14 +22,16 @@ #include <stdint.h> #include <stddef.h> -struct payload_backing_store { +struct buffer_area { void *data; size_t size; }; struct payload { const char *name; - struct payload_backing_store backing_store; + struct buffer_area backing_store; + /* Used when payload wants memory coreboot ramstage is running at. */ + struct buffer_area bounce; void *entry; }; diff --git a/src/lib/selfboot.c b/src/lib/selfboot.c index bd1206f259..ba0748039e 100644 --- a/src/lib/selfboot.c +++ b/src/lib/selfboot.c @@ -74,22 +74,22 @@ struct segment { static unsigned long bounce_size, bounce_buffer; -#if CONFIG_RELOCATABLE_RAMSTAGE -static void get_bounce_buffer(struct lb_memory *mem, unsigned long req_size) -{ - /* When the ramstage is relocatable there is no need for a bounce - * buffer. All payloads should not overlap the ramstage. - */ - bounce_buffer = ~0UL; - bounce_size = 0; -} -#else static void get_bounce_buffer(struct lb_memory *mem, unsigned long req_size) { unsigned long lb_size; unsigned long mem_entries; unsigned long buffer; int i; + + /* When the ramstage is relocatable there is no need for a bounce + * buffer. All payloads should not overlap the ramstage. + */ + if (IS_ENABLED(CONFIG_RELOCATABLE_RAMSTAGE)) { + bounce_buffer = ~0UL; + bounce_size = 0; + return; + } + lb_size = lb_end - lb_start; /* Plus coreboot size so I have somewhere * to place a copy to return to. @@ -120,7 +120,6 @@ static void get_bounce_buffer(struct lb_memory *mem, unsigned long req_size) bounce_buffer = buffer; bounce_size = req_size; } -#endif /* CONFIG_RELOCATABLE_RAMSTAGE */ static int valid_area(struct lb_memory *mem, unsigned long buffer, unsigned long start, unsigned long len) @@ -417,6 +416,11 @@ static int load_self_segments( printk(BIOS_ERR, "Could not find a bounce buffer...\n"); return 0; } + + /* Update the payload's bounce buffer data used when loading. */ + payload->bounce.data = (void *)(uintptr_t)bounce_buffer; + payload->bounce.size = bounce_size; + for(ptr = head->next; ptr != head; ptr = ptr->next) { /* Verify the memory addresses in the segment are valid */ if (!valid_area(mem, bounce_buffer, ptr->s_dstaddr, ptr->s_memsz)) |