title: How to access PCI memory from Linux kernel space by memory mapping (Kernel 3.14)
body: <p>I'm looking for a way to access the memory space of an PCI device (explicit BAR2 and BAR3) without using DMA and IO-mapping. I have read much documentations but I never saw a flowchart or a step by step how to. So all my tries aren't successful.</p>
  
  <p>These are the steps inside <code>pci_probe</code> I actually try:</p>
  
  <ol>
  <li><code>data = kzalloc( sizeof(*data) , GFP_KERNEL );</code></li>
  <li><code>pci_set_drvdata(pdev, data);</code></li>
  <li><code>pci_enable_device(pdev);</code></li>
  </ol>
  
  <p>Now is the question what is the correct address to access <code>BAR2+offset</code> using <code>writeb</code> or <code>readb</code>? Or is there a another function to read/write from this space?</p>
  
  <hr>
  
  <p>PS: An similar question regarding <code>iomap</code> was posted <a href="https://stackoverflow.com/questions/35058353/address-mapping-of-pci-memory-in-kernel-space">here</a>.</p>