sio.c (218424) | sio.c (225203) |
---|---|
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> | 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 218424 2011-02-08 00:16:36Z mdf $"); | 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; | 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 ALT_BREAK_TO_DEBUGGER | 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"); | 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) && (defined(BREAK_TO_DEBUGGER) || \ 1106 defined(ALT_BREAK_TO_DEBUGGER)) | 1105#if defined(KDB) |
1107 /* 1108 * Enable interrupts for early break-to-debugger support 1109 * on the console. 1110 */ 1111 if (ret == 0 && unit == comconsole) 1112 outb(siocniobase + com_ier, IER_ERXRDY | IER_ERLS | 1113 IER_EMSC); 1114#endif --- 76 unchanged lines hidden (view full) --- 1191 struct com_s *com; 1192 1193 s = spltty(); 1194 com = tp->t_sc; 1195 com->poll = FALSE; 1196 com->poll_output = FALSE; 1197 sio_setreg(com, com_cfcr, com->cfcr_image &= ~CFCR_SBREAK); 1198 | 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 |
1199#if defined(KDB) && (defined(BREAK_TO_DEBUGGER) || \ 1200 defined(ALT_BREAK_TO_DEBUGGER)) | 1198#if defined(KDB) |
1201 /* 1202 * Leave interrupts enabled and don't clear DTR if this is the 1203 * console. This allows us to detect break-to-debugger events 1204 * while the console device is closed. 1205 */ 1206 if (com->unit != comconsole) 1207#endif 1208 { --- 269 unchanged lines hidden (view full) --- 1478 struct com_s *com; 1479{ 1480 u_char int_ctl; 1481 u_char int_ctl_new; 1482 u_char line_status; 1483 u_char modem_status; 1484 u_char *ioptr; 1485 u_char recv_data; | 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; |
1486#if defined(KDB) && defined(ALT_BREAK_TO_DEBUGGER) 1487 int kdb_brk; | |
1488 | 1484 |
1485#ifdef KDB |
|
1489again: 1490#endif 1491 1492 if (COM_IIR_TXRDYBUG(com->flags)) { 1493 int_ctl = inb(com->int_ctl_port); 1494 int_ctl_new = int_ctl; 1495 } else { 1496 int_ctl = 0; --- 16 unchanged lines hidden (view full) --- 1513 /* input event? (check first to help avoid overruns) */ 1514 while (line_status & LSR_RCV_MASK) { 1515 /* break/unnattached error bits or real input? */ 1516 if (!(line_status & LSR_RXRDY)) 1517 recv_data = 0; 1518 else 1519 recv_data = inb(com->data_port); 1520#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 |
1521#ifdef ALT_BREAK_TO_DEBUGGER | |
1522 if (com->unit == comconsole && | 1518 if (com->unit == comconsole && |
1523 (kdb_brk = kdb_alt_break(recv_data, 1524 &com->alt_brk_state)) != 0) { 1525 mtx_unlock_spin(&sio_lock); 1526 switch (kdb_brk) { 1527 case KDB_REQ_DEBUGGER: 1528 kdb_enter(KDB_WHY_BREAK, 1529 "Break sequence on console"); 1530 break; 1531 case KDB_REQ_PANIC: 1532 kdb_panic("panic on console"); 1533 break; 1534 case KDB_REQ_REBOOT: 1535 kdb_reboot(); 1536 break; 1537 } 1538 mtx_lock_spin(&sio_lock); | 1519 kdb_alt_break(recv_data, &com->alt_brk_state) != 0) |
1539 goto again; | 1520 goto again; |
1540 } 1541#endif /* ALT_BREAK_TO_DEBUGGER */ | |
1542#endif /* KDB */ 1543 if (line_status & (LSR_BI | LSR_FE | LSR_PE)) { 1544 /* 1545 * Don't store BI if IGNBRK or FE/PE if IGNPAR. 1546 * Otherwise, push the work to a higher level 1547 * (to handle PARMRK) if we're bypassing. 1548 * Otherwise, convert BI/FE and PE+INPCK to 0. 1549 * 1550 * This makes bypassing work right in the 1551 * usual "raw" case (IGNBRK set, and IGNPAR 1552 * and INPCK clear). 1553 * 1554 * Note: BI together with FE/PE means just BI. 1555 */ 1556 if (line_status & LSR_BI) { | 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) { |
1557#if defined(KDB) && defined(BREAK_TO_DEBUGGER) | 1536#if defined(KDB) |
1558 if (com->unit == comconsole) { | 1537 if (com->unit == comconsole) { |
1559 kdb_enter(KDB_WHY_BREAK, 1560 "Line break on console"); | 1538 kdb_break(); |
1561 goto cont; 1562 } 1563#endif 1564 if (com->tp == NULL 1565 || com->tp->t_iflag & IGNBRK) 1566 goto cont; 1567 } else { 1568 if (com->tp == NULL --- 1080 unchanged lines hidden --- | 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 --- |