tech-kern archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: Multiple device attachments
Thanks --
On Jul 21, 2011, at 3:18 PM, Michael wrote:
> Hello,
>
> On Thu, 21 Jul 2011 14:44:04 -0500
> Frank Zerangue <frank.zerangue%gmail.com@localhost> wrote:
>
>> /sys/device.h -- seems to indicate that a device driver can attach to
>> multiple parent
>> drivers (e.g. busses, controllers, ?)
>>
>> /*
>> * Devices can have multiple configuration attachments if they attach
>> * to different attributes (busses, or whatever), to allow specification
>> * of multiple match and attach functions. There is only one configuration
>> * driver per driver, so that things like unit numbers and the device
>> * structure array will be shared.
>> */
>>
>> Does anyone know how this is done in practice?
>
> You split the driver in bus-dependent and bus-independent portions - the
> former does stuff like match & attach, find and map registers etc., the
> latter is the actual driver. There are plenty examples in the source tree:
> - hme, gem exist as pci and sbus variants
> - le, esp, com have lots of different bus backends ( Try to find a 1990s UNIX
> workstation that has neither an le nor an esp. Suns used both as sbus
> devices, others used their own buses or had them embedded in custom IO chips.
> )
> - chipsfb and igsfb supports both pci and ofbus ( actually vlb with
> OpenFirmware glue, see arch/shark/ofw/chipsfb_ofbus.c, igsfb_ofbus.c )
>
> have fun
> Michael
> --
> Michael <macallan%netbsd.org@localhost>
Home |
Main Index |
Thread Index |
Old Index