summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorbde <bde@FreeBSD.org>2002-03-31 09:15:43 +0000
committerbde <bde@FreeBSD.org>2002-03-31 09:15:43 +0000
commitdf30d6374fe92f59350770d63cd31f77979006da (patch)
treef8c2f5ed93e3f204296bb031ae818b3c8d00238f /sys
parentcf12629bdcf1d3d01898f867636181c50222eca8 (diff)
downloadFreeBSD-src-df30d6374fe92f59350770d63cd31f77979006da.zip
FreeBSD-src-df30d6374fe92f59350770d63cd31f77979006da.tar.gz
Support more than 32 sio unit numbers. The maximum unit number is now
(65536 * 32 - 1), but MAKEDEV only supports up to (32 * 32 -1). Device names use the unit number in base 32 for all "digits". This required fixing an old bug in MAKEDEV:ttyminor(). Its arg was the global $unit instead of $1. Reminded by: Valentin K. Ponomarenko <valka@krog.ukrtel.net> MFC-after: 1 week
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/sio/sio.c20
1 files changed, 12 insertions, 8 deletions
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