5  *  Copyright (C) 1998,1999,2000 R.E.Wolff@BitWizard.nl
 
   7  *      This program is free software; you can redistribute it and/or modify
 
   8  *      it under the terms of the GNU General Public License as published by
 
   9  *      the Free Software Foundation; either version 2 of the License, or
 
  10  *      (at your option) any later version.
 
  12  *      This program is distributed in the hope that it will be useful,
 
  13  *      but WITHOUT ANY WARRANTY; without even the implied warranty of
 
  14  *      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
  15  *      GNU General Public License for more details.
 
  17  *      You should have received a copy of the GNU General Public License
 
  18  *      along with this program; if not, write to the Free Software
 
  19  *      Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
  23  *  Version 1.0 -- July, 1999. 
 
  28 #define RIO_PORTSPERBOARD 128
 
  29 #define RIO_NPORTS        (RIO_NBOARDS * RIO_PORTSPERBOARD)
 
  35 #define RIO_MAGIC 0x12345678
 
  51 #define RIO_DEBUG_ALL           0xffffffff
 
  53 #define O_OTHER(tty)    \
 
  69 #define I_OTHER(tty)    \
 
  77 #endif                          /* __KERNEL__ */
 
  80 #define RIO_BOARD_INTR_LOCK  1
 
  83 #ifndef RIOCTL_MISC_MINOR
 
  84 /* Allow others to gather this into "major.h" or something like that */
 
  85 #define RIOCTL_MISC_MINOR    169
 
  89 /* Allow us to debug "in the field" without requiring clients to
 
  92 #define rio_spin_lock_irqsave(sem, flags) do { \
 
  93         rio_dprintk (RIO_DEBUG_SPINLOCK, "spinlockirqsave: %p %s:%d\n", \
 
  94                                         sem, __FILE__, __LINE__);\
 
  95         spin_lock_irqsave(sem, flags);\
 
  98 #define rio_spin_unlock_irqrestore(sem, flags) do { \
 
  99         rio_dprintk (RIO_DEBUG_SPINLOCK, "spinunlockirqrestore: %p %s:%d\n",\
 
 100                                         sem, __FILE__, __LINE__);\
 
 101         spin_unlock_irqrestore(sem, flags);\
 
 104 #define rio_spin_lock(sem) do { \
 
 105         rio_dprintk (RIO_DEBUG_SPINLOCK, "spinlock: %p %s:%d\n",\
 
 106                                         sem, __FILE__, __LINE__);\
 
 110 #define rio_spin_unlock(sem) do { \
 
 111         rio_dprintk (RIO_DEBUG_SPINLOCK, "spinunlock: %p %s:%d\n",\
 
 112                                         sem, __FILE__, __LINE__);\
 
 116 #define rio_spin_lock_irqsave(sem, flags) \
 
 117             spin_lock_irqsave(sem, flags)
 
 119 #define rio_spin_unlock_irqrestore(sem, flags) \
 
 120             spin_unlock_irqrestore(sem, flags)
 
 122 #define rio_spin_lock(sem) \
 
 125 #define rio_spin_unlock(sem) \
 
 132 #ifdef CONFIG_RIO_OLDPCI
 
 133 static inline void __iomem *rio_memcpy_toio(void __iomem *dummy, void __iomem *dest, void *source, int n)
 
 135         char __iomem *dst = dest;
 
 139                 writeb(*src++, dst++);
 
 146 static inline void __iomem *rio_copy_toio(void __iomem *dest, void *source, int n)
 
 148         char __iomem *dst = dest;
 
 152                 writeb(*src++, dst++);
 
 158 static inline void *rio_memcpy_fromio(void *dest, void __iomem *source, int n)
 
 161         char __iomem *src = source;
 
 164                 *dst++ = readb(src++);
 
 170 #define rio_memcpy_toio(dummy,dest,source,n)   memcpy_toio(dest, source, n)
 
 171 #define rio_copy_toio                          memcpy_toio
 
 172 #define rio_memcpy_fromio                      memcpy_fromio
 
 179    This driver can spew a whole lot of debugging output at you. If you
 
 180    need maximum performance, you should disable the DEBUG define. To
 
 181    aid in debugging in the field, I'm leaving the compile-time debug
 
 182    features enabled, and disable them "runtime". That allows me to
 
 183    instruct people with problems to enable debugging without requiring
 
 188 #define rio_dprintk(f, str...) do { if (rio_debug & f) printk (str);} while (0)
 
 189 #define func_enter() rio_dprintk (RIO_DEBUG_FLOW, "rio: enter %s\n", __FUNCTION__)
 
 190 #define func_exit()  rio_dprintk (RIO_DEBUG_FLOW, "rio: exit  %s\n", __FUNCTION__)
 
 191 #define func_enter2() rio_dprintk (RIO_DEBUG_FLOW, "rio: enter %s (port %d)\n",__FUNCTION__, port->line)
 
 193 #define rio_dprintk(f, str...)  /* nothing */
 
 196 #define func_enter2()