SD(4) | Device Drivers Manual | SD(4) |
sd
— SCSI and
ATAPI disk driver
sd* at scsibus? target ? lun ?
sd3 at scsibus0 target 3 lun 0
sd* at atapibus? drive ? flags 0x0000
The sd
driver provides support for SCSI
bus and Advanced Technology Attachment Packet Interface (ATAPI) disks. It
allows the disk to be divided up into a set of pseudo devices called
partitions.
In general the interfaces are similar to those described by
wd(4).
Where the wd(4) device has a fairly low level interface to the system, SCSI devices have a much higher level interface and talk to the system via a SCSI host adapter (e.g., ahc(4)). A SCSI adapter must also be separately configured into the system before a SCSI disk can be configured.
When the SCSI adapter is probed during boot, the SCSI
bus is scanned for devices. Any devices found which answer as
‘Direct’
type devices will be attached to the sd
driver.
For the use of flags with ATAPI devices, see wd(4).
On many systems disklabel(8) is used to partition the drive into filesystems. On some systems the NetBSD portion of the disk resides within a native partition, and another program is used to create the NetBSD portion.
For example, the i386 port uses fdisk(8) to partition the disk into a BIOS level partition. This allows sharing the disk with other operating systems.
The following config(1) options may be applied to SCSI disks as well as to other disks.
SDRETRIES
SD_IO_TIMEOUT
The following
ioctl(2) calls apply to SCSI
disks as well as to other disks. They are defined in the header file
<sys/dkio.h>
and use data
structures defined in
<sys/disklabel.h>
.
DIOCGDINFO
DIOCSDINFO
DIOCKLABEL
DIOCWLABEL
DIOCWDINFO
DIOCLOCK
DIOCEJECT
In addition, the
scsi(4) general
ioctl
()
commands may be used with the sd
driver, but only
against the ‘c
’ (whole disk)
partition.
If a removable device is attached to the
sd
driver, then the act of changing the media will
invalidate the disklabel and information held within the kernel. To avoid
corruption, all accesses to the device will be discarded until there are no
more open file descriptors referencing the device. During this period, all
new open attempts will be rejected. When no more open file descriptors
reference the device, the first next open will load a new set of parameters
(including disklabel) for the drive.
None.
ioctl(2), intro(4), scsi(4), wd(4), disklabel(5), disklabel(8), fdisk(8), scsictl(8)
The sd
driver was originally written for
Mach 2.5, and was ported to FreeBSD by Julian
Elischer. It was later ported to NetBSD.
June 9, 2016 | NetBSD 10.99 |