summaryrefslogtreecommitdiff
path: root/sys/arch
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2014-02-18 19:37:34 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2014-02-18 19:37:34 +0000
commit299fab64eee85c3e1bc12d3f76b632a6579b302a (patch)
treef0f7b3ef4a7062afd3dfcda91363ee6374ba8930 /sys/arch
parent81509a99f4a04ed21b9613bf9137ff5e742b6eca (diff)
sio_intr_shutdown() used to be a shutdown hook, and eventually became an
unconditional call in machdep.c!boot(). Except that the cpp conditional enabling its use was not in machdep.c's scope, so this function was never called. Ouch. Remove it from boot() and grow a ca_activate method to the sio(4/alpha) device, which will take care of invoking sio_intr_shutdown() if DVACT_POWERDOWN.
Diffstat (limited to 'sys/arch')
-rw-r--r--sys/arch/alpha/alpha/machdep.c10
-rw-r--r--sys/arch/alpha/pci/sio.c26
-rw-r--r--sys/arch/alpha/pci/sio_pic.c12
-rw-r--r--sys/arch/alpha/pci/siovar.h3
4 files changed, 30 insertions, 21 deletions
diff --git a/sys/arch/alpha/alpha/machdep.c b/sys/arch/alpha/alpha/machdep.c
index b6dd865b21b..b63dcfd3907 100644
--- a/sys/arch/alpha/alpha/machdep.c
+++ b/sys/arch/alpha/alpha/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.148 2014/02/04 21:52:42 miod Exp $ */
+/* $OpenBSD: machdep.c,v 1.149 2014/02/18 19:37:32 miod Exp $ */
/* $NetBSD: machdep.c,v 1.210 2000/06/01 17:12:38 thorpej Exp $ */
/*-
@@ -122,10 +122,6 @@
#include <dev/tc/ioasicvar.h>
#endif
-#ifdef BROKEN_PROM_CONSOLE
-extern void sio_intr_shutdown(void);
-#endif
-
int cpu_dump(void);
int cpu_dumpsize(void);
u_long cpu_dump_mempagecnt(void);
@@ -1049,10 +1045,6 @@ haltsys:
if (!TAILQ_EMPTY(&alldevs))
config_suspend(TAILQ_FIRST(&alldevs), DVACT_POWERDOWN);
-#ifdef BROKEN_PROM_CONSOLE
- sio_intr_shutdown(NULL);
-#endif
-
#ifdef BOOTKEY
printf("hit any key to %s...\n", howto & RB_HALT ? "halt" : "reboot");
cnpollc(1); /* for proper keyboard command handling */
diff --git a/sys/arch/alpha/pci/sio.c b/sys/arch/alpha/pci/sio.c
index 9d41887b6ac..e2b1b022c57 100644
--- a/sys/arch/alpha/pci/sio.c
+++ b/sys/arch/alpha/pci/sio.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sio.c,v 1.37 2013/03/08 18:29:33 miod Exp $ */
+/* $OpenBSD: sio.c,v 1.38 2014/02/18 19:37:33 miod Exp $ */
/* $NetBSD: sio.c,v 1.15 1996/12/05 01:39:36 cgd Exp $ */
/*
@@ -58,13 +58,16 @@ struct sio_softc {
int siomatch(struct device *, void *, void *);
void sioattach(struct device *, struct device *, void *);
+int sioactivate(struct device *, int);
extern int sio_intr_alloc(isa_chipset_tag_t *, int, int, int *);
extern int sio_intr_check(isa_chipset_tag_t *, int, int);
-
struct cfattach sio_ca = {
- sizeof(struct sio_softc), siomatch, sioattach,
+ .ca_devsize = sizeof(struct sio_softc),
+ .ca_match = siomatch,
+ .ca_attach = sioattach,
+ .ca_activate = sioactivate
};
struct cfdriver sio_cd = {
@@ -156,6 +159,23 @@ sioattach(parent, self, aux)
config_defer(self, sio_bridge_callback);
}
+int
+sioactivate(struct device *self, int act)
+{
+ int rv = 0;
+
+ switch (act) {
+ case DVACT_POWERDOWN:
+ rv = config_activate_children(self, act);
+ sio_intr_shutdown();
+ break;
+ default:
+ rv = config_activate_children(self, act);
+ break;
+ }
+ return (rv);
+}
+
void
sio_bridge_callback(self)
struct device *self;
diff --git a/sys/arch/alpha/pci/sio_pic.c b/sys/arch/alpha/pci/sio_pic.c
index d8e9dca1362..df15d8f7264 100644
--- a/sys/arch/alpha/pci/sio_pic.c
+++ b/sys/arch/alpha/pci/sio_pic.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sio_pic.c,v 1.35 2013/03/08 18:29:33 miod Exp $ */
+/* $OpenBSD: sio_pic.c,v 1.36 2014/02/18 19:37:33 miod Exp $ */
/* $NetBSD: sio_pic.c,v 1.28 2000/06/06 03:10:13 thorpej Exp $ */
/*-
@@ -123,9 +123,6 @@ int sio_intr_check(void *, int, int);
u_int8_t (*sio_read_elcr)(int);
void (*sio_write_elcr)(int, u_int8_t);
static void specific_eoi(int);
-#ifdef BROKEN_PROM_CONSOLE
-void sio_intr_shutdown(void *);
-#endif
/******************** i82378 SIO ELCR functions ********************/
@@ -403,11 +400,10 @@ sio_intr_setup(pc, iot)
}
}
-#ifdef BROKEN_PROM_CONSOLE
void
-sio_intr_shutdown(arg)
- void *arg;
+sio_intr_shutdown()
{
+#ifdef BROKEN_PROM_CONSOLE
if (sio_write_elcr == NULL)
return;
@@ -418,8 +414,8 @@ sio_intr_shutdown(arg)
bus_space_write_1(sio_iot, sio_ioh_icu2, 1, initial_ocw1[1]);
(*sio_write_elcr)(0, initial_elcr[0]); /* XXX */
(*sio_write_elcr)(1, initial_elcr[1]); /* XXX */
-}
#endif
+}
const char *
sio_intr_string(v, irq)
diff --git a/sys/arch/alpha/pci/siovar.h b/sys/arch/alpha/pci/siovar.h
index ca5e6937480..c07b899904e 100644
--- a/sys/arch/alpha/pci/siovar.h
+++ b/sys/arch/alpha/pci/siovar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: siovar.h,v 1.14 2010/06/06 11:26:11 miod Exp $ */
+/* $OpenBSD: siovar.h,v 1.15 2014/02/18 19:37:33 miod Exp $ */
/* $NetBSD: siovar.h,v 1.5 1996/10/23 04:12:34 cgd Exp $ */
/*
@@ -31,6 +31,7 @@
#include <sys/evcount.h>
void sio_intr_setup(pci_chipset_tag_t, bus_space_tag_t);
+void sio_intr_shutdown(void);
void sio_iointr(void *framep, unsigned long vec);
const char *sio_intr_string(void *, int);