public
Created

Gratuitous console debug for sgimips O2; trying to zero in on random hard lock up.

  • Download Gist
netbsd-sgimips-crime-debug
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411
Index: dev/crime.c
===================================================================
RCS file: /cvsroot/src/sys/arch/sgimips/dev/crime.c,v
retrieving revision 1.36
diff -u -r1.36 crime.c
--- dev/crime.c 18 Aug 2011 02:56:21 -0000 1.36
+++ dev/crime.c 18 Mar 2013 21:37:00 -0000
@@ -98,6 +98,8 @@
static void
crime_attach(device_t parent, device_t self, void *aux)
{
+ aprint_debug("XXX2013-RPF crime_attach()!\n");
+
struct mainbus_attach_args *ma = aux;
struct cpu_info * const ci = curcpu();
struct crime_softc *sc = device_private(self);
@@ -196,11 +198,18 @@
crime_intr_establish(int irq, int level, int (*func)(void *), void *arg)
{
- if (irq < 16)
+ if (irq < 16) {
+ aprint_error("XXX2013-RPF mace_intr_establish(%d, %d) via crime_intr_establish()!\n",
+ irq, level);
+
return mace_intr_establish(irq, level, func, arg);
+ }
+ aprint_debug("XXX2013-RPF crime_intr_establish(%d, %d)!\n", irq, level);
- if (crime[irq].func != NULL)
+ if (crime[irq].func != NULL) {
+ aprint_error("XXX2013-RPF crime_intr_establish() crime irq %d: func was NULL!\n", irq);
return NULL; /* panic("Cannot share CRIME interrupts!"); */
+ }
crime[irq].func = func;
crime[irq].arg = arg;
@@ -219,12 +228,16 @@
uint64_t address, stat;
int i;
+ aprint_error("XXX2013-RPF crime_intr(%u, %u, %u)!\n", pc, status, ipending);
crime_intmask = bus_space_read_8(crm_iot, crm_ioh, CRIME_INTMASK);
crime_intstat = bus_space_read_8(crm_iot, crm_ioh, CRIME_INTSTAT);
crime_ipending = (crime_intstat & crime_intmask);
- if (crime_ipending & 0xffff)
+ if (crime_ipending & 0xffff) {
+ aprint_error("XXX2013-RPF -> mace_intr(%llu)\n",
+ crime_ipending & 0xffff);
mace_intr(crime_ipending & 0xffff);
+ }
if (crime_ipending & 0xffff0000) {
/*
@@ -238,6 +251,8 @@
printf("crime: memory error address %" PRIu64
" status %" PRIu64 "\n", address << 2, stat);
crime_bus_reset();
+
+ //panic("XXX2013-RPF memory error");
}
if (crime_ipending & CRIME_INT_CRMERR) {
@@ -248,17 +263,32 @@
bus_space_read_8(crm_iot, crm_ioh,
CRIME_CPU_ERROR_ADDR));
crime_bus_reset();
+ //panic("XXX2013-RPF cpu error");
}
}
crime_ipending &= ~0xffff;
if (crime_ipending) {
+ aprint_debug("XXX2013-RPF crime_intr crime_ipending %llu\n", crime_ipending);
for (i = 16; i < CRIME_NINTR; i++) {
- if ((crime_ipending & (1 << i)) &&
- crime[i].func != NULL)
- (*crime[i].func)(crime[i].arg);
+
+ if (crime_ipending & (1 << i)) {
+ if (crime[i].func != NULL) {
+ aprint_debug("C%d:->(%llu)(%p) ",
+ i, crime_ipending & (1 << i),
+ crime[i].func);
+ (*crime[i].func)(crime[i].arg);
+ } else {
+ aprint_debug("XXX2013-RPF crime_intr GOOD CATCH at [%d]\n", i);
+ }
+ } else {
+ aprint_debug("C%d:%llu ", i, crime_ipending & (1 << i));
+ }
}
+ aprint_debug("done\n");
+ } else {
+ aprint_debug("XXX2013-RPF <- !crime_ipending %llu\n", crime_ipending);
}
}
@@ -266,7 +296,7 @@
crime_intr_mask(unsigned int intr)
{
uint64_t mask;
-
+ aprint_debug("XXX2013-RPF crime_intr_mask(%d)!\n", intr);
mask = bus_space_read_8(crm_iot, crm_ioh, CRIME_INTMASK);
mask |= (1 << intr);
bus_space_write_8(crm_iot, crm_ioh, CRIME_INTMASK, mask);
@@ -277,6 +307,7 @@
{
uint64_t mask;
+ aprint_debug("XXX2013-RPF crime_intr_unmask(%d)!\n", intr);
mask = bus_space_read_8(crm_iot, crm_ioh, CRIME_INTMASK);
mask &= ~(1 << intr);
bus_space_write_8(crm_iot, crm_ioh, CRIME_INTMASK, mask);
@@ -285,15 +316,19 @@
void
crime_bus_reset(void)
{
+ aprint_error("XXX2013-RPF: crime_bus_reset ...\n");
bus_space_write_8(crm_iot, crm_ioh, CRIME_CPU_ERROR_STAT, 0);
bus_space_write_8(crm_iot, crm_ioh, CRIME_MEM_ERROR_STAT, 0);
+
+ aprint_error("XXX2013-RPF: crime_bus_reset done!\n");
}
void
crime_watchdog_reset(void)
{
+// printf("XXX2013-RPF crime_watchdog_reset()!\n");
#ifdef DISABLE_CRIME_WATCHDOG
bus_space_write_8(crm_iot, crm_ioh, CRIME_WATCHDOG, 0);
#else
@@ -309,6 +344,7 @@
{
uint64_t reg;
+ aprint_debug("XXX2013-RPF crime_watchdog_disable()!\n");
bus_space_write_8(crm_iot, crm_ioh, CRIME_WATCHDOG, 0);
reg = bus_space_read_8(crm_iot, crm_ioh, CRIME_CONTROL)
& ~CRIME_CONTROL_DOG_ENABLE;
@@ -319,6 +355,7 @@
crime_reboot(void)
{
+ aprint_debug("XXX2013-RPF crime_reboot()!\n");
bus_space_write_8(crm_iot, crm_ioh, CRIME_CONTROL,
CRIME_CONTROL_HARD_RESET);
for (;;)
Index: dev/zs_kgdb.c
===================================================================
RCS file: /cvsroot/src/sys/arch/sgimips/dev/zs_kgdb.c,v
retrieving revision 1.15
diff -u -r1.15 zs_kgdb.c
--- dev/zs_kgdb.c 18 Mar 2009 10:22:35 -0000 1.15
+++ dev/zs_kgdb.c 18 Mar 2013 21:37:00 -0000
@@ -137,7 +137,7 @@
unit = (kgdb_dev & 2) ? 1 : 0; /* XXX ??? */
channel = kgdb_dev & 1;
printf("zs_kgdb_init: attaching to Serial(%d) at %d baud\n",
- (kgdb_dev & 3), kgdb_rate);
+ (int)(kgdb_dev & 3), (int)kgdb_rate);
zc = zs_get_chan_addr(unit, channel);
Index: mace/mace.c
===================================================================
RCS file: /cvsroot/src/sys/arch/sgimips/mace/mace.c,v
retrieving revision 1.19
diff -u -r1.19 mace.c
--- mace/mace.c 27 Oct 2012 17:18:10 -0000 1.19
+++ mace/mace.c 18 Mar 2013 21:37:00 -0000
@@ -132,8 +132,11 @@
struct mainbus_attach_args *ma = aux;
uint32_t scratch;
+ aprint_debug("XXX2013-RPF mace_attach()\n");
+
sc->sc_dev = self;
#ifdef BLINK
+ aprint_debug("XXX2013-RPF mace_attach() setting BLINK\n");
callout_init(&mace_blink_ch, 0);
#endif
@@ -233,10 +236,15 @@
{
int i;
+
+ aprint_debug("XXX2013-RPF mace_intr_establish(%d, %d)!\n", intr, level);
+
if (intr < 0 || intr >= 16)
panic("invalid interrupt number");
- for (i = 0; i < MACE_NINTR; i++)
+ for (i = 0; i < MACE_NINTR; i++) {
+ aprint_debug("XXX2013-RPF mace_intr_establish(%d, %d)!: [%d] \n",
+ intr, level, i);
if (maceintrtab[i].func == NULL) {
maceintrtab[i].func = func;
maceintrtab[i].arg = arg;
@@ -248,8 +256,10 @@
evcnt_attach_dynamic(&maceintrtab[i].evcnt,
EVCNT_TYPE_INTR, NULL,
"mace", maceintrtab[i].evname);
+ aprint_debug("XXX2013-RPF [%d] installing handler irq %d level %d: %s\n", i, (1 << intr), level, maceintrtab[i].evname);
break;
}
+ }
crime_intr_mask(intr);
aprint_debug("mace: established interrupt %d (level %x)\n",
@@ -262,8 +272,11 @@
{
int intr = -1, level = 0, irq = 0, i;
+ aprint_debug("XXX2013-RPF mace_intr_disestablish()!\n");
for (i = 0; i < MACE_NINTR; i++)
+
if (&maceintrtab[i] == cookie) {
+ aprint_debug("XXX2013-RPF +++ [%d] matched cookie(%s)\n", i, maceintrtab[i].evname);
evcnt_detach(&maceintrtab[i].evcnt);
for (intr = 0;
maceintrtab[i].irq == (1 << intr); intr++);
@@ -300,25 +313,58 @@
/* irq 4 is the ISA cascade interrupt. Must handle with care. */
if (irqs & (1 << 4)) {
+ aprint_debug("XXX2013-RPF -> IRQ4 mace_intr(%d) is IRQ 4!!! \n", irqs);
+
isa_mask = mips3_ld((volatile uint64_t *)MIPS_PHYS_TO_KSEG1(MACE_BASE
+ MACE_ISA_INT_MASK));
isa_irq = mips3_ld((volatile uint64_t *)MIPS_PHYS_TO_KSEG1(MACE_BASE
+ MACE_ISA_INT_STATUS));
+
+ aprint_debug("XXX2013-RPF -> IRQ4 mace_intr(%d) completed mips3_ld() \n", irqs);
+
for (i = 0; i < MACE_NINTR; i++) {
+
if ((maceintrtab[i].irq == (1 << 4)) &&
- (isa_irq & maceintrtab[i].intrmask)) {
- (maceintrtab[i].func)(maceintrtab[i].arg);
- maceintrtab[i].evcnt.ev_count++;
- }
+ (isa_irq & maceintrtab[i].intrmask)) {
+ if (maceintrtab[i].func != NULL) {
+ aprint_debug("M4:%d:->(%p) ", i, maceintrtab[i].func);
+ (maceintrtab[i].func)(maceintrtab[i].arg);
+ maceintrtab[i].evcnt.ev_count++;
+ } else {
+ aprint_debug("XXX2013-RPF IRQ4 GOOD CATCH at [%d] irq %d;\n",
+ i, irqs);
+ }
+ } else {
+ aprint_debug("M4:%d:%d ", i, irqs);
+ }
}
+ aprint_debug("done\n");
irqs &= ~(1 << 4);
}
- for (i = 0; i < MACE_NINTR; i++)
+ aprint_debug("XXX2013-RPF -> mace_inst(%d): processing non-IRQ 4\n", irqs);
+
+ for (i = 0; i < MACE_NINTR; i++) {
+
if ((irqs & maceintrtab[i].irq)) {
- (maceintrtab[i].func)(maceintrtab[i].arg);
+
+ if (maceintrtab[i].func != NULL) {
+
+ aprint_debug("M%d:->(%p) ", i, maceintrtab[i].func);
+
+ (maceintrtab[i].func)(maceintrtab[i].arg);
+
+ } else {
+ aprint_debug("XXX2013-RPF GOOD CATCH at [%d] irq %d;\n",
+ i, irqs);
+ }
+
maceintrtab[i].evcnt.ev_count++;
+ } else {
+ aprint_debug("M%d:%d ", i, irqs);
}
+ }
+ aprint_debug("done\n");
}
#if defined(BLINK)
Index: mace/mavb.c
===================================================================
RCS file: /cvsroot/src/sys/arch/sgimips/mace/mavb.c,v
retrieving revision 1.9
diff -u -r1.9 mavb.c
--- mace/mavb.c 27 Oct 2012 17:18:10 -0000 1.9
+++ mace/mavb.c 18 Mar 2013 21:37:01 -0000
@@ -38,7 +38,8 @@
#include <dev/ic/ad1843reg.h>
-#undef MAVB_DEBUG
+/* #undef MAVB_DEBUG */
+#define MAVB_DEBUG
#ifdef MAVB_DEBUG
#define DPRINTF(l,x) do { if (mavb_debug & (l)) printf x; } while (0)
Index: sgimips/bus.c
===================================================================
RCS file: /cvsroot/src/sys/arch/sgimips/sgimips/bus.c,v
retrieving revision 1.65
diff -u -r1.65 bus.c
--- sgimips/bus.c 2 Oct 2012 23:54:54 -0000 1.65
+++ sgimips/bus.c 18 Mar 2013 21:37:01 -0000
@@ -906,9 +906,12 @@
addr = map->dm_segs[i].ds_addr;
#ifdef BUS_DMA_DEBUG
+ aprint_debug("XXX2013-RPF _bus_dmamap_sync_mips1: flushing segment %d\n", i);
+/*
printf("bus_dmamap_sync_mips1: flushing segment %d "
"(0x%lx..0x%lx) ...", i, addr + offset,
addr + offset + minlen - 1);
+*/
#endif
mips_dcache_inv_range(
MIPS_PHYS_TO_KSEG0(addr + offset), minlen);
@@ -1019,9 +1022,14 @@
vaddr = map->dm_segs[i]._ds_vaddr;
#ifdef BUS_DMA_DEBUG
+
+ aprint_debug("XXX2013-RPF _bus_dmamap_sync_mips3: flushing segment %d ", i);
+
+/*
printf("bus_dmamap_sync_mips3: flushing segment %d "
"(0x%lx+%lx, 0x%lx+0x%lx) (olen = %ld)...", i,
vaddr, offset, vaddr, offset + minlen - 1, len);
+*/
#endif
/*
@@ -1071,6 +1079,7 @@
}
#ifdef BUS_DMA_DEBUG
printf("\n");
+
#endif
offset = 0;
len -= minlen;
Index: sgimips/console.c
===================================================================
RCS file: /cvsroot/src/sys/arch/sgimips/sgimips/console.c,v
retrieving revision 1.43
diff -u -r1.43 console.c
--- sgimips/console.c 13 Oct 2012 17:58:54 -0000 1.43
+++ sgimips/console.c 18 Mar 2013 21:37:01 -0000
@@ -222,6 +222,8 @@
base = (consdev[7] == '0') ? MACE_ISA_SER1_BASE :
MACE_ISA_SER2_BASE;
+ aprint_debug("XXX2013-RPF mace_serial_init: dbaud %s; speed %d\n", dbaud, speed);
+
delay(10000);
/* XXX: hardcoded MACE iotag */
@@ -240,9 +242,11 @@
{
# if (NCOM > 0)
# define KGDB_DEVMODE ((TTYDEF_CFLAG & ~(CSIZE | CSTOPB | PARENB)) | CS8)
- if (mach_type == MACH_SGI_IP32)
+ if (mach_type == MACH_SGI_IP32) {
+ aprint_debug("XXX2013-RPF kgdb_port_init\n");
com_kgdb_attach(SGIMIPS_BUS_SPACE_MACE, 0xbf398000, 9600, COM_FREQ, COM_TYPE_NORMAL,
KGDB_DEVMODE);
+ }
# endif /* (NCOM > 0) */
# if (NZSC > 0)
Index: sgimips/machdep.c
===================================================================
RCS file: /cvsroot/src/sys/arch/sgimips/sgimips/machdep.c,v
retrieving revision 1.138
diff -u -r1.138 machdep.c
--- sgimips/machdep.c 27 Oct 2012 17:18:10 -0000 1.138
+++ sgimips/machdep.c 18 Mar 2013 21:37:01 -0000
@@ -332,6 +332,8 @@
cpufreq = arcbios_GetEnvironmentVariable("cpufreq");
+ aprint_debug("XXX2013-RPF mach_init(): CPUFREQ %s\n", cpufreq);
+
if (cpufreq == 0)
panic("no $cpufreq");
@@ -906,10 +908,12 @@
{
switch (where) {
case 1: /* Entry to DDB, turn watchdog off */
+ aprint_debug("XXX2013-RPF dbb_trap_hook enabled\n");
(void)(*platform.watchdog_disable)();
break;
case 0: /* Exit from DDB, turn watchdog back on */
+ aprint_debug("XXX2013-RPF dbb_trap_hook disabled\n");
(void)(*platform.watchdog_enable)();
break;
}

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.