Deleted Added
full compact
sio.c (51202) sio.c (51654)
1/*-
2 * Copyright (c) 1991 The Regents of the University of California.
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 16 unchanged lines hidden (view full) ---

25 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
32 *
1/*-
2 * Copyright (c) 1991 The Regents of the University of California.
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 16 unchanged lines hidden (view full) ---

25 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
32 *
33 * $FreeBSD: head/sys/pc98/cbus/sio.c 51202 1999-09-12 13:44:54Z nyan $
33 * $FreeBSD: head/sys/pc98/cbus/sio.c 51654 1999-09-25 16:21:39Z phk $
34 * from: @(#)com.c 7.5 (Berkeley) 5/16/91
35 * from: i386/isa sio.c,v 1.234
36 */
37
38#include "opt_comconsole.h"
39#include "opt_compat.h"
40#include "opt_ddb.h"
41#include "opt_sio.h"

--- 206 unchanged lines hidden (view full) ---

248/*
249 * com state bits.
250 * (CS_BUSY | CS_TTGO) and (CS_BUSY | CS_TTGO | CS_ODEVREADY) must be higher
251 * than the other bits so that they can be tested as a group without masking
252 * off the low bits.
253 *
254 * The following com and tty flags correspond closely:
255 * CS_BUSY = TS_BUSY (maintained by comstart(), siopoll() and
34 * from: @(#)com.c 7.5 (Berkeley) 5/16/91
35 * from: i386/isa sio.c,v 1.234
36 */
37
38#include "opt_comconsole.h"
39#include "opt_compat.h"
40#include "opt_ddb.h"
41#include "opt_sio.h"

--- 206 unchanged lines hidden (view full) ---

248/*
249 * com state bits.
250 * (CS_BUSY | CS_TTGO) and (CS_BUSY | CS_TTGO | CS_ODEVREADY) must be higher
251 * than the other bits so that they can be tested as a group without masking
252 * off the low bits.
253 *
254 * The following com and tty flags correspond closely:
255 * CS_BUSY = TS_BUSY (maintained by comstart(), siopoll() and
256 * siostop())
256 * comstop())
257 * CS_TTGO = ~TS_TTSTOP (maintained by comparam() and comstart())
258 * CS_CTS_OFLOW = CCTS_OFLOW (maintained by comparam())
259 * CS_RTS_IFLOW = CRTS_IFLOW (maintained by comparam())
260 * TS_FLUSH is not used.
261 * XXX I think TIOCSETA doesn't clear TS_TTSTOP when it clears IXON.
262 * XXX CS_*FLOW should be CF_*FLOW in com->flags (control flags not state).
263 */
264#define CS_BUSY 0x80 /* output in progress */

--- 157 unchanged lines hidden (view full) ---

422static void siointr __P((void *arg));
423static int commctl __P((struct com_s *com, int bits, int how));
424static int comparam __P((struct tty *tp, struct termios *t));
425static swihand_t siopoll;
426static int sioprobe __P((device_t dev));
427static void siosettimeout __P((void));
428static int siosetwater __P((struct com_s *com, speed_t speed));
429static void comstart __P((struct tty *tp));
257 * CS_TTGO = ~TS_TTSTOP (maintained by comparam() and comstart())
258 * CS_CTS_OFLOW = CCTS_OFLOW (maintained by comparam())
259 * CS_RTS_IFLOW = CRTS_IFLOW (maintained by comparam())
260 * TS_FLUSH is not used.
261 * XXX I think TIOCSETA doesn't clear TS_TTSTOP when it clears IXON.
262 * XXX CS_*FLOW should be CF_*FLOW in com->flags (control flags not state).
263 */
264#define CS_BUSY 0x80 /* output in progress */

--- 157 unchanged lines hidden (view full) ---

422static void siointr __P((void *arg));
423static int commctl __P((struct com_s *com, int bits, int how));
424static int comparam __P((struct tty *tp, struct termios *t));
425static swihand_t siopoll;
426static int sioprobe __P((device_t dev));
427static void siosettimeout __P((void));
428static int siosetwater __P((struct com_s *com, speed_t speed));
429static void comstart __P((struct tty *tp));
430static void comstop __P((struct tty *tp, int rw));
430static timeout_t comwakeup;
431static void disc_optim __P((struct tty *tp, struct termios *t,
432 struct com_s *com));
433
434
435static char driver_name[] = "sio";
436
437/* table and macro for fast conversion from a unit number to its com struct */

--- 15 unchanged lines hidden (view full) ---

453 sizeof(struct com_s),
454};
455
456static d_open_t sioopen;
457static d_close_t sioclose;
458static d_read_t sioread;
459static d_write_t siowrite;
460static d_ioctl_t sioioctl;
431static timeout_t comwakeup;
432static void disc_optim __P((struct tty *tp, struct termios *t,
433 struct com_s *com));
434
435
436static char driver_name[] = "sio";
437
438/* table and macro for fast conversion from a unit number to its com struct */

--- 15 unchanged lines hidden (view full) ---

454 sizeof(struct com_s),
455};
456
457static d_open_t sioopen;
458static d_close_t sioclose;
459static d_read_t sioread;
460static d_write_t siowrite;
461static d_ioctl_t sioioctl;
461static d_stop_t siostop;
462static d_devtotty_t siodevtotty;
463
464#define CDEV_MAJOR 28
465static struct cdevsw sio_cdevsw = {
466 /* open */ sioopen,
467 /* close */ sioclose,
468 /* read */ sioread,
469 /* write */ siowrite,
470 /* ioctl */ sioioctl,
462
463#define CDEV_MAJOR 28
464static struct cdevsw sio_cdevsw = {
465 /* open */ sioopen,
466 /* close */ sioclose,
467 /* read */ sioread,
468 /* write */ siowrite,
469 /* ioctl */ sioioctl,
471 /* stop */ siostop,
470 /* stop */ nostop,
472 /* reset */ noreset,
471 /* reset */ noreset,
473 /* devtotty */ siodevtotty,
474 /* poll */ ttpoll,
472 /* devtotty */ nodevtotty,
473 /* poll */ ttypoll,
475 /* mmap */ nommap,
476 /* strategy */ nostrategy,
477 /* name */ driver_name,
478 /* parms */ noparms,
479 /* maj */ CDEV_MAJOR,
480 /* dump */ nodump,
481 /* psize */ nopsize,
482 /* flags */ D_TTY,

--- 1458 unchanged lines hidden (view full) ---

1941 } else {
1942 /*
1943 * The device isn't open, so there are no conflicts.
1944 * Initialize it. Initialization is done twice in many
1945 * cases: to preempt sleeping callin opens if we are
1946 * callout, and to complete a callin open after DCD rises.
1947 */
1948 tp->t_oproc = comstart;
474 /* mmap */ nommap,
475 /* strategy */ nostrategy,
476 /* name */ driver_name,
477 /* parms */ noparms,
478 /* maj */ CDEV_MAJOR,
479 /* dump */ nodump,
480 /* psize */ nopsize,
481 /* flags */ D_TTY,

--- 1458 unchanged lines hidden (view full) ---

1940 } else {
1941 /*
1942 * The device isn't open, so there are no conflicts.
1943 * Initialize it. Initialization is done twice in many
1944 * cases: to preempt sleeping callin opens if we are
1945 * callout, and to complete a callin open after DCD rises.
1946 */
1947 tp->t_oproc = comstart;
1948 tp->t_stop = comstop;
1949 tp->t_param = comparam;
1950 tp->t_dev = dev;
1951 tp->t_termios = mynor & CALLOUT_MASK
1952 ? com->it_out : com->it_in;
1953#ifdef PC98
1954 if (!IS_8251(com->pc98_if_type))
1955#endif
1956 (void)commctl(com, TIOCM_DTR | TIOCM_RTS, DMSET);

--- 165 unchanged lines hidden (view full) ---

2122 com = com_addr(MINOR_TO_UNIT(mynor));
2123 tp = com->tp;
2124 s = spltty();
2125 (*linesw[tp->t_line].l_close)(tp, flag);
2126#ifdef PC98
2127 com->modem_checking = 0;
2128#endif
2129 disc_optim(tp, &tp->t_termios, com);
1949 tp->t_param = comparam;
1950 tp->t_dev = dev;
1951 tp->t_termios = mynor & CALLOUT_MASK
1952 ? com->it_out : com->it_in;
1953#ifdef PC98
1954 if (!IS_8251(com->pc98_if_type))
1955#endif
1956 (void)commctl(com, TIOCM_DTR | TIOCM_RTS, DMSET);

--- 165 unchanged lines hidden (view full) ---

2122 com = com_addr(MINOR_TO_UNIT(mynor));
2123 tp = com->tp;
2124 s = spltty();
2125 (*linesw[tp->t_line].l_close)(tp, flag);
2126#ifdef PC98
2127 com->modem_checking = 0;
2128#endif
2129 disc_optim(tp, &tp->t_termios, com);
2130 siostop(tp, FREAD | FWRITE);
2130 comstop(tp, FREAD | FWRITE);
2131 comhardclose(com);
2132 ttyclose(tp);
2133 siosettimeout();
2134 splx(s);
2135 if (com->gone) {
2136 printf("sio%d: gone\n", com->unit);
2137 s = spltty();
2138 if (com->ibuf != NULL)

--- 1468 unchanged lines hidden (view full) ---

3607/* if(IS_8251(com->pc98_if_type))
3608 com_int_Tx_enable(com); */
3609#endif
3610 ttwwakeup(tp);
3611 splx(s);
3612}
3613
3614static void
2131 comhardclose(com);
2132 ttyclose(tp);
2133 siosettimeout();
2134 splx(s);
2135 if (com->gone) {
2136 printf("sio%d: gone\n", com->unit);
2137 s = spltty();
2138 if (com->ibuf != NULL)

--- 1468 unchanged lines hidden (view full) ---

3607/* if(IS_8251(com->pc98_if_type))
3608 com_int_Tx_enable(com); */
3609#endif
3610 ttwwakeup(tp);
3611 splx(s);
3612}
3613
3614static void
3615siostop(tp, rw)
3615comstop(tp, rw)
3616 struct tty *tp;
3617 int rw;
3618{
3619 struct com_s *com;
3620#ifdef PC98
3621 int port_shift = 0;
3622 int rsa98_tmp = 0;
3623#endif

--- 49 unchanged lines hidden (view full) ---

3673#endif
3674 com_events -= (com->iptr - com->ibuf);
3675 com->iptr = com->ibuf;
3676 }
3677 enable_intr();
3678 comstart(tp);
3679}
3680
3616 struct tty *tp;
3617 int rw;
3618{
3619 struct com_s *com;
3620#ifdef PC98
3621 int port_shift = 0;
3622 int rsa98_tmp = 0;
3623#endif

--- 49 unchanged lines hidden (view full) ---

3673#endif
3674 com_events -= (com->iptr - com->ibuf);
3675 com->iptr = com->ibuf;
3676 }
3677 enable_intr();
3678 comstart(tp);
3679}
3680
3681static struct tty *
3682siodevtotty(dev)
3683 dev_t dev;
3684{
3685 int mynor;
3686 int unit;
3687
3688 mynor = minor(dev);
3689 if (mynor & CONTROL_MASK)
3690 return (NULL);
3691 unit = MINOR_TO_UNIT(mynor);
3692 if ((u_int) unit >= NSIOTOT)
3693 return (NULL);
3694 return (dev->si_tty);
3695}
3696
3697static int
3698commctl(com, bits, how)
3699 struct com_s *com;
3700 int bits;
3701 int how;
3702{
3703 int mcr;
3704 int msr;

--- 1209 unchanged lines hidden ---
3681static int
3682commctl(com, bits, how)
3683 struct com_s *com;
3684 int bits;
3685 int how;
3686{
3687 int mcr;
3688 int msr;

--- 1209 unchanged lines hidden ---