PageRenderTime 32ms CodeModel.GetById 24ms app.highlight 5ms RepoModel.GetById 0ms app.codeStats 0ms

/drivers/char/rio/rio.h

https://bitbucket.org/cresqo/cm7-p500-kernel
C Header | 208 lines | 88 code | 38 blank | 82 comment | 0 complexity | 18142e2e309b645e6cd2f964ece5c525 MD5 | raw file
Possible License(s): LGPL-2.0, AGPL-1.0, GPL-2.0
  1/*
  2** -----------------------------------------------------------------------------
  3**
  4**  Perle Specialix driver for Linux
  5**  Ported from existing RIO Driver for SCO sources.
  6 *
  7 *  (C) 1990 - 1998 Specialix International Ltd., Byfleet, Surrey, UK.
  8 *
  9 *      This program is free software; you can redistribute it and/or modify
 10 *      it under the terms of the GNU General Public License as published by
 11 *      the Free Software Foundation; either version 2 of the License, or
 12 *      (at your option) any later version.
 13 *
 14 *      This program is distributed in the hope that it will be useful,
 15 *      but WITHOUT ANY WARRANTY; without even the implied warranty of
 16 *      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 17 *      GNU General Public License for more details.
 18 *
 19 *      You should have received a copy of the GNU General Public License
 20 *      along with this program; if not, write to the Free Software
 21 *      Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 22**
 23**	Module		: rio.h
 24**	SID		: 1.3
 25**	Last Modified	: 11/6/98 11:34:13
 26**	Retrieved	: 11/6/98 11:34:22
 27**
 28**  ident @(#)rio.h	1.3
 29**
 30** -----------------------------------------------------------------------------
 31*/
 32
 33#ifndef	__rio_rio_h__
 34#define	__rio_rio_h__
 35
 36/*
 37**	Maximum numbers of things
 38*/
 39#define	RIO_SLOTS	4	/* number of configuration slots */
 40#define	RIO_HOSTS	4	/* number of hosts that can be found */
 41#define	PORTS_PER_HOST	128	/* number of ports per host */
 42#define	LINKS_PER_UNIT	4	/* number of links from a host */
 43#define	RIO_PORTS	(PORTS_PER_HOST * RIO_HOSTS)	/* max. no. of ports */
 44#define	RTAS_PER_HOST	(MAX_RUP)	/* number of RTAs per host */
 45#define	PORTS_PER_RTA	(PORTS_PER_HOST/RTAS_PER_HOST)	/* ports on a rta */
 46#define	PORTS_PER_MODULE 4	/* number of ports on a plug-in module */
 47				/* number of modules on an RTA */
 48#define	MODULES_PER_RTA	 (PORTS_PER_RTA/PORTS_PER_MODULE)
 49#define MAX_PRODUCT	16	/* numbr of different product codes */
 50#define MAX_MODULE_TYPES 16	/* number of different types of module */
 51
 52#define RIO_CONTROL_DEV	128	/* minor number of host/control device */
 53#define RIO_INVALID_MAJOR 0	/* test first host card's major no for validity */
 54
 55/*
 56** number of RTAs that can be bound to a master
 57*/
 58#define MAX_RTA_BINDINGS (MAX_RUP * RIO_HOSTS)
 59
 60/*
 61**	Unit types
 62*/
 63#define PC_RTA16	0x90000000
 64#define PC_RTA8		0xe0000000
 65#define TYPE_HOST	0
 66#define TYPE_RTA8	1
 67#define TYPE_RTA16	2
 68
 69/*
 70**	Flag values returned by functions
 71*/
 72
 73#define	RIO_FAIL	-1
 74
 75/*
 76** SysPort value for something that hasn't any ports
 77*/
 78#define	NO_PORT	0xFFFFFFFF
 79
 80/*
 81** Unit ID Of all hosts
 82*/
 83#define	HOST_ID	0
 84
 85/*
 86** Break bytes into nybles
 87*/
 88#define	LONYBLE(X)	((X) & 0xF)
 89#define	HINYBLE(X)	(((X)>>4) & 0xF)
 90
 91/*
 92** Flag values passed into some functions
 93*/
 94#define	DONT_SLEEP	0
 95#define	OK_TO_SLEEP	1
 96
 97#define	DONT_PRINT	1
 98#define	DO_PRINT	0
 99
100#define PRINT_TO_LOG_CONS	0
101#define PRINT_TO_CONS	1
102#define PRINT_TO_LOG	2
103
104/*
105** Timeout has trouble with times of less than 3 ticks...
106*/
107#define	MIN_TIMEOUT	3
108
109/*
110**	Generally useful constants
111*/
112
113#define	HUNDRED_MS		((HZ/10)?(HZ/10):1)
114#define	ONE_MEG			0x100000
115#define	SIXTY_FOUR_K		0x10000
116
117#define	RIO_AT_MEM_SIZE		SIXTY_FOUR_K
118#define	RIO_EISA_MEM_SIZE	SIXTY_FOUR_K
119#define	RIO_MCA_MEM_SIZE	SIXTY_FOUR_K
120
121#define	COOK_WELL		0
122#define	COOK_MEDIUM		1
123#define	COOK_RAW		2
124
125/*
126**	Pointer manipulation stuff
127**	RIO_PTR takes hostp->Caddr and the offset into the DP RAM area
128**	and produces a UNIX caddr_t (pointer) to the object
129**	RIO_OBJ takes hostp->Caddr and a UNIX pointer to an object and
130**	returns the offset into the DP RAM area.
131*/
132#define	RIO_PTR(C,O) (((unsigned char __iomem *)(C))+(0xFFFF&(O)))
133#define	RIO_OFF(C,O) ((unsigned char __iomem *)(O)-(unsigned char __iomem *)(C))
134
135/*
136**	How to convert from various different device number formats:
137**	DEV is a dev number, as passed to open, close etc - NOT a minor
138**	number!
139**/
140
141#define	RIO_MODEM_MASK		0x1FF
142#define	RIO_MODEM_BIT		0x200
143#define	RIO_UNMODEM(DEV)	(MINOR(DEV) & RIO_MODEM_MASK)
144#define	RIO_ISMODEM(DEV)	(MINOR(DEV) & RIO_MODEM_BIT)
145#define RIO_PORT(DEV,FIRST_MAJ)	( (MAJOR(DEV) - FIRST_MAJ) * PORTS_PER_HOST) \
146					+ MINOR(DEV)
147#define CSUM(pkt_ptr)  (((u16 *)(pkt_ptr))[0] + ((u16 *)(pkt_ptr))[1] + \
148			((u16 *)(pkt_ptr))[2] + ((u16 *)(pkt_ptr))[3] + \
149			((u16 *)(pkt_ptr))[4] + ((u16 *)(pkt_ptr))[5] + \
150			((u16 *)(pkt_ptr))[6] + ((u16 *)(pkt_ptr))[7] + \
151			((u16 *)(pkt_ptr))[8] + ((u16 *)(pkt_ptr))[9] )
152
153#define	RIO_LINK_ENABLE	0x80FF	/* FF is a hack, mainly for Mips, to        */
154			       /* prevent a really stupid race condition.  */
155
156#define	NOT_INITIALISED	0
157#define	INITIALISED	1
158
159#define	NOT_POLLING	0
160#define	POLLING		1
161
162#define	NOT_CHANGED	0
163#define	CHANGED		1
164
165#define	NOT_INUSE	0
166
167#define	DISCONNECT	0
168#define	CONNECT		1
169
170/* ------ Control Codes ------ */
171
172#define	CONTROL		'^'
173#define IFOAD		( CONTROL + 1 )
174#define	IDENTIFY	( CONTROL + 2 )
175#define	ZOMBIE		( CONTROL + 3 )
176#define	UFOAD		( CONTROL + 4 )
177#define IWAIT		( CONTROL + 5 )
178
179#define	IFOAD_MAGIC	0xF0AD	/* of course */
180#define	ZOMBIE_MAGIC	(~0xDEAD)	/* not dead -> zombie */
181#define	UFOAD_MAGIC	0xD1E	/* kill-your-neighbour */
182#define	IWAIT_MAGIC	0xB1DE	/* Bide your time */
183
184/* ------ Error Codes ------ */
185
186#define E_NO_ERROR                       ((ushort) 0)
187
188/* ------ Free Lists ------ */
189
190struct rio_free_list {
191	u16 next;
192	u16 prev;
193};
194
195/* NULL for card side linked lists */
196#define	TPNULL	((ushort)(0x8000))
197/* We can add another packet to a transmit queue if the packet pointer pointed
198 * to by the TxAdd pointer has PKT_IN_USE clear in its address. */
199#define PKT_IN_USE    0x1
200
201/* ------ Topology ------ */
202
203struct Top {
204	u8 Unit;
205	u8 Link;
206};
207
208#endif				/* __rio_h__ */