Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 2 May 2000 23:34:52 -0400 (EDT)
From:      Mike Nowlin <mike@argos.org>
To:        freebsd-current@freebsd.org
Cc:        Tim Pozar <pozar@lns.com>
Subject:   kern/16767  (A.K.A. Re: Geek Port crash)
Message-ID:  <Pine.LNX.4.05.10005022317400.22957-100000@jason.argos.org>
In-Reply-To: <20000430140040.A71703@lns.com>

next in thread | previous in thread | raw e-mail | index | archive | help

Lots of crashes, lots of fsck's, and lots of swearing resulted in the
following:

Opening /dev/ppi* in 4.0 (After Jan 14) causes a panic when the system
tries to allocate what appears to be IRQ 0 to the parallel port...  I know
little about the interrupt handling, so I went after this with the "brute
force" method, ending up with (so far) this:

ppc0: <Parallel port> at port 0x378-0x37f on isa0
ppc0: Generic chipset (EPP/NIBBLE) in COMPATIBLE mode
ppbus_attach(0xc0840d00)                 <-- added this line
ppi0: <Parallel I/O> on ppbus0
ppi0 - BUS_READ_IVAR returns IRQ 0       <-- added this line
lpt0: <Printer> on ppbus0
lpt0: Polled port
plip0: <PLIP network interface> on ppbus0

...with the enclosed patches, the geek port once again works, but I really
don't have the know-how to really test it correctly...  I'm able to read &
write the data lines on the port without blowing up the machine.
Essentially, ppiopen() in sys/dev/ppbus/ppi.c will not call
BUS_SETUP_INTR() if it sees an IRQ of 0.  (Not using polled mode on the
parallel port def in the config file didn't make any difference.)

I'm going to beat on this some more over the next few days, but this is a
start.  I'd be interested to know if anyone can make the
"ppi->intr_resource != 0 -- activating IRQ" message show up when opening
/dev/ppi0, especially if their machine doesn't crash when opening up
the device without this patch...  

--mike

---------------------------------------------------------------------------

diff -u /usr/src/sys/dev/ppbus/ppbconf.c newppbus/ppbconf.c
--- /usr/src/sys/dev/ppbus/ppbconf.c	Sun Jan 23 09:41:04 2000
+++ newppbus/ppbconf.c	Tue May  2 22:45:52 2000
@@ -390,6 +390,7 @@
 static int
 ppbus_attach(device_t dev)
 {
+	printf("ppbus_attach(%p)\n", dev);
 
 	/* Locate our children */
 	bus_generic_probe(dev);
diff -u /usr/src/sys/dev/ppbus/ppi.c newppbus/ppi.c
--- /usr/src/sys/dev/ppbus/ppi.c	Sun Jan 23 09:41:04 2000
+++ newppbus/ppi.c	Tue May  2 23:04:43 2000
@@ -169,6 +169,8 @@
 
 	/* retrive the irq */
 	BUS_READ_IVAR(device_get_parent(dev), dev, PPBUS_IVAR_IRQ, &irq);
+	printf("ppi%d - BUS_READ_IVAR returns IRQ %d\n", 
+		device_get_unit(dev), irq);
 
 	/* declare our interrupt handler */
 	ppi->intr_resource = bus_alloc_resource(dev, SYS_RES_IRQ,
@@ -271,10 +273,16 @@
 			return (res);
 
 		ppi->ppi_flags |= HAVE_PPBUS;
-
+		
+		if (!ppi->intr_resource) {
 		/* register our interrupt handler */
-		BUS_SETUP_INTR(device_get_parent(ppidev), ppidev, ppi->intr_resource,
+			printf("ppi->intr_resource != 0 -- activating IRQ\n");
+			BUS_SETUP_INTR(device_get_parent(ppidev), ppidev, ppi->intr_resource,
 			       INTR_TYPE_TTY, ppiintr, dev, &ppi->intr_cookie);
+		}
+		else {
+			printf("ppi->intr_resource = 0 -- not using IRQ\n");
+		}
 	}
 	ppi->ppi_count += 1;
 



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.LNX.4.05.10005022317400.22957-100000>