diff options
author | Dominik Brodowski <linux@dominikbrodowski.net> | 2008-08-31 09:20:26 -0400 |
---|---|---|
committer | Dominik Brodowski <linux@dominikbrodowski.net> | 2008-08-31 09:25:47 -0400 |
commit | 994917f8b718f1cd7114317cc3cbf04fe46c1841 (patch) | |
tree | 18bcc749026fbd3216e68353a993f7c20880e5a0 | |
parent | 35200d865d49d0207b054074055e1487a0c28ae4 (diff) |
pcmcia: card services header cleanup
16-bit PCMCIA device handling function definitions are moved to ds.h,
internal definitions to cs_internal.h.
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
-rw-r--r-- | drivers/char/pcmcia/ipwireless/main.c | 2 | ||||
-rw-r--r-- | drivers/net/pcmcia/nmclan_cs.c | 2 | ||||
-rw-r--r-- | drivers/net/wireless/orinoco_cs.c | 2 | ||||
-rw-r--r-- | drivers/pcmcia/cs.c | 4 | ||||
-rw-r--r-- | drivers/pcmcia/cs_internal.h | 12 | ||||
-rw-r--r-- | drivers/pcmcia/pcmcia_ioctl.c | 2 | ||||
-rw-r--r-- | include/pcmcia/cistpl.h | 6 | ||||
-rw-r--r-- | include/pcmcia/cs.h | 67 | ||||
-rw-r--r-- | include/pcmcia/ds.h | 56 |
9 files changed, 76 insertions, 77 deletions
diff --git a/drivers/char/pcmcia/ipwireless/main.c b/drivers/char/pcmcia/ipwireless/main.c index 24ffe0324e53..dcf2b59ca8c5 100644 --- a/drivers/char/pcmcia/ipwireless/main.c +++ b/drivers/char/pcmcia/ipwireless/main.c | |||
@@ -65,7 +65,7 @@ static void signalled_reboot_work(struct work_struct *work_reboot) | |||
65 | struct ipw_dev *ipw = container_of(work_reboot, struct ipw_dev, | 65 | struct ipw_dev *ipw = container_of(work_reboot, struct ipw_dev, |
66 | work_reboot); | 66 | work_reboot); |
67 | struct pcmcia_device *link = ipw->link; | 67 | struct pcmcia_device *link = ipw->link; |
68 | int ret = pccard_reset_card(link->socket); | 68 | int ret = pcmcia_reset_card(link->socket); |
69 | 69 | ||
70 | if (ret != 0) | 70 | if (ret != 0) |
71 | cs_error(link, ResetCard, ret); | 71 | cs_error(link, ResetCard, ret); |
diff --git a/drivers/net/pcmcia/nmclan_cs.c b/drivers/net/pcmcia/nmclan_cs.c index cfcbea9b7e2e..54df34f21c5f 100644 --- a/drivers/net/pcmcia/nmclan_cs.c +++ b/drivers/net/pcmcia/nmclan_cs.c | |||
@@ -925,7 +925,7 @@ static void mace_tx_timeout(struct net_device *dev) | |||
925 | printk(KERN_NOTICE "%s: transmit timed out -- ", dev->name); | 925 | printk(KERN_NOTICE "%s: transmit timed out -- ", dev->name); |
926 | #if RESET_ON_TIMEOUT | 926 | #if RESET_ON_TIMEOUT |
927 | printk("resetting card\n"); | 927 | printk("resetting card\n"); |
928 | pcmcia_reset_card(link, NULL); | 928 | pcmcia_reset_card(link->socket); |
929 | #else /* #if RESET_ON_TIMEOUT */ | 929 | #else /* #if RESET_ON_TIMEOUT */ |
930 | printk("NOT resetting card\n"); | 930 | printk("NOT resetting card\n"); |
931 | #endif /* #if RESET_ON_TIMEOUT */ | 931 | #endif /* #if RESET_ON_TIMEOUT */ |
diff --git a/drivers/net/wireless/orinoco_cs.c b/drivers/net/wireless/orinoco_cs.c index c7b57d9d499d..f8d9de2fb4cf 100644 --- a/drivers/net/wireless/orinoco_cs.c +++ b/drivers/net/wireless/orinoco_cs.c | |||
@@ -80,7 +80,7 @@ orinoco_cs_hard_reset(struct orinoco_private *priv) | |||
80 | /* We need atomic ops here, because we're not holding the lock */ | 80 | /* We need atomic ops here, because we're not holding the lock */ |
81 | set_bit(0, &card->hard_reset_in_progress); | 81 | set_bit(0, &card->hard_reset_in_progress); |
82 | 82 | ||
83 | err = pcmcia_reset_card(link, NULL); | 83 | err = pcmcia_reset_card(link->socket); |
84 | if (err) | 84 | if (err) |
85 | return err; | 85 | return err; |
86 | 86 | ||
diff --git a/drivers/pcmcia/cs.c b/drivers/pcmcia/cs.c index 48386f31e610..c68c5d338285 100644 --- a/drivers/pcmcia/cs.c +++ b/drivers/pcmcia/cs.c | |||
@@ -752,7 +752,7 @@ EXPORT_SYMBOL(pccard_register_pcmcia); | |||
752 | * CIS register. | 752 | * CIS register. |
753 | */ | 753 | */ |
754 | 754 | ||
755 | int pccard_reset_card(struct pcmcia_socket *skt) | 755 | int pcmcia_reset_card(struct pcmcia_socket *skt) |
756 | { | 756 | { |
757 | int ret; | 757 | int ret; |
758 | 758 | ||
@@ -791,7 +791,7 @@ int pccard_reset_card(struct pcmcia_socket *skt) | |||
791 | 791 | ||
792 | return ret; | 792 | return ret; |
793 | } /* reset_card */ | 793 | } /* reset_card */ |
794 | EXPORT_SYMBOL(pccard_reset_card); | 794 | EXPORT_SYMBOL(pcmcia_reset_card); |
795 | 795 | ||
796 | 796 | ||
797 | /* These shut down or wake up a socket. They are sort of user | 797 | /* These shut down or wake up a socket. They are sort of user |
diff --git a/drivers/pcmcia/cs_internal.h b/drivers/pcmcia/cs_internal.h index 2df8d8be1ff9..d71eeee4992b 100644 --- a/drivers/pcmcia/cs_internal.h +++ b/drivers/pcmcia/cs_internal.h | |||
@@ -174,10 +174,18 @@ int pcmcia_get_window(struct pcmcia_socket *s, | |||
174 | window_handle_t *handle, | 174 | window_handle_t *handle, |
175 | int idx, | 175 | int idx, |
176 | win_req_t *req); | 176 | win_req_t *req); |
177 | int pccard_reset_card(struct pcmcia_socket *skt); | ||
178 | int pccard_register_pcmcia(struct pcmcia_socket *s, struct pcmcia_callback *c); | 177 | int pccard_register_pcmcia(struct pcmcia_socket *s, struct pcmcia_callback *c); |
179 | struct pcmcia_socket *pcmcia_get_socket_by_nr(unsigned int nr); | 178 | struct pcmcia_socket *pcmcia_get_socket_by_nr(unsigned int nr); |
180 | 179 | ||
180 | int pcmcia_suspend_card(struct pcmcia_socket *skt); | ||
181 | int pcmcia_resume_card(struct pcmcia_socket *skt); | ||
182 | |||
183 | int pcmcia_eject_card(struct pcmcia_socket *skt); | ||
184 | int pcmcia_insert_card(struct pcmcia_socket *skt); | ||
185 | |||
186 | struct pcmcia_socket *pcmcia_get_socket(struct pcmcia_socket *skt); | ||
187 | void pcmcia_put_socket(struct pcmcia_socket *skt); | ||
188 | |||
181 | /* cistpl.c */ | 189 | /* cistpl.c */ |
182 | int pcmcia_read_cis_mem(struct pcmcia_socket *s, int attr, | 190 | int pcmcia_read_cis_mem(struct pcmcia_socket *s, int attr, |
183 | u_int addr, u_int len, void *ptr); | 191 | u_int addr, u_int len, void *ptr); |
@@ -187,6 +195,8 @@ void release_cis_mem(struct pcmcia_socket *s); | |||
187 | void destroy_cis_cache(struct pcmcia_socket *s); | 195 | void destroy_cis_cache(struct pcmcia_socket *s); |
188 | int pccard_read_tuple(struct pcmcia_socket *s, unsigned int function, | 196 | int pccard_read_tuple(struct pcmcia_socket *s, unsigned int function, |
189 | cisdata_t code, void *parse); | 197 | cisdata_t code, void *parse); |
198 | int pcmcia_replace_cis(struct pcmcia_socket *s, | ||
199 | const u8 *data, const size_t len); | ||
190 | 200 | ||
191 | /* rsrc_mgr.c */ | 201 | /* rsrc_mgr.c */ |
192 | int pcmcia_validate_mem(struct pcmcia_socket *s); | 202 | int pcmcia_validate_mem(struct pcmcia_socket *s); |
diff --git a/drivers/pcmcia/pcmcia_ioctl.c b/drivers/pcmcia/pcmcia_ioctl.c index c400872f5d3b..579ec9455706 100644 --- a/drivers/pcmcia/pcmcia_ioctl.c +++ b/drivers/pcmcia/pcmcia_ioctl.c | |||
@@ -861,7 +861,7 @@ static int ds_ioctl(struct inode * inode, struct file * file, | |||
861 | ret = pccard_parse_tuple(&buf->tuple, &buf->tuple_parse.parse); | 861 | ret = pccard_parse_tuple(&buf->tuple, &buf->tuple_parse.parse); |
862 | break; | 862 | break; |
863 | case DS_RESET_CARD: | 863 | case DS_RESET_CARD: |
864 | ret = pccard_reset_card(s); | 864 | ret = pcmcia_reset_card(s); |
865 | break; | 865 | break; |
866 | case DS_GET_STATUS: | 866 | case DS_GET_STATUS: |
867 | if (buf->status.Function && | 867 | if (buf->status.Function && |
diff --git a/include/pcmcia/cistpl.h b/include/pcmcia/cistpl.h index 75a9d34c6346..7e8c2bcf11a7 100644 --- a/include/pcmcia/cistpl.h +++ b/include/pcmcia/cistpl.h | |||
@@ -580,8 +580,8 @@ typedef struct cisinfo_t { | |||
580 | 580 | ||
581 | #define CISTPL_MAX_CIS_SIZE 0x200 | 581 | #define CISTPL_MAX_CIS_SIZE 0x200 |
582 | 582 | ||
583 | int pcmcia_replace_cis(struct pcmcia_socket *s, | 583 | #ifdef __KERNEL__ |
584 | const u8 *data, const size_t len); | 584 | struct pcmcia_socket; |
585 | 585 | ||
586 | /* don't use outside of PCMCIA core yet */ | 586 | /* don't use outside of PCMCIA core yet */ |
587 | int pccard_get_next_tuple(struct pcmcia_socket *s, unsigned int func, tuple_t *tuple); | 587 | int pccard_get_next_tuple(struct pcmcia_socket *s, unsigned int func, tuple_t *tuple); |
@@ -615,4 +615,6 @@ int pcmcia_loop_config(struct pcmcia_device *p_dev, | |||
615 | void *priv_data), | 615 | void *priv_data), |
616 | void *priv_data); | 616 | void *priv_data); |
617 | 617 | ||
618 | #endif /* __KERNEL__ */ | ||
619 | |||
618 | #endif /* LINUX_CISTPL_H */ | 620 | #endif /* LINUX_CISTPL_H */ |
diff --git a/include/pcmcia/cs.h b/include/pcmcia/cs.h index 42c8759f0bdc..6944a74d3a7c 100644 --- a/include/pcmcia/cs.h +++ b/include/pcmcia/cs.h | |||
@@ -201,16 +201,6 @@ typedef struct win_req_t { | |||
201 | #define WIN_BAR_MASK 0xe000 | 201 | #define WIN_BAR_MASK 0xe000 |
202 | #define WIN_BAR_SHIFT 13 | 202 | #define WIN_BAR_SHIFT 13 |
203 | 203 | ||
204 | /* Attributes for RegisterClient -- UNUSED -- */ | ||
205 | #define INFO_MASTER_CLIENT 0x01 | ||
206 | #define INFO_IO_CLIENT 0x02 | ||
207 | #define INFO_MTD_CLIENT 0x04 | ||
208 | #define INFO_MEM_CLIENT 0x08 | ||
209 | #define MAX_NUM_CLIENTS 3 | ||
210 | |||
211 | #define INFO_CARD_SHARE 0x10 | ||
212 | #define INFO_CARD_EXCL 0x20 | ||
213 | |||
214 | typedef struct cs_status_t { | 204 | typedef struct cs_status_t { |
215 | u_char Function; | 205 | u_char Function; |
216 | event_t CardState; | 206 | event_t CardState; |
@@ -252,61 +242,4 @@ typedef struct error_info_t { | |||
252 | #define CS_EVENT_3VCARD 0x200000 | 242 | #define CS_EVENT_3VCARD 0x200000 |
253 | #define CS_EVENT_XVCARD 0x400000 | 243 | #define CS_EVENT_XVCARD 0x400000 |
254 | 244 | ||
255 | |||
256 | #ifdef __KERNEL__ | ||
257 | |||
258 | /* | ||
259 | * The main Card Services entry point | ||
260 | */ | ||
261 | |||
262 | enum service { | ||
263 | AccessConfigurationRegister, AddSocketServices, | ||
264 | AdjustResourceInfo, CheckEraseQueue, CloseMemory, CopyMemory, | ||
265 | DeregisterClient, DeregisterEraseQueue, GetCardServicesInfo, | ||
266 | GetClientInfo, GetConfigurationInfo, GetEventMask, | ||
267 | GetFirstClient, GetFirstPartion, GetFirstRegion, GetFirstTuple, | ||
268 | GetNextClient, GetNextPartition, GetNextRegion, GetNextTuple, | ||
269 | GetStatus, GetTupleData, MapLogSocket, MapLogWindow, MapMemPage, | ||
270 | MapPhySocket, MapPhyWindow, ModifyConfiguration, ModifyWindow, | ||
271 | OpenMemory, ParseTuple, ReadMemory, RegisterClient, | ||
272 | RegisterEraseQueue, RegisterMTD, RegisterTimer, | ||
273 | ReleaseConfiguration, ReleaseExclusive, ReleaseIO, ReleaseIRQ, | ||
274 | ReleaseSocketMask, ReleaseWindow, ReplaceSocketServices, | ||
275 | RequestConfiguration, RequestExclusive, RequestIO, RequestIRQ, | ||
276 | RequestSocketMask, RequestWindow, ResetCard, ReturnSSEntry, | ||
277 | SetEventMask, SetRegion, ValidateCIS, VendorSpecific, | ||
278 | WriteMemory, BindDevice, BindMTD, ReportError, | ||
279 | SuspendCard, ResumeCard, EjectCard, InsertCard, ReplaceCIS, | ||
280 | GetFirstWindow, GetNextWindow, GetMemPage | ||
281 | }; | ||
282 | |||
283 | struct pcmcia_socket; | ||
284 | |||
285 | int pcmcia_access_configuration_register(struct pcmcia_device *p_dev, conf_reg_t *reg); | ||
286 | int pcmcia_get_mem_page(window_handle_t win, memreq_t *req); | ||
287 | int pcmcia_map_mem_page(window_handle_t win, memreq_t *req); | ||
288 | int pcmcia_modify_configuration(struct pcmcia_device *p_dev, modconf_t *mod); | ||
289 | int pcmcia_release_window(window_handle_t win); | ||
290 | int pcmcia_request_configuration(struct pcmcia_device *p_dev, config_req_t *req); | ||
291 | int pcmcia_request_io(struct pcmcia_device *p_dev, io_req_t *req); | ||
292 | int pcmcia_request_irq(struct pcmcia_device *p_dev, irq_req_t *req); | ||
293 | int pcmcia_request_window(struct pcmcia_device **p_dev, win_req_t *req, window_handle_t *wh); | ||
294 | int pcmcia_suspend_card(struct pcmcia_socket *skt); | ||
295 | int pcmcia_resume_card(struct pcmcia_socket *skt); | ||
296 | int pcmcia_eject_card(struct pcmcia_socket *skt); | ||
297 | int pcmcia_insert_card(struct pcmcia_socket *skt); | ||
298 | int pccard_reset_card(struct pcmcia_socket *skt); | ||
299 | |||
300 | struct pcmcia_device * pcmcia_dev_present(struct pcmcia_device *p_dev); | ||
301 | void pcmcia_disable_device(struct pcmcia_device *p_dev); | ||
302 | |||
303 | struct pcmcia_socket * pcmcia_get_socket(struct pcmcia_socket *skt); | ||
304 | void pcmcia_put_socket(struct pcmcia_socket *skt); | ||
305 | |||
306 | /* compatibility functions */ | ||
307 | #define pcmcia_reset_card(p_dev, req) \ | ||
308 | pccard_reset_card(p_dev->socket) | ||
309 | |||
310 | #endif /* __KERNEL__ */ | ||
311 | |||
312 | #endif /* _LINUX_CS_H */ | 245 | #endif /* _LINUX_CS_H */ |
diff --git a/include/pcmcia/ds.h b/include/pcmcia/ds.h index 279df0fb036e..29e403230899 100644 --- a/include/pcmcia/ds.h +++ b/include/pcmcia/ds.h | |||
@@ -145,7 +145,26 @@ struct pcmcia_device { | |||
145 | * or dev_dbg() directly in the driver, without referring to pcmcia_error_func() | 145 | * or dev_dbg() directly in the driver, without referring to pcmcia_error_func() |
146 | * and/or pcmcia_error_ret() for those functions will go away soon. | 146 | * and/or pcmcia_error_ret() for those functions will go away soon. |
147 | */ | 147 | */ |
148 | 148 | enum service { | |
149 | AccessConfigurationRegister, AddSocketServices, | ||
150 | AdjustResourceInfo, CheckEraseQueue, CloseMemory, CopyMemory, | ||
151 | DeregisterClient, DeregisterEraseQueue, GetCardServicesInfo, | ||
152 | GetClientInfo, GetConfigurationInfo, GetEventMask, | ||
153 | GetFirstClient, GetFirstPartion, GetFirstRegion, GetFirstTuple, | ||
154 | GetNextClient, GetNextPartition, GetNextRegion, GetNextTuple, | ||
155 | GetStatus, GetTupleData, MapLogSocket, MapLogWindow, MapMemPage, | ||
156 | MapPhySocket, MapPhyWindow, ModifyConfiguration, ModifyWindow, | ||
157 | OpenMemory, ParseTuple, ReadMemory, RegisterClient, | ||
158 | RegisterEraseQueue, RegisterMTD, RegisterTimer, | ||
159 | ReleaseConfiguration, ReleaseExclusive, ReleaseIO, ReleaseIRQ, | ||
160 | ReleaseSocketMask, ReleaseWindow, ReplaceSocketServices, | ||
161 | RequestConfiguration, RequestExclusive, RequestIO, RequestIRQ, | ||
162 | RequestSocketMask, RequestWindow, ResetCard, ReturnSSEntry, | ||
163 | SetEventMask, SetRegion, ValidateCIS, VendorSpecific, | ||
164 | WriteMemory, BindDevice, BindMTD, ReportError, | ||
165 | SuspendCard, ResumeCard, EjectCard, InsertCard, ReplaceCIS, | ||
166 | GetFirstWindow, GetNextWindow, GetMemPage | ||
167 | }; | ||
149 | const char *pcmcia_error_func(int func); | 168 | const char *pcmcia_error_func(int func); |
150 | const char *pcmcia_error_ret(int ret); | 169 | const char *pcmcia_error_ret(int ret); |
151 | 170 | ||
@@ -158,6 +177,32 @@ const char *pcmcia_error_ret(int ret); | |||
158 | } | 177 | } |
159 | 178 | ||
160 | 179 | ||
180 | /* is the device still there? */ | ||
181 | struct pcmcia_device *pcmcia_dev_present(struct pcmcia_device *p_dev); | ||
182 | |||
183 | /* low-level interface reset */ | ||
184 | int pcmcia_reset_card(struct pcmcia_socket *skt); | ||
185 | |||
186 | /* CIS config */ | ||
187 | int pcmcia_access_configuration_register(struct pcmcia_device *p_dev, | ||
188 | conf_reg_t *reg); | ||
189 | |||
190 | /* device configuration */ | ||
191 | int pcmcia_request_io(struct pcmcia_device *p_dev, io_req_t *req); | ||
192 | int pcmcia_request_irq(struct pcmcia_device *p_dev, irq_req_t *req); | ||
193 | int pcmcia_request_configuration(struct pcmcia_device *p_dev, | ||
194 | config_req_t *req); | ||
195 | |||
196 | int pcmcia_request_window(struct pcmcia_device **p_dev, win_req_t *req, | ||
197 | window_handle_t *wh); | ||
198 | int pcmcia_release_window(window_handle_t win); | ||
199 | |||
200 | int pcmcia_get_mem_page(window_handle_t win, memreq_t *req); | ||
201 | int pcmcia_map_mem_page(window_handle_t win, memreq_t *req); | ||
202 | |||
203 | int pcmcia_modify_configuration(struct pcmcia_device *p_dev, modconf_t *mod); | ||
204 | void pcmcia_disable_device(struct pcmcia_device *p_dev); | ||
205 | |||
161 | #endif /* __KERNEL__ */ | 206 | #endif /* __KERNEL__ */ |
162 | 207 | ||
163 | 208 | ||
@@ -341,6 +386,15 @@ typedef union ds_ioctl_arg_t { | |||
341 | /* used in userspace only */ | 386 | /* used in userspace only */ |
342 | #define CS_IN_USE 0x1e | 387 | #define CS_IN_USE 0x1e |
343 | 388 | ||
389 | #define INFO_MASTER_CLIENT 0x01 | ||
390 | #define INFO_IO_CLIENT 0x02 | ||
391 | #define INFO_MTD_CLIENT 0x04 | ||
392 | #define INFO_MEM_CLIENT 0x08 | ||
393 | #define MAX_NUM_CLIENTS 3 | ||
394 | |||
395 | #define INFO_CARD_SHARE 0x10 | ||
396 | #define INFO_CARD_EXCL 0x20 | ||
397 | |||
344 | 398 | ||
345 | #endif /* !defined(__KERNEL__) || defined(CONFIG_PCMCIA_IOCTL) */ | 399 | #endif /* !defined(__KERNEL__) || defined(CONFIG_PCMCIA_IOCTL) */ |
346 | 400 | ||