riscv: resume needs to be a global
If we take an exception before u-boot is relocated, there's a good chance we will end up in an endless loop of exceptions because resume is invalid until after relocation. Signed-off-by: Anton Blanchard <antonb@tenstorrent.com> Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
This commit is contained in:

committed by
Leo Yu-Chi Liang

parent
9d688e6da5
commit
8e1acda14e
@@ -42,6 +42,7 @@ struct arch_global_data {
|
|||||||
#ifdef CONFIG_SMBIOS
|
#ifdef CONFIG_SMBIOS
|
||||||
ulong smbios_start; /* Start address of SMBIOS table */
|
ulong smbios_start; /* Start address of SMBIOS table */
|
||||||
#endif
|
#endif
|
||||||
|
struct resume_data *resume;
|
||||||
};
|
};
|
||||||
|
|
||||||
#include <asm-generic/global_data.h>
|
#include <asm-generic/global_data.h>
|
||||||
|
@@ -22,11 +22,9 @@
|
|||||||
|
|
||||||
DECLARE_GLOBAL_DATA_PTR;
|
DECLARE_GLOBAL_DATA_PTR;
|
||||||
|
|
||||||
static struct resume_data *resume;
|
|
||||||
|
|
||||||
void set_resume(struct resume_data *data)
|
void set_resume(struct resume_data *data)
|
||||||
{
|
{
|
||||||
resume = data;
|
gd->arch.resume = data;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void show_efi_loaded_images(uintptr_t epc)
|
static void show_efi_loaded_images(uintptr_t epc)
|
||||||
@@ -138,9 +136,9 @@ static void _exit_trap(ulong code, ulong epc, ulong tval, struct pt_regs *regs)
|
|||||||
"Store/AMO page fault",
|
"Store/AMO page fault",
|
||||||
};
|
};
|
||||||
|
|
||||||
if (resume) {
|
if (gd->arch.resume) {
|
||||||
resume->code = code;
|
gd->arch.resume->code = code;
|
||||||
longjmp(resume->jump, 1);
|
longjmp(gd->arch.resume->jump, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (code < ARRAY_SIZE(exception_code))
|
if (code < ARRAY_SIZE(exception_code))
|
||||||
|
Reference in New Issue
Block a user