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
|
@ -124,33 +124,6 @@ uartdisable(Uart *p)
|
||||||
iunlock(&uartalloc);
|
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
|
static void
|
||||||
setlength(int i)
|
setlength(int i)
|
||||||
{
|
{
|
||||||
|
|
|
@ -50,8 +50,6 @@ void i8042auxenable(void (*)(int, int));
|
||||||
void i8042reset(void);
|
void i8042reset(void);
|
||||||
void i8250console(void);
|
void i8250console(void);
|
||||||
void* i8250alloc(int, int, int);
|
void* i8250alloc(int, int, int);
|
||||||
void i8250mouse(char*, int (*)(Queue*, int), int);
|
|
||||||
void i8250setmouseputc(char*, int (*)(Queue*, int));
|
|
||||||
void i8253enable(void);
|
void i8253enable(void);
|
||||||
void i8253init(void);
|
void i8253init(void);
|
||||||
void i8253reset(void);
|
void i8253reset(void);
|
||||||
|
|
|
@ -240,7 +240,7 @@ setintellimouse(void)
|
||||||
i8042auxcmd(0x50);
|
i8042auxcmd(0x50);
|
||||||
break;
|
break;
|
||||||
case Mouseserial:
|
case Mouseserial:
|
||||||
i8250setmouseputc(mouseport, m5mouseputc);
|
uartsetmouseputc(mouseport, m5mouseputc);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -311,13 +311,13 @@ mousectl(Cmdbuf *cb)
|
||||||
|
|
||||||
if(cb->nf > 2){
|
if(cb->nf > 2){
|
||||||
if(strcmp(cb->f[2], "M") == 0)
|
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)
|
else if(strcmp(cb->f[2], "MI") == 0)
|
||||||
i8250mouse(cb->f[1], m5mouseputc, 0);
|
uartmouse(cb->f[1], m5mouseputc, 0);
|
||||||
else
|
else
|
||||||
i8250mouse(cb->f[1], mouseputc, cb->nf == 1);
|
uartmouse(cb->f[1], mouseputc, cb->nf == 1);
|
||||||
} else
|
} else
|
||||||
i8250mouse(cb->f[1], mouseputc, cb->nf == 1);
|
uartmouse(cb->f[1], mouseputc, cb->nf == 1);
|
||||||
|
|
||||||
mousetype = Mouseserial;
|
mousetype = Mouseserial;
|
||||||
strncpy(mouseport, cb->f[1], sizeof(mouseport)-1);
|
strncpy(mouseport, cb->f[1], sizeof(mouseport)-1);
|
||||||
|
|
|
@ -84,6 +84,7 @@ misc
|
||||||
mtrr
|
mtrr
|
||||||
|
|
||||||
uarti8250
|
uarti8250
|
||||||
|
uartisa
|
||||||
uartpci pci
|
uartpci pci
|
||||||
|
|
||||||
sdaoe
|
sdaoe
|
||||||
|
|
|
@ -95,6 +95,7 @@ misc
|
||||||
sdloop
|
sdloop
|
||||||
|
|
||||||
uarti8250
|
uarti8250
|
||||||
|
uartisa
|
||||||
uartpci pci
|
uartpci pci
|
||||||
|
|
||||||
vga3dfx +cur
|
vga3dfx +cur
|
||||||
|
|
|
@ -14,8 +14,6 @@ enum {
|
||||||
Uart0IRQ = 4,
|
Uart0IRQ = 4,
|
||||||
Uart1 = 0x2F8, /* COM2 */
|
Uart1 = 0x2F8, /* COM2 */
|
||||||
Uart1IRQ = 3,
|
Uart1IRQ = 3,
|
||||||
Uart2 = 0x200, /* COM3 */
|
|
||||||
Uart2IRQ = 5,
|
|
||||||
|
|
||||||
UartFREQ = 1843200,
|
UartFREQ = 1843200,
|
||||||
};
|
};
|
||||||
|
@ -123,7 +121,7 @@ typedef struct Ctlr {
|
||||||
|
|
||||||
extern PhysUart i8250physuart;
|
extern PhysUart i8250physuart;
|
||||||
|
|
||||||
static Ctlr i8250ctlr[3] = {
|
static Ctlr i8250ctlr[2] = {
|
||||||
{ .io = Uart0,
|
{ .io = Uart0,
|
||||||
.irq = Uart0IRQ,
|
.irq = Uart0IRQ,
|
||||||
.tbdf = BUSUNKNOWN, },
|
.tbdf = BUSUNKNOWN, },
|
||||||
|
@ -131,13 +129,9 @@ static Ctlr i8250ctlr[3] = {
|
||||||
{ .io = Uart1,
|
{ .io = Uart1,
|
||||||
.irq = Uart1IRQ,
|
.irq = Uart1IRQ,
|
||||||
.tbdf = BUSUNKNOWN, },
|
.tbdf = BUSUNKNOWN, },
|
||||||
|
|
||||||
{ .io = Uart2,
|
|
||||||
.irq = Uart2IRQ,
|
|
||||||
.tbdf = BUSUNKNOWN, },
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static Uart i8250uart[3] = {
|
static Uart i8250uart[2] = {
|
||||||
{ .regs = &i8250ctlr[0],
|
{ .regs = &i8250ctlr[0],
|
||||||
.name = "COM1",
|
.name = "COM1",
|
||||||
.freq = UartFREQ,
|
.freq = UartFREQ,
|
||||||
|
@ -150,13 +144,6 @@ static Uart i8250uart[3] = {
|
||||||
.freq = UartFREQ,
|
.freq = UartFREQ,
|
||||||
.phys = &i8250physuart,
|
.phys = &i8250physuart,
|
||||||
.special= 0,
|
.special= 0,
|
||||||
.next = &i8250uart[2], },
|
|
||||||
|
|
||||||
{ .regs = &i8250ctlr[2],
|
|
||||||
.name = "COM3",
|
|
||||||
.freq = UartFREQ,
|
|
||||||
.phys = &i8250physuart,
|
|
||||||
.special= 0,
|
|
||||||
.next = nil, },
|
.next = nil, },
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -704,21 +691,9 @@ i8250console(void)
|
||||||
if((p = getconf("console")) == nil)
|
if((p = getconf("console")) == nil)
|
||||||
return;
|
return;
|
||||||
n = strtoul(p, &cmd, 0);
|
n = strtoul(p, &cmd, 0);
|
||||||
if(p == cmd)
|
if(p == cmd || n < 0 || n >= nelem(i8250uart))
|
||||||
return;
|
return;
|
||||||
switch(n){
|
uart = &i8250uart[n];
|
||||||
default:
|
|
||||||
return;
|
|
||||||
case 0:
|
|
||||||
uart = &i8250uart[0];
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
uart = &i8250uart[1];
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
uart = &i8250uart[2];
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
(*uart->phys->enable)(uart, 0);
|
(*uart->phys->enable)(uart, 0);
|
||||||
uartctl(uart, "b9600 l8 pn s1");
|
uartctl(uart, "b9600 l8 pn s1");
|
||||||
|
@ -728,28 +703,3 @@ i8250console(void)
|
||||||
consuart = uart;
|
consuart = uart;
|
||||||
uart->console = 1;
|
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);
|
iunlock(&uartalloc);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static Uart*
|
||||||
uartmouse(Uart* p, int (*putc)(Queue*, int), int setb1200)
|
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);
|
qlock(p);
|
||||||
if(p->opens++ == 0 && uartenable(p) == nil){
|
if(p->opens++ == 0 && uartenable(p) == nil){
|
||||||
qunlock(p);
|
qunlock(p);
|
||||||
|
@ -137,8 +154,11 @@ uartmouse(Uart* p, int (*putc)(Queue*, int), int setb1200)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
uartsetmouseputc(Uart* p, int (*putc)(Queue*, int))
|
uartsetmouseputc(char *which, int (*putc)(Queue*, int))
|
||||||
{
|
{
|
||||||
|
Uart *p;
|
||||||
|
|
||||||
|
p = uartport(which);
|
||||||
qlock(p);
|
qlock(p);
|
||||||
if(p->opens == 0 || p->special == 0){
|
if(p->opens == 0 || p->special == 0){
|
||||||
qunlock(p);
|
qunlock(p);
|
||||||
|
|
|
@ -345,8 +345,8 @@ void tsleep(Rendez*, int (*)(void*), void*, ulong);
|
||||||
int uartctl(Uart*, char*);
|
int uartctl(Uart*, char*);
|
||||||
int uartgetc(void);
|
int uartgetc(void);
|
||||||
void uartkick(void*);
|
void uartkick(void*);
|
||||||
void uartmouse(Uart*, int (*)(Queue*, int), int);
|
void uartmouse(char*, int (*)(Queue*, int), int);
|
||||||
void uartsetmouseputc(Uart*, int (*)(Queue*, int));
|
void uartsetmouseputc(char*, int (*)(Queue*, int));
|
||||||
void uartputc(int);
|
void uartputc(int);
|
||||||
void uartputs(char*, int);
|
void uartputs(char*, int);
|
||||||
void uartrecv(Uart*, char);
|
void uartrecv(Uart*, char);
|
||||||
|
|
Loading…
Reference in a new issue