Writing Device Drivers


Writing Device Drivers provides information on developing device drivers for character-oriented devices, block-oriented devices, and small computer system interface (SCSI) target devices. This book discusses the development of a dynamically loadable and unloadable, multithreaded reentrant device driver applicable to all architectures that conform to the SolarisTM 7 DDI/DKI. A common driver programming approach is taken so that drivers can be written without concern for platform-specific issues such as endianness and data ordering.

Who Should Use This Book

The audience for this book is UNIX® programmers familiar with UNIX device drivers. Several overview chapters at the beginning of the book provide background information for the detailed technical chapters that follow, but they are not intended as a general tutorial or text on device drivers.

How This Book Is Organized

This book is organized into the following chapters.

Related Books

For detailed reference information about the device driver interfaces, see the man page sections 9, 9E (entry points), 9F (functions), and 9S (structures). For information on hardware issues and other driver-related issues, the following books may be helpful.

Ordering Sun Documents

The SunDocsSM program provides more than 250 manuals from Sun Microsystems, Inc. If you live in the United States, Canada, Europe, or Japan, you can purchase documentation sets or individual manuals using this program.

For a list of documents and how to order them, see the catalog section of the SunExpressTM Internet site at http://www.sun.com/sunexpress.

What Typographic Changes Mean

Table P-1 describes the typographic changes used in this book.

Table P-1 Typographic Conventions

Typeface or Symbol 




The names of commands, files, and directories; on-screen computer output 

di_add_intr() registers a device interrupt with the system.

add_drv adds a driver to the system.



What you type, contrasted with on-screen computer output 

machine_name% su


Command-line placeholder: 

replace with a real name or value 

number is the number of the interrupt to register.


Book titles, new words or terms, or words to be emphasized 

Read Chapter 6 in Writing Device Drivers. A mutual exclusion lock is....

Note -

The term "x86" refers to the Intel 8086 family of microprocessor chips, including the Pentium and Pentium Pro processors and compatible microprocessor chips made by AMD and Cyrix. In this document the term "x86" refers to the overall platform architecture, whereas "Intel Platform Edition" appears in the product name of x86 products.