Lines Matching +full:memory +full:- +full:mapping
1 /*-
28 /* Routines for mapping device memory. */
45 #define DEVMAP_PADDR_NOTFOUND ((vm_paddr_t)(-1))
51 * The allocated-kva (akva) devmap table and metadata. Platforms can call
68 * Print the contents of the static mapping table using the provided printf-like
82 for (pd = devmap_table; pd->pd_size != 0; ++pd) { in devmap_dump_table()
83 prfunc(" 0x%08jx - 0x%08jx mapped at VA 0x%08jx\n", in devmap_dump_table()
84 (uintmax_t)pd->pd_pa, in devmap_dump_table()
85 (uintmax_t)(pd->pd_pa + pd->pd_size - 1), in devmap_dump_table()
86 (uintmax_t)pd->pd_va); in devmap_dump_table()
91 * Print the contents of the static mapping table. Used for bootverbose.
114 for (pd = devmap_table; pd != NULL && pd->pd_size != 0; ++pd) { in devmap_lastaddr()
115 if (lowaddr > pd->pd_va) in devmap_lastaddr()
116 lowaddr = pd->pd_va; in devmap_lastaddr()
127 * needs and when the platform-specific init function calls devmap_bootstrap()
138 if (akva_devmap_idx == (AKVA_DEVMAP_MAX_ENTRIES - 1)) in devmap_add_entry()
147 * also align the virtual address to the next-lower 1MB boundary so that in devmap_add_entry()
148 * we end with a nice efficient section mapping. in devmap_add_entry()
151 akva_devmap_vaddr = trunc_1mpage(akva_devmap_vaddr - sz); in devmap_add_entry()
153 akva_devmap_vaddr = trunc_page(akva_devmap_vaddr - sz); in devmap_add_entry()
156 m->pd_va = akva_devmap_vaddr; in devmap_add_entry()
157 m->pd_pa = pa; in devmap_add_entry()
158 m->pd_size = sz; in devmap_add_entry()
189 for (pd = devmap_table; pd->pd_size != 0; ++pd) { in devmap_bootstrap()
190 pmap_preboot_map_attr(pd->pd_pa, pd->pd_va, pd->pd_size, in devmap_bootstrap()
196 * Look up the given physical address in the static mapping data and return the
207 for (pd = devmap_table; pd->pd_size != 0; ++pd) { in devmap_ptov()
208 if (pa >= pd->pd_pa && pa + size <= pd->pd_pa + pd->pd_size) in devmap_ptov()
209 return ((void *)(pd->pd_va + (pa - pd->pd_pa))); in devmap_ptov()
216 * Look up the given virtual address in the static mapping data and return the
229 for (pd = devmap_table; pd->pd_size != 0; ++pd) { in devmap_vtop()
230 if (va >= pd->pd_va && va + size <= pd->pd_va + pd->pd_size) in devmap_vtop()
231 return ((vm_paddr_t)(pd->pd_pa + (va - pd->pd_va))); in devmap_vtop()
239 * Map a set of physical memory pages into the kernel virtual address space.
242 * This uses a pre-established static mapping if one exists for the requested
245 * This routine is intended to be used for mapping device memory, NOT real
246 * memory; the mapping type is inherently VM_MEMATTR_DEVICE in
263 * First look in the static mapping table. These are all mapped in pmap_mapdev_attr()
264 * as device memory, so only use the devmap for VM_MEMATTR_DEVICE. in pmap_mapdev_attr()
268 ("%s: Non-device mapping for pa %jx (type %x)", __func__, in pmap_mapdev_attr()
280 akva_devmap_vaddr = trunc_page(akva_devmap_vaddr - size); in pmap_mapdev_attr()
282 KASSERT(va >= (VM_MAX_KERNEL_ADDRESS - PMAP_MAPDEV_EARLY_SIZE), in pmap_mapdev_attr()
295 panic("pmap_mapdev: Couldn't alloc kernel virtual memory"); in pmap_mapdev_attr()
303 * Unmap device memory and free the kva space.
311 /* Nothing to do if we find the mapping in the static table. */ in pmap_unmapdev()