Port-atari archive

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

Re: Question on the images in /miniroot



jdc%coris.org.uk@localhost wrote:

> Same problem with both.

Hmm, I wonder why gcc3 kernel doesn't work on your machine..

> (I think making the macros inline and removing '&'
> is worth commiting.)

Maybe it's better to confirm that they actually fix some problem
before committing.

> First, there is a pause between printing "kbd0 at mainbus0" and the
> following new-line character of roughly 105 seconds.  I'm guessing that
> this is in the:
> 
>       for (timeout = 1000; timeout > 0; timeout--) {
> 
> loop starting at atari/dev/kbd.c:213 (netbsd-4 src), where we should wait
> at most 100,000us (but more likely nearer 10,000us).

I guess such long delay is caused by spurious interrupts.
Could you try to add some debug printfs in intr.c to see
which interrupt happens?

Anyway, I added some more volatiles in atari5380.c.
Please try this one:
http://www.ceres.dti.ne.jp/~tsutsui/netbsd/netbsd-atari-BOOT-20080617.gz
---
Index: atari5380.c
===================================================================
RCS file: /cvsroot/src/sys/arch/atari/dev/atari5380.c,v
retrieving revision 1.41
diff -u -r1.41 atari5380.c
--- atari5380.c 10 May 2006 06:24:02 -0000      1.41
+++ atari5380.c 17 Jun 2008 16:34:21 -0000
@@ -136,20 +136,27 @@
        volatile u_char         s_hdma_ctrl;    /* Hades control register */
 };
 
-#define        set_scsi_dma(addr, val) (void)(                                 
\
-       {                                                               \
-       u_char  *address = (u_char*)__UNVOLATILE(addr+1);               \
-       u_long  nval     = (u_long)val;                                 \
-       __asm("movepl   %0, %1@(0)": :"d" (nval), "a" (address));       \
-       })
-
-#define        get_scsi_dma(addr, res) (                                       
\
-       {                                                               \
-       u_char  *address = (u_char*)__UNVOLATILE(addr+1);               \
-       u_long  nval;                                                   \
-       __asm("movepl   %1@(0), %0": "=d" (nval) : "a" (address));      \
-       res = (u_long)nval;                                             \
-       })
+static inline void set_scsi_dma(volatile uint8_t *, u_long);
+static inline u_long get_scsi_dma(volatile uint8_t *);
+
+static inline void
+set_scsi_dma(volatile uint8_t *addr, u_long val)
+{
+       volatile uint8_t *address = addr + 1;
+       u_long  nval = val;
+
+       __asm("movepl   %0, %1@(0)": :"d" (nval), "a" (address));
+}
+
+static inline u_long
+get_scsi_dma(volatile uint8_t *addr)
+{
+       volatile uint8_t *address = addr + 1;
+       u_long  nval;
+
+       __asm("movepl   %1@(0), %0": "=d" (nval) : "a" (address));
+       return nval;
+}
 
 /*
  * Defines for TT-DMA control register
@@ -342,8 +349,8 @@
                SCSI_DMA->s_dma_ctrl = SD_IN;
                if (machineid & ATARI_HADES)
                    SCSI_DMA->s_hdma_ctrl &= ~(SDH_BUSERR|SDH_EOP);
-               set_scsi_dma(&(SCSI_DMA->s_dma_ptr), reqp->dm_cur->dm_addr);
-               set_scsi_dma(&(SCSI_DMA->s_dma_cnt), reqp->dm_cur->dm_count);
+               set_scsi_dma(SCSI_DMA->s_dma_ptr, reqp->dm_cur->dm_addr);
+               set_scsi_dma(SCSI_DMA->s_dma_cnt, reqp->dm_cur->dm_count);
                SET_TT_REG(NCR5380_ICOM, 0);
                SET_TT_REG(NCR5380_MODE, mode);
                SCSI_DMA->s_dma_ctrl = SD_ENABLE;
@@ -353,8 +360,8 @@
                SCSI_DMA->s_dma_ctrl = SD_OUT;
                if (machineid & ATARI_HADES)
                    SCSI_DMA->s_hdma_ctrl &= ~(SDH_BUSERR|SDH_EOP);
-               set_scsi_dma(&(SCSI_DMA->s_dma_ptr), reqp->dm_cur->dm_addr);
-               set_scsi_dma(&(SCSI_DMA->s_dma_cnt), reqp->dm_cur->dm_count);
+               set_scsi_dma(SCSI_DMA->s_dma_ptr, reqp->dm_cur->dm_addr);
+               set_scsi_dma(SCSI_DMA->s_dma_cnt, reqp->dm_cur->dm_count);
                SET_TT_REG(NCR5380_MODE, mode);
                SET_TT_REG(NCR5380_ICOM, SC_ADTB);
                SET_TT_REG(NCR5380_DMSTAT, 0);
@@ -436,8 +443,8 @@
 
        dmastat = SCSI_DMA->s_dma_ctrl;
        dmstat  = GET_TT_REG(NCR5380_DMSTAT);
-       get_scsi_dma(SCSI_DMA->s_dma_cnt, leftover);
-       get_scsi_dma(SCSI_DMA->s_dma_ptr, ptr);
+       leftover = get_scsi_dma(SCSI_DMA->s_dma_cnt);
+       ptr      = get_scsi_dma(SCSI_DMA->s_dma_ptr);
        byte_p = (u_char *)ptr;
 
        if (dmastat & SD_BUSERR) {
@@ -472,10 +479,11 @@
         */
        if ((machineid & ATARI_TT) && ((u_long)byte_p & 3)
            && PH_IN(reqp->phase)) {
-               u_char  *p, *q;
+               u_char  *p;
+               volatile u_char *q;
 
                p = ptov(reqp, (u_long *)((u_long)byte_p & ~3));
-               q = (u_char*)&(SCSI_DMA->s_dma_res);
+               q = SCSI_DMA->s_dma_res;
                switch ((u_long)byte_p & 3) {
                        case 3: *p++ = *q++;
                        case 2: *p++ = *q++;
@@ -495,7 +503,7 @@
        label_t                 faultbuf;
        int                     write;
        u_long                  count, t;
-       u_char                  *data_p = (u_char*)(stio_addr+0x741);
+       volatile u_char         *data_p = (volatile u_char *)(stio_addr+0x741);
 
        /*
         * Block SCSI interrupts while emulating DMA. They come
@@ -520,7 +528,7 @@
                /*
                 * Determine number of bytes transferred
                 */
-               get_scsi_dma(SCSI_DMA->s_dma_ptr, tmp);
+               tmp = get_scsi_dma(SCSI_DMA->s_dma_ptr);
                ptr = (u_char *)tmp;
                cnt = dma_ptr - ptr;
 
@@ -528,8 +536,8 @@
                        /*
                         * Update the DMA pointer/count fields
                         */
-                       set_scsi_dma(SCSI_DMA->s_dma_ptr, dma_ptr);
-                       get_scsi_dma(SCSI_DMA->s_dma_cnt, tmp);
+                       set_scsi_dma(SCSI_DMA->s_dma_ptr, (u_long)dma_ptr);
+                       tmp = get_scsi_dma(SCSI_DMA->s_dma_cnt);
                        set_scsi_dma(SCSI_DMA->s_dma_cnt, tmp - cnt);
 
                        if (tmp > cnt) {
@@ -589,8 +597,8 @@
        }
 #endif
 
-       get_scsi_dma(SCSI_DMA->s_dma_cnt, count);
-       get_scsi_dma(SCSI_DMA->s_dma_ptr, t);
+       count = get_scsi_dma(SCSI_DMA->s_dma_cnt);
+       t = get_scsi_dma(SCSI_DMA->s_dma_ptr);
        dma_ptr = (u_char *)t;
 
        /*

---
Izumi Tsutsui


Home | Main Index | Thread Index | Old Index