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 and
13 *	hardware module.
14 */
15
16#ifndef	TARGETOS_H
17#define TARGETOS_H
18
19
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
25
26
27//-------- those should go into include/linux/if_fddi.h
28#define FDDI_MAC_HDR_LEN 13
29
30#define FDDI_RII	0x01 /* routing information bit */
31#define FDDI_RCF_DIR_BIT 0x80
32#define FDDI_RCF_LEN_MASK 0x1f
33#define FDDI_RCF_BROADCAST 0x8000
34#define FDDI_RCF_LIMITED_BROADCAST 0xA000
35#define FDDI_RCF_FRAME2K 0x20
36#define FDDI_RCF_FRAME4K 0x30
37//--------
38
39
40#undef ADDR
41
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 definition
49#undef ADDR
50#ifdef MEM_MAPPED_IO
51#define	ADDR(a) (smc->hw.iop+(a))
52#else
53#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#endif
55
56#include "hwmtm.h"
57
58#define TRUE  1
59#define FALSE 0
60
61// HWM Definitions
62// -----------------------
63#define FDDI_TRACE(string, arg1, arg2, arg3)	// Performance analysis.
64#ifdef PCI
65#define NDD_TRACE(string, arg1, arg2, arg3)	// Performance analysis.
66#endif	// PCI
67#define SMT_PAGESIZE	PAGE_SIZE	// Size of a memory page (power of 2).
68// -----------------------
69
70
71// SMT Definitions
72// -----------------------
73#define	TICKS_PER_SECOND	HZ
74#define SMC_VERSION    		1
75// -----------------------
76
77
78// OS-Driver Definitions
79// -----------------------
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		0
84#define SK_BUS_TYPE_EISA	1
85
86#define FP_IO_LEN		256	/* length of IO area used */
87
88#define u8	unsigned char
89#define u16	unsigned short
90#define u32	unsigned int
91
92#define MAX_TX_QUEUE_LEN	20 // number of packets queued by driver
93#define MAX_FRAME_SIZE		4550
94
95#define	RX_LOW_WATERMARK	NUM_RECEIVE_BUFFERS  / 2
96#define TX_LOW_WATERMARK	NUM_TRANSMIT_BUFFERS - 2
97
98/*
99** Include the IOCTL stuff
100*/
101#include <linux/sockios.h>
102
103#define	SKFPIOCTL	SIOCDEVPRIVATE
104
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 structure
118struct 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 structure
138	struct fddi_statistics MacStat;
139
140	// receive into this local buffer if no skb available
141	// data will be not valid, because multiple RxDs can
142	// point here at the same time, it must be at least
143	// MAX_FRAME_SIZE bytes in size
144	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-savety
154	spinlock_t DriverLock;
155
156};
157
158typedef struct s_smt_os skfddi_priv;
159
160#endif	 // _TARGETOS_
161