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:

> > Could you try this one (compiled by gcc4 with the attched patch)?
> > http://www.ceres.dti.ne.jp/~tsutsui/netbsd/netbsd-atari-BOOT-20080616.gz
> 
> Thanks for looking at this.  There is still a long pause when probing the
> floppy and (after about an hour) my TT hasn't got past the "scsibus0: waiting
> 2 seconds ..." line.  I'm not able to break into DDB here.  I wonder if there
> is also a problem with timing.  I'll add some debugging printf()'s.

Hmm, could you also try these ones?

compiled by gcc3 with the previous patch:
http://www.ceres.dti.ne.jp/~tsutsui/netbsd/netbsd-atari-BOOT-20080616b.gz

compiled by gcc4 with the attached patch:
(make macros inline, and remove '&' on getting array's address)
http://www.ceres.dti.ne.jp/~tsutsui/netbsd/netbsd-atari-BOOT-20080616c.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 16 Jun 2008 15:24:50 -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) {
@@ -520,7 +527,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 +535,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 +596,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