<html><body bgcolor="#FFFFFF"><div><div><br><br>在 2012-7-10,12:58,Prabhu nath <<a href="mailto:gprabhunath@gmail.com"><a href="mailto:gprabhunath@gmail.com">gprabhunath@gmail.com</a></a>> 写道:<br><br></div><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><span class="Apple-style-span" style="-webkit-tap-highlight-color: rgba(26, 26, 26, 0.296875); -webkit-composition-fill-color: rgba(175, 192, 227, 0.230469); -webkit-composition-frame-color: rgba(77, 128, 180, 0.230469); font-size: 15px; font-family: 微软雅黑; "><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><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><span class="Apple-style-span" style="-webkit-tap-highlight-color: rgba(26, 26, 26, 0.296875); -webkit-composition-fill-color: rgba(175, 192, 227, 0.230469); -webkit-composition-frame-color: rgba(77, 128, 180, 0.230469); font-size: 15px; font-family: 微软雅黑; "><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><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"><a href="mailto:Kernelnewbies@kernelnewbies.org">Kernelnewbies@kernelnewbies.org</a></a></span><br><span><a href="http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies"><a href="http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies">http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies</a></a></span><br></div></blockquote></div><div><span></span></div></body></html>