Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 1 Dec 1996 16:36:17 +1100
From:      Bruce Evans <bde@zeta.org.au>
To:        durian@plutotech.com, freebsd-hackers@FreeBSD.org
Subject:   Re: LKM driver question / patch
Message-ID:  <199612010536.QAA10354@godzilla.zeta.org.au>

next in thread | raw e-mail | index | archive | help
>  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:

Thanks.  I knew that unloading the joy and qcam modules was broken.

>  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

No one knows the details yet :-[.  We will know when you've finished :-).

>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

See eisa_reg_intr() in eisaconf.c.  The isa code is mouldier and
all the current code only good enough at boot time.  It's important
to call update_intr() masks somewhere (eisa_reg_intr() does this).
If you are loading a tty driver and PPP or SLIP is enabled, then it is
important to OR tty_imask into net_imask.  See ppp_tty.c and isa.c.  The
initializations there only work at ppp attach time (for PPP) and at boot
time (for SLIP).  They should probably be done in update_intr_masks(),
and update_intr_masks() should probably be called from register_intr().

register_intr() only returns EBUSY when the interrupt is already assigned
to something _other than_ isa_strayintr, i.e., when it really is busy.

>  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.

See eisa_release_intr() in eisaconf.c.  I think this doesn't actually
work.  update_intr_masks() needs some changes.  Note that it ORs bits
into the current masks.  Thus it is no use releasing interrupts.  It
can't simply clear all the masks so that they get rebuilt from scratch
since some of the masks are initialized to nonzero (clk_imask, stat_imask,
npx0_imask at least).

Bruce



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199612010536.QAA10354>