28.08.2015 Views

The Design and Implementation of the Anykernel and Rump Kernels

1F3KDce

1F3KDce

SHOW MORE
SHOW LESS
  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

150<br />

using an interface called USBDI, or USB Driver Interface. <strong>The</strong> role <strong>of</strong> <strong>the</strong> host<br />

controller, along with ugen, is a detail which makes USB especially suitable for<br />

userspace drivers: we need to implement a host controller which maps USBDI to<br />

<strong>the</strong> ugen device node instead <strong>of</strong> having to care about all bus details.<br />

We implemented a host controller called ugenhc. When <strong>the</strong> kernel’s device autoconfiguration<br />

subsystem calls <strong>the</strong> ugenhc driver to probe <strong>the</strong> device, <strong>the</strong> ugenhc driver<br />

tries to open /dev/ugen on <strong>the</strong> host. If <strong>the</strong> open is successful, <strong>the</strong> host kernel has<br />

attached a device to <strong>the</strong> respective ugen instance <strong>and</strong> ugenhc can return a successful<br />

match. Next, <strong>the</strong> ugenhc driver is attached in <strong>the</strong> rump kernel, along with a USB<br />

bus <strong>and</strong> a USB root hub. <strong>The</strong> root hub driver explores <strong>the</strong> bus to see which devices<br />

are connected to it, causing <strong>the</strong> probes to be delivered first to ugenhc <strong>and</strong> through<br />

/dev/ugen to <strong>the</strong> host kernel <strong>and</strong> finally to <strong>the</strong> actual hardware. Figure 3.24 contains<br />

a “dmesg” <strong>of</strong> a server with four ugenhc devices configured <strong>and</strong> one USB mass<br />

media attached.<br />

3.10.2 Defining Device Relations with Config<br />

Device autoconfiguration [108] is used to attach hardware device drivers in <strong>the</strong><br />

NetBSD kernel. A configuration file determines <strong>the</strong> relationship <strong>of</strong> device drivers<br />

in <strong>the</strong> system <strong>and</strong> <strong>the</strong> autoconfiguration subsystem attempts to attach drivers according<br />

to <strong>the</strong> configuration. <strong>The</strong> configuration is expressed in a domain specific<br />

language (DSL). <strong>The</strong> language is divided into two parts: a global set <strong>of</strong> descriptions<br />

for which drivers can attach to which busses, <strong>and</strong> a system-specific configuration<br />

<strong>of</strong> what hardware is expected to be present <strong>and</strong> how this particular configuration<br />

allows devices to attach. For example, even though <strong>the</strong> USB bus allows a USB hub<br />

to be attached to ano<strong>the</strong>r hub, <strong>the</strong> device configuration might allow a USB hub to<br />

be attached only to <strong>the</strong> host controller root hub <strong>and</strong> not o<strong>the</strong>r hubs.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!