Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-or-later */
0002 /******************************************************************************
0003  *
0004  *  (C)Copyright 1998,1999 SysKonnect,
0005  *  a business unit of Schneider & Koch & Co. Datensysteme GmbH.
0006  *
0007  *  The information in this file is provided "AS IS" without warranty.
0008  *
0009  ******************************************************************************/
0010 
0011 /*
0012  *  Operating system specific definitions for driver and
0013  *  hardware module.
0014  */
0015 
0016 #ifndef TARGETOS_H
0017 #define TARGETOS_H
0018 
0019 
0020 //-------- those should go into include/linux/pci.h
0021 #define PCI_VENDOR_ID_SK        0x1148
0022 #define PCI_DEVICE_ID_SK_FP     0x4000
0023 //--------
0024 
0025 
0026 
0027 //-------- those should go into include/linux/if_fddi.h
0028 #define FDDI_MAC_HDR_LEN 13
0029 
0030 #define FDDI_RII    0x01 /* routing information bit */
0031 #define FDDI_RCF_DIR_BIT 0x80
0032 #define FDDI_RCF_LEN_MASK 0x1f
0033 #define FDDI_RCF_BROADCAST 0x8000
0034 #define FDDI_RCF_LIMITED_BROADCAST 0xA000
0035 #define FDDI_RCF_FRAME2K 0x20
0036 #define FDDI_RCF_FRAME4K 0x30
0037 //--------
0038 
0039 
0040 #undef ADDR
0041 
0042 #include <asm/io.h>
0043 #include <linux/netdevice.h>
0044 #include <linux/fddidevice.h>
0045 #include <linux/skbuff.h>
0046 #include <linux/pci.h>
0047 
0048 // is redefined by linux, but we need our definition
0049 #undef ADDR
0050 #ifdef MEM_MAPPED_IO
0051 #define ADDR(a) (smc->hw.iop+(a))
0052 #else
0053 #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))))
0054 #endif
0055 
0056 #include "hwmtm.h"
0057 
0058 #define TRUE  1
0059 #define FALSE 0
0060 
0061 // HWM Definitions
0062 // -----------------------
0063 #define FDDI_TRACE(string, arg1, arg2, arg3)    // Performance analysis.
0064 #ifdef PCI
0065 #define NDD_TRACE(string, arg1, arg2, arg3) // Performance analysis.
0066 #endif  // PCI
0067 #define SMT_PAGESIZE    PAGE_SIZE   // Size of a memory page (power of 2).
0068 // -----------------------
0069 
0070 
0071 // SMT Definitions
0072 // -----------------------
0073 #define TICKS_PER_SECOND    HZ
0074 #define SMC_VERSION         1
0075 // -----------------------
0076 
0077 
0078 // OS-Driver Definitions
0079 // -----------------------
0080 #define NO_ADDRESS 0xffe0   /* No Device (I/O) Address */
0081 #define SKFP_MAX_NUM_BOARDS 8   /* maximum number of PCI boards */
0082 
0083 #define SK_BUS_TYPE_PCI     0
0084 #define SK_BUS_TYPE_EISA    1
0085 
0086 #define FP_IO_LEN       256 /* length of IO area used */
0087 
0088 #define u8  unsigned char
0089 #define u16 unsigned short
0090 #define u32 unsigned int
0091 
0092 #define MAX_TX_QUEUE_LEN    20 // number of packets queued by driver
0093 #define MAX_FRAME_SIZE      4550
0094 
0095 #define RX_LOW_WATERMARK    NUM_RECEIVE_BUFFERS  / 2
0096 #define TX_LOW_WATERMARK    NUM_TRANSMIT_BUFFERS - 2
0097 
0098 /*
0099 ** Include the IOCTL stuff
0100 */
0101 #include <linux/sockios.h>
0102 
0103 #define SKFPIOCTL   SIOCDEVPRIVATE
0104 
0105 struct s_skfp_ioctl {
0106     unsigned short cmd;                /* Command to run */
0107     unsigned short len;                /* Length of the data buffer */
0108     unsigned char __user *data;        /* Pointer to the data buffer */
0109 };
0110 
0111 /* 
0112 ** Recognised ioctl commands for the driver 
0113 */
0114 #define SKFP_GET_STATS      0x05 /* Get the driver statistics */
0115 #define SKFP_CLR_STATS      0x06 /* Zero out the driver statistics */
0116 
0117 // The per-adapter driver structure
0118 struct s_smt_os {
0119     struct net_device *dev;
0120     struct net_device *next_module;
0121     u32 bus_type;       /* bus type (0 == PCI, 1 == EISA) */
0122     struct pci_dev  pdev;       /* PCI device structure */
0123     
0124     unsigned long base_addr;
0125     unsigned char factory_mac_addr[8];
0126     ulong   SharedMemSize;
0127     ulong   SharedMemHeap;
0128     void*   SharedMemAddr;
0129     dma_addr_t SharedMemDMA;
0130 
0131     ulong   QueueSkb;
0132     struct  sk_buff_head SendSkbQueue;
0133 
0134     ulong   MaxFrameSize;
0135     u8  ResetRequested;
0136 
0137     // MAC statistics structure
0138     struct fddi_statistics MacStat;
0139 
0140     // receive into this local buffer if no skb available
0141     // data will be not valid, because multiple RxDs can
0142     // point here at the same time, it must be at least
0143     // MAX_FRAME_SIZE bytes in size
0144     unsigned char *LocalRxBuffer;
0145     dma_addr_t LocalRxBufferDMA;
0146     
0147     // Version (required by SMT module).
0148     u_long smc_version ;
0149 
0150     // Required by Hardware Module (HWM).
0151     struct hw_modul hwm ;
0152     
0153     // For SMP-savety
0154     spinlock_t DriverLock;
0155     
0156 };
0157 
0158 typedef struct s_smt_os skfddi_priv;
0159 
0160 #endif   // _TARGETOS_