Remove one level of interrupt redirection by switching on the ADB
hardware type and registering a Cuda or PMU interrupt handler specifically instead of an intermediate interrupt handler.
This commit is contained in:
parent
c5d6d91dc9
commit
969369e173
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: adb.c,v 1.17 2005/02/01 02:46:00 briggs Exp $ */
|
||||
/* $NetBSD: adb.c,v 1.18 2005/02/01 03:08:16 briggs Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (C) 1994 Bradley A. Grantham
|
||||
@ -31,7 +31,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: adb.c,v 1.17 2005/02/01 02:46:00 briggs Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: adb.c,v 1.18 2005/02/01 03:08:16 briggs Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/device.h>
|
||||
@ -134,9 +134,14 @@ adbattach(parent, self, aux)
|
||||
adb_polling = 1;
|
||||
ADBReInit();
|
||||
|
||||
intr_establish(irq, IST_LEVEL, IPL_HIGH, (int (*)(void *))adb_intr, sc);
|
||||
if (adbHardware == ADB_HW_PMU) {
|
||||
switch (adbHardware) {
|
||||
case ADB_HW_CUDA:
|
||||
intr_establish(irq, IST_LEVEL, IPL_HIGH, adb_intr_cuda, sc);
|
||||
break;
|
||||
case ADB_HW_PMU:
|
||||
intr_establish(irq, IST_LEVEL, IPL_HIGH, pm_intr, sc);
|
||||
pm_init();
|
||||
break;
|
||||
}
|
||||
|
||||
#ifdef ADB_DEBUG
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: adb_direct.c,v 1.29 2005/02/01 02:54:17 briggs Exp $ */
|
||||
/* $NetBSD: adb_direct.c,v 1.30 2005/02/01 03:08:16 briggs Exp $ */
|
||||
|
||||
/* From: adb_direct.c 2.02 4/18/97 jpw */
|
||||
|
||||
@ -60,7 +60,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: adb_direct.c,v 1.29 2005/02/01 02:54:17 briggs Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: adb_direct.c,v 1.30 2005/02/01 03:08:16 briggs Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/cdefs.h>
|
||||
@ -256,7 +256,6 @@ extern int adb_polling; /* Are we polling? */
|
||||
|
||||
void pm_setup_adb __P((void));
|
||||
void pm_check_adb_devices __P((int));
|
||||
void pm_intr __P((void));
|
||||
int pm_adb_op __P((u_char *, void *, void *, int));
|
||||
void pm_init_adb_device __P((void));
|
||||
|
||||
@ -266,10 +265,8 @@ void pm_init_adb_device __P((void));
|
||||
#ifdef ADB_DEBUG
|
||||
void print_single __P((u_char *));
|
||||
#endif
|
||||
void adb_intr __P((void));
|
||||
void adb_intr_II __P((void));
|
||||
void adb_intr_IIsi __P((void));
|
||||
void adb_intr_cuda __P((void));
|
||||
void adb_soft_intr __P((void));
|
||||
int send_adb_II __P((u_char *, u_char *, void *, void *, int));
|
||||
int send_adb_IIsi __P((u_char *, u_char *, void *, void *, int));
|
||||
@ -365,8 +362,8 @@ adb_cuda_tickle(void)
|
||||
* TO DO: do we want to add some calls to intr_dispatch() here to
|
||||
* grab serial interrupts?
|
||||
*/
|
||||
void
|
||||
adb_intr_cuda(void)
|
||||
int
|
||||
adb_intr_cuda(void *arg)
|
||||
{
|
||||
volatile int i, ending;
|
||||
volatile unsigned int s;
|
||||
@ -379,7 +376,7 @@ adb_intr_cuda(void)
|
||||
reg = read_via_reg(VIA1, vIFR); /* Read the interrupts */
|
||||
if ((reg & 0x80) == 0) {
|
||||
splx(s);
|
||||
return; /* No interrupts to process */
|
||||
return 0; /* No interrupts to process */
|
||||
}
|
||||
|
||||
write_via_reg(VIA1, vIFR, reg & 0x7f); /* Clear 'em */
|
||||
@ -594,7 +591,7 @@ switch_start:
|
||||
|
||||
splx(s); /* restore */
|
||||
|
||||
return;
|
||||
return 1;
|
||||
} /* end adb_intr_cuda */
|
||||
|
||||
|
||||
@ -680,7 +677,7 @@ send_adb_cuda(u_char * in, u_char * buffer, void *compRout, void *data, int
|
||||
while ((adbActionState != ADB_ACTION_IDLE) || (ADB_INTR_IS_ON)
|
||||
|| (adbWaiting == 1))
|
||||
if (ADB_SR_INTR_IS_ON) { /* wait for "interrupt" */
|
||||
adb_intr_cuda(); /* process it */
|
||||
adb_intr_cuda(NULL); /* process it */
|
||||
adb_soft_intr();
|
||||
}
|
||||
|
||||
@ -755,13 +752,8 @@ adb_guess_next_device(void)
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Called when when an adb interrupt happens.
|
||||
* This routine simply transfers control over to the appropriate
|
||||
* code for the machine we are running on.
|
||||
*/
|
||||
void
|
||||
adb_intr(void)
|
||||
int
|
||||
adb_intr(void *arg)
|
||||
{
|
||||
switch (adbHardware) {
|
||||
case ADB_HW_II:
|
||||
@ -773,16 +765,17 @@ adb_intr(void)
|
||||
break;
|
||||
|
||||
case ADB_HW_PMU:
|
||||
pm_intr();
|
||||
return pm_intr(arg);
|
||||
break;
|
||||
|
||||
case ADB_HW_CUDA:
|
||||
adb_intr_cuda();
|
||||
return adb_intr_cuda(arg);
|
||||
break;
|
||||
|
||||
case ADB_HW_UNKNOWN:
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: adbvar.h,v 1.8 2005/02/01 02:05:10 briggs Exp $ */
|
||||
/* $NetBSD: adbvar.h,v 1.9 2005/02/01 03:08:16 briggs Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (C) 1994 Bradley A. Grantham
|
||||
@ -93,10 +93,11 @@ extern int adbHardware;
|
||||
#define ADBLISTEN(dev, reg) ((((u_int8_t)(dev) & 0x0f) << 4) | 0x08 | (reg))
|
||||
#define ADBTALK(dev, reg) ((((u_int8_t)(dev) & 0x0f) << 4) | 0x0c | (reg))
|
||||
|
||||
void adb_intr __P((void));
|
||||
int adb_intr __P((void *));
|
||||
int adb_poweroff __P((void));
|
||||
void adb_restart __P((void));
|
||||
void adb_cuda_autopoll __P((void));
|
||||
int adb_intr_cuda __P((void *));
|
||||
int CountADBs __P((void));
|
||||
void ADBReInit __P((void));
|
||||
int GetIndADB __P((ADBDataBlock * info, int index));
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: akbd.c,v 1.31 2003/07/24 20:56:24 nathanw Exp $ */
|
||||
/* $NetBSD: akbd.c,v 1.32 2005/02/01 03:08:16 briggs Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 1998 Colin Wood
|
||||
@ -31,7 +31,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: akbd.c,v 1.31 2003/07/24 20:56:24 nathanw Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: akbd.c,v 1.32 2005/02/01 03:08:16 briggs Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/device.h>
|
||||
@ -611,7 +611,7 @@ akbd_cngetc(v, type, data)
|
||||
KASSERT(adb_polling);
|
||||
|
||||
while (sc->sc_npolledkeys == 0) {
|
||||
adb_intr();
|
||||
adb_intr(NULL);
|
||||
DELAY(10000); /* XXX */
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: pm_direct.c,v 1.23 2005/02/01 02:46:00 briggs Exp $ */
|
||||
/* $NetBSD: pm_direct.c,v 1.24 2005/02/01 03:08:16 briggs Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 1997 Takashi Hamada
|
||||
@ -38,7 +38,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: pm_direct.c,v 1.23 2005/02/01 02:46:00 briggs Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: pm_direct.c,v 1.24 2005/02/01 03:08:16 briggs Exp $");
|
||||
|
||||
#ifdef DEBUG
|
||||
#ifndef ADB_DEBUG
|
||||
@ -194,18 +194,17 @@ int pm_wait_free __P((int));
|
||||
int pm_receive_pm1 __P((u_char *));
|
||||
int pm_send_pm1 __P((u_char,int));
|
||||
int pm_pmgrop_pm1 __P((PMData *));
|
||||
void pm_intr_pm1 __P((void));
|
||||
int pm_intr_pm1 __P((void *));
|
||||
|
||||
/* these functions are for the PB Duo series and the PB 5XX series */
|
||||
int pm_receive_pm2 __P((u_char *));
|
||||
int pm_send_pm2 __P((u_char));
|
||||
int pm_pmgrop_pm2 __P((PMData *));
|
||||
void pm_intr_pm2 __P((void));
|
||||
int pm_intr_pm2 __P((void *));
|
||||
|
||||
/* these functions are called from adb_direct.c */
|
||||
void pm_setup_adb __P((void));
|
||||
void pm_check_adb_devices __P((int));
|
||||
void pm_intr __P((void));
|
||||
int pm_adb_op __P((u_char *, void *, void *, int));
|
||||
|
||||
/* these functions also use the variables of adb_direct.c */
|
||||
@ -640,8 +639,8 @@ pm_pmgrop_pm1(pmdata)
|
||||
/*
|
||||
* My PM interrupt routine for PB1XX series
|
||||
*/
|
||||
void
|
||||
pm_intr_pm1()
|
||||
int
|
||||
pm_intr_pm1(void *arg)
|
||||
{
|
||||
#if 0
|
||||
int s;
|
||||
@ -690,6 +689,7 @@ pm_intr_pm1()
|
||||
#else
|
||||
panic("pm_intr_pm1");
|
||||
#endif
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
@ -913,8 +913,8 @@ pm_pmgrop_pm2(pmdata)
|
||||
/*
|
||||
* My PM interrupt routine for the PB Duo series and the PB 5XX series
|
||||
*/
|
||||
void
|
||||
pm_intr_pm2()
|
||||
int
|
||||
pm_intr_pm2(void *arg)
|
||||
{
|
||||
int s;
|
||||
int rval;
|
||||
@ -935,7 +935,7 @@ pm_intr_pm2()
|
||||
printf("pm: PM is not ready. error code: %08x\n", rval);
|
||||
#endif
|
||||
splx(s);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
switch ((u_int)(pmdata.data[2] & 0xff)) {
|
||||
@ -991,6 +991,8 @@ pm_intr_pm2()
|
||||
}
|
||||
|
||||
splx(s);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
@ -1018,19 +1020,20 @@ pmgrop(pmdata)
|
||||
/*
|
||||
* My PM interrupt routine
|
||||
*/
|
||||
void
|
||||
pm_intr()
|
||||
int
|
||||
pm_intr(void *arg)
|
||||
{
|
||||
switch (pmHardware) {
|
||||
case PM_HW_PB1XX:
|
||||
pm_intr_pm1();
|
||||
return pm_intr_pm1(arg);
|
||||
break;
|
||||
case PM_HW_PB5XX:
|
||||
pm_intr_pm2();
|
||||
return pm_intr_pm2(arg);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@ -1120,7 +1123,7 @@ pm_adb_op(buffer, compRout, data, command)
|
||||
timo = 0x80000;
|
||||
while (adbWaiting == 1) {
|
||||
if (read_via_reg(VIA1, vIFR) & 0x14)
|
||||
pm_intr();
|
||||
pm_intr(NULL);
|
||||
#ifdef PM_GRAB_SI
|
||||
#if 0
|
||||
zshard(0); /* grab any serial interrupts */
|
||||
@ -1134,7 +1137,7 @@ pm_adb_op(buffer, compRout, data, command)
|
||||
* when i press a key after boot and before adb
|
||||
* is attached; For example, when booting with -d.
|
||||
*/
|
||||
pm_intr();
|
||||
pm_intr(NULL);
|
||||
if (adbWaiting) {
|
||||
printf("pm_adb_op: timeout. command = 0x%x\n",command);
|
||||
splx(s);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: pm_direct.h,v 1.9 2005/02/01 02:46:00 briggs Exp $ */
|
||||
/* $NetBSD: pm_direct.h,v 1.10 2005/02/01 03:08:16 briggs Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 1997 Takashi Hamada
|
||||
@ -46,6 +46,7 @@ typedef struct {
|
||||
} PMData;
|
||||
|
||||
int pmgrop __P((PMData *));
|
||||
int pm_intr __P((void *));
|
||||
void pm_init __P((void));
|
||||
void pm_adb_restart __P((void));
|
||||
void pm_adb_poweroff __P((void));
|
||||
|
Loading…
Reference in New Issue
Block a user