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

Preface

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

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

Index

Numbers and Symbols

A

B

C

D

E

F

G

H

I

K

L

M

N

O

P

Q

R

S

T

U

V

W

X

D

data alignment for SPARC, index iconSPARC Data Alignment
data corruption
control data, index iconCorruption of Device Management and Control Data
detecting, index iconDetecting Corrupted Data
device management data, index iconCorruption of Device Management and Control Data
malignant, definition of, index iconCorruption of Device Management and Control Data
misleading, definition of, index iconCorruption of Device Management and Control Data
of received data, index iconCorruption of Received Data
data sharing
using devmap(), index iconData Sharing in devmap()
using ioctl(), index iconData Sharing in ioctl()
using mmap(), index iconData Sharing in mmap()
data storage classes, index iconStorage Classes of Driver Data
data structures
dev_ops structure, index icondev_ops Structure
GLDv2
index iconGLDv2 Declarations and Data Structures
index icongld_stats Structure
modldrv structure, index iconmodldrv Structure
data transfers, character drivers, index iconI/O Request Handling
ddi_cb_register() function, index iconCallback Interfaces
ddi_cb_unregister() function, index iconCallback Interfaces
DDI-compliant drivers
byte ordering, index iconEndianness
compliance testing, index iconDDI/DKI Compliance Testing
ddi_create_minor_node() function, index iconCreating Minor Device Nodes
ddi_device_acc_attr structure, index iconAccess Attributes Structure
ddi_device_copy() function, index iconddi_device_copy() Argument Changes
ddi_device_zero() function, index iconddi_device_zero() Argument Changes
ddi_devid_free() function, index iconRetrieving Target Device Information
DDI/DKI
See also LDI
design considerations, index iconDDI/DKI Facilities
and disk performance, index iconDisk Performance
overview, index iconDDI/DKI Interfaces
purpose in kernel, index iconWhat Is the Kernel?
ddi_dma_attr structure
index iconddi_dma_attr Structure
index iconDMA Attributes Structure
index iconddi_dma_attr
ddi_dma_cookie structure, index iconddi_dma_cookie Structure Changes
ddi_dma_getwin() function, index iconDMA Software Components: Handles, Windows, and Cookies
ddi_dma_mem_alloc() function, index iconddi_dma_mem_alloc() Argument Changes
ddi_dma_nextseg() function, index iconDMA Software Components: Handles, Windows, and Cookies
ddi_dma_sync() function
index iconDMA Isolation
index iconConfiguring the Test Harness
ddi_driver_major() function
index iconBlock Device Autoconfiguration
index iconBlock Device Autoconfiguration
ddi_enter_critical() function, index iconTiming-Critical Sections
ddi_eventcookie_t, index iconReceiving Asynchronous Device Event Notification
ddi_fm_acc_err_clear() function, index iconGetting Error Status
ddi_fm_acc_err_get() function
index iconAccess Attributes Structure
index iconAccess Attributes Structure
ddi_fm_capable() function, index iconGetting the Fault Management Capability Bit Mask
ddi_fm_dma_err_clear() function, index iconClearing Errors
ddi_fm_dma_err_get() function, index iconDMA Attributes Structure
ddi_fm_ereport_post() function
index iconReporting Errors
index iconReporting Errors
ddi_fm_error structure
index iconRegistering an Error Handler
index iconRegistering an Error Handler
index iconFault Management Data and Status Structure
ddi_fm_fini() function, index iconCleaning Up Fault Management Resources
ddi_fm_handler_register() function
index iconAccess Attributes Structure
index iconRegistering an Error Handler
ddi_fm_handler_unregister() function, index iconRegistering an Error Handler
ddi_fm_init() function, index iconDeclaring Fault Management Capabilities
ddi_fm_service_impact() function, index iconReporting Errors
DDI function tables, index iconSummary of Solaris DDI/DKI Services
ddi_get_cred() function
index icondrv_getparm() Argument Changes
index iconData Sharing in ioctl()
ddi_get_driver_private() function
index iconscsi_device Structure
index iconGLDv2 Driver Requirements
ddi_get_instance() function, index icongld_mac_info Structure
ddi_get_lbolt() function, index icondrv_getparm() Argument Changes
ddi_get_pid() function, index icondrv_getparm() Argument Changes
ddi_get_time() function, index icondrv_getparm() Argument Changes
ddi_get()X functions
index iconExclusive Use of DDI Access Handles
index iconFault Injection
DDI_INFO_DEVT2DEVINFO, index icongetinfo() Entry Point
DDI_INFO_DEVT2INSTANCE, index icongetinfo() Entry Point
ddi_intr_add_handler() function
index iconMSI-X Interrupts
index iconInterrupt Initialization and Destruction Functions
index iconRegistering Interrupts
ddi_intr_add_softint() function, index iconSoft Interrupt Functions
ddi_intr_alloc() function
index iconMSI-X Interrupts
index iconInterrupt Initialization and Destruction Functions
index iconInterrupt Request Interfaces
ddi_intr_block_disable() function, index iconInterrupt Initialization and Destruction Functions
ddi_intr_block_enable() function, index iconInterrupt Initialization and Destruction Functions
DDI_INTR_CLAIMED, index iconInterrupt Handler Functionality
ddi_intr_clr_mask() function
index iconInterrupt Initialization and Destruction Functions
index iconInterrupt Function Examples
ddi_intr_disable() function
index iconMSI-X Interrupts
index iconInterrupt Initialization and Destruction Functions
ddi_intr_dup_handler() function
index iconMSI-X Interrupts
index iconInterrupt Initialization and Destruction Functions
ddi_intr_enable() function
index iconMSI-X Interrupts
index iconInterrupt Initialization and Destruction Functions
ddi_intr_free() function
index iconMSI-X Interrupts
index iconInterrupt Initialization and Destruction Functions
ddi_intr_get_cap() function, index iconInterrupt Capability Functions
ddi_intr_get_hilevel_pri() function
index iconPriority Management Functions
index iconHandling High-Level Interrupts
ddi_intr_get_navail() function, index iconInterrupt Capability Functions
ddi_intr_get_nintrs() function, index iconInterrupt Capability Functions
ddi_intr_get_pending() function
index iconInterrupt Initialization and Destruction Functions
index iconInterrupt Function Examples
ddi_intr_get_pri() function
index iconPriority Management Functions
index iconHandling High-Level Interrupts
ddi_intr_get_softint_pri() function, index iconSoft Interrupt Functions
ddi_intr_get_supported_types() function, index iconInterrupt Capability Functions
ddi_intr_hilevel() function, index iconHigh-Level Interrupts
ddi_intr_remove_handler() function
index iconMSI-X Interrupts
index iconInterrupt Initialization and Destruction Functions
ddi_intr_remove_softint() function, index iconSoft Interrupt Functions
ddi_intr_set_cap() function, index iconInterrupt Initialization and Destruction Functions
ddi_intr_set_mask() function
index iconInterrupt Initialization and Destruction Functions
index iconInterrupt Function Examples
ddi_intr_set_nreq() function, index iconInterrupt Request Interfaces
ddi_intr_set_pri() function, index iconPriority Management Functions
ddi_intr_set_softint_pri() function
index iconSoft Interrupt Functions
index iconInterrupt Function Examples
ddi_intr_trigger_softint() function
index iconHigh-Level Interrupts
index iconSoft Interrupt Functions
DDI_INTR_UNCLAIMED, index iconInterrupt Handler Functionality
ddi_log_sysevent() function
index iconUsing ddi_log_sysevent() to Log Events
index iconUsing ddi_log_sysevent() to Log Events
ddi_model_convert_from() function, index iconData Sharing in ioctl()
ddi_peek() function, index iconAccess Attributes Structure
ddi_poke() function, index iconAccess Attributes Structure
ddi_prop_free() function, index iconDriver Source File
ddi_prop_get_int() function, index iconHBA Configuration Properties
ddi_prop_lookup() function, index iconLooking Up Properties
ddi_prop_lookup_string() function, index iconDriver Source File
ddi_prop_op() function, index iconprop_op() Entry Point
ddi_ptob() function, index iconDMA Isolation
ddi_put()X functions
index iconExclusive Use of DDI Access Handles
index iconFault Injection
ddi_regs_map_setup() function
index iconddi_device_acc_attr Structure
index iconExclusive Use of DDI Access Handles
index iconFault Injection
index iconConfiguring the Test Harness
ddi_removing_power() function, index icondetach() Entry Point
ddi_rep_get()X functions, index iconExclusive Use of DDI Access Handles
ddi_rep_put()X functions, index iconExclusive Use of DDI Access Handles
DDI_RESUME, detach() function, index icondetach() Entry Point
ddi_set_driver_private() function, index iconscsi_device Structure
DDI_SUSPEND, detach() function, index icondetach() Entry Point
ddi_umem_alloc() function
index iconAllocating Kernel Memory for User Access
index iconDMA Isolation
ddi_umem_free() function, index iconFreeing Kernel Memory Exported for User Access
DDX module, index iconThe X Window System Frame Buffer Specific DDX Module
DE (diagnosis engine), definition, index iconDiagnosing Faults
deadman kernel feature, index iconEnable the Deadman Feature to Avoid a Hard Hang
DEBUG symbol
index iconCompiling and Linking the Driver
index iconUse ASSERT() to Catch Invalid Assumptions
debugging
ASSERT() macro, index iconUse ASSERT() to Catch Invalid Assumptions
booting an alternate kernel, index iconTo Boot With an Alternate Kernel
coding hints, index iconDebugging Preparation Techniques
common tasks, index iconUseful Debugging Tasks With kmdb and mdb
conditional compilation, index iconUse Conditional Compilation to Toggle Costly Debugging Features
console frame buffer drivers, index iconDeveloping, Testing, and Debugging Console Frame Buffer Drivers
DEBUG symbol, index iconUse ASSERT() to Catch Invalid Assumptions
detecting kernel memory leaks, index iconDetecting Kernel Memory Leaks
displaying kernel data structures, index iconObtaining Kernel Data Structure Information
system file, index iconSetting Up Test Modules
kmdb debugger, index iconUsing the kmdb Kernel Debugger
kmem_flags, index iconSetting kmem_flags Debugging Flags
mdb debugger, index iconUsing the mdb Modular Debugger
moddebug, index iconLoading and Unloading Test Modules
postmortem, index iconPostmortem Debugging
preparing for disasters, index iconAvoiding Data Loss on a Test System
setting up a serial connection, index iconTesting With a Serial Connection
setting up a SPARC test system, index iconSetting Up a Target System on the SPARC Platform
setting up an x86 test system, index iconSetting Up a Target System on the x86 Platform
system registers, index iconExploring System Registers With kmdb
tools, index iconDebugging Tools
using kernel variables, index iconModifying Kernel Variables
using the SPARC PROM for device debugging, index iconPROM on SPARC Machines
writing mdb commands, index iconWriting Debugger Commands With mdb
delay() function, index icondelay() and timeout() Argument Changes
changes to, index icondelay() and timeout() Argument Changes
dependency, index iconPower Management Dependencies
deprecated device access functions, index iconUser Application Kernel and Device Access Functions
deprecated DMA functions, index iconDirect Memory Access (DMA) Functions
deprecated interrupt functions, index iconInterrupt Functions
deprecated memory allocation functions, index iconMemory Allocation and Deallocation Functions
deprecated power management functions, index iconPower Management Functions
deprecated programmed I/O functions, index iconProgrammed I/O Functions
deprecated property functions, index iconProperty Functions
deprecated SCSI functions, index iconSCSI Functions
deprecated time-related functions, index iconTime-Related Functions
deprecated user application kernel functions, index iconUser Application Kernel and Device Access Functions
deprecated user process information functions, index iconUser Process Information Functions
deprecated user space access functions, index iconUser Space Access Functions
deprecated virtual memory functions, index iconVirtual Memory Functions
descriptor tree
index iconThe Descriptor Tree
index iconRegistering Drivers to Gain Device Access
dest_adcent argument, ddi_device_copy(), changes to, index iconddi_device_copy() Argument Changes
detach() entry point
active power management, index iconDevice Power Management
description of, index icondetach() Entry Point
hot removal, index iconHot Removal
network drivers, index iconGLDv3 MAC Registration Functions
system power management, index iconSystem Power Management
detecting kernel memory leaks with mdb, index iconDetecting Kernel Memory Leaks
dev_advcnt argument, ddi_device_zero(), changes to, index iconddi_device_zero() Argument Changes
dev_datasz argument, ddi_device_copy(), changes to, index iconddi_device_copy() Argument Changes
dev_datasz argument, ddi_device_zero(), changes to, index iconddi_device_zero() Argument Changes
dev_info_t functions, index iconDevice Information Tree Node (dev_info_t) Functions
dev_ops structure, description of, index icondev_ops Structure
dev_t functions, index iconDevice (dev_t) Functions
devfsadm command, index iconInstalling Drivers with add_drv
device
alternate settings, index iconHow USB Devices Appear to the System
composite
index iconDevices With Multiple Interfaces
index iconManaging Entire Devices
configurations, index iconHow USB Devices Appear to the System
endpoints, index iconHow USB Devices Appear to the System
interface number, index iconGetting Interface Numbers
interfaces, index iconHow USB Devices Appear to the System
quiesce, index iconExample Implementation of Interrupt Resource Management
resume, index iconExample Implementation of Interrupt Resource Management
splitting interfaces
index iconDevices With Multiple Interfaces
index iconMultiple-Configuration Devices
device access functions
block drivers, index iconopen() Entry Point (Block Drivers)
character drivers, index iconopen() Entry Point (Character Drivers)
deprecated, index iconUser Application Kernel and Device Access Functions
table, index iconUser Application Kernel and Device Access Functions
device configuration, entry points, index iconDevice Configuration Concepts
device context management, index iconWhat Is a Device Context?
entry points, index iconEntry Points for Device Context Management
model, index iconContext Management Model
operation, index iconContext Management Operation
device-dependency, power.conf entry, index iconPower Management Dependencies
device-dependency-property, power.conf entry, index iconPower Management Dependencies
device directory, recovering, index iconRecovering the Device Directory
device drivers
See also compiling drivers
See also linking drivers
See also loading drivers
64-bit drivers
index iconI/O Control Support for 64-Bit Capable Device Drivers
index iconMaking a Device Driver 64-Bit Ready
access from within kernel, index iconLayered Driver Interface (LDI)
aliases, index iconUpdating Driver Information
binding to device node
index iconBinding a Driver to a Device
index iconCompatible Device Names
bindings, index iconChecking Device Driver Bindings
block driver, index iconEntry Points for Block Device Drivers
configuration descriptor clouds, index iconHot Reinsertion
context, index iconDriver Context
debugging, index iconDebugging, Testing, and Tuning Device Drivers
coding hints, index iconDebugging Preparation Techniques
setting up a serial connection, index iconTesting With a Serial Connection
tools, index iconDebugging Tools
using the PROM, index iconPROM on SPARC Machines
definition, index iconWhat Is a Device Driver?
entry points, index iconWhat Is a Device Driver Entry Point?
error handling, index iconError Handling
header files, index iconHeader Files
hubd USB hub driver, index iconHot Insertion
loadable interface, index iconLoadable Driver Interfaces
modifying information with update_drv, index iconUpdating Driver Information
modifying permissions, index iconUpdating Driver Information
module configuration, index iconSource Files
network drivers, index iconDrivers for Network Devices
offlining
index iconHotplug Callbacks
index iconHot Removal
packaging, index iconDriver Packaging
printing messages, index iconReturning Errors
purpose in kernel, index iconWhat Is the Kernel?
source files, index iconSource Files
standard character driver, index iconEntry Points for Character Device Drivers
testing
index iconCriteria for Testing Drivers
index iconTesting Drivers
tuning, index iconTuning Drivers
USB driver, index iconUSB Drivers
usb_mid USB multi-interface driver
index iconDevices With Multiple Interfaces
index iconHot Removal
index iconGetting Interface Numbers
using kstats, index iconKernel Statistics
device ID functions, index iconDevice ID Functions
device information
binding a driver to a device, index iconBinding a Driver to a Device
binding a driver to a USB device, index iconCompatible Device Names
compatible device names, index iconCompatible Device Names
di_link_next_by_lnode() function, index iconDevice Information Library Interfaces
di_link_next_by_node() function, index iconDevice Information Library Interfaces
di_link_private_get() function, index iconDevice Information Library Interfaces
di_link_private_set() function, index iconDevice Information Library Interfaces
di_link_spectype() function, index iconDevice Information Library Interfaces
di_link_t, index iconDevice Information Library Interfaces
di_link_to_lnode() function, index iconDevice Information Library Interfaces
di_lnode_devinfo() function, index iconDevice Information Library Interfaces
di_lnode_devt() function, index iconDevice Information Library Interfaces
di_lnode_name() function, index iconDevice Information Library Interfaces
di_lnode_next() function, index iconDevice Information Library Interfaces
di_lnode_private_get() function, index iconDevice Information Library Interfaces
di_lnode_private_set() function, index iconDevice Information Library Interfaces
di_lnode_t, index iconDevice Information Library Interfaces
di_node_t, index iconDevice Information Library Interfaces
di_walk_link() function, index iconDevice Information Library Interfaces
di_walk_lnode() function, index iconDevice Information Library Interfaces
DINFOLYR, index iconDevice Information Library Interfaces
LDI, index iconRetrieving Target Device Information
lnode, index iconDevice Information Library Interfaces
nblocks property, index iconDevice Sizes
Nblocks property, index iconDevice Sizes
property values, index iconRetrieving Target Device Property Values
self-identifying, index iconDevice Identification
tree structure
index iconDevice Tree Components
index iconDevice Tree Components
device instances, index iconFault Injection
device interrupts, See interrupts; interrupt handling
device layering, See LDI
device memory
D_DEVMAP flag in cb_ops, index iconcb_ops Structure
mapping
index iconEntry Points for Memory Mapped Devices
index iconMapping Device and Kernel Memory
device node, index iconUSB Devices and the Oracle Solaris Device Tree
device number, description of, index iconDevices as Special Files
device polling, index iconInterrupt Handler Functionality
in character drivers, index iconMultiplexing I/O on File Descriptors
chpoll() function, index iconMultiplexing I/O on File Descriptors
poll() function, index iconMultiplexing I/O on File Descriptors
device power management
components, index iconPower Management Components
definition of, index iconPower Management Framework
dependency, index iconPower Management Dependencies
entry points, index iconpower() Entry Point
interfaces, index iconDevice Power Management Interfaces
model, index iconDevice Power Management Model
pm_busy_component() function
index iconPower Management States
index iconBusy-Idle State Transitions
index iconDevice Power Management
index iconDevice Power Management
pm_idle_component() function
index iconPower Management States
index iconBusy-Idle State Transitions
index iconBusy-Idle State Transitions
index iconDevice Power Management
index iconDevice Power Management
pm_lower_power() function
index iconPower Levels
index iconDevice Power Management
pm_raise_power() function
index iconMultiple Power Management Components
index iconPower Levels
index iconBusy-Idle State Transitions
index iconDevice Power Management
index iconDevice Power Management
power() entry point
index iconDevice Power Management
index iconDevice Power Management
power() function, index iconpower() Entry Point
power levels, index iconPower Levels
state transitions, index iconBusy-Idle State Transitions
usb_create_pm_components() function, index iconDevice Power Management
USB devices, index iconDevice Power Management
device registers, mapping, index iconattach() Entry Point
device state in power management, index iconHardware State
device tree
displaying, index iconDisplaying the Device Tree
navigating, in debugger, index iconObtaining Device Tree Information
overview, index iconDevice Tree Components
purpose in kernel, index iconWhat Is the Kernel?
device usage, index iconKernel Interfaces
See LDI
/devices directory
description of, index iconDevices as Special Files
displaying the device tree, index icon/devices Directory
devinfo tree, index iconFault Injection
devmap_ entry point, devmap_access() function, index icondevmap_access() Entry Point
devmap_ entry points
devmap_access() function, index icondevmap_unload() Entry Point
devmap_contextmgt()function, index icondevmap_contextmgt() Entry Point
devmap_dup() function, index icondevmap_dup() Entry Point
devmap() function, index iconThe devmap(9E) Entry Point
devmap_map() function, index icondevmap_map() Entry Point
devmap_unmap() function, index icondevmap_unmap() Entry Point
devmap_ functions
devmap_devmem_setup() function, index iconAssociating Device Memory With User Mappings
devmap_load() function, index icondevmap_load() Entry Point
devmap_umem_setup() function, index iconExporting Kernel Memory to Applications
devmap_unload() function, index icondevmap_unload() Entry Point
diagnosis engine, definition, index iconWhat Is Predictive Self-Healing?
.dict dictionary files, index iconMessage IDs and Dictionary Files
disaster recovery, index iconRecovering the Device Directory
disk
I/O controls, index iconDisk ioctls
performance, index iconDisk Performance
disk driver testing, index iconDisk Drivers
DKI, See DDI/DKI
DL_ETHER, network statistics, index iconGLDv2 Network Statistics
DLIOCRAW, ioctl() function, index iconGLDv2 I/O Control Functions
DLPI (Data Link Provider Interface), See network drivers, GLDv2
DLPI primitives, DL_GET_STATISTICS_REQ, index iconGLDv2 Network Statistics
DMA
buffer allocation, index iconAllocating Private DMA Buffers
burst sizes, index iconDetermining Maximum Burst Sizes
callbacks, index iconCanceling DMA Callbacks
cookie
index iconDMA Model
index iconDMA Software Components: Handles, Windows, and Cookies
freeing handle, index iconFreeing the DMA Handle
freeing resources, index iconFreeing the DMA Resources
handle
index iconDMA Model
index iconDMA Software Components: Handles, Windows, and Cookies
index iconAllocating a DMA Handle
object, index iconDMA Model
object locking, index iconObject Locking
operations, index iconDMA Operations
physical addresses, index iconTypes of Host Platform DMA
private buffer allocation, index iconAllocating Private DMA Buffers
register structure, index iconDevice Register Structure
resource allocation, index iconAllocating DMA Resources
restrictions, index iconDMA Attributes
transfers
index iconDMA Operations
index iconDMA Transfers (Synchronous)
virtual addresses, index iconTypes of Host Platform DMA
windows
index iconDMA Software Components: Handles, Windows, and Cookies
index iconDMA Windows
DMA functions, index iconDirect Memory Access (DMA) Functions
deprecated, index iconDirect Memory Access (DMA) Functions
driver binding name, index iconBinding a Driver to a Device
driver.conf files, See hardware configuration files
driver instances, index iconUsing Separate Device Driver Instances
driver module entry points, See entry points
drivers, requests from user applications, index iconThreats From Top-Down Requests
drv_getparm() function, changes to, index icondrv_getparm() Argument Changes
drv_usecwait(9F), index iconDelays
DTrace
definition, index iconDTrace for Dynamic Instrumentation
task queues, index iconTask Queue DTrace SDT Probes
dump() entry point, block drivers, index icondump() Entry Point (Block Drivers)
DVMA
SBus slots supporting, index iconPhysical SBus Addresses
virtual addresses, index iconTypes of Host Platform DMA
dynamic memory allocation, index iconDynamic Memory Allocation