I port the Linux kernel is investigating how the new ARM platform. I have noticed that some platform implementation is static mapping from a physical IO address to a virtual address in the map_io
function.
My question is how should I fix the "virtual" address in the structure map_desc
? Can I map physical IO to arbitrary virtual memory? Or are there some rules or good practice about it? .
Here Some examples of map_desc
and map_io
>
44 DT_MACHINE_START (VERSATILE_PB, "ARM-Versailles (device tree support)") 45.map_io = multifunction_map_o, 46.init_argeley = virtual_init_ariali, 47.in_matchin = multicast_dt_inited, 48.dt_compat = versatile_dt_match, 49 Restart = versatile_restart, 50 MACHINE_END
189 void __init versatile_map_io (null) 190 {191 iotable_init (versatile_io_desc, ARRAY_SIZE (versatile_io_desc)); 192} 131 static structure map_desc versatile_io_desc [] __initdata __maybe_unused = {132 {133. Virtual = IO_ADDRESS (VERSATILE_SYS_BASE), 134 Kpifan = __phys_to_pfn (VERSATILE_SYS_BASE), 135. Length = SZ_4K, 136. Type = MT_DEVICE 137}, {
too long for a comment ... < / P> Not an expert but, because map_desc is for static mapping. It should be from the system manual. How virtual the peripheral kernel can be accessed from the virtual location, the PFN (page frame number) is the physical address by the page units. does not matter if you are in kernel space, so you want to make this kernel using the virtual space mapping even have access to a fixed physical address which you need mapping, That can be one-by-one which I believe is what you get from map_desc. Statemapping mapping is map_desc, dynamic mapping is the ioremap. So if you want to play with physical IO, then ioremap is the first thing if it does not work for special cases map_desc. Different types of addresses in Linux provide a good entry point to mapping.
No comments:
Post a Comment