Port-atari archive

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

small patches for atari kernel



Could anyone try the following small changes?

1) use pmap_kenter_pa(9) rather than pmap_enter(9) to map msgbuf
   as other ports (msgbuf pages are not managed by pmap)

2) replace multi-statement macro using GCC extension `({})' in atari5380.c
   with static inline functions to avoid possible side effects or confusion

http://www.ceres.dti.ne.jp/~tsutsui/netbsd/netbsd-atari-BOOT-5.0_BETA-20090121.gz

Comments? (these are other concerns ;-)

---

Index: atari/machdep.c
===================================================================
RCS file: /cvsroot/src/sys/arch/atari/atari/machdep.c,v
retrieving revision 1.150.6.1
diff -u -r1.150.6.1 machdep.c
--- atari/machdep.c     8 Jan 2009 22:19:14 -0000       1.150.6.1
+++ atari/machdep.c     21 Jan 2009 12:28:54 -0000
@@ -181,9 +181,8 @@
         * and initialize it now.
         */
        for (i = 0; i < btoc(MSGBUFSIZE); i++)
-               pmap_enter(pmap_kernel(), (vaddr_t)msgbufaddr + i * PAGE_SIZE,
-                   msgbufpa + i * PAGE_SIZE, VM_PROT_READ|VM_PROT_WRITE,
-                   VM_PROT_READ|VM_PROT_WRITE|PMAP_WIRED);
+               pmap_kenter_pa((vaddr_t)msgbufaddr + i * PAGE_SIZE,
+                   msgbufpa + i * PAGE_SIZE, VM_PROT_READ|VM_PROT_WRITE);
        pmap_update(pmap_kernel());
        initmsgbuf(msgbufaddr, m68k_round_page(MSGBUFSIZE));
 
Index: dev/atari5380.c
===================================================================
RCS file: /cvsroot/src/sys/arch/atari/dev/atari5380.c,v
retrieving revision 1.46
diff -u -r1.46 atari5380.c
--- dev/atari5380.c     29 Oct 2008 14:31:01 -0000      1.46
+++ dev/atari5380.c     21 Jan 2009 12:28:54 -0000
@@ -136,20 +136,29 @@
        volatile u_char         s_hdma_ctrl;    /* Hades control register */
 };
 
-#define        set_scsi_dma(addr, val) (void)(                                 
\
-       {                                                               \
-       volatile u_char *address = (volatile u_char *)addr+1;           \
-       u_long  nval     = (u_long)val;                                 \
-       __asm("movepl   %0, %1@(0)": :"d" (nval), "a" (address));       \
-       })
-
-#define        get_scsi_dma(addr, res) (                                       
\
-       {                                                               \
-       volatile u_char *address = (volatile u_char *)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 u_char *, u_long);
+static inline u_long get_scsi_dma(volatile u_char *);
+
+static inline void
+set_scsi_dma(volatile u_char *addr, u_long val)
+{
+       volatile u_char *address;
+
+       address = addr + 1;
+       __asm("movepl   %0, %1@(0)": :"d" (val), "a" (address));
+}
+
+static inline u_long
+get_scsi_dma(volatile u_char *addr)
+{
+       volatile u_char *address;
+       u_long  nval;
+
+       address = addr + 1;
+       __asm("movepl   %1@(0), %0": "=d" (nval) : "a" (address));
+
+       return nval;
+}
 
 /*
  * Defines for TT-DMA control register
@@ -432,13 +441,12 @@
 {
        int     dmastat, dmstat;
        u_char  *byte_p;
-       u_long  leftover, ptr;
+       u_long  leftover;
 
        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);
-       byte_p = (u_char *)ptr;
+       leftover = get_scsi_dma(SCSI_DMA->s_dma_cnt);
+       byte_p = (u_char *)get_scsi_dma(SCSI_DMA->s_dma_ptr);
 
        if (dmastat & SD_BUSERR) {
                /*
@@ -495,7 +503,7 @@
 extern int                     *nofault;
        label_t                 faultbuf;
        int                     write;
-       u_long                  count, t;
+       u_long                  count;
        volatile u_char         *data_p = (volatile u_char *)(stio_addr+0x741);
 
        /*
@@ -512,7 +520,6 @@
        nofault = (int *) &faultbuf;
 
        if (setjmp((label_t *) nofault)) {
-               u_char  *ptr;
                u_long  cnt, tmp;
 
                PID("drq berr");
@@ -521,16 +528,14 @@
                /*
                 * Determine number of bytes transferred
                 */
-               get_scsi_dma(SCSI_DMA->s_dma_ptr, tmp);
-               ptr = (u_char *)tmp;
-               cnt = dma_ptr - ptr;
+               cnt = (u_long)dma_ptr - get_scsi_dma(SCSI_DMA->s_dma_ptr);
 
                if (cnt != 0) {
                        /*
                         * 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) {
@@ -590,9 +595,8 @@
        }
 #endif
 
-       get_scsi_dma(SCSI_DMA->s_dma_cnt, count);
-       get_scsi_dma(SCSI_DMA->s_dma_ptr, t);
-       dma_ptr = (u_char *)t;
+       count = get_scsi_dma(SCSI_DMA->s_dma_cnt);
+       dma_ptr = (u_char *)get_scsi_dma(SCSI_DMA->s_dma_ptr);
 
        /*
         * Keep pushing bytes until we're done or a bus-error

---
Izumi Tsutsui


Home | Main Index | Thread Index | Old Index