[Return to Library] [Contents] [Next Section] [Next Chapter] [Index] [Help]


About This Book

This book discusses advanced topics related to writing device drivers for computer systems running the Digital UNIX® operating system. These advanced topics are beyond the scope of the core tutorial.


[Return to Library] [Contents] [Previous Chapter] [Next Section] [Next Chapter] [Index] [Help]


Audience

This book is intended for systems engineers who:

This book assumes that you have a strong background in operating systems based on the UNIX operating system. It also assumes that you have a strong background in systems and C programming, and that you are familiar with topics presented in Writing Device Drivers: Tutorial. In addition, the book assumes that you have no source code licenses.


[Return to Library] [Contents] [Previous Chapter] [Previous Section] [Next Section] [Next Chapter] [Index] [Help]


New and Changed Features

The following sections summarize the changes and additions made to this version of the book.


[Return to Library] [Contents] [Previous Chapter] [Previous Section] [Next Section] [Next Chapter] [Index] [Help]


Changes to Chapter 5: Using Funnels

This chapter is rewritten to reflect the replacement of the bdevsw and cdevsw structures with the dsent structure and the replacement of the bdevsw_add, cdevsw_add, and dualdevsw_add interfaces with the devsw_add interface.


[Return to Library] [Contents] [Previous Chapter] [Previous Section] [Next Section] [Next Chapter] [Index] [Help]


Changes to Chapter 7: Using Kernel Threads-Related Interfaces

This chapter contains a new section, ``Terminating a Kernel Thread,'' that discusses how to terminate a kernel thread. Terminating a kernel thread involves the use of the current_thread, thread_halt_self, and thread_terminate interfaces.


[Return to Library] [Contents] [Previous Chapter] [Previous Section] [Next Section] [Next Chapter] [Index] [Help]


Chapter 8: Writing a Disk Device Driver

This new chapter describes how to write a disk device driver for Digital UNIX.


[Return to Library] [Contents] [Previous Chapter] [Previous Section] [Next Section] [Next Chapter] [Index] [Help]


Appendix B: Example Disk Device Driver

This new appendix provides a sample disk device driver.


[Return to Library] [Contents] [Previous Chapter] [Previous Section] [Next Section] [Next Chapter] [Index] [Help]


Scope of the Book

This book is for users of the Digital UNIX operating system on computer systems developed by Digital Equipment Corporation.
The book builds on the concepts and topics presented in Writing Device Drivers: Tutorial, the core book for developing device drivers on Digital UNIX.

The book introduces driver writers to topics that are beyond the scope of the core tutorial; it does not emphasize any specific types of device drivers. The book presents examples that show how to use the interfaces associated with symmetric multiprocessing and kernel threads.

The book assumes that you have written at least one Digital UNIX device driver, adhering to the guidelines and using the interfaces described in Writing Device Drivers: Tutorial and Writing Device Drivers: Reference.


[Return to Library] [Contents] [Previous Chapter] [Previous Section] [Next Section] [Next Chapter] [Index] [Help]


Organization

The book contains the following chapters and appendixes.


Part 1 Overview

Part 1 contains one chapter, whose goal is to provide you with a review of general device driver concepts.
Chapter 1 Review of Device Driver Concepts
  Reviews general device driver concepts, which are discussed in detail in Writing Device Drivers: Tutorial.


Part 2 Device Drivers and Symmetric Multiprocessing

Part 2 contains four chapters, whose combined goal is to provide the information necessary to write device drivers that can operate in a symmetric multiprocessing (SMP) environment.
Chapter 2 Overview of the Symmetric Multiprocessing Environment
  Provides an overview of the symmetric multiprocessing (SMP) environment, including guidelines on which items a device driver must lock. The chapter also compares simple locks, complex locks, and funnels, which are the methods available in Digital UNIX for writing SMP-safe device drivers. Read this chapter to gain an understanding of the differences between the methods and to choose the method most appropriate for your device drivers.
Chapter 3 Using Simple Lock Interfaces
  Describes how to use the simple lock interfaces to make device drivers safe in an SMP environment. Read this chapter to learn how to use the simple lock interfaces.
Chapter 4 Using Complex Lock Interfaces
  Describes how to use the complex lock interfaces to make device drivers safe in an SMP environment. Read this chapter to learn how to use the complex lock interfaces.
Chapter 5 Using Funnels
  Describes how to initialize the dsent table to implement SMP-safe device drivers. Read this chapter to learn how to use the funnel mechanism to implement SMP-safe device drivers.


Part 3 Device Drivers and Kernel Threads

Part 3 contains two chapters, whose combined goal is to provide the information necessary to use kernel threads in device drivers.
Chapter 6 Device Drivers and Multithreaded Programming
  Provides an introduction to multithreaded programming in device drivers. Read this chapter to gain an understanding of kernel threads as they relate to device drivers.
Chapter 7 Using Kernel Threads-Related Interfaces
  Describes how to use the kernel threads-related interfaces. Read this chapter to learn how to use the kernel threads interfaces to implement kernel threads in device drivers.


Part 5 Appendixes

Part 5 contains two appendixes and a glossary.
Appendix A Summary Tables
  Presents tables that summarize the header files, kernel interfaces, data structures, and other interfaces that device drivers use.
Appendix B Example Disk Device Driver
  Presents the source listing for a sample disk device driver called /dev/xxx_disk.
Glossary Glossary
  Provides definitions of terms used in the book.



[Return to Library] [Contents] [Previous Chapter] [Previous Section] [Next Section] [Next Chapter] [Index] [Help]


Related Documentation


The printed version of the Digital UNIX documentation set is color coded to help specific audiences quickly find the books that meet their needs. (You can order the printed documentation from Digital.) This color coding is reinforced with the use of an icon on the spines of books. The following list describes this convention:
Audience Icon Color Code
General users G Blue
System and network administrators S Red
Programmers P Purple
Device driver writers D Orange
Reference page users R Green


Some books in the documentation set help meet the needs of several audiences. For example, the information in some system books is also used by programmers. Keep this in mind when searching for information on specific topics.

The Documentation Overview, Glossary, and Master Index provides information on all of the books in the Digital UNIX documentation set.

Writing device drivers is a complex task; driver writers require knowledge in a variety of areas. One way to acquire this knowledge is to have at least the following categories of documentation available:

The following sections list the documentation associated with each of these categories.


[Return to Library] [Contents] [Previous Chapter] [Previous Section] [Next Section] [Next Chapter] [Index] [Help]


Hardware Documentation

You should have available the hardware manual associated with the device for which you are writing the device driver. You should also have access to the manual that describes the architecture associated with the CPU that the driver operates on, for example, the Alpha Architecture Reference Manual.


[Return to Library] [Contents] [Previous Chapter] [Previous Section] [Next Section] [Next Chapter] [Index] [Help]


Bus-Specific Device Driver Documentation

Writing Device Drivers: Tutorial is the core book for developing device drivers on the Digital UNIX operating system. It contains information needed for developing drivers on any bus that operates on Digital platforms.

Writing Device Drivers: Reference is a companion volume to the tutorial and describes, in reference-page style, the header files, kernel interfaces, data structures, and other interfaces that device drivers use.

Writing Device Drivers: Advanced Topics provides information on topics that are beyond the scope of the core tutorial. Systems engineers can find information on such advanced topics as kernel threads and writing device drivers in a symmetric multiprocessing (SMP) environment.

The following books provide information about writing device drivers for a specific bus that is beyond the scope of the core tutorial and reference:


[Return to Library] [Contents] [Previous Chapter] [Previous Section] [Next Section] [Next Chapter] [Index] [Help]


Operating System Overview Documentation

Refer to the Technical Overview for a technical introduction to the Digital UNIX operating system. This manual provides a technical overview of the Digital UNIX system, focusing on the networking subsystem, the file system, virtual memory, and the development environment. In addition, the manual lists all system limits.

This manual does not supersede the Software Product Description (SPD), which is the definitive description of the Digital UNIX system.


[Return to Library] [Contents] [Previous Chapter] [Previous Section] [Next Section] [Next Chapter] [Index] [Help]


Programming Tools Documentation

To create your device drivers, you use a number of programming development tools and should have on hand the manuals that describe how to use these tools. The following manuals provide information related to programming tools used in the Digital UNIX operating system environment:


[Return to Library] [Contents] [Previous Chapter] [Previous Section] [Next Section] [Next Chapter] [Index] [Help]


System Management Documentation

Refer to the System Administration manual for information about building a kernel and for general information on system administration. This manual describes how to configure, use, and maintain the Digital UNIX operating system. It includes information on general day-to-day activities and tasks, changing your system configuration, and locating and eliminating sources of trouble.

This manual is for the system administrators responsible for managing the operating system. It assumes a knowledge of operating system concepts, commands, and configurations.


[Return to Library] [Contents] [Previous Chapter] [Previous Section] [Next Section] [Next Chapter] [Index] [Help]


Porting Documentation

Refer to the Digital UNIX Migration Guide for a discussion of the differences between the Digital UNIX and ULTRIX operating systems. This manual compares the Digital UNIX operating system to the ULTRIX operating system by describing the differences between the two systems.

This manual has three audiences, as follows:

This manual assumes you are familiar with the ULTRIX operating system.


[Return to Library] [Contents] [Previous Chapter] [Previous Section] [Next Section] [Next Chapter] [Index] [Help]


Reference Pages

The following reference pages are of interest to device driver writers:



[Return to Library] [Contents] [Previous Chapter] [Previous Section] [Next Section] [Next Chapter] [Index] [Help]


Reader's Comments

Digital welcomes any comments and suggestions you have on this and other Digital UNIX manuals.

You can send your comments in the following ways:

Please include the following information along with your comments:

The Digital UNIX Publications group cannot respond to system problems or technical support inquiries. Please address technical questions to your local system vendor or to the appropriate Digital technical support office. Information provided with the software media explains how to send problem reports to Digital.


[Return to Library] [Contents] [Previous Chapter] [Previous Section] [Next Chapter] [Index] [Help]


Conventions

The following conventions are used in this book:


.
.
.
A vertical ellipsis indicates that a portion of an example that would normally be present is not shown.
. . . In syntax definitions, a horizontal ellipsis indicates that the preceding item can be repeated one or more times.
filename In examples, syntax descriptions, and function definitions, this typeface indicates variable values.
buf In function definitions and syntax definitions used in driver configuration, this typeface is used to indicate names that you must type exactly as shown.
[ ] In formal parameter declarations in function definitions and in structure declarations, brackets indicate arrays. Brackets are also used to specify ranges for device minor numbers and device special files in stanza.loadable file fragments. However, for the syntax definitions used in driver configuration, these brackets indicate items that are optional.
 | Vertical bars separating items that appear in the syntax definitions used in driver configuration indicate that you choose one item from among those listed.

This book uses the word kernel ``interface'' instead of kernel ``routine'' or kernel ``macro.''