[U-Boot] [PATCH 8/9] MIPS: add handling for generic and EJTAG exceptions
Paul Burton
paul.burton at imgtec.com
Mon Sep 26 20:15:37 CEST 2016
On Monday, 26 September 2016 19:41:22 BST Daniel Schwierzeck wrote:
> 2016-09-26 12:29 GMT+02:00 Paul Burton <paul.burton at imgtec.com>:
> > Something I've had in the U-Boot source we use on Boston, Malta & SEAD-3
> > boards internally for a while is the ability to longjmp back to the shell
> > after an exception. It seems to work pretty well & generally means
> > exceptions are non-fatal. I'll submit that once this goes in.
>
> But this only works for commands issues at the U-Boot prompt? If the
> init code crashes,
> then you have no valid code to jump to.
Hi Daniel,
Yes, that's true. To end users though that's the typical case - when an
exception occurs it's generally because an address was typed incorrectly or
because the wrong size of access was used. Allowing the user to recover from
that by returning them to the prompt where they can simply push the up key &
modify the command they typed makes use much nicer.
>
> >> +
> >>
> >> + .macro RESTORE_TEMP
> >>
> >> + LONG_L $24, PT_LO(sp)
> >>
> >> + mtlo $24
> >>
> >> + LONG_L $24, PT_HI(sp)
> >>
> >> + mthi $24
> >
> > The hi & lo bits here & in the save code above need to be wrapped in "#if
> > __mips_isa_rev < 6", since the hi & lo registers were removed in MIPSr6.
>
> ok, I'll do a resync with Linux's arch/mips/include/asm/stackframe.h.
Sounds good :)
>
> >> +void trap_init(ulong reloc_addr)
> >>
> >> +{
> >>
> >> + unsigned long ebase = gd->irq_sp;
> >>
> >> +
> >>
> >> + set_handler(0x180, &except_vec3_generic, 0x80);
> >>
> >> + set_handler(0x280, &except_vec_ejtag_debug, 0x80);
> >>
> >> +
> >>
> >> + write_c0_ebase(ebase);
> >>
> >> + clear_c0_status(ST0_BEV);
> >
> > I think strictly speaking we should probably have an ehb instruction at
> > the
> > end of trap_init so that we know the new ebase takes effect straight away.
>
> Sounds plausible. Shall I import arch/mips/include/asm/hazards.h from Linux?
Could be good. I have a patch lying around which adds hazards.h to clear the
instruction hazard at the end of flush_cache, but it doesn't reuse the
instruction_hazard function from Linux because that caused problems when run
during relocation. I expect since my change to relocate_code that ought not to
be a problem anymore though & the Linux version will probably work fine, but I
haven't yet tested it.
> > With the R6 change mentioned above this works fine on a 64r6el (I6400)
> > Boston board, so feel free to add:
> >
> >
> >
> > Reviewed-by: Paul Burton <paul.burton at imgtec.com>
> >
> > Tested-by: Paul Burton <paul.burton at imgtec.com>
>
> thanks for testing and reviewing
No problem.
Thanks,
Paul
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160926/cfd6e5b5/attachment.sig>
More information about the U-Boot
mailing list