Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/mac68k Unfortunately, several changes that are inte...



details:   https://anonhg.NetBSD.org/src/rev/59d5f08bc88c
branches:  trunk
changeset: 474097:59d5f08bc88c
user:      briggs <briggs%NetBSD.org@localhost>
date:      Mon Jun 28 01:56:55 1999 +0000

description:
Unfortunately, several changes that are intermingled:
- Add initial IOP support.  ADB doesn't work yet for me, but it's here so
  that others will be encouraged to work on it.  ADB_HW_IOP basically
  is configured as a NOP so that serial consoles will continue to work.
- Roll via1_intr and via2_intr into the intr.c scheme--this also required
  changing rtclock_intr to grovel the stack differently so that hardclock
  gets the right arguments and softclock() doesn't get all reentrant.
- Make via1 interrupts parallel to via2 interrupts--handlers get a pass-
  through pointer and we can register handlers.  Register via1 interrupt
  with intr_establish()--normally level 1, level 6 for A/UX scheme.
- Use intr_establish() to set real via2 interrupt handler instead of the
  hacked function pointer.
- Reorganize adb-direct interrupts so that a function call is removed.
- Implement A/UX interrupts for all Quadras right now.  We may need to
  special case some Quadras, but Linux folks are reporting success on
  several models.
- Fix intrnames to be accurate for the normal, PSC, and A/UX interrupt
  configurations.

diffstat:

 sys/arch/mac68k/conf/files.mac68k |    3 +-
 sys/arch/mac68k/dev/adb_direct.c  |  175 ++++++++++++--
 sys/arch/mac68k/dev/adbvar.h      |    5 +-
 sys/arch/mac68k/dev/pm_direct.c   |   43 ++-
 sys/arch/mac68k/include/cpu.h     |    6 +-
 sys/arch/mac68k/include/iopreg.h  |  149 ++++++++++++
 sys/arch/mac68k/include/viareg.h  |   18 +-
 sys/arch/mac68k/mac68k/intr.c     |   66 ++++-
 sys/arch/mac68k/mac68k/iop.c      |  441 ++++++++++++++++++++++++++++++++++++++
 sys/arch/mac68k/mac68k/locore.s   |   65 +---
 sys/arch/mac68k/mac68k/machdep.c  |   38 +++-
 sys/arch/mac68k/mac68k/pram.c     |    4 +-
 sys/arch/mac68k/mac68k/vectors.s  |    6 +-
 sys/arch/mac68k/mac68k/via.c      |   74 ++++-
 sys/arch/mac68k/obio/asc.c        |    8 +-
 sys/arch/mac68k/obio/if_sn_obio.c |    8 +-
 16 files changed, 972 insertions(+), 137 deletions(-)

diffs (truncated from 1824 to 300 lines):

diff -r 1f59ab37a099 -r 59d5f08bc88c sys/arch/mac68k/conf/files.mac68k
--- a/sys/arch/mac68k/conf/files.mac68k Mon Jun 28 01:41:13 1999 +0000
+++ b/sys/arch/mac68k/conf/files.mac68k Mon Jun 28 01:56:55 1999 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: files.mac68k,v 1.90 1999/06/07 20:31:31 thorpej Exp $
+#      $NetBSD: files.mac68k,v 1.91 1999/06/28 01:56:55 briggs Exp $
 
 # mac68k-specific configuration info
 
@@ -136,6 +136,7 @@
 file   arch/mac68k/mac68k/conf.c
 file   arch/mac68k/mac68k/disksubr.c           disk
 file   arch/mac68k/mac68k/intr.c
+file   arch/mac68k/mac68k/iop.c
 file   arch/mac68k/mac68k/kgdb_machdep.c       kgdb
 file   arch/mac68k/mac68k/machdep.c
 file   arch/mac68k/mac68k/macrom.c
diff -r 1f59ab37a099 -r 59d5f08bc88c sys/arch/mac68k/dev/adb_direct.c
--- a/sys/arch/mac68k/dev/adb_direct.c  Mon Jun 28 01:41:13 1999 +0000
+++ b/sys/arch/mac68k/dev/adb_direct.c  Mon Jun 28 01:56:55 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: adb_direct.c,v 1.23 1999/05/15 19:29:12 scottr Exp $   */
+/*     $NetBSD: adb_direct.c,v 1.24 1999/06/28 01:56:56 briggs Exp $   */
 
 /* From: adb_direct.c 2.02 4/18/97 jpw */
 
@@ -70,6 +70,7 @@
 #include <machine/param.h>
 #include <machine/cpu.h>
 #include <machine/adbsys.h>                    /* required for adbvar.h */
+#include <machine/iopreg.h>                    /* required for IOP support */
 
 #include <mac68k/mac68k/macrom.h>
 #include <mac68k/dev/adbvar.h>
@@ -100,6 +101,7 @@
 #define ADB_ACTION_OUT         0x3     /* sending out a command */
 #define ADB_ACTION_IN          0x4     /* receiving data */
 #define ADB_ACTION_POLLING     0x5     /* polling - II only */
+#define ADB_ACTION_RUNNING     0x6     /* running - IOP only */
 
 /*
  * These describe the state of the ADB bus itself, although they
@@ -210,6 +212,7 @@
        "IIsi series",
        "PowerBook",
        "Cuda",
+       "IOP",
 };
 
 /*
@@ -265,8 +268,9 @@
 extern int ite_polling;                        /* Are we polling?  (Debugger mode) */
 
 void   pm_setup_adb __P((void));
+void   pm_hw_setup __P((void));
 void   pm_check_adb_devices __P((int));
-void   pm_intr __P((void));
+void   pm_intr __P((void *));
 int    pm_adb_op __P((u_char *, void *, void *, int));
 void   pm_init_adb_device __P((void));
 
@@ -276,10 +280,10 @@
 #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_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));
@@ -307,6 +311,8 @@
 int    adb_prog_switch_disable __P((void));
 /* we should create this and it will be the public version */
 int    send_adb __P((u_char *, void *, void *));
+void   adb_iop_recv __P((IOP *, struct iop_msg *));
+int    send_adb_iop __P((int, u_char *, void *, void *));
 
 #ifdef ADB_DEBUG
 /*
@@ -374,7 +380,7 @@
  * grab serial interrupts?
  */
 void
-adb_intr_cuda(void)
+adb_intr_cuda(void *arg)
 {
        volatile int i, ending;
        volatile unsigned int s;
@@ -682,7 +688,7 @@
                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();
                                }
 
@@ -691,7 +697,7 @@
 
 
 void
-adb_intr_II(void)
+adb_intr_II(void *arg)
 {
        struct adbCommand packet;
        int i, intr_on = 0;
@@ -706,6 +712,8 @@
        ADB_VIA_INTR_DISABLE(); /* disable ADB interrupt on IIs. */
 
        delay(ADB_DELAY);       /* yuck (don't remove) */
+
+if (!mac68k_machine.aux_interrupts)
        (void)intr_dispatch(0x70); /* grab any serial interrupts */
 
        if (ADB_INTR_IS_ON)
@@ -753,6 +761,7 @@
                        adbActionState = ADB_ACTION_IN;
                }
                delay(ADB_DELAY);
+if (!mac68k_machine.aux_interrupts)
                (void)intr_dispatch(0x70); /* grab any serial interrupts */
                goto switch_start;
                break;
@@ -1123,7 +1132,7 @@
                while ((adbActionState != ADB_ACTION_IDLE) || (ADB_INTR_IS_ON)
                    || (adbWaiting == 1))
                        if (ADB_SR_INTR_IS_ON) { /* wait for "interrupt" */
-                               adb_intr_II();  /* go process "interrupt" */
+                               adb_intr_II(NULL); /* go process "interrupt" */
                                adb_soft_intr();
                        }
 
@@ -1187,22 +1196,25 @@
  * code for the machine we are running on.
  */
 void
-adb_intr(void)
+adb_intr(void *arg)
 {
        switch (adbHardware) {
        case ADB_HW_II:
-               adb_intr_II();
+               adb_intr_II(arg);
                break;
 
        case ADB_HW_IISI:
-               adb_intr_IIsi();
+               adb_intr_IIsi(arg);
                break;
 
-       case ADB_HW_PB:
+       case ADB_HW_PB:         /* Should not come through here. */
                break;
 
        case ADB_HW_CUDA:
-               adb_intr_cuda();
+               adb_intr_cuda(arg);
+               break;
+
+       case ADB_HW_IOP:        /* Should not come through here. */
                break;
 
        case ADB_HW_UNKNOWN:
@@ -1218,7 +1230,7 @@
  *
  */
 void
-adb_intr_IIsi(void)
+adb_intr_IIsi(void *arg)
 {
        struct adbCommand packet;
        int i, ending;
@@ -1502,13 +1514,77 @@
                while ((adbActionState != ADB_ACTION_IDLE) || (ADB_INTR_IS_ON)
                    || (adbWaiting == 1))
                        if (ADB_SR_INTR_IS_ON) {        /* wait for "interrupt" */
-                               adb_intr_IIsi();        /* process it */
+                               adb_intr_IIsi(NULL);    /* process it */
                                adb_soft_intr();
                        }
 
         return 0;
 }                              /* send_adb_IIsi */
 
+void
+adb_iop_recv(IOP *iop, struct iop_msg *msg)
+{
+       struct adbCommand       pkt;
+       unsigned                flags;
+
+       if (adbActionState != ADB_ACTION_RUNNING)
+               return;
+
+       switch (msg->status) {
+       case IOP_MSGSTAT_SENT:
+               if (0 == adb_cmd_result(msg->msg + 1)) {
+                       adbWaiting = 1;
+                       adbWaitingCmd = msg->msg[2];
+               }
+               break;
+       case IOP_MSGSTAT_RECEIVED:
+       case IOP_MSGSTAT_UNEXPECTED:
+               flags = msg->msg[0];
+               if (flags != 0) {
+                       printf("ADB FLAGS 0x%x", flags);
+                       break;
+               }
+               if (adbWaiting &&
+                   (msg->msg[2] == adbWaitingCmd)) {
+                       pkt.saveBuf = msg->msg + 1;
+                       pkt.compRout = adbCompRout;
+                       pkt.compData = adbCompData;
+                       pkt.unsol = 0;
+                       pkt.ack_only = 0;
+                       adb_pass_up(&pkt);
+
+                       adbWaitingCmd = 0;
+                       adbWaiting = 0;
+               } else {
+                       pkt.unsol = 1;
+                       pkt.ack_only = 0;
+                       adb_pass_up(&pkt);
+               }
+               break;
+       default:
+               return;
+       }
+}
+
+int
+send_adb_iop(int cmd, u_char * buffer, void *compRout, void *data)
+{
+       u_char  buff[32];
+       int     i, cnt;
+
+       if (adbActionState != ADB_ACTION_RUNNING)
+               return -1;
+
+       buff[0] = IOP_ADB_FL_EXPLICIT;
+       buff[1] = buffer[0];
+       buff[2] = cmd;
+       cnt = (int) buff[1];
+       for (i=0; i<cnt ; i++) {
+               buff[i+3] = buffer[i+1];
+       }
+       return iop_send_msg(ISM_IOP, IOP_CHAN_ADB, buff, cnt+3,
+                           adb_iop_recv, NULL);
+}
 
 /* 
  * adb_pass_up is called by the interrupt-time routines.
@@ -1559,6 +1635,7 @@
                start = 0;
        } else {
                switch (adbHardware) {
+               case ADB_HW_IOP:
                case ADB_HW_II:
                        cmd = in->data[1];
                        if (in->data[0] < 2)
@@ -1776,6 +1853,17 @@
                        return -1;
                break;
 
+       case ADB_HW_IOP:
+#if 0
+               result = send_adb_iop((int)command, (u_char *)buffer,
+                   (void *)compRout, (void *)data);
+               if (result == 0)
+                       return 0;
+               else
+#endif
+                       return -1;
+               break;
+
        case ADB_HW_IISI:
                result = send_adb_IIsi((u_char *)0, (u_char *)buffer,
                    (void *)compRout, (void *)data, (int)command);
@@ -1831,6 +1919,8 @@
 
        switch (adbHardware) {
        case ADB_HW_II:
+               via1_register_irq(2, adb_intr_II, NULL);
+
                via_reg(VIA1, vDirB) |= 0x30;   /* register B bits 4 and 5:
                                                 * outputs */
                via_reg(VIA1, vDirB) &= 0xf7;   /* register B bit 3: input */
@@ -1847,7 +1937,14 @@
                ADB_VIA_CLR_INTR();     /* clear interrupt */
                break;
 
+       case ADB_HW_IOP:
+               /* adbActionState = ADB_ACTION_RUNNING; */
+               via_reg(VIA1, vIER) = 0x84;
+               via_reg(VIA1, vIFR) = 0x04;



Home | Main Index | Thread Index | Old Index