targetos.h 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. /******************************************************************************
  2. *
  3. * (C)Copyright 1998,1999 SysKonnect,
  4. * a business unit of Schneider & Koch & Co. Datensysteme GmbH.
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation; either version 2 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * The information in this file is provided "AS IS" without warranty.
  12. *
  13. ******************************************************************************/
  14. /*
  15. * Operating system specific definitions for driver and
  16. * hardware module.
  17. */
  18. #ifndef TARGETOS_H
  19. #define TARGETOS_H
  20. //-------- those should go into include/linux/pci.h
  21. #define PCI_VENDOR_ID_SK 0x1148
  22. #define PCI_DEVICE_ID_SK_FP 0x4000
  23. //--------
  24. //-------- those should go into include/linux/if_fddi.h
  25. #define FDDI_MAC_HDR_LEN 13
  26. #define FDDI_RII 0x01 /* routing information bit */
  27. #define FDDI_RCF_DIR_BIT 0x80
  28. #define FDDI_RCF_LEN_MASK 0x1f
  29. #define FDDI_RCF_BROADCAST 0x8000
  30. #define FDDI_RCF_LIMITED_BROADCAST 0xA000
  31. #define FDDI_RCF_FRAME2K 0x20
  32. #define FDDI_RCF_FRAME4K 0x30
  33. //--------
  34. #undef ADDR
  35. #include <asm/io.h>
  36. #include <linux/netdevice.h>
  37. #include <linux/fddidevice.h>
  38. #include <linux/skbuff.h>
  39. #include <linux/pci.h>
  40. #include <linux/init.h>
  41. // is redefined by linux, but we need our definition
  42. #undef ADDR
  43. #ifdef MEM_MAPPED_IO
  44. #define ADDR(a) (smc->hw.iop+(a))
  45. #else
  46. #define ADDR(a) (((a)>>7) ? (outp(smc->hw.iop+B0_RAP,(a)>>7), (smc->hw.iop+( ((a)&0x7F) | ((a)>>7 ? 0x80:0)) )) : (smc->hw.iop+(((a)&0x7F)|((a)>>7 ? 0x80:0))))
  47. #endif
  48. #include "h/hwmtm.h"
  49. #define TRUE 1
  50. #define FALSE 0
  51. // HWM Definitions
  52. // -----------------------
  53. #define FDDI_TRACE(string, arg1, arg2, arg3) // Performance analysis.
  54. #ifdef PCI
  55. #define NDD_TRACE(string, arg1, arg2, arg3) // Performance analysis.
  56. #endif // PCI
  57. #define SMT_PAGESIZE PAGE_SIZE // Size of a memory page (power of 2).
  58. // -----------------------
  59. // SMT Definitions
  60. // -----------------------
  61. #define TICKS_PER_SECOND HZ
  62. #define SMC_VERSION 1
  63. // -----------------------
  64. // OS-Driver Definitions
  65. // -----------------------
  66. #define NO_ADDRESS 0xffe0 /* No Device (I/O) Address */
  67. #define SKFP_MAX_NUM_BOARDS 8 /* maximum number of PCI boards */
  68. #define SK_BUS_TYPE_PCI 0
  69. #define SK_BUS_TYPE_EISA 1
  70. #define FP_IO_LEN 256 /* length of IO area used */
  71. #define u8 unsigned char
  72. #define u16 unsigned short
  73. #define u32 unsigned int
  74. #define MAX_TX_QUEUE_LEN 20 // number of packets queued by driver
  75. #define MAX_FRAME_SIZE 4550
  76. #define RX_LOW_WATERMARK NUM_RECEIVE_BUFFERS / 2
  77. #define TX_LOW_WATERMARK NUM_TRANSMIT_BUFFERS - 2
  78. /*
  79. ** Include the IOCTL stuff
  80. */
  81. #include <linux/sockios.h>
  82. #define SKFPIOCTL SIOCDEVPRIVATE
  83. struct s_skfp_ioctl {
  84. unsigned short cmd; /* Command to run */
  85. unsigned short len; /* Length of the data buffer */
  86. unsigned char __user *data; /* Pointer to the data buffer */
  87. };
  88. /*
  89. ** Recognised ioctl commands for the driver
  90. */
  91. #define SKFP_GET_STATS 0x05 /* Get the driver statistics */
  92. #define SKFP_CLR_STATS 0x06 /* Zero out the driver statistics */
  93. // The per-adapter driver structure
  94. struct s_smt_os {
  95. struct net_device *dev;
  96. struct net_device *next_module;
  97. u32 bus_type; /* bus type (0 == PCI, 1 == EISA) */
  98. struct pci_dev pdev; /* PCI device structure */
  99. unsigned long base_addr;
  100. unsigned char factory_mac_addr[8];
  101. ulong SharedMemSize;
  102. ulong SharedMemHeap;
  103. void* SharedMemAddr;
  104. dma_addr_t SharedMemDMA;
  105. ulong QueueSkb;
  106. struct sk_buff_head SendSkbQueue;
  107. ulong MaxFrameSize;
  108. u8 ResetRequested;
  109. // MAC statistics structure
  110. struct fddi_statistics MacStat;
  111. // receive into this local buffer if no skb available
  112. // data will be not valid, because multiple RxDs can
  113. // point here at the same time, it must be at least
  114. // MAX_FRAME_SIZE bytes in size
  115. unsigned char *LocalRxBuffer;
  116. dma_addr_t LocalRxBufferDMA;
  117. // Version (required by SMT module).
  118. u_long smc_version ;
  119. // Required by Hardware Module (HWM).
  120. struct hw_modul hwm ;
  121. // For SMP-savety
  122. spinlock_t DriverLock;
  123. };
  124. typedef struct s_smt_os skfddi_priv;
  125. #endif // _TARGETOS_