Deleted Added
full compact
sio.c (98691) sio.c (102542)
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/dev/sio/sio.c 98691 2002-06-23 18:57:53Z n_hibma $
33 * $FreeBSD: head/sys/dev/sio/sio.c 102542 2002-08-28 22:25:41Z 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"

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

1228 error = comparam(tp, &tp->t_termios);
1229 --com->wopeners;
1230 if (error != 0)
1231 goto out;
1232 /*
1233 * XXX we should goto open_top if comparam() slept.
1234 */
1235 if (com->hasfifo) {
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"

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

1228 error = comparam(tp, &tp->t_termios);
1229 --com->wopeners;
1230 if (error != 0)
1231 goto out;
1232 /*
1233 * XXX we should goto open_top if comparam() slept.
1234 */
1235 if (com->hasfifo) {
1236 int i;
1236 /*
1237 * (Re)enable and drain fifos.
1238 *
1239 * Certain SMC chips cause problems if the fifos
1240 * are enabled while input is ready. Turn off the
1241 * fifo if necessary to clear the input. We test
1242 * the input ready bit after enabling the fifos
1243 * since we've already enabled them in comparam()
1244 * and to handle races between enabling and fresh
1245 * input.
1246 */
1237 /*
1238 * (Re)enable and drain fifos.
1239 *
1240 * Certain SMC chips cause problems if the fifos
1241 * are enabled while input is ready. Turn off the
1242 * fifo if necessary to clear the input. We test
1243 * the input ready bit after enabling the fifos
1244 * since we've already enabled them in comparam()
1245 * and to handle races between enabling and fresh
1246 * input.
1247 */
1247 while (TRUE) {
1248 for (i = 0; i < 500; i++) {
1248 sio_setreg(com, com_fifo,
1249 FIFO_RCV_RST | FIFO_XMT_RST
1250 | com->fifo_image);
1251 /*
1252 * XXX the delays are for superstitious
1253 * historical reasons. It must be less than
1254 * the character time at the maximum
1255 * supported speed (87 usec at 115200 bps

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

1261 */
1262 DELAY(50);
1263 if (!(inb(com->line_status_port) & LSR_RXRDY))
1264 break;
1265 sio_setreg(com, com_fifo, 0);
1266 DELAY(50);
1267 (void) inb(com->data_port);
1268 }
1249 sio_setreg(com, com_fifo,
1250 FIFO_RCV_RST | FIFO_XMT_RST
1251 | com->fifo_image);
1252 /*
1253 * XXX the delays are for superstitious
1254 * historical reasons. It must be less than
1255 * the character time at the maximum
1256 * supported speed (87 usec at 115200 bps

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

1262 */
1263 DELAY(50);
1264 if (!(inb(com->line_status_port) & LSR_RXRDY))
1265 break;
1266 sio_setreg(com, com_fifo, 0);
1267 DELAY(50);
1268 (void) inb(com->data_port);
1269 }
1270 if (i == 500) {
1271 error = EIO;
1272 goto out;
1273 }
1269 }
1270
1271 mtx_lock_spin(&sio_lock);
1272 (void) inb(com->line_status_port);
1273 (void) inb(com->data_port);
1274 com->prev_modem_status = com->last_modem_status
1275 = inb(com->modem_status_port);
1276 if (COM_IIR_TXRDYBUG(com->flags)) {

--- 1986 unchanged lines hidden ---
1274 }
1275
1276 mtx_lock_spin(&sio_lock);
1277 (void) inb(com->line_status_port);
1278 (void) inb(com->data_port);
1279 com->prev_modem_status = com->last_modem_status
1280 = inb(com->modem_status_port);
1281 if (COM_IIR_TXRDYBUG(com->flags)) {

--- 1986 unchanged lines hidden ---