The allocation of PCI resources is done in the
probe()
function, and usually an extra
xxx_create()
function is written for this
purpose.
In the case of PCI devices, you first have to call
the pci_enable_device()
function before
allocating resources. Also, you need to set the proper PCI DMA
mask to limit the accessed I/O range. In some cases, you might
need to call pci_set_master()
function,
too.
Suppose the 28bit mask, and the code to be added would be like:
err = pci_enable_device(pci); if (err < 0) return err; if (pci_set_dma_mask(pci, DMA_BIT_MASK(28)) < 0 || pci_set_consistent_dma_mask(pci, DMA_BIT_MASK(28)) < 0) { printk(KERN_ERR "error to set 28bit mask DMA\n"); pci_disable_device(pci); return -ENXIO; }