About This Guide

This guide describes the ways in which hardware devices are integrated into and controlled from a Silicon Graphics® computer system running the IRIX operating system version 6.3 for O2.

Note: This edition applies only to IRIX 6.3 for O2, and discusses only hardware supported by that system version. If your device driver will work with a different release, you should use the version of this manual appropriate to that release (see “Internet Resources”).

Three general classes of device-control software exist in an IRIX system: process-level drivers, kernel-level drivers, and STREAMS drivers.

All three classes are discussed in this guide, although the greatest amount of attention is given to kernel-level drivers.

What You Need to Know

In order to write a process-level driver you must be an experienced C programmer with a thorough understanding of the use of IRIX system services and, of course, detailed knowledge of the device to be managed.

In order to write a kernel-level driver or a STREAMS driver you must be an experienced C programmer who knows UNIX® system administration, and expecially IRIX system administration, and who understands the concepts of UNIX device management.

What This Guide Contains

This guide is divided into the following major parts.

Part I, “IRIX Device Integration”

How devices are attached to Silicon Graphics computers, configured to IRIX, and initialized at boot time.

Part II, “Device Control From Process Space”

Details of user-level handling of PCI devices, and SCSI control using dslib.

Part III, “Kernel-Level Drivers”

How kernel-level drivers are designed, compiled, loaded, and tested. Survey of kernel services for drivers.

Part IV, “SCSI Device Drivers”

Kernel-level drivers for the SCSI bus.

Part V, “Network Drivers”

Kernel-level drivers for network interfaces.

Part VI, “PCI Drivers”

Kernel-level drivers for the PCI bus.

Part VII, “STREAMS Drivers”

Design of STREAMS drivers.

Appendix A, “Silicon Graphics Driver/Kernel API”

Summary of kernel functions with compatibility notes.

In the printed book, you can locate these parts using the part-tabs printed in the margins. Using IRIS InSight, each part is a top-level division in the clickable table of contents, or you can jump to any part by clicking the blue cross-references in the list above.

Other Sources of Information

Developer Program

Information and support are available through the Silicon Graphics Developer Program. The Developer Toolbox CDROM contains numerous code examples. To join the program, contact the Developer Response Center at (800) 770-3033 or send e-mail to [email protected].

Internet Resources

A great deal of useful material can be found on the internet. Some starting points are in the following list. (A URL displayed in red is a webjumper; click it to launch Netscape to display that page.)

Earlier versions of this book as well as all other SGI technical manuals to read or download.


SGI patches, examples, and other material.


Network of pages of information about Silicon Graphics and MIPS® products


Text of all Internet RFC documents.


Computer graphics pointers at the UCSC Perceptual Science Labororatory.


Pointers to binaries and sources at The National Research Council of Canada's Institute For Biodiagnostics.


A Silicon Graphics “meta page” at the Georgia Institute of Technology College of Computing.


Dazzling Silicon Graphics “meta page” at NASA in Huntsville, AL.


Complete SCSI-2 standard in HTML.


IEEE Catalog and worldwide ordering information.


MIPS processor manuals in HTML form.


Home page of the PCI bus standardization organization

http://www.mips.com/ http://www.mips.com/ http://www.pcisig.com

Standards Documents

The following documents are the official standard descriptions of buses:

  • PCI Local Bus Specification, Version 2.1, available from the PCI Special Interest Group, P.O. Box 14070, Portland, OR 97214 (fax: 503-234-6762)

  • ANSI/IEEE standard 1014-1987 (VME Bus), available from IEEE Customer Service, 445 Hoes Lane, PO Box 1331, Piscataway, NJ 08855-1331 (but see also “Internet Resources”).

Important Reference Pages

The following reference pages contain important details about software tools and practices that you need. Whenever you see the title of a reference page displayed in red (as in the following list) you can click the title to open a shell window displaying that page.


The interface to the inventory database



The use of the inventory display command



The conventions used for special device filenames



The use of the program that creates device special files



Syntax of files in /var/sysgen/master.d


Commands of the “miniroot” and other features of the boot PROM, which you use to bring up the system when testing a new device driver



Syntax of files in /var/sysgen/system/*.sm


Functions for performing user-level DMA from VME.



Functions for registering and using a user-level interrupt handler.



Naming conventions for mappable VME device special files.

Additional Reading

The following books, obtainable from Silicon Graphics, can be helpful when designing or testing a device driver.

  • MIPSpro Compiling and Performance Tuning Guide, document number 007-2360-nnn, tells how to use the C compiler and related tools.

  • MIPSpro Assembly Language Programmer's Guide, document number 007-2418-nnn, tells how to compile assembly-language modules.

  • MIPSpro 64-Bit Porting and Transition Guide, document number 007-2391-nnn, documents the implications of the 64-bit execution mode for user programs.

  • MIPSpro N32 ABI Handbook, document number 007-2816-nnn, gives details of the code generated when the -n32 compiler option is used.

  • Topics in IRIX Programming, document number 008-2478-nnn, documents some of the sophisticated services offered by the IRIX kernel to user-level programs.

  • MIPS R4000 User's Manual (2nd ed.) by Joe Heinrich, document number 007-2489-001, gives detailed information on the MIPS instruction set and hardware registers for the processor used in many Silicon Graphics computer systems (also available as HTML on http://www.mips.com/ ).

  • MIPS R10000 User's Manual by Joe Heinrich gives detailed information on the MIPS instruction set and hardware registers for the processor used in certain high-end systems. Available only in HTML form from http://www.mips.com/ .

  • IRIX Administration: System Configuration and Operation, document number 007-2859-nnn, describes the basic adminstrative tools for configuring, operating, and tuning IRIX.

  • IRIX Administration: Disks and File Systems, document number 007-2825-nnn, describes the configuration of new disk subsystems and the management of logical volumes and file systems.

  • IRIX Administration: Peripheral Devices, document number 007-2861-nnn, describes the adminstration of tapes, printers, and other devices.

The following books, obtainable from bookstores or libraries, can also be helpful.

  • Egan, Janet I., and Thomas J. Teixeira. Writing a UNIX Device Driver. John Wiley & Sons, 1992.

  • Leffler, Samuel J., et alia. The Design and Implementation of the 4.3BSD UNIX Operating System. Palo Alto, California: Addison-Wesley Publishing Company, 1989.

  • A. Silberschatz, J. Peterson, and P. Galvin. Operating System Concepts, Third Edition. Addison Wesley Publishing Company, 1991.

  • Heath, Steve. VMEbus User's Handbook. CRC Press, Inc, 1989. ISBN 0-8493-7130-9.

  • Device Driver Reference, UNIX SVR4.2, UNIX Press 1992.

  • UNIX System V Release 4 Programmer's Guide, UNIX SVR4.2. UNIX Press, 1992.

  • STREAMS Modules and Drivers, UNIX SVR4.2, UNIX Press 1992. ISBN 0-13-066879.

Conventions Used in This Guide

Special terms and special kinds of words are indicated with the following typographical conventions:

Data structures, variables, function arguments, and macros.

The dsiovec structure has members iov_base and iov_len. Use the IOVLEN macro to access them.

Kernel and library functions and functions in examples.

When successful, v_mapphys() returns 0.

Driver entry point names that must be completed with a unique prefix string.

The munmap() system function calls the pfx unmap() entry point.

Files and directories.

Device special files are in /dev, and are created using the /dev/MAKEDEV script.

First use of terms defined in the glossary (see “Glossary” on page 447).

The inode of a device special file contains the major device number.

Literal quotes of code examples.

The SCSI driver's prefix is scsi_.

Citations of reference pages in red are clickable hyperlinks.

See the kvtophys(D3) reference page.