Deleted Added
full compact
comconsole.c (256281) comconsole.c (261573)
1/*-
2 * Copyright (c) 1998 Michael Smith (msmith@freebsd.org)
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.

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

19 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23 * SUCH DAMAGE.
24 */
25
26#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 1998 Michael Smith (msmith@freebsd.org)
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.

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

19 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23 * SUCH DAMAGE.
24 */
25
26#include <sys/cdefs.h>
27__FBSDID("$FreeBSD: stable/10/sys/boot/pc98/libpc98/comconsole.c 251223 2013-06-01 12:27:48Z nyan $");
27__FBSDID("$FreeBSD: stable/10/sys/boot/pc98/libpc98/comconsole.c 261573 2014-02-07 04:09:15Z mav $");
28
29#include <stand.h>
30#include <bootstrap.h>
31#include <machine/cpufunc.h>
32#include <dev/ic/ns16550.h>
33#include <dev/pci/pcireg.h>
34#include "libi386.h"
35

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

176{
177 int speed;
178
179 if (value == NULL || (speed = comc_parseint(value)) <= 0) {
180 printf("Invalid speed\n");
181 return (CMD_ERROR);
182 }
183
28
29#include <stand.h>
30#include <bootstrap.h>
31#include <machine/cpufunc.h>
32#include <dev/ic/ns16550.h>
33#include <dev/pci/pcireg.h>
34#include "libi386.h"
35

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

176{
177 int speed;
178
179 if (value == NULL || (speed = comc_parseint(value)) <= 0) {
180 printf("Invalid speed\n");
181 return (CMD_ERROR);
182 }
183
184 if ((comconsole.c_flags & (C_ACTIVEIN | C_ACTIVEOUT)) != 0 &&
185 comc_curspeed != speed)
184 if (comc_curspeed != speed)
186 comc_setup(speed, comc_port);
187
188 env_setenv(ev->ev_name, flags | EV_NOHOOK, value, NULL, NULL);
189
190 return (CMD_OK);
191}
192
193static int
194comc_port_set(struct env_var *ev, int flags, const void *value)
195{
196 int port;
197
198 if (value == NULL || (port = comc_parseint(value)) <= 0) {
199 printf("Invalid port\n");
200 return (CMD_ERROR);
201 }
202
185 comc_setup(speed, comc_port);
186
187 env_setenv(ev->ev_name, flags | EV_NOHOOK, value, NULL, NULL);
188
189 return (CMD_OK);
190}
191
192static int
193comc_port_set(struct env_var *ev, int flags, const void *value)
194{
195 int port;
196
197 if (value == NULL || (port = comc_parseint(value)) <= 0) {
198 printf("Invalid port\n");
199 return (CMD_ERROR);
200 }
201
203 if ((comconsole.c_flags & (C_ACTIVEIN | C_ACTIVEOUT)) != 0 &&
204 comc_port != port)
202 if (comc_port != port)
205 comc_setup(comc_curspeed, port);
206
207 env_setenv(ev->ev_name, flags | EV_NOHOOK, value, NULL, NULL);
208
209 return (CMD_OK);
210}
211
212/*

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

304{
305 static int TRY_COUNT = 1000000;
306 char intbuf[64];
307 int tries;
308
309 unsetenv("hw.uart.console");
310 comc_curspeed = speed;
311 comc_port = port;
203 comc_setup(comc_curspeed, port);
204
205 env_setenv(ev->ev_name, flags | EV_NOHOOK, value, NULL, NULL);
206
207 return (CMD_OK);
208}
209
210/*

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

302{
303 static int TRY_COUNT = 1000000;
304 char intbuf[64];
305 int tries;
306
307 unsetenv("hw.uart.console");
308 comc_curspeed = speed;
309 comc_port = port;
310 if ((comconsole.c_flags & (C_ACTIVEIN | C_ACTIVEOUT)) == 0)
311 return;
312
313 outb(comc_port + com_cfcr, CFCR_DLAB | COMC_FMT);
314 outb(comc_port + com_dlbl, COMC_BPS(speed) & 0xff);
315 outb(comc_port + com_dlbh, COMC_BPS(speed) >> 8);
316 outb(comc_port + com_cfcr, COMC_FMT);
317 outb(comc_port + com_mcr, MCR_RTS | MCR_DTR);
318
319 tries = 0;

--- 48 unchanged lines hidden ---
312
313 outb(comc_port + com_cfcr, CFCR_DLAB | COMC_FMT);
314 outb(comc_port + com_dlbl, COMC_BPS(speed) & 0xff);
315 outb(comc_port + com_dlbh, COMC_BPS(speed) >> 8);
316 outb(comc_port + com_cfcr, COMC_FMT);
317 outb(comc_port + com_mcr, MCR_RTS | MCR_DTR);
318
319 tries = 0;

--- 48 unchanged lines hidden ---