panic.c 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /*
  2. * Copyright (C) 2003 Richard Curnow, SuperH UK Limited
  3. *
  4. * This file is subject to the terms and conditions of the GNU General Public
  5. * License. See the file "COPYING" in the main directory of this archive
  6. * for more details.
  7. */
  8. #include <linux/kernel.h>
  9. #include <asm/io.h>
  10. #include <cpu/registers.h>
  11. /* THIS IS A PHYSICAL ADDRESS */
  12. #define HDSP2534_ADDR (0x04002100)
  13. #ifdef CONFIG_SH_CAYMAN
  14. static void poor_mans_delay(void)
  15. {
  16. int i;
  17. for (i = 0; i < 2500000; i++) {
  18. } /* poor man's delay */
  19. }
  20. static void show_value(unsigned long x)
  21. {
  22. int i;
  23. unsigned nibble;
  24. for (i = 0; i < 8; i++) {
  25. nibble = ((x >> (i * 4)) & 0xf);
  26. ctrl_outb(nibble + ((nibble > 9) ? 55 : 48),
  27. HDSP2534_ADDR + 0xe0 + ((7 - i) << 2));
  28. }
  29. }
  30. #endif
  31. void
  32. panic_handler(unsigned long panicPC, unsigned long panicSSR,
  33. unsigned long panicEXPEVT)
  34. {
  35. #ifdef CONFIG_SH_CAYMAN
  36. while (1) {
  37. /* This piece of code displays the PC on the LED display */
  38. show_value(panicPC);
  39. poor_mans_delay();
  40. show_value(panicSSR);
  41. poor_mans_delay();
  42. show_value(panicEXPEVT);
  43. poor_mans_delay();
  44. }
  45. #endif
  46. /* Never return from the panic handler */
  47. for (;;) ;
  48. }