xref: /openbmc/linux/drivers/net/fddi/skfp/h/targetos.h (revision e23feb16)
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 /*
16  *	Operating system specific definitions for driver and
17  *	hardware module.
18  */
19 
20 #ifndef	TARGETOS_H
21 #define TARGETOS_H
22 
23 
24 //-------- those should go into include/linux/pci.h
25 #define PCI_VENDOR_ID_SK		0x1148
26 #define PCI_DEVICE_ID_SK_FP		0x4000
27 //--------
28 
29 
30 
31 //-------- those should go into include/linux/if_fddi.h
32 #define FDDI_MAC_HDR_LEN 13
33 
34 #define FDDI_RII	0x01 /* routing information bit */
35 #define FDDI_RCF_DIR_BIT 0x80
36 #define FDDI_RCF_LEN_MASK 0x1f
37 #define FDDI_RCF_BROADCAST 0x8000
38 #define FDDI_RCF_LIMITED_BROADCAST 0xA000
39 #define FDDI_RCF_FRAME2K 0x20
40 #define FDDI_RCF_FRAME4K 0x30
41 //--------
42 
43 
44 #undef ADDR
45 
46 #include <asm/io.h>
47 #include <linux/netdevice.h>
48 #include <linux/fddidevice.h>
49 #include <linux/skbuff.h>
50 #include <linux/pci.h>
51 #include <linux/init.h>
52 
53 // is redefined by linux, but we need our definition
54 #undef ADDR
55 #ifdef MEM_MAPPED_IO
56 #define	ADDR(a) (smc->hw.iop+(a))
57 #else
58 #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))))
59 #endif
60 
61 #include "hwmtm.h"
62 
63 #define TRUE  1
64 #define FALSE 0
65 
66 // HWM Definitions
67 // -----------------------
68 #define FDDI_TRACE(string, arg1, arg2, arg3)	// Performance analysis.
69 #ifdef PCI
70 #define NDD_TRACE(string, arg1, arg2, arg3)	// Performance analysis.
71 #endif	// PCI
72 #define SMT_PAGESIZE	PAGE_SIZE	// Size of a memory page (power of 2).
73 // -----------------------
74 
75 
76 // SMT Definitions
77 // -----------------------
78 #define	TICKS_PER_SECOND	HZ
79 #define SMC_VERSION    		1
80 // -----------------------
81 
82 
83 // OS-Driver Definitions
84 // -----------------------
85 #define NO_ADDRESS 0xffe0	/* No Device (I/O) Address */
86 #define SKFP_MAX_NUM_BOARDS 8	/* maximum number of PCI boards */
87 
88 #define SK_BUS_TYPE_PCI		0
89 #define SK_BUS_TYPE_EISA	1
90 
91 #define FP_IO_LEN		256	/* length of IO area used */
92 
93 #define u8	unsigned char
94 #define u16	unsigned short
95 #define u32	unsigned int
96 
97 #define MAX_TX_QUEUE_LEN	20 // number of packets queued by driver
98 #define MAX_FRAME_SIZE		4550
99 
100 #define	RX_LOW_WATERMARK	NUM_RECEIVE_BUFFERS  / 2
101 #define TX_LOW_WATERMARK	NUM_TRANSMIT_BUFFERS - 2
102 
103 /*
104 ** Include the IOCTL stuff
105 */
106 #include <linux/sockios.h>
107 
108 #define	SKFPIOCTL	SIOCDEVPRIVATE
109 
110 struct s_skfp_ioctl {
111 	unsigned short cmd;                /* Command to run */
112 	unsigned short len;                /* Length of the data buffer */
113 	unsigned char __user *data;        /* Pointer to the data buffer */
114 };
115 
116 /*
117 ** Recognised ioctl commands for the driver
118 */
119 #define SKFP_GET_STATS		0x05 /* Get the driver statistics */
120 #define SKFP_CLR_STATS		0x06 /* Zero out the driver statistics */
121 
122 // The per-adapter driver structure
123 struct s_smt_os {
124 	struct net_device *dev;
125 	struct net_device *next_module;
126 	u32	bus_type;		/* bus type (0 == PCI, 1 == EISA) */
127 	struct pci_dev 	pdev;		/* PCI device structure */
128 
129 	unsigned long base_addr;
130 	unsigned char factory_mac_addr[8];
131 	ulong	SharedMemSize;
132 	ulong	SharedMemHeap;
133 	void*	SharedMemAddr;
134 	dma_addr_t SharedMemDMA;
135 
136 	ulong	QueueSkb;
137 	struct	sk_buff_head SendSkbQueue;
138 
139 	ulong	MaxFrameSize;
140 	u8	ResetRequested;
141 
142 	// MAC statistics structure
143 	struct fddi_statistics MacStat;
144 
145 	// receive into this local buffer if no skb available
146 	// data will be not valid, because multiple RxDs can
147 	// point here at the same time, it must be at least
148 	// MAX_FRAME_SIZE bytes in size
149 	unsigned char *LocalRxBuffer;
150 	dma_addr_t LocalRxBufferDMA;
151 
152 	// Version (required by SMT module).
153 	u_long smc_version ;
154 
155 	// Required by Hardware Module (HWM).
156 	struct hw_modul hwm ;
157 
158 	// For SMP-savety
159 	spinlock_t DriverLock;
160 
161 };
162 
163 typedef struct s_smt_os skfddi_priv;
164 
165 #endif	 // _TARGETOS_
166