| |
| ....Timing-Critical Sections | 24 |
| ....Delays | 25 |
| ....Internal Sequencing Logic | 25 |
| ....Interrupt Issues | 25 |
| ....Byte Ordering | 26 |
| ..The PROM on SPARC Machines | 26 |
| ....Open Boot PROM 2.x | 27 |
| ..Reading and Writing | 32 |
| ....The Sun Monitor | 34 |
3. Overview of SunOS Device Drivers | 41 |
| ..What is a Device Driver? | 41 |
| ..Types of Device Drivers | 42 |
| ....Block Device Drivers | 42 |
| ....Standard Character Device Drivers | 42 |
| ....STREAMS Drivers | 44 |
| ..Device Issues | 44 |
| ....Accessing Device Registers | 44 |
| ....Example Device Registers | 45 |
| ....Device Register Structure | 46 |
| ..Driver Interfaces | 48 |
| ....Entry Points | 48 |
| ..Callback functions | 51 |
| ..Interrupt Handling | 52 |
| ..Driver Context | 52 |
| |
| ..Data Transfers | 176 |
| .....strategy( ) | 176 |
| .....The buf Structure | 176 |
| ..Synchronous Data Transfers | 178 |
| ..Asynchronous Data Transfers | 182 |
| ..Miscellaneous Entry Points | 186 |
| .....dump( ) | 186 |
| .....print( ) | 188 |
10. SCSI Target Drivers | 189 |
| ..Overview | 189 |
| ..Reference Documents | 190 |
| ..Sun Common SCSI Architecture Overview | 191 |
| .....General Flow of Control | 192 |
| ..SCSA Functions | 194 |
| ..SCSA Compatibility Functions | 195 |
| ..SCSI Target Drivers | 195 |
| .....Hardware Configuration File | 195 |
| .....Declarations and Data Structures | 196 |
| .....Autoconfiguration | 199 |
| .....Resource Allocation | 205 |
| ..Building and Transporting a Command | 208 |
| .....Building a Command | 208 |
| .....Transporting a Command | 209 |
| .....Command Completion | 210 |
| |
11. Device Context Management | 213 |
| ..What Is A Device Context? | 213 |
| ..Context Management Model | 213 |
| .....Multiprocessor Considerations | 215 |
| ..Context Management Operation | 216 |
| .....State Structure | 216 |
| .....Declarations and Data Structures | 217 |
| .....Associating Devices with User Mappings | 217 |
| .....Managing Mapping Accesses | 219 |
| .....Device Context Management Entry Points | 220 |
12. Loading and Unloading Drivers | 225 |
| ..Preparing for Installation | 225 |
| .....Module Naming | 225 |
| .....Compile and Link the Driver | 226 |
| .....Write a Hardware Configuration File | 226 |
| ..Installing and Removing Drivers | 227 |
| .....Copy the Driver to a Module Directory | 227 |
| .....Run add_drv(1M) | 227 |
| ..Removing the Driver | 228 |
| ..Loading Drivers | 228 |
| ..Getting the Driver Module's ID | 228 |
| ..Unloading Drivers | 229 |
13. Debugging | 231 |
| ..Machine Configuration | 231 |
| |
| .....Setting Up a tip(1) Connection | 231 |
| .....Preparing for the Worst | 233 |
| ..Coding Hints | 236 |
| .....Process Layout | 237 |
| .....System Support | 237 |
| .....Conditional Compilation and Variables | 239 |
| .....The Optimizer and volatile | 241 |
| ..Using Existing Drivers | 241 |
| ..Debugging Tools | 243 |
| ...../etc/system | 243 |
| .....modload and modunload | 244 |
| .....Saving System Core Dumps | 245 |
| .....adb and kadb | 246 |
| .....Example: adb on a Core Dump | 257 |
| .....Example: kadb on a Deadlocked Thread | 260 |
| ..Testing | 263 |
| .....Configuration Testing | 263 |
| .....Functionality Testing | 264 |
| .....Error Handling | 264 |
| .....Stress, Performance, and Interoperability Testing | 265 |
| .....DDI/DKI Compliance Testing | 265 |
| .....Installation and Packaging Testing | 266 |
| .....Testing Specific Types of Drivers | 266 |
A. Converting a Device Driver to SunOS 5.4 | 269 |