diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2010-11-20 20:33:25 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2010-11-20 20:33:25 +0000 |
commit | b7e31873a5c9480c386ed30cda01527bec2c0527 (patch) | |
tree | e8f6580efeecf338242520c76bc4469a5748e650 /sys/arch | |
parent | 0ec4827cfd483b9a1e6a836c4dbc9266b7bf44f6 (diff) |
This is a first step towards getting rid of avail_start and avail_end in the
kernel, currently limited to low-hanging fruit: these variables were used
by bus_dma to specify the range in which to allocate memory, back when
uvm_pglistalloc() was stupid and would not walk the vm_physseg[].
Nowadays, except on some platforms for early initialization, these variables
are not used, or do not need to be global variables. Therefore:
- remove `extern' declarations of avail_start and avail_end (or close cousins,
such as arm physical_start and physical_end) from files which no longer need
to use them.
- make them local variables whenever possible.
- remove them when they are assigned to but no longer used.
Diffstat (limited to 'sys/arch')
-rw-r--r-- | sys/arch/alpha/dev/bus_dma.c | 6 | ||||
-rw-r--r-- | sys/arch/amd64/amd64/bus_dma.c | 4 | ||||
-rw-r--r-- | sys/arch/amd64/amd64/machdep.c | 5 | ||||
-rw-r--r-- | sys/arch/amd64/amd64/pmap.c | 11 | ||||
-rw-r--r-- | sys/arch/arm/arm/bus_dma.c | 5 | ||||
-rw-r--r-- | sys/arch/hppa/hppa/machdep.c | 4 | ||||
-rw-r--r-- | sys/arch/hppa64/hppa64/machdep.c | 4 | ||||
-rw-r--r-- | sys/arch/i386/i386/bus_dma.c | 4 | ||||
-rw-r--r-- | sys/arch/i386/i386/pmap.c | 12 | ||||
-rw-r--r-- | sys/arch/mac68k/mac68k/pmap_bootstrap.c | 6 | ||||
-rw-r--r-- | sys/arch/sh/sh/pmap.c | 6 | ||||
-rw-r--r-- | sys/arch/sparc64/sparc64/machdep.c | 4 | ||||
-rw-r--r-- | sys/arch/sparc64/sparc64/pmap.c | 18 | ||||
-rw-r--r-- | sys/arch/vax/vax/bus_dma.c | 4 | ||||
-rw-r--r-- | sys/arch/vax/vax/mem.c | 5 |
15 files changed, 23 insertions, 75 deletions
diff --git a/sys/arch/alpha/dev/bus_dma.c b/sys/arch/alpha/dev/bus_dma.c index a58a0f3a78e..c2bbcdd7526 100644 --- a/sys/arch/alpha/dev/bus_dma.c +++ b/sys/arch/alpha/dev/bus_dma.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bus_dma.c,v 1.28 2010/04/10 13:46:12 oga Exp $ */ +/* $OpenBSD: bus_dma.c,v 1.29 2010/11/20 20:33:21 miod Exp $ */ /* $NetBSD: bus_dma.c,v 1.40 2000/07/17 04:47:56 thorpej Exp $ */ /*- @@ -49,8 +49,6 @@ int _bus_dmamap_load_buffer_direct(bus_dma_tag_t, bus_dmamap_t, void *, bus_size_t, struct proc *, int, paddr_t *, int *, int); -extern paddr_t avail_start, avail_end; /* from pmap.c */ - /* * Common function for DMA map creation. May be called by bus-specific * DMA map creation functions. @@ -516,7 +514,7 @@ _bus_dmamem_alloc_range(t, size, alignment, boundary, segs, nsegs, rsegs, for (; m != TAILQ_END(&mlist); m = TAILQ_NEXT(m, pageq)) { curaddr = VM_PAGE_TO_PHYS(m); #ifdef DIAGNOSTIC - if (curaddr < avail_start || curaddr >= high) { + if (curaddr < low || curaddr >= high) { printf("uvm_pglistalloc returned non-sensical" " address 0x%lx\n", curaddr); panic("_bus_dmamem_alloc"); diff --git a/sys/arch/amd64/amd64/bus_dma.c b/sys/arch/amd64/amd64/bus_dma.c index b5475d6a55e..bfcd2685327 100644 --- a/sys/arch/amd64/amd64/bus_dma.c +++ b/sys/arch/amd64/amd64/bus_dma.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bus_dma.c,v 1.33 2010/09/06 19:05:48 kettenis Exp $ */ +/* $OpenBSD: bus_dma.c,v 1.34 2010/11/20 20:33:23 miod Exp $ */ /* $NetBSD: bus_dma.c,v 1.3 2003/05/07 21:33:58 fvdl Exp $ */ /*- @@ -109,8 +109,6 @@ #include <machine/mpbiosvar.h> #endif -extern paddr_t avail_end; - int _bus_dmamap_load_buffer(bus_dma_tag_t, bus_dmamap_t, void *, bus_size_t, struct proc *, int, paddr_t *, int *, int); diff --git a/sys/arch/amd64/amd64/machdep.c b/sys/arch/amd64/amd64/machdep.c index b5eaae0e9b7..f0870b235d7 100644 --- a/sys/arch/amd64/amd64/machdep.c +++ b/sys/arch/amd64/amd64/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.127 2010/11/13 04:16:42 guenther Exp $ */ +/* $OpenBSD: machdep.c,v 1.128 2010/11/20 20:33:23 miod Exp $ */ /* $NetBSD: machdep.c,v 1.3 2003/05/07 22:58:18 fvdl Exp $ */ /*- @@ -222,7 +222,8 @@ pid_t sigpid = 0; #define SDB_FOLLOW 0x01 #endif -extern paddr_t avail_start, avail_end; +paddr_t avail_start; +paddr_t avail_end; void (*delay_func)(int) = i8254_delay; void (*initclock_func)(void) = i8254_initclocks; diff --git a/sys/arch/amd64/amd64/pmap.c b/sys/arch/amd64/amd64/pmap.c index 8a754946bc3..b2a068d58ae 100644 --- a/sys/arch/amd64/amd64/pmap.c +++ b/sys/arch/amd64/amd64/pmap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap.c,v 1.58 2010/11/13 04:16:42 guenther Exp $ */ +/* $OpenBSD: pmap.c,v 1.59 2010/11/20 20:33:23 miod Exp $ */ /* $NetBSD: pmap.c,v 1.3 2003/05/08 18:13:13 thorpej Exp $ */ /* @@ -245,15 +245,6 @@ int pmap_pg_g = 0; int pmap_pg_wc = PG_UCMINUS; /* - * i386 physical memory comes in a big contig chunk with a small - * hole toward the front of it... the following 4 paddr_t's - * (shared with machdep.c) describe the physical address space - * of this machine. - */ -paddr_t avail_start; /* PA of first available physical page */ -paddr_t avail_end; /* PA of last available physical page */ - -/* * other data structures */ diff --git a/sys/arch/arm/arm/bus_dma.c b/sys/arch/arm/arm/bus_dma.c index f81bc6dd9ed..004350a9726 100644 --- a/sys/arch/arm/arm/bus_dma.c +++ b/sys/arch/arm/arm/bus_dma.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bus_dma.c,v 1.17 2010/03/31 19:46:26 miod Exp $ */ +/* $OpenBSD: bus_dma.c,v 1.18 2010/11/20 20:33:23 miod Exp $ */ /* $NetBSD: bus_dma.c,v 1.38 2003/10/30 08:44:13 scw Exp $ */ /*- @@ -605,9 +605,6 @@ _bus_dmamap_sync(bus_dma_tag_t t, bus_dmamap_t map, bus_addr_t offset, * by bus-specific DMA memory allocation functions. */ -extern paddr_t physical_start; -extern paddr_t physical_end; - int _bus_dmamem_alloc(bus_dma_tag_t t, bus_size_t size, bus_size_t alignment, bus_size_t boundary, bus_dma_segment_t *segs, int nsegs, int *rsegs, diff --git a/sys/arch/hppa/hppa/machdep.c b/sys/arch/hppa/hppa/machdep.c index cdb016784da..7ab48adb317 100644 --- a/sys/arch/hppa/hppa/machdep.c +++ b/sys/arch/hppa/hppa/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.193 2010/07/01 05:33:32 jsing Exp $ */ +/* $OpenBSD: machdep.c,v 1.194 2010/11/20 20:33:23 miod Exp $ */ /* * Copyright (c) 1999-2003 Michael Shalayeff @@ -143,7 +143,6 @@ int (*cpu_dbtlb_ins)(int i, pa_space_t sp, vaddr_t va, paddr_t pa, dev_t bootdev; int physmem, resvmem, resvphysmem, esym; -paddr_t avail_end; #ifdef MULTIPROCESSOR struct mutex mtx_atomic = MUTEX_INITIALIZER(IPL_NONE); @@ -295,6 +294,7 @@ hppa_init(start) extern int kernel_text; struct cpu_info *ci; int error; + paddr_t avail_end; pdc_init(); /* init PDC iface, so we can call em easy */ diff --git a/sys/arch/hppa64/hppa64/machdep.c b/sys/arch/hppa64/hppa64/machdep.c index 68e9788f868..b0d424d717d 100644 --- a/sys/arch/hppa64/hppa64/machdep.c +++ b/sys/arch/hppa64/hppa64/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.26 2010/07/24 21:27:57 kettenis Exp $ */ +/* $OpenBSD: machdep.c,v 1.27 2010/11/20 20:33:23 miod Exp $ */ /* * Copyright (c) 2005 Michael Shalayeff @@ -121,7 +121,6 @@ u_int fpu_version; dev_t bootdev; int physmem, resvmem, resvphysmem, esym; -paddr_t avail_end; /* * Things for MI glue to stick on. @@ -182,6 +181,7 @@ hppa_init(start) { extern int kernel_text; int error; + paddr_t avail_end; mtctl((long)&cpu0_info, 24); diff --git a/sys/arch/i386/i386/bus_dma.c b/sys/arch/i386/i386/bus_dma.c index 605d67d8bd8..01df80304f5 100644 --- a/sys/arch/i386/i386/bus_dma.c +++ b/sys/arch/i386/i386/bus_dma.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bus_dma.c,v 1.22 2010/09/06 19:05:48 kettenis Exp $ */ +/* $OpenBSD: bus_dma.c,v 1.23 2010/11/20 20:33:24 miod Exp $ */ /*- * Copyright (c) 1996, 1997 The NetBSD Foundation, Inc. * All rights reserved. @@ -78,8 +78,6 @@ #include <uvm/uvm_extern.h> -extern paddr_t avail_end; - int _bus_dmamap_load_buffer(bus_dma_tag_t, bus_dmamap_t, void *, bus_size_t, struct proc *, int, paddr_t *, int *, int); diff --git a/sys/arch/i386/i386/pmap.c b/sys/arch/i386/i386/pmap.c index 7895ffa2a57..20fe7e15915 100644 --- a/sys/arch/i386/i386/pmap.c +++ b/sys/arch/i386/i386/pmap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap.c,v 1.149 2010/11/20 20:21:13 miod Exp $ */ +/* $OpenBSD: pmap.c,v 1.150 2010/11/20 20:33:24 miod Exp $ */ /* $NetBSD: pmap.c,v 1.91 2000/06/02 17:46:37 thorpej Exp $ */ /* @@ -245,16 +245,6 @@ int pmap_pg_g = 0; int pmap_pg_wc = PG_UCMINUS; /* - * i386 physical memory comes in a big contig chunk with a small - * hole toward the front of it... the following 4 paddr_t's - * (shared with machdep.c) describe the physical address space - * of this machine. - */ -paddr_t avail_start; /* PA of first available physical page */ -paddr_t hole_start; /* PA of start of "hole" */ -paddr_t hole_end; /* PA of end of "hole" */ - -/* * other data structures */ diff --git a/sys/arch/mac68k/mac68k/pmap_bootstrap.c b/sys/arch/mac68k/mac68k/pmap_bootstrap.c index faf063c2474..a1b722f9e59 100644 --- a/sys/arch/mac68k/mac68k/pmap_bootstrap.c +++ b/sys/arch/mac68k/mac68k/pmap_bootstrap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap_bootstrap.c,v 1.42 2010/06/28 04:20:28 miod Exp $ */ +/* $OpenBSD: pmap_bootstrap.c,v 1.43 2010/11/20 20:33:24 miod Exp $ */ /* $NetBSD: pmap_bootstrap.c,v 1.50 1999/04/07 06:14:33 scottr Exp $ */ /* @@ -106,7 +106,6 @@ void bootstrap_mac68k(int); */ #define PMAP_MD_LOCALS \ paddr_t vidpa; \ - paddr_t avail_next; \ int i; \ \ vidlen = round_page(((videosize >> 16) & 0xffff) * videorowbytes + \ @@ -153,13 +152,12 @@ do { \ */ #define PMAP_MD_MEMSIZE() \ do { \ - avail_next = avail_start; \ physmem = 0; \ for (i = 0; i < numranges; i++) \ physmem += atop(high[i] - low[i]); \ + /* reserve one page for the message buffer */ \ maxaddr = high[numranges - 1] - PAGE_SIZE; \ high[numranges - 1] -= round_page(MSGBUFSIZE); \ - avail_end = high[numranges - 1]; \ } while (0) #define PMAP_MD_RELOC3() /* nothing */ diff --git a/sys/arch/sh/sh/pmap.c b/sys/arch/sh/sh/pmap.c index a32a73113de..9678826343b 100644 --- a/sys/arch/sh/sh/pmap.c +++ b/sys/arch/sh/sh/pmap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap.c,v 1.14 2010/04/21 03:03:26 deraadt Exp $ */ +/* $OpenBSD: pmap.c,v 1.15 2010/11/20 20:33:24 miod Exp $ */ /* $NetBSD: pmap.c,v 1.55 2006/08/07 23:19:36 tsutsui Exp $ */ /*- @@ -56,8 +56,6 @@ struct pmap __pmap_kernel; STATIC vaddr_t __pmap_kve; /* VA of last kernel virtual */ -paddr_t avail_start; /* PA of first available physical page */ -paddr_t avail_end; /* PA of last available physical page */ /* pmap pool */ STATIC struct pool __pmap_pmap_pool; @@ -101,8 +99,6 @@ pmap_bootstrap() /* Steal msgbuf area */ initmsgbuf((caddr_t)uvm_pageboot_alloc(MSGBUFSIZE), MSGBUFSIZE); - avail_start = ptoa(vm_physmem[0].start); - avail_end = ptoa(vm_physmem[vm_nphysseg - 1].end); __pmap_kve = VM_MIN_KERNEL_ADDRESS; pmap_kernel()->pm_refcnt = 1; diff --git a/sys/arch/sparc64/sparc64/machdep.c b/sys/arch/sparc64/sparc64/machdep.c index 0a0d305b8d8..96d03b8e255 100644 --- a/sys/arch/sparc64/sparc64/machdep.c +++ b/sys/arch/sparc64/sparc64/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.124 2010/06/27 03:03:48 thib Exp $ */ +/* $OpenBSD: machdep.c,v 1.125 2010/11/20 20:33:24 miod Exp $ */ /* $NetBSD: machdep.c,v 1.108 2001/07/24 19:30:14 eeh Exp $ */ /*- @@ -159,7 +159,6 @@ int _bus_dmamem_alloc_range(bus_dma_tag_t tag, bus_dma_tag_t, int bus_space_debug = 0; struct vm_map *exec_map = NULL; -extern vaddr_t avail_end; /* * Declare these as initialized data so we can patch them. @@ -1373,7 +1372,6 @@ _bus_dmamap_sync(t, t0, map, offset, len, ops) membar(MemIssue); } -extern paddr_t vm_first_phys, vm_num_phys; /* * Common function for DMA-safe memory allocation. May be called * by bus-specific DMA memory allocation functions. diff --git a/sys/arch/sparc64/sparc64/pmap.c b/sys/arch/sparc64/sparc64/pmap.c index 141449e0937..4aefe5525fe 100644 --- a/sys/arch/sparc64/sparc64/pmap.c +++ b/sys/arch/sparc64/sparc64/pmap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap.c,v 1.70 2010/04/20 23:27:00 deraadt Exp $ */ +/* $OpenBSD: pmap.c,v 1.71 2010/11/20 20:33:24 miod Exp $ */ /* $NetBSD: pmap.c,v 1.107 2001/08/31 16:47:41 eeh Exp $ */ #undef NO_VCACHE /* Don't forget the locked TLB in dostart */ /* @@ -206,11 +206,6 @@ void pmap_pinit(struct pmap *); void pmap_release(struct pmap *); pv_entry_t pa_to_pvh(paddr_t); -/* - * First and last managed physical addresses. XXX only used for dumping the system. - */ -paddr_t vm_first_phys, vm_num_phys; - u_int64_t first_phys_addr; pv_entry_t @@ -297,8 +292,6 @@ int memsize; static int memh = 0, vmemh = 0; /* Handles to OBP devices */ -paddr_t avail_start, avail_end; - static int ptelookup_va(vaddr_t va); /* sun4u */ static __inline void @@ -1454,12 +1447,6 @@ remap_data: } vmmap = (vaddr_t)reserve_dumppages((caddr_t)(u_long)vmmap); - /* - * Set up bounds of allocatable memory for vmstat et al. - */ - avail_start = avail->start; - for (mp = avail; mp->size; mp++) - avail_end = mp->start+mp->size; BDPRINTF(PDB_BOOT1, ("Finished pmap_bootstrap()\r\n")); pmap_bootstrap_cpu(cpus->ci_paddr); @@ -1593,9 +1580,6 @@ pmap_init() pool_init(&pv_pool, sizeof(struct pv_entry), 0, 0, 0, "pv_entry", NULL); pool_init(&pmap_pool, sizeof(struct pmap), 0, 0, 0, "pmappl", &pool_allocator_nointr); - - vm_first_phys = avail_start; - vm_num_phys = avail_end - avail_start; } /* Start of non-cachable physical memory on UltraSPARC-III. */ diff --git a/sys/arch/vax/vax/bus_dma.c b/sys/arch/vax/vax/bus_dma.c index ff904c3e2a8..b5984fe383d 100644 --- a/sys/arch/vax/vax/bus_dma.c +++ b/sys/arch/vax/vax/bus_dma.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bus_dma.c,v 1.24 2010/03/29 19:21:58 oga Exp $ */ +/* $OpenBSD: bus_dma.c,v 1.25 2010/11/20 20:33:24 miod Exp $ */ /* $NetBSD: bus_dma.c,v 1.5 1999/11/13 00:32:20 thorpej Exp $ */ /*- @@ -56,7 +56,7 @@ #include <machine/ka43.h> #include <machine/sid.h> -extern vaddr_t avail_start, avail_end, virtual_avail; +extern vaddr_t virtual_avail; int _bus_dmamap_load_buffer(bus_dma_tag_t, bus_dmamap_t, void *, bus_size_t, struct proc *, int, paddr_t *, int *, int); diff --git a/sys/arch/vax/vax/mem.c b/sys/arch/vax/vax/mem.c index 036fae831d6..858182c57ea 100644 --- a/sys/arch/vax/vax/mem.c +++ b/sys/arch/vax/vax/mem.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mem.c,v 1.15 2007/09/22 16:21:32 krw Exp $ */ +/* $OpenBSD: mem.c,v 1.16 2010/11/20 20:33:24 miod Exp $ */ /* $NetBSD: mem.c,v 1.15 1999/03/24 05:51:17 mrg Exp $ */ /* @@ -54,7 +54,6 @@ #include <uvm/uvm_extern.h> -extern unsigned int avail_end; caddr_t zeropage; #define mmread mmrw @@ -117,7 +116,7 @@ mmrw(dev, uio, flags) /* minor device 0 is physical memory */ case 0: v = uio->uio_offset; - if (v < 0 || v >= avail_end) { + if (v < 0 || v >= ptoa(physmem)) { return (EFAULT); } |