1 /* $Id$
2  *
3  * This file is subject to the terms and conditions of the GNU General Public
4  * License.  See the file "COPYING" in the main directory of this archive
5  * for more details.
6  *
7  * Copyright (C) 1992 - 1997, 2000-2003 Silicon Graphics, Inc. All rights reserved.
8  */
9 #ifndef _ASM_IA64_SN_PIO_H
10 #define _ASM_IA64_SN_PIO_H
11 
12 #include <linux/types.h>
13 #include <asm/sn/sgi.h>
14 #include <asm/sn/driver.h>
15 
16 /*
17  * pioaddr_t	- The kernel virtual address that a PIO can be done upon.
18  *		  Should probably be (volatile void*) but EVEREST would do PIO
19  *		  to long mostly, just cast for other sizes.
20  */
21 
22 typedef volatile ulong*	pioaddr_t;
23 
24 /*
25  * iopaddr_t	- the physical io space relative address (e.g. VME A16S 0x0800).
26  * iosapce_t	- specifies the io address space to be mapped/accessed.
27  * piomap_t	- the handle returned by pio_alloc() and used with all the pio
28  *		  access functions.
29  */
30 
31 
32 typedef struct piomap {
33 	uint		pio_bus;
34 	uint		pio_adap;
35 	int		pio_flag;
36 	int		pio_reg;
37 	char		pio_name[7];	/* to identify the mapped device */
38 	struct piomap	*pio_next;	/* dlist to link active piomap's */
39 	struct piomap	*pio_prev;	/* for debug and error reporting */
40 	iopaddr_t	pio_iopmask;	/* valid iop address bit mask */
41 	iobush_t	pio_bushandle;	/* bus-level handle */
42 } piomap_t;
43 
44 #define pio_type	pio_iospace.ios_type
45 #define pio_iopaddr	pio_iospace.ios_iopaddr
46 #define pio_size	pio_iospace.ios_size
47 #define pio_vaddr	pio_iospace.ios_vaddr
48 
49 /* Macro to get/set PIO error function */
50 #define	pio_seterrf(p,f)	(p)->pio_errfunc = (f)
51 #define	pio_geterrf(p)		(p)->pio_errfunc
52 
53 
54 /*
55  * piomap_t type defines
56  */
57 
58 #define PIOMAP_NTYPES	7
59 
60 #define PIOMAP_A16N	VME_A16NP
61 #define PIOMAP_A16S	VME_A16S
62 #define PIOMAP_A24N	VME_A24NP
63 #define PIOMAP_A24S	VME_A24S
64 #define PIOMAP_A32N	VME_A32NP
65 #define PIOMAP_A32S	VME_A32S
66 #define PIOMAP_A64	6
67 
68 #define PIOMAP_EISA_IO	0
69 #define PIOMAP_EISA_MEM	1
70 
71 #define PIOMAP_PCI_IO	0
72 #define PIOMAP_PCI_MEM	1
73 #define PIOMAP_PCI_CFG	2
74 #define PIOMAP_PCI_ID	3
75 
76 /* IBUS piomap types */
77 #define PIOMAP_FCI	0
78 
79 /* dang gio piomap types */
80 
81 #define	PIOMAP_GIO32	0
82 #define	PIOMAP_GIO64	1
83 
84 #define ET_MEM         	0
85 #define ET_IO          	1
86 #define LAN_RAM         2
87 #define LAN_IO          3
88 
89 #define PIOREG_NULL	(-1)
90 
91 /* standard flags values for pio_map routines,
92  * including {xtalk,pciio}_piomap calls.
93  * NOTE: try to keep these in step with DMAMAP flags.
94  */
95 #define PIOMAP_UNFIXED	0x0
96 #define PIOMAP_FIXED	0x1
97 #define PIOMAP_NOSLEEP	0x2
98 #define	PIOMAP_INPLACE	0x4
99 
100 #define	PIOMAP_FLAGS	0x7
101 
102 #endif	/* _ASM_IA64_SN_PIO_H */
103