summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@gmx.de>2013-01-13 10:23:31 +0100
committercinap_lenrek <cinap_lenrek@gmx.de>2013-01-13 10:23:31 +0100
commitaa0627162b3abdf2a9f8dd68e5b845a8461c75a4 (patch)
tree950088e60429b7a6cb75af173be7d6b8c9f60c9a
parent63f1fc07eb77a5443d693b902dd2b74b56f95057 (diff)
downloadplan9front-aa0627162b3abdf2a9f8dd68e5b845a8461c75a4.tar.xz
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
-rw-r--r--sys/src/9/omap/devuart.c27
-rw-r--r--sys/src/9/pc/fns.h2
-rw-r--r--sys/src/9/pc/mouse.c10
-rw-r--r--sys/src/9/pc/pccpuf1
-rw-r--r--sys/src/9/pc/pcf1
-rw-r--r--sys/src/9/pc/uarti8250.c58
-rw-r--r--sys/src/9/port/devuart.c24
-rw-r--r--sys/src/9/port/portfns.h4
8 files changed, 35 insertions, 92 deletions
diff --git a/sys/src/9/omap/devuart.c b/sys/src/9/omap/devuart.c
index af7ed0005..59abbcbe5 100644
--- a/sys/src/9/omap/devuart.c
+++ b/sys/src/9/omap/devuart.c
@@ -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)
{
diff --git a/sys/src/9/pc/fns.h b/sys/src/9/pc/fns.h
index 928267b34..dca0cc614 100644
--- a/sys/src/9/pc/fns.h
+++ b/sys/src/9/pc/fns.h
@@ -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);
diff --git a/sys/src/9/pc/mouse.c b/sys/src/9/pc/mouse.c
index c8263eccd..d5e6386bd 100644
--- a/sys/src/9/pc/mouse.c
+++ b/sys/src/9/pc/mouse.c
@@ -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);
diff --git a/sys/src/9/pc/pccpuf b/sys/src/9/pc/pccpuf
index 1795e6542..b3873db50 100644
--- a/sys/src/9/pc/pccpuf
+++ b/sys/src/9/pc/pccpuf
@@ -84,6 +84,7 @@ misc
mtrr
uarti8250
+ uartisa
uartpci pci
sdaoe
diff --git a/sys/src/9/pc/pcf b/sys/src/9/pc/pcf
index 31e90139b..4c9465ae0 100644
--- a/sys/src/9/pc/pcf
+++ b/sys/src/9/pc/pcf
@@ -95,6 +95,7 @@ misc
sdloop
uarti8250
+ uartisa
uartpci pci
vga3dfx +cur
diff --git a/sys/src/9/pc/uarti8250.c b/sys/src/9/pc/uarti8250.c
index aba0be90c..fe14bdf0e 100644
--- a/sys/src/9/pc/uarti8250.c
+++ b/sys/src/9/pc/uarti8250.c
@@ -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)
- return;
- switch(n){
- default:
+ if(p == cmd || n < 0 || n >= nelem(i8250uart))
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);
-
-}
diff --git a/sys/src/9/port/devuart.c b/sys/src/9/port/devuart.c
index 9fc9a0123..57fdbb6e5 100644
--- a/sys/src/9/port/devuart.c
+++ b/sys/src/9/port/devuart.c
@@ -121,9 +121,26 @@ uartdisable(Uart *p)
iunlock(&uartalloc);
}
+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(Uart* p, int (*putc)(Queue*, int), int setb1200)
+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);
diff --git a/sys/src/9/port/portfns.h b/sys/src/9/port/portfns.h
index 897398dfa..ffeb7315a 100644
--- a/sys/src/9/port/portfns.h
+++ b/sys/src/9/port/portfns.h
@@ -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);