* Map all of the static regions in the devmap table, and remember the devmap * table so the mapdev, ptov, and vtop functions can do lookups later. * * If a non-NULL table pointer is given it is used unconditionally, otherwise * the previously-registered table is used. This smooths transition from legacy * code that fills in a local table then calls this function passing that table, * and ne
| 176 | * with a NULL pointer. |
| 177 | */ |
| 178 | void |
| 179 | devmap_bootstrap(vm_offset_t l1pt, const struct devmap_entry *table) |
| 180 | { |
| 181 | const struct devmap_entry *pd; |
| 182 | |
| 183 | devmap_bootstrap_done = true; |
| 184 | |
| 185 | /* |
| 186 | * If given a table pointer, use it. Otherwise, if a table was |
| 187 | * previously registered, use it. Otherwise, no work to do. |
| 188 | */ |
| 189 | if (table != NULL) |
| 190 | devmap_table = table; |
| 191 | else if (devmap_table == NULL) |
| 192 | return; |
| 193 | |
| 194 | for (pd = devmap_table; pd->pd_size != 0; ++pd) { |
| 195 | #if defined(__arm__) |
| 196 | #if __ARM_ARCH >= 6 |
| 197 | pmap_preboot_map_attr(pd->pd_pa, pd->pd_va, pd->pd_size, |
| 198 | VM_PROT_READ | VM_PROT_WRITE, VM_MEMATTR_DEVICE); |
| 199 | #else |
| 200 | pmap_map_chunk(l1pt, pd->pd_va, pd->pd_pa, pd->pd_size, |
| 201 | VM_PROT_READ | VM_PROT_WRITE, PTE_DEVICE); |
| 202 | #endif |
| 203 | #elif defined(__aarch64__) || defined(__riscv) |
| 204 | pmap_kenter_device(pd->pd_va, pd->pd_size, pd->pd_pa); |
| 205 | #endif |
| 206 | } |
| 207 | } |
| 208 | |
| 209 | /* |
| 210 | * Look up the given physical address in the static mapping data and return the |
no test coverage detected