Magic symlinks redux

M. Warner Losh imp at bsdimp.com
Sat Aug 23 01:54:20 UTC 2008


In message: <20080823013912.GA19588 at epsilon.local>
            Rui Paulo <rpaulo at FreeBSD.org> writes:
: On Sat, Aug 23, 2008 at 12:51:19AM +0200, Luigi Rizzo wrote:
: > sorry but now i am the one who doesn't understand how you can move,
: 
: [snip]
: 
: I think what Warner was saying was that the BUS code can do a mapping of
: device IDs from something not known to the driver to something know by the
: driver.
: 
: Take, for example, if_re.  if_re knows how to support devid 0x1234.
: A new device comes out that works exactly the same way as device 0x1234, but
: the the device ID is 0x4567. If we change the BUS code to map devid 0x4567 to
: 0x1234, we don't need to change anything in the if_re driver. We just changed
: the BUS code with no change to the leaf driver.
: 
: If there is a new device with ID 0x9912 that needs modifications in if_re, we
: are basically busted and need to change if_re itself. In this scenario,
: we don't change anything in the BUS code because that would be pointless.
: 
: I hope this is what Warner was trying to say.

Yes.  The bus code would have a mapping table.  If you have to do more
than just say 'treat this like this other thing' you'll need to hack
the driver anyway, so you'd save nothing with a fancier solution that
might allow this...

In the above example, the pci code would read the device id.  It would
see it is 0x4567 and lie to the driver saying it is really 0x1234.
The driver then matches this, and treats it exactly as if it were a
0x1234, since that's what it thinks the card is.  Most of the drivers
in the tree support a variety of cards, so some way of telling it
which one to use is needed....  There are some complicated drivers
that know all the errata for this or that rev of the chip.  I'm not
sure how those would work out in practice.  However, those drivers
almost always need tweaks for new parts...

Warner


More information about the freebsd-arch mailing list