161 lines · c
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/*12 * Operating system specific definitions for driver and13 * hardware module.14 */15 16#ifndef TARGETOS_H17#define TARGETOS_H18 19 20//-------- those should go into include/linux/pci.h21#define PCI_VENDOR_ID_SK 0x114822#define PCI_DEVICE_ID_SK_FP 0x400023//--------24 25 26 27//-------- those should go into include/linux/if_fddi.h28#define FDDI_MAC_HDR_LEN 1329 30#define FDDI_RII 0x01 /* routing information bit */31#define FDDI_RCF_DIR_BIT 0x8032#define FDDI_RCF_LEN_MASK 0x1f33#define FDDI_RCF_BROADCAST 0x800034#define FDDI_RCF_LIMITED_BROADCAST 0xA00035#define FDDI_RCF_FRAME2K 0x2036#define FDDI_RCF_FRAME4K 0x3037//--------38 39 40#undef ADDR41 42#include <asm/io.h>43#include <linux/netdevice.h>44#include <linux/fddidevice.h>45#include <linux/skbuff.h>46#include <linux/pci.h>47 48// is redefined by linux, but we need our definition49#undef ADDR50#ifdef MEM_MAPPED_IO51#define ADDR(a) (smc->hw.iop+(a))52#else53#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))))54#endif55 56#include "hwmtm.h"57 58#define TRUE 159#define FALSE 060 61// HWM Definitions62// -----------------------63#define FDDI_TRACE(string, arg1, arg2, arg3) // Performance analysis.64#ifdef PCI65#define NDD_TRACE(string, arg1, arg2, arg3) // Performance analysis.66#endif // PCI67#define SMT_PAGESIZE PAGE_SIZE // Size of a memory page (power of 2).68// -----------------------69 70 71// SMT Definitions72// -----------------------73#define TICKS_PER_SECOND HZ74#define SMC_VERSION 175// -----------------------76 77 78// OS-Driver Definitions79// -----------------------80#define NO_ADDRESS 0xffe0 /* No Device (I/O) Address */81#define SKFP_MAX_NUM_BOARDS 8 /* maximum number of PCI boards */82 83#define SK_BUS_TYPE_PCI 084#define SK_BUS_TYPE_EISA 185 86#define FP_IO_LEN 256 /* length of IO area used */87 88#define u8 unsigned char89#define u16 unsigned short90#define u32 unsigned int91 92#define MAX_TX_QUEUE_LEN 20 // number of packets queued by driver93#define MAX_FRAME_SIZE 455094 95#define RX_LOW_WATERMARK NUM_RECEIVE_BUFFERS / 296#define TX_LOW_WATERMARK NUM_TRANSMIT_BUFFERS - 297 98/*99** Include the IOCTL stuff100*/101#include <linux/sockios.h>102 103#define SKFPIOCTL SIOCDEVPRIVATE104 105struct s_skfp_ioctl {106 unsigned short cmd; /* Command to run */107 unsigned short len; /* Length of the data buffer */108 unsigned char __user *data; /* Pointer to the data buffer */109};110 111/* 112** Recognised ioctl commands for the driver 113*/114#define SKFP_GET_STATS 0x05 /* Get the driver statistics */115#define SKFP_CLR_STATS 0x06 /* Zero out the driver statistics */116 117// The per-adapter driver structure118struct s_smt_os {119 struct net_device *dev;120 struct net_device *next_module;121 u32 bus_type; /* bus type (0 == PCI, 1 == EISA) */122 struct pci_dev pdev; /* PCI device structure */123 124 unsigned long base_addr;125 unsigned char factory_mac_addr[8];126 ulong SharedMemSize;127 ulong SharedMemHeap;128 void* SharedMemAddr;129 dma_addr_t SharedMemDMA;130 131 ulong QueueSkb;132 struct sk_buff_head SendSkbQueue;133 134 ulong MaxFrameSize;135 u8 ResetRequested;136 137 // MAC statistics structure138 struct fddi_statistics MacStat;139 140 // receive into this local buffer if no skb available141 // data will be not valid, because multiple RxDs can142 // point here at the same time, it must be at least143 // MAX_FRAME_SIZE bytes in size144 unsigned char *LocalRxBuffer;145 dma_addr_t LocalRxBufferDMA;146 147 // Version (required by SMT module).148 u_long smc_version ;149 150 // Required by Hardware Module (HWM).151 struct hw_modul hwm ;152 153 // For SMP-savety154 spinlock_t DriverLock;155 156};157 158typedef struct s_smt_os skfddi_priv;159 160#endif // _TARGETOS_161