Writing Device Drivers

Programmed I/O Functions

Table B–13 Programmed I/O Functions

Function Name 

Description 

ddi_dev_nregs

return the number of register sets a device has 

ddi_dev_regsize 

return the size of a device's register 

ddi_regs_map_setup 

set up a mapping for a register address space 

ddi_regs_map_free 

free a previously mapped register address space 

ddi_device_copy 

copy data from one device register to another device register 

ddi_device_zero 

zero fill the device 

ddi_check_acc_handle 

check data access handle 

ddi_get8 

read 8–bit data from mapped memory, device register or DMA memory 

ddi_get16 

read 16–bit data from mapped memory, device register or DMA memory 

ddi_get32 

read 32–bit data from mapped memory, device register or DMA memory 

ddi_get64 

read 64–bit data from mapped memory, device register or DMA memory 

ddi_put8 

write 8–bit data to mapped memory, device register or DMA memory 

ddi_put16 

write 16–bit data to mapped memory, device register or DMA memory 

ddi_put32 

write 32–bit data to mapped memory, device register or DMA memory 

ddi_put64 

write 64–bit data to mapped memory, device register or DMA memory 

ddi_rep_get8 

read multiple 8–bit data from mapped memory, device register or DMA memory 

ddi_rep_get16 

read multiple 16–bit data from mapped memory, device register or DMA memory 

ddi_rep_get32 

read multiple 32–bit data from mapped memory, device register or DMA memory 

ddi_rep_get64 

read multiple 64–bit data from mapped memory, device register or DMA memory 

ddi_rep_put8 

write multiple 8–bit data to mapped memory, device register or DMA memory 

ddi_rep_put16 

write multiple 16–bit data to mapped memory, device register or DMA memory 

ddi_rep_put32 

write multiple 32–bit data to mapped memory, device register or DMA memory 

ddi_rep_put64 

write multiple 64–bit data to mapped memory, device register or DMA memory 

ddi_peek8 

cautiously read an 8–bit value from a location 

ddi_peek16 

cautiously read a 16–bit value from a location 

ddi_peek32 

cautiously read a 32–bit value from a location 

ddi_peek64 

cautiously read a 64–bit value from a location 

ddi_poke8 

cautiously write an 8–bit value to a location 

ddi_poke16 

cautiously write a 16–bit value to a location 

ddi_poke32 

cautiously write a 32–bit value to a location 

ddi_poke64 

cautiously write a 64–bit value to a location 

The general programmed I/O functions above can always be used rather than the mem, io, and pci_config functions below. However, the below functions may be used as alternatives in cases where the type of access is known at compile time.

Table B–14 Alternate Access Mechanisms

Function Name 

Description 

ddi_io_get8

read 8-bit data from mapped device register in I/O space 

ddi_io_get16 

read 16-bit data from mapped device register in I/O space 

ddi_io_get32 

read 32-bit data from mapped device register in I/O space 

ddi_io_put8 

write 8-bit data to mapped device register in I/O space 

ddi_io_put16 

write 16-bit data to mapped device register in I/O space 

ddi_io_put32 

write 32-bit data to mapped device register in I/O space 

ddi_io_rep_get8 

read multiple 8-bit data from mapped device register in I/O space 

ddi_io_rep_get16 

read multiple 16-bit data from mapped device register in I/O space 

ddi_io_rep_get32 

read multiple 32-bit data from mapped device register in I/O space 

ddi_io_rep_put8 

write multiple 8-bit data to mapped device register in I/O space 

ddi_io_rep_put16 

write multiple 16-bit data to mapped device register in I/O space 

ddi_io_rep_put32 

write multiple 32-bit data to mapped device register in I/O space 

ddi_mem_get8 

read 8-bit data from mapped device in memory space or DMA memory 

ddi_mem_get16 

read 16-bit data from mapped device in memory space or DMA memory 

ddi_mem_get32 

read 32-bit data from mapped device in memory space or DMA memory 

ddi_mem_get64 

read 64-bit data from mapped device in memory space or DMA memory 

ddi_mem_put8 

write 8-bit data to mapped device in memory space or DMA memory 

ddi_mem_put16 

write 16-bit data to mapped device in memory space or DMA memory 

ddi_mem_put32 

write 32-bit data to mapped device in memory space or DMA memory 

ddi_mem_put64 

write 64-bit data to mapped device in memory space or DMA memory 

ddi_mem_rep_get8 

read multiple 8-bit data from mapped device in memory space or DMA memory 

ddi_mem_rep_get16 

read multiple 16-bit data from mapped device in memory space or DMA memory 

ddi_mem_rep_get32 

read multiple 32-bit data from mapped device in memory space or DMA memory 

ddi_mem_rep_get64 

read multiple 64-bit data from mapped device in memory space or DMA memory 

ddi_mem_rep_put8 

write multiple 8-bit data to mapped device in memory space or DMA memory 

ddi_mem_rep_put16 

write multiple 16-bit data to mapped device in memory space or DMA memory 

ddi_mem_rep_put32 

write multiple 32-bit data to mapped device in memory space or DMA memory 

ddi_mem_rep_put64 

write multiple 64-bit data to mapped device in memory space or DMA memory 

pci_config_setup 

setup access to PCI Local Bus Configuration space 

pci_config_teardown 

tear down access to PCI Local Bus Configuration space 

pci_config_get8 

read 8-bit data from the PCI Local Bus Configuration space 

pci_config_get16 

read 16-bit data from the PCI Local Bus Configuration space 

pci_config_get32 

read 32-bit data from the PCI Local Bus Configuration space 

pci_config_get64 

read 64-bit data from the PCI Local Bus Configuration space 

pci_config_put8 

write 8-bit data to the PCI Local Bus Configuration space 

pci_config_put16 

write 16-bit data to the PCI Local Bus Configuration space 

pci_config_put32 

write 32-bit data to the PCI Local Bus Configuration space 

pci_config_put64 

write 64-bit data to the PCI Local Bus Configuration space 

Table B–15 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