Port-sparc archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Sun4/110 "Panic: Crazy Interrupts"



Hi,

> I'm not sure exactly how (if at all) these commands translate into
> Sunmon commands... not having access to OpenBoot in the PROM does
> impact my options a little. I will see if I can find a resource on how
> this could be done from SunOS 4 since I'm not sure Sunmon can do this
> at all.

No problem, it was an idea to try to see some of the properties of the
framebuffer.  It should be possible from SunOS, but I have a few more
guesses left on how to get things working!

> No rush on the 4/330 though - this is my hobby project after all! I
> appreciate all the help from you folks on the SPARC mailing list.

It's holiday here, so I had a bit of time to look again :-)  The attached
patch should print out the real value of the P4 register before and after
trying to disable interrupts.  The colour map handling is commented out,
because we know that it's not working.  I also added (I hope) an interrupt
handler that will catch the interrupts at level 4 and ignore them (it will
increment a counter though).

Regards,

Julian
--- sys/arch/sparc/dev/cgfour.c.orig	2024-04-18 14:30:13.838093938 +0200
+++ sys/arch/sparc/dev/cgfour.c	2024-05-07 08:50:05.355097271 +0200
@@ -108,6 +108,7 @@
 #include <sys/systm.h>
 #include <sys/buf.h>
 #include <sys/device.h>
+#include <sys/evcnt.h>
 #include <sys/ioctl.h>
 #include <sys/mman.h>
 #include <sys/tty.h>
@@ -115,6 +116,7 @@
 
 #include <machine/autoconf.h>
 #include <machine/eeprom.h>
+#include <machine/intr.h>
 
 #include <dev/sun/fbio.h>
 #include <dev/sun/fbvar.h>
@@ -130,11 +132,13 @@
 
 	volatile struct fbcontrol *sc_fbc;	/* Brooktree registers */
 	union bt_cmap	sc_cmap;	/* Brooktree color map */
+	struct evcnt	sc_intrcnt;
 };
 
 /* autoconfiguration driver */
 static int	cgfourmatch(device_t, cfdata_t, void *);
 static void	cgfourattach(device_t, device_t, void *);
+static int	cgfour_intr(void *);
 
 #if defined(SUN4)
 static void	cgfourunblank(device_t);
@@ -216,9 +220,9 @@
 	union obio_attach_args *uoba = aux;
 	struct obio4_attach_args *oba = &uoba->uoba_oba4;
 	bus_space_handle_t bh;
-	volatile struct bt_regs *bt;
+	/* XXX volatile struct bt_regs *bt; */
 	struct fbdevice *fb = &sc->sc_fb;
-	int ramsize, i, isconsole;
+	int ramsize, /* XXX i, */ isconsole;
 
 	sc->sc_bustag = oba->oba_bustag;
 	sc->sc_paddr = (bus_addr_t)oba->oba_paddr;
@@ -283,8 +287,15 @@
 		/* XXX this is kind of a waste */
 		fb->fb_pixels = mapiodev(ca->ca_ra.ra_reg,
 					 PFOUR_COLOR_OFF_OVERLAY, ramsize);
-	}
+		printf(" (console)\n");
+	} else
 #endif
+		printf("\n");
+
+	/* Disable interrupts */
+printf("P4 register = 0x%04x\n", *(fb->fb_pfour));
+	*fb->fb_pfour &= ~(PFOUR_REG_INTEN) | PFOUR_REG_INTCLR;
+printf("P4 register = 0x%04x\n", *(fb->fb_pfour));
 
 	/* Map the Brooktree. */
 	if (bus_space_map(oba->oba_bustag,
@@ -299,28 +310,34 @@
 	sc->sc_fbc = (volatile struct fbcontrol *)bh;
 
 	/* grab initial (current) color map */
+/* XXX
 	bt = &sc->sc_fbc->fbc_dac;
 	bt->bt_addr = 0;
 	for (i = 0; i < 256 * 3 / 4; i++)
 		((char *)&sc->sc_cmap)[i] = bt->bt_cmap >> 24;
 
 	BT_INIT(bt, 24);
+XXX */
 
 #if 0	/* See above. */
 	if (isconsole) {
-		printf(" (console)\n");
 #if defined(RASTERCONSOLE) && 0	/* XXX been told it doesn't work well. */
 		fbrcons_init(fb);
 #endif
-	} else
+	}
 #endif /* 0 */
-		printf("\n");
 
 	/*
 	 * Even though we're not using rconsole, we'd still like
 	 * to notice if we're the console framebuffer.
 	 */
 	fb_attach(fb, isconsole);
+
+	/* Interrupt handler */
+	(void)bus_intr_establish(oba->oba_bustag, oba->oba_pri, 4,
+	    cgfour_intr, sc);
+	evcnt_attach_dynamic(&sc->sc_intrcnt, EVCNT_TYPE_INTR, NULL,
+	    device_xname(self), "intr");
 #endif /* SUN4 */
 }
 
@@ -503,4 +520,16 @@
 		bt->bt_cmap = i << 24;
 	}
 }
+
+static int
+cgfour_intr(void *arg)
+{
+	struct cgfour_softc *sc = arg;
+	struct fbdevice *fb = &sc->sc_fb;
+
+	sc->sc_intrcnt.ev_count++;
+	*fb->fb_pfour &= PFOUR_REG_INTCLR;
+
+	return 1;	/* claimed */
+}
 #endif /* SUN4 */


Home | Main Index | Thread Index | Old Index