Next | Top | Index

Full Table of Contents


Contents
Introduction
About This Guide
Audience
Document Overview
Related Documentation
Reference Material
Notation and Syntax Conventions
1. - Introduction to Device Drivers
Driver Overview
Device Types
Software Devices
Hardware Devices
Levels of Device Drivers
User-level Device Drivers
Kernel-level Device Drivers
System Hardware
Hardware Platforms
MIPS RISC Processors Interrupt Masking
Understanding Driver Address Space
Virtual to Physical Memory Mapping
Privilege States/Modes
User Mode Virtual Addressing
Kernel Mode Virtual Addressing
Bus Interfaces
VME-bus Interface
EISA-bus Interface
SCSI-bus Interface
GIO-bus Interface
System Software
2. - Writing a Device Driver
Creating Device Drivers
Creating User-level Device Drivers
Creating Kernel-level Device Drivers
Device-special File
Creating Device-special Files
Major and Minor Device Numbers
Device-special File Example
Configuration Files
Including a Device Driver in the Kernel
Driver Entry Points
Missing Driver Entry Points
Character and Block Entry Point Driver Routines
open - Gain Access to a Device
close - Relinquish Access to a Device
read or write - Read/Write Data from/to a Device
ioctl - Control a Character Device
poll - Poll Entry Point for a Non-STREAMS Character Driver
map or unmap - Check Virtual Mapping for a Memory-mapped Device
devflag - driver flags
Writing Other Driver Routines
intr - Process a Device Interrupt
strategy - Perform Block I/O
edtinit and init - Initialize a Device
halt - Shut Down the Driver When the System Shuts Down
start - Initialize a Device at System Startup
unload - Clean Up a Loadable Kernel Module
STREAMS Driver Entry Points
put - Coordinate Message Passing Between Queues in a Stream
srv - Service Routine
3. - Writing a VME Device Driver
VME-bus Interface Overview
VME-bus Adapter
VME-bus Address Space
VME-bus Read-Modify-Write Cycle
VME-bus Adapter Requests
VME-bus Interrupts
Distribution of VME Interrupts on Multiprocessors
Choosing a Driver Model
User-level VME-bus Device Driver
Kernel-level VME Device Driver
Kernel-level General Memory-mapping Device Driver
Writing User-level VME Device Drivers
Example VME Device Driver
Using mmap
Accessing Mapped Space
VME-bus Error Handling for User-level Device Drivers
User-level DMA Library (udmalib)
Writing Kernel-level VME Device Drivers
Determining VME Device Addresses
Including VME Device Drivers in the Kernel
Writing edtinit()
edt Type Structure
vme_intrs Structure
VME Interrupt Handler
Programmed I/O (PIO)
DMA Operations
A32 Addressing Scatter/Gather Support
DMA Mapping for High-end Systems and Older Systems
Does the VME Device Perform A24 Master Addressing?
A32 Addressing with No Scatter/Gather
VME Devices with Scatter/Gather Capability
Using DMA Maps
Example Using DMA Maps
DMA on A24 Devices with No DMA Mapping
DMA on A32 Devices with No Scatter/Gather Capability
4. - Writing an EISA Device Driver
EISA-bus Interface Overview
Initialization
EISA-Bus Locked Cycles
EISA-Bus Request Arbitration
EISA-Bus Interrupts
EISA-Bus Data Transfers
EISA-Bus Address Space
Byte Swapping
Choosing a Device Driver Model
When to Write a User-level Device Driver
When to Write a Kernel-level Device Driver
When to Write a Kernel-level Memory-mapping Device Driver
Writing a User-level EISA Device Driver
User-level EISA Special Files
Using the mmap Operating System Function
Writing a Kernel-level EISA Device Driver
Configuring a Kernel-level EISA Device Driver
File Requirements
Determining ISA/EISA Device Addresses
Including EISA Drivers in the Kernel
VECTOR Directive
EISA Product Identifier (ID)
System File Example
Writing edtinit()
edt_t Structure
I/O and Memory Space Initialization
Dynamic Resource Allocation
EISA Locked Cycles
DMA Address Mapping
EISA DMA Utility Functions and Structures
5. - Writing a SCSI Device Driver
SCSI-bus Interface Overview
Choosing a Driver Model
User-level SCSI-bus Device Driver
Kernel-level SCSI Device Driver
User-level SCSI Device Drivers
Creating Device-special Files for User-level SCSI Drivers
dsreq - User-level Driver Communication Structure
dsreq Structure
dslib Routines Description
SCSI Open and Close Driver Routines
dsopen - Allocate a dsreq Type Structure and Open a Device
dsclose - Free the dsreq Structure and Close the Device
SCSI Function-Building Routines - Group 1
doscsireq - Send a Command to the SCSI Device
filldsreq - set Members of a dsreq Type Structure
fillg0cmd - Set Up the dsreq Structure
fillg1cmd - Send a Group 1 SCSI Command
vtostr - Return a Pointer to a String Describing Table Entry
SCSI Function-Building Routines - Group 2
inquiry12 - Issue an Inquiry Command
modeselect15 - Issue a Group 0 "Mode Select" Command
modesense1a - Send a Group 0 "Mode Sense" Command
readcapacity25 - Issue a Read Capacity Command
readextended28 - Issue a Read Extended Command
requestsense03 - Issue a Request Sense Command
senddiagnostic1d - Issue a Send Diagnostic Command
testunitready00 - Issue a Test Unit Ready Command to a SCSI Device
write0a - Issue a Group 0 Write Command
writeextended2a - Issue a Write Extended Command
Using the dslib Routines
Opening a SCSI Device
Sending Commands to a SCSI Device
Closing a SCSI Device
Kernel-level SCSI Device Drivers
Configuring a Kernel-level SCSI Driver
Writing a SCSI init()
SCSI Device Interface Overview
Determining Driver Number
scsi_info - Getting Information About a Device
scsi_alloc - Initializing a Connection
scsi_command - Executing a SCSI Command
scsi_free - Freeing the Connection
Using the SCSI Access Routines
SCSI Device Driver Example
6. - Writing Kernel-level GIO Device Drivers
GIO-bus Architecture
Determining GIO Device Addresses
Including GIO Device Drivers in the Kernel
Creating a System File
Creating a Master File
Creating a Boot File
The GBD Example
Writing edtinit()
GIO-specific Functions
setgiovector
splgio0, splgio1, splgio2
setgioconfig
GIO Interrupt Handler
Programmed I/O (PIO)
DMA Operations
Memory Parity Workarounds
GIO Devices with Hardware-supported Scatter/Gather Capability
DMA on GIO Devices Without Scatter/Gather Capability
Device Driver Example
7. - Writing Kernel-level General Memory-mapping Device Drivers
Including a Memory-mapping Device Driver in the Kernel
Mapping and Unmapping Functions
mmap - Mapping the Device drvmmap - Mapping the Device
munmap - Unmapping the Device
v_mapphys - Mapping Device Control Registers and On-board Memory
Sharing Kernel Memory with a User Program
Example Program
Returning Opaque Handle Data
8. - Writing Multiprocessor Device Drivers
Preliminary Considerations
Shared Data between Upper-half and Interrupt Routines
Protecting Shared Data Among Upper-half Routines
Semaphore and Spinlock Calls
semap
freesema
psema
vsema
cpsema
cvsema
LOCK_ALLOC
LOCK_DEALLOC
LOCK
UNLOCK
SLEEP_LOCK
SLEEP_LOCK_SIG
SLEEP_UNLOCK
SLEEP_TRYLOCK
TRYLOCK
Multiprocessing STREAMS Drivers
STREAMS Monitor
STREAMS Example
9. - Writing Network Device Drivers
Preliminary Discussion
IRIX Kernel Networking Design
ifnet Driver Interfaces
Multiprocessor Issues
Compilation Flags for MP TCP/IP
IFNET_LOCK(ifp, s)
IFNET_UNLOCK(ifp,s)
IFNET_LOCKNOSPL(ifp)
IFNET_UNLOCKNOSPL(ifp)
IFQ_LOCK/UNLOCK(ifq)
IF_ENQUEUE(ifq, m)
Input Queueing Example
Interrupt Handler Example
ifnet Device Driver Example
10. - Driver Installation and Testing
Using the Kernel Debugger
Making a Debuggable Kernel
Making an ASCII Terminal the Console
Invoking symmon
Displaying and Changing Registers
Using symmon Commands
Help for symmon Commands
symmon's dbgmon Mode Commands
brk Command
bt Command
c Command
call Command
dis Command
dump Command
g Command
goto Command
hx Command
lkaddr Command
lkup Command
nm Command
p Command
sleep Command
s [count] and S [count]
string Command
tlbdump Command
tlbflush Command
tlbmap Command
tlbpid Command
tlbptov Command
tlbvtop Command
unbrk Command
wake Command
wpt Command
Using symmon's Kernel Print Command
kp buf [index/address] - View a buf Structure
kp eframe address
kp inode number/address - View an inode Structure
kp kill addr
kp mlist
kp msyms id
kp pb -- Dump Console Print Buffer
kp plist [#] - List Process Summaries
kp pda [index] - View a pda Structure
kp proc index/address - View a proc Structure
kp qbuf device
kp runq - View the runq Structure
kp sema address - View a Semaphore Structure
kp slpproc - View Summary of Sleeping Processes
kp ubt [index] - View Subroutine Backtrace Summary
kp user [index] - View a User Structure
kp wd - View SCSI Information
Multiprocessor Debugging
Configuring the System Software
Preparing the System Hardware
symmon and Multiprocessor Debugging
Forcing System Memory Dumps
11. - Kernel-level Dynamically Loadable Modules (DLMs)
Module Configuration
Using a Dynamically Loadable Kernel Module
Load
Register
Unload
Unregister
List
Master File Configuration
Auto Registration
Auto Unload
Kernel Configuration
Module Entry Points
Module Initialization
Edt Type Drivers
Library Modules
Loadable Modules and Hardware Inventory
Run-time Symbol Table
Debugging Loadable Kernel Modules
Load/Register Failures
Example 1
Example 2
A. - System-specific Issues
CPU Types
Data Cache Write Back and Invalidation
Flushing the Write Buffer
Registers and Register Optimization
Reliable Multiprocessor Spinlocks
VME Slave Addressing
VME Master Addressing
VME-bus Space Reserved for Customer Drivers
POWER Indigo2 and POWER CHALLENGE M Drivers
Sharing Data Between CPU and Peripheral Devices
Using mmap()
B. - SCSI Controller Error Messages
Introduction
Sense Key Information
SCSI Driver Error Messages
SCSI Driver Debugging Messages
SCSI States and Phases
C. - Device Driver Migration Notes
Introduction
Intended Audience and Prerequisites
Background
IRIX 5.x
IRIX 6.0
Migration Overview
IRIX 4.x to 5.x Migration
SVR4 API Changes
STREAMS Changes
DDI Changes
DKI Changes
Addressability
CHALLENGE/Onyx Family Support
Kernel Configuration Issues
Equipped Device Table (EDT) Changes
IRIX 5.2 to 5.3 Migration
Standard Device Drivers
STREAMS Modules
ifnet Drivers
Context diff of Token Ring ifnet Driver
Board Initialization
Interrupt Handler
mbuf Manager Changes
Migration to IRIX 6.0
Virtual Page Size
Constants
Macros
ioctl Support
Pointers
Hardware Data Copying
Glossary
Index

Next | Top | Index