summaryrefslogtreecommitdiffstats
path: root/sys/isa/sio.c
diff options
context:
space:
mode:
authorpst <pst@FreeBSD.org>1995-02-25 20:09:44 +0000
committerpst <pst@FreeBSD.org>1995-02-25 20:09:44 +0000
commit1dcb420b646ff6fd0ab578e340fd7f26b32ed79d (patch)
tree1f0482b969de4dd457ac5b450c026dcaab6317e2 /sys/isa/sio.c
parent04958419e842202587df95082c8717fe0b164213 (diff)
downloadFreeBSD-src-1dcb420b646ff6fd0ab578e340fd7f26b32ed79d.zip
FreeBSD-src-1dcb420b646ff6fd0ab578e340fd7f26b32ed79d.tar.gz
(a) remove the pointer to each driver's tty structure array from cdevsw
(b) add a function callback vector to tty drivers that will return a pointer to a valid tty structure based upon a dev_t (c) make syscons structures the same size whether or not APM is enabled so utilities don't crash if NAPM changes (and make the damn kernel compile!) (d) rewrite /dev/snp ioctl interface so that it is device driver and i386 independant
Diffstat (limited to 'sys/isa/sio.c')
-rw-r--r--sys/isa/sio.c41
1 files changed, 38 insertions, 3 deletions
diff --git a/sys/isa/sio.c b/sys/isa/sio.c
index c284150..39bec6d 100644
--- a/sys/isa/sio.c
+++ b/sys/isa/sio.c
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* from: @(#)com.c 7.5 (Berkeley) 5/16/91
- * $Id: sio.c,v 1.65 1995/01/20 07:34:15 wpaul Exp $
+ * $Id: sio.c,v 1.66 1995/02/24 00:11:01 ache Exp $
*/
#include "sio.h"
@@ -1819,15 +1819,50 @@ siostop(tp, rw)
enable_intr();
}
+struct tty *
+siodevtotty(dev)
+ dev_t dev;
+{
+ register int mynor, unit;
+ struct com_s *com;
+
+ mynor = minor(dev);
+ if (mynor & CONTROL_MASK)
+ return NULL;
+
+ unit = MINOR_TO_UNIT(mynor);
+ if (unit >= NSIO)
+ return NULL;
+
+ com = com_addr(unit);
+ if (com == NULL)
+ return NULL;
+
+ return com->tp;
+}
+
int
sioselect(dev, rw, p)
dev_t dev;
int rw;
struct proc *p;
{
- if (minor(dev) & CONTROL_MASK)
+ register int mynor, unit;
+ struct com_s *com;
+
+ mynor = minor(dev);
+ if (mynor & CONTROL_MASK)
return (ENODEV);
- return (ttselect(dev & ~MINOR_MAGIC_MASK, rw, p));
+
+ unit = MINOR_TO_UNIT(mynor);
+ if (unit >= NSIO)
+ return (ENXIO);
+
+ com = com_addr(unit);
+ if (com == NULL)
+ return (ENXIO);
+
+ return (ttyselect(com->tp, rw, p));
}
static void
OpenPOWER on IntegriCloud