summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--etc/MAKEDEV48
-rw-r--r--sys/dev/sio/sio.c20
2 files changed, 47 insertions, 21 deletions
diff --git a/etc/MAKEDEV b/etc/MAKEDEV
index cc8a1a8..7f13367 100644
--- a/etc/MAKEDEV
+++ b/etc/MAKEDEV
@@ -256,8 +256,8 @@ saminor()
# Convert the last character of a tty name to a minor number.
ttyminor()
{
- case $unit in
- [0-9]) m=$unit;;
+ case $1 in
+ [0-9]) m=$1;;
a) m=10;; b) m=11;; c) m=12;; d) m=13;; e) m=14;; f) m=15;; g) m=16;;
h) m=17;; i) m=18;; j) m=19;; k) m=20;; l) m=21;; m) m=22;; n) m=23;;
o) m=24;; p) m=25;; q) m=26;; r) m=27;; s) m=28;; t) m=29;; u) m=30;;
@@ -1068,22 +1068,44 @@ speaker)
mknod speaker c 26 0
;;
-cuaa?|cua?)
+cua?|cuaa?|cuaa??)
umask 7
- unit=`expr $i : 'cua.*\(.\)$'`
- m=`ttyminor $unit`
- mknod cuaa$unit c 28 $(($m + 128)) uucp:dialer
- mknod cuaia$unit c 28 $(($m + 32 + 128)) uucp:dialer
- mknod cuala$unit c 28 $(($m + 64 + 128)) uucp:dialer
+ unit_low=`expr $i : 'cua.*\(.\)$'`
+ case $i in
+ cua?|cuaa?)
+ unit_high=""
+ m_high=0
+ ;;
+ cuaa??)
+ unit_high=`expr $i : 'cuaa\(.\).$'`
+ m_high=`ttyminor $unit_high`
+ ;;
+ esac
+ unit=$unit_high$unit_low
+ m=$(($m_high << 16 | `ttyminor $unit_low`))
+ mknod cuaa$unit c 28 $(($m | 128)) uucp:dialer
+ mknod cuaia$unit c 28 $(($m | 32 | 128)) uucp:dialer
+ mknod cuala$unit c 28 $(($m | 64 | 128)) uucp:dialer
umask 77
;;
-tty0?|ttyd?|tty?)
- unit=`expr $i : 'tty.*\(.\)$'`
- m=`ttyminor $unit`
+tty?|tty0?|ttyd?|ttyd??)
+ unit_low=`expr $i : 'tty.*\(.\)$'`
+ case $i in
+ tty?|tty0?|ttyd?)
+ unit_high=""
+ m_high=0
+ ;;
+ ttyd??)
+ unit_high=`expr $i : 'ttyd\(.\).$'`
+ m_high=`ttyminor $unit_high`
+ ;;
+ esac
+ unit=$unit_high$unit_low
+ m=$(($m_high << 16 | `ttyminor $unit_low`))
mknod ttyd$unit c 28 $m
- mknod ttyid$unit c 28 $(($m + 32))
- mknod ttyld$unit c 28 $(($m + 64))
+ mknod ttyid$unit c 28 $(($m | 32))
+ mknod ttyld$unit c 28 $(($m | 64))
;;
cuac?)
diff --git a/sys/dev/sio/sio.c b/sys/dev/sio/sio.c
index 2728e25..11894df 100644
--- a/sys/dev/sio/sio.c
+++ b/sys/dev/sio/sio.c
@@ -93,8 +93,10 @@
#define CONTROL_INIT_STATE 0x20
#define CONTROL_LOCK_STATE 0x40
#define DEV_TO_UNIT(dev) (MINOR_TO_UNIT(minor(dev)))
-#define MINOR_MAGIC_MASK (CALLOUT_MASK | CONTROL_MASK)
-#define MINOR_TO_UNIT(mynor) ((mynor) & ~MINOR_MAGIC_MASK)
+#define MINOR_TO_UNIT(mynor) ((((mynor) & ~0xffffU) >> (8 + 3)) \
+ | ((mynor) & 0x1f))
+#define UNIT_TO_MINOR(unit) ((((unit) & ~0x1fU) << (8 + 3)) \
+ | ((unit) & 0x1f))
#ifdef COM_MULTIPORT
/* checks in flags for multiport and which is multiport "master chip"
@@ -874,6 +876,7 @@ sioattach(dev, xrid, rclk)
Port_t *espp;
#endif
Port_t iobase;
+ int minorbase;
int unit;
u_int flags;
int rid;
@@ -1090,19 +1093,20 @@ determined_type: ;
swi_add(&clk_ithd, "tty:sio", siopoll, NULL, SWI_TTY, 0,
&sio_slow_ih);
}
- com->devs[0] = make_dev(&sio_cdevsw, unit,
+ minorbase = UNIT_TO_MINOR(unit);
+ com->devs[0] = make_dev(&sio_cdevsw, minorbase,
UID_ROOT, GID_WHEEL, 0600, "ttyd%r", unit);
- com->devs[1] = make_dev(&sio_cdevsw, unit | CONTROL_INIT_STATE,
+ com->devs[1] = make_dev(&sio_cdevsw, minorbase | CONTROL_INIT_STATE,
UID_ROOT, GID_WHEEL, 0600, "ttyid%r", unit);
- com->devs[2] = make_dev(&sio_cdevsw, unit | CONTROL_LOCK_STATE,
+ com->devs[2] = make_dev(&sio_cdevsw, minorbase | CONTROL_LOCK_STATE,
UID_ROOT, GID_WHEEL, 0600, "ttyld%r", unit);
- com->devs[3] = make_dev(&sio_cdevsw, unit | CALLOUT_MASK,
+ com->devs[3] = make_dev(&sio_cdevsw, minorbase | CALLOUT_MASK,
UID_UUCP, GID_DIALER, 0660, "cuaa%r", unit);
com->devs[4] = make_dev(&sio_cdevsw,
- unit | CALLOUT_MASK | CONTROL_INIT_STATE,
+ minorbase | CALLOUT_MASK | CONTROL_INIT_STATE,
UID_UUCP, GID_DIALER, 0660, "cuaia%r", unit);
com->devs[5] = make_dev(&sio_cdevsw,
- unit | CALLOUT_MASK | CONTROL_LOCK_STATE,
+ minorbase | CALLOUT_MASK | CONTROL_LOCK_STATE,
UID_UUCP, GID_DIALER, 0660, "cuala%r", unit);
com->flags = flags;
com->pps.ppscap = PPS_CAPTUREASSERT | PPS_CAPTURECLEAR;
OpenPOWER on IntegriCloud