<?xml version="1.0" encoding="ANSI_X3.4-1968" standalone="no"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=ANSI_X3.4-1968" /><title>Some Hafta's</title><meta name="generator" content="DocBook XSL Stylesheets V1.75.2" /><link rel="home" href="index.html" title="Writing an ALSA Driver" /><link rel="up" href="ch04.html" title="Chapter 4. PCI Resource Management" /><link rel="prev" href="ch04.html" title="Chapter 4. PCI Resource Management" /><link rel="next" href="ch04s03.html" title="Resource Allocation" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Some Hafta's</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch04.html">Prev</a> </td><th width="60%" align="center">Chapter 4. PCI Resource Management</th><td width="20%" align="right"> <a accesskey="n" href="ch04s03.html">Next</a></td></tr></table><hr /></div><div class="section" title="Some Hafta's"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="pci-resource-some-haftas"></a>Some Hafta's</h2></div></div></div><p> The allocation of PCI resources is done in the <code class="function">probe()</code> function, and usually an extra <code class="function">xxx_create()</code> function is written for this purpose. </p><p> In the case of PCI devices, you first have to call the <code class="function">pci_enable_device()</code> 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 <code class="function">pci_set_master()</code> function, too. </p><p> Suppose the 28bit mask, and the code to be added would be like: </p><div class="informalexample"><pre class="programlisting"> 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; } </pre></div><p> </p></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch04.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="ch04.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="ch04s03.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Chapter 4. PCI Resource Management </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Resource Allocation</td></tr></table></div></body></html>