JavaScript is required to for searching.
Skip Navigation Links
Exit Print View
Writing Device Drivers     Oracle Solaris 10 1/13 Information Library
search filter icon
search icon

Document Information


Part I Designing Device Drivers for the Oracle Solaris Platform

1.  Overview of Oracle Solaris Device Drivers

2.  Oracle Solaris Kernel and Device Tree

3.  Multithreading

4.  Properties

5.  Managing Events and Queueing Tasks

6.  Driver Autoconfiguration

7.  Device Access: Programmed I/O

8.  Interrupt Handlers

9.  Direct Memory Access (DMA)

10.  Mapping Device and Kernel Memory

11.  Device Context Management

12.  Power Management

13.  Hardening Oracle Solaris Drivers

14.  Layered Driver Interface (LDI)

Part II Designing Specific Kinds of Device Drivers

15.  Drivers for Character Devices

16.  Drivers for Block Devices

17.  SCSI Target Drivers

18.  SCSI Host Bus Adapter Drivers

Introduction to Host Bus Adapter Drivers

SCSI Interface

SCSA HBA Interfaces

SCSA HBA Entry Point Summary

SCSA HBA Data Structures

scsi_hba_tran() Structure

scsi_address Structure

scsi_device Structure

scsi_pkt Structure (HBA)

Per-Target Instance Data

Transport Structure Cloning

SCSA HBA Functions

HBA Driver Dependency and Configuration Issues

Declarations and Structures

Per-Command Structure

Entry Points for Module Initialization

_init() Entry Point (SCSI HBA Drivers)

_fini() Entry Point (SCSI HBA Drivers)

Autoconfiguration Entry Points

attach() Entry Point (SCSI HBA Drivers)

detach() Entry Point (SCSI HBA Drivers)

Entry Points for SCSA HBA Drivers

Target Driver Instance Initialization

tran_tgt_init() Entry Point

tran_tgt_probe() Entry Point

tran_tgt_free() Entry Point

Resource Allocation

tran_init_pkt() Entry Point

Allocation and Initialization of a scsi_pkt(9S) Structure

Allocation of DMA Resources

Reallocation of DMA Resources for Data Transfer

tran_destroy_pkt() Entry Point

tran_sync_pkt() Entry Point

tran_dmafree() Entry Point

Command Transport

tran_start() Entry Point

Interrupt Handler and Command Completion

Timeout Handler

Capability Management

tran_getcap() Entry Point

tran_setcap() Entry Point

Abort and Reset Management

tran_abort() Entry Point

tran_reset() Entry Point

tran_bus_reset() Entry Point

tran_reset_notify() Entry Point

Dynamic Reconfiguration

SCSI HBA Driver Specific Issues

Installing HBA Drivers

HBA Configuration Properties

scsi-reset-delay Property

scsi-options Property

Per-Target scsi-options

x86 Target Driver Configuration Properties

Support for Queuing

19.  Drivers for Network Devices

20.  USB Drivers

21.  SR-IOV Drivers

Part III Building a Device Driver

22.  Compiling, Loading, Packaging, and Testing Drivers

23.  Debugging, Testing, and Tuning Device Drivers

24.  Recommended Coding Practices

Part IV Appendixes

A.  Hardware Overview

B.  Summary of Solaris DDI/DKI Services

C.  Making a Device Driver 64-Bit Ready

D.  Console Frame Buffer Drivers

E.  pci.conf File


SCSI HBA Driver Specific Issues

The section covers issues specific to SCSI HBA drivers.

Installing HBA Drivers

A SCSI HBA driver is installed in similar fashion to a leaf driver. See Chapter 22, Compiling, Loading, Packaging, and Testing Drivers. The difference is that the add_drv(1M) command must specify the driver class as SCSI, such as:

# add_drv -m" * 0666 root root" -i'"pci1077,1020"' -c scsi isp

HBA Configuration Properties

When attaching an instance of an HBA device, scsi_hba_attach_setup(9F) creates a number of SCSI configuration properties for that HBA instance. A particular property is created only if no existing property of the same name is already attached to the HBA instance. This restriction avoids overriding any default property values in an HBA configuration file.

An HBA driver must use ddi_prop_get_int(9F) to retrieve each property. The HBA driver then modifies or accepts the default value of the properties to configure its specific operation.

scsi-reset-delay Property

The scsi-reset-delay property is an integer specifying the recovery time in milliseconds for a reset delay by either a SCSI bus or SCSI device.

scsi-options Property

The scsi-options property is an integer specifying a number of options through individually defined bits:

Per-Target scsi-options

An HBA driver might support a per-target scsi-options feature in the following format:

target<n>-scsi-options=<hex value>

In this example, < n> is the target ID. If the per-target scsi-options property is defined, the HBA driver uses that value rather than the per-HBA driver instance scsi-options property. This approach can provide more precise control if, for example, synchronous data transfer needs to be disabled for just one particular target device. The per-target scsi-options property can be defined in the driver.conf(4) file.

The following example shows a per-target scsi-options property definition to disable synchronous data transfer for target device 3:


x86 Target Driver Configuration Properties

Some x86 SCSI target drivers, such as the driver for cmdk disk, use the following configuration properties:

If you use the cmdk sample driver to write an HBA driver for an x86 platform, any appropriate properties must be defined in the driver.conf(4) file.

Note - These property definitions should appear only in an HBA driver's driver.conf(4) file. The HBA driver itself should not inspect or attempt to interpret these properties in any way. These properties are advisory only and serve as an adjunct to the cmdk driver. The properties should not be relied upon in any way. The property definitions might not be used in future releases.

The disk property can be used to define the type of disk supported by cmdk. For a SCSI HBA, the only possible value for the disk property is:

The queue property defines how the disk driver sorts the queue of incoming requests during strategy(9E). Two values are possible:

The flow_control property defines how commands are transported to the HBA driver. Three values are possible:

The following example is a driver.conf(4) file for use with an x86 HBA PCI device that has been designed for use with the cmdk sample driver:

# config file for ISP 1020 SCSI HBA driver     
       flow_control="dsngl" queue="qsort" disk="scdk"