<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="GENERATOR" content="MSHTML 8.00.6001.23501">
</head>
<body>
<div dir="ltr" align="left"><span class="133430607-28062013"><font color="#0000ff" size="2" face="Arial">Hi Jayesh,</font></span></div>
<div dir="ltr" align="left"><span class="133430607-28062013"><font color="#0000ff" size="2" face="Arial"></font></span>&nbsp;</div>
<div dir="ltr" align="left"><span class="133430607-28062013"><font color="#0000ff" size="2" face="Arial">thanks, so I should use pci_ioremap_bar() and ioread8() and iowrite8() and the like.</font></span></div>
<div dir="ltr" align="left"><span class="133430607-28062013"></span>&nbsp;</div>
<div dir="ltr" align="left"><span class="133430607-28062013"><font color="#0000ff" size="2" face="Arial">What really confused me&nbsp;was the &quot;re&quot; in pci_ioremap_bar() (by the way, there is no</font></span></div>
<div dir="ltr" align="left"><span class="133430607-28062013"><font color="#0000ff" size="2" face="Arial">API called</font>&nbsp;<font color="#0000ff" size="2" face="Arial">pci_ioremap(), but only pci_iomap()), suggesting that something different</font></span></div>
<div dir="ltr" align="left"><span class="133430607-28062013"><font color="#0000ff" size="2" face="Arial">may be done in these two functions&nbsp;apart from better error checking.&nbsp;&nbsp;</font></span></div>
<br>
<div dir="ltr" lang="en-us" class="OutlookMessageHeader" align="left">
<hr tabindex="-1">
<font size="2" face="Tahoma"><b>From:</b> JAYESH TANK [mailto:jayeshece08@gmail.com]
<br>
<b>Sent:</b> Donnerstag, 27. Juni 2013 10:27<br>
<b>To:</b> Warlich, Christof<br>
<b>Cc:</b> kernelnewbies@kernelnewbies.org<br>
<b>Subject:</b> Re: pci_iomap() and pci_ioremap_bar()<br>
</font><br>
</div>
<div></div>
<div dir="ltr">AFAIK,&nbsp;<span style="FONT-FAMILY: arial,sans-serif; FONT-SIZE: 13px">pci_ioremap_bar api</span><span style="COLOR: rgb(0,0,0)">&nbsp;provides an error-proof way (relative to pci_ioremap) for PCI memory remap.</span>
<div><span style="COLOR: rgb(0,0,0)"><br>
</span></div>
<div><span style="COLOR: rgb(0,0,0)">After the mapping is successful, in case you are writing a portable code, use&nbsp;</span><span style="FONT-FAMILY: arial,sans-serif; FONT-SIZE: 13px">ioread8 api which provides platform abstraction to the re mapped registers.</span></div>
<div><span style="FONT-FAMILY: arial,sans-serif; FONT-SIZE: 13px"><br>
</span></div>
<div><span style="FONT-FAMILY: arial,sans-serif; FONT-SIZE: 13px">Hope that helps.</span></div>
<div><span style="FONT-FAMILY: arial,sans-serif; FONT-SIZE: 13px"><br>
</span></div>
<div><span style="FONT-FAMILY: arial,sans-serif; FONT-SIZE: 13px">BR,</span></div>
<div><span style="FONT-FAMILY: arial,sans-serif; FONT-SIZE: 13px">Jayesh&nbsp;</span></div>
</div>
<div class="gmail_extra"><br>
<br>
<div class="gmail_quote">On Wed, Jun 26, 2013 at 12:42 PM, Warlich, Christof <span dir="ltr">
&lt;<a href="mailto:christof.warlich@siemens.com" target="_blank">christof.warlich@siemens.com</a>&gt;</span> wrote:<br>
<blockquote style="BORDER-LEFT: #ccc 1px solid; MARGIN: 0px 0px 0px 0.8ex; PADDING-LEFT: 1ex" class="gmail_quote">
Hi,<br>
<br>
can anyone explain when I should use<br>
<br>
void __iomem *regs = pci_iomap(device, barNumber, 0);<br>
<br>
and when<br>
<br>
void __iomem *regs = pci_ioremap_bar(device, barNumber);<br>
<br>
is more appropriate to map PCI memory?<br>
<br>
Furthermore, after the mapping succeeded, when may I<br>
directly access the mapped memory, e.g.:<br>
<br>
char firstByte = *regs;<br>
<br>
and when should I better use ioread8() instead?:<br>
<br>
char firstBype = ioread8(regs);<br>
<br>
All listed alternatives from above seems to work equally<br>
well for me (on x86), so I'm curious to learn what might<br>
be the difference. A guess: Does ioread8() work for both<br>
memory mapped _and_ IO mapped registers, while the direct<br>
access only works for the memory mapped case?<br>
<br>
Thanks for any clarification.<br>
<br>
_______________________________________________<br>
Kernelnewbies mailing list<br>
<a href="mailto:Kernelnewbies@kernelnewbies.org">Kernelnewbies@kernelnewbies.org</a><br>
<a href="http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies" target="_blank">http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies</a><br>
</blockquote>
</div>
<br>
</div>
</body>
</html>