Index: alpha/alpha/pmap.c =================================================================== RCS file: /home/ncvs/src/sys/alpha/alpha/pmap.c,v retrieving revision 1.91 diff -u -r1.91 pmap.c --- alpha/alpha/pmap.c 15 Apr 2002 16:07:52 -0000 1.91 +++ alpha/alpha/pmap.c 29 Apr 2002 05:11:34 -0000 @@ -222,7 +222,7 @@ * Given a map and a machine independent protection code, * convert to an alpha protection code. */ -#define pte_prot(m, p) (protection_codes[m == pmap_kernel() ? 0 : 1][p]) +#define pte_prot(m, p) (protection_codes[m == kernel_pmap ? 0 : 1][p]) int protection_codes[2][8]; /* @@ -296,8 +296,7 @@ /* * Statically allocated kernel pmap */ -static struct pmap kernel_pmap_store; -pmap_t kernel_pmap; +struct pmap kernel_pmap_store; vm_offset_t avail_start; /* PA of first available physical page */ vm_offset_t avail_end; /* PA of last available physical page */ @@ -531,13 +530,9 @@ alpha_protection_init(); /* - * The kernel's pmap is statically allocated so we don't have to use - * pmap_create, which is unlikely to work correctly at this part of - * the boot sequence (XXX and which no longer exists). + * Initialize the kernel pmap (which is statically allocated). */ - kernel_pmap = &kernel_pmap_store; kernel_pmap->pm_lev1 = Lev1map; - kernel_pmap->pm_count = 1; kernel_pmap->pm_active = ~0; kernel_pmap->pm_asn[alpha_pal_whami()].asn = 0; kernel_pmap->pm_asn[alpha_pal_whami()].gen = 1; @@ -1356,7 +1351,6 @@ int i; pmap->pm_lev1 = Lev1map; - pmap->pm_count = 1; pmap->pm_ptphint = NULL; pmap->pm_active = 0; for (i = 0; i < MAXCPU; i++) { @@ -1407,7 +1401,6 @@ pmap->pm_lev1[PTLEV1I] = pmap_phys_to_pte(VM_PAGE_TO_PHYS(lev1pg)) | PG_V | PG_KRE | PG_KWE; - pmap->pm_count = 1; pmap->pm_ptphint = NULL; pmap->pm_active = 0; for (i = 0; i < MAXCPU; i++) { @@ -1775,39 +1768,9 @@ critical_exit(); } -/* - * Retire the given physical map from service. - * Should only be called if the map contains - * no valid mappings. - */ -void -pmap_destroy(pmap_t pmap) -{ - int count; - - if (pmap == NULL) - return; - - count = --pmap->pm_count; - if (count == 0) { - pmap_release(pmap); - panic("destroying a pmap is not yet implemented"); - } -} - -/* - * Add a reference to the specified pmap. - */ -void -pmap_reference(pmap_t pmap) -{ - if (pmap != NULL) { - pmap->pm_count++; - } -} /*************************************************** -* page management routines. + * page management routines. ***************************************************/ /* @@ -2691,16 +2654,6 @@ { } -/* - * Routine: pmap_kernel - * Function: - * Returns the physical map handle for the kernel. - */ -pmap_t -pmap_kernel() -{ - return (kernel_pmap); -} /* * pmap_zero_page zeros the specified hardware page by Index: alpha/include/pmap.h =================================================================== RCS file: /home/ncvs/src/sys/alpha/include/pmap.h,v retrieving revision 1.16 diff -u -r1.16 pmap.h --- alpha/include/pmap.h 20 Mar 2002 18:58:45 -0000 1.16 +++ alpha/include/pmap.h 29 Apr 2002 05:11:34 -0000 @@ -173,7 +173,6 @@ pt_entry_t *pm_lev1; /* KVA of lev0map */ vm_object_t pm_pteobj; /* Container for pte's */ TAILQ_HEAD(,pv_entry) pm_pvlist; /* list of mappings in pmap */ - int pm_count; /* reference count */ u_int32_t pm_active; /* active cpus */ struct { u_int32_t asn:ASN_BITS; /* address space number */ @@ -192,7 +191,8 @@ typedef struct pmap *pmap_t; #ifdef _KERNEL -extern pmap_t kernel_pmap; +extern struct pmap kernel_pmap_store; +#define kernel_pmap (&kernel_pmap_store) #endif /* @@ -231,7 +231,6 @@ void pmap_bootstrap(vm_offset_t, u_int); void pmap_setdevram(unsigned long long basea, vm_offset_t sizea); int pmap_uses_prom_console(void); -pmap_t pmap_kernel(void); void *pmap_mapdev(vm_offset_t, vm_size_t); void pmap_unmapdev(vm_offset_t, vm_size_t); unsigned *pmap_pte(pmap_t, vm_offset_t) __pure2; Index: alpha/isa/isa_dma.c =================================================================== RCS file: /home/ncvs/src/sys/alpha/isa/isa_dma.c,v retrieving revision 1.6 diff -u -r1.6 isa_dma.c --- alpha/isa/isa_dma.c 30 Jun 2001 05:29:10 -0000 1.6 +++ alpha/isa/isa_dma.c 29 Apr 2002 05:11:34 -0000 @@ -239,7 +239,7 @@ panic("isa_dmastart: transfer mapping not contiguous"); if ((chipset.sgmap == NULL) && - (pmap_extract(pmap_kernel(), (vm_offset_t)addr) + (pmap_extract(kernel_pmap, (vm_offset_t)addr) > BUS_SPACE_MAXADDR_24BIT)) { /* we bounced */ dma_bounced |= (1 << chan); Index: i386/i386/pmap.c =================================================================== RCS file: /home/ncvs/src/sys/i386/i386/pmap.c,v retrieving revision 1.321 diff -u -r1.321 pmap.c --- i386/i386/pmap.c 15 Apr 2002 15:59:56 -0000 1.321 +++ i386/i386/pmap.c 29 Apr 2002 05:11:35 -0000 @@ -146,8 +146,7 @@ #define pte_prot(m, p) (protection_codes[p]) static int protection_codes[8]; -static struct pmap kernel_pmap_store; -pmap_t kernel_pmap; +struct pmap kernel_pmap_store; LIST_HEAD(pmaplist, pmap); struct pmaplist allpmaps; @@ -306,14 +307,9 @@ i386_protection_init(); /* - * The kernel's pmap is statically allocated so we don't have to use - * pmap_create, which is unlikely to work correctly at this part of - * the boot sequence (XXX and which no longer exists). + * Initialize the kernel pmap (which is statically allocated). */ - kernel_pmap = &kernel_pmap_store; - kernel_pmap->pm_pdir = (pd_entry_t *) (KERNBASE + (u_int)IdlePTD); - kernel_pmap->pm_count = 1; kernel_pmap->pm_active = -1; /* don't allow deactivation */ TAILQ_INIT(&kernel_pmap->pm_pvlist); LIST_INIT(&allpmaps); @@ -1281,7 +1279,6 @@ pmap->pm_pdir = (pd_entry_t *)kmem_alloc_pageable(kernel_map, PAGE_SIZE); pmap_kenter((vm_offset_t) pmap->pm_pdir, (vm_offset_t) IdlePTD); - pmap->pm_count = 1; pmap->pm_ptphint = NULL; pmap->pm_active = 0; TAILQ_INIT(&pmap->pm_pvlist); @@ -1342,7 +1339,6 @@ pmap->pm_pdir[PTDPTDI] = VM_PAGE_TO_PHYS(ptdpg) | PG_V | PG_RW | PG_A | PG_M; - pmap->pm_count = 1; pmap->pm_active = 0; pmap->pm_ptphint = NULL; TAILQ_INIT(&pmap->pm_pvlist); @@ -1642,39 +1638,9 @@ splx(s); } -/* - * Retire the given physical map from service. - * Should only be called if the map contains - * no valid mappings. - */ -void -pmap_destroy(pmap_t pmap) -{ - int count; - - if (pmap == NULL) - return; - - count = --pmap->pm_count; - if (count == 0) { - pmap_release(pmap); - panic("destroying a pmap is not yet implemented"); - } -} - -/* - * Add a reference to the specified pmap. - */ -void -pmap_reference(pmap_t pmap) -{ - if (pmap != NULL) { - pmap->pm_count++; - } -} /*************************************************** -* page management routines. + * page management routines. ***************************************************/ /* @@ -2846,17 +2812,6 @@ } /* - * Routine: pmap_kernel - * Function: - * Returns the physical map handle for the kernel. - */ -pmap_t -pmap_kernel() -{ - return (kernel_pmap); -} - -/* * pmap_zero_page zeros the specified hardware page by mapping * the page into KVM and using bzero to clear its contents. */ Index: i386/include/pmap.h =================================================================== RCS file: /home/ncvs/src/sys/i386/include/pmap.h,v retrieving revision 1.77 diff -u -r1.77 pmap.h --- i386/include/pmap.h 20 Mar 2002 05:48:58 -0000 1.77 +++ i386/include/pmap.h 29 Apr 2002 05:11:35 -0000 @@ -208,7 +208,6 @@ pd_entry_t *pm_pdir; /* KVA of page directory */ vm_object_t pm_pteobj; /* Container for pte's */ TAILQ_HEAD(,pv_entry) pm_pvlist; /* list of mappings in pmap */ - int pm_count; /* reference count */ int pm_active; /* active on cpus */ struct pmap_statistics pm_stats; /* pmap statistics */ struct vm_page *pm_ptphint; /* pmap ptp hint */ @@ -220,7 +219,8 @@ typedef struct pmap *pmap_t; #ifdef _KERNEL -extern pmap_t kernel_pmap; +extern struct pmap kernel_pmap_store; +#define kernel_pmap (&kernel_pmap_store) #endif /* @@ -262,7 +262,6 @@ extern vm_offset_t virtual_end; void pmap_bootstrap( vm_offset_t, vm_offset_t); -pmap_t pmap_kernel(void); void *pmap_mapdev(vm_offset_t, vm_size_t); void pmap_unmapdev(vm_offset_t, vm_size_t); pt_entry_t *pmap_pte(pmap_t, vm_offset_t) __pure2; Index: i386/isa/isa_dma.c =================================================================== RCS file: /home/ncvs/src/sys/i386/isa/isa_dma.c,v retrieving revision 1.11 diff -u -r1.11 isa_dma.c --- i386/isa/isa_dma.c 20 Mar 2002 07:39:48 -0000 1.11 +++ i386/isa/isa_dma.c 29 Apr 2002 05:11:35 -0000 @@ -257,7 +257,7 @@ } /* translate to physical */ - phys = pmap_extract(pmap_kernel(), (vm_offset_t)addr); + phys = pmap_extract(kernel_pmap, (vm_offset_t)addr); if (flags & ISADMA_RAW) { dma_auto_mode |= (1 << chan); @@ -380,7 +380,7 @@ endva = (vm_offset_t)round_page((vm_offset_t)va + length); for (; va < (caddr_t) endva ; va += PAGE_SIZE) { - phys = trunc_page(pmap_extract(pmap_kernel(), (vm_offset_t)va)); + phys = trunc_page(pmap_extract(kernel_pmap, (vm_offset_t)va)); #define ISARAM_END RAM_END if (phys == 0) panic("isa_dmacheck: no physical page present"); Index: i386/isa/bs/bsif.c =================================================================== RCS file: /home/ncvs/src/sys/i386/isa/bs/bsif.c,v retrieving revision 1.15 diff -u -r1.15 bsif.c --- i386/isa/bs/bsif.c 20 Mar 2002 07:39:49 -0000 1.15 +++ i386/isa/bs/bsif.c 29 Apr 2002 05:11:35 -0000 @@ -392,7 +392,7 @@ endva = (vm_offset_t)round_page((unsigned long)(va+length)); for (; va < (caddr_t)endva; va += PAGE_SIZE) { - phys = trunc_page(pmap_extract(pmap_kernel(), (vm_offset_t)va)); + phys = trunc_page(pmap_extract(kernel_pmap, (vm_offset_t)va)); if (phys == 0) panic("bs_dmarangecheck: no physical page present"); if (phys >= RAM_END) Index: ia64/ia64/pmap.c =================================================================== RCS file: /home/ncvs/src/sys/ia64/ia64/pmap.c,v retrieving revision 1.57 diff -u -r1.57 pmap.c --- ia64/ia64/pmap.c 15 Apr 2002 16:07:52 -0000 1.57 +++ ia64/ia64/pmap.c 29 Apr 2002 05:11:35 -0000 @@ -166,7 +166,7 @@ * Given a map and a machine independent protection code, * convert to an ia64 protection code. */ -#define pte_prot(m, p) (protection_codes[m == pmap_kernel() ? 0 : 1][p]) +#define pte_prot(m, p) (protection_codes[m == kernel_pmap ? 0 : 1][p]) #define pte_prot_pl(m, p) (pte_prot(m, p) & 3) #define pte_prot_ar(m, p) (pte_prot(m, p) >> 2) int protection_codes[2][8]; @@ -179,8 +179,7 @@ /* * Statically allocated kernel pmap */ -static struct pmap kernel_pmap_store; -pmap_t kernel_pmap; +struct pmap kernel_pmap_store; vm_offset_t avail_start; /* PA of first available physical page */ vm_offset_t avail_end; /* PA of last available physical page */ @@ -435,14 +434,10 @@ ia64_protection_init(); /* - * The kernel's pmap is statically allocated so we don't have to use - * pmap_create, which is unlikely to work correctly at this part of - * the boot sequence (XXX and which no longer exists). + * Initialize the kernel pmap (which is statically allocated). */ - kernel_pmap = &kernel_pmap_store; for (i = 0; i < 5; i++) kernel_pmap->pm_rid[i] = 0; - kernel_pmap->pm_count = 1; kernel_pmap->pm_active = 1; TAILQ_INIT(&kernel_pmap->pm_pvlist); PCPU_SET(current_pmap, kernel_pmap); @@ -824,7 +819,6 @@ pmap->pm_flags = 0; for (i = 0; i < 5; i++) pmap->pm_rid[i] = 0; - pmap->pm_count = 1; pmap->pm_ptphint = NULL; pmap->pm_active = 0; TAILQ_INIT(&pmap->pm_pvlist); @@ -843,7 +837,6 @@ pmap->pm_flags = 0; for (i = 0; i < 5; i++) pmap->pm_rid[i] = 0; - pmap->pm_count = 1; pmap->pm_ptphint = NULL; pmap->pm_active = 0; TAILQ_INIT(&pmap->pm_pvlist); @@ -926,39 +919,8 @@ } } -/* - * Retire the given physical map from service. - * Should only be called if the map contains - * no valid mappings. - */ -void -pmap_destroy(pmap_t pmap) -{ - int count; - - if (pmap == NULL) - return; - - count = --pmap->pm_count; - if (count == 0) { - pmap_release(pmap); - panic("destroying a pmap is not yet implemented"); - } -} - -/* - * Add a reference to the specified pmap. - */ -void -pmap_reference(pmap_t pmap) -{ - if (pmap != NULL) { - pmap->pm_count++; - } -} - /*************************************************** -* page management routines. + * page management routines. ***************************************************/ /* @@ -2095,16 +2057,6 @@ { } -/* - * Routine: pmap_kernel - * Function: - * Returns the physical map handle for the kernel. - */ -pmap_t -pmap_kernel() -{ - return (kernel_pmap); -} /* * pmap_zero_page zeros the specified hardware page by Index: ia64/include/pmap.h =================================================================== RCS file: /home/ncvs/src/sys/ia64/include/pmap.h,v retrieving revision 1.7 diff -u -r1.7 pmap.h --- ia64/include/pmap.h 20 Mar 2002 23:30:31 -0000 1.7 +++ ia64/include/pmap.h 29 Apr 2002 05:11:35 -0000 @@ -89,7 +89,6 @@ struct pmap { TAILQ_HEAD(,pv_entry) pm_pvlist; /* list of mappings in pmap */ u_int32_t pm_rid[5]; /* base RID for pmap */ - int pm_count; /* reference count */ int pm_flags; /* pmap flags */ int pm_active; /* active flag */ struct pmap_statistics pm_stats; /* pmap statistics */ @@ -104,7 +103,8 @@ typedef struct pmap *pmap_t; #ifdef _KERNEL -extern pmap_t kernel_pmap; +extern struct pmap kernel_pmap_store; +#define kernel_pmap (&kernel_pmap_store) #endif /* @@ -134,7 +134,6 @@ void pmap_bootstrap(void); void pmap_setdevram(unsigned long long basea, vm_offset_t sizea); int pmap_uses_prom_console(void); -pmap_t pmap_kernel(void); void *pmap_mapdev(vm_offset_t, vm_size_t); void pmap_unmapdev(vm_offset_t, vm_size_t); unsigned *pmap_pte(pmap_t, vm_offset_t) __pure2; Index: ia64/isa/isa_dma.c =================================================================== RCS file: /home/ncvs/src/sys/ia64/isa/isa_dma.c,v retrieving revision 1.3 diff -u -r1.3 isa_dma.c --- ia64/isa/isa_dma.c 19 Mar 2002 11:15:26 -0000 1.3 +++ ia64/isa/isa_dma.c 29 Apr 2002 05:11:35 -0000 @@ -242,7 +242,7 @@ #if 0 if ((chipset.sgmap == NULL) && - (pmap_extract(pmap_kernel(), (vm_offset_t)addr) + (pmap_extract(kernel_pmap, (vm_offset_t)addr) > BUS_SPACE_MAXADDR_24BIT)) { /* we bounced */ dma_bounced |= (1 << chan); Index: pc98/pc98/isa_dma.c =================================================================== RCS file: /home/ncvs/src/sys/pc98/pc98/isa_dma.c,v retrieving revision 1.14 diff -u -r1.14 isa_dma.c --- pc98/pc98/isa_dma.c 20 Mar 2002 12:22:31 -0000 1.14 +++ pc98/pc98/isa_dma.c 29 Apr 2002 05:11:36 -0000 @@ -290,7 +290,7 @@ } /* translate to physical */ - phys = pmap_extract(pmap_kernel(), (vm_offset_t)addr); + phys = pmap_extract(kernel_pmap, (vm_offset_t)addr); if (flags & ISADMA_RAW) { dma_auto_mode |= (1 << chan); @@ -440,7 +440,7 @@ endva = (vm_offset_t)round_page((vm_offset_t)va + length); for (; va < (caddr_t) endva ; va += PAGE_SIZE) { - phys = trunc_page(pmap_extract(pmap_kernel(), (vm_offset_t)va)); + phys = trunc_page(pmap_extract(kernel_pmap, (vm_offset_t)va)); #ifdef EPSON_BOUNCEDMA #define ISARAM_END 0xf00000 #else Index: powerpc/include/pmap.h =================================================================== RCS file: /home/ncvs/src/sys/powerpc/include/pmap.h,v retrieving revision 1.5 diff -u -r1.5 pmap.h --- powerpc/include/pmap.h 28 Feb 2002 11:55:37 -0000 1.5 +++ powerpc/include/pmap.h 29 Apr 2002 05:11:36 -0000 @@ -41,7 +41,6 @@ u_int pm_sr[16]; u_int pm_active; u_int pm_context; - u_int pm_count; struct pmap_statistics pm_stats; }; Index: powerpc/powerpc/pmap.c =================================================================== RCS file: /home/ncvs/src/sys/powerpc/powerpc/pmap.c,v retrieving revision 1.31 diff -u -r1.31 pmap.c --- powerpc/powerpc/pmap.c 16 Apr 2002 12:15:17 -0000 1.31 +++ powerpc/powerpc/pmap.c 29 Apr 2002 05:11:36 -0000 @@ -686,7 +686,6 @@ } kernel_pmap->pm_sr[KERNEL_SR] = KERNEL_SEGMENT; kernel_pmap->pm_active = ~0; - kernel_pmap->pm_count = 1; /* * Allocate a kernel stack with a guard page for thread0 and map it @@ -1223,7 +1222,6 @@ /* * Allocate some segment registers for this pmap. */ - pmap->pm_count = 1; for (i = 0; i < NPMAPS; i += VSID_NBPW) { u_int hash, n; @@ -1367,17 +1365,6 @@ for (i = 0; i < count; i++, va += PAGE_SIZE) pmap_kremove(va); -} - -/* - * Add a reference to the specified pmap. - */ -void -pmap_reference(pmap_t pm) -{ - - if (pm != NULL) - pm->pm_count++; } void Index: sparc64/include/pmap.h =================================================================== RCS file: /home/ncvs/src/sys/sparc64/include/pmap.h,v retrieving revision 1.15 diff -u -r1.15 pmap.h --- sparc64/include/pmap.h 4 Mar 2002 05:20:28 -0000 1.15 +++ sparc64/include/pmap.h 29 Apr 2002 05:11:36 -0000 @@ -71,7 +71,6 @@ vm_object_t pm_tsb_obj; u_int pm_active; u_int pm_context[MAXCPU]; - u_int pm_count; struct pmap_statistics pm_stats; }; Index: sparc64/sparc64/pmap.c =================================================================== RCS file: /home/ncvs/src/sys/sparc64/sparc64/pmap.c,v retrieving revision 1.50 diff -u -r1.50 pmap.c --- sparc64/sparc64/pmap.c 21 Apr 2002 22:57:42 -0000 1.50 +++ sparc64/sparc64/pmap.c 29 Apr 2002 05:11:36 -0000 @@ -406,7 +406,6 @@ for (i = 0; i < MAXCPU; i++) pm->pm_context[i] = TLB_CTX_KERNEL; pm->pm_active = ~0; - pm->pm_count = 1; TAILQ_INIT(&pm->pm_pvlist); /* XXX flush all non-locked tlb entries */ @@ -1116,7 +1115,6 @@ for (i = 0; i < MAXCPU; i++) pm->pm_context[i] = 0; pm->pm_active = 0; - pm->pm_count = 1; pm->pm_tsb = NULL; pm->pm_tsb_obj = NULL; TAILQ_INIT(&pm->pm_pvlist); @@ -1167,7 +1165,6 @@ for (i = 0; i < MAXCPU; i++) pm->pm_context[i] = -1; pm->pm_active = 0; - pm->pm_count = 1; TAILQ_INIT(&pm->pm_pvlist); bzero(&pm->pm_stats, sizeof(pm->pm_stats)); } @@ -1217,26 +1214,6 @@ void pmap_growkernel(vm_offset_t addr) { -} - -/* - * Retire the given physical map from service. Pmaps are always allocated - * as part of a larger structure, so this never happens. - */ -void -pmap_destroy(pmap_t pm) -{ - panic("pmap_destroy: unimplemented"); -} - -/* - * Add a reference to the specified pmap. - */ -void -pmap_reference(pmap_t pm) -{ - if (pm != NULL) - pm->pm_count++; } /* Index: vm/pmap.h =================================================================== RCS file: /home/ncvs/src/sys/vm/pmap.h,v retrieving revision 1.45 diff -u -r1.45 pmap.h --- vm/pmap.h 15 Apr 2002 16:00:01 -0000 1.45 +++ vm/pmap.h 29 Apr 2002 05:11:36 -0000 @@ -98,7 +98,6 @@ void pmap_collect(void); void pmap_copy(pmap_t, pmap_t, vm_offset_t, vm_size_t, vm_offset_t); void pmap_copy_page(vm_page_t, vm_page_t); -void pmap_destroy(pmap_t); void pmap_enter(pmap_t, vm_offset_t, vm_page_t, vm_prot_t, boolean_t); vm_offset_t pmap_extract(pmap_t pmap, vm_offset_t va); @@ -122,7 +121,6 @@ void pmap_protect(pmap_t, vm_offset_t, vm_offset_t, vm_prot_t); void pmap_qenter(vm_offset_t, vm_page_t *, int); void pmap_qremove(vm_offset_t, int); -void pmap_reference(pmap_t); void pmap_release(pmap_t); void pmap_remove(pmap_t, vm_offset_t, vm_offset_t); void pmap_remove_pages(pmap_t, vm_offset_t, vm_offset_t); Index: vm/vm_kern.c =================================================================== RCS file: /home/ncvs/src/sys/vm/vm_kern.c,v retrieving revision 1.76 diff -u -r1.76 vm_kern.c --- vm/vm_kern.c 10 Mar 2002 21:52:46 -0000 1.76 +++ vm/vm_kern.c 29 Apr 2002 05:11:36 -0000 @@ -270,7 +270,6 @@ panic("kmem_suballoc"); } *max = *min + size; - pmap_reference(vm_map_pmap(parent)); result = vm_map_create(vm_map_pmap(parent), *min, *max); if (result == NULL) panic("kmem_suballoc: cannot create submap");