next up previous
Next: Keyboard Up: Device Drivers Previous: ITE

Disk (SCSI)

SCSI-based machines have two levels of disk code in the kernel. The file scsi.c handles the low-level SCSI messages and commands, while the file sd.c (SCSI disk) handles the partitions, blocks, and order of disk accesses. The NetBSD project recently moved most of the high-level SCSI disk code into a machine-independent directory, so it is likely that a new port will only have to write the adapter-specific code.

Most SCSI systems can either work by interrupts or by polling. With the former, the SCSI system will make a request to the disk, record that the request was made, then leave the CPU free for other processes. An interrupt from the SCSI controller will cause the SCSI system to figure out what request was just terminated and transfer the data, if necessary. With the latter, the SCSI system must busy-loop until the controller handles the request; this can waste quite a bit of CPU time. A first-cut SCSI system should be written with polling to minimize possible bugs, but an interrupt-driven system should eventually be implemented if the controller supports it.

Lawrence Kesteloot
Fri Jan 20 16:29:52 EST 1995