summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2002-06-07 07:14:49 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2002-06-07 07:14:49 +0000
commit843b27eb0c466ac940633b8fef22b72fe516797c (patch)
treeede4fdbefb87193c5aa13264ad3ed79a39953389 /sys
parent4816cf65812cf69013a62e620de3da7942d3f4cb (diff)
Vacuum cleaning of the adb code, step 1: random KNF, remove mac68k
leftovers, unused variables and functions, fix some comments, etc.
Diffstat (limited to 'sys')
-rw-r--r--sys/arch/macppc/dev/adb.c30
-rw-r--r--sys/arch/macppc/dev/adb_direct.c625
-rw-r--r--sys/arch/macppc/dev/adb_direct.h5
-rw-r--r--sys/arch/macppc/dev/adbvar.h50
-rw-r--r--sys/arch/macppc/dev/aed.c139
-rw-r--r--sys/arch/macppc/dev/akbd.c6
-rw-r--r--sys/arch/macppc/dev/pm_direct.c473
-rw-r--r--sys/arch/macppc/dev/viareg.h137
8 files changed, 107 insertions, 1358 deletions
diff --git a/sys/arch/macppc/dev/adb.c b/sys/arch/macppc/dev/adb.c
index b79bd37743a..ed6bd866dc0 100644
--- a/sys/arch/macppc/dev/adb.c
+++ b/sys/arch/macppc/dev/adb.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: adb.c,v 1.4 2002/03/14 01:26:36 millert Exp $ */
+/* $OpenBSD: adb.c,v 1.5 2002/06/07 07:14:48 miod Exp $ */
/* $NetBSD: adb.c,v 1.6 1999/08/16 06:28:09 tsubai Exp $ */
/*-
@@ -43,6 +43,7 @@
#include <machine/autoconf.h>
#include <macppc/dev/adbvar.h>
+#include <macppc/dev/adb_direct.h>
#include <macppc/dev/akbdvar.h>
#include <macppc/dev/viareg.h>
@@ -52,17 +53,16 @@
/*
* Function declarations.
*/
-static int adbmatch(struct device *, void *, void *);
-static void adbattach(struct device *, struct device *, void *);
-static int adbprint(void *, const char *);
+int adbmatch(struct device *, void *, void *);
+void adbattach(struct device *, struct device *, void *);
+int adbprint(void *, const char *);
/*
* Global variables.
*/
-int adb_polling = 0; /* Are we polling? (Debugger mode) */
-int adb_initted = 0; /* adb_init() has completed successfully */
+int adb_polling; /* Are we polling? (Debugger mode) */
#ifdef ADB_DEBUG
-int adb_debug = 0; /* Output debugging messages */
+int adb_debug; /* Output debugging messages */
#endif /* ADB_DEBUG */
/*
@@ -75,7 +75,7 @@ struct cfdriver adb_cd = {
NULL, "adb", DV_DULL
};
-static int
+int
adbmatch(parent, cf, aux)
struct device *parent;
void *cf;
@@ -99,20 +99,16 @@ adbmatch(parent, cf, aux)
}
/* HACK ALERT */
-int adb_read_date_time(unsigned long *time);
-int adb_write_date_time(unsigned long time);
-int adb_set_date_time(unsigned long time);
typedef int (clock_read_t)(int *sec, int *min, int *hour, int *day,
int *mon, int *yr);
-typedef int (time_read_t)(unsigned long *sec);
-typedef int (time_write_t)(unsigned long sec);
+typedef int (time_read_t)(u_long *sec);
+typedef int (time_write_t)(u_long sec);
extern time_read_t *time_read;
extern time_write_t *time_write;
extern clock_read_t *clock_read;
-
-static void
+void
adbattach(parent, self, aux)
struct device *parent, *self;
void *aux;
@@ -125,8 +121,6 @@ adbattach(parent, self, aux)
int totaladbs;
int adbindex, adbaddr;
- extern volatile u_char *Via1Base;
-
ca->ca_reg[0] += ca->ca_baseaddr;
sc->sc_regbase = mapiodev(ca->ca_reg[0], ca->ca_reg[1]);
@@ -217,10 +211,12 @@ adbprint(args, name)
printf("%s addr %d: ", name, aa_args->adbaddr);
switch(aa_args->origaddr) {
#ifdef DIAGNOSTIC
+#if NAED > 0
case 0:
printf("ADB event device");
rv = UNCONF;
break;
+#endif
case ADBADDR_SECURE:
printf("security dongle (%d)", aa_args->handler_id);
break;
diff --git a/sys/arch/macppc/dev/adb_direct.c b/sys/arch/macppc/dev/adb_direct.c
index e045523b73a..81592db50bb 100644
--- a/sys/arch/macppc/dev/adb_direct.c
+++ b/sys/arch/macppc/dev/adb_direct.c
@@ -1,8 +1,6 @@
-/* $OpenBSD: adb_direct.c,v 1.4 2002/03/14 03:15:55 millert Exp $ */
+/* $OpenBSD: adb_direct.c,v 1.5 2002/06/07 07:14:48 miod Exp $ */
/* $NetBSD: adb_direct.c,v 1.14 2000/06/08 22:10:45 tsubai Exp $ */
-/* From: adb_direct.c 2.02 4/18/97 jpw */
-
/*
* Copyright (C) 1996, 1997 John P. Wittkoski
* All rights reserved.
@@ -91,46 +89,20 @@
#define vSR_INT 0x04
#define vSR_OUT 0x10
-/* the type of ADB action that we are currently preforming */
+/* the type of ADB action that we are currently performing */
#define ADB_ACTION_NOTREADY 0x1 /* has not been initialized yet */
#define ADB_ACTION_IDLE 0x2 /* the bus is currently idle */
#define ADB_ACTION_OUT 0x3 /* sending out a command */
#define ADB_ACTION_IN 0x4 /* receiving data */
-#define ADB_ACTION_POLLING 0x5 /* polling - II only */
-
-/*
- * These describe the state of the ADB bus itself, although they
- * don't necessarily correspond directly to ADB states.
- * Note: these are not really used in the IIsi code.
- */
-#define ADB_BUS_UNKNOWN 0x1 /* we don't know yet - all models */
-#define ADB_BUS_IDLE 0x2 /* bus is idle - all models */
-#define ADB_BUS_CMD 0x3 /* starting a command - II models */
-#define ADB_BUS_ODD 0x4 /* the "odd" state - II models */
-#define ADB_BUS_EVEN 0x5 /* the "even" state - II models */
-#define ADB_BUS_ACTIVE 0x6 /* active state - IIsi models */
-#define ADB_BUS_ACK 0x7 /* currently ACKing - IIsi models */
/*
* Shortcuts for setting or testing the VIA bit states.
* Not all shortcuts are used for every type of ADB hardware.
*/
-#define ADB_SET_STATE_IDLE_II() via_reg_or(VIA1, vBufB, (vPB4 | vPB5))
-#define ADB_SET_STATE_IDLE_IISI() via_reg_and(VIA1, vBufB, ~(vPB4 | vPB5))
#define ADB_SET_STATE_IDLE_CUDA() via_reg_or(VIA1, vBufB, (vPB4 | vPB5))
-#define ADB_SET_STATE_CMD() via_reg_and(VIA1, vBufB, ~(vPB4 | vPB5))
-#define ADB_SET_STATE_EVEN() write_via_reg(VIA1, vBufB, \
- (read_via_reg(VIA1, vBufB) | vPB4) & ~vPB5)
-#define ADB_SET_STATE_ODD() write_via_reg(VIA1, vBufB, \
- (read_via_reg(VIA1, vBufB) | vPB5) & ~vPB4 )
-#define ADB_SET_STATE_ACTIVE() via_reg_or(VIA1, vBufB, vPB5)
-#define ADB_SET_STATE_INACTIVE() via_reg_and(VIA1, vBufB, ~vPB5)
#define ADB_SET_STATE_TIP() via_reg_and(VIA1, vBufB, ~vPB5)
#define ADB_CLR_STATE_TIP() via_reg_or(VIA1, vBufB, vPB5)
-#define ADB_SET_STATE_ACKON() via_reg_or(VIA1, vBufB, vPB4)
-#define ADB_SET_STATE_ACKOFF() via_reg_and(VIA1, vBufB, ~vPB4)
#define ADB_TOGGLE_STATE_ACK_CUDA() via_reg_xor(VIA1, vBufB, vPB4)
-#define ADB_SET_STATE_ACKON_CUDA() via_reg_and(VIA1, vBufB, ~vPB4)
#define ADB_SET_STATE_ACKOFF_CUDA() via_reg_or(VIA1, vBufB, vPB4)
#define ADB_SET_SR_INPUT() via_reg_and(VIA1, vACR, ~vSR_OUT)
#define ADB_SET_SR_OUTPUT() via_reg_or(VIA1, vACR, vSR_OUT)
@@ -140,7 +112,6 @@
#define ADB_VIA_CLR_INTR() write_via_reg(VIA1, vIFR, 0x04)
#define ADB_INTR_IS_OFF (vPB3 == (read_via_reg(VIA1, vBufB) & vPB3))
#define ADB_INTR_IS_ON (0 == (read_via_reg(VIA1, vBufB) & vPB3))
-#define ADB_SR_INTR_IS_OFF (0 == (read_via_reg(VIA1, vIFR) & vSR_INT))
#define ADB_SR_INTR_IS_ON (vSR_INT == (read_via_reg(VIA1, \
vIFR) & vSR_INT))
@@ -203,22 +174,15 @@ struct adbCommand {
*/
int adbHardware = ADB_HW_UNKNOWN;
int adbActionState = ADB_ACTION_NOTREADY;
-int adbBusState = ADB_BUS_UNKNOWN;
int adbWaiting = 0; /* waiting for return data from the device */
int adbWriteDelay = 0; /* working on (or waiting to do) a write */
-int adbOutQueueHasData = 0; /* something in the queue waiting to go out */
-int adbNextEnd = 0; /* the next incoming bute is the last (II) */
int adbSoftPower = 0; /* machine supports soft power */
int adbWaitingCmd = 0; /* ADB command we are waiting for */
u_char *adbBuffer = (long)0; /* pointer to user data area */
void *adbCompRout = (long)0; /* pointer to the completion routine */
void *adbCompData = (long)0; /* pointer to the completion routine data */
-long adbFakeInts = 0; /* keeps track of fake ADB interrupts for
- * timeouts (II) */
int adbStarting = 1; /* doing ADBReInit so do polling differently */
-int adbSendTalk = 0; /* the intr routine is sending the talk, not
- * the user (II) */
int adbPolling = 0; /* we are polling for service request */
int adbPollCmd = 0; /* the last poll command we sent */
@@ -227,9 +191,6 @@ u_char adbOutputBuffer[ADB_MAX_MSG_LENGTH]; /* data output buffer */
struct adbCmdHoldEntry adbOutQueue; /* our 1 entry output queue */
int adbSentChars = 0; /* how many characters we have sent */
-int adbLastDevice = 0; /* last ADB dev we heard from (II ONLY) */
-int adbLastDevIndex = 0; /* last ADB dev loc in dev table (II ONLY) */
-int adbLastCommand = 0; /* the last ADB command we sent (II) */
struct ADBDevEntry ADBDevTable[16]; /* our ADB device table */
int ADBNumDevices; /* num. of ADB devices found with ADBReInit */
@@ -250,13 +211,6 @@ struct timeout adb_cuda_timeout;
struct timeout adb_softintr_timeout;
volatile u_char *Via1Base;
-extern int adb_polling; /* Are we polling? */
-
-void pm_setup_adb(void);
-void pm_check_adb_devices(int);
-void pm_intr(void);
-int pm_adb_op(u_char *, void *, void *, int);
-void pm_init_adb_device(void);
/*
* The following are private routines.
@@ -264,14 +218,9 @@ void pm_init_adb_device(void);
#ifdef ADB_DEBUG
void print_single(u_char *);
#endif
-void adb_intr_II(void);
-void adb_intr_IIsi(void);
void adb_intr_cuda(void);
void adb_soft_intr(void);
-int send_adb_II(u_char *, u_char *, void *, void *, int);
-int send_adb_IIsi(u_char *, u_char *, void *, void *, int);
int send_adb_cuda(u_char *, u_char *, void *, void *, int);
-void adb_intr_cuda_test(void);
void adb_cuda_tickle(void);
void adb_pass_up(struct adbCommand *);
void adb_op_comprout(caddr_t, caddr_t, int);
@@ -282,18 +231,9 @@ int get_adb_info(ADBDataBlock *, int);
int set_adb_info(ADBSetInfoBlock *, int);
void adb_setup_hw_type(void);
int adb_op(Ptr, Ptr, Ptr, short);
-void adb_read_II(u_char *);
void adb_hw_setup(void);
-void adb_hw_setup_IIsi(u_char *);
-void adb_comp_exec(void);
int adb_cmd_result(u_char *);
-int adb_cmd_extra(u_char *);
-int adb_guess_next_device(void);
-int adb_prog_switch_enable(void);
-int adb_prog_switch_disable(void);
-/* we should create this and it will be the public version */
-int send_adb(u_char *, void *, void *);
-int setsoftadb(void);
+void setsoftadb(void);
#ifdef ADB_DEBUG
/*
@@ -579,9 +519,7 @@ switch_start:
ADB_VIA_INTR_ENABLE(); /* enable ADB interrupt on IIs. */
splx(s); /* restore */
-
- return;
-} /* end adb_intr_cuda */
+}
int
@@ -617,11 +555,6 @@ send_adb_cuda(u_char * in, u_char * buffer, void *compRout, void *data, int
printf_intr("QUEUE\n");
#endif
if ((long)in == (long)0) { /* need to convert? */
- /*
- * Don't need to use adb_cmd_extra here because this section
- * will be called ONLY when it is an ADB command (no RTC or
- * PRAM)
- */
if ((command & 0x0c) == 0x08) /* copy addl data ONLY if
* doing a listen! */
len = buffer[0]; /* length of additional data */
@@ -671,76 +604,8 @@ send_adb_cuda(u_char * in, u_char * buffer, void *compRout, void *data, int
}
return 0;
-} /* send_adb_cuda */
-
-
-void
-adb_intr_II(void)
-{
- panic("adb_intr_II");
-}
-
-
-/*
- * send_adb version for II series machines
- */
-int
-send_adb_II(u_char * in, u_char * buffer, void *compRout, void *data, int command)
-{
- panic("send_adb_II");
}
-
-/*
- * This routine is called from the II series interrupt routine
- * to determine what the "next" device is that should be polled.
- */
-int
-adb_guess_next_device(void)
-{
- int last, i, dummy;
-
- if (adbStarting) {
- /*
- * Start polling EVERY device, since we can't be sure there is
- * anything in the device table yet
- */
- if (adbLastDevice < 1 || adbLastDevice > 15)
- adbLastDevice = 1;
- if (++adbLastDevice > 15) /* point to next one */
- adbLastDevice = 1;
- } else {
- /* find the next device using the device table */
- if (adbLastDevice < 1 || adbLastDevice > 15) /* let's be parinoid */
- adbLastDevice = 2;
- last = 1; /* default index location */
-
- for (i = 1; i < 16; i++) /* find index entry */
- if (ADBDevTable[i].currentAddr == adbLastDevice) { /* look for device */
- last = i; /* found it */
- break;
- }
- dummy = last; /* index to start at */
- for (;;) { /* find next device in index */
- if (++dummy > 15) /* wrap around if needed */
- dummy = 1;
- if (dummy == last) { /* didn't find any other
- * device! This can happen if
- * there are no devices on the
- * bus */
- dummy = 1;
- break;
- }
- /* found the next device */
- if (ADBDevTable[dummy].devType != 0)
- break;
- }
- adbLastDevice = ADBDevTable[dummy].currentAddr;
- }
- return adbLastDevice;
-}
-
-
/*
* Called when when an adb interrupt happens.
* This routine simply transfers control over to the appropriate
@@ -750,14 +615,6 @@ int
adb_intr(void *arg)
{
switch (adbHardware) {
- case ADB_HW_II:
- adb_intr_II();
- break;
-
- case ADB_HW_IISI:
- adb_intr_IIsi();
- break;
-
case ADB_HW_PB:
pm_intr();
break;
@@ -765,49 +622,11 @@ adb_intr(void *arg)
case ADB_HW_CUDA:
adb_intr_cuda();
break;
-
- case ADB_HW_UNKNOWN:
- break;
}
return 1;
}
-/*
- * called when when an adb interrupt happens
- *
- * IIsi version of adb_intr
- *
- */
-void
-adb_intr_IIsi(void)
-{
- panic("adb_intr_IIsi");
-}
-
-
-/*****************************************************************************
- * if the device is currently busy, and there is no data waiting to go out, then
- * the data is "queued" in the outgoing buffer. If we are already waiting, then
- * we return.
- * in: if (in == 0) then the command string is built from command and buffer
- * if (in != 0) then in is used as the command string
- * buffer: additional data to be sent (used only if in == 0)
- * this is also where return data is stored
- * compRout: the completion routine that is called when then return value
- * is received (if a return value is expected)
- * data: a data pointer that can be used by the completion routine
- * command: an ADB command to be sent (used only if in == 0)
- *
- */
-int
-send_adb_IIsi(u_char * in, u_char * buffer, void *compRout, void *data, int
- command)
-{
- panic("send_adb_IIsi");
-}
-
-
/*
* adb_pass_up is called by the interrupt-time routines.
* It takes the raw packet data that was received from the
@@ -857,16 +676,6 @@ adb_pass_up(struct adbCommand *in)
start = 0;
} else {
switch (adbHardware) {
- case ADB_HW_II:
- cmd = in->data[1];
- if (in->data[0] < 2)
- len = 0;
- else
- len = in->data[0]-1;
- start = 1;
- break;
-
- case ADB_HW_IISI:
case ADB_HW_CUDA:
/* If it's unsolicited, accept only ADB data for now */
if (in->unsol)
@@ -947,8 +756,6 @@ adb_pass_up(struct adbCommand *in)
adb_soft_intr();
else
setsoftadb();
-
- return;
}
@@ -1044,7 +851,6 @@ adb_soft_intr(void)
splx(s);
}
- return;
}
@@ -1067,31 +873,6 @@ adb_op(Ptr buffer, Ptr compRout, Ptr data, short command)
int result;
switch (adbHardware) {
- case ADB_HW_II:
- result = send_adb_II((u_char *)0, (u_char *)buffer,
- (void *)compRout, (void *)data, (int)command);
- if (result == 0)
- return 0;
- else
- return -1;
- break;
-
- case ADB_HW_IISI:
- result = send_adb_IIsi((u_char *)0, (u_char *)buffer,
- (void *)compRout, (void *)data, (int)command);
- /*
- * I wish I knew why this delay is needed. It usually needs to
- * be here when several commands are sent in close succession,
- * especially early in device probes when doing collision
- * detection. It must be some race condition. Sigh. - jpw
- */
- delay(100);
- if (result == 0)
- return 0;
- else
- return -1;
- break;
-
case ADB_HW_PB:
result = pm_adb_op((u_char *)buffer, (void *)compRout,
(void *)data, (int)command);
@@ -1111,7 +892,6 @@ adb_op(Ptr buffer, Ptr compRout, Ptr data, short command)
return -1;
break;
- case ADB_HW_UNKNOWN:
default:
return -1;
}
@@ -1127,55 +907,8 @@ void
adb_hw_setup(void)
{
volatile int i;
- u_char send_string[ADB_MAX_MSG_LENGTH];
switch (adbHardware) {
- case ADB_HW_II:
- via_reg_or(VIA1, vDirB, 0x30); /* register B bits 4 and 5:
- * outputs */
- via_reg_and(VIA1, vDirB, 0xf7); /* register B bit 3: input */
- via_reg_and(VIA1, vACR, ~vSR_OUT); /* make sure SR is set
- * to IN (II, IIsi) */
- adbActionState = ADB_ACTION_IDLE; /* used by all types of
- * hardware (II, IIsi) */
- adbBusState = ADB_BUS_IDLE; /* this var. used in II-series
- * code only */
- write_via_reg(VIA1, vIER, 0x84);/* make sure VIA interrupts
- * are on (II, IIsi) */
- ADB_SET_STATE_IDLE_II(); /* set ADB bus state to idle */
-
- ADB_VIA_CLR_INTR(); /* clear interrupt */
- break;
-
- case ADB_HW_IISI:
- via_reg_or(VIA1, vDirB, 0x30); /* register B bits 4 and 5:
- * outputs */
- via_reg_and(VIA1, vDirB, 0xf7); /* register B bit 3: input */
- via_reg_and(VIA1, vACR, ~vSR_OUT); /* make sure SR is set
- * to IN (II, IIsi) */
- adbActionState = ADB_ACTION_IDLE; /* used by all types of
- * hardware (II, IIsi) */
- adbBusState = ADB_BUS_IDLE; /* this var. used in II-series
- * code only */
- write_via_reg(VIA1, vIER, 0x84);/* make sure VIA interrupts
- * are on (II, IIsi) */
- ADB_SET_STATE_IDLE_IISI(); /* set ADB bus state to idle */
-
- /* get those pesky clock ticks we missed while booting */
- for (i = 0; i < 30; i++) {
- delay(ADB_DELAY);
- adb_hw_setup_IIsi(send_string);
-#ifdef ADB_DEBUG
- if (adb_debug) {
- printf_intr("adb: cleanup: ");
- print_single(send_string);
- }
-#endif
- delay(ADB_DELAY);
- if (ADB_INTR_IS_OFF)
- break;
- }
- break;
case ADB_HW_PB:
/*
@@ -1194,8 +927,6 @@ adb_hw_setup(void)
write_via_reg(VIA1, vACR, (read_via_reg(VIA1, vACR) | 0x0c) & ~0x10);
adbActionState = ADB_ACTION_IDLE; /* used by all types of
* hardware */
- adbBusState = ADB_BUS_IDLE; /* this var. used in II-series
- * code only */
write_via_reg(VIA1, vIER, 0x84);/* make sure VIA interrupts
* are on */
ADB_SET_STATE_IDLE_CUDA(); /* set ADB bus state to idle */
@@ -1220,26 +951,10 @@ adb_hw_setup(void)
default:
write_via_reg(VIA1, vIER, 0x04);/* turn interrupts off - TO
* DO: turn PB ints off? */
- return;
break;
}
}
-
-/*
- * adb_hw_setup_IIsi
- * This is sort of a "read" routine that forces the adb hardware through a read cycle
- * if there is something waiting. This helps "clean up" any commands that may have gotten
- * stuck or stopped during the boot process.
- *
- */
-void
-adb_hw_setup_IIsi(u_char * buffer)
-{
- panic("adb_hw_setup_IIsi");
-}
-
-
/*
* adb_reinit sets up the adb stuff
*
@@ -1467,11 +1182,6 @@ adb_reinit(void)
}
#endif
-#ifndef MRG_ADB
- /* enable the programmer's switch, if we have one */
- adb_prog_switch_enable();
-#endif
-
#ifdef ADB_DEBUG
if (adb_debug) {
if (0 == ADBNumDevices) /* tell user if no devices found */
@@ -1495,45 +1205,6 @@ adb_reinit(void)
}
-#if 0
-/*
- * adb_comp_exec
- * This is a general routine that calls the completion routine if there is one.
- * NOTE: This routine is now only used by pm_direct.c
- * All the code in this file (adb_direct.c) uses
- * the adb_pass_up routine now.
- */
-void
-adb_comp_exec(void)
-{
- if ((long)0 != adbCompRout) /* don't call if empty return location */
-#ifdef __NetBSD__
- asm(" movml #0xffff,sp@- | save all registers
- movl %0,a2 | adbCompData
- movl %1,a1 | adbCompRout
- movl %2,a0 | adbBuffer
- movl %3,d0 | adbWaitingCmd
- jbsr a1@ | go call the routine
- movml sp@+,#0xffff | restore all registers"
- :
- : "g"(adbCompData), "g"(adbCompRout),
- "g"(adbBuffer), "g"(adbWaitingCmd)
- : "d0", "a0", "a1", "a2");
-#else /* for Mac OS-based testing */
- asm {
- movem.l a0/a1/a2/d0, -(a7)
- move.l adbCompData, a2
- move.l adbCompRout, a1
- move.l adbBuffer, a0
- move.w adbWaitingCmd, d0
- jsr(a1)
- movem.l(a7) +, d0/a2/a1/a0
- }
-#endif
-}
-#endif
-
-
/*
* adb_cmd_result
*
@@ -1547,13 +1218,6 @@ int
adb_cmd_result(u_char *in)
{
switch (adbHardware) {
- case ADB_HW_II:
- /* was it an ADB talk command? */
- if ((in[1] & 0x0c) == 0x0c)
- return 0;
- return 1;
-
- case ADB_HW_IISI:
case ADB_HW_CUDA:
/* was it an ADB talk command? */
if ((in[1] == 0x00) && ((in[2] & 0x0c) == 0x0c))
@@ -1566,7 +1230,6 @@ adb_cmd_result(u_char *in)
case ADB_HW_PB:
return 1;
- case ADB_HW_UNKNOWN:
default:
return 1;
}
@@ -1574,44 +1237,6 @@ adb_cmd_result(u_char *in)
/*
- * adb_cmd_extra
- *
- * This routine lets the caller know whether the specified adb command string
- * may have extra data appended to the end of it, such as a LISTEN command.
- *
- * returns: 0 if extra data is allowed
- * 1 if extra data is NOT allowed
- */
-int
-adb_cmd_extra(u_char *in)
-{
- switch (adbHardware) {
- case ADB_HW_II:
- if ((in[1] & 0x0c) == 0x08) /* was it a listen command? */
- return 0;
- return 1;
-
- case ADB_HW_IISI:
- case ADB_HW_CUDA:
- /*
- * TO DO: support needs to be added to recognize RTC and PRAM
- * commands
- */
- if ((in[2] & 0x0c) == 0x08) /* was it a listen command? */
- return 0;
- /* add others later */
- return 1;
-
- case ADB_HW_PB:
- return 1;
-
- case ADB_HW_UNKNOWN:
- default:
- return 1;
- }
-}
-
-/*
* adb_op_sync
*
* This routine does exactly what the adb_op routine does, except that after
@@ -1693,127 +1318,6 @@ adb_setup_hw_type(void)
default:
panic("unknown adb hardware");
}
-#if 0
- response = 0; /*mac68k_machine.machineid;*/
-
- /*
- * Determine what type of ADB hardware we are running on.
- */
- switch (response) {
- case MACH_MACC610: /* Centris 610 */
- case MACH_MACC650: /* Centris 650 */
- case MACH_MACII: /* II */
- case MACH_MACIICI: /* IIci */
- case MACH_MACIICX: /* IIcx */
- case MACH_MACIIX: /* IIx */
- case MACH_MACQ610: /* Quadra 610 */
- case MACH_MACQ650: /* Quadra 650 */
- case MACH_MACQ700: /* Quadra 700 */
- case MACH_MACQ800: /* Quadra 800 */
- case MACH_MACSE30: /* SE/30 */
- adbHardware = ADB_HW_II;
-#ifdef ADB_DEBUG
- if (adb_debug)
- printf_intr("adb: using II series hardware support\n");
-#endif
- break;
-
- case MACH_MACCLASSICII: /* Classic II */
- case MACH_MACLCII: /* LC II, Performa 400/405/430 */
- case MACH_MACLCIII: /* LC III, Performa 450 */
- case MACH_MACIISI: /* IIsi */
- case MACH_MACIIVI: /* IIvi */
- case MACH_MACIIVX: /* IIvx */
- case MACH_MACP460: /* Performa 460/465/467 */
- case MACH_MACP600: /* Performa 600 */
- adbHardware = ADB_HW_IISI;
-#ifdef ADB_DEBUG
- if (adb_debug)
- printf_intr("adb: using IIsi series hardware support\n");
-#endif
- break;
-
- case MACH_MACPB140: /* PowerBook 140 */
- case MACH_MACPB145: /* PowerBook 145 */
- case MACH_MACPB150: /* PowerBook 150 */
- case MACH_MACPB160: /* PowerBook 160 */
- case MACH_MACPB165: /* PowerBook 165 */
- case MACH_MACPB165C: /* PowerBook 165c */
- case MACH_MACPB170: /* PowerBook 170 */
- case MACH_MACPB180: /* PowerBook 180 */
- case MACH_MACPB180C: /* PowerBook 180c */
- adbHardware = ADB_HW_PB;
- pm_setup_adb();
-#ifdef ADB_DEBUG
- if (adb_debug)
- printf_intr("adb: using PowerBook 100-series hardware support\n");
-#endif
- break;
-
- case MACH_MACPB210: /* PowerBook Duo 210 */
- case MACH_MACPB230: /* PowerBook Duo 230 */
- case MACH_MACPB250: /* PowerBook Duo 250 */
- case MACH_MACPB270: /* PowerBook Duo 270 */
- case MACH_MACPB280: /* PowerBook Duo 280 */
- case MACH_MACPB280C: /* PowerBook Duo 280c */
- case MACH_MACPB500: /* PowerBook 500 series */
- adbHardware = ADB_HW_PB;
- pm_setup_adb();
-#ifdef ADB_DEBUG
- if (adb_debug)
- printf_intr("adb: using PowerBook Duo-series and PowerBook 500-series hardware support\n");
-#endif
- break;
-
- case MACH_MACC660AV: /* Centris 660AV */
- case MACH_MACCCLASSIC: /* Color Classic */
- case MACH_MACCCLASSICII: /* Color Classic II */
- case MACH_MACLC475: /* LC 475, Performa 475/476 */
- case MACH_MACLC475_33: /* Clock-chipped 47x */
- case MACH_MACLC520: /* LC 520 */
- case MACH_MACLC575: /* LC 575, Performa 575/577/578 */
- case MACH_MACP550: /* LC 550, Performa 550 */
- case MACH_MACP580: /* Performa 580/588 */
- case MACH_MACQ605: /* Quadra 605 */
- case MACH_MACQ605_33: /* Clock-chipped Quadra 605 */
- case MACH_MACQ630: /* LC 630, Performa 630, Quadra 630 */
- case MACH_MACQ840AV: /* Quadra 840AV */
- adbHardware = ADB_HW_CUDA;
-#ifdef ADB_DEBUG
- if (adb_debug)
- printf_intr("adb: using Cuda series hardware support\n");
-#endif
- break;
- default:
- adbHardware = ADB_HW_UNKNOWN;
-#ifdef ADB_DEBUG
- if (adb_debug) {
- printf_intr("adb: hardware type unknown for this machine\n");
- printf_intr("adb: ADB support is disabled\n");
- }
-#endif
- break;
- }
-
- /*
- * Determine whether this machine has ADB based soft power.
- */
- switch (response) {
- case MACH_MACCCLASSIC: /* Color Classic */
- case MACH_MACCCLASSICII: /* Color Classic II */
- case MACH_MACIISI: /* IIsi */
- case MACH_MACIIVI: /* IIvi */
- case MACH_MACIIVX: /* IIvx */
- case MACH_MACLC520: /* LC 520 */
- case MACH_MACLC575: /* LC 575, Performa 575/577/578 */
- case MACH_MACP550: /* LC 550, Performa 550 */
- case MACH_MACP600: /* Performa 600 */
- case MACH_MACQ630: /* LC 630, Performa 630, Quadra 630 */
- case MACH_MACQ840AV: /* Quadra 840AV */
- adbSoftPower = 1;
- break;
- }
-#endif
}
int
@@ -1893,8 +1397,6 @@ set_adb_info(ADBSetInfoBlock * info, int adbAddr)
}
-#ifndef MRG_ADB
-
/* caller should really use machine-independant version: getPramTime */
/* this version does pseudo-adb access only */
int
@@ -1906,28 +1408,6 @@ adb_read_date_time(unsigned long *time)
volatile int flag = 0;
switch (adbHardware) {
- case ADB_HW_II:
- retcode = -1;
- break;
-
- case ADB_HW_IISI:
- output[0] = 0x02; /* 2 byte message */
- output[1] = 0x01; /* to pram/rtc device */
- output[2] = 0x03; /* read date/time */
- result = send_adb_IIsi((u_char *)output, (u_char *)output,
- (void *)adb_op_comprout, (int *)&flag, (int)0);
- if (result != 0) { /* exit if not sent */
- retcode = -1;
- break;
- }
-
- while (0 == flag) /* wait for result */
- ;
-
- *time = (long)(*(long *)(output + 1));
- retcode = 0;
- break;
-
case ADB_HW_PB:
pm_read_date_time(time);
retcode = 0;
@@ -2001,9 +1481,6 @@ adb_set_date_time(unsigned long time)
pm_set_date_time(time);
return 0;
- case ADB_HW_II:
- case ADB_HW_IISI:
- case ADB_HW_UNKNOWN:
default:
return -1;
}
@@ -2022,19 +1499,6 @@ adb_poweroff(void)
adb_polling = 1;
switch (adbHardware) {
- case ADB_HW_IISI:
- output[0] = 0x02; /* 2 byte message */
- output[1] = 0x01; /* to pram/rtc/soft-power device */
- output[2] = 0x0a; /* set date/time */
- result = send_adb_IIsi((u_char *)output, (u_char *)0,
- (void *)0, (void *)0, (int)0);
- if (result != 0) /* exit if not sent */
- return -1;
-
- for (;;); /* wait for power off */
-
- return 0;
-
case ADB_HW_PB:
pm_adb_poweroff();
@@ -2055,76 +1519,6 @@ adb_poweroff(void)
return 0;
- case ADB_HW_II: /* II models don't do ADB soft power */
- case ADB_HW_UNKNOWN:
- default:
- return -1;
- }
-}
-
-int
-adb_prog_switch_enable(void)
-{
- u_char output[ADB_MAX_MSG_LENGTH];
- int result;
- volatile int flag = 0;
-
- switch (adbHardware) {
- case ADB_HW_IISI:
- output[0] = 0x03; /* 3 byte message */
- output[1] = 0x01; /* to pram/rtc/soft-power device */
- output[2] = 0x1c; /* prog. switch control */
- output[3] = 0x01; /* enable */
- result = send_adb_IIsi((u_char *)output, (u_char *)0,
- (void *)adb_op_comprout, (void *)&flag, (int)0);
- if (result != 0) /* exit if not sent */
- return -1;
-
- while (0 == flag) /* wait for send to finish */
- ;
-
- return 0;
-
- case ADB_HW_PB:
- return -1;
-
- case ADB_HW_II: /* II models don't do prog. switch */
- case ADB_HW_CUDA: /* cuda doesn't do prog. switch TO DO: verify this */
- case ADB_HW_UNKNOWN:
- default:
- return -1;
- }
-}
-
-int
-adb_prog_switch_disable(void)
-{
- u_char output[ADB_MAX_MSG_LENGTH];
- int result;
- volatile int flag = 0;
-
- switch (adbHardware) {
- case ADB_HW_IISI:
- output[0] = 0x03; /* 3 byte message */
- output[1] = 0x01; /* to pram/rtc/soft-power device */
- output[2] = 0x1c; /* prog. switch control */
- output[3] = 0x01; /* disable */
- result = send_adb_IIsi((u_char *)output, (u_char *)0,
- (void *)adb_op_comprout, (void *)&flag, (int)0);
- if (result != 0) /* exit if not sent */
- return -1;
-
- while (0 == flag) /* wait for send to finish */
- ;
-
- return 0;
-
- case ADB_HW_PB:
- return -1;
-
- case ADB_HW_II: /* II models don't do prog. switch */
- case ADB_HW_CUDA: /* cuda doesn't do prog. switch */
- case ADB_HW_UNKNOWN:
default:
return -1;
}
@@ -2160,21 +1554,12 @@ SetADBInfo(ADBSetInfoBlock * info, int adbAddr)
return (set_adb_info(info, adbAddr));
}
-int
-ADBOp(Ptr buffer, Ptr compRout, Ptr data, short commandNum)
-{
- return (adb_op(buffer, compRout, data, commandNum));
-}
-
-#endif
-
-int
+void
setsoftadb()
{
if (!timeout_initialized(&adb_softintr_timeout))
timeout_set(&adb_softintr_timeout, (void *)adb_soft_intr, NULL);
timeout_add(&adb_softintr_timeout, 1);
- return 0;
}
void
diff --git a/sys/arch/macppc/dev/adb_direct.h b/sys/arch/macppc/dev/adb_direct.h
index bc96f0a51e2..84a430d37be 100644
--- a/sys/arch/macppc/dev/adb_direct.h
+++ b/sys/arch/macppc/dev/adb_direct.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: adb_direct.h,v 1.2 2002/03/14 01:26:36 millert Exp $ */
+/* $OpenBSD: adb_direct.h,v 1.3 2002/06/07 07:14:48 miod Exp $ */
/* $NetBSD: adb_direct.h,v 1.1 1998/05/15 10:15:47 tsubai Exp $ */
/*
@@ -38,8 +38,6 @@
/* types of adb hardware that we (will eventually) support */
#define ADB_HW_UNKNOWN 0x01 /* don't know */
-#define ADB_HW_II 0x02 /* Mac II series */
-#define ADB_HW_IISI 0x03 /* Mac IIsi series */
#define ADB_HW_PB 0x04 /* PowerBook series */
#define ADB_HW_CUDA 0x05 /* Machines with a Cuda chip */
@@ -49,7 +47,6 @@ void ADBReInit(void);
int GetIndADB(ADBDataBlock *info, int index);
int GetADBInfo(ADBDataBlock *info, int adbAddr);
int SetADBInfo(ADBSetInfoBlock *info, int adbAddr);
-int ADBOp(Ptr buffer, Ptr compRout, Ptr data, short commandNum);
int adb_read_date_time(unsigned long *);
int adb_set_date_time(unsigned long);
int adb_op_sync(Ptr, Ptr, Ptr, short);
diff --git a/sys/arch/macppc/dev/adbvar.h b/sys/arch/macppc/dev/adbvar.h
index b4997addc41..77874ef1155 100644
--- a/sys/arch/macppc/dev/adbvar.h
+++ b/sys/arch/macppc/dev/adbvar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: adbvar.h,v 1.3 2002/03/14 01:26:36 millert Exp $ */
+/* $OpenBSD: adbvar.h,v 1.4 2002/06/07 07:14:48 miod Exp $ */
/* $NetBSD: adbvar.h,v 1.3 2000/06/08 22:10:46 tsubai Exp $ */
/*-
@@ -42,30 +42,18 @@ struct adb_attach_args {
int handler_id;
};
-#define ADB_MAXTRACE (NBPG / sizeof(int) - 1)
-extern int adb_traceq[ADB_MAXTRACE];
-extern int adb_traceq_tail;
-extern int adb_traceq_len;
-
-typedef struct adb_trace_xlate_s {
- int params;
- char *string;
-} adb_trace_xlate_t;
-
-extern adb_trace_xlate_t adb_trace_xlations[];
-
#ifdef DEBUG
#ifndef ADB_DEBUG
#define ADB_DEBUG
#endif
#endif
+extern int adb_polling; /* Are we polling? (Debugger mode) */
#ifdef ADB_DEBUG
extern int adb_debug;
#endif
typedef caddr_t Ptr;
-typedef caddr_t *Handle;
/* ADB Manager */
typedef struct {
@@ -84,50 +72,20 @@ struct adb_softc {
char *sc_regbase;
};
-
-/* adb.c */
-void adb_enqevent(adb_event_t *event);
-void adb_handoff(adb_event_t *event);
-void adb_autorepeat(void *keyp);
-void adb_dokeyupdown(adb_event_t *event);
-void adb_keymaybemouse(adb_event_t *event);
-void adb_processevent(adb_event_t *event);
-int adbopen(dev_t dev, int flag, int mode, struct proc *p);
-int adbclose(dev_t dev, int flag, int mode, struct proc *p);
-int adbread(dev_t dev, struct uio *uio, int flag);
-int adbwrite(dev_t dev, struct uio *uio, int flag);
-int adbioctl(dev_t , int , caddr_t , int , struct proc *);
-int adbpoll(dev_t dev, int events, struct proc *p);
-
-/* adbsys.c */
-void adb_complete(caddr_t buffer, caddr_t data_area, int adb_command);
-void adb_msa3_complete(caddr_t buffer, caddr_t data_area, int adb_command);
-void adb_mm_nonemp_complete(caddr_t buffer, caddr_t data_area, int adb_command);
-void extdms_init(int);
-void extdms_complete(caddr_t, caddr_t, int);
-
-/* types of adb hardware that we (will eventually) support */
-#define ADB_HW_UNKNOWN 0x01 /* don't know */
-#define ADB_HW_II 0x02 /* Mac II series */
-#define ADB_HW_IISI 0x03 /* Mac IIsi series */
-#define ADB_HW_PB 0x04 /* PowerBook series */
-#define ADB_HW_CUDA 0x05 /* Machines with a Cuda chip */
-
-extern int adbHardware; /* in adb_direct.c */
+/* adb_direct.c */
+extern int adbHardware;
#define ADB_CMDADDR(cmd) ((u_int8_t)((cmd) & 0xf0) >> 4)
#define ADBFLUSH(dev) ((((u_int8_t)(dev) & 0x0f) << 4) | 0x01)
#define ADBLISTEN(dev, reg) ((((u_int8_t)(dev) & 0x0f) << 4) | 0x08 | (reg))
#define ADBTALK(dev, reg) ((((u_int8_t)(dev) & 0x0f) << 4) | 0x0c | (reg))
-/* adb_direct.c */
int adb_poweroff(void);
int CountADBs(void);
void ADBReInit(void);
int GetIndADB(ADBDataBlock * info, int index);
int GetADBInfo(ADBDataBlock * info, int adbAddr);
int SetADBInfo(ADBSetInfoBlock * info, int adbAddr);
-int ADBOp(Ptr buffer, Ptr compRout, Ptr data, short commandNum);
int adb_read_date_time(unsigned long *t);
int adb_set_date_time(unsigned long t);
int adb_intr(void *arg);
diff --git a/sys/arch/macppc/dev/aed.c b/sys/arch/macppc/dev/aed.c
index 75f56ca69fa..d96c8ed51de 100644
--- a/sys/arch/macppc/dev/aed.c
+++ b/sys/arch/macppc/dev/aed.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: aed.c,v 1.3 2002/03/14 01:26:36 millert Exp $ */
+/* $OpenBSD: aed.c,v 1.4 2002/06/07 07:14:48 miod Exp $ */
/* $NetBSD: aed.c,v 1.5 2000/03/23 06:40:33 thorpej Exp $ */
/*
@@ -41,6 +41,7 @@
#include <sys/systm.h>
#include <machine/autoconf.h>
+#include <machine/conf.h>
#include <machine/cpu.h>
#include <macppc/dev/keyboard.h>
@@ -53,29 +54,19 @@
/*
* Function declarations.
*/
-#ifdef __NetBSD__
-static int aedmatch(struct device *, struct cfdata *, void *);
-#endif /* __NetBSD__ */
-#ifdef __OpenBSD__
-static int aedmatch(struct device *, void *, void *);
-#endif /* __OpenBSD__ */
-static void aedattach(struct device *, struct device *, void *);
-static void aed_emulate_mouse(adb_event_t *event);
-static void aed_kbdrpt(void *kstate);
-static void aed_dokeyupdown(adb_event_t *event);
-static void aed_handoff(adb_event_t *event);
-static void aed_enqevent(adb_event_t *event);
-
-/*
- * Global variables.
- */
-extern int adb_polling; /* Are we polling? (Debugger mode) */
+int aedmatch(struct device *, void *, void *);
+void aedattach(struct device *, struct device *, void *);
+void aed_emulate_mouse(adb_event_t *event);
+void aed_kbdrpt(void *kstate);
+void aed_dokeyupdown(adb_event_t *event);
+void aed_handoff(adb_event_t *event);
+void aed_enqevent(adb_event_t *event);
/*
* Local variables.
*/
-static struct aed_softc *aed_sc = NULL;
-static int aed_options = 0; /* | AED_MSEMUL; */
+struct aed_softc *aed_sc = NULL;
+int aed_options = 0; /* | AED_MSEMUL; */
/* Driver definition */
struct cfdriver aed_cd = {
@@ -86,17 +77,10 @@ struct cfattach aed_ca = {
sizeof(struct aed_softc), aedmatch, aedattach
};
-extern struct cfdriver aed_cd;
-
-static int
+int
aedmatch(parent, cf, aux)
struct device *parent;
-#ifdef __NetBSD__
- struct cfdata *cf;
-#endif /* __NetBSD__ */
-#ifdef __OpenBSD__
void *cf;
-#endif /* __OpenBSD__ */
void *aux;
{
struct adb_attach_args *aa_args = (struct adb_attach_args *)aux;
@@ -110,7 +94,7 @@ aedmatch(parent, cf, aux)
return (0);
}
-static void
+void
aedattach(parent, self, aux)
struct device *parent, *self;
void *aux;
@@ -142,10 +126,7 @@ aedattach(parent, self, aux)
sc->sc_open = 0;
-
printf("ADB Event device\n");
-
- return;
}
/*
@@ -173,7 +154,7 @@ aed_input(event)
break;
default: /* God only knows. */
#ifdef DIAGNOSTIC
- panic("aed: received event from unsupported device!\n");
+ panic("aed: received event from unsupported device!");
#endif
break;
}
@@ -186,7 +167,7 @@ aed_input(event)
* 3rd mouse button events while the 1, 2, and 3 keys will generate
* the corresponding mouse button event.
*/
-static void
+void
aed_emulate_mouse(event)
adb_event_t *event;
{
@@ -323,7 +304,7 @@ aed_emulate_mouse(event)
* for the repeating key and schedules the next call at sc_rptinterval
* ticks in the future.
*/
-static void
+void
aed_kbdrpt(kstate)
void *kstate;
{
@@ -348,7 +329,7 @@ aed_kbdrpt(kstate)
* a new repeating key event if needed, and hands the event off to the
* appropriate subsystem.
*/
-static void
+void
aed_dokeyupdown(event)
adb_event_t *event;
{
@@ -377,7 +358,7 @@ aed_dokeyupdown(event)
* Place the event in the event queue if a requesting device is open
* and we are not polling.
*/
-static void
+void
aed_handoff(event)
adb_event_t *event;
{
@@ -388,9 +369,9 @@ aed_handoff(event)
/*
* Place the event in the event queue and wakeup any waiting processes.
*/
-static void
+void
aed_enqevent(event)
- adb_event_t *event;
+ adb_event_t *event;
{
int s;
@@ -421,9 +402,9 @@ aed_enqevent(event)
int
aedopen(dev, flag, mode, p)
- dev_t dev;
- int flag, mode;
- struct proc *p;
+ dev_t dev;
+ int flag, mode;
+ struct proc *p;
{
int unit;
int error = 0;
@@ -451,9 +432,9 @@ aedopen(dev, flag, mode, p)
int
aedclose(dev, flag, mode, p)
- dev_t dev;
- int flag, mode;
- struct proc *p;
+ dev_t dev;
+ int flag, mode;
+ struct proc *p;
{
int s = spladb();
@@ -467,9 +448,9 @@ aedclose(dev, flag, mode, p)
int
aedread(dev, uio, flag)
- dev_t dev;
- struct uio *uio;
- int flag;
+ dev_t dev;
+ struct uio *uio;
+ int flag;
{
int s, error;
int willfit;
@@ -516,9 +497,9 @@ aedread(dev, uio, flag)
int
aedwrite(dev, uio, flag)
- dev_t dev;
- struct uio *uio;
- int flag;
+ dev_t dev;
+ struct uio *uio;
+ int flag;
{
return 0;
}
@@ -526,14 +507,15 @@ aedwrite(dev, uio, flag)
int
aedioctl(dev, cmd, data, flag, p)
- dev_t dev;
- int cmd;
- caddr_t data;
- int flag;
- struct proc *p;
+ dev_t dev;
+ u_long cmd;
+ caddr_t data;
+ int flag;
+ struct proc *p;
{
switch (cmd) {
- case ADBIOCDEVSINFO: {
+ case ADBIOCDEVSINFO:
+ {
adb_devinfo_t *di;
ADBDataBlock adbdata;
int totaldevs;
@@ -552,66 +534,47 @@ aedioctl(dev, cmd, data, flag, p)
di->dev[adbaddr].addr = adbaddr;
di->dev[adbaddr].default_addr = (int)(adbdata.origADBAddr);
di->dev[adbaddr].handler_id = (int)(adbdata.devType);
- }
+ }
/* Must call ADB Manager to get devices now */
- break;
}
+ break;
- case ADBIOCGETREPEAT:{
+ case ADBIOCGETREPEAT:
+ {
adb_rptinfo_t *ri;
ri = (void *)data;
ri->delay_ticks = aed_sc->sc_rptdelay;
ri->interval_ticks = aed_sc->sc_rptinterval;
- break;
}
+ break;
- case ADBIOCSETREPEAT:{
+ case ADBIOCSETREPEAT:
+ {
adb_rptinfo_t *ri;
ri = (void *) data;
aed_sc->sc_rptdelay = ri->delay_ticks;
aed_sc->sc_rptinterval = ri->interval_ticks;
- break;
}
+ break;
case ADBIOCRESET:
/* Do nothing for now */
break;
- case ADBIOCLISTENCMD:{
+ case ADBIOCLISTENCMD:
+ {
adb_listencmd_t *lc;
lc = (void *)data;
}
+ /* FALLTHROUGH */
default:
return (EINVAL);
}
- return (0);
-}
-
-int
-aedpoll(dev, events, p)
- dev_t dev;
- int events;
- struct proc *p;
-{
- int s, revents;
-
- revents = events & (POLLOUT | POLLWRNORM);
-
- if ((events & (POLLIN | POLLRDNORM)) == 0)
- return (revents);
-
- s = spladb();
- if (aed_sc->sc_evq_len > 0)
- revents |= events & (POLLIN | POLLRDNORM);
- else
- selrecord(p, &aed_sc->sc_selinfo);
- splx(s);
-
- return (revents);
+ return (0);
}
diff --git a/sys/arch/macppc/dev/akbd.c b/sys/arch/macppc/dev/akbd.c
index 8ac8a0bc256..6363360fde2 100644
--- a/sys/arch/macppc/dev/akbd.c
+++ b/sys/arch/macppc/dev/akbd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: akbd.c,v 1.9 2002/03/28 04:17:40 drahn Exp $ */
+/* $OpenBSD: akbd.c,v 1.10 2002/06/07 07:14:48 miod Exp $ */
/* $NetBSD: akbd.c,v 1.13 2001/01/25 14:08:55 tsubai Exp $ */
/*
@@ -57,7 +57,6 @@
#include <macppc/dev/akbdvar.h>
#include <macppc/dev/amsvar.h>
#include <macppc/dev/adb_direct.h>
-#include <macppc/dev/pm_direct.h>
#include "aed.h"
@@ -83,8 +82,6 @@ struct cfdriver akbd_cd = {
};
-extern struct cfdriver akbd_cd;
-
int akbd_enable(void *, int);
void akbd_set_leds(void *, int);
int akbd_ioctl(void *, u_long, caddr_t, int, struct proc *);
@@ -502,7 +499,6 @@ akbd_rawrepeat(void *v)
static int polledkey;
-extern int adb_polling;
int
akbd_intr(event)
diff --git a/sys/arch/macppc/dev/pm_direct.c b/sys/arch/macppc/dev/pm_direct.c
index 383f8b17ade..7517765f523 100644
--- a/sys/arch/macppc/dev/pm_direct.c
+++ b/sys/arch/macppc/dev/pm_direct.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pm_direct.c,v 1.6 2002/04/10 17:35:14 drahn Exp $ */
+/* $OpenBSD: pm_direct.c,v 1.7 2002/06/07 07:14:48 miod Exp $ */
/* $NetBSD: pm_direct.c,v 1.9 2000/06/08 22:10:46 tsubai Exp $ */
/*
@@ -30,7 +30,6 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-/* From: pm_direct.c 1.3 03/18/98 Takashi Hamada */
#ifdef DEBUG
#ifndef ADB_DEBUG
@@ -52,15 +51,11 @@
#include <macppc/dev/pm_direct.h>
#include <macppc/dev/viareg.h>
-extern int adb_polling; /* Are we polling? (Debugger mode) */
-
/* hardware dependent values */
#define ADBDelay 100 /* XXX */
-#define HwCfgFlags3 0x20000 /* XXX */
/* define the types of the Power Manager */
#define PM_HW_UNKNOWN 0x00 /* don't know */
-#define PM_HW_PB1XX 0x01 /* PowerBook 1XX series */
#define PM_HW_PB5XX 0x02 /* PowerBook Duo and 5XX series */
/* useful macros */
@@ -87,7 +82,6 @@ int pmHardware = PM_HW_UNKNOWN;
u_short pm_existent_ADB_devices = 0x0; /* each bit expresses the existent ADB device */
u_int pm_LCD_brightness = 0x0;
u_int pm_LCD_contrast = 0x0;
-u_int pm_counter = 0; /* clock count */
/* these values shows that number of data returned after 'send' cmd is sent */
signed char pm_send_cmd_type[] = {
@@ -174,12 +168,6 @@ void pm_printerr(char *, int, int, char *);
int pm_wait_busy(int);
int pm_wait_free(int);
-/* these functions are for the PB1XX series */
-int pm_receive_pm1(u_char *);
-int pm_send_pm1(u_char,int);
-int pm_pmgrop_pm1(PMData *);
-void pm_intr_pm1(void);
-
/* these functions are for the PB Duo series and the PB 5XX series */
int pm_receive_pm2(u_char *);
int pm_send_pm2(u_char);
@@ -189,16 +177,9 @@ void pm_intr_pm2(void);
/* this function is MRG-Based (for testing) */
int pm_pmgrop_mrg(PMData *);
-/* these functions are called from adb_direct.c */
-void pm_setup_adb(void);
-void pm_check_adb_devices(int);
-void pm_intr(void);
-int pm_adb_op(u_char *, void *, void *, int);
-
/* these functions also use the variables of adb_direct.c */
void pm_adb_get_TALK_result(PMData *);
void pm_adb_get_ADB_data(PMData *);
-void pm_adb_poll_next_device_pm1(PMData *);
/*
@@ -321,290 +302,6 @@ pm_wait_free(delay)
return 1;
}
-
-
-/*
- * Functions for the PB1XX series
- */
-
-/*
- * Receive data from PM for the PB1XX series
- */
-int
-pm_receive_pm1(data)
- u_char *data;
-{
-#if 0
- int rval = 0xffffcd34;
-
- via_reg(VIA2, vDirA) = 0x00;
-
- switch (1) {
- default:
- if (pm_wait_busy(0x40) != 0)
- break; /* timeout */
-
- PM_SET_STATE_ACKOFF();
- *data = via_reg(VIA2, 0x200);
-
- rval = 0xffffcd33;
- if (pm_wait_free(0x40) == 0)
- break; /* timeout */
-
- rval = 0x00;
- break;
- }
-
- PM_SET_STATE_ACKON();
- via_reg(VIA2, vDirA) = 0x00;
-
- return rval;
-#else
- panic("pm_receive_pm1");
-#endif
-}
-
-
-
-/*
- * Send data to PM for the PB1XX series
- */
-int
-pm_send_pm1(data, delay)
- u_char data;
- int delay;
-{
-#if 0
- int rval;
-
- via_reg(VIA2, vDirA) = 0xff;
- via_reg(VIA2, 0x200) = data;
-
- PM_SET_STATE_ACKOFF();
- if (pm_wait_busy(0x400) != 0) {
- PM_SET_STATE_ACKON();
- via_reg(VIA2, vDirA) = 0x00;
-
- return 0xffffcd36;
- }
-
- rval = 0x0;
- PM_SET_STATE_ACKON();
- if (pm_wait_free(0x40) == 0)
- rval = 0xffffcd35;
-
- PM_SET_STATE_ACKON();
- via_reg(VIA2, vDirA) = 0x00;
-
- return rval;
-#else
- panic("pm_send_pm1");
-#endif
-}
-
-
-/*
- * My PMgrOp routine for the PB1XX series
- */
-int
-pm_pmgrop_pm1(pmdata)
- PMData *pmdata;
-{
-#if 0
- int i;
- int s = 0x81815963;
- u_char via1_vIER, via1_vDirA;
- int rval = 0;
- int num_pm_data = 0;
- u_char pm_cmd;
- u_char pm_data;
- u_char *pm_buf;
-
- /* disable all inetrrupts but PM */
- via1_vIER = via_reg(VIA1, vIER);
- PM_VIA_INTR_DISABLE();
-
- via1_vDirA = via_reg(VIA1, vDirA);
-
- switch (pmdata->command) {
- default:
- for (i = 0; i < 7; i++) {
- via_reg(VIA2, vDirA) = 0x00;
-
- /* wait until PM is free */
- if (pm_wait_free(ADBDelay) == 0) { /* timeout */
- via_reg(VIA2, vDirA) = 0x00;
- /* restore formar value */
- via_reg(VIA1, vDirA) = via1_vDirA;
- via_reg(VIA1, vIER) = via1_vIER;
- return 0xffffcd38;
- }
-
- switch (mac68k_machine.machineid) {
- case MACH_MACPB160:
- case MACH_MACPB165:
- case MACH_MACPB165C:
- case MACH_MACPB180:
- case MACH_MACPB180C:
- {
- int delay = ADBDelay * 16;
-
- via_reg(VIA2, vDirA) = 0x00;
- while ((via_reg(VIA2, 0x200) == 0x7f) && (delay >= 0))
- delay--;
-
- if (delay < 0) { /* timeout */
- via_reg(VIA2, vDirA) = 0x00;
- /* restore formar value */
- via_reg(VIA1, vIER) = via1_vIER;
- return 0xffffcd38;
- }
- }
- } /* end switch */
-
- s = splhigh();
-
- via1_vDirA = via_reg(VIA1, vDirA);
- via_reg(VIA1, vDirA) &= 0x7f;
-
- pm_cmd = (u_char)(pmdata->command & 0xff);
- if ((rval = pm_send_pm1(pm_cmd, ADBDelay * 8)) == 0)
- break; /* send command succeeded */
-
- via_reg(VIA1, vDirA) = via1_vDirA;
- splx(s);
- } /* end for */
-
- /* failed to send a command */
- if (i == 7) {
- via_reg(VIA2, vDirA) = 0x00;
- /* restore formar value */
- via_reg(VIA1, vDirA) = via1_vDirA;
- via_reg(VIA1, vIER) = via1_vIER;
- if (s != 0x81815963)
- splx(s);
- return 0xffffcd38;
- }
-
- /* send # of PM data */
- num_pm_data = pmdata->num_data;
- if ((rval = pm_send_pm1((u_char)(num_pm_data & 0xff), ADBDelay * 8)) != 0)
- break; /* timeout */
-
- /* send PM data */
- pm_buf = (u_char *)pmdata->s_buf;
- for (i = 0; i < num_pm_data; i++)
- if ((rval = pm_send_pm1(pm_buf[i], ADBDelay * 8)) != 0)
- break; /* timeout */
- if ((i != num_pm_data) && (num_pm_data != 0))
- break; /* timeout */
-
- /* Will PM IC return data? */
- if ((pm_cmd & 0x08) == 0) {
- rval = 0;
- break; /* no returned data */
- }
-
- rval = 0xffffcd37;
- if (pm_wait_busy(ADBDelay) != 0)
- break; /* timeout */
-
- /* receive PM command */
- if ((rval = pm_receive_pm1(&pm_data)) != 0)
- break;
-
- pmdata->command = pm_data;
-
- /* receive number of PM data */
- if ((rval = pm_receive_pm1(&pm_data)) != 0)
- break; /* timeout */
- num_pm_data = pm_data;
- pmdata->num_data = num_pm_data;
-
- /* receive PM data */
- pm_buf = (u_char *)pmdata->r_buf;
- for (i = 0; i < num_pm_data; i++) {
- if ((rval = pm_receive_pm1(&pm_data)) != 0)
- break; /* timeout */
- pm_buf[i] = pm_data;
- }
-
- rval = 0;
- }
-
- via_reg(VIA2, vDirA) = 0x00;
-
- /* restore formar value */
- via_reg(VIA1, vDirA) = via1_vDirA;
- via_reg(VIA1, vIER) = via1_vIER;
- if (s != 0x81815963)
- splx(s);
-
- return rval;
-#else
- panic("pm_pmgrop_pm1");
-#endif
-}
-
-
-/*
- * My PM interrupt routine for PB1XX series
- */
-void
-pm_intr_pm1()
-{
-#if 0
- int s;
- int rval;
- PMData pmdata;
-
- s = splhigh();
-
- PM_VIA_CLR_INTR(); /* clear VIA1 interrupt */
-
- /* ask PM what happend */
- pmdata.command = 0x78;
- pmdata.num_data = 0;
- pmdata.data[0] = pmdata.data[1] = 0;
- pmdata.s_buf = &pmdata.data[2];
- pmdata.r_buf = &pmdata.data[2];
- rval = pm_pmgrop_pm1(&pmdata);
- if (rval != 0) {
-#ifdef ADB_DEBUG
- if (adb_debug)
- printf("pm: PM is not ready. error code=%08x\n", rval);
-#endif
- splx(s);
- return;
- }
-
- if ((pmdata.data[2] & 0x10) == 0x10) {
- if ((pmdata.data[2] & 0x0f) == 0) {
- /* ADB data that were requested by TALK command */
- pm_adb_get_TALK_result(&pmdata);
- } else if ((pmdata.data[2] & 0x08) == 0x8) {
- /* PM is requesting to poll */
- pm_adb_poll_next_device_pm1(&pmdata);
- } else if ((pmdata.data[2] & 0x04) == 0x4) {
- /* ADB device event */
- pm_adb_get_ADB_data(&pmdata);
- }
- } else {
-#ifdef ADB_DEBUG
- if (adb_debug)
- pm_printerr("driver does not supported this event.",
- rval, pmdata.num_data, pmdata.data);
-#endif
- }
-
- splx(s);
-#else
- panic("pm_intr_pm1");
-#endif
-}
-
-
-
/*
* Functions for the PB Duo series and the PB 5XX series
*/
@@ -720,36 +417,16 @@ pm_pmgrop_pm2(pmdata)
if (pm_wait_free(ADBDelay * 4) == 0)
break; /* timeout */
- if (HwCfgFlags3 & 0x00200000) {
- /* PB 160, PB 165(c), PB 180(c)? */
- int delay = ADBDelay * 16;
-
- write_via_reg(VIA2, vDirA, 0x00);
- while ((read_via_reg(VIA2, 0x200) == 0x07) &&
- (delay >= 0))
- delay--;
-
- if (delay < 0) {
- rval = 0xffffcd38;
- break; /* timeout */
- }
- }
-
/* send PM command */
if ((rval = pm_send_pm2((u_char)(pm_cmd & 0xff))))
break; /* timeout */
/* send number of PM data */
num_pm_data = pmdata->num_data;
- if (HwCfgFlags3 & 0x00020000) { /* PB Duo, PB 5XX */
- if (pm_send_cmd_type[pm_cmd] < 0) {
- if ((rval = pm_send_pm2((u_char)(num_pm_data & 0xff))) != 0)
- break; /* timeout */
- pmdata->command = 0;
- }
- } else { /* PB 1XX series ? */
+ if (pm_send_cmd_type[pm_cmd] < 0) {
if ((rval = pm_send_pm2((u_char)(num_pm_data & 0xff))) != 0)
- break; /* timeout */
+ break; /* timeout */
+ pmdata->command = 0;
}
/* send PM data */
pm_buf = (u_char *)pmdata->s_buf;
@@ -770,37 +447,22 @@ pm_pmgrop_pm2(pmdata)
/* receive PM command */
pm_data = pmdata->command;
- if (HwCfgFlags3 & 0x00020000) { /* PB Duo, PB 5XX */
- pm_num_rx_data--;
- if (pm_num_rx_data == 0)
- if ((rval = pm_receive_pm2(&pm_data)) != 0) {
- rval = 0xffffcd37;
- break;
- }
- pmdata->command = pm_data;
- } else { /* PB 1XX series ? */
+ pm_num_rx_data--;
+ if (pm_num_rx_data == 0)
if ((rval = pm_receive_pm2(&pm_data)) != 0) {
rval = 0xffffcd37;
break;
}
- pmdata->command = pm_data;
- }
+ pmdata->command = pm_data;
/* receive number of PM data */
- if (HwCfgFlags3 & 0x00020000) { /* PB Duo, PB 5XX */
- if (pm_num_rx_data < 0) {
- if ((rval = pm_receive_pm2(&pm_data)) != 0)
- break; /* timeout */
- num_pm_data = pm_data;
- } else
- num_pm_data = pm_num_rx_data;
- pmdata->num_data = num_pm_data;
- } else { /* PB 1XX serias ? */
+ if (pm_num_rx_data < 0) {
if ((rval = pm_receive_pm2(&pm_data)) != 0)
- break; /* timeout */
+ break; /* timeout */
num_pm_data = pm_data;
- pmdata->num_data = num_pm_data;
- }
+ } else
+ num_pm_data = pm_num_rx_data;
+ pmdata->num_data = num_pm_data;
/* receive PM data */
pm_buf = (u_char *)pmdata->r_buf;
@@ -853,34 +515,8 @@ pm_intr_pm2()
case 0x00: /* 1 sec interrupt? */
break;
case 0x80: /* 1 sec interrupt? */
- pm_counter++;
break;
case 0x08: /* Brightness/Contrast button on LCD panel */
- /* get brightness and contrast of the LCD */
- pm_LCD_brightness = (u_int)pmdata.data[3] & 0xff;
- pm_LCD_contrast = (u_int)pmdata.data[4] & 0xff;
-/*
- pm_printerr("#08", rval, pmdata.num_data, pmdata.data);
- pmdata.command = 0x33;
- pmdata.num_data = 1;
- pmdata.s_buf = pmdata.data;
- pmdata.r_buf = pmdata.data;
- pmdata.data[0] = pm_LCD_contrast;
- rval = pm_pmgrop_pm2(&pmdata);
- pm_printerr("#33", rval, pmdata.num_data, pmdata.data);
-*/
- /* this is an experimental code */
- pmdata.command = 0x41;
- pmdata.num_data = 1;
- pmdata.s_buf = pmdata.data;
- pmdata.r_buf = pmdata.data;
- pm_LCD_brightness = 0x7f - pm_LCD_brightness / 2;
- if (pm_LCD_brightness < 0x08)
- pm_LCD_brightness = 0x08;
- if (pm_LCD_brightness > 0x78)
- pm_LCD_brightness = 0x78;
- pmdata.data[0] = pm_LCD_brightness;
- rval = pm_pmgrop_pm2(&pmdata);
break;
case 0x10: /* ADB data that were requested by TALK command */
case 0x14:
@@ -895,7 +531,7 @@ pm_intr_pm2()
default:
#ifdef ADB_DEBUG
if (adb_debug)
- pm_printerr("driver does not supported this event.",
+ pm_printerr("driver does not support this event.",
pmdata.data[2], pmdata.num_data,
pmdata.data);
#endif
@@ -937,15 +573,11 @@ pmgrop(pmdata)
PMData *pmdata;
{
switch (pmHardware) {
- case PM_HW_PB1XX:
- return (pm_pmgrop_pm1(pmdata));
- break;
- case PM_HW_PB5XX:
- return (pm_pmgrop_pm2(pmdata));
- break;
- default:
- /* return (pmgrop_mrg(pmdata)); */
- return 1;
+ case PM_HW_PB5XX:
+ return (pm_pmgrop_pm2(pmdata));
+ default:
+ /* return (pmgrop_mrg(pmdata)); */
+ return 1;
}
}
@@ -957,14 +589,11 @@ void
pm_intr()
{
switch (pmHardware) {
- case PM_HW_PB1XX:
- pm_intr_pm1();
- break;
- case PM_HW_PB5XX:
- pm_intr_pm2();
- break;
- default:
- break;
+ case PM_HW_PB5XX:
+ pm_intr_pm2();
+ break;
+ default:
+ break;
}
}
@@ -1071,24 +700,14 @@ pm_adb_op(buffer, compRout, data, command)
}
/* this command enables the interrupt by operating ADB devices */
- if (HwCfgFlags3 & 0x00020000) { /* PB Duo series, PB 5XX series */
- pmdata.command = 0x20;
- pmdata.num_data = 4;
- pmdata.s_buf = pmdata.data;
- pmdata.r_buf = pmdata.data;
- pmdata.data[0] = 0x00;
- pmdata.data[1] = 0x86; /* magic spell for awaking the PM */
- pmdata.data[2] = 0x00;
- pmdata.data[3] = 0x0c; /* each bit may express the existent ADB device */
- } else { /* PB 1XX series */
- pmdata.command = 0x20;
- pmdata.num_data = 3;
- pmdata.s_buf = pmdata.data;
- pmdata.r_buf = pmdata.data;
- pmdata.data[0] = (u_char)(command & 0xf0) | 0xc;
- pmdata.data[1] = 0x04;
- pmdata.data[2] = 0x00;
- }
+ pmdata.command = 0x20;
+ pmdata.num_data = 4;
+ pmdata.s_buf = pmdata.data;
+ pmdata.r_buf = pmdata.data;
+ pmdata.data[0] = 0x00;
+ pmdata.data[1] = 0x86; /* magic spell for awaking the PM */
+ pmdata.data[2] = 0x00;
+ pmdata.data[3] = 0x0c; /* each bit may express the existent ADB device */
rval = pmgrop(&pmdata);
splx(s);
@@ -1142,36 +761,6 @@ pm_adb_get_ADB_data(pmdata)
adb_pass_up(&packet);
}
-
-void
-pm_adb_poll_next_device_pm1(pmdata)
- PMData *pmdata;
-{
- int i;
- int ndid;
- u_short bendid = 0x1;
- int rval;
- PMData tmp_pmdata;
-
- /* find another existent ADB device to poll */
- for (i = 1; i < 16; i++) {
- ndid = (ADB_CMDADDR(pmdata->data[3]) + i) & 0xf;
- bendid <<= ndid;
- if ((pm_existent_ADB_devices & bendid) != 0)
- break;
- }
-
- /* poll the other device */
- tmp_pmdata.command = 0x20;
- tmp_pmdata.num_data = 3;
- tmp_pmdata.s_buf = tmp_pmdata.data;
- tmp_pmdata.r_buf = tmp_pmdata.data;
- tmp_pmdata.data[0] = (u_char)(ndid << 4) | 0xc;
- tmp_pmdata.data[1] = 0x04; /* magic spell for awaking the PM */
- tmp_pmdata.data[2] = 0x00;
- rval = pmgrop(&tmp_pmdata);
-}
-
void
pm_adb_restart()
{
diff --git a/sys/arch/macppc/dev/viareg.h b/sys/arch/macppc/dev/viareg.h
index 7d22035bf07..4833f6e16ec 100644
--- a/sys/arch/macppc/dev/viareg.h
+++ b/sys/arch/macppc/dev/viareg.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: viareg.h,v 1.3 2002/03/14 03:15:55 millert Exp $ */
+/* $OpenBSD: viareg.h,v 1.4 2002/06/07 07:14:48 miod Exp $ */
/* $NetBSD: viareg.h,v 1.2 1998/10/20 14:56:30 tsubai Exp $ */
/*-
@@ -42,109 +42,8 @@
*/
-
- /* VIA1 data register A */
-#define DA1I_vSCCWrReq 0x80
-#define DA1O_vPage2 0x40
-#define DA1I_CPU_ID1 0x40
-#define DA1O_vHeadSel 0x20
-#define DA1O_vOverlay 0x10
-#define DA1O_vSync 0x08
-#define DA1O_RESERVED2 0x04
-#define DA1O_RESERVED1 0x02
-#define DA1O_RESERVED0 0x01
-
- /* VIA1 data register B */
-#define DB1I_Par_Err 0x80
-#define DB1O_vSndEnb 0x80
-#define DB1O_Par_Enb 0x40
-#define DB1O_vFDesk2 0x20
-#define DB1O_vFDesk1 0x10
-#define DB1I_vFDBInt 0x08
-#define DB1O_rTCEnb 0x04
-#define DB1O_rTCCLK 0x02
-#define DB1O_rTCData 0x01
-#define DB1I_rTCData 0x01
-
- /* VIA2 data register A */
-#define DA2O_v2Ram1 0x80
-#define DA2O_v2Ram0 0x40
-#define DA2I_v2IRQ0 0x40
-#define DA2I_v2IRQE 0x20
-#define DA2I_v2IRQD 0x10
-#define DA2I_v2IRQC 0x08
-#define DA2I_v2IRQB 0x04
-#define DA2I_v2IRQA 0x02
-#define DA2I_v2IRQ9 0x01
-
- /* VIA2 data register B */
-#define DB2O_v2VBL 0x80
-#define DB2O_Par_Test 0x80
-#define DB2I_v2SNDEXT 0x40
-#define DB2I_v2TM0A 0x20
-#define DB2I_v2TM1A 0x10
-#define DB2I_vFC3 0x08
-#define DB2O_vFC3 0x08
-#define DB2O_v2PowerOff 0x04
-#define DB2O_v2BusLk 0x02
-#define DB2O_vCDis 0x01
-#define DB2O_CEnable 0x01
-
-/*
- * VIA1 interrupts
- */
-#define VIA1_T1 6
-#define VIA1_T2 5
-#define VIA1_ADBCLK 4
-#define VIA1_ADBDATA 3
-#define VIA1_ADBRDY 2
-#define VIA1_VBLNK 1
-#define VIA1_ONESEC 0
-
-/* VIA1 interrupt bits */
-#define V1IF_IRQ 0x80
-#define V1IF_T1 (1 << VIA1_T1)
-#define V1IF_T2 (1 << VIA1_T2)
-#define V1IF_ADBCLK (1 << VIA1_ADBCLK)
-#define V1IF_ADBDATA (1 << VIA1_ADBDATA)
-#define V1IF_ADBRDY (1 << VIA1_ADBRDY)
-#define V1IF_VBLNK (1 << VIA1_VBLNK)
-#define V1IF_ONESEC (1 << VIA1_ONESEC)
-
-/*
- * VIA2 interrupts
- */
-#define VIA2_T1 6
-#define VIA2_T2 5
-#define VIA2_ASC 4
-#define VIA2_SCSIIRQ 3
-#define VIA2_EXPIRQ 2
-#define VIA2_SLOTINT 1
-#define VIA2_SCSIDRQ 0
-
-/* VIA2 interrupt bits */
-#define V2IF_IRQ 0x80
-#define V2IF_T1 (1 << VIA2_T1)
-#define V2IF_T2 (1 << VIA2_T2)
-#define V2IF_ASC (1 << VIA2_ASC)
-#define V2IF_SCSIIRQ (1 << VIA2_SCSIIRQ)
-#define V2IF_EXPIRQ (1 << VIA2_EXPIRQ)
-#define V2IF_SLOTINT (1 << VIA2_SLOTINT)
-#define V2IF_SCSIDRQ (1 << VIA2_SCSIDRQ)
-
-#define VIA1_INTS (V1IF_T1 | V1IF_ADBRDY)
-#define VIA2_INTS (V2IF_T1 | V2IF_ASC | V2IF_SCSIIRQ | V2IF_SLOTINT | \
- V2IF_SCSIDRQ)
-
-#define RBV_INTS (V2IF_T1 | V2IF_ASC | V2IF_SCSIIRQ | V2IF_SLOTINT | \
- V2IF_SCSIDRQ | V1IF_ADBRDY)
-
-#define ACR_T1LATCH 0x40
-
extern volatile unsigned char *Via1Base;
#define VIA1_addr Via1Base /* at PA 0x50f00000 */
-#define VIA2OFF 1 /* VIA2 addr = VIA1_addr * 0x2000 */
-#define RBVOFF 0x13 /* RBV addr = VIA1_addr * 0x13000 */
#define VIA1 0
#define VIA2 0
@@ -162,29 +61,9 @@ extern volatile unsigned char *Via1Base;
#define vT2CH 0x1200
#define vSR 0x1400 /* shift register */
#define vACR 0x1600 /* aux control register */
-#define vPCR 0x1800 /* peripheral control register */
#define vIFR 0x1a00 /* interrupt flag register */
#define vIER 0x1c00 /* interrupt enable register */
- /* RBV interface registers */
-#define rBufB 0 /* register B */
-#define rBufA 2 /* register A */
-#define rIFR 0x3 /* interrupt flag register (writes?) */
-#define rIER 0x13 /* interrupt enable register */
-#define rMonitor 0x10 /* Monitor type */
-#define rSlotInt 0x12 /* Slot interrupt */
-
- /* RBV monitor type flags and masks */
-#define RBVDepthMask 0x07 /* depth in bits */
-#define RBVMonitorMask 0x38 /* Type numbers */
-#define RBVOff 0x40 /* monitor turn off */
-#define RBVMonIDNone 0x38 /* What RBV actually has for no video */
-#define RBVMonIDOff 0x0 /* What rbv_vidstatus() returns for no video */
-#define RBVMonID15BWP 0x08 /* BW portrait */
-#define RBVMonIDRGB 0x10 /* color monitor */
-#define RBVMonIDRGB15 0x28 /* 15 inch RGB */
-#define RBVMonIDBW 0x30 /* No internal video */
-
#define via_reg(v, r) (*(Via1Base + (r)))
#include <machine/pio.h>
@@ -228,17 +107,3 @@ write_via_reg(int ign, int reg, int val)
out8(addr, val);
}
-
-#define vDirA_ADBState 0x30
-
-void via_init(void);
-int rbv_vidstatus(void);
-void via_shutdown(void);
-void via_set_modem(int);
-int add_nubus_intr(int, void (*)(void *, int), void *);
-void enable_nubus_intr(void);
-void via1_register_irq(int, void (*)(void *), void *);
-void via2_register_irq(int, void (*)(void *), void *);
-
-extern void (*via1itab[7])(void *);
-extern void (*via2itab[7])(void *);