Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys Abstract the interface between pckbc(4), and the pckbd(4...
details: https://anonhg.NetBSD.org/src/rev/4ac90829532e
branches: trunk
changeset: 559238:4ac90829532e
user: bjh21 <bjh21%NetBSD.org@localhost>
date: Sat Mar 13 17:31:33 2004 +0000
description:
Abstract the interface between pckbc(4), and the pckbd(4) and pms(4)
drivers that attach to it. This allows for other host interface chips
that use the same keyboards and mice, such as the ones in the ARM
IOMD20, ARM7500, and SA-1111. The PC-compatible driver is still
called pckbc(4), and the new abstraction layer is "pckbport", so the
child devices have moved from sys/dev/pckbc to sys/dev/pckbport, which
also contains some code shared between all host controllers. To avoid
incompatibility, pckbdreg.h is still installed in
/usr/include/dev/pckbc.
In theory, this shouldn't cause any behavioural changes in the drivers
concerned. Thy just use rather more function pointers than before. Tested
on i386 and (with a new host driver) acorn32. Compiled on several other
affected architectures.
diffstat:
sys/arch/algor/conf/files.algor | 4 +-
sys/arch/alpha/conf/files.alpha | 4 +-
sys/arch/amd64/conf/files.amd64 | 4 +-
sys/arch/arc/conf/files.arc | 4 +-
sys/arch/arc/jazz/pckbc_jazzio.c | 8 +-
sys/arch/arm/sa11x0/sa1111_kbc.c | 519 +------------------
sys/arch/atari/conf/files.atari | 4 +-
sys/arch/bebox/bebox/machdep.c | 11 +-
sys/arch/bebox/conf/files.bebox | 8 +-
sys/arch/bebox/isa/pccons.c | 50 +-
sys/arch/cats/conf/files.cats | 4 +-
sys/arch/evbarm/conf/files.lubbock | 16 +-
sys/arch/evbmips/conf/files.malta | 4 +-
sys/arch/evbppc/conf/files.ev64260 | 4 +-
sys/arch/evbppc/conf/files.explora | 4 +-
sys/arch/evbppc/conf/files.walnut | 4 +-
sys/arch/hp700/conf/files.hp700 | 4 +-
sys/arch/i386/conf/files.i386 | 8 +-
sys/arch/i386/isa/pccons.c | 50 +-
sys/arch/ibmnws/conf/files.ibmnws | 4 +-
sys/arch/netwinder/conf/files.netwinder | 4 +-
sys/arch/prep/conf/files.prep | 4 +-
sys/arch/sandpoint/conf/files.sandpoint | 4 +-
sys/arch/sbmips/conf/files.sbmips | 4 +-
sys/arch/sgimips/conf/files.sgimips | 4 +-
sys/arch/sparc/conf/files.sparc | 16 +-
sys/arch/sparc/dev/kbd_pckbc.c | 804 --------------------------------
sys/arch/sparc/dev/kbd_pckbport.c | 803 +++++++++++++++++++++++++++++++
sys/arch/sparc/dev/ms_pckbc.c | 308 ------------
sys/arch/sparc/dev/ms_pckbport.c | 308 ++++++++++++
sys/arch/sparc/dev/pckbc_js.c | 10 +-
sys/arch/x86/x86/consinit.c | 11 +-
sys/dev/Makefile | 4 +-
sys/dev/hpc/files.hpckbd | 4 +-
sys/dev/hpc/hpckbd.c | 6 +-
sys/dev/hpc/pckbd_encode.c | 6 +-
sys/dev/ic/pckbc.c | 568 ++--------------------
sys/dev/isa/pckbc_isa.c | 8 +-
sys/dev/isa/pcppi.c | 7 +-
sys/dev/pckbc/Makefile | 8 -
sys/dev/pckbc/files.pckbc | 12 -
sys/dev/pckbc/pckbd.c | 690 ---------------------------
sys/dev/pckbc/pckbdreg.h | 27 -
sys/dev/pckbc/pckbdvar.h | 5 -
sys/dev/pckbc/pms.c | 664 --------------------------
sys/dev/pckbc/pmsreg.h | 19 -
sys/dev/pckbc/wskbdmap_mfii.c | 556 ----------------------
sys/dev/pckbc/wskbdmap_mfii.h | 39 -
sys/dev/pckbport/Makefile | 9 +
sys/dev/pckbport/files.pckbport | 15 +
sys/dev/pckbport/pckbd.c | 691 +++++++++++++++++++++++++++
sys/dev/pckbport/pckbdreg.h | 27 +
sys/dev/pckbport/pckbdvar.h | 7 +
sys/dev/pckbport/pckbport.c | 683 +++++++++++++++++++++++++++
sys/dev/pckbport/pckbportvar.h | 113 ++++
sys/dev/pckbport/pms.c | 664 ++++++++++++++++++++++++++
sys/dev/pckbport/pmsreg.h | 19 +
sys/dev/pckbport/wskbdmap_mfii.c | 556 ++++++++++++++++++++++
sys/dev/pckbport/wskbdmap_mfii.h | 39 +
59 files changed, 4185 insertions(+), 4259 deletions(-)
diffs (truncated from 9798 to 300 lines):
diff -r 9c8fff080ca6 -r 4ac90829532e sys/arch/algor/conf/files.algor
--- a/sys/arch/algor/conf/files.algor Sat Mar 13 17:23:32 2004 +0000
+++ b/sys/arch/algor/conf/files.algor Sat Mar 13 17:31:33 2004 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: files.algor,v 1.17 2003/10/08 17:29:59 bouyer Exp $
+# $NetBSD: files.algor,v 1.18 2004/03/13 17:31:33 bjh21 Exp $
# Algorithmics evaluation board specific configuration info.
@@ -79,7 +79,7 @@
#
# Machine-independent PC-style keyboard controller drivers
#
-include "dev/pckbc/files.pckbc"
+include "dev/pckbport/files.pckbport"
#
# Machine-independent USB device support
diff -r 9c8fff080ca6 -r 4ac90829532e sys/arch/alpha/conf/files.alpha
--- a/sys/arch/alpha/conf/files.alpha Sat Mar 13 17:23:32 2004 +0000
+++ b/sys/arch/alpha/conf/files.alpha Sat Mar 13 17:31:33 2004 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: files.alpha,v 1.165 2004/01/20 19:58:00 jdolecek Exp $
+# $NetBSD: files.alpha,v 1.166 2004/03/13 17:31:33 bjh21 Exp $
#
# alpha-specific configuration info
@@ -223,7 +223,7 @@
define isadma_bounce
file arch/alpha/isa/isadma_bounce.c isadma_bounce
-include "dev/pckbc/files.pckbc"
+include "dev/pckbport/files.pckbport"
# ISA speaker generates keyboard beep
device isabeep
diff -r 9c8fff080ca6 -r 4ac90829532e sys/arch/amd64/conf/files.amd64
--- a/sys/arch/amd64/conf/files.amd64 Sat Mar 13 17:23:32 2004 +0000
+++ b/sys/arch/amd64/conf/files.amd64 Sat Mar 13 17:31:33 2004 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: files.amd64,v 1.8 2004/01/20 19:58:00 jdolecek Exp $
+# $NetBSD: files.amd64,v 1.9 2004/03/13 17:31:33 bjh21 Exp $
#
# new style config file for amd64 architecture
#
@@ -140,7 +140,7 @@
include "dev/wscons/files.wscons"
include "dev/wsfont/files.wsfont"
-include "dev/pckbc/files.pckbc"
+include "dev/pckbport/files.pckbport"
device sysbeep
attach sysbeep at pcppi
diff -r 9c8fff080ca6 -r 4ac90829532e sys/arch/arc/conf/files.arc
--- a/sys/arch/arc/conf/files.arc Sat Mar 13 17:23:32 2004 +0000
+++ b/sys/arch/arc/conf/files.arc Sat Mar 13 17:31:33 2004 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: files.arc,v 1.49 2003/11/17 12:53:47 tsutsui Exp $
+# $NetBSD: files.arc,v 1.50 2004/03/13 17:31:33 bjh21 Exp $
# $OpenBSD: files.arc,v 1.21 1999/09/11 10:20:20 niklas Exp $
#
# maxpartitions must be first item in files.${ARCH}
@@ -95,7 +95,7 @@
#
include "dev/wscons/files.wscons"
-include "dev/pckbc/files.pckbc"
+include "dev/pckbport/files.pckbport"
#
# System BUS types
diff -r 9c8fff080ca6 -r 4ac90829532e sys/arch/arc/jazz/pckbc_jazzio.c
--- a/sys/arch/arc/jazz/pckbc_jazzio.c Sat Mar 13 17:23:32 2004 +0000
+++ b/sys/arch/arc/jazz/pckbc_jazzio.c Sat Mar 13 17:31:33 2004 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pckbc_jazzio.c,v 1.9 2003/07/15 00:04:50 lukem Exp $ */
+/* $NetBSD: pckbc_jazzio.c,v 1.10 2004/03/13 17:31:33 bjh21 Exp $ */
/* NetBSD: pckbc_isa.c,v 1.2 2000/03/23 07:01:35 thorpej Exp */
/*
@@ -33,7 +33,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pckbc_jazzio.c,v 1.9 2003/07/15 00:04:50 lukem Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pckbc_jazzio.c,v 1.10 2004/03/13 17:31:33 bjh21 Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -101,14 +101,14 @@
t.t_ioh_c = ioh_c;
/* flush KBC */
- (void) pckbc_poll_data1(&t, PCKBC_KBD_SLOT, 0);
+ (void) pckbc_poll_data1(&t, PCKBC_KBD_SLOT);
/* KBC selftest */
if (pckbc_send_cmd(iot, ioh_c, KBC_SELFTEST) == 0) {
ok = 0;
goto out;
}
- res = pckbc_poll_data1(&t, PCKBC_KBD_SLOT, 0);
+ res = pckbc_poll_data1(&t, PCKBC_KBD_SLOT);
if (res != 0x55) {
printf("kbc selftest: %x\n", res);
ok = 0;
diff -r 9c8fff080ca6 -r 4ac90829532e sys/arch/arm/sa11x0/sa1111_kbc.c
--- a/sys/arch/arm/sa11x0/sa1111_kbc.c Sat Mar 13 17:23:32 2004 +0000
+++ b/sys/arch/arm/sa11x0/sa1111_kbc.c Sat Mar 13 17:31:33 2004 +0000
@@ -1,6 +1,7 @@
-/* $NetBSD: sa1111_kbc.c,v 1.2 2003/07/15 00:24:50 lukem Exp $ */
+/* $NetBSD: sa1111_kbc.c,v 1.3 2004/03/13 17:31:33 bjh21 Exp $ */
/*
+ * Copyright (c) 2004 Ben Harris.
* Copyright (c) 2002 Genetec Corporation. All rights reserved.
* Written by Hiroyuki Bessho for Genetec Corporation.
*
@@ -29,13 +30,6 @@
* POSSIBILITY OF SUCH DAMAGE.
*
* Driver for keyboard controller in SA-1111 companion chip.
- *
- * PC keyboard driver (sys/dev/pckbc/pckbd.c) works only with 8042
- * keyboard controller driver (sys/dev/ic/pckbc.c). This file
- * provides same functions as those of 8042 driver.
- *
- * XXX: we need cleaner interface between the keyboard driver and
- * keyboard controller drivers.
*/
/*
* Copyright (c) 1998
@@ -69,7 +63,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sa1111_kbc.c,v 1.2 2003/07/15 00:24:50 lukem Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sa1111_kbc.c,v 1.3 2004/03/13 17:31:33 bjh21 Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -88,24 +82,12 @@
#include <arm/sa11x0/sa1111_reg.h>
#include <arm/sa11x0/sa1111_var.h>
-#include <dev/ic/pckbcvar.h> /* for prototypes */
+#include <dev/pckbport/pckbportvar.h> /* for prototypes */
#include "pckbd.h"
#include "rnd.h"
#include "locators.h"
-/* descriptor for one device command */
-struct pckbc_devcmd {
- TAILQ_ENTRY(pckbc_devcmd) next;
- int flags;
-#define KBC_CMDFLAG_SYNC 1 /* give descriptor back to caller */
-#define KBC_CMDFLAG_SLOW 2
- u_char cmd[4];
- int cmdlen, cmdidx, retries;
- u_char response[4];
- int status, responselen, responseidx;
-};
-
struct sackbc_softc {
struct device dev;
@@ -119,33 +101,31 @@
int poll_stat; /* data read from inr handler if polling */
int poll_data; /* status read from intr handler if polling */
- TAILQ_HEAD(, pckbc_devcmd) cmdqueue; /* active commands */
- TAILQ_HEAD(, pckbc_devcmd) freequeue; /* free commands */
-#define NCMD 5
- struct pckbc_devcmd cmd[NCMD];
-
- struct callout t_cleanup;
- pckbc_inputfcn inputhandler;
- void *inputarg;
- const char *subname;
-
+ pckbport_tag_t pt;
};
-#define CMD_IN_QUEUE(q) (TAILQ_FIRST(&(q)->cmdqueue) != NULL)
-
-#define N_KBC_SLOTS 2
-/*static struct sackbc_softc *sackbc_slot[N_KBC_SLOTS] = { NULL, NULL };*/
-
static int sackbc_match(struct device *, struct cfdata *, void *);
static void sackbc_attach(struct device *, struct device *, void *);
-static int sackbc_cmdresponse( struct sackbc_softc *, int );
+
+static int sackbc_xt_translation(void *, pckbport_slot_t, int);
+#define sackbc_send_devcmd sackbc_send_cmd
+static int sackbc_send_devcmd(void *, pckbport_slot_t, u_char);
+static int sackbc_poll_data1(void *, pckbport_slot_t);
+static void sackbc_slot_enable(void *, pckbport_slot_t, int);
+static void sackbc_intr_establish(void *, pckbport_slot_t);
+static void sackbc_set_poll(void *, pckbport_slot_t, int);
CFATTACH_DECL(sackbc, sizeof(struct sackbc_softc), sackbc_match,
sackbc_attach, NULL, NULL);
-/* XXX should not be here */
-#define KBC_DEVCMD_ACK 0xfa
-#define KBC_DEVCMD_RESEND 0xfe
+static struct pckbport_accessops const sackbc_ops = {
+ sackbc_xt_translation,
+ sackbc_send_devcmd,
+ sackbc_poll_data1,
+ sackbc_slot_enable,
+ sackbc_intr_establish,
+ sackbc_set_poll
+};
#define KBD_DELAY DELAY(8)
@@ -157,9 +137,6 @@
#define DPRINTF(arg)
#endif
-static void sackbc_poll_cmd1( struct sackbc_softc *, struct pckbc_devcmd * );
-
-
static int
sackbc_match(struct device *parent, struct cfdata *cf, void *aux)
@@ -200,26 +177,19 @@
sc->poll_data = code;
sc->poll_stat = stat;
}
- else if (CMD_IN_QUEUE(sc) && sackbc_cmdresponse(sc, code))
- ;
- else if( sc->inputhandler ){
- (* sc->inputhandler)( sc->inputarg, code );
- }
+ else
+ pckbportintr(sc->pt, PCKBPORT_KBD_SLOT, code);
return 1;
}
return 0;
}
-static int
-sackbcprint(void *aux, const char *pnp)
+static void
+sackbc_intr_establish(void *cookie, pckbport_slot_t slot)
{
- return (QUIET);
-}
+ struct sackbc_softc *sc = cookie;
-static void
-sackbc_setup_intrhandler(struct sackbc_softc *sc)
-{
if( !(sc->polling) && sc->ih_rx==NULL ){
sc->ih_rx = sacc_intr_establish(
(sacc_chipset_tag_t *)(sc->dev.dv_parent),
@@ -242,27 +212,15 @@
}
}
-static int
-sackbc_submatch(struct device *parent, struct cfdata *cf, void *aux)
-{
- struct pckbc_attach_args *pa = aux;
-
- DPRINTF(( "slot = %d ", cf->cf_loc[SACKBCCF_SLOT] ));
-
- if( pa->pa_slot == PCKBCCF_SLOT_DEFAULT )
- pa->pa_slot = cf->cf_loc[SACKBCCF_SLOT];
-
- return config_match(parent, cf, aux);
-}
-
static void
sackbc_attach(struct device *parent, struct device *self, void *aux)
{
struct sackbc_softc *sc = (struct sackbc_softc *)self;
struct sacc_softc *psc = (struct sacc_softc *)parent;
struct sa1111_attach_args *aa = (struct sa1111_attach_args *)aux;
+ struct device *child;
uint32_t tmp, clock_bit;
- int i, found, intr;
+ int intr;
switch( aa->sa_addr ){
case SACC_KBD0: clock_bit = (1<<6); intr = 21; break;
@@ -290,15 +248,6 @@
sc->ih_rx = NULL;
sc->intr = aa->sa_intr;
- sc->inputhandler = NULL;
- sc->subname = sc->dev.dv_xname;
-
- TAILQ_INIT(&sc->cmdqueue);
- TAILQ_INIT(&sc->freequeue);
Home |
Main Index |
Thread Index |
Old Index