summaryrefslogtreecommitdiff
path: root/sys/arch/sgi/pci
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2010-03-20 16:22:56 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2010-03-20 16:22:56 +0000
commit88e3a5ffe05ba89494884709af8488464f764604 (patch)
tree20451403a9e5ae696c37b1aeae4eb45ac5d452e3 /sys/arch/sgi/pci
parente995bd3a29cc2b1c26f169864d4cfeea2c7aee3d (diff)
Add code to tell Origin 200 and Origin 2000 / Onyx 2 apart.
Use this to correctly handle the onboard IOC3 chip configuration on O2k (two IOC3 chips to be able to provide four serial ports, and the other subdevices are split accross the two IOC3 chips).
Diffstat (limited to 'sys/arch/sgi/pci')
-rw-r--r--sys/arch/sgi/pci/ioc.c115
1 files changed, 89 insertions, 26 deletions
diff --git a/sys/arch/sgi/pci/ioc.c b/sys/arch/sgi/pci/ioc.c
index e1aa1afe2fb..c19fc82b88e 100644
--- a/sys/arch/sgi/pci/ioc.c
+++ b/sys/arch/sgi/pci/ioc.c
@@ -1,8 +1,8 @@
-/* $OpenBSD: ioc.c,v 1.32 2010/03/07 13:44:26 miod Exp $ */
+/* $OpenBSD: ioc.c,v 1.33 2010/03/20 16:22:53 miod Exp $ */
/*
* Copyright (c) 2008 Joel Sing.
- * Copyright (c) 2008, 2009 Miodrag Vallat.
+ * Copyright (c) 2008, 2009, 2010 Miodrag Vallat.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -115,10 +115,10 @@ int iocow_pulse(struct ioc_softc *, int, int);
#ifdef TGT_ORIGIN
/*
* A mask of nodes on which an ioc driver has attached.
- * We use this to prevent attaching a pci IOC3 card which NIC has failed,
- * as the onboard IOC3.
- *
- * XXX This obviously will not work in N mode...
+ * We use this on IP35 systems, to prevent attaching a pci IOC3 card which NIC
+ * has failed, as the onboard IOC3.
+ * XXX This obviously will not work in N mode... but then IP35 are supposed to
+ * XXX always run in M mode.
*/
static uint64_t ioc_nodemask = 0;
#endif
@@ -274,32 +274,95 @@ ioc_attach(struct device *parent, struct device *self, void *aux)
* very likely that we are the on-board IOC3 found
* on IP27 and IP35 systems, unless we have already
* found an on-board IOC3 on this node.
+ *
+ * Origin 2000 (real IP27) systems are a real annoyance,
+ * because they actually have two IOC3 on their BASEIO
+ * board, with the various devices split accross them
+ * (two IOC3 chips are needed to provide the four serial
+ * ports). We can rely upon the PCI device numbers (2 and 6)
+ * to tell onboard IOC3 from PCI IOC3 devices.
*/
- if ((sys_config.system_type == SGI_IP27 ||
- sys_config.system_type == SGI_IP35) &&
- !ISSET(ioc_nodemask, 1UL << currentnasid)) {
- SET(ioc_nodemask, 1UL << currentnasid);
+ switch (sys_config.system_type) {
+ case SGI_IP27:
+ switch (sys_config.system_subtype) {
+ case IP27_O2K:
+ if (pci_get_widget(sc->sc_pc) ==
+ IP27_O2K_BRIDGE_WIDGET)
+ switch (pa->pa_device) {
+ case IP27_IOC_SLOTNO:
+ subdevice_mask =
+ (1 << IOCDEV_SERIAL_A) |
+ (1 << IOCDEV_SERIAL_B) |
+ (1 << IOCDEV_RTC) |
+ (1 << IOCDEV_EF);
+ break;
+ case IP27_IOC2_SLOTNO:
+ subdevice_mask =
+ (1 << IOCDEV_SERIAL_A) |
+ (1 << IOCDEV_SERIAL_B) |
+ (1 << IOCDEV_LPT) |
+#if 0 /* not worth doing */
+ (1 << IOCDEV_RTC) |
+#endif
+ (1 << IOCDEV_KBC);
+ break;
+ default:
+ break;
+ }
+ break;
+ case IP27_O200:
+ if (pci_get_widget(sc->sc_pc) ==
+ IP27_O200_BRIDGE_WIDGET)
+ switch (pa->pa_device) {
+ case IP27_IOC_SLOTNO:
+ subdevice_mask =
+ (1 << IOCDEV_SERIAL_A) |
+ (1 << IOCDEV_SERIAL_B) |
+ (1 << IOCDEV_LPT) |
+ (1 << IOCDEV_KBC) |
+ (1 << IOCDEV_RTC) |
+ (1 << IOCDEV_EF);
+ break;
+ default:
+ break;
+ }
+ break;
+ default:
+ break;
+ }
+ break;
+ case SGI_IP35:
+ if (!ISSET(ioc_nodemask, 1UL << currentnasid)) {
+ SET(ioc_nodemask, 1UL << currentnasid);
- subdevice_mask = (1 << IOCDEV_SERIAL_A) |
- (1 << IOCDEV_SERIAL_B) | (1 << IOCDEV_LPT) |
- (1 << IOCDEV_KBC) | (1 << IOCDEV_RTC) |
- (1 << IOCDEV_EF);
- /*
- * Origin 300 onboard IOC3 do not have PS/2 ports;
- * since they can only be connected to other 300 or
- * 350 bricks (the latter using IOC4 devices),
- * it is safe to do this regardless of the current
- * nasid.
- */
- if (sys_config.system_type == SGI_IP35 &&
- sys_config.system_subtype == IP35_O300)
- subdevice_mask &= ~(1 << IOCDEV_KBC);
+ subdevice_mask = (1 << IOCDEV_SERIAL_A) |
+ (1 << IOCDEV_SERIAL_B) | (1 << IOCDEV_LPT) |
+ (1 << IOCDEV_KBC) | (1 << IOCDEV_RTC) |
+ (1 << IOCDEV_EF);
+ /*
+ * Origin 300 onboard IOC3 do not have PS/2
+ * ports; since they can only be connected to
+ * other 300 or 350 bricks (the latter using
+ * IOC4 devices), it is safe to do this
+ * regardless of the current nasid.
+ * XXX What about Onyx 300 though???
+ */
+ if (sys_config.system_subtype == IP35_O300)
+ subdevice_mask &= ~(1 << IOCDEV_KBC);
+ }
+ break;
+ default:
+ break;
+ }
+ if (subdevice_mask != 0) {
rtcbase = IOC3_BYTEBUS_0;
- has_superio = has_enet = 1;
+ has_superio = 1;
+ if (ISSET(subdevice_mask, 1 << IOCDEV_EF))
+ has_enet = 1;
is_obio = 1;
} else
-#endif
+#endif /* TGT_ORIGIN */
{
unknown:
/*