aboutsummaryrefslogtreecommitdiffstats
path: root/include/pcmcia/ds.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/pcmcia/ds.h')
-rw-r--r--include/pcmcia/ds.h80
1 files changed, 39 insertions, 41 deletions
diff --git a/include/pcmcia/ds.h b/include/pcmcia/ds.h
index 8e2a96396478..8c339f5678cf 100644
--- a/include/pcmcia/ds.h
+++ b/include/pcmcia/ds.h
@@ -39,7 +39,7 @@ typedef struct win_info_t {
39typedef struct bind_info_t { 39typedef struct bind_info_t {
40 dev_info_t dev_info; 40 dev_info_t dev_info;
41 u_char function; 41 u_char function;
42 struct dev_link_t *instance; 42 struct pcmcia_device *instance;
43 char name[DEV_NAME_LEN]; 43 char name[DEV_NAME_LEN];
44 u_short major, minor; 44 u_short major, minor;
45 void *next; 45 void *next;
@@ -96,6 +96,7 @@ typedef union ds_ioctl_arg_t {
96 96
97#ifdef __KERNEL__ 97#ifdef __KERNEL__
98#include <linux/device.h> 98#include <linux/device.h>
99#include <pcmcia/ss.h>
99 100
100typedef struct dev_node_t { 101typedef struct dev_node_t {
101 char dev_name[DEV_NAME_LEN]; 102 char dev_name[DEV_NAME_LEN];
@@ -103,34 +104,9 @@ typedef struct dev_node_t {
103 struct dev_node_t *next; 104 struct dev_node_t *next;
104} dev_node_t; 105} dev_node_t;
105 106
106typedef struct dev_link_t {
107 dev_node_t *dev;
108 u_int state, open;
109 wait_queue_head_t pending;
110 client_handle_t handle;
111 io_req_t io;
112 irq_req_t irq;
113 config_req_t conf;
114 window_handle_t win;
115 void *priv;
116 struct dev_link_t *next;
117} dev_link_t;
118
119/* Flags for device state */
120#define DEV_PRESENT 0x01
121#define DEV_CONFIG 0x02
122#define DEV_STALE_CONFIG 0x04 /* release on close */
123#define DEV_STALE_LINK 0x08 /* detach on release */
124#define DEV_CONFIG_PENDING 0x10
125#define DEV_RELEASE_PENDING 0x20
126#define DEV_SUSPEND 0x40
127#define DEV_BUSY 0x80
128
129#define DEV_OK(l) \
130 ((l) && ((l->state & ~DEV_BUSY) == (DEV_CONFIG|DEV_PRESENT)))
131
132 107
133struct pcmcia_socket; 108struct pcmcia_socket;
109struct config_t;
134 110
135struct pcmcia_driver { 111struct pcmcia_driver {
136 int (*probe) (struct pcmcia_device *dev); 112 int (*probe) (struct pcmcia_device *dev);
@@ -148,6 +124,7 @@ struct pcmcia_driver {
148int pcmcia_register_driver(struct pcmcia_driver *driver); 124int pcmcia_register_driver(struct pcmcia_driver *driver);
149void pcmcia_unregister_driver(struct pcmcia_driver *driver); 125void pcmcia_unregister_driver(struct pcmcia_driver *driver);
150 126
127
151struct pcmcia_device { 128struct pcmcia_device {
152 /* the socket and the device_no [for multifunction devices] 129 /* the socket and the device_no [for multifunction devices]
153 uniquely define a pcmcia_device */ 130 uniquely define a pcmcia_device */
@@ -160,21 +137,40 @@ struct pcmcia_device {
160 /* the hardware "function" device; certain subdevices can 137 /* the hardware "function" device; certain subdevices can
161 * share one hardware "function" device. */ 138 * share one hardware "function" device. */
162 u8 func; 139 u8 func;
140 struct config_t* function_config;
163 141
164 struct list_head socket_device_list; 142 struct list_head socket_device_list;
165 143
166 /* deprecated, a cleaned up version will be moved into this 144 /* deprecated, will be cleaned up soon */
167 struct soon */ 145 dev_node_t *dev_node;
168 dev_link_t *instance; 146 u_int open;
169 u_int state; 147 io_req_t io;
148 irq_req_t irq;
149 config_req_t conf;
150 window_handle_t win;
151
152 /* Is the device suspended, or in the process of
153 * being removed? */
154 u16 suspended:1;
155 u16 _removed:1;
156
157 /* Flags whether io, irq, win configurations were
158 * requested, and whether the configuration is "locked" */
159 u16 _irq:1;
160 u16 _io:1;
161 u16 _win:4;
162 u16 _locked:1;
163
164 /* Flag whether a "fuzzy" func_id based match is
165 * allowed. */
166 u16 allow_func_id_match:1;
170 167
171 /* information about this device */ 168 /* information about this device */
172 u8 has_manf_id:1; 169 u16 has_manf_id:1;
173 u8 has_card_id:1; 170 u16 has_card_id:1;
174 u8 has_func_id:1; 171 u16 has_func_id:1;
175 172
176 u8 allow_func_id_match:1; 173 u16 reserved:3;
177 u8 reserved:4;
178 174
179 u8 func_id; 175 u8 func_id;
180 u16 manf_id; 176 u16 manf_id;
@@ -182,22 +178,24 @@ struct pcmcia_device {
182 178
183 char * prod_id[4]; 179 char * prod_id[4];
184 180
181 struct device dev;
182
183#ifdef CONFIG_PCMCIA_IOCTL
185 /* device driver wanted by cardmgr */ 184 /* device driver wanted by cardmgr */
186 struct pcmcia_driver * cardmgr; 185 struct pcmcia_driver * cardmgr;
186#endif
187 187
188 struct device dev; 188 /* data private to drivers */
189 void *priv;
189}; 190};
190 191
191#define to_pcmcia_dev(n) container_of(n, struct pcmcia_device, dev) 192#define to_pcmcia_dev(n) container_of(n, struct pcmcia_device, dev)
192#define to_pcmcia_drv(n) container_of(n, struct pcmcia_driver, drv) 193#define to_pcmcia_drv(n) container_of(n, struct pcmcia_driver, drv)
193 194
194#define handle_to_pdev(handle) (handle)
195#define handle_to_dev(handle) (handle->dev) 195#define handle_to_dev(handle) (handle->dev)
196 196
197#define dev_to_instance(dev) (dev->instance)
198
199/* error reporting */ 197/* error reporting */
200void cs_error(client_handle_t handle, int func, int ret); 198void cs_error(struct pcmcia_device *handle, int func, int ret);
201 199
202#endif /* __KERNEL__ */ 200#endif /* __KERNEL__ */
203#endif /* _LINUX_DS_H */ 201#endif /* _LINUX_DS_H */