include upstream ip1000a driver version 2.09f
[linux-2.4.git] / drivers / net / ip1000a / ipg.h
1 /*\r
2  *\r
3  * ipg.h\r
4  *\r
5  * Include file for Gigabit Ethernet device driver for Network\r
6  * Interface Cards (NICs) utilizing the Tamarack Microelectronics\r
7  * Inc. IPG Gigabit or Triple Speed Ethernet Media Access\r
8  * Controller.\r
9  *\r
10  * Craig Rich\r
11  * Sundance Technology, Inc.\r
12  * 1485 Saratoga Avenue\r
13  * Suite 200\r
14  * San Jose, CA 95129\r
15  * 408 873 4117\r
16  * www.sundanceti.com\r
17  * craig_rich@sundanceti.com\r
18  *\r
19  * Rev  Date     Description\r
20  * --------------------------------------------------------------\r
21  * 0.1  11/8/99  Initial revision work begins\r
22  *\r
23  * 0.2  12/1/99  Minor update to modversions.h inclusion.\r
24  *\r
25  * 0.3  12/30/99 Updates to fully comply with IPG spec.\r
26  *\r
27  * 0.4  4/24/00  Updates to allow for removal of FCS generation\r
28  *               and verification.\r
29  * 0.5  8/15/00  Updates for MII PHY registers and fields.\r
30  *\r
31  * 0.6  8/31/00  Updates to change to using 64 bit data types\r
32  *\r
33  * 0.7  10/31/00 Added DDEBUG_MSG to allow for easy activation of\r
34  *               individual DEBUG_MSGs.\r
35  *\r
36  * 0.8  11/06/00 Changed LastFreedRxBuff to LastRestoredRxBuff for\r
37  *               clarity.\r
38  *\r
39  * 0.9  11/10/00 Changed Sundance DeviceID to 0x9020\r
40  *\r
41  * 0.10 2/14/01  Changed "DROP_ON_ERRORS", breaking out Ethernet from\r
42  *               TCP/IP errors.\r
43  *\r
44  * 0.11 3/16/01  Changed "IPG_FRAMESBETWEENTXCOMPLETES" to\r
45  *               "IPG_FRAMESBETWEENTXDMACOMPLETES" since will\r
46  *               be using TxDMAIndicate instead of TxIndicate to\r
47  *               improve performance. Added TFDunavailCount and\r
48  *               RFDlistendCount to aid in performance improvement.\r
49  *\r
50  * 0.12 3/22/01  Removed IPG_DROP_ON_RX_TCPIP_ERRORS.\r
51  *\r
52  * 0.13 3/23/01  Removed IPG_TXQUEUE_MARGIN.\r
53  *\r
54  * 0.14 3/30/01  Broke out sections into multiple files and added\r
55  *               OS version specific detection and settings.\r
56  */\r
57 \r
58 \r
59 /*\r
60  * Linux header utilization:\r
61  *\r
62  * config.h     For PCI support, namely CONFIG_PCI macro.\r
63  *\r
64  * version.h    For Linux kernel version detection.\r
65  *\r
66  * module.h     For modularized driver support.\r
67  *\r
68  * kernel.h     For 'printk'.\r
69  *\r
70  * pci.h        PCI support, including ID, VENDOR, and CLASS\r
71  *              standard definitions; PCI specific structures,\r
72  *              including pci_dev struct.\r
73  *\r
74  * ioport.h     I/O ports, check_region, request_region,\r
75  *              release_region.\r
76  *\r
77  * errno.h      Standard error numbers, e.g. ENODEV.\r
78  *\r
79  * asm/io.h     For reading/writing I/O ports, and for virt_to_bus\r
80  *              function.\r
81  *\r
82  * delay.h      For milisecond delays.\r
83  *\r
84  * types.h      For specific typedefs (i.e. u32, u16, u8).\r
85  *\r
86  * netdevice.h  For device structure needed for network support.\r
87  *\r
88  * etherdevice.h        For ethernet device support.\r
89  *\r
90  * init.h       For __initfunc.\r
91  *\r
92  * skbuff.h     Socket buffer (skbuff) definition.\r
93  *\r
94  * asm/bitops.h For test_and_set_bit, clear_bit functions.\r
95  *\r
96  * asm/spinlock.h For spin_lock_irqsave, spin_lock_irqrestore functions.\r
97  *\r
98  */\r
99 \r
100 \r
101 #include <linux/config.h>\r
102 #include <linux/version.h>\r
103 #include <linux/module.h>\r
104 \r
105 #if ((LINUX_VERSION_CODE < KERNEL_VERSION(2,3,0)) &&  defined(MODVERSIONS))\r
106         #include <linux/modversions.h>\r
107 #endif\r
108 \r
109 #include <linux/kernel.h>\r
110 #include <linux/pci.h>\r
111 #include <linux/ioport.h>\r
112 #include <linux/errno.h>\r
113 #include <asm/io.h>\r
114 #include <linux/delay.h>\r
115 #include <linux/types.h>\r
116 #include <linux/netdevice.h>\r
117 #include <linux/etherdevice.h>\r
118 #include <linux/init.h>\r
119 #include <linux/skbuff.h>\r
120 #include <linux/version.h>\r
121 #include <asm/bitops.h>\r
122 /*#include <asm/spinlock.h>*/\r
123 \r
124 #define DrvVer "2.09d"\r
125 \r
126 const char *version =\r
127 "ipg : "DrvVer" Written by Craig Rich, www.sundanceti.com\n";\r
128 \r
129 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,0))\r
130         char kernel_version[] = UTS_RELEASE;\r
131 #endif\r
132 \r
133 #if (defined(MODULE) && (LINUX_VERSION_CODE > KERNEL_VERSION(2,1,15)))\r
134         MODULE_AUTHOR("IC Plus Corp. 2003                                           ");\r
135    MODULE_DESCRIPTION("IC Plus IP1000 Gigabit Ethernet Adapter Linux Driver "DrvVer);\r
136 #endif\r
137 \r
138 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0))\r
139         #define IPG_LINUX2_2\r
140         #undef IPG_LINUX2_4\r
141 \r
142         #define IPG_DEV_KFREE_SKB(skb) dev_kfree_skb(skb)\r
143 \r
144         #define IPG_HOST2BUS_MAP(addr) virt_to_bus(addr)\r
145 \r
146         #define IPG_PCI_RESOURCE_START(dev, bar) dev->base_address[bar]\r
147 \r
148         #define IPG_TX_NOTBUSY(dev) clear_bit(0,(void*)&dev->tbusy)\r
149         #define IPG_IS_TX_BUSY(dev) test_and_set_bit(0, (void*)&dev->tbusy)\r
150 \r
151         #define IPG_DEVICE_TYPE struct device\r
152         #define IPG_STATS_TYPE struct enet_statistics\r
153 #else\r
154         #undef IPG_LINUX2_2\r
155         #define IPG_LINUX2_4\r
156 \r
157         #define IPG_DEV_KFREE_SKB(skb) dev_kfree_skb_irq(skb)\r
158 \r
159         #define IPG_HOST2BUS_MAP(addr) addr\r
160 \r
161         #define IPG_PCI_RESOURCE_START(dev, bar) dev->resource[bar].start\r
162 \r
163         #define IPG_TX_NOTBUSY(dev) netif_wake_queue(dev)\r
164         #define IPG_IS_TX_BUSY(dev) netif_queue_stopped(dev)\r
165 \r
166         #define IPG_DEVICE_TYPE struct net_device\r
167         #define IPG_STATS_TYPE struct net_device_stats\r
168 #endif\r
169 \r
170 /* Order of the following includes is important, the following must\r
171  * appear first:\r
172  * ipg_constants.h\r
173  * ipg_tune.h\r
174  */\r
175 #include "ipg_constants.h"\r
176 #include "ipg_tune.h"\r
177 #include "ipg_macros.h"\r
178 #include "ipg_structs.h"\r
179 #include "PhyParam.h"\r
180 \r
181 /* end ipg.h */\r