summaryrefslogtreecommitdiff
path: root/sys/arch
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2006-01-04 20:23:12 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2006-01-04 20:23:12 +0000
commit45917bfa2091918b20278d0595a37c48b7e5f1d0 (patch)
tree58aac1620f3413c26aea0bf7a2439e6116d89adb /sys/arch
parente7f53c53a8eac503ffbe310baba08ebea91948c4 (diff)
Stop abusing phys_map to know if it is safe to use malloc in extent routines;
instead use a global flag, like some other architectures do. No functional change.
Diffstat (limited to 'sys/arch')
-rw-r--r--sys/arch/sgi/localbus/macebus.c22
-rw-r--r--sys/arch/sgi/pci/macepcibridge.c20
-rw-r--r--sys/arch/sgi/sgi/machdep.c8
3 files changed, 25 insertions, 25 deletions
diff --git a/sys/arch/sgi/localbus/macebus.c b/sys/arch/sgi/localbus/macebus.c
index ac6ebc49fd0..e6e56fd2d46 100644
--- a/sys/arch/sgi/localbus/macebus.c
+++ b/sys/arch/sgi/localbus/macebus.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: macebus.c,v 1.17 2006/01/04 20:20:16 miod Exp $ */
+/* $OpenBSD: macebus.c,v 1.18 2006/01/04 20:23:07 miod Exp $ */
/*
* Copyright (c) 2000-2004 Opsycon AB (www.opsycon.se)
@@ -352,6 +352,8 @@ mace_write_8(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o, u_int64_t v)
#endif
}
+extern int extent_malloc_flags;
+
int
mace_space_map(bus_space_tag_t t, bus_addr_t offs, bus_size_t size,
int cacheable, bus_space_handle_t *bshp)
@@ -369,13 +371,13 @@ mace_space_map(bus_space_tag_t t, bus_addr_t offs, bus_size_t size,
}
if ((error = extent_alloc_region(t->bus_extent, bpa, size,
- EX_NOWAIT | EX_MALLOCOK))) {
+ EX_NOWAIT | extent_malloc_flags))) {
return error;
}
- if ((error = bus_mem_add_mapping(bpa, size, cacheable, bshp))) {
- if (extent_free(t->bus_extent, bpa, size, EX_NOWAIT |
- ((phys_map != NULL) ? EX_MALLOCOK : 0))) {
+ if ((error = bus_mem_add_mapping(bpa, size, cacheable, bshp))) {
+ if (extent_free(t->bus_extent, bpa, size,
+ EX_NOWAIT | extent_malloc_flags)) {
printf("bus_space_map: pa %p, size %p\n", bpa, size);
printf("bus_space_map: can't free region\n");
}
@@ -405,14 +407,10 @@ mace_space_unmap(bus_space_tag_t t, bus_space_handle_t bsh, bus_size_t size)
return;
}
- if (phys_map != NULL &&
- ((sva >= VM_MIN_KERNEL_ADDRESS) && (sva < VM_MAX_KERNEL_ADDRESS))) {
- /* do not free memory which was stolen from the vm system */
- uvm_km_free(kernel_map, sva, len);
- }
+ uvm_km_free(kernel_map, sva, len);
- if (extent_free(t->bus_extent, paddr, size, EX_NOWAIT |
- ((phys_map != NULL) ? EX_MALLOCOK : 0))) {
+ if (extent_free(t->bus_extent, paddr, size,
+ EX_NOWAIT | extent_malloc_flags)) {
printf("bus_space_map: pa %p, size %p\n", paddr, size);
printf("bus_space_map: can't free region\n");
}
diff --git a/sys/arch/sgi/pci/macepcibridge.c b/sys/arch/sgi/pci/macepcibridge.c
index 3a946cca843..90b6646b683 100644
--- a/sys/arch/sgi/pci/macepcibridge.c
+++ b/sys/arch/sgi/pci/macepcibridge.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: macepcibridge.c,v 1.8 2006/01/04 20:20:18 miod Exp $ */
+/* $OpenBSD: macepcibridge.c,v 1.9 2006/01/04 20:23:09 miod Exp $ */
/*
* Copyright (c) 2001-2004 Opsycon AB (www.opsycon.se)
@@ -504,6 +504,8 @@ mace_pcib_write_8(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o, u_int64
*(volatile u_int64_t *)(h + o) = v;
}
+extern int extent_malloc_flags;
+
int
mace_pcib_space_map(bus_space_tag_t t, bus_addr_t offs, bus_size_t size,
int cacheable, bus_space_handle_t *bshp)
@@ -513,13 +515,13 @@ mace_pcib_space_map(bus_space_tag_t t, bus_addr_t offs, bus_size_t size,
bpa = t->bus_base + (offs & 0x01ffffff);
if ((error = extent_alloc_region(t->bus_extent, bpa, size,
- EX_NOWAIT | EX_MALLOCOK))) {
+ EX_NOWAIT | extent_malloc_flags))) {
return error;
}
if ((error = bus_mem_add_mapping(bpa, size, cacheable, bshp))) {
- if (extent_free(t->bus_extent, bpa, size, EX_NOWAIT |
- ((phys_map != NULL) ? EX_MALLOCOK : 0))) {
+ if (extent_free(t->bus_extent, bpa, size,
+ EX_NOWAIT | extent_malloc_flags)) {
printf("bus_space_map: pa %p, size %p\n", bpa, size);
printf("bus_space_map: can't free region\n");
}
@@ -545,14 +547,8 @@ mace_pcib_space_unmap(bus_space_tag_t t, bus_space_handle_t bsh, bus_size_t size
return;
}
- if (phys_map != NULL &&
- ((sva >= VM_MIN_KERNEL_ADDRESS) && (sva < VM_MAX_KERNEL_ADDRESS))) {
- /* do not free memory which was stolen from the vm system */
- uvm_km_free(kernel_map, sva, len);
- }
-
- if (extent_free(t->bus_extent, paddr, size, EX_NOWAIT |
- ((phys_map != NULL) ? EX_MALLOCOK : 0))) {
+ if (extent_free(t->bus_extent, paddr, size,
+ EX_NOWAIT | extent_malloc_flags)) {
printf("bus_space_map: pa %p, size %p\n", paddr, size);
printf("bus_space_map: can't free region\n");
}
diff --git a/sys/arch/sgi/sgi/machdep.c b/sys/arch/sgi/sgi/machdep.c
index 0ffbac0fe84..d7629df5135 100644
--- a/sys/arch/sgi/sgi/machdep.c
+++ b/sys/arch/sgi/sgi/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.27 2006/01/04 20:17:12 miod Exp $ */
+/* $OpenBSD: machdep.c,v 1.28 2006/01/04 20:23:11 miod Exp $ */
/*
* Copyright (c) 2003-2004 Opsycon AB (www.opsycon.se / www.opsycon.com)
@@ -45,6 +45,7 @@
#include <sys/mount.h>
#include <sys/syscallargs.h>
#include <sys/exec_elf.h>
+#include <sys/extent.h>
#ifdef SYSVSHM
#include <sys/shm.h>
#endif
@@ -123,6 +124,8 @@ int bufcachepercent = BUFCACHEPERCENT;
vm_map_t exec_map;
vm_map_t phys_map;
+int extent_malloc_flags = 0;
+
caddr_t msgbufbase;
int physmem; /* max supported memory, changes to actual */
@@ -722,6 +725,9 @@ cpu_startup()
printf("avail mem = %d\n", ptoa(uvmexp.free));
printf("using %d buffers containing %d bytes of memory\n",
nbuf, bufpages * PAGE_SIZE);
+
+ extent_malloc_flags = EX_MALLOCOK;
+
/*
* Set up CPU-specific registers, cache, etc.
*/