fedora core 6 1.2949 + vserver 2.2.0
[linux-2.6.git] / drivers / net / tlan.h
index b3c0e4a..41ce0b6 100644 (file)
@@ -9,13 +9,13 @@
  *
  *  (C) 1997-1998 Caldera, Inc.
  *  (C) 1999-2001 Torben Mathiasen
- * 
+ *
  *  This software may be used and distributed according to the terms
  *  of the GNU General Public License, incorporated herein by reference.
  *
  ** This file is best viewed/edited with tabstop=4, colums>=132
  *
- *  
+ *
  *  Dec 10, 1999       Torben Mathiasen <torben.mathiasen@compaq.com>
  *                     New Maintainer
  *
@@ -48,7 +48,7 @@
 #define TLAN_DBG(lvl, format, args...) if (debug&lvl) printk(KERN_DEBUG "TLAN: " format, ##args );
 #define TLAN_DEBUG_GNRL                0x0001
 #define TLAN_DEBUG_TX          0x0002
-#define TLAN_DEBUG_RX          0x0004 
+#define TLAN_DEBUG_RX          0x0004
 #define TLAN_DEBUG_LIST                0x0008
 #define TLAN_DEBUG_PROBE       0x0010
 
@@ -60,7 +60,7 @@
         * Device Identification Definitions
         *
         ****************************************************************/
-               
+
 #define PCI_DEVICE_ID_NETELLIGENT_10_T2                        0xB012
 #define PCI_DEVICE_ID_NETELLIGENT_10_100_WS_5100       0xB030
 #ifndef PCI_DEVICE_ID_OLICOM_OC2183
@@ -102,11 +102,11 @@ typedef struct tlan_adapter_entry {
         *
         ****************************************************************/
 
-#define EISA_ID      0xc80   /* EISA ID Registers */ 
-#define EISA_ID0     0xc80   /* EISA ID Register 0 */ 
-#define EISA_ID1     0xc81   /* EISA ID Register 1 */ 
-#define EISA_ID2     0xc82   /* EISA ID Register 2 */ 
-#define EISA_ID3     0xc83   /* EISA ID Register 3 */ 
+#define EISA_ID      0xc80   /* EISA ID Registers */
+#define EISA_ID0     0xc80   /* EISA ID Register 0 */
+#define EISA_ID1     0xc81   /* EISA ID Register 1 */
+#define EISA_ID2     0xc82   /* EISA ID Register 2 */
+#define EISA_ID3     0xc83   /* EISA ID Register 3 */
 #define EISA_CR      0xc84   /* EISA Control Register */
 #define EISA_REG0    0xc88   /* EISA Configuration Register 0 */
 #define EISA_REG1    0xc89   /* EISA Configuration Register 1 */
@@ -170,6 +170,7 @@ typedef u8 TLanBuffer[TLAN_MAX_FRAME_SIZE];
 typedef struct tlan_private_tag {
        struct net_device       *nextDevice;
        struct pci_dev          *pciDev;
+       struct net_device       *dev;
        void                    *dmaStorage;
        dma_addr_t              dmaStorageDMA;
        unsigned int            dmaSize;
@@ -443,17 +444,17 @@ typedef struct tlan_private_tag {
 
 /* Routines to access internal registers. */
 
-inline u8 TLan_DioRead8(u16 base_addr, u16 internal_addr)
+static inline u8 TLan_DioRead8(u16 base_addr, u16 internal_addr)
 {
        outw(internal_addr, base_addr + TLAN_DIO_ADR);
        return (inb((base_addr + TLAN_DIO_DATA) + (internal_addr & 0x3)));
-       
+
 } /* TLan_DioRead8 */
 
 
 
 
-inline u16 TLan_DioRead16(u16 base_addr, u16 internal_addr)
+static inline u16 TLan_DioRead16(u16 base_addr, u16 internal_addr)
 {
        outw(internal_addr, base_addr + TLAN_DIO_ADR);
        return (inw((base_addr + TLAN_DIO_DATA) + (internal_addr & 0x2)));
@@ -463,7 +464,7 @@ inline u16 TLan_DioRead16(u16 base_addr, u16 internal_addr)
 
 
 
-inline u32 TLan_DioRead32(u16 base_addr, u16 internal_addr)
+static inline u32 TLan_DioRead32(u16 base_addr, u16 internal_addr)
 {
        outw(internal_addr, base_addr + TLAN_DIO_ADR);
        return (inl(base_addr + TLAN_DIO_DATA));
@@ -473,7 +474,7 @@ inline u32 TLan_DioRead32(u16 base_addr, u16 internal_addr)
 
 
 
-inline void TLan_DioWrite8(u16 base_addr, u16 internal_addr, u8 data)
+static inline void TLan_DioWrite8(u16 base_addr, u16 internal_addr, u8 data)
 {
        outw(internal_addr, base_addr + TLAN_DIO_ADR);
        outb(data, base_addr + TLAN_DIO_DATA + (internal_addr & 0x3));
@@ -483,7 +484,7 @@ inline void TLan_DioWrite8(u16 base_addr, u16 internal_addr, u8 data)
 
 
 
-inline void TLan_DioWrite16(u16 base_addr, u16 internal_addr, u16 data)
+static inline void TLan_DioWrite16(u16 base_addr, u16 internal_addr, u16 data)
 {
        outw(internal_addr, base_addr + TLAN_DIO_ADR);
        outw(data, base_addr + TLAN_DIO_DATA + (internal_addr & 0x2));
@@ -493,46 +494,38 @@ inline void TLan_DioWrite16(u16 base_addr, u16 internal_addr, u16 data)
 
 
 
-inline void TLan_DioWrite32(u16 base_addr, u16 internal_addr, u32 data)
+static inline void TLan_DioWrite32(u16 base_addr, u16 internal_addr, u32 data)
 {
        outw(internal_addr, base_addr + TLAN_DIO_ADR);
        outl(data, base_addr + TLAN_DIO_DATA + (internal_addr & 0x2));
 
 }
 
-
-
-#if 0
-inline void TLan_ClearBit(u8 bit, u16 port)
-{
-       outb_p(inb_p(port) & ~bit, port);
-}
-
-
-
-
-inline int TLan_GetBit(u8 bit, u16 port)
-{
-       return ((int) (inb_p(port) & bit));
-}
-
-
-
-
-inline void TLan_SetBit(u8 bit, u16 port)
-{
-       outb_p(inb_p(port) | bit, port);
-}
-#endif
-
 #define TLan_ClearBit( bit, port )     outb_p(inb_p(port) & ~bit, port)
 #define TLan_GetBit( bit, port )       ((int) (inb_p(port) & bit))
 #define TLan_SetBit( bit, port )       outb_p(inb_p(port) | bit, port)
 
-#ifdef I_LIKE_A_FAST_HASH_FUNCTION
-/* given 6 bytes, view them as 8 6-bit numbers and return the XOR of those */
-/* the code below is about seven times as fast as the original code */
-inline u32 TLan_HashFunc( u8 *a )
+/*
+ * given 6 bytes, view them as 8 6-bit numbers and return the XOR of those
+ * the code below is about seven times as fast as the original code
+ *
+ * The original code was:
+ *
+ * u32 xor( u32 a, u32 b ) {   return ( ( a && ! b ) || ( ! a && b ) ); }
+ *
+ * #define XOR8( a, b, c, d, e, f, g, h )      \
+ *     xor( a, xor( b, xor( c, xor( d, xor( e, xor( f, xor( g, h ) ) ) ) ) ) )
+ * #define DA( a, bit )                ( ( (u8) a[bit/8] ) & ( (u8) ( 1 << bit%8 ) ) )
+ *
+ *     hash  = XOR8( DA(a,0), DA(a, 6), DA(a,12), DA(a,18), DA(a,24), DA(a,30), DA(a,36), DA(a,42) );
+ *     hash |= XOR8( DA(a,1), DA(a, 7), DA(a,13), DA(a,19), DA(a,25), DA(a,31), DA(a,37), DA(a,43) ) << 1;
+ *     hash |= XOR8( DA(a,2), DA(a, 8), DA(a,14), DA(a,20), DA(a,26), DA(a,32), DA(a,38), DA(a,44) ) << 2;
+ *     hash |= XOR8( DA(a,3), DA(a, 9), DA(a,15), DA(a,21), DA(a,27), DA(a,33), DA(a,39), DA(a,45) ) << 3;
+ *     hash |= XOR8( DA(a,4), DA(a,10), DA(a,16), DA(a,22), DA(a,28), DA(a,34), DA(a,40), DA(a,46) ) << 4;
+ *     hash |= XOR8( DA(a,5), DA(a,11), DA(a,17), DA(a,23), DA(a,29), DA(a,35), DA(a,41), DA(a,47) ) << 5;
+ *
+ */
+static inline u32 TLan_HashFunc( const u8 *a )
 {
         u8     hash;
 
@@ -545,30 +538,4 @@ inline u32 TLan_HashFunc( u8 *a )
 
         return (hash & 077);
 }
-
-#else /* original code */
-
-inline u32     xor( u32 a, u32 b )
-{
-       return ( ( a && ! b ) || ( ! a && b ) );
-}
-#define XOR8( a, b, c, d, e, f, g, h ) xor( a, xor( b, xor( c, xor( d, xor( e, xor( f, xor( g, h ) ) ) ) ) ) )
-#define DA( a, bit )                                   ( ( (u8) a[bit/8] ) & ( (u8) ( 1 << bit%8 ) ) )
-
-inline u32 TLan_HashFunc( u8 *a )
-{
-       u32     hash;
-
-       hash  = XOR8( DA(a,0), DA(a, 6), DA(a,12), DA(a,18), DA(a,24), DA(a,30), DA(a,36), DA(a,42) );
-       hash |= XOR8( DA(a,1), DA(a, 7), DA(a,13), DA(a,19), DA(a,25), DA(a,31), DA(a,37), DA(a,43) ) << 1;
-       hash |= XOR8( DA(a,2), DA(a, 8), DA(a,14), DA(a,20), DA(a,26), DA(a,32), DA(a,38), DA(a,44) ) << 2;
-       hash |= XOR8( DA(a,3), DA(a, 9), DA(a,15), DA(a,21), DA(a,27), DA(a,33), DA(a,39), DA(a,45) ) << 3;
-       hash |= XOR8( DA(a,4), DA(a,10), DA(a,16), DA(a,22), DA(a,28), DA(a,34), DA(a,40), DA(a,46) ) << 4;
-       hash |= XOR8( DA(a,5), DA(a,11), DA(a,17), DA(a,23), DA(a,29), DA(a,35), DA(a,41), DA(a,47) ) << 5;
-
-       return hash;
-
-} 
-
-#endif /* I_LIKE_A_FAST_HASH_FUNCTION */
 #endif