die() when attempting to use bounce buffer on non-i386.

Only i386 has code to support bounce buffer. For others coreboot
would silently discard part of binary which doesn't work and is a hell to debug.

Instead just die.

Change-Id: I37ae24ea5d13aae95f9856a896700a0408747233
Signed-off-by: Vladimir Serbinenko <phcoder@gmail.com>
Reviewed-on: https://review.coreboot.org/13750
Tested-by: build bot (Jenkins)
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
This commit is contained in:
Vladimir Serbinenko 2016-02-19 16:44:22 +01:00
parent 4f22267b09
commit f0d39c409b
8 changed files with 36 additions and 0 deletions

View File

@ -25,3 +25,8 @@ void arch_prog_run(struct prog *prog)
doit = prog_entry(prog); doit = prog_entry(prog);
doit(prog_entry_arg(prog)); doit(prog_entry_arg(prog));
} }
int arch_supports_bounce_buffer(void)
{
return 0;
}

View File

@ -72,6 +72,11 @@ void arch_prog_run(struct prog *prog)
doit(prog_entry_arg(prog)); doit(prog_entry_arg(prog));
} }
int arch_supports_bounce_buffer(void)
{
return 0;
}
/* Generic stage entry point. Can be overridden by board/SoC if needed. */ /* Generic stage entry point. Can be overridden by board/SoC if needed. */
__attribute__((weak)) void stage_entry(void) __attribute__((weak)) void stage_entry(void)
{ {

View File

@ -23,3 +23,8 @@ void arch_prog_run(struct prog *prog)
doit(cb_tables); doit(cb_tables);
} }
int arch_supports_bounce_buffer(void)
{
return 0;
}

View File

@ -21,3 +21,8 @@ void arch_prog_run(struct prog *prog)
doit(prog_entry_arg(prog)); doit(prog_entry_arg(prog));
} }
int arch_supports_bounce_buffer(void)
{
return 0;
}

View File

@ -30,3 +30,8 @@ void arch_prog_run(struct prog *prog)
doit(prog_entry_arg(prog)); doit(prog_entry_arg(prog));
} }
} }
int arch_supports_bounce_buffer(void)
{
return 0;
}

View File

@ -192,6 +192,11 @@ static void jmp_payload(void *entry, unsigned long buffer, unsigned long size)
); );
} }
int arch_supports_bounce_buffer(void)
{
return 1;
}
static void try_payload(struct prog *prog) static void try_payload(struct prog *prog)
{ {
if (prog_type(prog) == PROG_PAYLOAD) { if (prog_type(prog) == PROG_PAYLOAD) {

View File

@ -41,6 +41,9 @@ enum prog_type {
* set on the last segment loaded. */ * set on the last segment loaded. */
void arch_segment_loaded(uintptr_t start, size_t size, int flags); void arch_segment_loaded(uintptr_t start, size_t size, int flags);
/* Return true if arch supports bounce buffer. */
int arch_supports_bounce_buffer(void);
/* Representation of a program. */ /* Representation of a program. */
struct prog { struct prog {
/* The region_device is the source of program content to load. After /* The region_device is the source of program content to load. After

View File

@ -114,6 +114,9 @@ static int relocate_segment(unsigned long buffer, struct segment *seg)
if (!overlaps_coreboot(seg)) if (!overlaps_coreboot(seg))
return 0; return 0;
if (!arch_supports_bounce_buffer())
die ("bounce buffer not supported");
start = seg->s_dstaddr; start = seg->s_dstaddr;
middle = start + seg->s_filesz; middle = start + seg->s_filesz;
end = start + seg->s_memsz; end = start + seg->s_memsz;