Date: Mon, 24 Apr 1995 11:44:20 +0000 From: Matt Thomas <matt@lkg.dec.com> To: Bruce Evans <bde@zeta.org.au> Cc: julian@ref.tfs.com, phk@ref.tfs.com, hackers@FreeBSD.org Subject: Re: [EISA] related matters Message-ID: <199504241144.LAA02851@whydos.lkg.dec.com> In-Reply-To: Your message of "Mon, 24 Apr 1995 11:05:35 %2B1000." <199504240105.LAA12989@godzilla.zeta.org.au>
next in thread | previous in thread | raw e-mail | index | archive | help
> >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.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199504241144.LAA02851>