Title: UNIX SCSI Drivers Overview
1UNIX SCSI DriversOverview
February 2002
2Computer Essentials
Software
Hardware
3Operating System
Applications
Utilities
User Space
Kernel Space
Process Control
Device Managers
Hardware
4Device Drivers
Application
User Space
Kernel Space
Driver
Driver
Hardware
Device
Device
5Decoupling Drivers
major number
minor number
Application access driver (1), device (2)
Switch Table
Driver(1)
Driver(4)
Hardware
Device(0)
Device(2)
Device
Device(1)
6Block vs. Character Devices
Application
Application
File System
Raw I/O
Cooked I/O
Switch Table
Block Driver
Character Driver
Hardware
Blocky Devices
Letter-y Devices
7Switch Table Entry Points
Common
Block
Character
strategy
read write ioctl
open close
8Device Nodes
Stored under /dev Special Files Type block
or character (cooked or raw) Device
Number Major Number Selects Driver from Switch
Table Minor Number Driver-Specific. device
instance device partitioning (a.k.a.
slice) device options (e.g. rewind tape)
9Driver Arguments (1)
open (dev_t dev, int flag, int open_type, cred_t
cred_p) close (dev_t dev, int flag, int
open_type, cred_t cred_p)
dev major and minor number from the device
node flag read, write, exclusive, no delays,
etc. open_type block, character, layered,
etc. cred_p pointer to users credentials
10Driver Arguments (2)
strategy (struct buf bp)
bp pointer to buffer header. kernel maintains
buffer pool. file system buffers application
I/O in memory cache. buffer processing is
asynchronous. application can do something
else while waiting on I/O
11Driver Arguments (3)
read (dev_t dev, uio_t uiop, cred_t
cred_p) write (dev_t dev, uio_t uiop, cred_t
cred_p)
dev major and minor number uio_p pointer to
user I/O structure, describes I/O cred_p pointer
to users credentials
12Driver Arguments (4)
ioctl (dev_t dev, int cmd, long arg, int
mode, cred_t cred_p, int rval_p)
dev major and minor number cmd interpreted by
driver arg (usually) pointer to cmd
arguments mode direction of transfer out or
in cred_p pointer to users credentials ral_p
pointer for returning ioctl status
13Target vs. HBA Drivers
target driver (disk)
target driver (tape)
HBA driver
Driver software
Host Adapter
Hardware
SCSI BUS
14Layered Drivers
Application
Switch Table
layered open
RDAC Driver
Driver
path table
Software
Hardware
Multi-Path Device