summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2012-04-03 21:17:36 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2012-04-03 21:17:36 +0000
commit62772d3601f4733fab64f366ba53c585f7545f6b (patch)
treec1e708642bc22a9e10340b978cd4f84a0e8ea7e1
parent8834d9efc6815f5a1cb94086c8ee7d869ee6f698 (diff)
Default DMA-reachable address constraints to the whole address space, and
narrow these in the various ipXX_machdep.c. On IP22-like systems, narrow them to 28 bit physical addresses, but unpessimize this by extending this to 32 bit after autoconf, if no 28-bit limited hpc(4) device has been found. Since physical memory on these systems start at 128MB, this means that Indigo systems with more than 128MB memory will behave correctly (and so will Indy systems with E++ boards and more than 128MB memory).
-rw-r--r--share/man/man4/man4.sgi/hpc.412
-rw-r--r--sys/arch/sgi/hpc/hpc.c5
-rw-r--r--sys/arch/sgi/include/autoconf.h3
-rw-r--r--sys/arch/sgi/sgi/ip22.h4
-rw-r--r--sys/arch/sgi/sgi/ip22_machdep.c40
-rw-r--r--sys/arch/sgi/sgi/ip27_machdep.c12
-rw-r--r--sys/arch/sgi/sgi/ip30_machdep.c11
-rw-r--r--sys/arch/sgi/sgi/machdep.c6
-rw-r--r--sys/arch/sgi/sgi/mainbus.c5
9 files changed, 76 insertions, 22 deletions
diff --git a/share/man/man4/man4.sgi/hpc.4 b/share/man/man4/man4.sgi/hpc.4
index ad259a038ed..d31d90c4abe 100644
--- a/share/man/man4/man4.sgi/hpc.4
+++ b/share/man/man4/man4.sgi/hpc.4
@@ -1,4 +1,4 @@
-.\" $OpenBSD: hpc.4,v 1.5 2012/03/29 08:47:35 jmc Exp $
+.\" $OpenBSD: hpc.4,v 1.6 2012/04/03 21:17:34 miod Exp $
.\" $NetBSD: hpc.4,v 1.12 2008/04/30 13:10:56 martin Exp $
.\"
.\" Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -28,7 +28,7 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
-.Dd $Mdocdate: March 29 2012 $
+.Dd $Mdocdate: April 3 2012 $
.Dt HPC 4 sgi
.Os
.Sh NAME
@@ -81,11 +81,3 @@ Zilog 8530 (ZSCC) Serial Communications Controller
.Xr gio 4 ,
.Xr imc 4 ,
.Xr intro 4
-.Sh BUGS
-.Nm
-revisions 1 and 1.5 support DMA buffer pointers of only 28 bits
-and may therefore only address 256 megabytes of memory.
-The R4k Indigo and Indy are the only systems that support sufficient
-memory to illustrate this drawback.
-A software workaround is not currently implemented.
-Revision 3, with 32-bit pointers, does not have this limitation.
diff --git a/sys/arch/sgi/hpc/hpc.c b/sys/arch/sgi/hpc/hpc.c
index ca2c31c06ed..9656b8672a4 100644
--- a/sys/arch/sgi/hpc/hpc.c
+++ b/sys/arch/sgi/hpc/hpc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: hpc.c,v 1.1 2012/03/28 20:44:23 miod Exp $ */
+/* $OpenBSD: hpc.c,v 1.2 2012/04/03 21:17:35 miod Exp $ */
/* $NetBSD: hpc.c,v 1.66 2011/07/01 18:53:46 dyoung Exp $ */
/* $NetBSD: ioc.c,v 1.9 2011/07/01 18:53:47 dyoung Exp $ */
@@ -486,6 +486,9 @@ hpc_attach(struct device *parent, struct device *self, void *aux)
return;
}
+ if (hpctype != 3)
+ hpc_old = 1;
+
/* force big-endian mode */
if (hpctype == 15)
bus_space_write_4(sc->sc_ct, sc->sc_ch, HPC1_BIGENDIAN, 0);
diff --git a/sys/arch/sgi/include/autoconf.h b/sys/arch/sgi/include/autoconf.h
index d3db14d94e5..f6317ad7c9b 100644
--- a/sys/arch/sgi/include/autoconf.h
+++ b/sys/arch/sgi/include/autoconf.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: autoconf.h,v 1.33 2012/03/28 20:44:23 miod Exp $ */
+/* $OpenBSD: autoconf.h,v 1.34 2012/04/03 21:17:35 miod Exp $ */
/*
* Copyright (c) 2001-2003 Opsycon AB (www.opsycon.se / www.opsycon.com)
@@ -94,6 +94,7 @@ void dksc_device_register(struct device *, void *);
extern void (*_device_register)(struct device *, void *);
void ip22_setup(void);
+void ip22_post_autoconf(void);
void ip27_setup(void);
void ip27_autoconf(struct device *);
void ip30_setup(void);
diff --git a/sys/arch/sgi/sgi/ip22.h b/sys/arch/sgi/sgi/ip22.h
index 9fd00054f77..c85023486fb 100644
--- a/sys/arch/sgi/sgi/ip22.h
+++ b/sys/arch/sgi/sgi/ip22.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip22.h,v 1.1 2012/03/28 20:44:23 miod Exp $ */
+/* $OpenBSD: ip22.h,v 1.2 2012/04/03 21:17:35 miod Exp $ */
/*
* Copyright (c) 2012 Miodrag Vallat.
@@ -30,3 +30,5 @@
#define INTPRI_BUSERR (INTPRI_CLOCK + 1)
#define INTPRI_L1 (INTPRI_BUSERR + 1)
#define INTPRI_L0 (INTPRI_L1 + 1)
+
+extern int hpc_old; /* nonzero if at least one HPC 1.x device found */
diff --git a/sys/arch/sgi/sgi/ip22_machdep.c b/sys/arch/sgi/sgi/ip22_machdep.c
index dbe7ccbd330..4f187362c3c 100644
--- a/sys/arch/sgi/sgi/ip22_machdep.c
+++ b/sys/arch/sgi/sgi/ip22_machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip22_machdep.c,v 1.1 2012/03/28 20:44:23 miod Exp $ */
+/* $OpenBSD: ip22_machdep.c,v 1.2 2012/04/03 21:17:35 miod Exp $ */
/*
* Copyright (c) 2012 Miodrag Vallat.
@@ -30,6 +30,8 @@
#include <mips64/arcbios.h>
#include <mips64/archtype.h>
+#include <uvm/uvm.h>
+
#include <sgi/sgi/ip22.h>
#include <sgi/localbus/imcreg.h>
#include <sgi/localbus/imcvar.h>
@@ -38,6 +40,8 @@
extern char *hw_prod;
+int hpc_old = 0;
+
void ip22_arcbios_walk(void);
int ip22_arcbios_walk_component(arc_config_t *);
void ip22_memory_setup(void);
@@ -269,9 +273,43 @@ ip22_setup()
ip22_memory_setup();
/*
+ * Register DMA-reachable memory constraints.
+ * hpc(4) revision 1 and 1.5 only use 28-bit address pointers, thus
+ * only 256MB are addressable; unfortunately, since physical memory
+ * starts at 128MB, this enforces a 128MB limit.
+ *
+ * The following logic is pessimistic, as IP24 (Indy) systems have
+ * a revision 3 hpc(4) onboard, but will accept older revisions in
+ * expansion boards.
+ */
+ switch (sys_config.system_type) {
+ default:
+ dma_constraint.ucr_low = 0;
+ dma_constraint.ucr_high = (1UL << 32) - 1;
+ if (sys_config.system_subtype == IP22_INDIGO2)
+ break;
+ /* FALLTHROUGH */
+ case SGI_IP20:
+ dma_constraint.ucr_low = 0;
+ dma_constraint.ucr_high = (1UL << 28) - 1;
+ break;
+ }
+
+ /*
* Scan ARCBios component list for L2 cache information.
*/
ip22_arcbios_walk();
_device_register = arcs_device_register;
}
+
+void
+ip22_post_autoconf()
+{
+ /*
+ * Relax DMA-reachable memory constraints if no 28-bit hpc(4)
+ * device has attached.
+ */
+ if (hpc_old == 0)
+ dma_constraint.ucr_high = (1UL << 32) - 1;
+}
diff --git a/sys/arch/sgi/sgi/ip27_machdep.c b/sys/arch/sgi/sgi/ip27_machdep.c
index ec256704296..c59608804a6 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.54 2012/03/15 18:57:22 miod Exp $ */
+/* $OpenBSD: ip27_machdep.c,v 1.55 2012/04/03 21:17:35 miod Exp $ */
/*
* Copyright (c) 2008, 2009 Miodrag Vallat.
@@ -39,7 +39,7 @@
#include <machine/mnode.h>
#include <machine/atomic.h>
-#include <uvm/uvm_extern.h>
+#include <uvm/uvm.h>
#include <sgi/sgi/ip27.h>
#include <sgi/sgi/l1.h>
@@ -174,6 +174,14 @@ ip27_setup()
}
}
+ /*
+ * Register DMA-reachable memory constraints.
+ * The xbridge(4) is limited to a 31-bit region (its IOMMU features
+ * are too restricted to be of use).
+ */
+ dma_constraint.ucr_low = 0;
+ dma_constraint.ucr_high = (1UL << 31) - 1;
+
xbow_widget_base = ip27_widget_short;
xbow_widget_map = ip27_widget_map;
xbow_widget_id = ip27_widget_id_early;
diff --git a/sys/arch/sgi/sgi/ip30_machdep.c b/sys/arch/sgi/sgi/ip30_machdep.c
index c5077d31438..d21d4526267 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.51 2012/03/28 20:44:23 miod Exp $ */
+/* $OpenBSD: ip30_machdep.c,v 1.52 2012/04/03 21:17:35 miod Exp $ */
/*
* Copyright (c) 2008, 2009 Miodrag Vallat.
@@ -35,7 +35,7 @@
#include <machine/cpu.h>
#include <machine/memconf.h>
-#include <uvm/uvm_extern.h>
+#include <uvm/uvm.h>
#include <sgi/sgi/ip30.h>
#include <sgi/xbow/widget.h>
@@ -136,6 +136,13 @@ ip30_setup()
}
}
+ /*
+ * Register DMA-reachable memory constraints.
+ * The xbridge(4) is limited to a 31-bit region (its IOMMU features
+ * are too restricted to be of use).
+ */
+ dma_constraint.ucr_low = 0;
+ dma_constraint.ucr_high = (1UL << 31) - 1;
xbow_widget_base = ip30_widget_short;
xbow_widget_map = ip30_widget_map;
diff --git a/sys/arch/sgi/sgi/machdep.c b/sys/arch/sgi/sgi/machdep.c
index 52405982621..1a991d22da8 100644
--- a/sys/arch/sgi/sgi/machdep.c
+++ b/sys/arch/sgi/sgi/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.115 2012/03/28 20:44:23 miod Exp $ */
+/* $OpenBSD: machdep.c,v 1.116 2012/04/03 21:17:35 miod Exp $ */
/*
* Copyright (c) 2003-2004 Opsycon AB (www.opsycon.se / www.opsycon.com)
@@ -84,8 +84,8 @@ void dump_tlb(void);
char machine[] = MACHINE; /* Machine "architecture" */
char cpu_model[30];
-/* low 32 bits range. */
-struct uvm_constraint_range dma_constraint = { 0x0, 0x7fffffff };
+/* will be updated in ipXX_machdep.c whenever necessary */
+struct uvm_constraint_range dma_constraint = { 0x0, (paddr_t)-1 };
struct uvm_constraint_range *uvm_md_constraints[] = {
&dma_constraint,
NULL
diff --git a/sys/arch/sgi/sgi/mainbus.c b/sys/arch/sgi/sgi/mainbus.c
index 018bbd372a4..0cb5fe14e57 100644
--- a/sys/arch/sgi/sgi/mainbus.c
+++ b/sys/arch/sgi/sgi/mainbus.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mainbus.c,v 1.9 2012/03/28 20:44:23 miod Exp $ */
+/* $OpenBSD: mainbus.c,v 1.10 2012/04/03 21:17:35 miod Exp $ */
/*
* Copyright (c) 2001-2003 Opsycon AB (www.opsycon.se / www.opsycon.com)
@@ -114,6 +114,9 @@ mbattach(struct device *parent, struct device *self, void *aux)
/* Memory Controller */
caa.caa_maa.maa_name = "imc";
config_found(self, &caa.caa_maa, mbprint);
+
+ ip22_post_autoconf();
+
break;
#endif
#ifdef TGT_O2