Aaron Durbin (adurbin@google.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/5298
-gerrit
commit f5572b530dcba2a2d6f288228bc77d388a6affee Author: Aaron Durbin adurbin@chromium.org Date: Mon Feb 24 21:50:24 2014 -0600
coreboot: use struct payload for selfload()
In order to encapsulate more data for self loading use struct payload as the type. That way modifications to what is needed for payload loading does not introduce more global variables.
Change-Id: I5b8facd7881e397ca7de1c04cec747fc1dce2d5f Signed-off-by: Aaron Durbin adurbin@chromium.org --- src/include/payload_loader.h | 3 +-- src/lib/loaders/load_and_run_payload.c | 2 +- src/lib/selfboot.c | 10 ++++++---- 3 files changed, 8 insertions(+), 7 deletions(-)
diff --git a/src/include/payload_loader.h b/src/include/payload_loader.h index b8bfc0d..3dde2f7 100644 --- a/src/include/payload_loader.h +++ b/src/include/payload_loader.h @@ -54,8 +54,7 @@ struct payload_loader_ops {
/* Defined in src/lib/selfboot.c */ struct lb_memory; -struct cbfs_payload; -void *selfload(struct lb_memory *mem, struct cbfs_payload *payload); +void *selfload(struct lb_memory *mem, struct payload *payload); void selfboot(void *entry);
#endif /* PAYLOAD_LOADER_H */ diff --git a/src/lib/loaders/load_and_run_payload.c b/src/lib/loaders/load_and_run_payload.c index 96f5e27..f18b57b 100644 --- a/src/lib/loaders/load_and_run_payload.c +++ b/src/lib/loaders/load_and_run_payload.c @@ -65,7 +65,7 @@ struct payload *payload_load(void) return NULL;
mem = get_lb_mem(); - entry = selfload(mem, payload->backing_store.data); + entry = selfload(mem, payload);
if (entry == NULL) return NULL; diff --git a/src/lib/selfboot.c b/src/lib/selfboot.c index 6f200fa..bd1206f 100644 --- a/src/lib/selfboot.c +++ b/src/lib/selfboot.c @@ -302,14 +302,16 @@ static int relocate_segment(unsigned long buffer, struct segment *seg) static int build_self_segment_list( struct segment *head, struct lb_memory *mem, - struct cbfs_payload *payload, uintptr_t *entry) + struct payload *payload, uintptr_t *entry) { struct segment *new; struct segment *ptr; struct cbfs_payload_segment *segment, *first_segment; + struct cbfs_payload *cbfs_payload; + cbfs_payload = payload->backing_store.data; memset(head, 0, sizeof(*head)); head->next = head->prev = head; - first_segment = segment = &payload->segments; + first_segment = segment = &cbfs_payload->segments;
while(1) { printk(BIOS_DEBUG, "Loading segment from rom address 0x%p\n", segment); @@ -394,7 +396,7 @@ static int build_self_segment_list( static int load_self_segments( struct segment *head, struct lb_memory *mem, - struct cbfs_payload *payload) + struct payload *payload) { struct segment *ptr;
@@ -500,7 +502,7 @@ static int load_self_segments( return 1; }
-void *selfload(struct lb_memory *mem, struct cbfs_payload *payload) +void *selfload(struct lb_memory *mem, struct payload *payload) { uintptr_t entry = 0; struct segment head;