On Feb 18, 2014, at 3:54 AM, Yann Sionneau <yann.sionn...@gmail.com> wrote:
> Le 10/02/14 23:00, Yann Sionneau a écrit : >> Thanks for all your explanations, if everything I said here is correct >> (which would mean I understood correctly your answer) then I think I'm ready >> to implement all this :) > > Hi, > > I have made good progress on the NetBSD port, it is now booting up to > enabling interrupts and cpu_initclocks() call, see the boot log [0]. > > But then I am wondering how I can map the memory mapped registers of the > timer0 of Milkymist SoC in order to use it as the main ticking clock. > > Basically, I need to map physical address 0xe000.1000 somewhere in kernel > virtual memory. > > Is there somewhere a function like vaddr_t map_paddr(paddr_t, prot)? > > I could indeed walk the kernel page table and insert somewhere in a free PTE > (a NULL one) a reference to the 0xe000.1000 physical address, but then how to > be sure that the vm subsystem will not allocate this virtual address twice? > > Is there an "iomapping" mechanism? > > Thank you for your help :) > > [0] -- http://pastebin.com/MYitt9L4 see bus_space(9), specifically bus_space_map. internally, it allocates some KVA via uvm and uses pmap_kenter_pa to map the I/O address via the allocated KVA.