summaryrefslogtreecommitdiffstats
path: root/sys/i386
diff options
context:
space:
mode:
Diffstat (limited to 'sys/i386')
-rw-r--r--sys/i386/i386/conf.c168
-rw-r--r--sys/i386/i386/cons.c7
-rw-r--r--sys/i386/isa/cx.c5
-rw-r--r--sys/i386/isa/cy.c19
-rw-r--r--sys/i386/isa/sio.c41
-rw-r--r--sys/i386/isa/syscons.c63
-rw-r--r--sys/i386/isa/syscons.h11
7 files changed, 191 insertions, 123 deletions
diff --git a/sys/i386/i386/conf.c b/sys/i386/i386/conf.c
index 6372438b..e15e85a 100644
--- a/sys/i386/i386/conf.c
+++ b/sys/i386/i386/conf.c
@@ -42,7 +42,7 @@
* SUCH DAMAGE.
*
* from: @(#)conf.c 5.8 (Berkeley) 5/12/91
- * $Id: conf.c,v 1.66 1995/02/15 12:01:24 jkh Exp $
+ * $Id: conf.c,v 1.67 1995/02/21 04:26:35 jkh Exp $
*/
#include <sys/param.h>
@@ -69,6 +69,7 @@ d_strategy_t swstrategy;
#define nommap (d_mmap_t *)enodev
#define nostrat (d_strategy_t *)enodev
#define nodump (d_dump_t *)enodev
+#define nodevtotty (d_ttycv_t *)nullop
#define nxopen (d_open_t *)enxio
#define nxclose (d_close_t *)enxio
@@ -81,6 +82,7 @@ d_strategy_t swstrategy;
#define nxreset (d_reset_t *)enxio
#define nxselect (d_select_t *)enxio
#define nxmmap (d_mmap_t *)enxio
+#define nxdevtotty (d_ttycv_t *)nullop
#define nullopen (d_open_t *)nullop
#define nullclose (d_close_t *)nullop
@@ -352,17 +354,19 @@ int nblkdev = sizeof (bdevsw) / sizeof (bdevsw[0]);
d_open_t scopen;
d_close_t scclose;
d_rdwr_t scread, scwrite;
+d_select_t scselect;
d_ioctl_t scioctl;
d_mmap_t scmmap;
-extern struct tty sccons[];
+d_ttycv_t scdevtotty;
#else
#define scopen nxopen
#define scclose nxclose
#define scread nxread
#define scwrite nxwrite
+#define scselect nxselect
#define scioctl nxioctl
#define scmmap nxmmap
-#define sccons NULL
+#define scdevtotty nxdevtotty
#endif
/* controlling TTY */
@@ -371,6 +375,7 @@ d_rdwr_t cttyread;
d_rdwr_t cttywrite;
d_ioctl_t cttyioctl;
d_select_t cttyselect;
+d_ttycv_t cttydevtotty;
/* /dev/mem */
d_open_t mmopen;
@@ -383,28 +388,31 @@ d_mmap_t memmmap;
#if NPTY > 0
d_open_t ptsopen;
d_close_t ptsclose;
-d_rdwr_t ptsread, ptswrite;
+d_rdwr_t ptsread;
+d_rdwr_t ptswrite;
d_stop_t ptsstop;
+d_select_t ptsselect;
d_open_t ptcopen;
d_close_t ptcclose;
d_rdwr_t ptcread;
d_rdwr_t ptcwrite;
d_select_t ptcselect;
+d_ttycv_t ptydevtotty;
d_ioctl_t ptyioctl;
-extern struct tty pt_tty[];
#else
#define ptsopen nxopen
#define ptsclose nxclose
#define ptsread nxread
#define ptswrite nxwrite
+#define ptsselect nxselect
#define ptcopen nxopen
#define ptcclose nxclose
#define ptcread nxread
#define ptcwrite nxwrite
#define ptyioctl nxioctl
-#define pt_tty NULL
#define ptcselect nxselect
#define ptsstop nullstop
+#define ptydevtotty nxdevtotty
#endif
@@ -466,12 +474,14 @@ d_open_t twopen;
d_close_t twclose;
d_rdwr_t twread, twwrite;
d_select_t twselect;
+d_ttycv_t twdevtotty;
#else
#define twopen nxopen
#define twclose nxclose
#define twread nxread
#define twwrite nxwrite
#define twselect nxselect
+#define twdevtotty nxdevtotty
#endif
#include "psm.h"
@@ -589,8 +599,8 @@ d_rdwr_t sioread, siowrite;
d_ioctl_t sioioctl;
d_select_t sioselect;
d_stop_t siostop;
+d_ttycv_t siodevtotty;
#define sioreset nxreset
-extern struct tty sio_tty[];
#else
#define sioopen nxopen
#define sioclose nxclose
@@ -600,7 +610,7 @@ extern struct tty sio_tty[];
#define siostop nxstop
#define sioreset nxreset
#define sioselect nxselect
-#define sio_tty (struct tty *)NULL
+#define siodevtotty nxdevtotty
#endif
#include "su.h"
@@ -702,7 +712,6 @@ d_rdwr_t cxread, cxwrite;
d_ioctl_t cxioctl;
d_select_t cxselect;
d_stop_t cxstop;
-extern struct tty cx_tty[];
#else
#define cxopen nxopen
#define cxclose nxclose
@@ -711,7 +720,6 @@ extern struct tty cx_tty[];
#define cxioctl nxioctl
#define cxstop nxstop
#define cxselect nxselect
-#define cx_tty (struct tty *)NULL
#endif
#include "gp.h"
@@ -797,10 +805,10 @@ d_write_t cywrite;
d_ioctl_t cyioctl;
d_stop_t cystop;
d_select_t cyselect;
+d_ttycv_t cydevtotty;
#define cyreset nxreset
#define cymmap nxmmap
#define cystrategy nxstrategy
-extern struct tty cy_tty[];
#else
#define cyopen nxopen
#define cyclose nxclose
@@ -812,7 +820,7 @@ extern struct tty cy_tty[];
#define cyselect nxselect
#define cymmap nxmmap
#define cystrategy nxstrategy
-#define cy_tty (struct tty *)NULL
+#define cydevtotty nxdevtotty
#endif
#include "ity.h"
@@ -823,8 +831,8 @@ d_read_t ityread;
d_write_t itywrite;
d_ioctl_t ityioctl;
d_select_t ityselect;
+d_ttycv_t itydevtotty;
#define ityreset nxreset
-extern struct tty ity_tty[];
#else
#define ityopen nxopen
#define ityclose nxclose
@@ -833,7 +841,7 @@ extern struct tty ity_tty[];
#define ityioctl nxioctl
#define ityreset nxreset
#define ityselect nxselect
-#define ity_tty (struct tty *)NULL
+#define itydevtotty nxdevtotty
#endif
#include "nic.h"
@@ -906,196 +914,196 @@ d_ioctl_t ispyioctl;
struct cdevsw cdevsw[] =
{
{ cnopen, cnclose, cnread, cnwrite, /*0*/
- cnioctl, nullstop, nullreset, NULL, /* console */
+ cnioctl, nullstop, nullreset, nodevtotty,/* console */
cnselect, nommap, NULL },
{ cttyopen, nullclose, cttyread, cttywrite, /*1*/
- cttyioctl, nullstop, nullreset, NULL, /* tty */
+ cttyioctl, nullstop, nullreset, nodevtotty,/* tty */
cttyselect, nommap, NULL },
{ mmopen, mmclose, mmrw, mmrw, /*2*/
- noioc, nullstop, nullreset, NULL, /* memory */
+ noioc, nullstop, nullreset, nodevtotty,/* memory */
mmselect, memmmap, NULL },
{ wdopen, wdclose, rawread, rawwrite, /*3*/
- wdioctl, nostop, nullreset, NULL, /* wd */
+ wdioctl, nostop, nullreset, nodevtotty,/* wd */
seltrue, nommap, wdstrategy },
{ nullopen, nullclose, rawread, rawwrite, /*4*/
- noioc, nostop, noreset, NULL, /* swap */
+ noioc, nostop, noreset, nodevtotty,/* swap */
noselect, nommap, swstrategy },
{ ptsopen, ptsclose, ptsread, ptswrite, /*5*/
- ptyioctl, ptsstop, nullreset, pt_tty, /* ttyp */
- ttselect, nommap, NULL },
+ ptyioctl, ptsstop, nullreset, ptydevtotty,/* ttyp */
+ ptsselect, nommap, NULL },
{ ptcopen, ptcclose, ptcread, ptcwrite, /*6*/
- ptyioctl, nullstop, nullreset, pt_tty, /* ptyp */
+ ptyioctl, nullstop, nullreset, ptydevtotty,/* ptyp */
ptcselect, nommap, NULL },
{ logopen, logclose, logread, nowrite, /*7*/
- logioctl, nostop, nullreset, NULL, /* klog */
+ logioctl, nostop, nullreset, nodevtotty,/* klog */
logselect, nommap, NULL },
{ bquopen, bquclose, bquread, bquwrite, /*8*/
- bquioctl, nostop, nullreset, NULL, /* tputer */
+ bquioctl, nostop, nullreset, nodevtotty,/* tputer */
bquselect, nommap, NULL },
{ Fdopen, fdclose, rawread, rawwrite, /*9*/
- fdioctl, nostop, nullreset, NULL, /* Fd (!=fd) */
+ fdioctl, nostop, nullreset, nodevtotty,/* Fd (!=fd) */
seltrue, nommap, fdstrategy },
{ wtopen, wtclose, rawread, rawwrite, /*10*/
- wtioctl, nostop, nullreset, NULL, /* wt */
+ wtioctl, nostop, nullreset, nodevtotty,/* wt */
seltrue, nommap, wtstrategy },
{ spigot_open, spigot_close, spigot_read, spigot_write, /*11*/
- spigot_ioctl, nostop, nullreset, NULL, /* Spigot */
+ spigot_ioctl, nostop, nullreset, nodevtotty,/* Spigot */
spigot_select, spigot_mmap, NULL },
{ scopen, scclose, scread, scwrite, /*12*/
- scioctl, nullstop, nullreset, sccons, /* sc */
- ttselect, scmmap, NULL },
+ scioctl, nullstop, nullreset, scdevtotty,/* sc */
+ scselect, scmmap, NULL },
{ sdopen, sdclose, rawread, rawwrite, /*13*/
- sdioctl, nostop, nullreset, NULL, /* sd */
+ sdioctl, nostop, nullreset, nodevtotty,/* sd */
seltrue, nommap, sdstrategy },
{ stopen, stclose, rawread, rawwrite, /*14*/
- stioctl, nostop, nullreset, NULL, /* st */
+ stioctl, nostop, nullreset, nodevtotty,/* st */
seltrue, nommap, ststrategy },
{ cdopen, cdclose, rawread, nowrite, /*15*/
- cdioctl, nostop, nullreset, NULL, /* cd */
+ cdioctl, nostop, nullreset, nodevtotty,/* cd */
seltrue, nommap, cdstrategy },
{ lptopen, lptclose, noread, lptwrite, /*16*/
- lptioctl, nullstop, nullreset, NULL, /* lpt */
+ lptioctl, nullstop, nullreset, nodevtotty,/* lpt */
seltrue, nommap, nostrat},
{ chopen, chclose, noread, nowrite, /*17*/
- chioctl, nostop, nullreset, NULL, /* ch */
+ chioctl, nostop, nullreset, nodevtotty,/* ch */
noselect, nommap, nostrat },
{ suopen, suclose, suread, suwrite, /*18*/
- suioctl, nostop, nullreset, NULL, /* scsi */
+ suioctl, nostop, nullreset, nodevtotty,/* scsi */
suselect, summap, sustrategy }, /* 'generic' */
{ twopen, twclose, twread, twwrite, /*19*/
- noioc, nullstop, nullreset, NULL, /* tw */
+ noioc, nullstop, nullreset, nodevtotty,/* tw */
twselect, nommap, nostrat },
/*
* If you need a cdev major number for a driver that you intend to donate
* back to the group or release publically, please contact the FreeBSD team
- * by sending mail to "FreeBSD-hackers@freefall.cdrom.com".
+ * by sending mail to "hackers@freebsd.org".
* If you assign one yourself it may conflict with someone else.
* Otherwise, simply use the one reserved for local use.
*/
/* character device 20 is reserved for local use */
{ nxopen, nxclose, nxread, /*20*/
nxwrite, nxioctl, nxstop,
- nxreset, NULL, nxselect,
+ nxreset, nxdevtotty, nxselect,
nxmmap, NULL },
{ psmopen, psmclose, psmread, nowrite, /*21*/
- psmioctl, nostop, nullreset, NULL, /* psm mice */
+ psmioctl, nostop, nullreset, nodevtotty,/* psm mice */
psmselect, nommap, NULL },
{ fdopen, noclose, noread, nowrite, /*22*/
- noioc, nostop, nullreset, NULL, /* fd (!=Fd) */
+ noioc, nostop, nullreset, nodevtotty,/* fd (!=Fd) */
noselect, nommap, nostrat },
{ bpfopen, bpfclose, bpfread, bpfwrite, /*23*/
- bpfioctl, nostop, nullreset, NULL, /* bpf */
+ bpfioctl, nostop, nullreset, nodevtotty,/* bpf */
bpfselect, nommap, NULL },
{ pcaopen, pcaclose, noread, pcawrite, /*24*/
- pcaioctl, nostop, nullreset, NULL, /* pcaudio */
+ pcaioctl, nostop, nullreset, nodevtotty,/* pcaudio */
pcaselect, nommap, NULL },
{ vaopen, vaclose, varead, vawrite, /*25*/
- vaioctl, nostop, nullreset, NULL, /* vat */
+ vaioctl, nostop, nullreset, nodevtotty,/* vat */
vaselect, nommap, NULL },
{ spkropen, spkrclose, noread, spkrwrite, /*26*/
- spkrioctl, nostop, nullreset, NULL, /* spkr */
+ spkrioctl, nostop, nullreset, nodevtotty,/* spkr */
seltrue, nommap, NULL },
{ mseopen, mseclose, mseread, nowrite, /*27*/
- noioc, nostop, nullreset, NULL, /* mse */
+ noioc, nostop, nullreset, nodevtotty,/* mse */
mseselect, nommap, NULL },
{ sioopen, sioclose, sioread, siowrite, /*28*/
- sioioctl, siostop, sioreset, sio_tty, /* sio */
+ sioioctl, siostop, sioreset, siodevtotty,/* sio */
sioselect, nommap, NULL },
{ mcdopen, mcdclose, rawread, nowrite, /*29*/
- mcdioctl, nostop, nullreset, NULL, /* mitsumi cd */
+ mcdioctl, nostop, nullreset, nodevtotty,/* mitsumi cd */
seltrue, nommap, mcdstrategy },
{ sndopen, sndclose, sndread, sndwrite, /*30*/
- sndioctl, nostop, nullreset, NULL, /* sound */
+ sndioctl, nostop, nullreset, nodevtotty,/* sound */
sndselect, nommap, NULL },
{ ukopen, ukclose, noread, nowrite, /*31*/
- ukioctl, nostop, nullreset, NULL, /* unknown */
- seltrue, nommap, NULL }, /* scsi */
+ ukioctl, nostop, nullreset, nodevtotty,/* unknown */
+ seltrue, nommap, NULL }, /* scsi */
{ lkmcopen, lkmcclose, noread, nowrite, /*32*/
- lkmcioctl, nostop, nullreset, NULL,
+ lkmcioctl, nostop, nullreset, nodevtotty,
noselect, nommap, NULL },
{ lkmopen, lkmclose, lkmread, lkmwrite, /*33*/
- lkmioctl, lkmstop, lkmreset, NULL,
+ lkmioctl, lkmstop, lkmreset, nodevtotty,
lkmselect, lkmmmap, NULL },
{ lkmopen, lkmclose, lkmread, lkmwrite, /*34*/
- lkmioctl, lkmstop, lkmreset, NULL,
+ lkmioctl, lkmstop, lkmreset, nodevtotty,
lkmselect, lkmmmap, NULL },
{ lkmopen, lkmclose, lkmread, lkmwrite, /*35*/
- lkmioctl, lkmstop, lkmreset, NULL,
+ lkmioctl, lkmstop, lkmreset, nodevtotty,
lkmselect, lkmmmap, NULL },
{ lkmopen, lkmclose, lkmread, lkmwrite, /*36*/
- lkmioctl, lkmstop, lkmreset, NULL,
+ lkmioctl, lkmstop, lkmreset, nodevtotty,
lkmselect, lkmmmap, NULL },
{ lkmopen, lkmclose, lkmread, lkmwrite, /*37*/
- lkmioctl, lkmstop, lkmreset, NULL,
+ lkmioctl, lkmstop, lkmreset, nodevtotty,
lkmselect, lkmmmap, NULL },
{ lkmopen, lkmclose, lkmread, lkmwrite, /*38*/
- lkmioctl, lkmstop, lkmreset, NULL,
+ lkmioctl, lkmstop, lkmreset, nodevtotty,
lkmselect, lkmmmap, NULL },
{ apmopen, apmclose, noread, nowrite, /*39*/
- apmioctl, nostop, nullreset, NULL, /* laptop APM */
+ apmioctl, nostop, nullreset, nodevtotty,/* APM */
seltrue, nommap, NULL },
{ ctxopen, ctxclose, ctxread, ctxwrite, /*40*/
- ctxioctl, nostop, nullreset, NULL, /* cortex */
+ ctxioctl, nostop, nullreset, nodevtotty,/* cortex */
seltrue, nommap, NULL },
{ sockopen, sockclose, noread, nowrite, /*41*/
- sockioctl, nostop, nullreset, NULL, /* socksys */
+ sockioctl, nostop, nullreset, nodevtotty,/* socksys */
seltrue, nommap, NULL },
{ cxopen, cxclose, cxread, cxwrite, /*42*/
- cxioctl, cxstop, nullreset, cx_tty, /* cronyx */
+ cxioctl, cxstop, nullreset, nodevtotty,/* cronyx */
cxselect, nommap, NULL },
{ vnopen, vnclose, rawread, rawwrite, /*43*/
- vnioctl, nostop, nullreset, NULL, /* vn */
+ vnioctl, nostop, nullreset, nodevtotty,/* vn */
seltrue, nommap, vnstrategy },
{ gpopen, gpclose, noread, gpwrite, /*44*/
- gpioctl, nostop, nullreset, NULL, /* GPIB */
+ gpioctl, nostop, nullreset, nodevtotty,/* GPIB */
seltrue, nommap, NULL },
{ scdopen, scdclose, rawread, nowrite, /*45*/
- scdioctl, nostop, nullreset, NULL, /* sony cd */
+ scdioctl, nostop, nullreset, nodevtotty,/* sony cd */
seltrue, nommap, scdstrategy },
{ pcdopen, pcdclose, rawread, nowrite, /*46*/
- pcdioctl, nostop, nullreset, NULL, /* pana cd */
+ pcdioctl, nostop, nullreset, nodevtotty,/* pana cd */
seltrue, nommap, pcdstrategy },
{ gscopen, gscclose, gscread, nowrite, /*47*/
- gscioctl, nostop, nullreset, NULL, /* gsc */
+ gscioctl, nostop, nullreset, nodevtotty,/* gsc */
seltrue, nommap, NULL },
{ cyopen, cyclose, cyread, cywrite, /*48*/
- cyioctl, cystop, cyreset, cy_tty,
- cyselect, cymmap, cystrategy }, /* cyclades */
+ cyioctl, cystop, cyreset, cydevtotty,/*cyclades*/
+ cyselect, cymmap, cystrategy },
{ sscopen, sscclose, sscread, sscwrite, /*49*/
- sscioctl, nostop, nullreset, NULL, /* scsi super */
+ sscioctl, nostop, nullreset, nodevtotty,/* scsi super */
sscselect, sscmmap, sscstrategy },
{ nxopen, nxclose, nxread, nxwrite, /*50*/
- nxioctl, nxstop, nxreset, NULL, /* pcmcia */
+ nxioctl, nxstop, nxreset, nodevtotty,/* pcmcia */
nxselect, nxmmap, NULL },
{ joyopen, joyclose, joyread, nowrite, /*51*/
- joyioctl, nostop, nullreset, NULL, /*joystick */
+ joyioctl, nostop, nullreset, nodevtotty,/*joystick */
seltrue, nommap, NULL},
{ tunopen, tunclose, tunread, tunwrite, /*52*/
- tunioctl, nostop, nullreset, NULL, /* tunnel */
+ tunioctl, nostop, nullreset, nodevtotty,/* tunnel */
tunselect, nommap, NULL },
{ snpopen, snpclose, snpread, nowrite, /*53*/
- snpioctl, nostop, nullreset, NULL, /* snoop */
+ snpioctl, nostop, nullreset, nodevtotty,/* snoop */
snpselect, nommap, NULL },
{ nicopen, nicclose, noread, nowrite, /*54*/
- nicioctl, nostop, nullreset, NULL, /* nic */
+ nicioctl, nostop, nullreset, nodevtotty,/* nic */
seltrue, nommap, NULL },
{ isdnopen, isdnclose, isdnread, nowrite, /*55*/
- isdnioctl, nostop, nullreset, NULL, /* isdn */
+ isdnioctl, nostop, nullreset, nodevtotty,/* isdn */
seltrue, nommap, NULL },
{ ityopen, ityclose, ityread, itywrite, /*56*/
- ityioctl, nostop, ityreset, ity_tty,/* ity */
+ ityioctl, nostop, ityreset, itydevtotty,/* ity */
ityselect, nommap, NULL },
{ itelopen, itelclose, itelread, itelwrite, /*57*/
- itelioctl, nostop, nullreset, NULL, /* itel */
+ itelioctl, nostop, nullreset, nodevtotty,/* itel */
seltrue, nommap, NULL },
{ nxopen, nxclose, nxread, nxwrite, /*58*/
- nxioctl, nxstop, nxreset, NULL, /* unused */
+ nxioctl, nxstop, nxreset, nxdevtotty,/* unused */
seltrue, nxmmap, NULL },
{ ispyopen, ispyclose, ispyread, nowrite, /*59*/
- ispyioctl, nostop, nullreset, NULL, /* ispy */
+ ispyioctl, nostop, nullreset, nodevtotty,/* ispy */
seltrue, nommap, NULL },
{ nnicopen, nnicclose, noread, nowrite, /*60*/
- nnicioctl, nostop, nullreset, NULL, /* nnic */
+ nnicioctl, nostop, nullreset, nodevtotty,/* nnic */
seltrue, nommap, NULL },
};
int nchrdev = sizeof (cdevsw) / sizeof (cdevsw[0]);
diff --git a/sys/i386/i386/cons.c b/sys/i386/i386/cons.c
index 611cfdb..9e0f47f 100644
--- a/sys/i386/i386/cons.c
+++ b/sys/i386/i386/cons.c
@@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* from: @(#)cons.c 7.2 (Berkeley) 5/9/91
- * $Id: cons.c,v 1.20 1995/01/21 14:12:15 bde Exp $
+ * $Id: cons.c,v 1.21 1995/01/23 18:46:13 davidg Exp $
*/
#include <sys/param.h>
@@ -229,7 +229,10 @@ cnselect(dev, rw, p)
{
if (cn_tab == NULL)
return (1);
- return (ttselect(cn_tab->cn_dev, rw, p));
+
+ dev = cn_tab->cn_dev;
+
+ return ((*cdevsw[major(dev)].d_select)(dev, rw, p));
}
int
diff --git a/sys/i386/isa/cx.c b/sys/i386/isa/cx.c
index f1729b6..f7a53fe 100644
--- a/sys/i386/isa/cx.c
+++ b/sys/i386/isa/cx.c
@@ -678,12 +678,7 @@ int cxselect (dev_t dev, int flag, struct proc *p)
if (unit == UNIT_CTL)
return (0);
-#ifdef __FreeBSD__
- return (ttselect (dev, flag, p));
-#endif
-#ifdef __bsdi__
return (ttyselect (cxchan[unit]->ttyp, flag, p));
-#endif
}
/*
diff --git a/sys/i386/isa/cy.c b/sys/i386/isa/cy.c
index 3bd203b..ff67eb4 100644
--- a/sys/i386/isa/cy.c
+++ b/sys/i386/isa/cy.c
@@ -27,7 +27,7 @@
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * $Id: cy.c,v 1.1 1995/02/09 09:47:27 jkh Exp $
+ * $Id: cy.c,v 1.2 1995/02/15 18:41:41 bde Exp $
*/
/*
@@ -1500,13 +1500,26 @@ cystop(struct tty *tp, int flag)
return 0;
}
+struct tty *
+cydevtotty(dev_t dev)
+{
+ u_char unit = UNIT(dev);
+
+ if (unit >= /* NCY * ? */ PORTS_PER_CYCLOM)
+ return NULL;
+
+ return info[unit]->tty;
+}
int
cyselect(dev_t dev, int rw, struct proc *p)
{
- return (ttselect(UNIT(dev), rw, p));
-} /* end of cyselect() */
+ u_char unit = UNIT(dev);
+ if (unit >= /* NCY * ? */ PORTS_PER_CYCLOM)
+ return (ENXIO);
+ return (ttyselect(info[unit]->tty, rw, p));
+}
int
cyspeed(int speed, int *prescaler_io)
diff --git a/sys/i386/isa/sio.c b/sys/i386/isa/sio.c
index c284150..39bec6d 100644
--- a/sys/i386/isa/sio.c
+++ b/sys/i386/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
diff --git a/sys/i386/isa/syscons.c b/sys/i386/isa/syscons.c
index 1671125..379776b 100644
--- a/sys/i386/isa/syscons.c
+++ b/sys/i386/isa/syscons.c
@@ -25,10 +25,11 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * $Id$
+ * $Id: syscons.c,v 1.104 1995/02/22 13:40:19 sos Exp $
*/
#include "sc.h"
+#include "apm.h"
#if NSC > 0
#include <sys/param.h>
#include <sys/systm.h>
@@ -50,6 +51,7 @@
#include <machine/psl.h>
#include <machine/frame.h>
#include <machine/pc/display.h>
+#include <machine/apm_bios.h>
#include <i386/isa/isa.h>
#include <i386/isa/isa_device.h>
@@ -61,10 +63,6 @@
#if !defined(MAXCONS)
#define MAXCONS 16
#endif
-#include "apm.h"
-#if NAPM > 0
-#include "machine/apm_bios.h"
-#endif
/* this may break on older VGA's but is usefull on real 32 bit systems */
#define bcopyw bcopy
@@ -218,6 +216,19 @@ sc_registerdev(struct isa_device *id)
dev_attach(&kdc_sc[id->id_unit]);
}
+#if NAPM > 0
+static int
+scresume(void *dummy)
+{
+ shfts = 0;
+ ctls = 0;
+ alts = 0;
+ agrs = 0;
+ metas = 0;
+ return 0;
+}
+#endif
+
int
scattach(struct isa_device *dev)
{
@@ -267,7 +278,7 @@ scattach(struct isa_device *dev)
update_leds(scp->status);
sc_registerdev(dev);
#if NAPM > 0
- scp->r_hook.ah_fun = pcresume;
+ scp->r_hook.ah_fun = scresume;
scp->r_hook.ah_arg = NULL;
scp->r_hook.ah_name = "system keyboard";
scp->r_hook.ah_order = APM_MID_ORDER;
@@ -276,8 +287,8 @@ scattach(struct isa_device *dev)
return 0;
}
-static struct tty
-*get_tty_ptr(dev_t dev)
+struct tty
+*scdevtotty(dev_t dev)
{
int unit = minor(dev);
@@ -288,6 +299,17 @@ static struct tty
return VIRTUAL_TTY(unit);
}
+int
+scselect(dev_t dev, int rw, struct proc *p)
+{
+ struct tty *tp = scdevtotty(dev);
+
+ if (tp == NULL)
+ return(ENXIO);
+
+ return (ttyselect(tp, rw, p));
+}
+
static scr_stat
*get_scr_stat(dev_t dev)
{
@@ -313,7 +335,7 @@ get_scr_num()
int
scopen(dev_t dev, int flag, int mode, struct proc *p)
{
- struct tty *tp = get_tty_ptr(dev);
+ struct tty *tp = scdevtotty(dev);
if (!tp)
return(ENXIO);
@@ -344,7 +366,7 @@ scopen(dev_t dev, int flag, int mode, struct proc *p)
int
scclose(dev_t dev, int flag, int mode, struct proc *p)
{
- struct tty *tp = get_tty_ptr(dev);
+ struct tty *tp = scdevtotty(dev);
struct scr_stat *scp;
if (!tp)
@@ -379,7 +401,7 @@ scclose(dev_t dev, int flag, int mode, struct proc *p)
int
scread(dev_t dev, struct uio *uio, int flag)
{
- struct tty *tp = get_tty_ptr(dev);
+ struct tty *tp = scdevtotty(dev);
if (!tp)
return(ENXIO);
@@ -389,7 +411,7 @@ scread(dev_t dev, struct uio *uio, int flag)
int
scwrite(dev_t dev, struct uio *uio, int flag)
{
- struct tty *tp = get_tty_ptr(dev);
+ struct tty *tp = scdevtotty(dev);
if (!tp)
return(ENXIO);
@@ -458,7 +480,7 @@ scioctl(dev_t dev, int cmd, caddr_t data, int flag, struct proc *p)
struct trapframe *fp;
scr_stat *scp;
- tp = get_tty_ptr(dev);
+ tp = scdevtotty(dev);
if (!tp)
return ENXIO;
scp = get_scr_stat(tp->t_dev);
@@ -1050,7 +1072,7 @@ set_mouse_pos:
void
scxint(dev_t dev)
{
- struct tty *tp = get_tty_ptr(dev);
+ struct tty *tp = scdevtotty(dev);
if (!tp)
return;
@@ -1094,19 +1116,6 @@ scstart(struct tty *tp)
splx(s);
}
-#if NAPM > 0
-static int
-scresume(void *dummy)
-{
- shfts = 0;
- ctls = 0;
- alts = 0;
- agrs = 0;
- metas = 0;
- return 0;
-}
-#endif
-
void
pccnprobe(struct consdev *cp)
{
diff --git a/sys/i386/isa/syscons.h b/sys/i386/isa/syscons.h
index 546b2de..60cf84e 100644
--- a/sys/i386/isa/syscons.h
+++ b/sys/i386/isa/syscons.h
@@ -25,9 +25,16 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * $Id$
+ * $Id: syscons.h,v 1.1 1995/02/22 13:40:21 sos Exp $
*/
+/*
+ * The APM stuff is -not- under conditional compilation because we don't want
+ * the size of the scr_stat structure to vary depending upon if APM has been
+ * compiled in or not, that can cause utilities and lkms to crash!
+ */
+#include <machine/apm_bios.h>
+
/* vm things */
#define ISMAPPED(pa, width) \
(((pa) <= (u_long)0x1000 - (width)) \
@@ -140,9 +147,7 @@ typedef struct scr_stat {
u_short *history_pos; /* position shown on screen */
u_short *history_save; /* save area index */
int history_size; /* size of history buffer */
-#if NAPM > 0
struct apmhook r_hook; /* reconfiguration support */
-#endif
} scr_stat;
typedef struct default_attr {
OpenPOWER on IntegriCloud