aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pcmcia/cs_internal.h
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2008-10-13 17:12:40 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-10-13 17:12:40 -0400
commit2be4ff2f084842839b041b793ed6237e8d1d315a (patch)
tree1d776ac1717edeff4ee7d59ab0aea2782cb86dba /drivers/pcmcia/cs_internal.h
parentcf2fa66055d718ae13e62451bb546505f63906a2 (diff)
parenta45b3fb19ba1e4dfc3fc53563a072612092930a9 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/brodo/pcmcia-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/brodo/pcmcia-2.6: (49 commits) pcmcia: ioctl-internal definitions pcmcia: cistpl header cleanup pcmcia: remove unused argument to pcmcia_parse_tuple() pcmcia: card services header cleanup pcmcia: device_id header cleanup pcmcia: encapsulate ioaddr_t pcmcia: cleanup device driver header file pcmcia: cleanup socket services header file pcmcia: merge ds_internal.h into cs_internal.h pcmcia: cleanup cs_internal.h pcmcia: cs_internal.h is internal pcmcia: use dev_printk for cs_error() pcmcia: remove CS_ error codes alltogether pcmcia: deprecate CS_BAD_TUPLE pcmcia: deprecate CS_BAD_ARGS pcmcia: deprecate CS_BAD_BASE, CS_BAD_IRQ, CS_BAD_OFFSET and CS_BAD_SIZE pcmcia: deprecate CS_BAD_ATTRIBUTE, CS_BAD_TYPE and CS_BAD_PAGE pcmcia: deprecate CS_NO_MORE_ITEMS pcmcia: deprecate CS_IN_USE pcmcia: deprecate CS_CONFIGURATION_LOCKED ... Fix trivial conflict in drivers/pcmcia/ds.c manually
Diffstat (limited to 'drivers/pcmcia/cs_internal.h')
-rw-r--r--drivers/pcmcia/cs_internal.h226
1 files changed, 167 insertions, 59 deletions
diff --git a/drivers/pcmcia/cs_internal.h b/drivers/pcmcia/cs_internal.h
index 63dc1a28bda2..79615e6d540b 100644
--- a/drivers/pcmcia/cs_internal.h
+++ b/drivers/pcmcia/cs_internal.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * cs_internal.h 2 * cs_internal.h -- definitions internal to the PCMCIA core modules
3 * 3 *
4 * This program is free software; you can redistribute it and/or modify 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 5 * it under the terms of the GNU General Public License version 2 as
@@ -10,6 +10,12 @@
10 * are Copyright (C) 1999 David A. Hinds. All Rights Reserved. 10 * are Copyright (C) 1999 David A. Hinds. All Rights Reserved.
11 * 11 *
12 * (C) 1999 David A. Hinds 12 * (C) 1999 David A. Hinds
13 * (C) 2003 - 2008 Dominik Brodowski
14 *
15 *
16 * This file contains definitions _only_ needed by the PCMCIA core modules.
17 * It must not be included by PCMCIA socket drivers or by PCMCIA device
18 * drivers.
13 */ 19 */
14 20
15#ifndef _LINUX_CS_INTERNAL_H 21#ifndef _LINUX_CS_INTERNAL_H
@@ -18,29 +24,24 @@
18#include <linux/kref.h> 24#include <linux/kref.h>
19 25
20/* Flags in client state */ 26/* Flags in client state */
21#define CLIENT_CONFIG_LOCKED 0x0001
22#define CLIENT_IRQ_REQ 0x0002
23#define CLIENT_IO_REQ 0x0004
24#define CLIENT_UNBOUND 0x0008
25#define CLIENT_STALE 0x0010
26#define CLIENT_WIN_REQ(i) (0x1<<(i)) 27#define CLIENT_WIN_REQ(i) (0x1<<(i))
27#define CLIENT_CARDBUS 0x8000
28 28
29/* Each card function gets one of these guys */ 29/* Each card function gets one of these guys */
30typedef struct config_t { 30typedef struct config_t {
31 struct kref ref; 31 struct kref ref;
32 u_int state; 32 unsigned int state;
33 u_int Attributes; 33 unsigned int Attributes;
34 u_int IntType; 34 unsigned int IntType;
35 u_int ConfigBase; 35 unsigned int ConfigBase;
36 u_char Status, Pin, Copy, Option, ExtStatus; 36 unsigned char Status, Pin, Copy, Option, ExtStatus;
37 u_int CardValues; 37 unsigned int CardValues;
38 io_req_t io; 38 io_req_t io;
39 struct { 39 struct {
40 u_int Attributes; 40 u_int Attributes;
41 } irq; 41 } irq;
42} config_t; 42} config_t;
43 43
44
44struct cis_cache_entry { 45struct cis_cache_entry {
45 struct list_head node; 46 struct list_head node;
46 unsigned int addr; 47 unsigned int addr;
@@ -49,6 +50,30 @@ struct cis_cache_entry {
49 unsigned char cache[0]; 50 unsigned char cache[0];
50}; 51};
51 52
53struct pccard_resource_ops {
54 int (*validate_mem) (struct pcmcia_socket *s);
55 int (*adjust_io_region) (struct resource *res,
56 unsigned long r_start,
57 unsigned long r_end,
58 struct pcmcia_socket *s);
59 struct resource* (*find_io) (unsigned long base, int num,
60 unsigned long align,
61 struct pcmcia_socket *s);
62 struct resource* (*find_mem) (unsigned long base, unsigned long num,
63 unsigned long align, int low,
64 struct pcmcia_socket *s);
65 int (*add_io) (struct pcmcia_socket *s,
66 unsigned int action,
67 unsigned long r_start,
68 unsigned long r_end);
69 int (*add_mem) (struct pcmcia_socket *s,
70 unsigned int action,
71 unsigned long r_start,
72 unsigned long r_end);
73 int (*init) (struct pcmcia_socket *s);
74 void (*exit) (struct pcmcia_socket *s);
75};
76
52/* Flags in config state */ 77/* Flags in config state */
53#define CONFIG_LOCKED 0x01 78#define CONFIG_LOCKED 0x01
54#define CONFIG_IRQ_REQ 0x02 79#define CONFIG_IRQ_REQ 0x02
@@ -59,7 +84,6 @@ struct cis_cache_entry {
59#define SOCKET_INUSE 0x0010 84#define SOCKET_INUSE 0x0010
60#define SOCKET_SUSPEND 0x0080 85#define SOCKET_SUSPEND 0x0080
61#define SOCKET_WIN_REQ(i) (0x0100<<(i)) 86#define SOCKET_WIN_REQ(i) (0x0100<<(i))
62#define SOCKET_REGION_INFO 0x4000
63#define SOCKET_CARDBUS 0x8000 87#define SOCKET_CARDBUS 0x8000
64#define SOCKET_CARDBUS_CONFIG 0x10000 88#define SOCKET_CARDBUS_CONFIG 0x10000
65 89
@@ -83,69 +107,153 @@ static inline void cs_socket_put(struct pcmcia_socket *skt)
83 } 107 }
84} 108}
85 109
86/* In cardbus.c */ 110#ifdef CONFIG_PCMCIA_DEBUG
87int cb_alloc(struct pcmcia_socket *s); 111extern int cs_debug_level(int);
88void cb_free(struct pcmcia_socket *s);
89int read_cb_mem(struct pcmcia_socket *s, int space, u_int addr, u_int len, void *ptr);
90 112
91/* In cistpl.c */ 113#define cs_dbg(skt, lvl, fmt, arg...) do { \
92int pcmcia_read_cis_mem(struct pcmcia_socket *s, int attr, 114 if (cs_debug_level(lvl)) \
93 u_int addr, u_int len, void *ptr); 115 dev_printk(KERN_DEBUG, &skt->dev, \
94void pcmcia_write_cis_mem(struct pcmcia_socket *s, int attr, 116 "cs: " fmt, ## arg); \
95 u_int addr, u_int len, void *ptr); 117} while (0)
96void release_cis_mem(struct pcmcia_socket *s); 118#define __cs_dbg(lvl, fmt, arg...) do { \
97void destroy_cis_cache(struct pcmcia_socket *s); 119 if (cs_debug_level(lvl)) \
120 printk(KERN_DEBUG \
121 "cs: " fmt, ## arg); \
122} while (0)
123
124#else
125#define cs_dbg(skt, lvl, fmt, arg...) do { } while (0)
126#define __cs_dbg(lvl, fmt, arg...) do { } while (0)
127#endif
128
129#define cs_err(skt, fmt, arg...) \
130 dev_printk(KERN_ERR, &skt->dev, "cs: " fmt, ## arg)
131
132
133/*
134 * Stuff internal to module "pcmcia_core":
135 */
136
137/* cistpl.c */
98int verify_cis_cache(struct pcmcia_socket *s); 138int verify_cis_cache(struct pcmcia_socket *s);
99int pccard_read_tuple(struct pcmcia_socket *s, unsigned int function, cisdata_t code, void *parse);
100 139
101/* In rsrc_mgr */ 140/* rsrc_mgr.c */
102int pcmcia_validate_mem(struct pcmcia_socket *s);
103struct resource *pcmcia_find_io_region(unsigned long base, int num, unsigned long align,
104 struct pcmcia_socket *s);
105int pcmcia_adjust_io_region(struct resource *res, unsigned long r_start,
106 unsigned long r_end, struct pcmcia_socket *s);
107struct resource *pcmcia_find_mem_region(u_long base, u_long num, u_long align,
108 int low, struct pcmcia_socket *s);
109void release_resource_db(struct pcmcia_socket *s); 141void release_resource_db(struct pcmcia_socket *s);
110 142
111/* In socket_sysfs.c */ 143/* socket_sysfs.c */
112extern int pccard_sysfs_add_socket(struct device *dev); 144extern int pccard_sysfs_add_socket(struct device *dev);
113extern void pccard_sysfs_remove_socket(struct device *dev); 145extern void pccard_sysfs_remove_socket(struct device *dev);
114 146
115/* In cs.c */ 147/* cardbus.c */
116extern struct rw_semaphore pcmcia_socket_list_rwsem; 148int cb_alloc(struct pcmcia_socket *s);
117extern struct list_head pcmcia_socket_list; 149void cb_free(struct pcmcia_socket *s);
118int pcmcia_get_window(struct pcmcia_socket *s, window_handle_t *handle, int idx, win_req_t *req); 150int read_cb_mem(struct pcmcia_socket *s, int space, u_int addr, u_int len,
119int pccard_get_configuration_info(struct pcmcia_socket *s, struct pcmcia_device *p_dev, config_info_t *config); 151 void *ptr);
120int pccard_reset_card(struct pcmcia_socket *skt); 152
121 153
122 154
155/*
156 * Stuff exported by module "pcmcia_core" to module "pcmcia"
157 */
158
123struct pcmcia_callback{ 159struct pcmcia_callback{
124 struct module *owner; 160 struct module *owner;
125 int (*event) (struct pcmcia_socket *s, event_t event, int priority); 161 int (*event) (struct pcmcia_socket *s,
162 event_t event, int priority);
126 void (*requery) (struct pcmcia_socket *s, int new_cis); 163 void (*requery) (struct pcmcia_socket *s, int new_cis);
127 int (*suspend) (struct pcmcia_socket *s); 164 int (*suspend) (struct pcmcia_socket *s);
128 int (*resume) (struct pcmcia_socket *s); 165 int (*resume) (struct pcmcia_socket *s);
129}; 166};
130 167
168/* cs.c */
169extern struct rw_semaphore pcmcia_socket_list_rwsem;
170extern struct list_head pcmcia_socket_list;
171extern struct class pcmcia_socket_class;
172
173int pcmcia_get_window(struct pcmcia_socket *s,
174 window_handle_t *handle,
175 int idx,
176 win_req_t *req);
131int pccard_register_pcmcia(struct pcmcia_socket *s, struct pcmcia_callback *c); 177int pccard_register_pcmcia(struct pcmcia_socket *s, struct pcmcia_callback *c);
178struct pcmcia_socket *pcmcia_get_socket_by_nr(unsigned int nr);
132 179
133#define cs_socket_name(skt) ((skt)->dev.bus_id) 180int pcmcia_suspend_card(struct pcmcia_socket *skt);
181int pcmcia_resume_card(struct pcmcia_socket *skt);
134 182
135#ifdef DEBUG 183int pcmcia_eject_card(struct pcmcia_socket *skt);
136extern int cs_debug_level(int); 184int pcmcia_insert_card(struct pcmcia_socket *skt);
137 185
138#define cs_dbg(skt, lvl, fmt, arg...) do { \ 186struct pcmcia_socket *pcmcia_get_socket(struct pcmcia_socket *skt);
139 if (cs_debug_level(lvl)) \ 187void pcmcia_put_socket(struct pcmcia_socket *skt);
140 printk(KERN_DEBUG "cs: %s: " fmt, \
141 cs_socket_name(skt) , ## arg); \
142} while (0)
143 188
144#else 189/* cistpl.c */
145#define cs_dbg(skt, lvl, fmt, arg...) do { } while (0) 190int pcmcia_read_cis_mem(struct pcmcia_socket *s, int attr,
146#endif 191 u_int addr, u_int len, void *ptr);
192void pcmcia_write_cis_mem(struct pcmcia_socket *s, int attr,
193 u_int addr, u_int len, void *ptr);
194void release_cis_mem(struct pcmcia_socket *s);
195void destroy_cis_cache(struct pcmcia_socket *s);
196int pccard_read_tuple(struct pcmcia_socket *s, unsigned int function,
197 cisdata_t code, void *parse);
198int pcmcia_replace_cis(struct pcmcia_socket *s,
199 const u8 *data, const size_t len);
200int pccard_validate_cis(struct pcmcia_socket *s, unsigned int function,
201 unsigned int *count);
147 202
148#define cs_err(skt, fmt, arg...) \ 203/* rsrc_mgr.c */
149 printk(KERN_ERR "cs: %s: " fmt, (skt)->dev.bus_id , ## arg) 204int pcmcia_validate_mem(struct pcmcia_socket *s);
205struct resource *pcmcia_find_io_region(unsigned long base,
206 int num,
207 unsigned long align,
208 struct pcmcia_socket *s);
209int pcmcia_adjust_io_region(struct resource *res,
210 unsigned long r_start,
211 unsigned long r_end,
212 struct pcmcia_socket *s);
213struct resource *pcmcia_find_mem_region(u_long base,
214 u_long num,
215 u_long align,
216 int low,
217 struct pcmcia_socket *s);
218
219/*
220 * Stuff internal to module "pcmcia".
221 */
222/* ds.c */
223extern struct bus_type pcmcia_bus_type;
224
225/* pcmcia_resource.c */
226extern int pcmcia_release_configuration(struct pcmcia_device *p_dev);
227
228#ifdef CONFIG_PCMCIA_IOCTL
229/* ds.c */
230extern spinlock_t pcmcia_dev_list_lock;
231
232extern struct pcmcia_device *pcmcia_get_dev(struct pcmcia_device *p_dev);
233extern void pcmcia_put_dev(struct pcmcia_device *p_dev);
234
235struct pcmcia_device *pcmcia_device_add(struct pcmcia_socket *s,
236 unsigned int function);
237
238/* pcmcia_ioctl.c */
239extern void __init pcmcia_setup_ioctl(void);
240extern void __exit pcmcia_cleanup_ioctl(void);
241extern void handle_event(struct pcmcia_socket *s, event_t event);
242extern int handle_request(struct pcmcia_socket *s, event_t event);
243
244#else /* CONFIG_PCMCIA_IOCTL */
245
246static inline void __init pcmcia_setup_ioctl(void) { return; }
247static inline void __exit pcmcia_cleanup_ioctl(void) { return; }
248static inline void handle_event(struct pcmcia_socket *s, event_t event)
249{
250 return;
251}
252static inline int handle_request(struct pcmcia_socket *s, event_t event)
253{
254 return 0;
255}
256
257#endif /* CONFIG_PCMCIA_IOCTL */
150 258
151#endif /* _LINUX_CS_INTERNAL_H */ 259#endif /* _LINUX_CS_INTERNAL_H */