ref: 7304deaec1ed27567dd6c55e245d9d5cc99686bb
parent: f7514acc95ee1b7515936a9a7bfd48f72d21025b
author: cinap_lenrek <[email protected]>
date: Wed Aug 5 06:44:03 EDT 2015
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.
--- a/sys/src/9/pc/devkbd.c
+++ b/sys/src/9/pc/devkbd.c
@@ -159,24 +159,6 @@
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 @@
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 @@
{
if(nokbd)
return;
+ /* disable kbd and aux xfers and interrupts */
ccc &= ~(Ckbdint|Cauxint);
ccc |= (Cauxdis|Ckbddis);
outready();
@@ -391,7 +374,7 @@
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 @@
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");
}
--- a/sys/src/9/pc/fns.h
+++ b/sys/src/9/pc/fns.h
@@ -58,7 +58,6 @@
void halt(void);
void mwait(void*);
int i8042auxcmd(int);
-int i8042auxcmds(uchar*, int);
void i8042auxenable(void (*)(int, int));
void i8042reset(void);
void i8250console(void);
--- a/sys/src/9/pc/psaux.c
+++ /dev/null
@@ -1,57 +1,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);
-}
--- a/sys/src/9/pc64/fns.h
+++ b/sys/src/9/pc64/fns.h
@@ -49,7 +49,6 @@
void halt(void);
void mwait(void*);
int i8042auxcmd(int);
-int i8042auxcmds(uchar*, int);
void i8042auxenable(void (*)(int, int));
void i8042reset(void);
void i8250console(void);