From owner-freebsd-hackers Tue May 7 16:47:17 1996 Return-Path: owner-hackers Received: (from root@localhost) by freefall.freebsd.org (8.7.3/8.7.3) id QAA25248 for hackers-outgoing; Tue, 7 May 1996 16:47:17 -0700 (PDT) Received: from doberman.cisco.com (doberman.cisco.com [171.69.1.178]) by freefall.freebsd.org (8.7.3/8.7.3) with SMTP id QAA25240 for ; Tue, 7 May 1996 16:47:15 -0700 (PDT) Received: (amcrae@localhost) by doberman.cisco.com (8.6.12/8.6.5) id QAA09955; Tue, 7 May 1996 16:46:43 -0700 Date: Tue, 7 May 1996 16:46:43 -0700 From: Andrew McRae Message-Id: <199605072346.QAA09955@doberman.cisco.com> To: hackers@freebsd.org Subject: Re: shared interrupts? Sender: owner-hackers@freebsd.org X-Loop: FreeBSD.org Precedence: bulk se@zpr.uni-koeln.de (Stefan Esser): > On May 6, 16:02, "Amancio Hasty Jr." wrote: > } Subject: Re: shared interrupts? > } > > Is it possible for PCI devices to shared interrupts? > } > > } > Yes. > } > > } > > And if so how does one identify which device is generating the interrupt? > } > > } > One asks each device sharing the interrupt "Are *yo* talking to *me*?". > } > > } > 8-). > } > } Okay, specifically how does one ask each device "Are you really talking > } to me?" > > Well, that specific question is easy to answer (but I > don't know whether you'll like this particular answer :) As an example, the PC-Card stuff does this to allow multiple devices (Ether, modem) to exist together on the same PC-Card slot. A standard interrupt handler is installed that polls each actual device interrupt handler in turn; a device interrupt handler returning 0 indicates that this particular device has no interrupt outstanding e.g: /* * slot_irq_handler - Interrupt handler for shared irq devices. */ static void slot_irq_handler(int sp) { struct pccard_dev *dp; /* * For each device that has the shared interrupt, * call the interrupt handler. If the interrupt was * caught, the handler returns true. */ for (dp = ((struct slot *)sp)->devices; dp; dp = dp->next) if (dp->isahd.id_irq && dp->running && dp->drv->handler(dp)) return; printf("Slot %d, unfielded interrupt (%d)\n", ((struct slot *)sp)->slot, ((struct slot *)sp)->irq); } One problem with this are bugs (h/w or s/w) that cause an interrupt but the device doesn't own up (often caused by a race condition when the device is manipulated by interrupt unmasked code). Another common problem is dumb devices that don't have interrupt pending testable bits. The interrupt mechanism of the PC sucks. Andrew McRae (amcrae@cisco.com)