summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2012-03-15 18:57:23 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2012-03-15 18:57:23 +0000
commiteedcbe070ed694448d085ab2751855e6373dc882 (patch)
tree4e6c13f7bd721fdf6c8b8858a43ab963d8424c0b /sys
parent582f87978beb9c9f7445650954ace087e85f9398 (diff)
uncached_base was introduced early in IP27 support, since these designs use
subspaces in the CCA_NC uncached memory space. However, being coherent, there was never a need for bus_dma to use uncached addresses. This means that, on the only systems where uncached_base was not set to PHYS_TO_XKPHYS(0, CCA_NC), it was never used. Remove the variable, and replace PHYS_TO_UNCACHED() with PHYS_TO_XKPHYS(, CCA_NC). No functional change.
Diffstat (limited to 'sys')
-rw-r--r--sys/arch/loongson/loongson/bus_dma.c4
-rw-r--r--sys/arch/loongson/loongson/machdep.c5
-rw-r--r--sys/arch/mips64/include/cpu.h5
-rw-r--r--sys/arch/octeon/octeon/bus_dma.c4
-rw-r--r--sys/arch/octeon/octeon/machdep.c5
-rw-r--r--sys/arch/sgi/dev/gbe.c18
-rw-r--r--sys/arch/sgi/sgi/bus_dma.c13
-rw-r--r--sys/arch/sgi/sgi/ip27_machdep.c3
-rw-r--r--sys/arch/sgi/sgi/ip30_machdep.c12
-rw-r--r--sys/arch/sgi/sgi/ip32_machdep.c4
-rw-r--r--sys/arch/sgi/sgi/machdep.c3
11 files changed, 28 insertions, 48 deletions
diff --git a/sys/arch/loongson/loongson/bus_dma.c b/sys/arch/loongson/loongson/bus_dma.c
index 6f71881a9e5..912acb0b585 100644
--- a/sys/arch/loongson/loongson/bus_dma.c
+++ b/sys/arch/loongson/loongson/bus_dma.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bus_dma.c,v 1.7 2011/06/23 20:44:39 ariane Exp $ */
+/* $OpenBSD: bus_dma.c,v 1.8 2012/03/15 18:57:20 miod Exp $ */
/*
* Copyright (c) 2003-2004 Opsycon AB (www.opsycon.se / www.opsycon.com)
@@ -440,7 +440,7 @@ _dmamem_map(bus_dma_tag_t t, bus_dma_segment_t *segs, int nsegs, size_t size,
if (nsegs == 1) {
pa = (*t->_device_to_pa)(segs[0].ds_addr);
if (flags & BUS_DMA_COHERENT)
- *kvap = (caddr_t)PHYS_TO_UNCACHED(pa);
+ *kvap = (caddr_t)PHYS_TO_XKPHYS(pa, CCA_NC);
else
*kvap = (caddr_t)PHYS_TO_XKPHYS(pa, CCA_CACHED);
return (0);
diff --git a/sys/arch/loongson/loongson/machdep.c b/sys/arch/loongson/loongson/machdep.c
index 8b631db101b..6b822bf40f2 100644
--- a/sys/arch/loongson/loongson/machdep.c
+++ b/sys/arch/loongson/loongson/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.33 2011/07/21 20:36:12 miod Exp $ */
+/* $OpenBSD: machdep.c,v 1.34 2012/03/15 18:57:20 miod Exp $ */
/*
* Copyright (c) 2009, 2010 Miodrag Vallat.
@@ -105,7 +105,6 @@ vm_map_t phys_map;
int safepri = 0;
caddr_t msgbufbase;
-vaddr_t uncached_base;
int physmem; /* Max supported memory, changes to actual. */
int ncpu = 1; /* At least one CPU in the system. */
@@ -461,8 +460,6 @@ mips_init(int32_t argc, int32_t argv, int32_t envp, int32_t cv,
} else
memhi = 0;
- uncached_base = PHYS_TO_XKPHYS(0, CCA_NC);
-
switch (loongson_ver) {
case 0x2e:
loongson2e_setup(memlo, memhi);
diff --git a/sys/arch/mips64/include/cpu.h b/sys/arch/mips64/include/cpu.h
index 548434d5e07..26da2d06345 100644
--- a/sys/arch/mips64/include/cpu.h
+++ b/sys/arch/mips64/include/cpu.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: cpu.h,v 1.72 2011/06/24 19:47:48 naddy Exp $ */
+/* $OpenBSD: cpu.h,v 1.73 2012/03/15 18:57:22 miod Exp $ */
/*-
* Copyright (c) 1992, 1993
@@ -100,8 +100,6 @@
#define SP_SPECIAL 2UL /* Memory Special space */
#define SP_NC 3UL /* Memory Uncached space */
-extern vaddr_t uncached_base;
-
#define XKSSSEG_BASE 0x4000000000000000UL
#define XKPHYS_BASE 0x8000000000000000UL
#define XKSSEG_BASE 0xc000000000000000UL
@@ -110,7 +108,6 @@ extern vaddr_t uncached_base;
#define PHYS_TO_XKPHYS(x,c) ((paddr_t)(x) | XKPHYS_BASE | ((c) << 59))
#define PHYS_TO_XKPHYS_UNCACHED(x,s) \
(PHYS_TO_XKPHYS(x, CCA_NC) | ((s) << 57))
-#define PHYS_TO_UNCACHED(x) ((paddr_t)(x) | uncached_base)
#define IS_XKPHYS(va) (((va) >> 62) == 2)
#define XKPHYS_TO_CCA(x) (((x) >> 59) & 0x07)
#define XKPHYS_TO_SP(x) (((x) >> 57) & 0x03)
diff --git a/sys/arch/octeon/octeon/bus_dma.c b/sys/arch/octeon/octeon/bus_dma.c
index fb1be02b36f..c5b29beaef2 100644
--- a/sys/arch/octeon/octeon/bus_dma.c
+++ b/sys/arch/octeon/octeon/bus_dma.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bus_dma.c,v 1.3 2011/06/23 20:44:39 ariane Exp $ */
+/* $OpenBSD: bus_dma.c,v 1.4 2012/03/15 18:57:22 miod Exp $ */
/*
* Copyright (c) 2003-2004 Opsycon AB (www.opsycon.se / www.opsycon.com)
@@ -445,7 +445,7 @@ _dmamem_map(bus_dma_tag_t t, bus_dma_segment_t *segs, int nsegs, size_t size,
if (nsegs == 1) {
pa = (*t->_device_to_pa)(segs[0].ds_addr);
if (flags & BUS_DMA_COHERENT)
- *kvap = (caddr_t)PHYS_TO_UNCACHED(pa);
+ *kvap = (caddr_t)PHYS_TO_XKPHYS(pa, CCA_NC);
else
*kvap = (caddr_t)PHYS_TO_XKPHYS(pa, CCA_CACHED);
return (0);
diff --git a/sys/arch/octeon/octeon/machdep.c b/sys/arch/octeon/octeon/machdep.c
index 3b4441a959a..1c5ab1f26db 100644
--- a/sys/arch/octeon/octeon/machdep.c
+++ b/sys/arch/octeon/octeon/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.15 2011/06/26 22:40:00 deraadt Exp $ */
+/* $OpenBSD: machdep.c,v 1.16 2012/03/15 18:57:22 miod Exp $ */
/*
* Copyright (c) 2009, 2010 Miodrag Vallat.
@@ -172,7 +172,6 @@ vm_map_t phys_map;
int safepri = 0;
caddr_t msgbufbase;
-vaddr_t uncached_base;
int physmem; /* Max supported memory, changes to actual. */
int ncpu = 1; /* At least one CPU in the system. */
@@ -372,8 +371,6 @@ mips_init(__register_t a0, __register_t a1, __register_t a2 __unused,
*/
boothowto = RB_AUTOBOOT;
- uncached_base = PHYS_TO_XKPHYS(0, CCA_NC);
-
octeon_memory_init(boot_info);
/*
diff --git a/sys/arch/sgi/dev/gbe.c b/sys/arch/sgi/dev/gbe.c
index f4ab42da94b..ba51267e4c0 100644
--- a/sys/arch/sgi/dev/gbe.c
+++ b/sys/arch/sgi/dev/gbe.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: gbe.c,v 1.13 2010/12/26 15:41:00 miod Exp $ */
+/* $OpenBSD: gbe.c,v 1.14 2012/03/15 18:57:22 miod Exp $ */
/*
* Copyright (c) 2007, 2008, 2009 Joel Sing <jsing@openbsd.org>
@@ -225,8 +225,8 @@ gbe_attach(struct device *parent, struct device *self, void *aux)
* We've already been setup via gbe_cnattach().
*/
- gsc->ioh = PHYS_TO_UNCACHED(GBE_BASE);
- gsc->re_ioh = PHYS_TO_UNCACHED(RE_BASE);
+ gsc->ioh = PHYS_TO_XKPHYS(GBE_BASE, CCA_NC);
+ gsc->re_ioh = PHYS_TO_XKPHYS(RE_BASE, CCA_NC);
gsc->rev = bus_space_read_4(gsc->iot, gsc->ioh, GBE_CTRL_STAT)
& 0xf;
@@ -1275,7 +1275,7 @@ gbe_cnprobe(bus_space_tag_t iot, bus_addr_t addr)
int val, width, height;
/* Setup bus space mapping. */
- ioh = PHYS_TO_UNCACHED(addr);
+ ioh = PHYS_TO_XKPHYS(addr, CCA_NC);
/* Determine resolution configured by firmware. */
val = bus_space_read_4(iot, ioh, GBE_VT_HCMAP);
@@ -1309,8 +1309,8 @@ gbe_cnattach(bus_space_tag_t iot, bus_addr_t addr)
/* Setup bus space mapping. */
gsc->iot = iot;
- gsc->ioh = PHYS_TO_UNCACHED(addr);
- gsc->re_ioh = PHYS_TO_UNCACHED(RE_BASE);
+ gsc->ioh = PHYS_TO_XKPHYS(addr, CCA_NC);
+ gsc->re_ioh = PHYS_TO_XKPHYS(RE_BASE, CCA_NC);
/* Determine GBE revision. */
gsc->rev = bus_space_read_4(gsc->iot, gsc->ioh, GBE_CTRL_STAT) & 0xf;
@@ -1337,7 +1337,7 @@ gbe_cnattach(bus_space_tag_t iot, bus_addr_t addr)
va = pmap_steal_memory(gbe_consdata.tm_size + 65536, NULL, NULL);
pmap_extract(pmap_kernel(), va, &pa);
gbe_consdata.tm_phys = ((pa >> 16) + 1) << 16;
- gbe_consdata.tm = (caddr_t)PHYS_TO_UNCACHED(gbe_consdata.tm_phys);
+ gbe_consdata.tm = (caddr_t)PHYS_TO_XKPHYS(gbe_consdata.tm_phys, CCA_NC);
/*
* Steal memory for framebuffer - 64KB aligned and coherent.
@@ -1345,7 +1345,7 @@ gbe_cnattach(bus_space_tag_t iot, bus_addr_t addr)
va = pmap_steal_memory(gbe_consdata.fb_size + 65536, NULL, NULL);
pmap_extract(pmap_kernel(), va, &pa);
gbe_consdata.fb_phys = ((pa >> 16) + 1) << 16;
- gbe_consdata.fb = (caddr_t)PHYS_TO_UNCACHED(gbe_consdata.fb_phys);
+ gbe_consdata.fb = (caddr_t)PHYS_TO_XKPHYS(gbe_consdata.fb_phys, CCA_NC);
/*
* Steal memory for rasops tile - 64KB aligned and coherent.
@@ -1353,7 +1353,7 @@ gbe_cnattach(bus_space_tag_t iot, bus_addr_t addr)
va = pmap_steal_memory(GBE_TILE_SIZE + 65536, NULL, NULL);
pmap_extract(pmap_kernel(), va, &pa);
gbe_consdata.ro_phys = ((pa >> 16) + 1) << 16;
- gbe_consdata.ro = (caddr_t)PHYS_TO_UNCACHED(gbe_consdata.ro_phys);
+ gbe_consdata.ro = (caddr_t)PHYS_TO_XKPHYS(gbe_consdata.ro_phys, CCA_NC);
/*
* Setup GBE hardware.
diff --git a/sys/arch/sgi/sgi/bus_dma.c b/sys/arch/sgi/sgi/bus_dma.c
index 35d877dcf47..520b9a3139f 100644
--- a/sys/arch/sgi/sgi/bus_dma.c
+++ b/sys/arch/sgi/sgi/bus_dma.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bus_dma.c,v 1.22 2011/06/23 20:44:39 ariane Exp $ */
+/* $OpenBSD: bus_dma.c,v 1.23 2012/03/15 18:57:22 miod Exp $ */
/*
* Copyright (c) 2003-2004 Opsycon AB (www.opsycon.se / www.opsycon.com)
@@ -437,16 +437,13 @@ _dmamem_map(bus_dma_tag_t t, bus_dma_segment_t *segs, int nsegs, size_t size,
bus_addr_t addr;
int curseg, error;
-#ifdef TGT_COHERENT
- if (ISSET(flags, BUS_DMA_COHERENT))
- CLR(flags, BUS_DMA_COHERENT);
-#endif
-
if (nsegs == 1) {
pa = (*t->_device_to_pa)(segs[0].ds_addr);
+#ifndef TGT_COHERENT
if (flags & BUS_DMA_COHERENT)
- *kvap = (caddr_t)PHYS_TO_UNCACHED(pa);
+ *kvap = (caddr_t)PHYS_TO_XKPHYS(pa, CCA_NC);
else
+#endif
*kvap = (caddr_t)PHYS_TO_XKPHYS(pa, CCA_CACHED);
return (0);
}
@@ -476,9 +473,11 @@ _dmamem_map(bus_dma_tag_t t, bus_dma_segment_t *segs, int nsegs, size_t size,
return (error);
}
+#ifndef TGT_COHERENT
if (flags & BUS_DMA_COHERENT)
pmap_page_cache(PHYS_TO_VM_PAGE(pa),
PV_UNCACHED);
+#endif
}
pmap_update(pmap_kernel());
}
diff --git a/sys/arch/sgi/sgi/ip27_machdep.c b/sys/arch/sgi/sgi/ip27_machdep.c
index 53f86514aec..ec256704296 100644
--- a/sys/arch/sgi/sgi/ip27_machdep.c
+++ b/sys/arch/sgi/sgi/ip27_machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip27_machdep.c,v 1.53 2011/04/05 14:43:10 miod Exp $ */
+/* $OpenBSD: ip27_machdep.c,v 1.54 2012/03/15 18:57:22 miod Exp $ */
/*
* Copyright (c) 2008, 2009 Miodrag Vallat.
@@ -119,7 +119,6 @@ ip27_setup()
nmi_t *nmi;
static char unknown_model[20];
- uncached_base = PHYS_TO_XKPHYS_UNCACHED(0, SP_NC);
io_base = PHYS_TO_XKPHYS_UNCACHED(0, SP_IO);
ip35 = sys_config.system_type == SGI_IP35;
diff --git a/sys/arch/sgi/sgi/ip30_machdep.c b/sys/arch/sgi/sgi/ip30_machdep.c
index 76ef31c4d62..f3b9ced3547 100644
--- a/sys/arch/sgi/sgi/ip30_machdep.c
+++ b/sys/arch/sgi/sgi/ip30_machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip30_machdep.c,v 1.47 2011/05/30 22:25:22 oga Exp $ */
+/* $OpenBSD: ip30_machdep.c,v 1.48 2012/03/15 18:57:22 miod Exp $ */
/*
* Copyright (c) 2008, 2009 Miodrag Vallat.
@@ -97,12 +97,6 @@ ip30_setup()
#endif
/*
- * Although being r10k/r12k based, the uncached spaces are
- * apparently not used in this design.
- */
- uncached_base = PHYS_TO_XKPHYS(0, CCA_NC);
-
- /*
* Scan for memory. ARCBios reports up to 1GB of memory as available,
* and anything after is reported as reserved.
*/
@@ -258,13 +252,13 @@ ip30_autoconf(struct device *parent)
paddr_t
ip30_widget_short(int16_t nasid, u_int widget)
{
- return ((uint64_t)(widget) << 24) | (1ULL << 28) | uncached_base;
+ return PHYS_TO_XKPHYS((uint64_t)(widget) << 24) | (1ULL << 28), CCA_NC);
}
paddr_t
ip30_widget_long(int16_t nasid, u_int widget)
{
- return ((uint64_t)(widget) << 36) | uncached_base;
+ return PHYS_TO_XKPHYS((uint64_t)(widget) << 36, CCA_NC);
}
paddr_t
diff --git a/sys/arch/sgi/sgi/ip32_machdep.c b/sys/arch/sgi/sgi/ip32_machdep.c
index 927b9020897..e3760cbd031 100644
--- a/sys/arch/sgi/sgi/ip32_machdep.c
+++ b/sys/arch/sgi/sgi/ip32_machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip32_machdep.c,v 1.16 2011/05/30 22:25:22 oga Exp $ */
+/* $OpenBSD: ip32_machdep.c,v 1.17 2012/03/15 18:57:22 miod Exp $ */
/*
* Copyright (c) 2003-2004 Opsycon AB (www.opsycon.se / www.opsycon.com)
@@ -115,8 +115,6 @@ ip32_setup()
{
u_long cpuspeed;
- uncached_base = PHYS_TO_XKPHYS(0, CCA_NC);
-
crime_configure_memory();
/* R12K O2s must run with DSD on. */
diff --git a/sys/arch/sgi/sgi/machdep.c b/sys/arch/sgi/sgi/machdep.c
index eb6f75a5c4e..4b511712f04 100644
--- a/sys/arch/sgi/sgi/machdep.c
+++ b/sys/arch/sgi/sgi/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.112 2011/06/26 22:40:00 deraadt Exp $ */
+/* $OpenBSD: machdep.c,v 1.113 2012/03/15 18:57:22 miod Exp $ */
/*
* Copyright (c) 2003-2004 Opsycon AB (www.opsycon.se / www.opsycon.com)
@@ -100,7 +100,6 @@ vm_map_t phys_map;
int safepri = 0;
caddr_t msgbufbase;
-vaddr_t uncached_base;
int physmem; /* Max supported memory, changes to actual. */
int rsvdmem; /* Reserved memory not usable. */