From owner-freebsd-hackers Mon Apr 24 10:46:38 1995 Return-Path: hackers-owner Received: (from majordom@localhost) by freefall.cdrom.com (8.6.10/8.6.6) id KAA11576 for hackers-outgoing; Mon, 24 Apr 1995 10:46:38 -0700 Received: from inet-gw-2.pa.dec.com (inet-gw-2.pa.dec.com [16.1.0.23]) by freefall.cdrom.com (8.6.10/8.6.6) with SMTP id KAA11570 for ; Mon, 24 Apr 1995 10:46:36 -0700 Received: from muggsy.lkg.dec.com by inet-gw-2.pa.dec.com (5.65/24Feb95) id AA23834; Mon, 24 Apr 95 08:41:21 -0700 Received: from whydos.lkg.dec.com by muggsy.lkg.dec.com (5.65/DEC-Ultrix/4.3) with SMTP id AA07908; Mon, 24 Apr 1995 11:41:19 -0400 Received: from localhost (localhost [127.0.0.1]) by whydos.lkg.dec.com (8.6.11/8.6.9) with SMTP id LAA02851; Mon, 24 Apr 1995 11:44:52 GMT Message-Id: <199504241144.LAA02851@whydos.lkg.dec.com> X-Authentication-Warning: whydos.lkg.dec.com: Host localhost didn't use HELO protocol To: Bruce Evans Cc: julian@ref.tfs.com, phk@ref.tfs.com, hackers@FreeBSD.org Subject: Re: [EISA] related matters In-Reply-To: Your message of "Mon, 24 Apr 1995 11:05:35 +1000." <199504240105.LAA12989@godzilla.zeta.org.au> X-Mailer: exmh version 1.5omega 10/6/94 Date: Mon, 24 Apr 1995 11:44:20 +0000 From: Matt Thomas Sender: hackers-owner@FreeBSD.org Precedence: bulk > >It has always had me wondering why >I< had to tell config about spl-levels... > > >What we really should have is a TEXT_SET(device_probe...) and kill config... > > No linker magic is required or good. Drivers should register their > interrupt masking requirements as late as possible, preferably not > until open() completes. Not every device has an open routine (like network interfaces). There should be two steps: the first is registration (allow a driver to indicate that it will use an IRQ) to detect conflicts, the second is the actual enabling of the interrupt handler. BSD/OS actually has done this in a manner which is quite nice. There are no interrupt handlers defined in the config file. Every driver must register their interrupt handler in their attach routine. You can almost achieve the same thing in FreeBSD by setting id->id_intr in the attach routine. The problem is that the irq class is not so easily set in the driver (because of having isa_devtab_xxx in ioconf.c; it would be nicer if the isa_device structure had a id_class field which would be used to register the approriate interrupt handler). Right now, my new-improved DECPA driver needs the following config file line on FreeBSD: device di0 at isa? net irq ? The "net irq ?" is required so it's put into the right device table. Under BSD/OS, all I need is: di0 at isa? > I looked for other things that could be config'ed better in GENERIC: > > isa? config at attach time or later > vector config when intr is attached > iosiz config at attach time after probe decides it? > > These things can't always (never for isa) be config'ed later because > probing likely addresses is too dangerous: > > port, iomem The routines to check for port and mem conflicts need to generalized so they can be called from drivers probe routines. Note that BSD/OS contains routine to do such checks: int isa_portcheck(isa_ioport_t start, size_t size); int isa_memcheck(isa_physaddr_t start, size_t size); This allow driver to check over various port ranges without being accidentally stomped. This is really important for loadable drivers. > These things can't always be config'ed later because probing is unreliable: > > irq, drq The IRQ services in FreeBSD are definitely inferior to BSD/OS. BSD/OS supports shared interrupts for all interrupts (not specific to PCI as in FreeBSD). Some routines that FreeBSD could use are: isa_irqmask_t isa_irqalloc(isa_irqmask_t irqs); isa_irqmask_t isa_forceintr(int (*forceintr)(void *arg)); isa_irqalloc takes a set of irqs (IRQ%|IRQ9|...) and returns the highest IRQ not currently in use. isa_forceintr will call a routine to force an interrupt and then return which IRQ was signalled. I've never used DRQs so I can't say what's needed for them. Modifying my drivers to run under both FreeBSD and BSD/OS has been very enlightening. Some things BSD/OS does better while FreeBSD does better at other things. That's my two pence worth, Matt Thomas Internet: matt@lkg.dec.com U*X Networking WWW URL: http://ftp.dec.com/%7Ethomas/ Digital Equipment Corporation Disclaimer: This message reflects my Littleton, MA own warped views, etc.