Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 30 Nov 1996 20:36:56 -0700
From:      "Mike Durian" <durian@plutotech.com>
To:        freebsd-hackers@freebsd.org
Subject:   LKM driver question / patch
Message-ID:  <199612010336.UAA09679@pluto.plutotech.com>

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:

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



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