Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F135722377
D50016.id.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
4 KB
Referenced Files
None
Subscribers
None
D50016.id.diff
View Options
diff --git a/sys/arm/include/param.h b/sys/arm/include/param.h
--- a/sys/arm/include/param.h
+++ b/sys/arm/include/param.h
@@ -68,6 +68,8 @@
#define MAXMEMDOM 1
#endif
+#define __HAVE_STATIC_DEVMAP
+
#define ALIGNBYTES _ALIGNBYTES
#define ALIGN(p) _ALIGN(p)
/*
diff --git a/sys/arm64/arm64/machdep.c b/sys/arm64/arm64/machdep.c
--- a/sys/arm64/arm64/machdep.c
+++ b/sys/arm64/arm64/machdep.c
@@ -38,7 +38,6 @@
#include <sys/cons.h>
#include <sys/cpu.h>
#include <sys/csan.h>
-#include <sys/devmap.h>
#include <sys/efi.h>
#include <sys/efi_map.h>
#include <sys/exec.h>
@@ -852,8 +851,6 @@
physmem_init_kernel_globals();
- devmap_bootstrap();
-
valid = bus_probe();
cninit();
diff --git a/sys/kern/subr_devmap.c b/sys/kern/subr_devmap.c
--- a/sys/kern/subr_devmap.c
+++ b/sys/kern/subr_devmap.c
@@ -41,6 +41,7 @@
#include <machine/pte.h>
#endif
+#ifdef __HAVE_STATIC_DEVMAP
#define DEVMAP_PADDR_NOTFOUND ((vm_paddr_t)(-1))
static const struct devmap_entry *devmap_table;
@@ -55,12 +56,14 @@
#define AKVA_DEVMAP_MAX_ENTRIES 32
static struct devmap_entry akva_devmap_entries[AKVA_DEVMAP_MAX_ENTRIES];
static u_int akva_devmap_idx;
+#endif
static vm_offset_t akva_devmap_vaddr = DEVMAP_MAX_VADDR;
#if defined(__aarch64__) || defined(__riscv)
extern int early_boot;
#endif
+#ifdef __HAVE_STATIC_DEVMAP
/*
* Print the contents of the static mapping table using the provided printf-like
* output function (which will be either printf or db_printf).
@@ -139,7 +142,6 @@
devmap_register_table(akva_devmap_entries);
/* Allocate virtual address space from the top of kva downwards. */
-#ifdef __arm__
/*
* If the range being mapped is aligned and sized to 1MB boundaries then
* also align the virtual address to the next-lower 1MB boundary so that
@@ -147,9 +149,7 @@
*/
if ((pa & L1_S_OFFSET) == 0 && (sz & L1_S_OFFSET) == 0) {
akva_devmap_vaddr = trunc_1mpage(akva_devmap_vaddr - sz);
- } else
-#endif
- {
+ } else {
akva_devmap_vaddr = trunc_page(akva_devmap_vaddr - sz);
}
m = &akva_devmap_entries[akva_devmap_idx++];
@@ -187,12 +187,8 @@
return;
for (pd = devmap_table; pd->pd_size != 0; ++pd) {
-#if defined(__arm__)
pmap_preboot_map_attr(pd->pd_pa, pd->pd_va, pd->pd_size,
VM_PROT_READ | VM_PROT_WRITE, VM_MEMATTR_DEVICE);
-#elif defined(__aarch64__) || defined(__riscv)
- pmap_kenter_device(pd->pd_va, pd->pd_size, pd->pd_pa);
-#endif
}
}
@@ -237,6 +233,7 @@
return (DEVMAP_PADDR_NOTFOUND);
}
+#endif
/*
* Map a set of physical memory pages into the kernel virtual address space.
@@ -253,11 +250,13 @@
pmap_mapdev(vm_paddr_t pa, vm_size_t size)
{
vm_offset_t va, offset;
+#ifdef __HAVE_STATIC_DEVMAP
void * rva;
/* First look in the static mapping table. */
if ((rva = devmap_ptov(pa, size)) != NULL)
return (rva);
+#endif
offset = pa & PAGE_MASK;
pa = trunc_page(pa);
@@ -292,11 +291,13 @@
pmap_mapdev_attr(vm_paddr_t pa, vm_size_t size, vm_memattr_t ma)
{
vm_offset_t va, offset;
+#ifdef __HAVE_STATIC_DEVMAP
void * rva;
/* First look in the static mapping table. */
if ((rva = devmap_ptov(pa, size)) != NULL)
return (rva);
+#endif
offset = pa & PAGE_MASK;
pa = trunc_page(pa);
@@ -333,9 +334,11 @@
{
vm_offset_t offset, va;
+#ifdef __HAVE_STATIC_DEVMAP
/* Nothing to do if we find the mapping in the static table. */
if (devmap_vtop(p, size) != DEVMAP_PADDR_NOTFOUND)
return;
+#endif
va = (vm_offset_t)p;
offset = va & PAGE_MASK;
@@ -347,6 +350,7 @@
}
#ifdef DDB
+#ifdef __HAVE_STATIC_DEVMAP
#include <ddb/ddb.h>
DB_SHOW_COMMAND_FLAGS(devmap, db_show_devmap, DB_CMD_MEMSAFE)
@@ -354,4 +358,5 @@
devmap_dump_table(db_printf);
}
+#endif
#endif /* DDB */
diff --git a/sys/riscv/riscv/machdep.c b/sys/riscv/riscv/machdep.c
--- a/sys/riscv/riscv/machdep.c
+++ b/sys/riscv/riscv/machdep.c
@@ -44,7 +44,6 @@
#include <sys/bus.h>
#include <sys/cons.h>
#include <sys/cpu.h>
-#include <sys/devmap.h>
#include <sys/efi_map.h>
#include <sys/exec.h>
#include <sys/imgact.h>
@@ -157,8 +156,6 @@
printf("avail memory = %ju (%ju MB)\n",
ptoa((uintmax_t)vm_free_count()),
ptoa((uintmax_t)vm_free_count()) / (1024 * 1024));
- if (bootverbose)
- devmap_print_table();
bufinit();
vm_pager_bufferinit();
@@ -636,9 +633,6 @@
physmem_init_kernel_globals();
- /* Establish static device mappings */
- devmap_bootstrap();
-
cninit();
/*
diff --git a/sys/sys/devmap.h b/sys/sys/devmap.h
--- a/sys/sys/devmap.h
+++ b/sys/sys/devmap.h
@@ -33,6 +33,7 @@
#error "no user-serviceable parts inside"
#endif
+#ifdef __HAVE_STATIC_DEVMAP
/*
* This structure is used by MD code to describe static mappings of devices
* which are established as part of bringing up the MMU early in the boot.
@@ -78,5 +79,6 @@
/* Print the static mapping table; used for bootverbose output. */
void devmap_print_table(void);
+#endif
#endif /* !_SYS_DEVMAP_H_ */
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Nov 13, 5:32 AM (13 h, 58 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
25246871
Default Alt Text
D50016.id.diff (4 KB)
Attached To
Mode
D50016: subr_devmap: Reduce the use of the static devmap
Attached
Detach File
Event Timeline
Log In to Comment