[coreboot-gerrit] Change in coreboot[master]: lib/prog_loaders: Move argument selection into selfload
Patrick Rudolph (Code Review)
gerrit at coreboot.org
Thu Apr 26 10:37:35 CEST 2018
Patrick Rudolph has uploaded this change for review. ( https://review.coreboot.org/25861
Change subject: lib/prog_loaders: Move argument selection into selfload
......................................................................
lib/prog_loaders: Move argument selection into selfload
Set the payload argument in selfload, as other (non self) payloads, are
going to set a different argument.
Change-Id: I994f604fc4501e0e3b00165819f796b1b8275d8c
---
M src/arch/arm64/arm_tf.c
M src/include/program_loading.h
M src/lib/prog_loaders.c
M src/lib/selfboot.c
4 files changed, 13 insertions(+), 11 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/61/25861/1
diff --git a/src/arch/arm64/arm_tf.c b/src/arch/arm64/arm_tf.c
index 69e83c1..2df9842 100644
--- a/src/arch/arm64/arm_tf.c
+++ b/src/arch/arm64/arm_tf.c
@@ -50,9 +50,9 @@
if (prog_locate(&bl31))
die("BL31 not found");
- bl31_entry = selfload(&bl31, false);
- if (!bl31_entry)
+ if (!selfload(&bl31, false))
die("BL31 load failed");
+ bl31_entry = (void *)bl31.entry;
SET_PARAM_HEAD(&bl31_params, PARAM_BL31, VERSION_1, 0);
diff --git a/src/include/program_loading.h b/src/include/program_loading.h
index 416e2e9..9d1b637 100644
--- a/src/include/program_loading.h
+++ b/src/include/program_loading.h
@@ -193,10 +193,10 @@
/*
* Set check_regions to true to check that the payload targets usable memory.
* With this flag set, if it does not, the load will fail and this function
- * will return NULL.
+ * will return false. On successful payload loading this functions return true.
*
* Defined in src/lib/selfboot.c
*/
-void *selfload(struct prog *payload, bool check_regions);
+bool selfload(struct prog *payload, bool check_regions);
#endif /* PROGRAM_LOADING_H */
diff --git a/src/lib/prog_loaders.c b/src/lib/prog_loaders.c
index 128869b..82548bd 100644
--- a/src/lib/prog_loaders.c
+++ b/src/lib/prog_loaders.c
@@ -29,6 +29,7 @@
#include <stage_cache.h>
#include <symbols.h>
#include <timestamp.h>
+#include <cbfs.h>
/* Only can represent up to 1 byte less than size_t. */
const struct mem_region_device addrspace_32bit =
@@ -179,9 +180,7 @@
mirror_payload(payload);
- /* Pass cbtables to payload if architecture desires it. */
- prog_set_entry(payload, selfload(payload, true),
- cbmem_find(CBMEM_ID_CBTABLE));
+ selfload(payload, true);
out:
if (prog_entry(payload) == NULL)
diff --git a/src/lib/selfboot.c b/src/lib/selfboot.c
index 1cf32e5..534b33d 100644
--- a/src/lib/selfboot.c
+++ b/src/lib/selfboot.c
@@ -28,6 +28,7 @@
#include <bootmem.h>
#include <program_loading.h>
#include <timestamp.h>
+#include <cbmem.h>
static const unsigned long lb_start = (unsigned long)&_program;
static const unsigned long lb_end = (unsigned long)&_eprogram;
@@ -512,7 +513,7 @@
return 1;
}
-void *selfload(struct prog *payload, bool check_regions)
+bool selfload(struct prog *payload, bool check_regions)
{
uintptr_t entry = 0;
struct segment head;
@@ -521,7 +522,7 @@
data = rdev_mmap_full(prog_rdev(payload));
if (data == NULL)
- return NULL;
+ return false;
/* Preprocess the self segments */
if (!build_self_segment_list(&head, data, &entry))
@@ -538,9 +539,11 @@
/* Update the payload's area with the bounce buffer information. */
prog_set_area(payload, (void *)(uintptr_t)bounce_buffer, bounce_size);
- return (void *)entry;
+ /* Pass cbtables to payload if architecture desires it. */
+ prog_set_entry(payload, (void *)entry, cbmem_find(CBMEM_ID_CBTABLE));
+ return true;
out:
rdev_munmap(prog_rdev(payload), data);
- return NULL;
+ return false;
}
--
To view, visit https://review.coreboot.org/25861
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I994f604fc4501e0e3b00165819f796b1b8275d8c
Gerrit-Change-Number: 25861
Gerrit-PatchSet: 1
Gerrit-Owner: Patrick Rudolph <patrick.rudolph at 9elements.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.coreboot.org/pipermail/coreboot-gerrit/attachments/20180426/c3f638de/attachment-0001.html>
More information about the coreboot-gerrit
mailing list