Port-sparc archive

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

Re: Sun4/110 "Panic: Crazy Interrupts"



Hi,

> Thank you, Julian!
> 
> It doesn't seem to like compiling after this patch - I attached the
> compiler output.

Apologies - rushing to get it sent before travelling and I realise that I
must have built the wrong tree.  I've attached a new version.  Looking in
more detail at the colour map setup (bt_cmap) I'm not certain if that will
cause a size fault too.  However, I hope that we at least get the value
of the P4 register and disable interrupts there.

Regards,

Julian

-- 
--- sys/arch/sparc/dev/cgfour.c.orig	2024-04-18 14:30:13.838093938 +0200
+++ sys/arch/sparc/dev/cgfour.c	2024-04-23 19:01:23.433488262 +0200
@@ -123,12 +123,35 @@
 #include <dev/sun/pfourreg.h>
 
 /* per-display variables */
+struct p4bt_regs {
+	u_char	bt_addr[4];
+	u_int	bt_cmap;
+	u_char	bt_ctrl[4];
+	u_int	bt_omap;
+};
+#define P4BT_INIT(bt) do { \
+ 	(bt)->bt_addr[3] = 0x06;	/* command reg */ \
+ 	(bt)->bt_ctrl[3] = 0x73;	/* overlay plane */ \
+ 	(bt)->bt_addr[3] = 0x04;	/* read mask */ \
+ 	(bt)->bt_ctrl[3] = 0xff;	/* color planes */ \
+} while(0)
+
+
+struct p4fbcontrol {
+	struct	p4bt_regs fbc_dac;
+	u_char	fbc_ctrl;
+ 	u_char	fbc_status;
+ 	u_char	fbc_cursor_start;
+ 	u_char	fbc_cursor_end;
+ 	u_char	fbc_vcontrol[12];	/* 12 bytes of video timing goo */
+};
+
 struct cgfour_softc {
 	struct fbdevice	sc_fb;		/* frame buffer device */
 	bus_space_tag_t	sc_bustag;
 	bus_addr_t	sc_paddr;	/* phys address for device mmap() */
 
-	volatile struct fbcontrol *sc_fbc;	/* Brooktree registers */
+	volatile struct p4fbcontrol *sc_fbc;	/* Brooktree registers */
 	union bt_cmap	sc_cmap;	/* Brooktree color map */
 };
 
@@ -216,7 +239,7 @@
 	union obio_attach_args *uoba = aux;
 	struct obio4_attach_args *oba = &uoba->uoba_oba4;
 	bus_space_handle_t bh;
-	volatile struct bt_regs *bt;
+	volatile struct p4bt_regs *bt;
 	struct fbdevice *fb = &sc->sc_fb;
 	int ramsize, i, isconsole;
 
@@ -289,22 +312,22 @@
 	/* Map the Brooktree. */
 	if (bus_space_map(oba->oba_bustag,
 			  oba->oba_paddr + PFOUR_COLOR_OFF_CMAP,
-			  sizeof(struct fbcontrol),
+			  sizeof(struct p4fbcontrol),
 			  BUS_SPACE_MAP_LINEAR,
 			  &bh) != 0) {
 		printf("%s: cannot map control registers\n",
 			device_xname(self));
 		return;
 	}
-	sc->sc_fbc = (volatile struct fbcontrol *)bh;
+	sc->sc_fbc = (volatile struct p4fbcontrol *)bh;
 
 	/* grab initial (current) color map */
 	bt = &sc->sc_fbc->fbc_dac;
-	bt->bt_addr = 0;
+	bt->bt_addr[3] = 0;
 	for (i = 0; i < 256 * 3 / 4; i++)
 		((char *)&sc->sc_cmap)[i] = bt->bt_cmap >> 24;
 
-	BT_INIT(bt, 24);
+	P4BT_INIT(bt);
 
 #if 0	/* See above. */
 	if (isconsole) {
@@ -316,6 +339,10 @@
 #endif /* 0 */
 		printf("\n");
 
+	/* Disable interrupts */
+printf("P4 register = 0x%04ux\n", (unsigned int) fb->fb_pfour);
+	*fb->fb_pfour &= ~(PFOUR_REG_INTEN);
+
 	/*
 	 * Even though we're not using rconsole, we'd still like
 	 * to notice if we're the console framebuffer.
@@ -486,14 +513,14 @@
 static void
 cgfourloadcmap(struct cgfour_softc *sc, int start, int ncolors)
 {
-	volatile struct bt_regs *bt;
+	volatile struct p4bt_regs *bt;
 	u_int *ip, i;
 	int count;
 
 	ip = &sc->sc_cmap.cm_chip[BT_D4M3(start)];	/* start/4 * 3 */
 	count = BT_D4M3(start + ncolors - 1) - BT_D4M3(start) + 3;
 	bt = &sc->sc_fbc->fbc_dac;
-	bt->bt_addr = BT_D4M4(start) << 24;
+	bt->bt_addr[3] = BT_D4M4(start);
 	while (--count >= 0) {
 		i = *ip++;
 		/* hardware that makes one want to pound boards with hammers */


Home | Main Index | Thread Index | Old Index