Busses and Attachments


Every device in the system is attached to some other device. We saw an example of this in Chapter 11, with the dmassage program that generated a simple drawing of what hardware was attached to which bus. Not all systems have all busses; while OpenBSD supports PCI devices, for example, it runs just fine on ISA-only systems.

mainbus0

On i386 hardware everything sits on top of the main bus, called "mainbus0." This is the foundation of your kernel. Your SCSI hard disk might be on top of the SCSI bus, which sits on top of a SCSI card, which is plugged into the PCI bus, but that PCI bus will be attached to the main bus.

Connection Configuration

The kernel must know how these busses and cards hook together. You'll see quite a few entries in your copied kernel configuration that look like this.

 isa0    1 at mainbus0 isa0    2 at pcib? 

Older computers just have an ISA bus that is 1 directly attached to the main system bus, and we must tell the kernel how to recognize that configuration. On PCI-based computers, the ISA bus is frequently 2 plugged into the PCI-ISA bridge instead of directly to the main bus. (This is a matter of hardware design, not kernel design.) With the above configuration, if the ISA bus is in either of these locations the kernel will find it. If you have some special hardware with the ISA bus attached elsewhere, this kernel will not find it.

Also, note the device numbers. This configuration is for ISA bus number zero. As systems only have one ISA bus, this is perfectly acceptable. A system can have multiple PCI buses, however. That's why the second configuration line has a question mark by the device number for the PCI bus; this entry will match any PCI bus. Some device drivers must have a hard-coded number, while others will accept a question mark instead. Generally, non-Plug-and-Play ISA cards must have a hard-coded device number.

You can follow the hardware connections through the kernel configuration. We previously mentioned how a simple SCSI disk can live at the end of a long chain of hardware. Let's see how. A SCSI disk uses the "sd" driver.

 sd* 1     at 2 scsibus? target ? lun ?     # SCSI disk drives 

Here, we have 1 any number of SCSI disks. They can be attached to 2 any SCSI bus.

If you have an AdvanSys 1200B UltraSCSI controller, it'll use the adv driver. If you search your kernel configuration for this driver, you'll find it easily.

 1 adv*    at pci? 3 dev ? function ?   # AdvanSys 1200A/B and ULTRA SCSI 2 scsibus* at adv? 

The 1 first entry tells the kernel to recognize AdvanSys card. The kernel will also attach a 2 SCSI bus to this card, when found. A check of the GENERIC kernel configuration shows that the kernel is configured to attach a SCSI bus to any SCSI card. The adv card expects to be plugged into a 3 PCI bus. Where does our PCI bus come from? Well, GENERIC has the following entries for the PCI bus.

 pci*    at mainbus0 bus ? pci*    at ppb? bus ? pci*    at pchb? bus ? 

Depending on which sort of PCI bus you have and how it is attached to the system, you might be done. You could continue tracking these devices back, and see how everything hooks together, but you should have the idea by now.

For our SCSI disk to work, every step of the attachment chain must be in the kernel configuration. You can have the drivers for the SCSI disk and SCSI card in your kernel, but if you don't have the entry for the SCSI bus to connect the two, the disk won't work. Every device must be able to find the devices beneath it. After all, if your kernel can't find the PCI bus, it won't find the devices attached to it!




Absolute Openbsd(c) Unix for the Practical Paranoid
Absolute OpenBSD: Unix for the Practical Paranoid
ISBN: 1886411999
EAN: 2147483647
Year: 2005
Pages: 298

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net