pc, pc64: remove unused psaux driver, cleanup devkbd

the psaux driver is not used in any kernel configuration and theres
no userspace mouse daemon. i8042auxcmds() is wrong as access
to the user buffer can fault and we are holding an ilocks.

little cleanups in devkbd.
This commit is contained in:
cinap_lenrek 2015-08-05 10:44:03 +02:00
parent f7514acc95
commit 7304deaec1
4 changed files with 5 additions and 81 deletions

View file

@ -159,24 +159,6 @@ i8042auxcmd(int cmd)
return 0;
}
int
i8042auxcmds(uchar *cmd, int ncmd)
{
int i;
ilock(&i8042lock);
for(i=0; i<ncmd; i++){
if(outready() < 0)
break;
outb(Cmd, 0xD4);
if(outready() < 0)
break;
outb(Data, cmd[i]);
}
iunlock(&i8042lock);
return i;
}
/*
* set keyboard's leds for lock states (scroll, numeric, caps).
*
@ -252,7 +234,7 @@ i8042intr(Ureg*, void*)
void
i8042auxenable(void (*putc)(int, int))
{
char *err = "i8042: aux init failed\n";
static char err[] = "i8042: aux init failed\n";
ilock(&i8042lock);
@ -293,6 +275,7 @@ kbdshutdown(void)
{
if(nokbd)
return;
/* disable kbd and aux xfers and interrupts */
ccc &= ~(Ckbdint|Cauxint);
ccc |= (Cauxdis|Ckbddis);
outready();
@ -391,7 +374,7 @@ kbdwrite(Chan *c, void *a, long n, vlong)
static void
kbdreset(void)
{
static char *initfailed = "i8042: init failed\n";
static char initfailed[] = "i8042: kbd init failed\n";
int c, try;
kbd.q = qopen(1024, Qcoalesce, 0, 0);
@ -437,8 +420,8 @@ kbdreset(void)
outready();
nokbd = 0;
ioalloc(Data, 1, 0, "kbd");
ioalloc(Cmd, 1, 0, "kbd");
ioalloc(Cmd, 1, 0, "i8042.cs");
ioalloc(Data, 1, 0, "i8042.data");
intrenable(IrqKBD, i8042intr, 0, BUSUNKNOWN, "kbd");
}

View file

@ -58,7 +58,6 @@ void guesscpuhz(int);
void halt(void);
void mwait(void*);
int i8042auxcmd(int);
int i8042auxcmds(uchar*, int);
void i8042auxenable(void (*)(int, int));
void i8042reset(void);
void i8250console(void);

View file

@ -1,57 +0,0 @@
/*
* Interface to raw PS/2 aux port.
* Used by user-level mouse daemon.
*/
#include "u.h"
#include "../port/lib.h"
#include "mem.h"
#include "dat.h"
#include "fns.h"
#include "../port/error.h"
#include "io.h"
#define Image IMAGE
#include <draw.h>
#include <memdraw.h>
#include <cursor.h>
#include "screen.h"
/*
* BUG: we ignore shift here.
* we need a more general solution,
* one that will also work for serial mice.
*/
Queue *psauxq;
static void
psauxputc(int c, int)
{
uchar uc;
uc = c;
qproduce(psauxq, &uc, 1);
}
static long
psauxread(Chan*, void *a, long n, vlong)
{
return qread(psauxq, a, n);
}
static long
psauxwrite(Chan*, void *a, long n, vlong)
{
return i8042auxcmds(a, n);
}
void
psauxlink(void)
{
psauxq = qopen(1024, Qcoalesce, 0, 0);
if(psauxq == nil)
panic("psauxlink");
qnoblock(psauxq, 1);
i8042auxenable(psauxputc);
addarchfile("psaux", DMEXCL|0660, psauxread, psauxwrite);
}

View file

@ -49,7 +49,6 @@ void guesscpuhz(int);
void halt(void);
void mwait(void*);
int i8042auxcmd(int);
int i8042auxcmds(uchar*, int);
void i8042auxenable(void (*)(int, int));
void i8042reset(void);
void i8250console(void);