From owner-freebsd-hackers Sat Sep 23 22:59:44 1995 Return-Path: owner-hackers Received: (from root@localhost) by freefall.freebsd.org (8.6.12/8.6.6) id WAA03867 for hackers-outgoing; Sat, 23 Sep 1995 22:59:44 -0700 Received: from godzilla.zeta.org.au (godzilla.zeta.org.au [203.2.228.34]) by freefall.freebsd.org (8.6.12/8.6.6) with ESMTP id WAA03852 for ; Sat, 23 Sep 1995 22:59:34 -0700 Received: (from bde@localhost) by godzilla.zeta.org.au (8.6.9/8.6.9) id PAA18367; Sun, 24 Sep 1995 15:57:25 +1000 Date: Sun, 24 Sep 1995 15:57:25 +1000 From: Bruce Evans Message-Id: <199509240557.PAA18367@godzilla.zeta.org.au> To: freebsd-hackers@freebsd.org, hm@altona.hamburg.com Subject: Re: LKM: how to fiddle in interrupt routine ptrs ? Sender: owner-hackers@freebsd.org Precedence: bulk >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