| Document Information Preface Part I Designing Device Drivers for the Solaris Platform 1.  Overview of Solaris Device Drivers 2.  Solaris Kernel and Device Tree 3.  Multithreading 4.  Properties 5.  Managing Events and Queueing Tasks 6.  Driver Autoconfiguration 7.  Device Access: Programmed I/O 8.  Interrupt Handlers 9.  Direct Memory Access (DMA) 10.  Mapping Device and Kernel Memory 11.  Device Context Management 12.  Power Management 13.  Hardening Solaris Drivers 14.  Layered Driver Interface (LDI) Part II Designing Specific Kinds of Device Drivers 15.  Drivers for Character Devices 16.  Drivers for Block Devices 17.  SCSI Target Drivers 18.  SCSI Host Bus Adapter Drivers 19.  Drivers for Network Devices 20.  USB Drivers Part III Building a Device Driver 21.  Compiling, Loading, Packaging, and Testing Drivers 22.  Debugging, Testing, and Tuning Device Drivers 23.  Recommended Coding Practices Part IV Appendixes A.  Hardware Overview B.  Summary of Solaris DDI/DKI Services Module Functions Device Information Tree Node (dev_info_t) Functions Device (dev_t) Functions Property Functions Device Software State Functions Memory Allocation and Deallocation Functions Kernel Thread Control and Synchronization Functions Task Queue Management Functions Interrupt Functions Direct Memory Access (DMA) Functions User Space Access Functions User Process Event Functions User Process Information Functions User Application Kernel and Device Access Functions Time-Related Functions Power Management Functions Fault Management Functions Kernel Statistics Functions Kernel Logging and Printing Functions Buffered I/O Functions Virtual Memory Functions Device ID Functions SCSI Functions Resource Map Management Functions System Global State Utility Functions C.  Making a Device Driver 64-Bit Ready D.  Console Frame Buffer Drivers Index |       	 
             
Programmed I/O FunctionsThe programmed I/O functions are: ddi_dev_nregs()Return the number of register sets a device hasddi_dev_regsize()Return the size of a device's registerddi_regs_map_setup()Set up a mapping for a register address spaceddi_regs_map_free()Free a previously mapped register address spaceddi_device_copy()Copy data from one device register to another device registerddi_device_zero()Zero fill the deviceddi_check_acc_handle()Check data access handleddi_get8()Read 8-bit data from mapped memory, device register, or DMA memoryddi_get16()Read 16-bit data from mapped memory, device register, or DMA memoryddi_get32()Read 32-bit data from mapped memory, device register, or DMA memoryddi_get64()Read 64-bit data from mapped memory, device register, or DMA memoryddi_put8()Write 8-bit data to mapped memory, device register, or DMA memoryddi_put16()Write 16-bit data to mapped memory, device register, or DMA memoryddi_put32()Write 32-bit data to mapped memory, device register, or DMA memoryddi_put64()Write 64-bit data to mapped memory, device register, or DMA memoryddi_rep_get8()Read multiple 8-bit data from mapped memory, device register, or DMA memoryddi_rep_get16()Read multiple 16-bit data from mapped memory, device register, or DMA memoryddi_rep_get32()Read multiple 32-bit data from mapped memory, device register, or DMA memoryddi_rep_get64()Read multiple 64-bit data from mapped memory, device register, or DMA memoryddi_rep_put8()Write multiple 8-bit data to mapped memory, device register, or DMA memoryddi_rep_put16()Write multiple 16-bit data to mapped memory, device register, or DMA memoryddi_rep_put32()Write multiple 32-bit data to mapped memory, device register, or DMA memoryddi_rep_put64()Write multiple 64-bit data to mapped memory, device register, or DMA memoryddi_peek8()Cautiously read an 8-bit value from a locationddi_peek16()Cautiously read a 16-bit value from a locationddi_peek32()Cautiously read a 32-bit value from a locationddi_peek64()Cautiously read a 64-bit value from a locationddi_poke8()Cautiously write an 8-bit value to a locationddi_poke16()Cautiously write a 16-bit value to a locationddi_poke32()Cautiously write a 32-bit value to a locationddi_poke64()Cautiously write a 64-bit value to a location
 The general programmed I/O functions listed above can always be used rather than
the mem, io, and pci_config functions that follow. However, the following functions can be
used as alternatives in cases where the type of access is known at
compile time. ddi_io_get8()Read 8-bit data from a mapped device register in I/O spaceddi_io_get16()Read 16-bit data from a mapped device register in I/O spaceddi_io_get32()Read 32-bit data from a mapped device register in I/O spaceddi_io_put8()Write 8-bit data to a mapped device register in I/O spaceddi_io_put16()Write 16-bit data to a mapped device register in I/O spaceddi_io_put32()Write 32-bit data to a mapped device register in I/O spaceddi_io_rep_get8()Read multiple 8-bit data from a mapped device register in I/O spaceddi_io_rep_get16()Read multiple 16-bit data from a mapped device register in I/O spaceddi_io_rep_get32()Read multiple 32-bit data from a mapped device register in I/O spaceddi_io_rep_put8()Write multiple 8-bit data to a mapped device register in I/O spaceddi_io_rep_put16()Write multiple 16-bit data to a mapped device register in I/O spaceddi_io_rep_put32()Write multiple 32-bit data to a mapped device register in I/O spaceddi_mem_get8()Read 8-bit data from a mapped device in memory space or DMA memoryddi_mem_get16()Read 16-bit data from a mapped device in memory space or DMA memoryddi_mem_get32()Read 32-bit data from a mapped device in memory space or DMA memoryddi_mem_get64()Read 64-bit data from a mapped device in memory space or DMA memoryddi_mem_put8()Write 8-bit data to a mapped device in memory space or DMA memoryddi_mem_put16()Write 16-bit data to a mapped device in memory space or DMA memoryddi_mem_put32()Write 32-bit data to a mapped device in memory space or DMA memoryddi_mem_put64()Write 64-bit data to a mapped device in memory space or DMA memoryddi_mem_rep_get8()Read multiple 8-bit data from a mapped device in memory space or DMA memoryddi_mem_rep_get16()Read multiple 16-bit data from a mapped device in memory space or DMA memoryddi_mem_rep_get32()Read multiple 32-bit data from a mapped device in memory space or DMA memoryddi_mem_rep_get64()Read multiple 64-bit data from a mapped device in memory space or DMA memoryddi_mem_rep_put8()Write multiple 8-bit data to a mapped device in memory space or DMA memoryddi_mem_rep_put16()Write multiple 16-bit data to a mapped device in memory space or DMA memoryddi_mem_rep_put32()Write multiple 32-bit data to a mapped device in memory space or DMA memoryddi_mem_rep_put64()Write multiple 64-bit data to a mapped device in memory space or DMA memorypci_config_setup()Set up access to PCI Local Bus Configuration spacepci_config_teardown()Tear down access to PCI Local Bus Configuration spacepci_config_get8()Read 8-bit data from the PCI Local Bus Configuration spacepci_config_get16()Read 16-bit data from the PCI Local Bus Configuration spacepci_config_get32()Read 32-bit data from the PCI Local Bus Configuration spacepci_config_get64()Read 64-bit data from the PCI Local Bus Configuration spacepci_config_put8()Write 8-bit data to the PCI Local Bus Configuration spacepci_config_put16()Write 16-bit data to the PCI Local Bus Configuration spacepci_config_put32()Write 32-bit data to the PCI Local Bus Configuration spacepci_config_put64()Write 64-bit data to the PCI Local Bus Configuration space
 Table B-4 Deprecated Programmed I/O Functions| Deprecated Function | Replacement | 
|---|
 | ddi_getb() | ddi_get8() |  | ddi_getl() | ddi_get32() |  | ddi_getll() | ddi_get64() |  | ddi_getw() | ddi_get16() |  | ddi_io_getb() | ddi_io_get8() |  | ddi_io_getl() | ddi_io_get32() |  | ddi_io_getw() | ddi_io_get16() |  | ddi_io_putb() | ddi_io_put8() |  | ddi_io_putl() | ddi_io_put32() |  | ddi_io_putw() | ddi_io_put16() |  | ddi_io_rep_getb() | ddi_io_rep_get8() |  | ddi_io_rep_getl() | ddi_io_rep_get32() |  | ddi_io_rep_getw() | ddi_io_rep_get16() |  | ddi_io_rep_putb() | ddi_io_rep_put8() |  | ddi_io_rep_putl() | ddi_io_rep_put32() |  | ddi_io_rep_putw() | ddi_io_rep_put16() |  | ddi_map_regs() | ddi_regs_map_setup() |  | ddi_mem_getb() | ddi_mem_get8() |  | ddi_mem_getl() | ddi_mem_get32() |  | ddi_mem_getll() | ddi_mem_get64() |  | ddi_mem_getw() | ddi_mem_get16() |  | ddi_mem_putb() | ddi_mem_put8() |  | ddi_mem_putl() | ddi_mem_put32() |  | ddi_mem_putll() | ddi_mem_put64() |  | ddi_mem_putw() | ddi_mem_put16() |  | ddi_mem_rep_getb() | ddi_mem_rep_get8() |  | ddi_mem_rep_getl() | ddi_mem_rep_get32() |  | ddi_mem_rep_getll() | ddi_mem_rep_get64() |  | ddi_mem_rep_getw() | ddi_mem_rep_get16() |  | ddi_mem_rep_putb() | ddi_mem_rep_put8() |  | ddi_mem_rep_putl() | ddi_mem_rep_put32() |  | ddi_mem_rep_putll() | ddi_mem_rep_put64() |  | ddi_mem_rep_putw() | ddi_mem_rep_put16() |  | ddi_peekc() | ddi_peek8() |  | ddi_peekd() | ddi_peek64() |  | ddi_peekl() | ddi_peek32() |  | ddi_peeks() | ddi_peek16() |  | ddi_pokec() | ddi_poke8() |  | ddi_poked() | ddi_poke64() |  | ddi_pokel() | ddi_poke32() |  | ddi_pokes() | ddi_poke16() |  | ddi_putb() | ddi_put8() |  | ddi_putl() | ddi_put32() |  | ddi_putll() | ddi_put64() |  | ddi_putw() | ddi_put16() |  | ddi_rep_getb() | ddi_rep_get8() |  | ddi_rep_getl() | ddi_rep_get32() |  | ddi_rep_getll() | ddi_rep_get64() |  | ddi_rep_getw() | ddi_rep_get16() |  | ddi_rep_putb() | ddi_rep_put8() |  | ddi_rep_putl() | ddi_rep_put32() |  | ddi_rep_putll() | ddi_rep_put64() |  | ddi_rep_putw() | ddi_rep_put16() |  | ddi_unmap_regs() | ddi_regs_map_free() |  | inb() | ddi_io_get8() |  | inl() | ddi_io_get32() |  | inw() | ddi_io_get16() |  | outb() | ddi_io_put8() |  | outl() | ddi_io_put32() |  | outw() | ddi_io_put16() |  | pci_config_getb() | pci_config_get8() |  | pci_config_getl() | pci_config_get32() |  | pci_config_getll() | pci_config_get64() |  | pci_config_getw() | pci_config_get16() |  | pci_config_putb() | pci_config_put8() |  | pci_config_putl() | pci_config_put32() |  | pci_config_putll() | pci_config_put64() |  | pci_config_putw() | pci_config_put16() |  | repinsb() | ddi_io_rep_get8() |  | repinsd() | ddi_io_rep_get32() |  | repinsw() | ddi_io_rep_get16() |  | repoutsb() | ddi_io_rep_put8() |  | repoutsd() | ddi_io_rep_put32() |  | repoutsw() | ddi_io_rep_put16() | 
 |