Wonderful. I liked it. Please see inline<br><br><div class="gmail_quote">On Tue, Jul 10, 2012 at 7:37 PM, ß®Ìì ²· <span dir="ltr"><<a href="mailto:buyit@live.cn" target="_blank">buyit@live.cn</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div bgcolor="#FFFFFF"><div><div><br><br>ÔÚ 2012-7-10£¬12:58£¬Prabhu nath <<a href="mailto:gprabhunath@gmail.com" target="_blank"></a><a href="mailto:gprabhunath@gmail.com" target="_blank">gprabhunath@gmail.com</a>> дµÀ£º<br>
<br></div><div class="im"><div></div><blockquote type="cite"><div>Dear All,<div> </div><div> Is it possible to map a physical address of a device to a known Kernel virtual address. I know about ioremap_xxx (...). </div>
<div>which will map a physical address of a device to a kernel virtual address allocated by ioremap_xxx(...). </div>
<div><br>For E.g. I have a device whose physical address range is 0x80008000 to 0x80008FFF. </div><div> Is it possible to map this device physical address to a known virtual address range 0xF0008000 to 0xF0008FFF. </div>
<div><br></div></div></blockquote><div><br></div></div><span><div>you can do this if you know exactly what you are doing, please follow below steps:</div><div>1. ask yourself why you need this fix map to a device io address? if you only want to get a fix formula to calculate</div>
<div>device virutal address from physical address, you can call ioremap(), and store the return value into a global variable.</div><div> </div><div>2. ask the architecturer of you platform provider, or you search into source code by yourself, make sure</div>
<div>whether the virtual address range 0xF0008000 to 0xF0008FFF has not been mapped yet, this is very important because</div><div>kernel region cannot be mapped twice. othersie you will get warning from log and without remap this region finally.</div>
<div> </div><div>3. suppose step 2 is ok, the region is not mapped, then call function ioremap_page_range(0xF0008000, 0xF0009000, 0x80008000, pgprot);</div><div> kernel will map virtual address [0xF0008000~0xF0009000] to physical address [0x80008000~0x80009000] .</div>
<div> </div><div> Note! you must make sure this region has not been mapped before on your platform. as i guess, they are 99% mapped already :=)</div><div><br></div><div><br></div></span><div class="im"><blockquote type="cite">
<div><div><br></div><div>My hardware configuration has 128 MB of system RAM which will have been MAPPED to the Kernel virtual address from 0xC0000000 to 0xC7FFFFFF</div><div><br></div><div>Also is it possible to configure the vmalloc kernel virtual address region to a fixed range of 128 MB from 0xC8000000 to 0xCFFFFFFF </div>
<div><br></div></div></blockquote></div><span><div>you can try to do it as below:</div><div>1. find the definition of VMALLOC_END, define it to be 0xD0800000, the original value will be something like 0xF0000000:</div><div>
#define VMALLOC_END 0xD0800000</div><div> </div><div>2. pass in parameter from u-boot to kernel, set "vmalloc=128M"</div><div> </div><div>3. now you should get result from boot log as below:</div><div>[ 0.000000] vmalloc : 0xc8800000 - 0xd0800000 ( 128 MB)<br>
[ 0.000000] lowmem : 0xc0000000 - 0xc8000000 ( 128 MB)<br></div><div>4. although you did what you want to do, i am sure that you don't know what you really want to do because these steps make no sense.</div>
<div> keep in mind that vmalloc region, which is from VMALLOC_START to VMALLOC_END, does not use direct memory map.</div></span></div></div></blockquote><div><br> Very humbly I should confess that I know what I am doing. I want a clear demarkation betwen vmalloc region and kernel virtual address of the physical devices, so that it will help me in future debugging. <br>
</div><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div bgcolor="#FFFFFF"><div><div><br></div><div><br></div><br><blockquote type="cite"><div><div>
Thanks,<br>Prabhu</div><div><br></div>
</div></blockquote><blockquote type="cite"><div><span>_______________________________________________</span><br><span>Kernelnewbies mailing list</span><br><span><a href="mailto:Kernelnewbies@kernelnewbies.org" target="_blank"></a><a href="mailto:Kernelnewbies@kernelnewbies.org" target="_blank">Kernelnewbies@kernelnewbies.org</a></span><br>
<span><a href="http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies" target="_blank"></a><a href="http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies" target="_blank">http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies</a></span><br>
</div></blockquote></div><div><span></span></div></div></blockquote></div><br>