Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 24 Sep 1995 15:57:25 +1000
From:      Bruce Evans <bde@zeta.org.au>
To:        freebsd-hackers@freebsd.org, hm@altona.hamburg.com
Subject:   Re: LKM: how to fiddle in interrupt routine ptrs ?
Message-ID:  <199509240557.PAA18367@godzilla.zeta.org.au>

next in thread | raw e-mail | index | archive | help
>Is there a generic or recommended way or example of installing a device's
>interrupt routine at mod-loading a device driver LKM time ?

See pcibus.c:pcibus_ihandler_attach/detach.

There are some minor problems with these routines:

- the `func' arg should already have the correct type (inthand2_t).
- `deviced??' should be spelled `device_id??'
- it isn't possible to give a correect device_id.  0 is for clkintr.
  The device_id is only used for counting interrupts.  To fix this
  you would have to expand the string table in vector.s and edit it.
- 1ul should be 1u.
- update_intr_masks() and INTREN() and INTRDIS() may need to be called
  at a high ipl or with interrupts disabled.  The whole routines may
  need to be called at a high ipl or with interrupts disablied.
- INTRDIS() in pci_ihandler_detach() isn't right if several devices
  are sharing the interrupt.
- INTRDIS() in pci_ihandler_detach() isn't right if the unregister_intr()
  fails.

>Does one have to copy the old isa_devtab_xxx[], expand it with an entry
>and exchange it with a new one ?

That might work.  You would have to edit the interrupt name string table
too.  It would be better to supply a dummy driver and replace that,

>What is the way to tell the driver at mod-load time it's IRQ and i/o addr ?

There is no way.  You could use the values from the dummy driver.  These
values can be handled using standard methods (config, userconfig, dset).

Bruce



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