pcmcia: re-work pcmcia_request_irq()
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / include / pcmcia / cs.h
bloba04e6caa585ae6296c7ba9213796024c8789cf18
1 /*
2 * cs.h
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
8 * The initial developer of the original code is David A. Hinds
9 * <dahinds@users.sourceforge.net>. Portions created by David A. Hinds
10 * are Copyright (C) 1999 David A. Hinds. All Rights Reserved.
12 * (C) 1999 David A. Hinds
15 #ifndef _LINUX_CS_H
16 #define _LINUX_CS_H
18 #ifdef __KERNEL__
19 #include <linux/interrupt.h>
20 #endif
22 /* For AccessConfigurationRegister */
23 typedef struct conf_reg_t {
24 u_char Function;
25 u_int Action;
26 off_t Offset;
27 u_int Value;
28 } conf_reg_t;
30 /* Actions */
31 #define CS_READ 1
32 #define CS_WRITE 2
34 /* for AdjustResourceInfo */
35 /* Action field */
36 #define REMOVE_MANAGED_RESOURCE 1
37 #define ADD_MANAGED_RESOURCE 2
40 typedef struct event_callback_args_t {
41 struct pcmcia_device *client_handle;
42 void *client_data;
43 } event_callback_args_t;
45 /* For CardValues field */
46 #define CV_OPTION_VALUE 0x01
47 #define CV_STATUS_VALUE 0x02
48 #define CV_PIN_REPLACEMENT 0x04
49 #define CV_COPY_VALUE 0x08
50 #define CV_EXT_STATUS 0x10
52 /* For GetFirst/NextClient */
53 typedef struct client_req_t {
54 socket_t Socket;
55 u_int Attributes;
56 } client_req_t;
58 #define CLIENT_THIS_SOCKET 0x01
60 /* ModifyConfiguration */
61 typedef struct modconf_t {
62 u_int Attributes;
63 u_int Vcc, Vpp1, Vpp2;
64 } modconf_t;
66 /* Attributes for ModifyConfiguration */
67 #define CONF_IRQ_CHANGE_VALID 0x0100
68 #define CONF_VCC_CHANGE_VALID 0x0200
69 #define CONF_VPP1_CHANGE_VALID 0x0400
70 #define CONF_VPP2_CHANGE_VALID 0x0800
71 #define CONF_IO_CHANGE_WIDTH 0x1000
73 /* For RequestConfiguration */
74 typedef struct config_req_t {
75 u_int Attributes;
76 u_int Vpp; /* both Vpp1 and Vpp2 */
77 u_int IntType;
78 u_int ConfigBase;
79 u_char Status, Pin, Copy, ExtStatus;
80 u_char ConfigIndex;
81 u_int Present;
82 } config_req_t;
84 /* Attributes for RequestConfiguration */
85 #define CONF_ENABLE_IRQ 0x01
86 #define CONF_ENABLE_DMA 0x02
87 #define CONF_ENABLE_SPKR 0x04
88 #define CONF_ENABLE_PULSE_IRQ 0x08
89 #define CONF_VALID_CLIENT 0x100
91 /* IntType field */
92 #define INT_MEMORY 0x01
93 #define INT_MEMORY_AND_IO 0x02
94 #define INT_CARDBUS 0x04
95 #define INT_ZOOMED_VIDEO 0x08
97 /* For RequestIO and ReleaseIO */
98 typedef struct io_req_t {
99 u_int BasePort1;
100 u_int NumPorts1;
101 u_int Attributes1;
102 u_int BasePort2;
103 u_int NumPorts2;
104 u_int Attributes2;
105 u_int IOAddrLines;
106 } io_req_t;
108 /* Attributes for RequestIO and ReleaseIO */
109 #define IO_SHARED 0x01
110 #define IO_FIRST_SHARED 0x02
111 #define IO_FORCE_ALIAS_ACCESS 0x04
112 #define IO_DATA_PATH_WIDTH 0x18
113 #define IO_DATA_PATH_WIDTH_8 0x00
114 #define IO_DATA_PATH_WIDTH_16 0x08
115 #define IO_DATA_PATH_WIDTH_AUTO 0x10
117 /* Attributes for RequestIRQ and ReleaseIRQ */
118 #define IRQ_TYPE 0x03
119 #define IRQ_TYPE_EXCLUSIVE 0x00
120 #define IRQ_TYPE_TIME 0x01
121 #define IRQ_TYPE_DYNAMIC_SHARING 0x02
122 #define IRQ_FORCED_PULSE 0x04
123 #define IRQ_FIRST_SHARED 0x08 /* unused */
124 #define IRQ_HANDLE_PRESENT 0x10 /* unused */
125 #define IRQ_PULSE_ALLOCATED 0x100
127 /* Bits in IRQInfo1 field */
128 #define IRQ_MASK 0x0f
129 #define IRQ_NMI_ID 0x01
130 #define IRQ_IOCK_ID 0x02
131 #define IRQ_BERR_ID 0x04
132 #define IRQ_VEND_ID 0x08
133 #define IRQ_INFO2_VALID 0x10
134 #define IRQ_LEVEL_ID 0x20
135 #define IRQ_PULSE_ID 0x40
136 #define IRQ_SHARE_ID 0x80
138 typedef struct eventmask_t {
139 u_int Attributes;
140 u_int EventMask;
141 } eventmask_t;
143 #define CONF_EVENT_MASK_VALID 0x01
145 /* Configuration registers present */
146 #define PRESENT_OPTION 0x001
147 #define PRESENT_STATUS 0x002
148 #define PRESENT_PIN_REPLACE 0x004
149 #define PRESENT_COPY 0x008
150 #define PRESENT_EXT_STATUS 0x010
151 #define PRESENT_IOBASE_0 0x020
152 #define PRESENT_IOBASE_1 0x040
153 #define PRESENT_IOBASE_2 0x080
154 #define PRESENT_IOBASE_3 0x100
155 #define PRESENT_IOSIZE 0x200
157 /* For GetMemPage, MapMemPage */
158 typedef struct memreq_t {
159 u_int CardOffset;
160 page_t Page;
161 } memreq_t;
163 /* For ModifyWindow */
164 typedef struct modwin_t {
165 u_int Attributes;
166 u_int AccessSpeed;
167 } modwin_t;
169 /* For RequestWindow */
170 typedef struct win_req_t {
171 u_int Attributes;
172 u_long Base;
173 u_int Size;
174 u_int AccessSpeed;
175 } win_req_t;
177 /* Attributes for RequestWindow */
178 #define WIN_ADDR_SPACE 0x0001
179 #define WIN_ADDR_SPACE_MEM 0x0000
180 #define WIN_ADDR_SPACE_IO 0x0001
181 #define WIN_MEMORY_TYPE 0x0002
182 #define WIN_MEMORY_TYPE_CM 0x0000
183 #define WIN_MEMORY_TYPE_AM 0x0002
184 #define WIN_ENABLE 0x0004
185 #define WIN_DATA_WIDTH 0x0018
186 #define WIN_DATA_WIDTH_8 0x0000
187 #define WIN_DATA_WIDTH_16 0x0008
188 #define WIN_DATA_WIDTH_32 0x0010
189 #define WIN_PAGED 0x0020
190 #define WIN_SHARED 0x0040
191 #define WIN_FIRST_SHARED 0x0080
192 #define WIN_USE_WAIT 0x0100
193 #define WIN_STRICT_ALIGN 0x0200
194 #define WIN_MAP_BELOW_1MB 0x0400
195 #define WIN_PREFETCH 0x0800
196 #define WIN_CACHEABLE 0x1000
197 #define WIN_BAR_MASK 0xe000
198 #define WIN_BAR_SHIFT 13
200 typedef struct error_info_t {
201 int func;
202 int retcode;
203 } error_info_t;
205 /* Flag to bind to all functions */
206 #define BIND_FN_ALL 0xff
208 /* Events */
209 #define CS_EVENT_PRI_LOW 0
210 #define CS_EVENT_PRI_HIGH 1
212 #define CS_EVENT_WRITE_PROTECT 0x000001
213 #define CS_EVENT_CARD_LOCK 0x000002
214 #define CS_EVENT_CARD_INSERTION 0x000004
215 #define CS_EVENT_CARD_REMOVAL 0x000008
216 #define CS_EVENT_BATTERY_DEAD 0x000010
217 #define CS_EVENT_BATTERY_LOW 0x000020
218 #define CS_EVENT_READY_CHANGE 0x000040
219 #define CS_EVENT_CARD_DETECT 0x000080
220 #define CS_EVENT_RESET_REQUEST 0x000100
221 #define CS_EVENT_RESET_PHYSICAL 0x000200
222 #define CS_EVENT_CARD_RESET 0x000400
223 #define CS_EVENT_REGISTRATION_COMPLETE 0x000800
224 #define CS_EVENT_PM_SUSPEND 0x002000
225 #define CS_EVENT_PM_RESUME 0x004000
226 #define CS_EVENT_INSERTION_REQUEST 0x008000
227 #define CS_EVENT_EJECTION_REQUEST 0x010000
228 #define CS_EVENT_MTD_REQUEST 0x020000
229 #define CS_EVENT_ERASE_COMPLETE 0x040000
230 #define CS_EVENT_REQUEST_ATTENTION 0x080000
231 #define CS_EVENT_CB_DETECT 0x100000
232 #define CS_EVENT_3VCARD 0x200000
233 #define CS_EVENT_XVCARD 0x400000
235 #endif /* _LINUX_CS_H */