<?Pub UDT _bookmark _target?><?Pub EntList amp nbsp gt lt ndash hyphen?><?Pub CX solbook(book(title()bookinfo()?><preface id="preface-1"><title>Preface</title><highlights><para><citetitle>Writing Device Drivers</citetitle> provides information on developing
drivers for character-oriented devices, block-oriented devices, network devices,
SCSI target and HBA devices, and USB devices for the <trademark>Solaris</trademark> Operating
System (Solaris OS). This book discusses how to develop multithreaded reentrant
device drivers for all architectures that conform to the Solaris OS DDI/DKI
(Device Driver Interface, Driver-Kernel Interface). A common driver programming
approach is described that enables drivers to be written without concern for
platform-specific issues such as endianness and data ordering.</para><para>Additional topics include hardening Solaris drivers; power management;
driver autoconfiguration; programmed I/O; Direct Memory Access (DMA); device
context management; compilation, installation, and testing drivers; debugging
drivers; and porting Solaris drivers to a 64-bit environment.</para><note><para>This Solaris release supports systems that use the <trademark class="registered">SPARC</trademark> and x86 families of processor architectures: <trademark class="registered">UltraSPARC</trademark>, SPARC64, AMD64, Pentium, and Xeon
EM64T. For supported systems, see the <citetitle>Solaris OS Hardware Compatibility
Lists</citetitle> at <ulink url="http://www.sun.com/bigadmin/hcl/" type="url"></ulink>.
This document cites any implementation differences between the platform types.</para>
</note>
</highlights><sect1 id="wdd-whatsnew"><title>What's New</title><para><emphasis role="strong">SX build 96:</emphasis> Rewrote the description
of the sleep-flag flag on page 86.</para><para><emphasis role="strong">SX build 88:</emphasis> Added the <function>strnlen</function> function to <olink targetptr="ddidkisvc-73" remap="internal">Utility Functions</olink>.
Added  the <function>ddi_periodic_add</function> and <function>ddi_periodic_delete</function> functions to <olink targetptr="fcaon" remap="internal">Time-Related Functions</olink>.</para>
</sect1><sect1 id="preface-9"><title id="preface-2">Who Should Use This Book</title><para>This book is written for <trademark class="registered">UNIX</trademark> programmers
who are familiar with UNIX device drivers. Overview information is provided,
but the book is not intended to serve as a general tutorial on device drivers.</para><note><para>The Solaris operating system (Solaris OS) runs on both SPARC and
x86 architectures. The Solaris OS also runs on both 64-bit and 32-bit address
spaces. The information in this document applies to all platforms and address
spaces unless specifically noted.</para>
</note>
</sect1><sect1 id="preface-4"><title>How This Book Is Organized</title><itemizedlist><para>This book is organized into the following chapters:</para><listitem><para><olink targetptr="eqbqn" remap="internal">Chapter&nbsp;1, Overview of Solaris
Device Drivers</olink> provides an introduction to device drivers and associated
entry points on the Solaris platform. The entry points for each device driver
type are presented in tables.</para>
</listitem><listitem><para><olink targetptr="kernelovr-77198" remap="internal">Chapter&nbsp;2, Solaris
Kernel and Device Tree</olink> provides an overview of the Solaris kernel
with an explanation of how devices are represented as nodes in a device tree.</para>
</listitem><listitem><para><olink targetptr="mt-17026" remap="internal">Chapter&nbsp;3, Multithreading</olink> describes
the aspects of the Solaris multithreaded kernel that are relevant for device
driver developers.</para>
</listitem><listitem><para><olink targetptr="properties-1" remap="internal">Chapter&nbsp;4, Properties</olink> describes
the set of interfaces for using device properties.</para>
</listitem><listitem><para><olink targetptr="events-1" remap="internal">Chapter&nbsp;5, Managing Events
and Queueing Tasks</olink> describes how device drivers log events and how
to use task queues to perform a task at a later time.</para>
</listitem><listitem><para><olink targetptr="autoconf-17" remap="internal">Chapter&nbsp;6, Driver Autoconfiguration</olink> explains the support that a driver must provide for autoconfiguration.</para>
</listitem><listitem><para><olink targetptr="devaccess-3" remap="internal">Chapter&nbsp;7, Device Access:
Programmed I/O</olink> describes the interfaces and methodologies for drivers
to read or write to device memory.</para>
</listitem><listitem><para><olink targetptr="interrupt-15678" remap="internal">Chapter&nbsp;8, Interrupt
Handlers</olink> describes the mechanisms for handling interrupts. These mechanisms
include registering, servicing, and removing interrupts.</para>
</listitem><listitem><para><olink targetptr="dma-29901" remap="internal">Chapter&nbsp;9, Direct Memory
Access (DMA)</olink> describes direct memory access (DMA) and the DMA interfaces.</para>
</listitem><listitem><para><olink targetptr="devmap-24338" remap="internal">Chapter&nbsp;10, Mapping Device
and Kernel Memory</olink> describes interfaces for managing device and kernel
memory.</para>
</listitem><listitem><para><olink targetptr="devcnmgt-19679" remap="internal">Chapter&nbsp;11, Device
Context Management</olink> describes the set of interfaces that enable device
drivers to manage user access to devices.</para>
</listitem><listitem><para><olink targetptr="powermgt-37437" remap="internal">Chapter&nbsp;12, Power Management</olink> explains the interfaces for <trademark>Power Management</trademark>,
a framework for managing power consumption.</para>
</listitem><listitem><para><olink targetptr="gevsi" remap="internal">Chapter&nbsp;13, Hardening Solaris
Drivers</olink> describes how to integrate fault management capabilities into
I/O device drivers, how to incorporate defensive programming practices, and
how to use the driver hardening test harness.</para>
</listitem><listitem><para><olink targetptr="ldi-1" remap="internal">Chapter&nbsp;14, Layered Driver Interface
(LDI)</olink> describes the LDI, which enables kernel modules to access other
devices in the system.</para>
</listitem><listitem><para><olink targetptr="character-21002" remap="internal">Chapter&nbsp;15, Drivers
for Character Devices</olink> describes drivers for character-oriented devices.</para>
</listitem><listitem><para><olink targetptr="block-34861" remap="internal">Chapter&nbsp;16, Drivers for
Block Devices</olink> describes drivers for a block-oriented devices.</para>
</listitem><listitem><para><olink targetptr="scsi-36812" remap="internal">Chapter&nbsp;17, SCSI Target
Drivers</olink> outlines the Sun Common SCSI Architecture (SCSA) and the requirements
for SCSI target drivers.</para>
</listitem><listitem><para><olink targetptr="scsihba-32898" remap="internal">Chapter&nbsp;18, SCSI Host
Bus Adapter Drivers</olink> explains how to apply SCSA to SCSI Host Bus Adapter
(HBA) drivers.</para>
</listitem><listitem><para><olink targetptr="gld-1" remap="internal">Chapter&nbsp;19, Drivers for Network
Devices</olink> describes the Generic LAN driver (GLD), a Solaris network
driver that uses STREAMS technology and the Data Link Provider Interface (DLPI).</para>
</listitem><listitem><para><olink targetptr="usb-1" remap="internal">Chapter&nbsp;20, USB Drivers</olink> describes
how to write a client USB device driver using the USBA&nbsp;2.0 framework.</para>
</listitem><listitem><para><olink targetptr="loading-15035" remap="internal">Chapter&nbsp;21, Compiling,
Loading, Packaging, and Testing Drivers</olink> provides information on compiling,
linking, and installing a driver.</para>
</listitem><listitem><para><olink targetptr="debug-60" remap="internal">Chapter&nbsp;22, Debugging, Testing,
and Tuning Device Drivers</olink> describes techniques for debugging, testing,
and tuning drivers.</para>
</listitem><listitem><para><olink targetptr="coding-practices" remap="internal">Chapter&nbsp;23, Recommended
Coding Practices</olink> describes the recommended coding practices for writing
drivers.</para>
</listitem><listitem><para><olink targetptr="hwovr-18191" remap="internal">Appendix&nbsp;A, Hardware Overview</olink> discusses multi-platform hardware issues for device drivers.</para>
</listitem><listitem><para><olink targetptr="ddidkisvc-29227" remap="internal">Appendix&nbsp;B, Summary
of Solaris DDI/DKI Services</olink> provides tables of kernel functions for
device drivers. Deprecated functions are indicated as well.</para>
</listitem><listitem><para><olink targetptr="lp64-35004" remap="internal">Appendix&nbsp;C, Making a Device
Driver 64-Bit Ready</olink> provides guidelines for updating a device driver
to run in a 64-bit environment.</para>
</listitem><listitem><para><olink targetptr="euazz" remap="internal">Appendix&nbsp;D, Console Frame Buffer
Drivers</olink> describes how to add the necessary interfaces to a frame buffer
driver to enable the driver to interact with the Solaris kernel terminal emulator.</para>
</listitem>
</itemizedlist>
</sect1><sect1 id="preface-5"><title>Related Books and Papers</title><para>For detailed reference information about the device driver interfaces,
see the section&nbsp;9 man pages. Section&nbsp;9E, <olink targetdoc="group-refman" targetptr="intro-9e" remap="external"><citerefentry><refentrytitle>Intro</refentrytitle><manvolnum>9E</manvolnum></citerefentry></olink>, describes DDI/DKI (Device
Driver Interface, Driver-Kernel Interface) driver entry points. Section&nbsp;9F, <olink targetdoc="group-refman" targetptr="intro-9f" remap="external"><citerefentry><refentrytitle>Intro</refentrytitle><manvolnum>9F</manvolnum></citerefentry></olink>, describes DDI/DKI kernel
functions. Sections&nbsp;9P and&nbsp;9S, <olink targetdoc="group-refman" targetptr="intro-9s" remap="external"><citerefentry><refentrytitle>Intro</refentrytitle><manvolnum>9S</manvolnum></citerefentry></olink>, describe DDI/DKI properties
and data structures.</para><itemizedlist><para>For information on hardware and other driver-related issues, see the
following books from Sun Microsystems:</para><listitem><para><olink targetdoc="drivertut" remap="external"><citetitle remap="book">Device
Driver Tutorial</citetitle></olink>. Sun Microsystems, Inc., 2008.</para>
</listitem><listitem><para><olink targetdoc="packinstall" remap="external"><citetitle remap="book">Application
Packaging Developer&rsquo;s Guide</citetitle></olink>. Sun Microsystems, Inc.,
2005.</para>
</listitem><listitem><para><citetitle>Open Boot PROM Toolkit User's Guide</citetitle>.
Sun Microsystems, Inc., 1996.</para>
</listitem><listitem><para><olink targetdoc="streams" remap="external"><citetitle remap="book">STREAMS
Programming Guide</citetitle></olink>. Sun Microsystems, Inc., 2005.</para>
</listitem><listitem><para><olink targetdoc="mtp" remap="external"><citetitle remap="book">Multithreaded
Programming Guide</citetitle></olink>. Sun Microsystems, Inc., 2008.</para>
</listitem><listitem><para><olink targetdoc="sol64trans" remap="external"><citetitle remap="book">Solaris
64-bit Developer&rsquo;s Guide</citetitle></olink>. Sun Microsystems, Inc.,
2005.</para>
</listitem><listitem><para><olink targetdoc="moddebug" remap="external"><citetitle remap="book">Solaris
Modular Debugger Guide</citetitle></olink>. Sun Microsystems, Inc., 2008.</para>
</listitem><listitem><para><olink targetdoc="dynmctrcggd" remap="external"><citetitle remap="book">Solaris
Dynamic Tracing Guide</citetitle></olink>. Sun Microsystems, Inc., 2007.</para>
</listitem><listitem><para><olink targetdoc="dtrcug" remap="external"><citetitle remap="book">DTrace User
Guide</citetitle></olink>. Sun Microsystems, Inc., 2006.</para>
</listitem>
</itemizedlist><itemizedlist><para>The following books from other sources might also be useful:</para><listitem><para><citetitle>The SPARC Architecture Manual, Version 9</citetitle>.
Prentice Hall, 1998. ISBN 0-13-099227-5.</para>
</listitem><listitem><para><citetitle>The SPARC Architecture Manual, Version 8</citetitle>.
Prentice Hall, 1994.  ISBN 0-13-825001-4.</para>
</listitem><listitem><para><citetitle>Pentium Pro Family Developer's Manual, Volumes
1-3</citetitle>. Intel Corporation, 1996. Volume 1, ISBN 1-55512-259-0; Volume
2, ISBN 1-55512-260-4; Volume 3, ISBN 1-55512-261-2.</para>
</listitem>
</itemizedlist>
</sect1>&sundocs;&typeconv;
</preface><?Pub *0000012113 0?>