selfboot: Move the usable-RAM check into a function
In preparation for making this check optional, move it into its own function. load_self_segments() is already long and we don't want to make it longer. BUG=chrome-os-partner:56314 BRANCH=none TEST=boot on gru and see that BL31 loads and runs correctly Change-Id: If48d2bf485a23f21c5599670e77a7b8b098f1a88 Signed-off-by: Martin Roth <martinroth@chromium.org> Original-Commit-Id: 2381e02efa2033857ac06acbc4f0c0dd08de1080 Original-Change-Id: I005e5e4d9b2136605bdd95e9060655df7a8238cb Original-Signed-off-by: Simon Glass <sjg@chromium.org> Original-Reviewed-on: https://chromium-review.googlesource.com/381092 Original-Reviewed-by: Aaron Durbin <adurbin@chromium.org> Reviewed-on: https://review.coreboot.org/16585 Tested-by: build bot (Jenkins) Reviewed-by: Nico Huber <nico.h@gmx.de> Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
This commit is contained in:
parent
17c2b94ac1
commit
78c63860a6
|
@ -328,13 +328,10 @@ static int build_self_segment_list(
|
|||
return 1;
|
||||
}
|
||||
|
||||
static int load_self_segments(
|
||||
struct segment *head,
|
||||
struct prog *payload)
|
||||
static int payload_targets_usable_ram(struct segment *head)
|
||||
{
|
||||
struct segment *ptr;
|
||||
const unsigned long one_meg = (1UL << 20);
|
||||
unsigned long bounce_high = lb_end;
|
||||
struct segment *ptr;
|
||||
|
||||
for (ptr = head->next; ptr != head; ptr = ptr->next) {
|
||||
if (bootmem_region_targets_usable_ram(ptr->s_dstaddr,
|
||||
|
@ -344,7 +341,7 @@ static int load_self_segments(
|
|||
if (ptr->s_dstaddr < one_meg &&
|
||||
(ptr->s_dstaddr + ptr->s_memsz) <= one_meg) {
|
||||
printk(BIOS_DEBUG,
|
||||
"Payload being loaded below 1MiB "
|
||||
"Payload being loaded at below 1MiB "
|
||||
"without region being marked as RAM usable.\n");
|
||||
continue;
|
||||
}
|
||||
|
@ -357,6 +354,19 @@ static int load_self_segments(
|
|||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int load_self_segments(
|
||||
struct segment *head,
|
||||
struct prog *payload)
|
||||
{
|
||||
struct segment *ptr;
|
||||
unsigned long bounce_high = lb_end;
|
||||
|
||||
if (!payload_targets_usable_ram(head))
|
||||
return 0;
|
||||
|
||||
for(ptr = head->next; ptr != head; ptr = ptr->next) {
|
||||
/*
|
||||
* Add segments to bootmem memory map before a bounce buffer is
|
||||
|
|
Loading…
Reference in New Issue