From owner-freebsd-current Tue May 2 20:34:59 2000 Delivered-To: freebsd-current@freebsd.org Received: from jason.argos.org (a1-3b058.neo.rr.com [24.93.181.58]) by hub.freebsd.org (Postfix) with ESMTP id B96B437B87E for ; Tue, 2 May 2000 20:34:54 -0700 (PDT) (envelope-from mike@argos.org) Received: from localhost (mike@localhost) by jason.argos.org (8.9.1/8.9.1) with ESMTP id XAA23137; Tue, 2 May 2000 23:34:52 -0400 Date: Tue, 2 May 2000 23:34:52 -0400 (EDT) From: Mike Nowlin To: freebsd-current@freebsd.org Cc: Tim Pozar Subject: kern/16767 (A.K.A. Re: Geek Port crash) In-Reply-To: <20000430140040.A71703@lns.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG 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: at port 0x378-0x37f on isa0 ppc0: Generic chipset (EPP/NIBBLE) in COMPATIBLE mode ppbus_attach(0xc0840d00) <-- added this line ppi0: on ppbus0 ppi0 - BUS_READ_IVAR returns IRQ 0 <-- added this line lpt0: on ppbus0 lpt0: Polled port plip0: 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