debug.c 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. /***********************************************************************
  2. *
  3. * Copyright 2001 MontaVista Software Inc.
  4. * Author: jsun@mvista.com or jsun@junsun.net
  5. *
  6. * arch/mips/ddb5xxx/ddb5477/debug.c
  7. * vrc5477 specific debug routines.
  8. *
  9. * This program is free software; you can redistribute it and/or modify it
  10. * under the terms of the GNU General Public License as published by the
  11. * Free Software Foundation; either version 2 of the License, or (at your
  12. * option) any later version.
  13. *
  14. ***********************************************************************
  15. */
  16. #include <linux/kernel.h>
  17. #include <asm/mipsregs.h>
  18. #include <asm/ddb5xxx/ddb5xxx.h>
  19. typedef struct {
  20. const char *regname;
  21. unsigned regaddr;
  22. } Register;
  23. void jsun_show_regs(char *name, Register *regs)
  24. {
  25. int i;
  26. printk("\nshow regs: %s\n", name);
  27. for(i=0;regs[i].regname!= NULL; i++) {
  28. printk("%-16s= %08x\t\t(@%08x)\n",
  29. regs[i].regname,
  30. *(unsigned *)(regs[i].regaddr),
  31. regs[i].regaddr);
  32. }
  33. }
  34. static Register int_regs[] = {
  35. {"DDB_INTCTRL0", DDB_BASE + DDB_INTCTRL0},
  36. {"DDB_INTCTRL1", DDB_BASE + DDB_INTCTRL1},
  37. {"DDB_INTCTRL2", DDB_BASE + DDB_INTCTRL2},
  38. {"DDB_INTCTRL3", DDB_BASE + DDB_INTCTRL3},
  39. {"DDB_INT0STAT", DDB_BASE + DDB_INT0STAT},
  40. {"DDB_INT1STAT", DDB_BASE + DDB_INT1STAT},
  41. {"DDB_INT2STAT", DDB_BASE + DDB_INT2STAT},
  42. {"DDB_INT3STAT", DDB_BASE + DDB_INT3STAT},
  43. {"DDB_INT4STAT", DDB_BASE + DDB_INT4STAT},
  44. {"DDB_NMISTAT", DDB_BASE + DDB_NMISTAT},
  45. {"DDB_INTPPES0", DDB_BASE + DDB_INTPPES0},
  46. {"DDB_INTPPES1", DDB_BASE + DDB_INTPPES1},
  47. {NULL, 0x0}
  48. };
  49. void vrc5477_show_int_regs()
  50. {
  51. jsun_show_regs("interrupt registers", int_regs);
  52. printk("CPU CAUSE = %08x\n", read_c0_cause());
  53. printk("CPU STATUS = %08x\n", read_c0_status());
  54. }
  55. static Register pdar_regs[] = {
  56. {"DDB_SDRAM0", DDB_BASE + DDB_SDRAM0},
  57. {"DDB_SDRAM1", DDB_BASE + DDB_SDRAM1},
  58. {"DDB_LCS0", DDB_BASE + DDB_LCS0},
  59. {"DDB_LCS1", DDB_BASE + DDB_LCS1},
  60. {"DDB_LCS2", DDB_BASE + DDB_LCS2},
  61. {"DDB_INTCS", DDB_BASE + DDB_INTCS},
  62. {"DDB_BOOTCS", DDB_BASE + DDB_BOOTCS},
  63. {"DDB_PCIW0", DDB_BASE + DDB_PCIW0},
  64. {"DDB_PCIW1", DDB_BASE + DDB_PCIW1},
  65. {"DDB_IOPCIW0", DDB_BASE + DDB_IOPCIW0},
  66. {"DDB_IOPCIW1", DDB_BASE + DDB_IOPCIW1},
  67. {NULL, 0x0}
  68. };
  69. void vrc5477_show_pdar_regs(void)
  70. {
  71. jsun_show_regs("PDAR regs", pdar_regs);
  72. }
  73. static Register bar_regs[] = {
  74. {"DDB_BARC0", DDB_BASE + DDB_BARC0},
  75. {"DDB_BARM010", DDB_BASE + DDB_BARM010},
  76. {"DDB_BARM230", DDB_BASE + DDB_BARM230},
  77. {"DDB_BAR00", DDB_BASE + DDB_BAR00},
  78. {"DDB_BAR10", DDB_BASE + DDB_BAR10},
  79. {"DDB_BAR20", DDB_BASE + DDB_BAR20},
  80. {"DDB_BAR30", DDB_BASE + DDB_BAR30},
  81. {"DDB_BAR40", DDB_BASE + DDB_BAR40},
  82. {"DDB_BAR50", DDB_BASE + DDB_BAR50},
  83. {"DDB_BARB0", DDB_BASE + DDB_BARB0},
  84. {"DDB_BARC1", DDB_BASE + DDB_BARC1},
  85. {"DDB_BARM011", DDB_BASE + DDB_BARM011},
  86. {"DDB_BARM231", DDB_BASE + DDB_BARM231},
  87. {"DDB_BAR01", DDB_BASE + DDB_BAR01},
  88. {"DDB_BAR11", DDB_BASE + DDB_BAR11},
  89. {"DDB_BAR21", DDB_BASE + DDB_BAR21},
  90. {"DDB_BAR31", DDB_BASE + DDB_BAR31},
  91. {"DDB_BAR41", DDB_BASE + DDB_BAR41},
  92. {"DDB_BAR51", DDB_BASE + DDB_BAR51},
  93. {"DDB_BARB1", DDB_BASE + DDB_BARB1},
  94. {NULL, 0x0}
  95. };
  96. void vrc5477_show_bar_regs(void)
  97. {
  98. jsun_show_regs("BAR regs", bar_regs);
  99. }
  100. static Register pci_regs[] = {
  101. {"DDB_PCIW0", DDB_BASE + DDB_PCIW0},
  102. {"DDB_PCIW1", DDB_BASE + DDB_PCIW1},
  103. {"DDB_PCIINIT00", DDB_BASE + DDB_PCIINIT00},
  104. {"DDB_PCIINIT10", DDB_BASE + DDB_PCIINIT10},
  105. {"DDB_PCICTL0_L", DDB_BASE + DDB_PCICTL0_L},
  106. {"DDB_PCICTL0_H", DDB_BASE + DDB_PCICTL0_H},
  107. {"DDB_PCIARB0_L", DDB_BASE + DDB_PCIARB0_L},
  108. {"DDB_PCIARB0_H", DDB_BASE + DDB_PCIARB0_H},
  109. {"DDB_PCISWP0", DDB_BASE + DDB_PCISWP0},
  110. {"DDB_PCIERR0", DDB_BASE + DDB_PCIERR0},
  111. {"DDB_IOPCIW0", DDB_BASE + DDB_IOPCIW0},
  112. {"DDB_IOPCIW1", DDB_BASE + DDB_IOPCIW1},
  113. {"DDB_PCIINIT01", DDB_BASE + DDB_PCIINIT01},
  114. {"DDB_PCIINIT11", DDB_BASE + DDB_PCIINIT11},
  115. {"DDB_PCICTL1_L", DDB_BASE + DDB_PCICTL1_L},
  116. {"DDB_PCICTL1_H", DDB_BASE + DDB_PCICTL1_H},
  117. {"DDB_PCIARB1_L", DDB_BASE + DDB_PCIARB1_L},
  118. {"DDB_PCIARB1_H", DDB_BASE + DDB_PCIARB1_H},
  119. {"DDB_PCISWP1", DDB_BASE + DDB_PCISWP1},
  120. {"DDB_PCIERR1", DDB_BASE + DDB_PCIERR1},
  121. {NULL, 0x0}
  122. };
  123. void vrc5477_show_pci_regs(void)
  124. {
  125. jsun_show_regs("PCI regs", pci_regs);
  126. }
  127. static Register lb_regs[] = {
  128. {"DDB_LCNFG", DDB_BASE + DDB_LCNFG},
  129. {"DDB_LCST0", DDB_BASE + DDB_LCST0},
  130. {"DDB_LCST1", DDB_BASE + DDB_LCST1},
  131. {"DDB_LCST2", DDB_BASE + DDB_LCST2},
  132. {"DDB_ERRADR", DDB_BASE + DDB_ERRADR},
  133. {"DDB_ERRCS", DDB_BASE + DDB_ERRCS},
  134. {"DDB_BTM", DDB_BASE + DDB_BTM},
  135. {"DDB_BCST", DDB_BASE + DDB_BCST},
  136. {NULL, 0x0}
  137. };
  138. void vrc5477_show_lb_regs(void)
  139. {
  140. jsun_show_regs("Local Bus regs", lb_regs);
  141. }
  142. void vrc5477_show_all_regs(void)
  143. {
  144. vrc5477_show_pdar_regs();
  145. vrc5477_show_pci_regs();
  146. vrc5477_show_bar_regs();
  147. vrc5477_show_int_regs();
  148. vrc5477_show_lb_regs();
  149. }