summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorvisa <visa@openbsd.org>2016-01-02 05:49:35 +0000
committervisa <visa@openbsd.org>2016-01-02 05:49:35 +0000
commitbf62e0abe5be5891e570330f36419d1ce238706d (patch)
tree067b8af30711097c14b87263418bc94ede533af5
parentmmcc noticed that nd.ni_pledge was uninitialized in doopenat() for the (diff)
downloadwireguard-openbsd-bf62e0abe5be5891e570330f36419d1ce238706d.tar.xz
wireguard-openbsd-bf62e0abe5be5891e570330f36419d1ce238706d.zip
Take the PHY of iec(4) out of reset before attaching the interface.
Otherwise the PHY goes undetected on the slave node of a dual-node Origin 200. The PHY gets enabled by diagnostic checks but only on the master node. As the attach code will now do the enabling, the checks can be disabled on reboot, making reboots faster especially on IP27. Tested on Origin 200 (IP27), Fuel (IP35 with iec), and Origin 350 (IP35 without iec). Diff from miod@, ok krw@
-rw-r--r--sys/arch/sgi/pci/ioc.c17
-rw-r--r--sys/arch/sgi/pci/iocreg.h3
-rw-r--r--sys/arch/sgi/sgi/ip27_machdep.c17
-rw-r--r--sys/arch/sgi/xbow/hub.h4
4 files changed, 35 insertions, 6 deletions
diff --git a/sys/arch/sgi/pci/ioc.c b/sys/arch/sgi/pci/ioc.c
index 8224f38534f..a78c9e5f998 100644
--- a/sys/arch/sgi/pci/ioc.c
+++ b/sys/arch/sgi/pci/ioc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ioc.c,v 1.39 2014/05/19 21:18:42 miod Exp $ */
+/* $OpenBSD: ioc.c,v 1.40 2016/01/02 05:49:35 visa Exp $ */
/*
* Copyright (c) 2008 Joel Sing.
@@ -481,8 +481,21 @@ unknown:
}
if (ISSET(subdevice_mask, 1 << IOCDEV_KBC))
ioc_attach_child(sc, "iockbc", 0, IOCDEV_KBC);
- if (ISSET(subdevice_mask, 1 << IOCDEV_EF))
+ if (ISSET(subdevice_mask, 1 << IOCDEV_EF)) {
+ /*
+ * Make sure the PHY is correctly reset before attaching
+ * the interface.
+ */
+ bus_space_write_4(sc->sc_memt, sc->sc_memh,
+ IOC3_GPPR(5), 0);
+ bus_space_write_4(sc->sc_memt, sc->sc_memh,
+ IOC3_GPCR_S, IOC3_GPCR_PHY_RESET);
+ delay(10);
+ bus_space_write_4(sc->sc_memt, sc->sc_memh,
+ IOC3_GPPR(5), 1);
+
ioc_attach_child(sc, "iec", 0, IOCDEV_EF);
+ }
if (ISSET(subdevice_mask, 1 << IOCDEV_LPT))
ioc_attach_child(sc, "lpt", 0, IOCDEV_LPT);
if (ISSET(subdevice_mask, 1 << IOCDEV_RTC))
diff --git a/sys/arch/sgi/pci/iocreg.h b/sys/arch/sgi/pci/iocreg.h
index 46baabfa738..e65473ffcb3 100644
--- a/sys/arch/sgi/pci/iocreg.h
+++ b/sys/arch/sgi/pci/iocreg.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: iocreg.h,v 1.10 2009/11/18 19:03:27 miod Exp $ */
+/* $OpenBSD: iocreg.h,v 1.11 2016/01/02 05:49:36 visa Exp $ */
/*
* Copyright (c) 2008 Joel Sing.
@@ -101,6 +101,7 @@
#define IOC3_IRQ_KBC 0x00400000 /* keyboard controller */
/* bits in GPCR */
+#define IOC3_GPCR_PHY_RESET 0x00000020 /* reset Ethernet PHY */
#define IOC3_GPCR_UARTA_PIO 0x00000040 /* UARTA in PIO mode */
#define IOC3_GPCR_UARTB_PIO 0x00000080 /* UARTB in PIO mode */
#define IOC3_GPCR_MLAN 0x00200000 /* MicroLan enable */
diff --git a/sys/arch/sgi/sgi/ip27_machdep.c b/sys/arch/sgi/sgi/ip27_machdep.c
index 73a87e52a1e..8d3020910d3 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.70 2015/12/25 09:22:00 visa Exp $ */
+/* $OpenBSD: ip27_machdep.c,v 1.71 2016/01/02 05:49:36 visa Exp $ */
/*
* Copyright (c) 2008, 2009 Miodrag Vallat.
@@ -419,6 +419,19 @@ ip27_attach_node(struct device *parent, int16_t nasid)
currentnasid = nasid;
bzero(&u, sizeof u);
+ /*
+ * IRIX performs this extra initialization on Origin 200 systems.
+ * This seems to properly initialize on-board devices on the
+ * second node.
+ */
+ if (sys_config.system_type == SGI_IP27 &&
+ sys_config.system_subtype == IP27_O200) {
+ IP27_RHUB_S(nasid, HUBMDBASE_IP27 | HUBMD_LED0,
+ nasid == masternasid ? 1 : 9);
+ IP27_RHUB_S(nasid, HUBMDBASE_IP27 | HUBMD_LED0,
+ nasid == masternasid ? 1 : 9);
+ }
+
#ifdef MULTIPROCESSOR
kl_scan_node(nasid, IP27_BC_NODE, ip27_kl_attach_cpu_board, parent);
#endif
@@ -669,7 +682,7 @@ ip27_halt(int howto)
} else
promop = GDA_PROMOP_REBOOT;
- promop |= GDA_PROMOP_MAGIC | /* GDA_PROMOP_NO_DIAGS | */
+ promop |= GDA_PROMOP_MAGIC | GDA_PROMOP_NO_DIAGS |
GDA_PROMOP_NO_MEMINIT;
#if 0
diff --git a/sys/arch/sgi/xbow/hub.h b/sys/arch/sgi/xbow/hub.h
index 8c36d562380..485ac09f6a2 100644
--- a/sys/arch/sgi/xbow/hub.h
+++ b/sys/arch/sgi/xbow/hub.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: hub.h,v 1.10 2015/12/25 09:22:00 visa Exp $ */
+/* $OpenBSD: hub.h,v 1.11 2016/01/02 05:49:36 visa Exp $ */
/*
* Copyright (c) 2009 Miodrag Vallat.
@@ -179,6 +179,8 @@
#define HUBMDBASE_IP27 0x00200000
#define HUBMDBASE_IP35 0x00780000
+#define HUBMD_LED0 0x00020050
+
/*
* HUB IO - Widget I/O