Source-Changes-HG archive

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

[src/netbsd-1-4]: src/sys/arch/mac68k/dev Pull up revisions 1.26-1.33 (via pa...



details:   https://anonhg.NetBSD.org/src/rev/5fedd5b35ab3
branches:  netbsd-1-4
changeset: 469724:5fedd5b35ab3
user:      he <he%NetBSD.org@localhost>
date:      Sun Nov 21 15:03:16 1999 +0000

description:
Pull up revisions 1.26-1.33 (via patch, requested by sr):
  Clean up the ADB driver, and eliminate duplicate keystrokes under
  heavy load, fixing PR#7870.

diffstat:

 sys/arch/mac68k/dev/adb_direct.c |  131 +++++++++++++++++++-------------------
 1 files changed, 64 insertions(+), 67 deletions(-)

diffs (truncated from 382 to 300 lines):

diff -r cef97c2d8266 -r 5fedd5b35ab3 sys/arch/mac68k/dev/adb_direct.c
--- a/sys/arch/mac68k/dev/adb_direct.c  Sun Nov 21 15:02:46 1999 +0000
+++ b/sys/arch/mac68k/dev/adb_direct.c  Sun Nov 21 15:03:16 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: adb_direct.c,v 1.21.2.2 1999/06/07 19:32:29 perry Exp $        */
+/*     $NetBSD: adb_direct.c,v 1.21.2.3 1999/11/21 15:03:16 he Exp $   */
 
 /* From: adb_direct.c 2.02 4/18/97 jpw */
 
@@ -262,7 +262,6 @@
 int    adb_cuda_serial = 0;            /* the current packet */
 
 extern struct mac68k_machine_S mac68k_machine;
-extern int ite_polling;                        /* Are we polling?  (Debugger mode) */
 
 void   pm_setup_adb __P((void));
 void   pm_check_adb_devices __P((int));
@@ -436,8 +435,7 @@
                         * [4], even for RTC/PRAM commands.
                         */
                        /* set up data for adb_pass_up */
-                       for (i = 0; i <= adbInputBuffer[0]; i++)
-                               packet.data[i] = adbInputBuffer[i];
+                       memcpy(packet.data, adbInputBuffer, adbInputBuffer[0] + 1);
                                
                        if ((adbWaiting == 1) &&
                            (adbInputBuffer[4] == adbWaitingCmd) &&
@@ -541,8 +539,7 @@
                                adbWaitingCmd = adbOutputBuffer[2];     /* save waiting command */
                        } else {        /* no talk, so done */
                                /* set up stuff for adb_pass_up */
-                               for (i = 0; i <= adbInputBuffer[0]; i++)
-                                       packet.data[i] = adbInputBuffer[i];
+                               memcpy(packet.data, adbInputBuffer, adbInputBuffer[0] + 1);
                                packet.saveBuf = adbBuffer;
                                packet.compRout = adbCompRout;
                                packet.compData = adbCompData;
@@ -603,7 +600,7 @@
 send_adb_cuda(u_char * in, u_char * buffer, void *compRout, void *data, int
        command)
 {
-       int i, s, len;
+       int s, len;
 
 #ifdef ADB_DEBUG
        if (adb_debug)
@@ -648,12 +645,11 @@
                adbOutputBuffer[1] = 0x00;      /* mark as an ADB command */
                adbOutputBuffer[2] = (u_char)command;   /* load command */
 
-               for (i = 1; i <= len; i++)      /* copy additional output
-                                                * data, if any */
-                       adbOutputBuffer[2 + i] = buffer[i];
+               /* copy additional output data, if any */
+               memcpy(adbOutputBuffer + 3, buffer + 1, len);
        } else
-               for (i = 0; i <= (in[0] + 1); i++)
-                       adbOutputBuffer[i] = in[i];
+               /* if data ready, just copy over */
+               memcpy(adbOutputBuffer, in, in[0] + 2);
 
        adbSentChars = 0;       /* nothing sent yet */
        adbBuffer = buffer;     /* save buffer to know where to save result */
@@ -677,14 +673,15 @@
 
        splx(s);
 
-       if (0x0100 <= (s & 0x0700))     /* were VIA1 interrupts blocked ? */
+       if (0x0100 <= (s & 0x0700))     /* were VIA1 interrupts blocked? */
                /* poll until byte done */
                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_soft_intr();
-                               }
+                       if (ADB_SR_INTR_IS_ON) { /* wait for "interrupt" */
+                               adb_intr_cuda(); /* go process it */
+                               if (adb_polling)
+                                       adb_soft_intr();
+                       }
 
        return 0;
 }                              /* send_adb_cuda */
@@ -720,11 +717,13 @@
                                if (adb_debug & 0x80)
                                        printf_intr("POLL-doing-out-queue. ");
 #endif
-                       /* copy over data */
                                ADB_SET_STATE_IDLE_II();
                                delay(ADB_DELAY);
-                               for (i = 0; i <= (adbOutQueue.outBuf[0] + 1); i++)
-                                       adbOutputBuffer[i] = adbOutQueue.outBuf[i];
+
+                               /* copy over data */
+                               memcpy(adbOutputBuffer, adbOutQueue.outBuf,
+                                   adbOutQueue.outBuf[0] + 2);
+
                                adbBuffer = adbOutQueue.saveBuf;        /* user data area */
                                adbCompRout = adbOutQueue.compRout;     /* completion routine */
                                adbCompData = adbOutQueue.data; /* comp. rout. data */
@@ -735,8 +734,7 @@
                                ADB_SET_SR_OUTPUT();    /* set shift register for OUT */
                                ADB_SR() = adbOutputBuffer[1];  /* load byte for output */
                                adbBusState = ADB_BUS_CMD;      /* set bus to cmd state */
-                               ADB_SET_STATE_CMD();    /* tell ADB that we want to
-                                                * send */
+                               ADB_SET_STATE_CMD();    /* tell ADB that we want to send */
                                break;
                        } else {
 #ifdef ADB_DEBUG
@@ -830,8 +828,7 @@
                        }
                                
                        /* set up data for adb_pass_up */
-                       for (i = 0; i <= adbInputBuffer[0]; i++)
-                               packet.data[i] = adbInputBuffer[i];
+                       memcpy(packet.data, adbInputBuffer, adbInputBuffer[0] + 1);
 
                        if (!adbWaiting && (adbInputBuffer[0] != 0)) {
                                packet.unsol = 1;
@@ -861,8 +858,8 @@
                                        printf_intr("XXX: DOING OUT QUEUE\n");
 #endif
                                /* copy over data */
-                               for (i = 0; i <= (adbOutQueue.outBuf[0] + 1); i++)
-                                       adbOutputBuffer[i] = adbOutQueue.outBuf[i];
+                               memcpy(adbOutputBuffer, adbOutQueue.outBuf,
+                                   adbOutQueue.outBuf[0] + 2);
                                adbBuffer = adbOutQueue.saveBuf;        /* user data area */
                                adbCompRout = adbOutQueue.compRout;     /* completion routine */
                                adbCompData = adbOutQueue.data; /* comp. rout. data */
@@ -958,8 +955,7 @@
                                printf_intr("done \n");
 #endif
                        /* set up stuff for adb_pass_up */
-                       for (i = 0; i <= adbOutputBuffer[0]; i++)
-                               packet.data[i] = adbOutputBuffer[i];
+                       memcpy(packet.data, adbOutputBuffer, adbOutputBuffer[0] + 1);
                        packet.saveBuf = adbBuffer;
                        packet.compRout = adbCompRout;
                        packet.compData = adbCompData;
@@ -974,8 +970,8 @@
                        adbCompData = (long)0;
                        if (adbOutQueueHasData == 1) {
                                /* copy over data */
-                               for (i = 0; i <= (adbOutQueue.outBuf[0] + 1); i++)
-                                       adbOutputBuffer[i] = adbOutQueue.outBuf[i];
+                               memcpy(adbOutputBuffer, adbOutQueue.outBuf,
+                                   adbOutQueue.outBuf[0] + 2);
                                adbBuffer = adbOutQueue.saveBuf;        /* user data area */
                                adbCompRout = adbOutQueue.compRout;     /* completion routine */
                                adbCompData = adbOutQueue.data; /* comp. rout. data */
@@ -1049,7 +1045,7 @@
 int
 send_adb_II(u_char * in, u_char * buffer, void *compRout, void *data, int command)
 {
-       int i, s, len;
+       int s, len;
 
        if (adbActionState == ADB_ACTION_NOTREADY)      /* return if ADB not
                                                         * available */
@@ -1077,13 +1073,11 @@
                adbOutQueue.outBuf[0] = 1 + len;        /* command + addl. data */
                adbOutQueue.outBuf[1] = (u_char)command;        /* load command */
 
-               for (i = 1; i <= len; i++)      /* copy additional output
-                                                * data, if any */
-                       adbOutQueue.outBuf[1 + i] = buffer[i];
+               /* copy additional output data, if any */
+               memcpy(adbOutQueue.outBuf + 2, buffer + 1, len);
        } else
                /* if data ready, just copy over */
-               for (i = 0; i <= (in[0] + 1); i++)
-                       adbOutQueue.outBuf[i] = in[i];
+               memcpy(adbOutQueue.outBuf, in, in[0] + 2);
 
        adbOutQueue.saveBuf = buffer;   /* save buffer to know where to save
                                         * result */
@@ -1094,8 +1088,8 @@
        if ((adbActionState == ADB_ACTION_IDLE) &&      /* is ADB available? */
            (ADB_INTR_IS_OFF)) {        /* and no incoming interrupts? */
                /* then start command now */
-               for (i = 0; i <= (adbOutQueue.outBuf[0] + 1); i++)      /* copy over data */
-                       adbOutputBuffer[i] = adbOutQueue.outBuf[i];
+               memcpy(adbOutputBuffer, adbOutQueue.outBuf,
+                   adbOutQueue.outBuf[0] + 2);         /* copy over data */
 
                adbBuffer = adbOutQueue.saveBuf;        /* pointer to user data
                                                         * area */
@@ -1123,8 +1117,9 @@
                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_soft_intr();
+                               adb_intr_II(); /* go process it */
+                               if (adb_polling)
+                                       adb_soft_intr();
                        }
 
        return 0;
@@ -1271,8 +1266,7 @@
                         * commands
                         */
                        /* set up data for adb_pass_up */
-                       for (i = 0; i <= adbInputBuffer[0]; i++)
-                               packet.data[i] = adbInputBuffer[i];
+                       memcpy(packet.data, adbInputBuffer, adbInputBuffer[0] + 1);
                                
                        if ((adbWaiting == 1) &&        /* are we waiting AND */
                            (adbInputBuffer[4] == adbWaitingCmd) &&     /* the cmd we sent AND */
@@ -1364,8 +1358,8 @@
                                adbWaitingCmd = adbOutputBuffer[2];     /* save waiting command */
                        } else {/* no talk, so done */
                                /* set up stuff for adb_pass_up */
-                               for (i = 0; i <= adbInputBuffer[0]; i++)
-                                       packet.data[i] = adbInputBuffer[i];
+                               memcpy(packet.data, adbInputBuffer,
+                                   adbInputBuffer[0] + 1);
                                packet.saveBuf = adbBuffer;
                                packet.compRout = adbCompRout;
                                packet.compData = adbCompData;
@@ -1431,7 +1425,7 @@
 send_adb_IIsi(u_char * in, u_char * buffer, void *compRout, void *data, int
        command)
 {
-       int i, s, len;
+       int s, len;
 
        if (adbActionState == ADB_ACTION_NOTREADY)
                return 1;
@@ -1468,12 +1462,11 @@
                adbOutputBuffer[1] = 0x00;      /* mark as an ADB command */
                adbOutputBuffer[2] = (u_char)command;   /* load command */
 
-               for (i = 1; i <= len; i++)      /* copy additional output
-                                                * data, if any */
-                       adbOutputBuffer[2 + i] = buffer[i];
+               /* copy additional output data, if any */
+               memcpy(adbOutputBuffer + 3, buffer + 1, len);
        } else
-               for (i = 0; i <= (in[0] + 1); i++)
-                       adbOutputBuffer[i] = in[i];
+               /* if data ready, just copy over */
+               memcpy(adbOutputBuffer, in, in[0] + 2);
 
        adbSentChars = 0;       /* nothing sent yet */
        adbBuffer = buffer;     /* save buffer to know where to save result */
@@ -1497,19 +1490,19 @@
 
        splx(s);
 
-       if (0x0100 <= (s & 0x0700))     /* were VIA1 interrupts blocked ? */
+       if (0x0100 <= (s & 0x0700))     /* were VIA1 interrupts blocked? */
                /* poll until byte done */
                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_soft_intr();
+                       if (ADB_SR_INTR_IS_ON) { /* wait for "interrupt" */
+                               adb_intr_IIsi(); /* go process it */
+                               if (adb_polling)
+                                       adb_soft_intr();
                        }
 
         return 0;
 }                              /* send_adb_IIsi */
 
-
 /* 
  * adb_pass_up is called by the interrupt-time routines.
  * It takes the raw packet data that was received from the
@@ -1537,7 +1530,7 @@
 void
 adb_pass_up(struct adbCommand *in)
 {
-       int i, start = 0, len = 0, cmd = 0;
+       int start = 0, len = 0, cmd = 0;
        ADBDataBlock block;
 
        /* temp for testing */
@@ -1633,9 +1626,7 @@
         * directly into an adbCommand struct, which is passed to 
         * this routine, then we could eliminate this copy.
         */
-       for (i = 1; i <= len; i++)
-               adbInbound[adbInTail].data[i] = in->data[start+i];
-
+       memcpy(adbInbound[adbInTail].data + 1, in->data + start + 1, len);
        adbInbound[adbInTail].data[0] = len;
        adbInbound[adbInTail].cmd = cmd;
 
@@ -1647,7 +1638,7 @@
         * If the debugger is running, call upper half manually.
         * Otherwise, trigger a soft interrupt to handle the rest later.
         */
-       if (ite_polling)
+       if (adb_polling)



Home | Main Index | Thread Index | Old Index