remove non standard COM3 (eia2) serial port from i8250 uart.
access to non standard serial port COM3 at i/o port 0x200 causes kernel panic on some machines (Toshiba Sattelite 1415-S115). also, some machines have gameport at 0x200. i readded uartisa to the pcf and pccpuf kernel configurations so one can use plan9.ini to add non standard uarts like: uart2=type=isa port=0x200 irq=5
This commit is contained in:
parent
63f1fc07eb
commit
aa0627162b
8 changed files with 36 additions and 93 deletions
|
@ -124,33 +124,6 @@ uartdisable(Uart *p)
|
|||
iunlock(&uartalloc);
|
||||
}
|
||||
|
||||
void
|
||||
uartmouse(Uart* p, int (*putc)(Queue*, int), int setb1200)
|
||||
{
|
||||
qlock(p);
|
||||
if(p->opens++ == 0 && uartenable(p) == nil){
|
||||
qunlock(p);
|
||||
error(Enodev);
|
||||
}
|
||||
if(setb1200)
|
||||
uartctl(p, "b1200");
|
||||
p->putc = putc;
|
||||
p->special = 1;
|
||||
qunlock(p);
|
||||
}
|
||||
|
||||
void
|
||||
uartsetmouseputc(Uart* p, int (*putc)(Queue*, int))
|
||||
{
|
||||
qlock(p);
|
||||
if(p->opens == 0 || p->special == 0){
|
||||
qunlock(p);
|
||||
error(Enodev);
|
||||
}
|
||||
p->putc = putc;
|
||||
qunlock(p);
|
||||
}
|
||||
|
||||
static void
|
||||
setlength(int i)
|
||||
{
|
||||
|
|
|
@ -50,8 +50,6 @@ void i8042auxenable(void (*)(int, int));
|
|||
void i8042reset(void);
|
||||
void i8250console(void);
|
||||
void* i8250alloc(int, int, int);
|
||||
void i8250mouse(char*, int (*)(Queue*, int), int);
|
||||
void i8250setmouseputc(char*, int (*)(Queue*, int));
|
||||
void i8253enable(void);
|
||||
void i8253init(void);
|
||||
void i8253reset(void);
|
||||
|
|
|
@ -240,7 +240,7 @@ setintellimouse(void)
|
|||
i8042auxcmd(0x50);
|
||||
break;
|
||||
case Mouseserial:
|
||||
i8250setmouseputc(mouseport, m5mouseputc);
|
||||
uartsetmouseputc(mouseport, m5mouseputc);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -311,13 +311,13 @@ mousectl(Cmdbuf *cb)
|
|||
|
||||
if(cb->nf > 2){
|
||||
if(strcmp(cb->f[2], "M") == 0)
|
||||
i8250mouse(cb->f[1], m3mouseputc, 0);
|
||||
uartmouse(cb->f[1], m3mouseputc, 0);
|
||||
else if(strcmp(cb->f[2], "MI") == 0)
|
||||
i8250mouse(cb->f[1], m5mouseputc, 0);
|
||||
uartmouse(cb->f[1], m5mouseputc, 0);
|
||||
else
|
||||
i8250mouse(cb->f[1], mouseputc, cb->nf == 1);
|
||||
uartmouse(cb->f[1], mouseputc, cb->nf == 1);
|
||||
} else
|
||||
i8250mouse(cb->f[1], mouseputc, cb->nf == 1);
|
||||
uartmouse(cb->f[1], mouseputc, cb->nf == 1);
|
||||
|
||||
mousetype = Mouseserial;
|
||||
strncpy(mouseport, cb->f[1], sizeof(mouseport)-1);
|
||||
|
|
|
@ -84,6 +84,7 @@ misc
|
|||
mtrr
|
||||
|
||||
uarti8250
|
||||
uartisa
|
||||
uartpci pci
|
||||
|
||||
sdaoe
|
||||
|
|
|
@ -95,6 +95,7 @@ misc
|
|||
sdloop
|
||||
|
||||
uarti8250
|
||||
uartisa
|
||||
uartpci pci
|
||||
|
||||
vga3dfx +cur
|
||||
|
|
|
@ -14,8 +14,6 @@ enum {
|
|||
Uart0IRQ = 4,
|
||||
Uart1 = 0x2F8, /* COM2 */
|
||||
Uart1IRQ = 3,
|
||||
Uart2 = 0x200, /* COM3 */
|
||||
Uart2IRQ = 5,
|
||||
|
||||
UartFREQ = 1843200,
|
||||
};
|
||||
|
@ -123,7 +121,7 @@ typedef struct Ctlr {
|
|||
|
||||
extern PhysUart i8250physuart;
|
||||
|
||||
static Ctlr i8250ctlr[3] = {
|
||||
static Ctlr i8250ctlr[2] = {
|
||||
{ .io = Uart0,
|
||||
.irq = Uart0IRQ,
|
||||
.tbdf = BUSUNKNOWN, },
|
||||
|
@ -131,13 +129,9 @@ static Ctlr i8250ctlr[3] = {
|
|||
{ .io = Uart1,
|
||||
.irq = Uart1IRQ,
|
||||
.tbdf = BUSUNKNOWN, },
|
||||
|
||||
{ .io = Uart2,
|
||||
.irq = Uart2IRQ,
|
||||
.tbdf = BUSUNKNOWN, },
|
||||
};
|
||||
|
||||
static Uart i8250uart[3] = {
|
||||
static Uart i8250uart[2] = {
|
||||
{ .regs = &i8250ctlr[0],
|
||||
.name = "COM1",
|
||||
.freq = UartFREQ,
|
||||
|
@ -150,13 +144,6 @@ static Uart i8250uart[3] = {
|
|||
.freq = UartFREQ,
|
||||
.phys = &i8250physuart,
|
||||
.special= 0,
|
||||
.next = &i8250uart[2], },
|
||||
|
||||
{ .regs = &i8250ctlr[2],
|
||||
.name = "COM3",
|
||||
.freq = UartFREQ,
|
||||
.phys = &i8250physuart,
|
||||
.special= 0,
|
||||
.next = nil, },
|
||||
};
|
||||
|
||||
|
@ -704,21 +691,9 @@ i8250console(void)
|
|||
if((p = getconf("console")) == nil)
|
||||
return;
|
||||
n = strtoul(p, &cmd, 0);
|
||||
if(p == cmd)
|
||||
if(p == cmd || n < 0 || n >= nelem(i8250uart))
|
||||
return;
|
||||
switch(n){
|
||||
default:
|
||||
return;
|
||||
case 0:
|
||||
uart = &i8250uart[0];
|
||||
break;
|
||||
case 1:
|
||||
uart = &i8250uart[1];
|
||||
break;
|
||||
case 2:
|
||||
uart = &i8250uart[2];
|
||||
break;
|
||||
}
|
||||
uart = &i8250uart[n];
|
||||
|
||||
(*uart->phys->enable)(uart, 0);
|
||||
uartctl(uart, "b9600 l8 pn s1");
|
||||
|
@ -728,28 +703,3 @@ i8250console(void)
|
|||
consuart = uart;
|
||||
uart->console = 1;
|
||||
}
|
||||
|
||||
void
|
||||
i8250mouse(char* which, int (*putc)(Queue*, int), int setb1200)
|
||||
{
|
||||
char *p;
|
||||
int port;
|
||||
|
||||
port = strtol(which, &p, 0);
|
||||
if(p == which || port < 0 || port > 1)
|
||||
error(Ebadarg);
|
||||
uartmouse(&i8250uart[port], putc, setb1200);
|
||||
}
|
||||
|
||||
void
|
||||
i8250setmouseputc(char* which, int (*putc)(Queue*, int))
|
||||
{
|
||||
char *p;
|
||||
int port;
|
||||
|
||||
port = strtol(which, &p, 0);
|
||||
if(p == which || port < 0 || port > 1)
|
||||
error(Ebadarg);
|
||||
uartsetmouseputc(&i8250uart[port], putc);
|
||||
|
||||
}
|
||||
|
|
|
@ -121,9 +121,26 @@ uartdisable(Uart *p)
|
|||
iunlock(&uartalloc);
|
||||
}
|
||||
|
||||
void
|
||||
uartmouse(Uart* p, int (*putc)(Queue*, int), int setb1200)
|
||||
static Uart*
|
||||
uartport(char *which)
|
||||
{
|
||||
int port;
|
||||
char *p;
|
||||
|
||||
port = strtol(which, &p, 0);
|
||||
if(p == which)
|
||||
error(Ebadarg);
|
||||
if(port < 0 || port >= uartnuart || uart[port] == nil)
|
||||
error(Enodev);
|
||||
return uart[port];
|
||||
}
|
||||
|
||||
void
|
||||
uartmouse(char *which, int (*putc)(Queue*, int), int setb1200)
|
||||
{
|
||||
Uart *p;
|
||||
|
||||
p = uartport(which);
|
||||
qlock(p);
|
||||
if(p->opens++ == 0 && uartenable(p) == nil){
|
||||
qunlock(p);
|
||||
|
@ -137,8 +154,11 @@ uartmouse(Uart* p, int (*putc)(Queue*, int), int setb1200)
|
|||
}
|
||||
|
||||
void
|
||||
uartsetmouseputc(Uart* p, int (*putc)(Queue*, int))
|
||||
uartsetmouseputc(char *which, int (*putc)(Queue*, int))
|
||||
{
|
||||
Uart *p;
|
||||
|
||||
p = uartport(which);
|
||||
qlock(p);
|
||||
if(p->opens == 0 || p->special == 0){
|
||||
qunlock(p);
|
||||
|
|
|
@ -345,8 +345,8 @@ void tsleep(Rendez*, int (*)(void*), void*, ulong);
|
|||
int uartctl(Uart*, char*);
|
||||
int uartgetc(void);
|
||||
void uartkick(void*);
|
||||
void uartmouse(Uart*, int (*)(Queue*, int), int);
|
||||
void uartsetmouseputc(Uart*, int (*)(Queue*, int));
|
||||
void uartmouse(char*, int (*)(Queue*, int), int);
|
||||
void uartsetmouseputc(char*, int (*)(Queue*, int));
|
||||
void uartputc(int);
|
||||
void uartputs(char*, int);
|
||||
void uartrecv(Uart*, char);
|
||||
|
|
Loading…
Reference in a new issue