targetos.h 3.9 KB

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