Since ~all pckbc_poll_data1() callers had the appropriate pckbc
tag handy and we are going to need more of it in pckbc_poll_data1() soon, change pckbc_poll_data1() to accept it as first arg. iot, ioh_d, ioh_c are no longer passed separately. Use fabricated pckbc tag for calls from arch/arc/jazz/pckbc_jazzio.c and dev/isa/pckbc_isa.c.
This commit is contained in:
parent
1278735b51
commit
000f85917b
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: pckbc_jazzio.c,v 1.3 2001/06/13 15:11:38 soda Exp $ */
|
||||
/* $NetBSD: pckbc_jazzio.c,v 1.4 2001/07/23 21:03:19 jdolecek Exp $ */
|
||||
/* NetBSD: pckbc_isa.c,v 1.2 2000/03/23 07:01:35 thorpej Exp */
|
||||
|
||||
/*
|
||||
|
@ -85,6 +85,8 @@ pckbc_jazzio_match(parent, match, aux)
|
|||
return(0);
|
||||
|
||||
if (pckbc_is_console(iot, addr) == 0) {
|
||||
struct pckbc_internal t;
|
||||
|
||||
if (bus_space_map(iot, addr + KBDATAP, 1, 0, &ioh_d))
|
||||
return (0);
|
||||
if (bus_space_map(iot, PICA_KBCMDP, 1, 0, &ioh_c)) {
|
||||
|
@ -92,15 +94,20 @@ pckbc_jazzio_match(parent, match, aux)
|
|||
return (0);
|
||||
}
|
||||
|
||||
memset(&t, 0, sizeof(t));
|
||||
t.t_iot = iot;
|
||||
t.t_ioh_d = ioh_d;
|
||||
t.t_ioh_c = ioh_c;
|
||||
|
||||
/* flush KBC */
|
||||
(void) pckbc_poll_data1(iot, ioh_d, ioh_c, PCKBC_KBD_SLOT, 0);
|
||||
(void) pckbc_poll_data1(&t, PCKBC_KBD_SLOT, 0);
|
||||
|
||||
/* KBC selftest */
|
||||
if (pckbc_send_cmd(iot, ioh_c, KBC_SELFTEST) == 0) {
|
||||
ok = 0;
|
||||
goto out;
|
||||
}
|
||||
res = pckbc_poll_data1(iot, ioh_d, ioh_c, PCKBC_KBD_SLOT, 0);
|
||||
res = pckbc_poll_data1(&t, PCKBC_KBD_SLOT, 0);
|
||||
if (res != 0x55) {
|
||||
printf("kbc selftest: %x\n", res);
|
||||
ok = 0;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: pckbc.c,v 1.13 2001/07/07 16:13:50 thorpej Exp $ */
|
||||
/* $NetBSD: pckbc.c,v 1.14 2001/07/23 21:03:21 jdolecek Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1998
|
||||
|
@ -148,23 +148,22 @@ pckbc_send_cmd(iot, ioh_c, val)
|
|||
}
|
||||
|
||||
int
|
||||
pckbc_poll_data1(iot, ioh_d, ioh_c, slot, checkaux)
|
||||
bus_space_tag_t iot;
|
||||
bus_space_handle_t ioh_d, ioh_c;
|
||||
pckbc_poll_data1(pt, slot, checkaux)
|
||||
pckbc_tag_t pt;
|
||||
pckbc_slot_t slot;
|
||||
int checkaux;
|
||||
{
|
||||
struct pckbc_internal *t = pt;
|
||||
int i;
|
||||
u_char stat;
|
||||
u_char stat, c;
|
||||
|
||||
/* if 1 port read takes 1us (?), this polls for 100ms */
|
||||
for (i = 100000; i; i--) {
|
||||
stat = bus_space_read_1(iot, ioh_c, 0);
|
||||
stat = bus_space_read_1(t->t_iot, t->t_ioh_c, 0);
|
||||
if (stat & KBS_DIB) {
|
||||
register u_char c;
|
||||
|
||||
KBD_DELAY;
|
||||
c = bus_space_read_1(iot, ioh_d, 0);
|
||||
c = bus_space_read_1(t->t_iot, t->t_ioh_d, 0);
|
||||
|
||||
if (checkaux && (stat & 0x20)) { /* aux data */
|
||||
if (slot != PCKBC_AUX_SLOT) {
|
||||
#ifdef PCKBCDEBUG
|
||||
|
@ -194,14 +193,12 @@ pckbc_get8042cmd(t)
|
|||
struct pckbc_internal *t;
|
||||
{
|
||||
bus_space_tag_t iot = t->t_iot;
|
||||
bus_space_handle_t ioh_d = t->t_ioh_d;
|
||||
bus_space_handle_t ioh_c = t->t_ioh_c;
|
||||
int data;
|
||||
|
||||
if (!pckbc_send_cmd(iot, ioh_c, K_RDCMDBYTE))
|
||||
return (0);
|
||||
data = pckbc_poll_data1(iot, ioh_d, ioh_c, PCKBC_KBD_SLOT,
|
||||
t->t_haveaux);
|
||||
data = pckbc_poll_data1(t, PCKBC_KBD_SLOT, t->t_haveaux);
|
||||
if (data == -1)
|
||||
return (0);
|
||||
t->t_cmdbyte = data;
|
||||
|
@ -316,7 +313,7 @@ pckbc_attach(sc)
|
|||
ioh_c = t->t_ioh_c;
|
||||
|
||||
/* flush */
|
||||
(void) pckbc_poll_data1(iot, ioh_d, ioh_c, PCKBC_KBD_SLOT, 0);
|
||||
(void) pckbc_poll_data1(t, PCKBC_KBD_SLOT, 0);
|
||||
|
||||
/* set initial cmd byte */
|
||||
if (!pckbc_put8042cmd(t)) {
|
||||
|
@ -334,7 +331,7 @@ pckbc_attach(sc)
|
|||
*/
|
||||
if (!pckbc_send_cmd(iot, ioh_c, KBC_KBDTEST))
|
||||
return;
|
||||
res = pckbc_poll_data1(iot, ioh_d, ioh_c, PCKBC_KBD_SLOT, 0);
|
||||
res = pckbc_poll_data1(t, PCKBC_KBD_SLOT, 0);
|
||||
|
||||
/*
|
||||
* Normally, we should get a "0" here.
|
||||
|
@ -370,7 +367,7 @@ pckbc_attach(sc)
|
|||
goto nomouse;
|
||||
}
|
||||
bus_space_write_1(iot, ioh_d, 0, 0x5a); /* a random value */
|
||||
res = pckbc_poll_data1(iot, ioh_d, ioh_c, PCKBC_AUX_SLOT, 1);
|
||||
res = pckbc_poll_data1(t, PCKBC_AUX_SLOT, 1);
|
||||
if (res != -1) {
|
||||
/*
|
||||
* In most cases, the 0x5a gets echoed.
|
||||
|
@ -428,8 +425,7 @@ pckbc_flush(self, slot)
|
|||
{
|
||||
struct pckbc_internal *t = self;
|
||||
|
||||
(void) pckbc_poll_data1(t->t_iot, t->t_ioh_d, t->t_ioh_c,
|
||||
slot, t->t_haveaux);
|
||||
(void) pckbc_poll_data1(t, slot, t->t_haveaux);
|
||||
}
|
||||
|
||||
int
|
||||
|
@ -441,8 +437,7 @@ pckbc_poll_data(self, slot)
|
|||
struct pckbc_slotdata *q = t->t_slotdata[slot];
|
||||
int c;
|
||||
|
||||
c = pckbc_poll_data1(t->t_iot, t->t_ioh_d, t->t_ioh_c,
|
||||
slot, t->t_haveaux);
|
||||
c = pckbc_poll_data1(t, slot, t->t_haveaux);
|
||||
if (c != -1 && q && CMD_IN_QUEUE(q)) {
|
||||
/* we jumped into a running command - try to
|
||||
deliver the response */
|
||||
|
@ -554,9 +549,6 @@ pckbc_poll_cmd1(t, slot, cmd)
|
|||
pckbc_slot_t slot;
|
||||
struct pckbc_devcmd *cmd;
|
||||
{
|
||||
bus_space_tag_t iot = t->t_iot;
|
||||
bus_space_handle_t ioh_d = t->t_ioh_d;
|
||||
bus_space_handle_t ioh_c = t->t_ioh_c;
|
||||
int i, c = 0;
|
||||
|
||||
while (cmd->cmdidx < cmd->cmdlen) {
|
||||
|
@ -566,8 +558,7 @@ pckbc_poll_cmd1(t, slot, cmd)
|
|||
return;
|
||||
}
|
||||
for (i = 10; i; i--) { /* 1s ??? */
|
||||
c = pckbc_poll_data1(iot, ioh_d, ioh_c, slot,
|
||||
t->t_haveaux);
|
||||
c = pckbc_poll_data1(t, slot, t->t_haveaux);
|
||||
if (c != -1)
|
||||
break;
|
||||
}
|
||||
|
@ -608,8 +599,7 @@ pckbc_poll_cmd1(t, slot, cmd)
|
|||
else
|
||||
i = 10; /* 1s ??? */
|
||||
while (i--) {
|
||||
c = pckbc_poll_data1(iot, ioh_d, ioh_c, slot,
|
||||
t->t_haveaux);
|
||||
c = pckbc_poll_data1(t, slot, t->t_haveaux);
|
||||
if (c != -1)
|
||||
break;
|
||||
}
|
||||
|
@ -967,6 +957,7 @@ pckbc_cnattach(iot, addr, cmd_offset, slot)
|
|||
return (ENXIO);
|
||||
}
|
||||
|
||||
memset(&pckbc_consdata, 0, sizeof(pckbc_consdata));
|
||||
pckbc_consdata.t_iot = iot;
|
||||
pckbc_consdata.t_ioh_d = ioh_d;
|
||||
pckbc_consdata.t_ioh_c = ioh_c;
|
||||
|
@ -974,7 +965,7 @@ pckbc_cnattach(iot, addr, cmd_offset, slot)
|
|||
callout_init(&pckbc_consdata.t_cleanup);
|
||||
|
||||
/* flush */
|
||||
(void) pckbc_poll_data1(iot, ioh_d, ioh_c, PCKBC_KBD_SLOT, 0);
|
||||
(void) pckbc_poll_data1(&pckbc_consdata, PCKBC_KBD_SLOT, 0);
|
||||
|
||||
/* selftest? */
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: pckbcvar.h,v 1.5 2001/06/17 16:15:41 jdolecek Exp $ */
|
||||
/* $NetBSD: pckbcvar.h,v 1.6 2001/07/23 21:03:22 jdolecek Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1998
|
||||
|
@ -96,8 +96,7 @@ int pckbc_enqueue_cmd __P((pckbc_tag_t, pckbc_slot_t, u_char *, int,
|
|||
int, int, u_char *));
|
||||
int pckbc_send_cmd __P((bus_space_tag_t, bus_space_handle_t, u_char));
|
||||
int pckbc_poll_data __P((pckbc_tag_t, pckbc_slot_t));
|
||||
int pckbc_poll_data1 __P((bus_space_tag_t, bus_space_handle_t,
|
||||
bus_space_handle_t, pckbc_slot_t, int));
|
||||
int pckbc_poll_data1 __P((pckbc_tag_t, pckbc_slot_t, int));
|
||||
void pckbc_set_poll __P((pckbc_tag_t, pckbc_slot_t, int));
|
||||
int pckbc_xt_translation __P((pckbc_tag_t, pckbc_slot_t, int));
|
||||
void pckbc_slot_enable __P((pckbc_tag_t, pckbc_slot_t, int));
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: pckbc_isa.c,v 1.3 2001/07/18 20:39:53 thorpej Exp $ */
|
||||
/* $NetBSD: pckbc_isa.c,v 1.4 2001/07/23 21:03:22 jdolecek Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1998
|
||||
|
@ -84,6 +84,8 @@ pckbc_isa_match(parent, match, aux)
|
|||
return (0);
|
||||
|
||||
if (pckbc_is_console(iot, IO_KBD) == 0) {
|
||||
struct pckbc_internal t;
|
||||
|
||||
if (bus_space_map(iot, IO_KBD + KBDATAP, 1, 0, &ioh_d))
|
||||
return (0);
|
||||
if (bus_space_map(iot, IO_KBD + KBCMDP, 1, 0, &ioh_c)) {
|
||||
|
@ -91,15 +93,20 @@ pckbc_isa_match(parent, match, aux)
|
|||
return (0);
|
||||
}
|
||||
|
||||
memset(&t, 0, sizeof(t));
|
||||
t.t_iot = iot;
|
||||
t.t_ioh_d = ioh_d;
|
||||
t.t_ioh_c = ioh_c;
|
||||
|
||||
/* flush KBC */
|
||||
(void) pckbc_poll_data1(iot, ioh_d, ioh_c, PCKBC_KBD_SLOT, 0);
|
||||
(void) pckbc_poll_data1(&t, PCKBC_KBD_SLOT, 0);
|
||||
|
||||
/* KBC selftest */
|
||||
if (pckbc_send_cmd(iot, ioh_c, KBC_SELFTEST) == 0) {
|
||||
ok = 0;
|
||||
goto out;
|
||||
}
|
||||
res = pckbc_poll_data1(iot, ioh_d, ioh_c, PCKBC_KBD_SLOT, 0);
|
||||
res = pckbc_poll_data1(&t, PCKBC_KBD_SLOT, 0);
|
||||
if (res != 0x55) {
|
||||
printf("kbc selftest: %x\n", res);
|
||||
ok = 0;
|
||||
|
|
Loading…
Reference in New Issue