skdrv1st.h 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264
  1. /******************************************************************************
  2. *
  3. * Name: skdrv1st.h
  4. * Project: GEnesis, PCI Gigabit Ethernet Adapter
  5. * Version: $Revision: 1.11 $
  6. * Date: $Date: 2003/02/25 14:16:40 $
  7. * Purpose: First header file for driver and all other modules
  8. *
  9. ******************************************************************************/
  10. /******************************************************************************
  11. *
  12. * (C)Copyright 1998-2003 SysKonnect GmbH.
  13. *
  14. * This program is free software; you can redistribute it and/or modify
  15. * it under the terms of the GNU General Public License as published by
  16. * the Free Software Foundation; either version 2 of the License, or
  17. * (at your option) any later version.
  18. *
  19. * The information in this file is provided "AS IS" without warranty.
  20. *
  21. ******************************************************************************/
  22. /******************************************************************************
  23. *
  24. * History:
  25. *
  26. * $Log: skdrv1st.h,v $
  27. * Revision 1.11 2003/02/25 14:16:40 mlindner
  28. * Fix: Copyright statement
  29. *
  30. * Revision 1.10 2002/10/02 12:46:02 mlindner
  31. * Add: Support for Yukon
  32. *
  33. * Revision 1.9.2.2 2001/12/07 12:06:42 mlindner
  34. * Fix: malloc -> slab changes
  35. *
  36. * Revision 1.9.2.1 2001/03/12 16:50:59 mlindner
  37. * chg: kernel 2.4 adaption
  38. *
  39. * Revision 1.9 2001/01/22 14:16:04 mlindner
  40. * added ProcFs functionality
  41. * Dual Net functionality integrated
  42. * Rlmt networks added
  43. *
  44. * Revision 1.8 2000/02/21 12:19:18 cgoos
  45. * Added default for SK_DEBUG_CHKMOD/_CHKCAT
  46. *
  47. * Revision 1.7 1999/11/22 13:50:00 cgoos
  48. * Changed license header to GPL.
  49. * Added overwrite for several functions.
  50. * Removed linux 2.0.x definitions.
  51. * Removed PCI vendor ID definition (now in kernel).
  52. *
  53. * Revision 1.6 1999/07/27 08:03:33 cgoos
  54. * Changed SK_IN/OUT macros to readX/writeX instead of memory
  55. * accesses (necessary for ALPHA).
  56. *
  57. * Revision 1.5 1999/07/23 12:10:21 cgoos
  58. * Removed SK_RLMT_SLOW_LOOKAHEAD define.
  59. *
  60. * Revision 1.4 1999/07/14 12:31:13 cgoos
  61. * Added SK_RLMT_SLOW_LOOKAHEAD define.
  62. *
  63. * Revision 1.3 1999/04/07 10:12:54 cgoos
  64. * Added check for KERNEL and OPTIMIZATION defines.
  65. *
  66. * Revision 1.2 1999/03/01 08:51:47 cgoos
  67. * Fixed pcibios_read/write definitions.
  68. *
  69. * Revision 1.1 1999/02/16 07:40:49 cgoos
  70. * First version.
  71. *
  72. *
  73. *
  74. ******************************************************************************/
  75. /******************************************************************************
  76. *
  77. * Description:
  78. *
  79. * This is the first include file of the driver, which includes all
  80. * neccessary system header files and some of the GEnesis header files.
  81. * It also defines some basic items.
  82. *
  83. * Include File Hierarchy:
  84. *
  85. * see skge.c
  86. *
  87. ******************************************************************************/
  88. #ifndef __INC_SKDRV1ST_H
  89. #define __INC_SKDRV1ST_H
  90. #if 0
  91. /* Check kernel version */
  92. #include <linux/version.h>
  93. #if (LINUX_VERSION_CODE > 0x020300)
  94. #endif
  95. #endif
  96. typedef struct s_AC SK_AC;
  97. /* override some default functions with optimized linux functions */
  98. #define SK_PNMI_STORE_U16(p,v) memcpy((char*)(p),(char*)&(v),2)
  99. #define SK_PNMI_STORE_U32(p,v) memcpy((char*)(p),(char*)&(v),4)
  100. #define SK_PNMI_STORE_U64(p,v) memcpy((char*)(p),(char*)&(v),8)
  101. #define SK_PNMI_READ_U16(p,v) memcpy((char*)&(v),(char*)(p),2)
  102. #define SK_PNMI_READ_U32(p,v) memcpy((char*)&(v),(char*)(p),2)
  103. #define SK_PNMI_READ_U64(p,v) memcpy((char*)&(v),(char*)(p),2)
  104. #define SkCsCalculateChecksum(p,l) ((~ip_compute_csum(p, l)) & 0xffff)
  105. #define SK_ADDR_EQUAL(a1,a2) (!memcmp(a1,a2,6))
  106. #if !defined(__OPTIMIZE__) || !defined(__KERNEL__)
  107. #warning You must compile this file with the correct options!
  108. #warning See the last lines of the source file.
  109. #error You must compile this driver with "-O".
  110. #endif
  111. #if 0
  112. #include <linux/version.h>
  113. #endif
  114. #include <linux/types.h>
  115. #if 0
  116. #include <linux/kernel.h>
  117. #endif
  118. #include <linux/string.h>
  119. #if 0
  120. #include <linux/errno.h>
  121. #include <linux/ioport.h>
  122. #include <linux/slab.h>
  123. #include <linux/interrupt.h>
  124. #include <linux/pci.h>
  125. #endif
  126. #include <asm/byteorder.h>
  127. #include <asm/bitops.h>
  128. #include <asm/io.h>
  129. #if 0
  130. #include <linux/netdevice.h>
  131. #include <linux/etherdevice.h>
  132. #include <linux/skbuff.h>
  133. #include <linux/init.h>
  134. #include <asm/uaccess.h>
  135. #include <net/checksum.h>
  136. #endif
  137. #include "h/sktypes.h"
  138. #include "h/skerror.h"
  139. #include "h/skdebug.h"
  140. #include "h/lm80.h"
  141. #include "h/xmac_ii.h"
  142. #include "u-boot_compat.h"
  143. #ifdef __LITTLE_ENDIAN
  144. #define SK_LITTLE_ENDIAN
  145. #else
  146. #define SK_BIG_ENDIAN
  147. #endif
  148. #if 0
  149. #define SK_NET_DEVICE net_device
  150. #else
  151. #define SK_NET_DEVICE eth_device
  152. #endif
  153. /* we use gethrtime(), return unit: nanoseconds */
  154. #if 0
  155. #define SK_TICKS_PER_SEC HZ
  156. #else
  157. #define SK_TICKS_PER_SEC CFG_HZ
  158. #endif
  159. #define SK_MEM_MAPPED_IO
  160. /* #define SK_RLMT_SLOW_LOOKAHEAD */
  161. #define SK_MAX_MACS 2
  162. #define SK_MAX_NETS 2
  163. #define SK_IOC char*
  164. typedef struct s_DrvRlmtMbuf SK_MBUF;
  165. #define SK_CONST64 INT64_C
  166. #define SK_CONSTU64 UINT64_C
  167. #define SK_MEMCPY(dest,src,size) memcpy(dest,src,size)
  168. #define SK_MEMCMP(s1,s2,size) memcmp(s1,s2,size)
  169. #define SK_MEMSET(dest,val,size) memset(dest,val,size)
  170. #define SK_STRLEN(pStr) strlen((char*)(pStr))
  171. #define SK_STRNCPY(pDest,pSrc,size) strncpy((char*)(pDest),(char*)(pSrc),size)
  172. #define SK_STRCMP(pStr1,pStr2) strcmp((char*)(pStr1),(char*)(pStr2))
  173. /* macros to access the adapter */
  174. #define SK_OUT8(b,a,v) writeb((v), ((b)+(a)))
  175. #define SK_OUT16(b,a,v) writew((v), ((b)+(a)))
  176. #define SK_OUT32(b,a,v) writel((v), ((b)+(a)))
  177. #define SK_IN8(b,a,pv) (*(pv) = readb((b)+(a)))
  178. #define SK_IN16(b,a,pv) (*(pv) = readw((b)+(a)))
  179. #define SK_IN32(b,a,pv) (*(pv) = readl((b)+(a)))
  180. #define int8_t char
  181. #define int16_t short
  182. #define int32_t long
  183. #define int64_t long long
  184. #define uint8_t u_char
  185. #define uint16_t u_short
  186. #define uint32_t u_long
  187. #define uint64_t unsigned long long
  188. #define t_scalar_t int
  189. #define t_uscalar_t unsigned int
  190. #define uintptr_t unsigned long
  191. #define __CONCAT__(A,B) A##B
  192. #define INT32_C(a) __CONCAT__(a,L)
  193. #define INT64_C(a) __CONCAT__(a,LL)
  194. #define UINT32_C(a) __CONCAT__(a,UL)
  195. #define UINT64_C(a) __CONCAT__(a,ULL)
  196. #ifdef DEBUG
  197. #define SK_DBG_PRINTF printk
  198. #ifndef SK_DEBUG_CHKMOD
  199. #define SK_DEBUG_CHKMOD 0
  200. #endif
  201. #ifndef SK_DEBUG_CHKCAT
  202. #define SK_DEBUG_CHKCAT 0
  203. #endif
  204. /* those come from the makefile */
  205. #define SK_DBG_CHKMOD(pAC) (SK_DEBUG_CHKMOD)
  206. #define SK_DBG_CHKCAT(pAC) (SK_DEBUG_CHKCAT)
  207. extern void SkDbgPrintf(const char *format,...);
  208. #define SK_DBGMOD_DRV 0x00010000
  209. /**** possible driver debug categories ********************************/
  210. #define SK_DBGCAT_DRV_ENTRY 0x00010000
  211. #define SK_DBGCAT_DRV_SAP 0x00020000
  212. #define SK_DBGCAT_DRV_MCA 0x00040000
  213. #define SK_DBGCAT_DRV_TX_PROGRESS 0x00080000
  214. #define SK_DBGCAT_DRV_RX_PROGRESS 0x00100000
  215. #define SK_DBGCAT_DRV_PROGRESS 0x00200000
  216. #define SK_DBGCAT_DRV_MSG 0x00400000
  217. #define SK_DBGCAT_DRV_PROM 0x00800000
  218. #define SK_DBGCAT_DRV_TX_FRAME 0x01000000
  219. #define SK_DBGCAT_DRV_ERROR 0x02000000
  220. #define SK_DBGCAT_DRV_INT_SRC 0x04000000
  221. #define SK_DBGCAT_DRV_EVENT 0x08000000
  222. #endif
  223. #define SK_ERR_LOG SkErrorLog
  224. extern void SkErrorLog(SK_AC*, int, int, char*);
  225. #endif