From owner-freebsd-hackers Sat Nov 30 19:37:00 1996 Return-Path: owner-hackers Received: (from root@localhost) by freefall.freebsd.org (8.7.5/8.7.3) id TAA28513 for hackers-outgoing; Sat, 30 Nov 1996 19:37:00 -0800 (PST) Received: from pluto.plutotech.com (root@pluto.plutotech.com [206.168.67.1]) by freefall.freebsd.org (8.7.5/8.7.3) with ESMTP id TAA28508 for ; Sat, 30 Nov 1996 19:36:57 -0800 (PST) Received: from shane.plutotech.com (durian@shane.plutotech.com [206.168.67.149]) by pluto.plutotech.com (8.8.3/8.8.3) with ESMTP id UAA09679 for ; Sat, 30 Nov 1996 20:36:57 -0700 (MST) Message-Id: <199612010336.UAA09679@pluto.plutotech.com> From: "Mike Durian" To: freebsd-hackers@freebsd.org Subject: LKM driver question / patch Date: Sat, 30 Nov 1996 20:36:56 -0700 Sender: owner-hackers@freebsd.org X-Loop: FreeBSD.org Precedence: bulk First of all I have a patch for kern/kern_conf.c. Without this, you get a panic when you try to unload a driver module: *** kern_conf.c.orig Sat Nov 30 20:15:06 1996 --- kern_conf.c Sat Nov 30 19:00:58 1996 *************** *** 150,156 **** if (oldentry) { \ *oldentry = TTYPE[i]; \ } \ ! newentry->d_maj = i; \ /* replace with new */ \ TTYPE[i] = newentry; \ \ --- 150,157 ---- if (oldentry) { \ *oldentry = TTYPE[i]; \ } \ ! if (newentry != NULL) \ ! newentry->d_maj = i; \ /* replace with new */ \ TTYPE[i] = newentry; \ \ Second, I have a question on writing a lkm driver. What is the proper way to use ISA an lkm driver with interrupts? The existing drivers in sys/i386/isa don't use interrupt, or only use them in conjuction with other existing hardware. I've added the: INTRMASK register_intr INTREN code sequence as found in isa.c to my driver load routine, but register_intr fails with EBUSY because the interrupt is already assigned to isa_strayintr. Also, how should I unregister the interrupt when I unload the driver? I see code in isa.c that does: INTRDIS unregister_intr INTRUNMASK but it fails too (probably because it never got registered properly). In fact it ends up masking my SCSI interrupts and I get aborts and must reboot. Thanks, mike