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