summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/ic/z8530sc.h8
-rw-r--r--sys/dev/ic/z8530tty.c27
2 files changed, 32 insertions, 3 deletions
diff --git a/sys/dev/ic/z8530sc.h b/sys/dev/ic/z8530sc.h
index 73a6fce4f26..2d547298669 100644
--- a/sys/dev/ic/z8530sc.h
+++ b/sys/dev/ic/z8530sc.h
@@ -1,4 +1,4 @@
-/* $NetBSD: z8530sc.h,v 1.12 1999/03/27 01:22:36 wrstuden Exp $ */
+/* $NetBSD: z8530sc.h,v 1.13 2000/03/14 21:20:52 jdc Exp $ */
/*
* Copyright (c) 1994 Gordon W. Ross
@@ -113,6 +113,12 @@ struct zs_chanstate {
char cs_softreq; /* need soft interrupt call */
char cs_spare1; /* (for skippy :) */
+
+ /* power management hooks */
+ int (*enable) __P((struct zs_chanstate *));
+ void (*disable) __P((struct zs_chanstate *));
+ int enabled;
+
/* MD code might define a larger variant of this. */
};
diff --git a/sys/dev/ic/z8530tty.c b/sys/dev/ic/z8530tty.c
index 2dd01f303e9..8a2bdfa2c9a 100644
--- a/sys/dev/ic/z8530tty.c
+++ b/sys/dev/ic/z8530tty.c
@@ -1,4 +1,4 @@
-/* $NetBSD: z8530tty.c,v 1.62 1999/11/04 05:33:59 jonathan Exp $ */
+/* $NetBSD: z8530tty.c,v 1.63 2000/03/14 21:20:52 jdc Exp $ */
/*-
* Copyright (c) 1993, 1994, 1995, 1996, 1997, 1998, 1999
@@ -325,7 +325,10 @@ zstty_attach(parent, self, aux)
zst->zst_rbget = zst->zst_rbput = zst->zst_rbuf;
zst->zst_rbavail = zstty_rbuf_size;
- /* XXX - Do we need an MD hook here? */
+ /* if there are no enable/disable functions, assume the device
+ is always enabled */
+ if (!cs->enable)
+ cs->enabled = 1;
/*
* Hardware init
@@ -435,6 +438,15 @@ zs_shutdown(zst)
zs_write_reg(cs, 1, cs->cs_creg[1]);
}
+ /* Call the power management hook. */
+ if (cs->disable) {
+#ifdef DIAGNOSTIC
+ if (!cs->enabled)
+ panic("zs_shutdown: not enabled?");
+#endif
+ (*cs->disable)(zst->zst_cs);
+ }
+
splx(s);
}
@@ -482,6 +494,17 @@ zsopen(dev, flags, mode, p)
tp->t_dev = dev;
+ /* Call the power management hook. */
+ if (cs->enable) {
+ if ((*cs->enable)(cs)) {
+ splx(s2);
+ splx(s);
+ printf("%s: device enable failed\n",
+ zst->zst_dev.dv_xname);
+ return (EIO);
+ }
+ }
+
/*
* Initialize the termios status to the defaults. Add in the
* sticky bits from TIOCSFLAGS.