2 ** -----------------------------------------------------------------------------
 
   4 **  Perle Specialix driver for Linux
 
   5 **  Ported from existing RIO Driver for SCO sources.
 
   7  *  (C) 1990 - 1998 Specialix International Ltd., Byfleet, Surrey, UK.
 
   9  *      This program is free software; you can redistribute it and/or modify
 
  10  *      it under the terms of the GNU General Public License as published by
 
  11  *      the Free Software Foundation; either version 2 of the License, or
 
  12  *      (at your option) any later version.
 
  14  *      This program is distributed in the hope that it will be useful,
 
  15  *      but WITHOUT ANY WARRANTY; without even the implied warranty of
 
  16  *      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
  17  *      GNU General Public License for more details.
 
  19  *      You should have received a copy of the GNU General Public License
 
  20  *      along with this program; if not, write to the Free Software
 
  21  *      Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
  25 **      Last Modified   : 11/6/98 11:34:13
 
  26 **      Retrieved       : 11/6/98 11:34:22
 
  28 **  ident @(#)rio.h     1.3
 
  30 ** -----------------------------------------------------------------------------
 
  37 **      Maximum numbers of things
 
  39 #define RIO_SLOTS       4       /* number of configuration slots */
 
  40 #define RIO_HOSTS       4       /* number of hosts that can be found */
 
  41 #define PORTS_PER_HOST  128     /* number of ports per host */
 
  42 #define LINKS_PER_UNIT  4       /* number of links from a host */
 
  43 #define RIO_PORTS       (PORTS_PER_HOST * RIO_HOSTS)    /* max. no. of ports */
 
  44 #define RTAS_PER_HOST   (MAX_RUP)       /* number of RTAs per host */
 
  45 #define PORTS_PER_RTA   (PORTS_PER_HOST/RTAS_PER_HOST)  /* ports on a rta */
 
  46 #define PORTS_PER_MODULE 4      /* number of ports on a plug-in module */
 
  47                                 /* number of modules on an RTA */
 
  48 #define MODULES_PER_RTA  (PORTS_PER_RTA/PORTS_PER_MODULE)
 
  49 #define MAX_PRODUCT     16      /* numbr of different product codes */
 
  50 #define MAX_MODULE_TYPES 16     /* number of different types of module */
 
  52 #define RIO_CONTROL_DEV 128     /* minor number of host/control device */
 
  53 #define RIO_INVALID_MAJOR 0     /* test first host card's major no for validity */
 
  56 ** number of RTAs that can be bound to a master
 
  58 #define MAX_RTA_BINDINGS (MAX_RUP * RIO_HOSTS)
 
  63 #define PC_RTA16        0x90000000
 
  64 #define PC_RTA8         0xe0000000
 
  70 **      Flag values returned by functions
 
  76 ** SysPort value for something that hasn't any ports
 
  78 #define NO_PORT 0xFFFFFFFF
 
  81 ** Unit ID Of all hosts
 
  86 ** Break bytes into nybles
 
  88 #define LONYBLE(X)      ((X) & 0xF)
 
  89 #define HINYBLE(X)      (((X)>>4) & 0xF)
 
  92 ** Flag values passed into some functions
 
 100 #define PRINT_TO_LOG_CONS       0
 
 101 #define PRINT_TO_CONS   1
 
 102 #define PRINT_TO_LOG    2
 
 105 ** Timeout has trouble with times of less than 3 ticks...
 
 107 #define MIN_TIMEOUT     3
 
 110 **      Generally useful constants
 
 113 #define HUNDRED_MS              ((HZ/10)?(HZ/10):1)
 
 114 #define ONE_MEG                 0x100000
 
 115 #define SIXTY_FOUR_K            0x10000
 
 117 #define RIO_AT_MEM_SIZE         SIXTY_FOUR_K
 
 118 #define RIO_EISA_MEM_SIZE       SIXTY_FOUR_K
 
 119 #define RIO_MCA_MEM_SIZE        SIXTY_FOUR_K
 
 122 #define COOK_MEDIUM             1
 
 126 **      Pointer manipulation stuff
 
 127 **      RIO_PTR takes hostp->Caddr and the offset into the DP RAM area
 
 128 **      and produces a UNIX caddr_t (pointer) to the object
 
 129 **      RIO_OBJ takes hostp->Caddr and a UNIX pointer to an object and
 
 130 **      returns the offset into the DP RAM area.
 
 132 #define RIO_PTR(C,O) (((unsigned char __iomem *)(C))+(0xFFFF&(O)))
 
 133 #define RIO_OFF(C,O) ((unsigned char __iomem *)(O)-(unsigned char __iomem *)(C))
 
 136 **      How to convert from various different device number formats:
 
 137 **      DEV is a dev number, as passed to open, close etc - NOT a minor
 
 141 #define RIO_MODEM_MASK          0x1FF
 
 142 #define RIO_MODEM_BIT           0x200
 
 143 #define RIO_UNMODEM(DEV)        (MINOR(DEV) & RIO_MODEM_MASK)
 
 144 #define RIO_ISMODEM(DEV)        (MINOR(DEV) & RIO_MODEM_BIT)
 
 145 #define RIO_PORT(DEV,FIRST_MAJ) ( (MAJOR(DEV) - FIRST_MAJ) * PORTS_PER_HOST) \
 
 147 #define CSUM(pkt_ptr)  (((u16 *)(pkt_ptr))[0] + ((u16 *)(pkt_ptr))[1] + \
 
 148                         ((u16 *)(pkt_ptr))[2] + ((u16 *)(pkt_ptr))[3] + \
 
 149                         ((u16 *)(pkt_ptr))[4] + ((u16 *)(pkt_ptr))[5] + \
 
 150                         ((u16 *)(pkt_ptr))[6] + ((u16 *)(pkt_ptr))[7] + \
 
 151                         ((u16 *)(pkt_ptr))[8] + ((u16 *)(pkt_ptr))[9] )
 
 153 #define RIO_LINK_ENABLE 0x80FF  /* FF is a hack, mainly for Mips, to        */
 
 154                                /* prevent a really stupid race condition.  */
 
 156 #define NOT_INITIALISED 0
 
 157 #define INITIALISED     1
 
 159 #define NOT_POLLING     0
 
 162 #define NOT_CHANGED     0
 
 170 /* ------ Control Codes ------ */
 
 173 #define IFOAD           ( CONTROL + 1 )
 
 174 #define IDENTIFY        ( CONTROL + 2 )
 
 175 #define ZOMBIE          ( CONTROL + 3 )
 
 176 #define UFOAD           ( CONTROL + 4 )
 
 177 #define IWAIT           ( CONTROL + 5 )
 
 179 #define IFOAD_MAGIC     0xF0AD  /* of course */
 
 180 #define ZOMBIE_MAGIC    (~0xDEAD)       /* not dead -> zombie */
 
 181 #define UFOAD_MAGIC     0xD1E   /* kill-your-neighbour */
 
 182 #define IWAIT_MAGIC     0xB1DE  /* Bide your time */
 
 184 /* ------ Error Codes ------ */
 
 186 #define E_NO_ERROR                       ((ushort) 0)
 
 188 /* ------ Free Lists ------ */
 
 190 struct rio_free_list {
 
 195 /* NULL for card side linked lists */
 
 196 #define TPNULL  ((ushort)(0x8000))
 
 197 /* We can add another packet to a transmit queue if the packet pointer pointed
 
 198  * to by the TxAdd pointer has PKT_IN_USE clear in its address. */
 
 199 #define PKT_IN_USE    0x1
 
 201 /* ------ Topology ------ */
 
 208 #endif                          /* __rio_h__ */