27c27
< __FBSDID("$FreeBSD: head/sys/boot/i386/libi386/comconsole.c 229435 2012-01-03 22:36:12Z kib $");
---
> __FBSDID("$FreeBSD: head/sys/boot/i386/libi386/comconsole.c 241300 2012-10-06 20:04:51Z avg $");
66d65
< static int comc_started;
90,92d88
< /* XXX check the BIOS equipment list? */
< cp->c_flags |= (C_PRESENTIN | C_PRESENTOUT);
<
139a136
> comc_setup(comc_curspeed, comc_port);
145,147d141
< if (comc_started && arg == 0)
< return 0;
< comc_started = 1;
151c145,148
< return(0);
---
> if ((comconsole.c_flags & (C_PRESENTIN | C_PRESENTOUT)) ==
> (C_PRESENTIN | C_PRESENTOUT))
> return (CMD_OK);
> return (CMD_ERROR);
169c166
< return(comc_ischar() ? inb(comc_port + com_data) : -1);
---
> return (comc_ischar() ? inb(comc_port + com_data) : -1);
175c172
< return(inb(comc_port + com_lsr) & LSR_RXRDY);
---
> return (inb(comc_port + com_lsr) & LSR_RXRDY);
188c185,186
< if (comc_started && comc_curspeed != speed)
---
> if ((comconsole.c_flags & (C_ACTIVEIN | C_ACTIVEOUT)) != 0 &&
> comc_curspeed != speed)
206c204,205
< if (comc_started && comc_port != port) {
---
> if ((comconsole.c_flags & (C_ACTIVEIN | C_ACTIVEOUT)) != 0 &&
> comc_port != port) {
308c307,308
< if (comc_started && comc_locator != locator) {
---
> if ((comconsole.c_flags & (C_ACTIVEIN | C_ACTIVEOUT)) != 0 &&
> comc_locator != locator) {
319a320,321
> static int TRY_COUNT = 1000000;
> int tries;
329a332
> tries = 0;
332c335,340
< while (inb(comc_port + com_lsr) & LSR_RXRDY);
---
> while (inb(comc_port + com_lsr) & LSR_RXRDY && ++tries < TRY_COUNT);
>
> if (tries < TRY_COUNT)
> comconsole.c_flags |= (C_PRESENTIN | C_PRESENTOUT);
> else
> comconsole.c_flags &= ~(C_PRESENTIN | C_PRESENTOUT);
< __FBSDID("$FreeBSD: head/sys/boot/i386/libi386/comconsole.c 229435 2012-01-03 22:36:12Z kib $");
---
> __FBSDID("$FreeBSD: head/sys/boot/i386/libi386/comconsole.c 241300 2012-10-06 20:04:51Z avg $");
66d65
< static int comc_started;
90,92d88
< /* XXX check the BIOS equipment list? */
< cp->c_flags |= (C_PRESENTIN | C_PRESENTOUT);
<
139a136
> comc_setup(comc_curspeed, comc_port);
145,147d141
< if (comc_started && arg == 0)
< return 0;
< comc_started = 1;
151c145,148
< return(0);
---
> if ((comconsole.c_flags & (C_PRESENTIN | C_PRESENTOUT)) ==
> (C_PRESENTIN | C_PRESENTOUT))
> return (CMD_OK);
> return (CMD_ERROR);
169c166
< return(comc_ischar() ? inb(comc_port + com_data) : -1);
---
> return (comc_ischar() ? inb(comc_port + com_data) : -1);
175c172
< return(inb(comc_port + com_lsr) & LSR_RXRDY);
---
> return (inb(comc_port + com_lsr) & LSR_RXRDY);
188c185,186
< if (comc_started && comc_curspeed != speed)
---
> if ((comconsole.c_flags & (C_ACTIVEIN | C_ACTIVEOUT)) != 0 &&
> comc_curspeed != speed)
206c204,205
< if (comc_started && comc_port != port) {
---
> if ((comconsole.c_flags & (C_ACTIVEIN | C_ACTIVEOUT)) != 0 &&
> comc_port != port) {
308c307,308
< if (comc_started && comc_locator != locator) {
---
> if ((comconsole.c_flags & (C_ACTIVEIN | C_ACTIVEOUT)) != 0 &&
> comc_locator != locator) {
319a320,321
> static int TRY_COUNT = 1000000;
> int tries;
329a332
> tries = 0;
332c335,340
< while (inb(comc_port + com_lsr) & LSR_RXRDY);
---
> while (inb(comc_port + com_lsr) & LSR_RXRDY && ++tries < TRY_COUNT);
>
> if (tries < TRY_COUNT)
> comconsole.c_flags |= (C_PRESENTIN | C_PRESENTOUT);
> else
> comconsole.c_flags &= ~(C_PRESENTIN | C_PRESENTOUT);