test if port does exist via using scratch register
The SCR, scratch register was not present on the 8250 and 8250B UART, so we can use to test if we actually do have serial port. We need this test because some systems will get long delays while attempting to write to non-existing port and this will slow down the console IO to extreme. MFC after: 1 week
This commit is contained in:
parent
68983a2bc7
commit
7f505e7f79
@ -330,6 +330,16 @@ comc_setup(int speed, int port)
|
||||
if ((comconsole.c_flags & (C_ACTIVEIN | C_ACTIVEOUT)) == 0)
|
||||
return;
|
||||
|
||||
#define COMC_TEST 0xbb
|
||||
/*
|
||||
* Write byte to scratch register and read it out.
|
||||
*/
|
||||
outb(comc_port + com_scr, COMC_TEST);
|
||||
if (inb(comc_port + com_scr) != COMC_TEST) {
|
||||
comconsole.c_flags &= ~(C_PRESENTIN | C_PRESENTOUT);
|
||||
return;
|
||||
}
|
||||
|
||||
outb(comc_port + com_cfcr, CFCR_DLAB | COMC_FMT);
|
||||
outb(comc_port + com_dlbl, COMC_BPS(speed) & 0xff);
|
||||
outb(comc_port + com_dlbh, COMC_BPS(speed) >> 8);
|
||||
|
Loading…
Reference in New Issue
Block a user