cy.c (38303) | cy.c (38435) |
---|---|
1/*- 2 * cyclades cyclom-y serial driver 3 * Andrew Herbert <andrew@werple.apana.org.au>, 17 August 1993 4 * 5 * Copyright (c) 1993 Andrew Herbert. 6 * All rights reserved. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 13 unchanged lines hidden (view full) --- 22 * NO EVENT SHALL I BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 23 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 24 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 25 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 26 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 27 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 28 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 * | 1/*- 2 * cyclades cyclom-y serial driver 3 * Andrew Herbert <andrew@werple.apana.org.au>, 17 August 1993 4 * 5 * Copyright (c) 1993 Andrew Herbert. 6 * All rights reserved. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 13 unchanged lines hidden (view full) --- 22 * NO EVENT SHALL I BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 23 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 24 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 25 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 26 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 27 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 28 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 * |
30 * $Id: cy.c,v 1.67 1998/08/13 13:54:10 bde Exp $ | 30 * $Id: cy.c,v 1.68 1998/08/13 19:03:22 bde Exp $ |
31 */ 32 33#include "opt_compat.h" 34#include "opt_devfs.h" 35 36#include "cy.h" 37 38/* --- 109 unchanged lines hidden (view full) --- 148 149#define CY_MAX_PORTS (CD1400_NO_OF_CHANNELS * CY_MAX_CD1400s) 150 151/* We encode the cyclom unit number (cyu) in spare bits in the IVR's. */ 152#define CD1400_xIVR_CHAN_SHIFT 3 153#define CD1400_xIVR_CHAN 0x1F 154 155#define LOTS_OF_EVENTS 64 /* helps separate urgent events from input */ | 31 */ 32 33#include "opt_compat.h" 34#include "opt_devfs.h" 35 36#include "cy.h" 37 38/* --- 109 unchanged lines hidden (view full) --- 148 149#define CY_MAX_PORTS (CD1400_NO_OF_CHANNELS * CY_MAX_CD1400s) 150 151/* We encode the cyclom unit number (cyu) in spare bits in the IVR's. */ 152#define CD1400_xIVR_CHAN_SHIFT 3 153#define CD1400_xIVR_CHAN 0x1F 154 155#define LOTS_OF_EVENTS 64 /* helps separate urgent events from input */ |
156#define RB_I_HIGH_WATER (TTYHOG - 2 * RS_IBUFSIZE) | |
157#define RS_IBUFSIZE 256 158 159#define CALLOUT_MASK 0x80 160#define CONTROL_MASK 0x60 161#define CONTROL_INIT_STATE 0x20 162#define CONTROL_LOCK_STATE 0x40 163#define DEV_TO_UNIT(dev) (MINOR_TO_UNIT(minor(dev))) 164#define MINOR_MAGIC_MASK (CALLOUT_MASK | CONTROL_MASK) --- 220 unchanged lines hidden (view full) --- 385 sioioctl, siostop, noreset, siodevtotty, 386 ttpoll, nommap, NULL, driver_name, 387 NULL, -1, 388}; 389 390static int comconsole = -1; 391static speed_t comdefaultrate = TTYDEF_SPEED; 392static u_int com_events; /* input chars + weighted output completions */ | 156#define RS_IBUFSIZE 256 157 158#define CALLOUT_MASK 0x80 159#define CONTROL_MASK 0x60 160#define CONTROL_INIT_STATE 0x20 161#define CONTROL_LOCK_STATE 0x40 162#define DEV_TO_UNIT(dev) (MINOR_TO_UNIT(minor(dev))) 163#define MINOR_MAGIC_MASK (CALLOUT_MASK | CONTROL_MASK) --- 220 unchanged lines hidden (view full) --- 384 sioioctl, siostop, noreset, siodevtotty, 385 ttpoll, nommap, NULL, driver_name, 386 NULL, -1, 387}; 388 389static int comconsole = -1; 390static speed_t comdefaultrate = TTYDEF_SPEED; 391static u_int com_events; /* input chars + weighted output completions */ |
393static bool_t siopoll_registered; | 392static bool_t sio_registered; |
394static int sio_timeout; 395static int sio_timeouts_until_log; 396static struct callout_handle sio_timeout_handle 397 = CALLOUT_HANDLE_INITIALIZER(&sio_timeout_handle); 398#if 0 /* XXX */ 399static struct tty *sio_tty[NSIO]; 400#else 401static struct tty sio_tty[NSIO]; --- 197 unchanged lines hidden (view full) --- 599 termioschars(&com->it_in); 600 com->it_in.c_ispeed = com->it_in.c_ospeed = comdefaultrate; 601 com->it_out = com->it_in; 602 603 s = spltty(); 604 com_addr(unit) = com; 605 splx(s); 606 | 393static int sio_timeout; 394static int sio_timeouts_until_log; 395static struct callout_handle sio_timeout_handle 396 = CALLOUT_HANDLE_INITIALIZER(&sio_timeout_handle); 397#if 0 /* XXX */ 398static struct tty *sio_tty[NSIO]; 399#else 400static struct tty sio_tty[NSIO]; --- 197 unchanged lines hidden (view full) --- 598 termioschars(&com->it_in); 599 com->it_in.c_ispeed = com->it_in.c_ospeed = comdefaultrate; 600 com->it_out = com->it_in; 601 602 s = spltty(); 603 com_addr(unit) = com; 604 splx(s); 605 |
607 dev = makedev(CDEV_MAJOR, 0); 608 cdevsw_add(&dev, &sio_cdevsw, NULL); | |
609#ifdef DEVFS 610 com->devfs_token_ttyd = devfs_add_devswf(&sio_cdevsw, 611 unit, DV_CHR, 612 UID_ROOT, GID_WHEEL, 0600, "ttyc%r%r", adapter, 613 unit % CY_MAX_PORTS); 614 com->devfs_token_ttyi = devfs_add_devswf(&sio_cdevsw, 615 unit | CONTROL_INIT_STATE, DV_CHR, 616 UID_ROOT, GID_WHEEL, 0600, "ttyic%r%r", adapter, --- 12 unchanged lines hidden (view full) --- 629 unit % CY_MAX_PORTS); 630 com->devfs_token_cual = devfs_add_devswf(&sio_cdevsw, 631 unit | CALLOUT_MASK | CONTROL_LOCK_STATE, DV_CHR, 632 UID_UUCP, GID_DIALER, 0660, "cualc%r%r", adapter, 633 unit % CY_MAX_PORTS); 634#endif 635 } 636 } | 606#ifdef DEVFS 607 com->devfs_token_ttyd = devfs_add_devswf(&sio_cdevsw, 608 unit, DV_CHR, 609 UID_ROOT, GID_WHEEL, 0600, "ttyc%r%r", adapter, 610 unit % CY_MAX_PORTS); 611 com->devfs_token_ttyi = devfs_add_devswf(&sio_cdevsw, 612 unit | CONTROL_INIT_STATE, DV_CHR, 613 UID_ROOT, GID_WHEEL, 0600, "ttyic%r%r", adapter, --- 12 unchanged lines hidden (view full) --- 626 unit % CY_MAX_PORTS); 627 com->devfs_token_cual = devfs_add_devswf(&sio_cdevsw, 628 unit | CALLOUT_MASK | CONTROL_LOCK_STATE, DV_CHR, 629 UID_UUCP, GID_DIALER, 0660, "cualc%r%r", adapter, 630 unit % CY_MAX_PORTS); 631#endif 632 } 633 } |
637 if (!siopoll_registered) { | 634 if (!sio_registered) { 635 dev = makedev(CDEV_MAJOR, 0); 636 cdevsw_add(&dev, &sio_cdevsw, NULL); |
638 register_swi(SWI_TTY, siopoll); | 637 register_swi(SWI_TTY, siopoll); |
639 siopoll_registered = TRUE; | 638 sio_registered = TRUE; |
640 } 641 642 /* ensure an edge for the next interrupt */ 643 cd_outb(cy_iobase, CY_CLEAR_INTR, cy_align, 0); 644 645 return (adapter); 646} 647 --- 68 unchanged lines hidden (view full) --- 716 * cases: to preempt sleeping callin opens if we are 717 * callout, and to complete a callin open after DCD rises. 718 */ 719 tp->t_oproc = comstart; 720 tp->t_param = comparam; 721 tp->t_dev = dev; 722 tp->t_termios = mynor & CALLOUT_MASK 723 ? com->it_out : com->it_in; | 639 } 640 641 /* ensure an edge for the next interrupt */ 642 cd_outb(cy_iobase, CY_CLEAR_INTR, cy_align, 0); 643 644 return (adapter); 645} 646 --- 68 unchanged lines hidden (view full) --- 715 * cases: to preempt sleeping callin opens if we are 716 * callout, and to complete a callin open after DCD rises. 717 */ 718 tp->t_oproc = comstart; 719 tp->t_param = comparam; 720 tp->t_dev = dev; 721 tp->t_termios = mynor & CALLOUT_MASK 722 ? com->it_out : com->it_in; |
723 tp->t_ififosize = 2 * RS_IBUFSIZE; 724 tp->t_ispeedwat = (speed_t)-1; 725 tp->t_ospeedwat = (speed_t)-1; |
|
724#if 0 725 (void)commctl(com, TIOCM_DTR | TIOCM_RTS, DMSET); 726 com->poll = com->no_irq; 727 com->poll_output = com->loses_outints; 728#endif 729 ++com->wopeners; 730 iobase = com->iobase; 731 --- 22 unchanged lines hidden (view full) --- 754 */ 755 error = comparam(tp, &tp->t_termios); 756 --com->wopeners; 757 if (error != 0) 758 goto out; 759 /* 760 * XXX we should goto open_top if comparam() slept. 761 */ | 726#if 0 727 (void)commctl(com, TIOCM_DTR | TIOCM_RTS, DMSET); 728 com->poll = com->no_irq; 729 com->poll_output = com->loses_outints; 730#endif 731 ++com->wopeners; 732 iobase = com->iobase; 733 --- 22 unchanged lines hidden (view full) --- 756 */ 757 error = comparam(tp, &tp->t_termios); 758 --com->wopeners; 759 if (error != 0) 760 goto out; 761 /* 762 * XXX we should goto open_top if comparam() slept. 763 */ |
762 ttsetwater(tp); | |
763#if 0 764 if (com->hasfifo) { 765 /* 766 * (Re)enable and drain fifos. 767 * 768 * Certain SMC chips cause problems if the fifos 769 * are enabled while input is ready. Turn off the 770 * fifo if necessary to clear the input. We test --- 899 unchanged lines hidden (view full) --- 1670 /* 1671 * Avoid the grotesquely inefficient lineswitch routine 1672 * (ttyinput) in "raw" mode. It usually takes about 450 1673 * instructions (that's without canonical processing or echo!). 1674 * slinput is reasonably fast (usually 40 instructions plus 1675 * call overhead). 1676 */ 1677 if (tp->t_state & TS_CAN_BYPASS_L_RINT) { | 764#if 0 765 if (com->hasfifo) { 766 /* 767 * (Re)enable and drain fifos. 768 * 769 * Certain SMC chips cause problems if the fifos 770 * are enabled while input is ready. Turn off the 771 * fifo if necessary to clear the input. We test --- 899 unchanged lines hidden (view full) --- 1671 /* 1672 * Avoid the grotesquely inefficient lineswitch routine 1673 * (ttyinput) in "raw" mode. It usually takes about 450 1674 * instructions (that's without canonical processing or echo!). 1675 * slinput is reasonably fast (usually 40 instructions plus 1676 * call overhead). 1677 */ 1678 if (tp->t_state & TS_CAN_BYPASS_L_RINT) { |
1678 if (tp->t_rawq.c_cc + incc >= RB_I_HIGH_WATER | 1679 if (tp->t_rawq.c_cc + incc > tp->t_ihiwat |
1679 && (com->state & CS_RTS_IFLOW 1680 || tp->t_iflag & IXOFF) 1681 && !(tp->t_state & TS_TBLOCK)) 1682 ttyblock(tp); 1683 tk_nin += incc; 1684 tk_rawcc += incc; 1685 tp->t_rawcc += incc; 1686 com->delta_error_counts[CE_TTY_BUF_OVERFLOW] --- 928 unchanged lines hidden --- | 1680 && (com->state & CS_RTS_IFLOW 1681 || tp->t_iflag & IXOFF) 1682 && !(tp->t_state & TS_TBLOCK)) 1683 ttyblock(tp); 1684 tk_nin += incc; 1685 tk_rawcc += incc; 1686 tp->t_rawcc += incc; 1687 com->delta_error_counts[CE_TTY_BUF_OVERFLOW] --- 928 unchanged lines hidden --- |