Deleted Added
sdiff udiff text old ( 51088 ) new ( 51654 )
full compact
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/dev/sio/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"

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

302static void siointr __P((void *arg));
303static int commctl __P((struct com_s *com, int bits, int how));
304static int comparam __P((struct tty *tp, struct termios *t));
305static swihand_t siopoll;
306static int sioprobe __P((device_t dev));
307static void siosettimeout __P((void));
308static int siosetwater __P((struct com_s *com, speed_t speed));
309static void comstart __P((struct tty *tp));
310static void comstop __P((struct tty *tp, int rw));
311static timeout_t comwakeup;
312static void disc_optim __P((struct tty *tp, struct termios *t,
313 struct com_s *com));
314
315
316static char driver_name[] = "sio";
317
318/* table and macro for fast conversion from a unit number to its com struct */

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

334 sizeof(struct com_s),
335};
336
337static d_open_t sioopen;
338static d_close_t sioclose;
339static d_read_t sioread;
340static d_write_t siowrite;
341static d_ioctl_t sioioctl;
342
343#define CDEV_MAJOR 28
344static struct cdevsw sio_cdevsw = {
345 /* open */ sioopen,
346 /* close */ sioclose,
347 /* read */ sioread,
348 /* write */ siowrite,
349 /* ioctl */ sioioctl,
350 /* stop */ nostop,
351 /* reset */ noreset,
352 /* devtotty */ nodevtotty,
353 /* poll */ ttypoll,
354 /* mmap */ nommap,
355 /* strategy */ nostrategy,
356 /* name */ driver_name,
357 /* parms */ noparms,
358 /* maj */ CDEV_MAJOR,
359 /* dump */ nodump,
360 /* psize */ nopsize,
361 /* flags */ D_TTY,

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

1204 /*
1205 * The device isn't open, so there are no conflicts.
1206 * Initialize it. Initialization is done twice in many
1207 * cases: to preempt sleeping callin opens if we are
1208 * callout, and to complete a callin open after DCD rises.
1209 */
1210 tp->t_oproc = comstart;
1211 tp->t_param = comparam;
1212 tp->t_stop = comstop;
1213 tp->t_dev = dev;
1214 tp->t_termios = mynor & CALLOUT_MASK
1215 ? com->it_out : com->it_in;
1216 (void)commctl(com, TIOCM_DTR | TIOCM_RTS, DMSET);
1217 com->poll = com->no_irq;
1218 com->poll_output = com->loses_outints;
1219 ++com->wopeners;
1220 error = comparam(tp, &tp->t_termios);

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

1331 mynor = minor(dev);
1332 if (mynor & CONTROL_MASK)
1333 return (0);
1334 com = com_addr(MINOR_TO_UNIT(mynor));
1335 tp = com->tp;
1336 s = spltty();
1337 (*linesw[tp->t_line].l_close)(tp, flag);
1338 disc_optim(tp, &tp->t_termios, com);
1339 comstop(tp, FREAD | FWRITE);
1340 comhardclose(com);
1341 ttyclose(tp);
1342 siosettimeout();
1343 splx(s);
1344 if (com->gone) {
1345 printf("sio%d: gone\n", com->unit);
1346 s = spltty();
1347 if (com->ibuf != NULL)

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

2370 if (com->state >= (CS_BUSY | CS_TTGO))
2371 siointr1(com); /* fake interrupt to start output */
2372 enable_intr();
2373 ttwwakeup(tp);
2374 splx(s);
2375}
2376
2377static void
2378comstop(tp, rw)
2379 struct tty *tp;
2380 int rw;
2381{
2382 struct com_s *com;
2383
2384 com = com_addr(DEV_TO_UNIT(tp->t_dev));
2385 if (com->gone)
2386 return;

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

2410 FIFO_RCV_RST | com->fifo_image);
2411 com_events -= (com->iptr - com->ibuf);
2412 com->iptr = com->ibuf;
2413 }
2414 enable_intr();
2415 comstart(tp);
2416}
2417
2418static int
2419commctl(com, bits, how)
2420 struct com_s *com;
2421 int bits;
2422 int how;
2423{
2424 int mcr;
2425 int msr;

--- 619 unchanged lines hidden ---