diff options
-rw-r--r-- | drivers/pcmcia/cs_internal.h | 154 |
1 files changed, 90 insertions, 64 deletions
diff --git a/drivers/pcmcia/cs_internal.h b/drivers/pcmcia/cs_internal.h index 3fcdf4fbca0e..95297c57cdb1 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 */ |
30 | typedef struct config_t { | 30 | typedef 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 | |||
44 | struct cis_cache_entry { | 45 | struct cis_cache_entry { |
45 | struct list_head node; | 46 | struct list_head node; |
46 | unsigned int addr; | 47 | unsigned int addr; |
@@ -59,7 +60,6 @@ struct cis_cache_entry { | |||
59 | #define SOCKET_INUSE 0x0010 | 60 | #define SOCKET_INUSE 0x0010 |
60 | #define SOCKET_SUSPEND 0x0080 | 61 | #define SOCKET_SUSPEND 0x0080 |
61 | #define SOCKET_WIN_REQ(i) (0x0100<<(i)) | 62 | #define SOCKET_WIN_REQ(i) (0x0100<<(i)) |
62 | #define SOCKET_REGION_INFO 0x4000 | ||
63 | #define SOCKET_CARDBUS 0x8000 | 63 | #define SOCKET_CARDBUS 0x8000 |
64 | #define SOCKET_CARDBUS_CONFIG 0x10000 | 64 | #define SOCKET_CARDBUS_CONFIG 0x10000 |
65 | 65 | ||
@@ -83,52 +83,6 @@ static inline void cs_socket_put(struct pcmcia_socket *skt) | |||
83 | } | 83 | } |
84 | } | 84 | } |
85 | 85 | ||
86 | /* In cardbus.c */ | ||
87 | int cb_alloc(struct pcmcia_socket *s); | ||
88 | void cb_free(struct pcmcia_socket *s); | ||
89 | int read_cb_mem(struct pcmcia_socket *s, int space, u_int addr, u_int len, void *ptr); | ||
90 | |||
91 | /* In cistpl.c */ | ||
92 | int pcmcia_read_cis_mem(struct pcmcia_socket *s, int attr, | ||
93 | u_int addr, u_int len, void *ptr); | ||
94 | void pcmcia_write_cis_mem(struct pcmcia_socket *s, int attr, | ||
95 | u_int addr, u_int len, void *ptr); | ||
96 | void release_cis_mem(struct pcmcia_socket *s); | ||
97 | void destroy_cis_cache(struct pcmcia_socket *s); | ||
98 | int verify_cis_cache(struct pcmcia_socket *s); | ||
99 | int pccard_read_tuple(struct pcmcia_socket *s, unsigned int function, cisdata_t code, void *parse); | ||
100 | |||
101 | /* In rsrc_mgr */ | ||
102 | int pcmcia_validate_mem(struct pcmcia_socket *s); | ||
103 | struct resource *pcmcia_find_io_region(unsigned long base, int num, unsigned long align, | ||
104 | struct pcmcia_socket *s); | ||
105 | int pcmcia_adjust_io_region(struct resource *res, unsigned long r_start, | ||
106 | unsigned long r_end, struct pcmcia_socket *s); | ||
107 | struct resource *pcmcia_find_mem_region(u_long base, u_long num, u_long align, | ||
108 | int low, struct pcmcia_socket *s); | ||
109 | void release_resource_db(struct pcmcia_socket *s); | ||
110 | |||
111 | /* In socket_sysfs.c */ | ||
112 | extern int pccard_sysfs_add_socket(struct device *dev); | ||
113 | extern void pccard_sysfs_remove_socket(struct device *dev); | ||
114 | |||
115 | /* In cs.c */ | ||
116 | extern struct rw_semaphore pcmcia_socket_list_rwsem; | ||
117 | extern struct list_head pcmcia_socket_list; | ||
118 | int pcmcia_get_window(struct pcmcia_socket *s, window_handle_t *handle, int idx, win_req_t *req); | ||
119 | int pccard_reset_card(struct pcmcia_socket *skt); | ||
120 | |||
121 | |||
122 | struct pcmcia_callback{ | ||
123 | struct module *owner; | ||
124 | int (*event) (struct pcmcia_socket *s, event_t event, int priority); | ||
125 | void (*requery) (struct pcmcia_socket *s, int new_cis); | ||
126 | int (*suspend) (struct pcmcia_socket *s); | ||
127 | int (*resume) (struct pcmcia_socket *s); | ||
128 | }; | ||
129 | |||
130 | int pccard_register_pcmcia(struct pcmcia_socket *s, struct pcmcia_callback *c); | ||
131 | |||
132 | #ifdef CONFIG_PCMCIA_DEBUG | 86 | #ifdef CONFIG_PCMCIA_DEBUG |
133 | extern int cs_debug_level(int); | 87 | extern int cs_debug_level(int); |
134 | 88 | ||
@@ -151,4 +105,76 @@ extern int cs_debug_level(int); | |||
151 | #define cs_err(skt, fmt, arg...) \ | 105 | #define cs_err(skt, fmt, arg...) \ |
152 | dev_printk(KERN_ERR, &skt->dev, "cs: " fmt, ## arg) | 106 | dev_printk(KERN_ERR, &skt->dev, "cs: " fmt, ## arg) |
153 | 107 | ||
108 | |||
109 | /* | ||
110 | * Stuff internal to module "pcmcia_core": | ||
111 | */ | ||
112 | |||
113 | /* cistpl.c */ | ||
114 | int verify_cis_cache(struct pcmcia_socket *s); | ||
115 | |||
116 | /* rsrc_mgr.c */ | ||
117 | void release_resource_db(struct pcmcia_socket *s); | ||
118 | |||
119 | /* socket_sysfs.c */ | ||
120 | extern int pccard_sysfs_add_socket(struct device *dev); | ||
121 | extern void pccard_sysfs_remove_socket(struct device *dev); | ||
122 | |||
123 | /* cardbus.c */ | ||
124 | int cb_alloc(struct pcmcia_socket *s); | ||
125 | void cb_free(struct pcmcia_socket *s); | ||
126 | int read_cb_mem(struct pcmcia_socket *s, int space, u_int addr, u_int len, | ||
127 | void *ptr); | ||
128 | |||
129 | |||
130 | |||
131 | /* | ||
132 | * Stuff exported by module "pcmcia_core" to module "pcmcia" | ||
133 | */ | ||
134 | |||
135 | struct pcmcia_callback{ | ||
136 | struct module *owner; | ||
137 | int (*event) (struct pcmcia_socket *s, | ||
138 | event_t event, int priority); | ||
139 | void (*requery) (struct pcmcia_socket *s, int new_cis); | ||
140 | int (*suspend) (struct pcmcia_socket *s); | ||
141 | int (*resume) (struct pcmcia_socket *s); | ||
142 | }; | ||
143 | |||
144 | /* cs.c */ | ||
145 | extern struct rw_semaphore pcmcia_socket_list_rwsem; | ||
146 | extern struct list_head pcmcia_socket_list; | ||
147 | int pcmcia_get_window(struct pcmcia_socket *s, | ||
148 | window_handle_t *handle, | ||
149 | int idx, | ||
150 | win_req_t *req); | ||
151 | int pccard_reset_card(struct pcmcia_socket *skt); | ||
152 | int pccard_register_pcmcia(struct pcmcia_socket *s, struct pcmcia_callback *c); | ||
153 | |||
154 | /* cistpl.c */ | ||
155 | int pcmcia_read_cis_mem(struct pcmcia_socket *s, int attr, | ||
156 | u_int addr, u_int len, void *ptr); | ||
157 | void pcmcia_write_cis_mem(struct pcmcia_socket *s, int attr, | ||
158 | u_int addr, u_int len, void *ptr); | ||
159 | void release_cis_mem(struct pcmcia_socket *s); | ||
160 | void destroy_cis_cache(struct pcmcia_socket *s); | ||
161 | int pccard_read_tuple(struct pcmcia_socket *s, unsigned int function, | ||
162 | cisdata_t code, void *parse); | ||
163 | |||
164 | /* rsrc_mgr.c */ | ||
165 | int pcmcia_validate_mem(struct pcmcia_socket *s); | ||
166 | struct resource *pcmcia_find_io_region(unsigned long base, | ||
167 | int num, | ||
168 | unsigned long align, | ||
169 | struct pcmcia_socket *s); | ||
170 | int pcmcia_adjust_io_region(struct resource *res, | ||
171 | unsigned long r_start, | ||
172 | unsigned long r_end, | ||
173 | struct pcmcia_socket *s); | ||
174 | struct resource *pcmcia_find_mem_region(u_long base, | ||
175 | u_long num, | ||
176 | u_long align, | ||
177 | int low, | ||
178 | struct pcmcia_socket *s); | ||
179 | |||
154 | #endif /* _LINUX_CS_INTERNAL_H */ | 180 | #endif /* _LINUX_CS_INTERNAL_H */ |