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 --- 17 unchanged lines hidden (view full) --- 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 * SUCH DAMAGE. 28 * 29 * from: @(#)com.c 7.5 (Berkeley) 5/16/91 30 * from: i386/isa sio.c,v 1.234 31 */ 32 33#include <sys/cdefs.h> |
34__FBSDID("$FreeBSD: head/sys/dev/sio/sio.c 225203 2011-08-26 21:46:36Z rwatson $"); |
35 36#include "opt_comconsole.h" 37#include "opt_compat.h" 38#include "opt_gdb.h" 39#include "opt_kdb.h" 40#include "opt_sio.h" 41 42/* --- 180 unchanged lines hidden (view full) --- 223 Port_t modem_ctl_port; 224 Port_t line_status_port; 225 Port_t modem_status_port; 226 227 struct tty *tp; /* cross reference */ 228 229 struct pps_state pps; 230 int pps_bit; |
231#ifdef KDB |
232 int alt_brk_state; 233#endif 234 235 u_long bytes_in; /* statistics */ 236 u_long bytes_out; 237 u_int delta_error_counts[CE_NTYPES]; 238 u_long error_counts[CE_NTYPES]; 239 --- 857 unchanged lines hidden (view full) --- 1097 ret = bus_setup_intr(dev, 1098 com->irqres, INTR_TYPE_TTY, 1099 NULL, (driver_intr_t *)siointr, com, &com->cookie); 1100 if (ret == 0) 1101 device_printf(dev, "unable to activate interrupt in fast mode - using normal mode\n"); 1102 } 1103 if (ret) 1104 device_printf(dev, "could not activate interrupt\n"); |
1105#if defined(KDB) |
1106 /* 1107 * Enable interrupts for early break-to-debugger support 1108 * on the console. 1109 */ 1110 if (ret == 0 && unit == comconsole) 1111 outb(siocniobase + com_ier, IER_ERXRDY | IER_ERLS | 1112 IER_EMSC); 1113#endif --- 76 unchanged lines hidden (view full) --- 1190 struct com_s *com; 1191 1192 s = spltty(); 1193 com = tp->t_sc; 1194 com->poll = FALSE; 1195 com->poll_output = FALSE; 1196 sio_setreg(com, com_cfcr, com->cfcr_image &= ~CFCR_SBREAK); 1197 |
1198#if defined(KDB) |
1199 /* 1200 * Leave interrupts enabled and don't clear DTR if this is the 1201 * console. This allows us to detect break-to-debugger events 1202 * while the console device is closed. 1203 */ 1204 if (com->unit != comconsole) 1205#endif 1206 { --- 269 unchanged lines hidden (view full) --- 1476 struct com_s *com; 1477{ 1478 u_char int_ctl; 1479 u_char int_ctl_new; 1480 u_char line_status; 1481 u_char modem_status; 1482 u_char *ioptr; 1483 u_char recv_data; |
1484 |
1485#ifdef KDB |
1486again: 1487#endif 1488 1489 if (COM_IIR_TXRDYBUG(com->flags)) { 1490 int_ctl = inb(com->int_ctl_port); 1491 int_ctl_new = int_ctl; 1492 } else { 1493 int_ctl = 0; --- 16 unchanged lines hidden (view full) --- 1510 /* input event? (check first to help avoid overruns) */ 1511 while (line_status & LSR_RCV_MASK) { 1512 /* break/unnattached error bits or real input? */ 1513 if (!(line_status & LSR_RXRDY)) 1514 recv_data = 0; 1515 else 1516 recv_data = inb(com->data_port); 1517#ifdef KDB |
1518 if (com->unit == comconsole && |
1519 kdb_alt_break(recv_data, &com->alt_brk_state) != 0) |
1520 goto again; |
1521#endif /* KDB */ 1522 if (line_status & (LSR_BI | LSR_FE | LSR_PE)) { 1523 /* 1524 * Don't store BI if IGNBRK or FE/PE if IGNPAR. 1525 * Otherwise, push the work to a higher level 1526 * (to handle PARMRK) if we're bypassing. 1527 * Otherwise, convert BI/FE and PE+INPCK to 0. 1528 * 1529 * This makes bypassing work right in the 1530 * usual "raw" case (IGNBRK set, and IGNPAR 1531 * and INPCK clear). 1532 * 1533 * Note: BI together with FE/PE means just BI. 1534 */ 1535 if (line_status & LSR_BI) { |
1536#if defined(KDB) |
1537 if (com->unit == comconsole) { |
1538 kdb_break(); |
1539 goto cont; 1540 } 1541#endif 1542 if (com->tp == NULL 1543 || com->tp->t_iflag & IGNBRK) 1544 goto cont; 1545 } else { 1546 if (com->tp == NULL --- 1080 unchanged lines hidden --- |