| |
| ....Data Alignment | 15 |
| ....Structure Member Alignment | 16 |
| ....Byte Ordering | 16 |
| ....Register Windows | 16 |
| ....Floating Point Operations | 17 |
| .... Multiply and Divide Instructions | 17 |
| ....SPARC Architecture Manual | 17 |
| ..x86 Processor Issues | 17 |
| ....Data Alignment | 17 |
| ....Structure Member Alignment | 18 |
| ....Byte Ordering | 18 |
| ....Floating Point Operations | 18 |
| ....x86 Architecture Manuals | 18 |
| ..PowerPC Processor Issues | 18 |
| ....Data Alignment | 18 |
| ....Structure Member Alignment | 19 |
| ....Byte Ordering | 19 |
| ....Floating Point Operations | 19 |
| ....PowerPC Architecture Manual | 20 |
| ..Store Buffers | 20 |
| ..System Memory Model | 20 |
| ....Total Store Ordering (TSO) | 21 |
| ....Partial Store Ordering (PSO) | 21 |
| ..Bus Architectures | 21 |
| |
| ..Registering Interrupts | 120 |
| ..Responsibilities of an Interrupt Handler | 121 |
| ..State Structure | 124 |
| ..Handling High-Level Interrupts | 124 |
| ....Example | 125 |
7. DMA | 129 |
| ..The DMA Model | 129 |
| ..Types of Device DMA | 130 |
| ..DMA and DVMA | 131 |
| ..Handles, Windows and Cookies | 132 |
| ..DMA Operations | 132 |
| ....DMA attributes | 134 |
| ....Object Locking | 139 |
| ....Allocating a DMA Handle | 140 |
| ....Allocating DMA Resources | 141 |
| ....Burst Sizes | 145 |
| ....Programming the DMA Engine | 145 |
| ....Freeing the DMA Resources | 147 |
| ....Freeing the DMA handle | 148 |
| ..Cancelling DMA Callbacks | 148 |
| ..Synchronizing Memory Objects | 150 |
| ....Cache | 150 |
| ....ddi_dma_sync( ) | 152 |
| ..DMA Windows | 153 |
| |
| ..Allocating Private DMA Buffers | 156 |
| ....ddi_dma_devalign( ) | 158 |
8. Drivers for Character Devices | 161 |
| ..Driver Structure Overview | 161 |
| ....Character Driver Device Access | 161 |
| ..Entry Points | 163 |
| ..Autoconfiguration | 164 |
| ..Controlling Device Access | 165 |
| ..I/O Request Handling | 167 |
| ....User Addresses | 167 |
| ....Vectored I/O | 168 |
| ....Synchronous vs. Asynchronous I/O | 169 |
| ....Data Transfer Methods | 170 |
| ..Mapping Device Memory | 177 |
| ..Multiplexing I/O on File Descriptors | 180 |
| ..Miscellaneous I/O Control | 183 |
9. Drivers for Block Devices | 187 |
| ..Driver Structure Overview | 187 |
| ....Block Driver Device Access | 187 |
| ..File I/O | 189 |
| ..State Structure | 189 |
| ..Entry Points | 189 |
| ..Autoconfiguration | 190 |
| ..Controlling Device Access | 192 |
| |
| ..Data Transfers | 195 |
| .....strategy( ) | 195 |
| .....The buf Structure | 195 |
| ..Synchronous Data Transfers | 197 |
| ..Asynchronous Data Transfers | 201 |
| ..Miscellaneous Entry Points | 206 |
| .....dump( ) | 206 |
| .....print( ) | 207 |
10. Device Context Management | 209 |
| ..What Is A Device Context? | 209 |
| ..Context Management Model | 209 |
| .....Multiprocessor Considerations | 211 |
| ..Context Management Operation | 212 |
| .....State Structure | 212 |
| .....Declarations and Data Structures | 213 |
| .....Associating Devices with User Mappings | 213 |
| .....Managing Mapping Accesses | 216 |
| .....Device Context Management Entry Points | 217 |
11. SCSI Target Drivers | 223 |
| ..Overview | 223 |
| ..Reference Documents | 224 |
| ..Sun Common SCSI Architecture Overview | 225 |
| .....General Flow of Control | 226 |
| ..SCSA Functions | 228 |
| |
| ..SCSA Compatibility Functions | 229 |
| ..SCSI Target Drivers | 229 |
| .....Hardware Configuration File | 229 |
| .....Declarations and Data Structures | 230 |
| .....Autoconfiguration | 233 |
| .....Resource Allocation | 239 |
| ..Building and Transporting a Command | 241 |
| .....Building a Command | 242 |
| .....Capabilities | 243 |
| .....Transporting a Command | 243 |
| .....Command Completion | 244 |
| .....Reuse of packets | 245 |
| .....Auto-Request Sense Mode | 246 |
12. SCSI Host Bus Adapter Drivers | 249 |
| ..Overview | 249 |
| .....SCSA Interface | 250 |
| .....HBA Transport Layer | 251 |
| ..SCSA HBA Interfaces | 252 |
| .....SCSA HBA Entry Point Summary | 252 |
| .....SCSA HBA Data Structures | 252 |
| .....Per-Target Instance Data | 258 |
| .....Transport Structure Cloning (optional) | 260 |
| .....SCSA HBA Functions | 262 |
| ..HBA Driver Dependency and Configuration Issues | 262 |
| |
| .....Configuration Properties | 263 |
| .....Declarations and Structures | 264 |
| .....Module Initialization Entry Points | 266 |
| .....Autoconfiguration Entry Points | 269 |
| ..SCSA HBA Entry Points | 274 |
| .....Target Driver Instance Initialization | 275 |
| .....Resource Allocation | 277 |
| .....Command Transport | 288 |
| .....Capability Management | 295 |
| .....Abort and Reset Management | 301 |
| ..Driver Installation | 304 |
| .....Hardware Configuration File | 304 |
| .....Installing the Driver | 304 |
| .....x86 Target Driver Configuration Properties | 305 |
13. Loading and Unloading Drivers | 307 |
| ..Preparing for Installation | 307 |
| .....Module Naming | 307 |
| .....Compile and Link the Driver | 308 |
| .....Write a Hardware Configuration File | 308 |
| ..Installing and Removing Drivers | 309 |
| .....Copy the Driver to a Module Directory | 309 |
| .....Run add_drv(1M) | 309 |
| ..Removing the Driver | 310 |
| ..Loading Drivers | 310 |
| |
| ..Getting the Driver Module's ID | 310 |
| ..Unloading Drivers | 311 |
14. Debugging | 313 |
| ..Machine Configuration | 313 |
| .....Setting Up a tip(1) Connection | 313 |
| .....Preparing for the Worst | 315 |
| ..Coding Hints | 319 |
| .....Process Layout | 319 |
| .....System Support | 320 |
| .....Conditional Compilation and Variables | 321 |
| .....volatile and _depends_on | 323 |
| ..Debugging Tools | 323 |
| ...../etc/system | 323 |
| .....moddebug | 324 |
| .....modload and modunload | 325 |
| .....Saving System Core Dumps | 325 |
| .....adb and kadb | 327 |
| .....Example: adb on a Core Dump | 340 |
| .....Example: kadb on a Deadlocked Thread | 343 |
| ..Testing | 346 |
| .....Configuration Testing | 346 |
| .....Functionality Testing | 347 |
| .....Error Handling | 347 |
| .....Stress, Performance, and Interoperability Testing | 348 |
| |
| ..Conversion Notes | 366 |
| .....SunOS 4.1.x to SunOS 5.5 Differences | 371 |
B. Interface Transition List | 379 |
| .....Data Access Methods | 379 |
| .....DMA Data Access | 379 |
| .....SCSI HBA DMA Management | 379 |
| .....Device Memory Mapping | 379 |
| .....Open Boot PROM Device Properties | 380 |
| ..Data Access Methods | 380 |
| .....Device Access Attributes Structure | 380 |
| .....CPU Device Access | 380 |
| .....Device Access Functions | 380 |
| .....Common Device Access Functions | 382 |
| .....Other Device Access Functions | 383 |
| ..DMA Device Access | 383 |
| .....DMA Attributes Structure | 383 |
| .....DMA Memory Access | 383 |
| .....DMA Device Binding | 384 |
| ..SCSI HBA DMA Management | 385 |
| ..Device Memory Mapping | 385 |
| .....Device Context Management | 385 |
| ..Open Boot PROM Device Properties | 386 |
| .....Property Access Functions | 386 |
C. Summary of Solaris 2.5 DDI/DKI Services | 387 |