Fix the exception occuring in RAM table search issue.
The original search_one_table() function code can only processes the search for the exception occurring in FLASH/ROM, because the exception and fixup table usually locate in FLASH. If the exception address is also in FLASH, it will be OK. If the exception occurs in RAM, after the u-boot relocation, a relocation offset should be added. clean up the code in cpu/74xx_7xx/cpu.c Signed-off-by: Roy Zang <tie-fei.zang@freescale.com>
This commit is contained in:
parent
e0b369e4f7
commit
c9c1eeed7d
|
@ -164,6 +164,10 @@ int checkcpu (void)
|
||||||
str = "MPC7410";
|
str = "MPC7410";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case CPU_7447A:
|
||||||
|
str = "MPC7447A";
|
||||||
|
break;
|
||||||
|
|
||||||
case CPU_7448:
|
case CPU_7448:
|
||||||
str = "MPC7448";
|
str = "MPC7448";
|
||||||
break;
|
break;
|
||||||
|
@ -180,14 +184,6 @@ int checkcpu (void)
|
||||||
str = "MPC7457";
|
str = "MPC7457";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CPU_7447A:
|
|
||||||
str = "MPC7447A";
|
|
||||||
break;
|
|
||||||
|
|
||||||
case CPU_7448:
|
|
||||||
str = "MPC7448";
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
printf("Unknown CPU -- PVR: 0x%08x\n", pvr);
|
printf("Unknown CPU -- PVR: 0x%08x\n", pvr);
|
||||||
return -1;
|
return -1;
|
||||||
|
|
|
@ -439,6 +439,5 @@
|
||||||
*/
|
*/
|
||||||
#define BOOTFLAG_COLD 0x01 /* Normal Power-On: Boot from FLASH */
|
#define BOOTFLAG_COLD 0x01 /* Normal Power-On: Boot from FLASH */
|
||||||
#define BOOTFLAG_WARM 0x02 /* Software reboot */
|
#define BOOTFLAG_WARM 0x02 /* Software reboot */
|
||||||
#define CFG_EXCEPTION_AFTER_RELOCATE
|
|
||||||
#define CFG_SERIAL_HANG_IN_EXCEPTION
|
#define CFG_SERIAL_HANG_IN_EXCEPTION
|
||||||
#endif /* __CONFIG_H */
|
#endif /* __CONFIG_H */
|
||||||
|
|
|
@ -57,16 +57,22 @@ search_one_table(const struct exception_table_entry *first,
|
||||||
long diff;
|
long diff;
|
||||||
|
|
||||||
mid = (last - first) / 2 + first;
|
mid = (last - first) / 2 + first;
|
||||||
#ifdef CFG_EXCEPTION_AFTER_RELOCATE
|
if (mid > CFG_MONITOR_BASE){
|
||||||
diff = (mid->insn + gd->reloc_off) - value;
|
/* exception occurs in FLASH, before u-boot relocation.
|
||||||
if (diff == 0)
|
* No relocation offset is needed.
|
||||||
return (mid->fixup + gd->reloc_off);
|
*/
|
||||||
#else
|
|
||||||
diff = mid->insn - value;
|
diff = mid->insn - value;
|
||||||
if (diff == 0)
|
if (diff == 0)
|
||||||
return mid->fixup;
|
return mid->fixup;
|
||||||
#endif
|
} else {
|
||||||
else if (diff < 0)
|
/* exception occurs in RAM, after u-boot relocation.
|
||||||
|
* A relocation offset should be added.
|
||||||
|
*/
|
||||||
|
diff = (mid->insn + gd->reloc_off) - value;
|
||||||
|
if (diff == 0)
|
||||||
|
return (mid->fixup + gd->reloc_off);
|
||||||
|
}
|
||||||
|
if (diff < 0)
|
||||||
first = mid+1;
|
first = mid+1;
|
||||||
else
|
else
|
||||||
last = mid-1;
|
last = mid-1;
|
||||||
|
@ -83,6 +89,7 @@ search_exception_table(unsigned long addr)
|
||||||
|
|
||||||
/* There is only the kernel to search. */
|
/* There is only the kernel to search. */
|
||||||
ret = search_one_table(__start___ex_table, __stop___ex_table-1, addr);
|
ret = search_one_table(__start___ex_table, __stop___ex_table-1, addr);
|
||||||
|
/* if the serial port does not hang in exception, printf can be used */
|
||||||
#if !defined(CFG_SERIAL_HANG_IN_EXCEPTION)
|
#if !defined(CFG_SERIAL_HANG_IN_EXCEPTION)
|
||||||
if (ex_tab_message)
|
if (ex_tab_message)
|
||||||
printf("Bus Fault @ 0x%08lx, fixup 0x%08lx\n", addr, ret);
|
printf("Bus Fault @ 0x%08lx, fixup 0x%08lx\n", addr, ret);
|
||||||
|
|
Loading…
Reference in New Issue