aboutsummaryrefslogtreecommitdiffstats
path: root/include/pcmcia/ss.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/pcmcia/ss.h')
-rw-r--r--include/pcmcia/ss.h75
1 files changed, 32 insertions, 43 deletions
diff --git a/include/pcmcia/ss.h b/include/pcmcia/ss.h
index e0f6feb8588c..344705cb42f4 100644
--- a/include/pcmcia/ss.h
+++ b/include/pcmcia/ss.h
@@ -107,15 +107,6 @@ typedef struct io_window_t {
107 struct resource *res; 107 struct resource *res;
108} io_window_t; 108} io_window_t;
109 109
110#define WINDOW_MAGIC 0xB35C
111typedef struct window_t {
112 u_short magic;
113 u_short index;
114 struct pcmcia_device *handle;
115 struct pcmcia_socket *sock;
116 pccard_mem_map ctl;
117} window_t;
118
119/* Maximum number of IO windows per socket */ 110/* Maximum number of IO windows per socket */
120#define MAX_IO_WIN 2 111#define MAX_IO_WIN 2
121 112
@@ -143,9 +134,9 @@ struct pccard_operations {
143 134
144struct pcmcia_socket { 135struct pcmcia_socket {
145 struct module *owner; 136 struct module *owner;
146 spinlock_t lock;
147 socket_state_t socket; 137 socket_state_t socket;
148 u_int state; 138 u_int state;
139 u_int suspended_state; /* state before suspend */
149 u_short functions; 140 u_short functions;
150 u_short lock_count; 141 u_short lock_count;
151 pccard_mem_map cis_mem; 142 pccard_mem_map cis_mem;
@@ -155,7 +146,7 @@ struct pcmcia_socket {
155 u_int Config; 146 u_int Config;
156 } irq; 147 } irq;
157 io_window_t io[MAX_IO_WIN]; 148 io_window_t io[MAX_IO_WIN];
158 window_t win[MAX_WIN]; 149 pccard_mem_map win[MAX_WIN];
159 struct list_head cis_cache; 150 struct list_head cis_cache;
160 size_t fake_cis_len; 151 size_t fake_cis_len;
161 u8 *fake_cis; 152 u8 *fake_cis;
@@ -163,7 +154,7 @@ struct pcmcia_socket {
163 struct list_head socket_list; 154 struct list_head socket_list;
164 struct completion socket_released; 155 struct completion socket_released;
165 156
166 /* deprecated */ 157 /* deprecated */
167 unsigned int sock; /* socket number */ 158 unsigned int sock; /* socket number */
168 159
169 160
@@ -172,8 +163,8 @@ struct pcmcia_socket {
172 u_int irq_mask; 163 u_int irq_mask;
173 u_int map_size; 164 u_int map_size;
174 u_int io_offset; 165 u_int io_offset;
175 u_char pci_irq; 166 u_int pci_irq;
176 struct pci_dev * cb_dev; 167 struct pci_dev *cb_dev;
177 168
178 169
179 /* socket setup is done so resources should be able to be allocated. 170 /* socket setup is done so resources should be able to be allocated.
@@ -188,9 +179,9 @@ struct pcmcia_socket {
188 u8 reserved:5; 179 u8 reserved:5;
189 180
190 /* socket operations */ 181 /* socket operations */
191 struct pccard_operations * ops; 182 struct pccard_operations *ops;
192 struct pccard_resource_ops * resource_ops; 183 struct pccard_resource_ops *resource_ops;
193 void * resource_data; 184 void *resource_data;
194 185
195 /* Zoom video behaviour is so chip specific its not worth adding 186 /* Zoom video behaviour is so chip specific its not worth adding
196 this to _ops */ 187 this to _ops */
@@ -209,9 +200,14 @@ struct pcmcia_socket {
209 struct task_struct *thread; 200 struct task_struct *thread;
210 struct completion thread_done; 201 struct completion thread_done;
211 unsigned int thread_events; 202 unsigned int thread_events;
212 /* protects socket h/w state */ 203 unsigned int sysfs_events;
204
205 /* For the non-trivial interaction between these locks,
206 * see Documentation/pcmcia/locking.txt */
213 struct mutex skt_mutex; 207 struct mutex skt_mutex;
214 /* protects thread_events */ 208 struct mutex ops_mutex;
209
210 /* protects thread_events and sysfs_events */
215 spinlock_t thread_lock; 211 spinlock_t thread_lock;
216 212
217 /* pcmcia (16-bit) */ 213 /* pcmcia (16-bit) */
@@ -228,23 +224,16 @@ struct pcmcia_socket {
228 224
229 /* 16-bit state: */ 225 /* 16-bit state: */
230 struct { 226 struct {
231 /* PCMCIA card is present in socket */
232 u8 present:1;
233 /* "master" ioctl is used */ 227 /* "master" ioctl is used */
234 u8 busy:1; 228 u8 busy:1;
235 /* pcmcia module is being unloaded */ 229 /* the PCMCIA card consists of two pseudo devices */
236 u8 dead:1; 230 u8 has_pfc:1;
237 /* a multifunction-device add event is pending */
238 u8 device_add_pending:1;
239 /* the pending event adds a mfc (1) or pfc (0) */
240 u8 mfc_pfc:1;
241
242 u8 reserved:3;
243 } pcmcia_state;
244 231
232 u8 reserved:6;
233 } pcmcia_state;
245 234
246 /* for adding further pseudo-multifunction devices */ 235 /* non-zero if PCMCIA card is present */
247 struct work_struct device_add; 236 atomic_t present;
248 237
249#ifdef CONFIG_PCMCIA_IOCTL 238#ifdef CONFIG_PCMCIA_IOCTL
250 struct user_info_t *user; 239 struct user_info_t *user;
@@ -252,12 +241,6 @@ struct pcmcia_socket {
252#endif /* CONFIG_PCMCIA_IOCTL */ 241#endif /* CONFIG_PCMCIA_IOCTL */
253#endif /* CONFIG_PCMCIA */ 242#endif /* CONFIG_PCMCIA */
254 243
255 /* cardbus (32-bit) */
256#ifdef CONFIG_CARDBUS
257 struct resource * cb_cis_res;
258 void __iomem *cb_cis_virt;
259#endif /* CONFIG_CARDBUS */
260
261 /* socket device */ 244 /* socket device */
262 struct device dev; 245 struct device dev;
263 /* data internal to the socket driver */ 246 /* data internal to the socket driver */
@@ -272,19 +255,25 @@ struct pcmcia_socket {
272 * - pccard_static_ops iomem and ioport areas are assigned statically 255 * - pccard_static_ops iomem and ioport areas are assigned statically
273 * - pccard_iodyn_ops iomem areas is assigned statically, ioport 256 * - pccard_iodyn_ops iomem areas is assigned statically, ioport
274 * areas dynamically 257 * areas dynamically
258 * If this option is selected, use
259 * "select PCCARD_IODYN" in Kconfig.
275 * - pccard_nonstatic_ops iomem and ioport areas are assigned dynamically. 260 * - pccard_nonstatic_ops iomem and ioport areas are assigned dynamically.
276 * If this option is selected, use 261 * If this option is selected, use
277 * "select PCCARD_NONSTATIC" in Kconfig. 262 * "select PCCARD_NONSTATIC" in Kconfig.
263 *
278 */ 264 */
279extern struct pccard_resource_ops pccard_static_ops; 265extern struct pccard_resource_ops pccard_static_ops;
266#if defined(CONFIG_PCMCIA) || defined(CONFIG_PCMCIA_MODULE)
280extern struct pccard_resource_ops pccard_iodyn_ops; 267extern struct pccard_resource_ops pccard_iodyn_ops;
281extern struct pccard_resource_ops pccard_nonstatic_ops; 268extern struct pccard_resource_ops pccard_nonstatic_ops;
269#else
270/* If PCMCIA is not used, but only CARDBUS, these functions are not used
271 * at all. Therefore, do not use the large (240K!) rsrc_nonstatic module
272 */
273#define pccard_iodyn_ops pccard_static_ops
274#define pccard_nonstatic_ops pccard_static_ops
275#endif
282 276
283/* socket drivers are expected to use these callbacks in their .drv struct */
284extern int pcmcia_socket_dev_suspend(struct device *dev);
285extern void pcmcia_socket_dev_early_resume(struct device *dev);
286extern void pcmcia_socket_dev_late_resume(struct device *dev);
287extern int pcmcia_socket_dev_resume(struct device *dev);
288 277
289/* socket drivers use this callback in their IRQ handler */ 278/* socket drivers use this callback in their IRQ handler */
290extern void pcmcia_parse_events(struct pcmcia_socket *socket, 279extern void pcmcia_parse_events(struct pcmcia_socket *socket,