summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2009-06-13 21:48:04 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2009-06-13 21:48:04 +0000
commit7e97643755bb45a839c99309ba46c6c5b31c0669 (patch)
tree8aaa44aa51ce9cc3dcaf2b8040ca22675ebb1188
parentc66a555036d7337a47d930b3b23f88dacad8aaef (diff)
Enumerate all available nodes for hardware on IP27/IP35 systems; works to some
extent, but isp(4) on other nodes do not work correctly yet.
-rw-r--r--sys/arch/mips64/conf/files.mips643
-rw-r--r--sys/arch/sgi/conf/GENERIC-IP275
-rw-r--r--sys/arch/sgi/conf/files.sgi12
-rw-r--r--sys/arch/sgi/include/autoconf.h23
-rw-r--r--sys/arch/sgi/sgi/autoconf.c8
-rw-r--r--sys/arch/sgi/sgi/ip27_machdep.c82
-rw-r--r--sys/arch/sgi/sgi/machdep.c3
-rw-r--r--sys/arch/sgi/sgi/mainbus.c (renamed from sys/arch/mips64/mips64/mainbus.c)37
-rw-r--r--sys/arch/sgi/xbow/xbow.c22
-rw-r--r--sys/arch/sgi/xbow/xbow.h3
-rw-r--r--sys/arch/sgi/xbow/xbridge.c20
11 files changed, 156 insertions, 62 deletions
diff --git a/sys/arch/mips64/conf/files.mips64 b/sys/arch/mips64/conf/files.mips64
index 9d33ef565ae..251518297f7 100644
--- a/sys/arch/mips64/conf/files.mips64
+++ b/sys/arch/mips64/conf/files.mips64
@@ -1,10 +1,9 @@
-# $OpenBSD: files.mips64,v 1.10 2009/03/20 18:41:05 miod Exp $
+# $OpenBSD: files.mips64,v 1.11 2009/06/13 21:48:01 miod Exp $
file arch/mips64/mips64/arcbios.c arcbios
file arch/mips64/mips64/clock.c
file arch/mips64/mips64/cpu.c
file arch/mips64/mips64/interrupt.c
-file arch/mips64/mips64/mainbus.c
file arch/mips64/mips64/mem.c
file arch/mips64/mips64/pmap.c
file arch/mips64/mips64/process_machdep.c
diff --git a/sys/arch/sgi/conf/GENERIC-IP27 b/sys/arch/sgi/conf/GENERIC-IP27
index 5e739d45be9..0bcb6100098 100644
--- a/sys/arch/sgi/conf/GENERIC-IP27
+++ b/sys/arch/sgi/conf/GENERIC-IP27
@@ -1,4 +1,4 @@
-# $OpenBSD: GENERIC-IP27,v 1.5 2009/06/10 18:00:07 miod Exp $
+# $OpenBSD: GENERIC-IP27,v 1.6 2009/06/13 21:48:03 miod Exp $
#
# THIS KERNEL IS FOR Origin, Onyx, Fuel, Tezro (IP27, IP35) SYSTEMS ONLY.
#
@@ -41,7 +41,7 @@ cpu* at mainbus0
clock0 at mainbus0
#### Main local buses
-xbow0 at mainbus0
+xbow* at mainbus0
# XBow devices
xbridge* at xbow?
@@ -51,6 +51,7 @@ pci* at xbridge?
ioc* at pci?
com0 at ioc? base 0x00020178
com1 at ioc? base 0x00020170
+com* at ioc?
dsrtc0 at ioc?
onewire* at ioc?
diff --git a/sys/arch/sgi/conf/files.sgi b/sys/arch/sgi/conf/files.sgi
index db57f21e901..3c3876d974a 100644
--- a/sys/arch/sgi/conf/files.sgi
+++ b/sys/arch/sgi/conf/files.sgi
@@ -1,4 +1,4 @@
-# $OpenBSD: files.sgi,v 1.25 2009/05/02 21:31:17 miod Exp $
+# $OpenBSD: files.sgi,v 1.26 2009/06/13 21:48:03 miod Exp $
#
# maxpartitions must be first item in files.${ARCH}
#
@@ -8,14 +8,15 @@ maxusers 2 8 64
# Required files
-file arch/sgi/sgi/disksubr.c disk
file arch/sgi/sgi/autoconf.c
file arch/sgi/sgi/bus_dma.c
file arch/sgi/sgi/conf.c
+file arch/sgi/sgi/disksubr.c disk
file arch/sgi/sgi/ip27_machdep.c tgt_origin200 | tgt_origin2000
file arch/sgi/sgi/ip30_machdep.c tgt_octane
file arch/sgi/sgi/ip32_machdep.c tgt_o2
file arch/sgi/sgi/machdep.c
+file arch/sgi/sgi/mainbus.c
file arch/sgi/sgi/mutex.c
file arch/sgi/sgi/sginode.c tgt_origin200 | tgt_origin2000
file arch/sgi/sgi/wscons_machdep.c wsdisplay
@@ -35,7 +36,7 @@ include "dev/ata/files.ata"
#
# System BUS types
#
-define mainbus {}
+define mainbus {[nasid = -1]}
device mainbus
attach mainbus at root
@@ -102,11 +103,6 @@ device gbe: wsemuldisplaydev, rasops8, rasops16, rasops32
attach gbe at mainbus
file arch/sgi/dev/gbe.c gbe needs-flag
-# Impact graphics
-device impact: wsemuldisplaydev, rasops8, rasops16, rasops32
-attach impact at xbow
-file arch/sgi/xbow/impact.c impact needs-flag
-
# 16[45]50-based "com" ports on localbus
attach com at macebus with com_macebus
file arch/sgi/localbus/com_lbus.c com_macebus
diff --git a/sys/arch/sgi/include/autoconf.h b/sys/arch/sgi/include/autoconf.h
index d91fc883b1d..0b16587d677 100644
--- a/sys/arch/sgi/include/autoconf.h
+++ b/sys/arch/sgi/include/autoconf.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: autoconf.h,v 1.17 2009/05/21 16:28:11 miod Exp $ */
+/* $OpenBSD: autoconf.h,v 1.18 2009/06/13 21:48:03 miod Exp $ */
/*
* Copyright (c) 2001-2003 Opsycon AB (www.opsycon.se / www.opsycon.com)
@@ -71,24 +71,27 @@ struct sys_rec {
extern struct sys_rec sys_config;
-/**/
-struct confargs;
-
struct confargs {
- char *ca_name; /* Device name. */
- bus_space_tag_t ca_iot;
- bus_space_tag_t ca_memt;
- bus_dma_tag_t ca_dmat;
- int32_t ca_intr;
- bus_addr_t ca_baseaddr;
+ char *ca_name;
+ int16_t ca_nasid;
+ bus_space_tag_t ca_iot;
+ bus_dma_tag_t ca_dmat;
+ /* XXX the following are macebus-specific */
+ bus_space_tag_t ca_memt;
+ int32_t ca_intr;
+ bus_addr_t ca_baseaddr;
};
void enaddr_aton(const char *, u_int8_t *);
+struct device;
+
void ip27_setup(void);
+void ip27_autoconf(struct device *);
void ip30_setup(void);
void ip32_setup(void);
extern char osloadpartition[256];
+extern int16_t masternasid;
#endif /* _MACHINE_AUTOCONF_H_ */
diff --git a/sys/arch/sgi/sgi/autoconf.c b/sys/arch/sgi/sgi/autoconf.c
index 82e8be89684..7d132f5a91a 100644
--- a/sys/arch/sgi/sgi/autoconf.c
+++ b/sys/arch/sgi/sgi/autoconf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: autoconf.c,v 1.20 2009/05/21 16:28:12 miod Exp $ */
+/* $OpenBSD: autoconf.c,v 1.21 2009/06/13 21:48:03 miod Exp $ */
/*
* Copyright (c) 2009 Miodrag Vallat.
*
@@ -277,7 +277,7 @@ device_register(struct device *dev, void *aux)
/*
* The matching rules are as follows:
- * xio() matches xbow (we ignore nasid so far).
+ * xio() matches xbow.
* pci() matches any pci controller (macepcibr, xbridge), with the
* unit number being ignored on O2 and the widget number of the
* controller elsewhere.
@@ -292,7 +292,9 @@ device_register(struct device *dev, void *aux)
*/
if (strcmp(component, "xio") == 0) {
- if (strcmp(cd->cd_name, "xbow") == 0)
+ struct confargs *ca = aux;
+
+ if (strcmp(cd->cd_name, "xbow") == 0 && unit == ca->ca_nasid)
goto found_advance;
}
diff --git a/sys/arch/sgi/sgi/ip27_machdep.c b/sys/arch/sgi/sgi/ip27_machdep.c
index ba5372ca0fd..a5b30009f12 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.13 2009/06/13 18:47:30 miod Exp $ */
+/* $OpenBSD: ip27_machdep.c,v 1.14 2009/06/13 21:48:03 miod Exp $ */
/*
* Copyright (c) 2008, 2009 Miodrag Vallat.
@@ -56,7 +56,9 @@ int ip27_widget_id(int16_t, u_int, uint32_t *);
void ip27_halt(int);
static paddr_t io_base;
+static gda_t *gda;
static int ip35 = 0;
+static uint maxnodes;
int ip27_hub_intr_register(int, int, int *);
int ip27_hub_intr_establish(int (*)(void *), void *, int, int,
@@ -66,14 +68,15 @@ intrmask_t ip27_hub_intr_handler(intrmask_t, struct trap_frame *);
void ip27_hub_intr_makemasks(void);
void ip27_hub_do_pending_int(int);
+void ip27_attach_node(struct device *, int16_t);
+int ip27_print(void *, const char *);
void ip27_nmi(void *);
void
ip27_setup()
{
- gda_t *gda;
size_t gsz;
- uint node, masternode, maxnodes;
+ uint node;
nmi_t *nmi;
uncached_base = PHYS_TO_XKPHYS_UNCACHED(0, SP_NC);
@@ -104,10 +107,10 @@ ip27_setup()
gda = IP27_GDA(0);
gsz = IP27_GDA_SIZE(0);
if (gda->magic != GDA_MAGIC || gda->ver < 2) {
- masternode = 0;
+ masternasid = 0;
maxnodes = 0;
} else {
- masternode = gda->masternasid;
+ masternasid = gda->masternasid;
maxnodes = (gsz - offsetof(gda_t, nasid)) / sizeof(int16_t);
if (maxnodes > GDA_MAXNODES)
maxnodes = GDA_MAXNODES;
@@ -121,12 +124,12 @@ ip27_setup()
* information, starting with the master node.
*/
- kl_scan_config(masternode);
+ kl_scan_config(masternasid);
for (node = 0; node < maxnodes; node++) {
- if (node == masternode)
- continue;
if (gda->nasid[node] < 0)
continue;
+ if (gda->nasid[node] == masternasid)
+ continue;
kl_scan_config(gda->nasid[node]);
}
kl_scan_done();
@@ -186,6 +189,63 @@ ip27_setup()
}
/*
+ * Autoconf enumeration
+ */
+
+void
+ip27_autoconf(struct device *parent)
+{
+ struct confargs nca;
+ uint node;
+
+ /*
+ * Attach the CPU we are running on early; other processors,
+ * if any, will get attached as they are discovered.
+ */
+
+ bzero(&nca, sizeof nca);
+ nca.ca_nasid = masternasid;
+ nca.ca_name = "cpu";
+ config_found(parent, &nca, ip27_print);
+ nca.ca_name = "clock";
+ config_found(parent, &nca, ip27_print);
+
+ /*
+ * Now attach all nodes' I/O devices.
+ */
+
+ ip27_attach_node(parent, masternasid);
+ for (node = 0; node < maxnodes; node++) {
+ if (gda->nasid[node] < 0)
+ continue;
+ if (gda->nasid[node] == masternasid)
+ continue;
+ ip27_attach_node(parent, gda->nasid[node]);
+ }
+}
+
+void
+ip27_attach_node(struct device *parent, int16_t nasid)
+{
+ struct confargs nca;
+
+ bzero(&nca, sizeof nca);
+ nca.ca_name = "xbow";
+ nca.ca_nasid = nasid;
+ config_found(parent, &nca, ip27_print);
+}
+
+int
+ip27_print(void *aux, const char *pnp)
+{
+ struct confargs *ca = aux;
+
+ printf(" nasid %d", ca->ca_nasid);
+
+ return UNCONF;
+}
+
+/*
* Widget mapping.
*/
@@ -254,10 +314,8 @@ ip27_halt(int howto)
* to tell the PROM which action we want it to take afterwards.
*/
- if (howto & RB_HALT) {
- if (howto & RB_POWERDOWN)
- return; /* caller will spin */
- }
+ if (howto & RB_HALT)
+ return; /* caller will spin */
if (ip35) {
IP27_LHUB_S(HUBNI_IP35 + HUBNI_RESET_ENABLE, NI_RESET_ENABLE);
diff --git a/sys/arch/sgi/sgi/machdep.c b/sys/arch/sgi/sgi/machdep.c
index 20f4b55963b..c44bd038eec 100644
--- a/sys/arch/sgi/sgi/machdep.c
+++ b/sys/arch/sgi/sgi/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.72 2009/06/04 16:52:12 miod Exp $ */
+/* $OpenBSD: machdep.c,v 1.73 2009/06/13 21:48:03 miod Exp $ */
/*
* Copyright (c) 2003-2004 Opsycon AB (www.opsycon.se / www.opsycon.com)
@@ -117,6 +117,7 @@ struct user *proc0paddr;
struct user *curprocpaddr;
int console_ok; /* Set when console initialized. */
int kbd_reset;
+int16_t masternasid;
int32_t *environment;
struct sys_rec sys_config;
diff --git a/sys/arch/mips64/mips64/mainbus.c b/sys/arch/sgi/sgi/mainbus.c
index b0f041ae6c5..3828b6d521b 100644
--- a/sys/arch/mips64/mips64/mainbus.c
+++ b/sys/arch/sgi/sgi/mainbus.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mainbus.c,v 1.7 2009/04/19 12:52:33 miod Exp $ */
+/* $OpenBSD: mainbus.c,v 1.1 2009/06/13 21:48:03 miod Exp $ */
/*
* Copyright (c) 2001-2003 Opsycon AB (www.opsycon.se / www.opsycon.com)
@@ -50,11 +50,12 @@ struct cfdriver mainbus_cd = {
int
mbmatch(struct device *parent, void *cfdata, void *aux)
{
- struct cfdata *cf = cfdata;
+ static int mbattached = 0;
- if (cf->cf_unit > 0)
- return (0);
- return (1);
+ if (mbattached != 0)
+ return 0;
+
+ return mbattached = 1;
}
void
@@ -65,8 +66,24 @@ mbattach(struct device *parent, struct device *self, void *aux)
printf("\n");
/*
- * Try to find and attach all of the CPUs in the machine.
- * ( Right now only one CPU so code is simple )
+ * On IP27 and IP35 system, delegate everything to the IP-specific
+ * code.
+ */
+ switch (sys_config.system_type) {
+#if defined(TGT_ORIGIN200) || defined(TGT_ORIGIN2000)
+ case SGI_O200:
+ case SGI_O300:
+ ip27_autoconf(self);
+ return;
+#endif
+ default:
+ break;
+ }
+
+ /*
+ * On other systems, attach the CPU we are running on early;
+ * other processors, if any, will get attached as they are
+ * discovered.
*/
bzero(&nca, sizeof nca);
@@ -84,14 +101,14 @@ mbattach(struct device *parent, struct device *self, void *aux)
config_found(self, &nca, mbprint);
break;
#endif
-#if defined(TGT_ORIGIN200) || defined(TGT_ORIGIN2000) || defined(TGT_OCTANE)
- case SGI_O200:
- case SGI_O300:
+#ifdef TGT_OCTANE
case SGI_OCTANE:
nca.ca_name = "xbow";
config_found(self, &nca, mbprint);
break;
#endif
+ default:
+ break;
}
}
diff --git a/sys/arch/sgi/xbow/xbow.c b/sys/arch/sgi/xbow/xbow.c
index 5fbeea5c07e..b66ae708d4b 100644
--- a/sys/arch/sgi/xbow/xbow.c
+++ b/sys/arch/sgi/xbow/xbow.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: xbow.c,v 1.8 2009/06/13 16:28:11 miod Exp $ */
+/* $OpenBSD: xbow.c,v 1.9 2009/06/13 21:48:03 miod Exp $ */
/*
* Copyright (c) 2008, 2009 Miodrag Vallat.
@@ -225,7 +225,7 @@ xbowprint(void *aux, const char *pnp)
printf(" revision %d at %s",
xaa->xaa_revision, pnp);
}
- printf(" widget %d", xaa->xaa_widget);
+ printf(" nasid %d widget %d", xaa->xaa_nasid, xaa->xaa_widget);
if (pnp == NULL) {
if (p != NULL)
printf(": %s", p->productname);
@@ -289,7 +289,8 @@ struct xbow_kl_config {
void
xbowattach(struct device *parent, struct device *self, void *aux)
{
- int16_t nasid = 0; /* XXX for now... */
+ struct confargs *ca = aux;
+ int16_t nasid = ca->ca_nasid;
uint32_t wid, vendor, product;
const struct xbow_product *p;
struct xbow_config cfg;
@@ -319,9 +320,11 @@ xbowattach(struct device *parent, struct device *self, void *aux)
/*
* Default value for the interrupt register.
*/
- xbow_intr_widget_register = (1UL << 47) /* XIO I/O space */ |
- ((paddr_t)IP27_RHUB_ADDR(nasid, HUBPI_IR_CHANGE) -
- IP27_NODE_IO_BASE(0)) /* HUB register offset */;
+ if (xbow_intr_widget_register == 0)
+ xbow_intr_widget_register =
+ (1UL << 47) /* XIO I/O space */ |
+ ((paddr_t)IP27_RHUB_ADDR(nasid, HUBPI_IR_CHANGE) -
+ IP27_NODE_IO_BASE(0)) /* HUB register offset */;
klcfg.cfg = &cfg;
klcfg.probe_order = NULL;
@@ -337,7 +340,8 @@ xbowattach(struct device *parent, struct device *self, void *aux)
* Interrupt widget is hardwired to #a (this is another
* facet of this bridge).
*/
- xbow_intr_widget = 0x0a;
+ if (xbow_intr_widget == 0)
+ xbow_intr_widget = 0x0a;
klcfg.probe_order = xbow_probe_singlebridge;
} else {
/*
@@ -354,7 +358,8 @@ xbowattach(struct device *parent, struct device *self, void *aux)
* crossbow, and is where memory and interrupt logic
* resources are connected to.
*/
- xbow_intr_widget = cfg.master;
+ if (xbow_intr_widget == 0)
+ xbow_intr_widget = cfg.master;
}
break;
#endif
@@ -399,6 +404,7 @@ xbow_attach_widget(struct device *self, int16_t nasid, int widget,
xbow_build_bus_space(bs, nasid, widget, 0);
xbow_build_bus_space(bl, nasid, widget, 1);
+ xaa.xaa_nasid = nasid;
xaa.xaa_widget = widget;
xaa.xaa_vendor = (wid & WIDGET_ID_VENDOR_MASK) >>
WIDGET_ID_VENDOR_SHIFT;
diff --git a/sys/arch/sgi/xbow/xbow.h b/sys/arch/sgi/xbow/xbow.h
index 9209f5d5c2c..d7f0e5337b6 100644
--- a/sys/arch/sgi/xbow/xbow.h
+++ b/sys/arch/sgi/xbow/xbow.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: xbow.h,v 1.3 2009/04/15 18:45:41 miod Exp $ */
+/* $OpenBSD: xbow.h,v 1.4 2009/06/13 21:48:03 miod Exp $ */
/*
* Copyright (c) 2008 Miodrag Vallat.
@@ -108,6 +108,7 @@ extern void (*xbow_intr_widget_intr_disestablish)(int);
struct xbow_attach_args {
+ int16_t xaa_nasid;
int xaa_widget;
uint32_t xaa_vendor;
diff --git a/sys/arch/sgi/xbow/xbridge.c b/sys/arch/sgi/xbow/xbridge.c
index f26c3470276..5d8f5c729c0 100644
--- a/sys/arch/sgi/xbow/xbridge.c
+++ b/sys/arch/sgi/xbow/xbridge.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: xbridge.c,v 1.25 2009/06/13 16:28:11 miod Exp $ */
+/* $OpenBSD: xbridge.c,v 1.26 2009/06/13 21:48:03 miod Exp $ */
/*
* Copyright (c) 2008, 2009 Miodrag Vallat.
@@ -64,6 +64,7 @@ struct xbridge_softc {
struct device sc_dev;
int sc_flags;
#define XBRIDGE_FLAGS_XBRIDGE 0x01 /* is XBridge vs Bridge */
+ int16_t sc_nasid;
int sc_widget;
struct mips_pci_chipset sc_pc;
@@ -209,6 +210,7 @@ xbridge_attach(struct device *parent, struct device *self, void *aux)
struct pcibus_attach_args pba;
struct xbow_attach_args *xaa = aux;
+ sc->sc_nasid = xaa->xaa_nasid;
sc->sc_widget = xaa->xaa_widget;
printf(" revision %d\n", xaa->xaa_revision);
@@ -774,7 +776,6 @@ xbridge_intr_handler(void *v)
{
struct xbridge_intr *xi = v;
struct xbridge_softc *sc = xi->xi_bridge;
- uint16_t nasid = 0; /* XXX */
int rc;
int spurious;
@@ -827,11 +828,19 @@ xbridge_intr_handler(void *v)
} else {
if (bus_space_read_4(sc->sc_iot, sc->sc_regh,
BRIDGE_ISR) & (1 << xi->xi_intrbit)) {
- if (sys_config.system_type == SGI_OCTANE) {
+ switch (sys_config.system_type) {
+#if defined(TGT_OCTANE)
+ case SGI_OCTANE:
/* XXX what to do there? */
- } else {
- IP27_RHUB_PI_S(nasid, 0, HUBPI_IR_CHANGE,
+ break;
+#endif
+#if defined(TGT_ORIGIN200) || defined(TGT_ORIGIN2000)
+ case SGI_O200:
+ case SGI_O300:
+ IP27_RHUB_PI_S(sc->sc_nasid, 0, HUBPI_IR_CHANGE,
PI_IR_SET | xi->xi_intrsrc);
+ break;
+#endif
}
}
}
@@ -1629,6 +1638,7 @@ xbridge_setup(struct xbridge_softc *sc)
/*
* Configure the direct DMA window to access the low 2GB of memory.
+ * XXX assumes masternasid is 0
*/
if (sys_config.system_type == SGI_OCTANE)