Subject: Re: Proposed change to a whole load of drivers...
To: None <tech-kern@NetBSD.ORG>
From: Mike Long <firstname.lastname@example.org>
Date: 09/10/1996 11:07:29
>Date: Mon, 09 Sep 1996 23:53:28 -0700
>From: Jonathan Stone <jonathan@DSG.Stanford.EDU>
>Brett Lymn (email@example.com) writes:
>>See (2) .... Alternatively, what about a method that would report the
>>devices configuration? Something that is part of the driver that
>>reports the configuration to the caller, something similar to the
>>print function the autoconf calls excepting that it returns the data
>>to the caller. That would keep the abstraction barrier (a good thing)
>>but allow the appropriate data to be retrieved.
>I don't understand what data you want, here. The device-attach
>arguments are probably long gone by the time you call this new method.
>The device softc isn't particulalry meaningful outside the device,
>though perhaps the "struct device" base class [sic] is. Is the struct
>device what you want, or not? (and what about
>not-completely-new-config drivers that don't hav a struct device as
>the first member of the soft? Is the hp300 completeley new-config
Basically, he wants the locators; e.g. port, irq, drq, &c., for ISA.
One solution is to add two pointers to struct device--
The first is a pointer to a null-terminated array of (char *)s; the
(char *)s point to strings naming the locators. Only bus devices
(like ISA) would have this array filled in; the strings correspond to
locators used by children of that device.
The second is a pointer to an array of integers, which contain the
actual locators used to find a device. Child devices would have this
second array. The integers stored in the second array correspond with
the strings stored in the parent device's first array.
By adding this information to the device structs, userland (and
kernel) code can unambigously determine where every device in the
system is located, and display this information in human-readable
form. The overhead is small, and can be made still smaller by having
drivers use the locators stored in the device struct instead of
storing them in the softc. Another optimization would be to have bus
print functions (e.g. isaprint()) use the string arrays.
Implementing this idea requires altering the definition of struct
device in <sys/device.h>, and modifying bus-attach code to allocate
and fill in the arrays.
Hopefully this made some sense. If it doesn't get shot down out of
hand, I will even try to implement it.
Mike Long <firstname.lastname@example.org> <URL:http://www.shore.net/~mikel>
VLSI Design Engineer finger email@example.com for PGP public key
Analog Devices, CPD Division CCBF225E7D3F7ECB2C8F7ABB15D9BE7B
Norwood, MA 02062 USA (eq (opinion 'ADI) (opinion 'mike)) -> nil