BSDCan2010 - Final Release

BSDCan 2010
The Technical BSD Conference

Warner Losh
Day Talks - 1 - 2010-05-13
Room DMS 1140
Start time 16:00
Duration 01:00
ID 185
Event type Lecture
Track Hacking
Language used for presentation English

Enhanced compatibility through device mapping

lying to the drivers for fun and profit

An easy way to support new hardware that lacks support in the driver, but is similar enough to old hardware, is presented. A generic means of matching hardware, in a bus independent manner, is used to instruct the bus layer to lie about the plug and play properties of a device so as trick the driver into thinking the device is of a different, supported type. Compatible hardware will then work with this driver. Additional application for the matching or the mapping technology is discussed.

For years, new hardware has been released after FreeBSD does its releases. This new hardware often times is upwardly compatible with the prior generation of the hardware. Many times, the drive writers add support for this new hardware by having the driver treat it just like earlier versions of the hardware, possibly with additional capabilities. Today, FreeBSD users need to recompile the kernel or driver module to support this new hardware. A generic mapping capability will allow users of these devices to use them, possibly without the new features, until the drivers can be updated. There are also hooks in the system to allow users to 'downgrade' newer hardware when driver bugs prevent the usage of newer features of a card as well. Buses in the system cooperate with this mapping system by providing caching the plug and play data used to match devices and feeding that data to drivers bidding on a device. By hooking the mapping layer in at this point, buses can implement the mapping transparently to client drivers. This reduces the amount of work necessary to implement the feature because there's a relatively small number of bus drivers compared to the number of client drivers in the system.

In addition to providing a means to map the plug and play data used to match devices, this matching portin of this software also allows for other features to be implemented based on the mapping. Since location is included in this data, wiring devices to a specific location can be implemented with this method. New quirks can be added at run time, and can be more selective about which devices are matched that has traditionally been available.

This paper explores the current implementation, as well as outlines additional applications for the technology.