Skip to content
Snippets Groups Projects
Commit 3f5f18d1 authored by Graeme Russ's avatar Graeme Russ Committed by Wolfgang Denk
Browse files

Moved generic (triple fault) reset code


Moved from interrupts.c to cpu.c and made into a weak function to
allow vendor specific override

Vendor specific CPU reset (like the AMD SC520 MMCR reset) can now be
added to the vendor specific code without the need to remember to
#undef usage of the generic method and if you forget to include your
custom reset method, you will always get the default.

Signed-off-by: default avatarGraeme Russ <graeme.russ@gmail.com>
parent 9933d609
No related branches found
No related tags found
No related merge requests found
...@@ -35,6 +35,7 @@ ...@@ -35,6 +35,7 @@
#include <common.h> #include <common.h>
#include <command.h> #include <command.h>
#include <asm/interrupt.h>
int cpu_init(void) int cpu_init(void)
{ {
...@@ -64,3 +65,19 @@ void flush_cache (unsigned long dummy1, unsigned long dummy2) ...@@ -64,3 +65,19 @@ void flush_cache (unsigned long dummy1, unsigned long dummy2)
asm("wbinvd\n"); asm("wbinvd\n");
return; return;
} }
void __attribute__ ((regparm(0))) generate_gpf(void);
/* segment 0x70 is an arbitrary segment which does not exist */
asm(".globl generate_gpf\n"
"generate_gpf:\n"
"ljmp $0x70, $0x47114711\n");
void __reset_cpu(ulong addr)
{
printf("Resetting using i386 Triple Fault\n");
set_vector(13, generate_gpf); /* general protection fault handler */
set_vector(8, generate_gpf); /* double fault handler */
generate_gpf(); /* start the show */
}
void reset_cpu(ulong addr) __attribute__((weak, alias("__reset_cpu")));
...@@ -508,19 +508,3 @@ int disable_interrupts(void) ...@@ -508,19 +508,3 @@ int disable_interrupts(void)
return (flags&0x200); /* IE flags is bit 9 */ return (flags&0x200); /* IE flags is bit 9 */
} }
#ifdef CONFIG_SYS_RESET_GENERIC
void __attribute__ ((regparm(0))) generate_gpf(void);
asm(".globl generate_gpf\n"
"generate_gpf:\n"
"ljmp $0x70, $0x47114711\n"); /* segment 0x70 is an arbitrary segment which does not
* exist */
void reset_cpu(ulong addr)
{
set_vector(13, generate_gpf); /* general protection fault handler */
set_vector(8, generate_gpf); /* double fault handler */
generate_gpf(); /* start the show */
}
#endif
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment