author | mickeyl <mickeyl> | 2005-05-22 21:55:59 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2005-05-22 21:55:59 (UTC) |
commit | b153f9739d300b3bc608ea76968b818818fce1d0 (patch) (unidiff) | |
tree | 8b05eedb78f5eab6b5d49c68248da8425f09410b | |
parent | ffe68fa0d9b4eb89fe1549b5734ca6ab23c8ab62 (diff) | |
download | opie-b153f9739d300b3bc608ea76968b818818fce1d0.zip opie-b153f9739d300b3bc608ea76968b818818fce1d0.tar.gz opie-b153f9739d300b3bc608ea76968b818818fce1d0.tar.bz2 |
start talking directly to pcmcia card services
-rw-r--r-- | libopie2/opiecore/linux/opcmciasystem.cpp | 142 | ||||
-rw-r--r-- | libopie2/opiecore/linux/opcmciasystem.h | 28 | ||||
-rw-r--r-- | libopie2/opiecore/linux_inotify.h | 2 | ||||
-rw-r--r-- | libopie2/opiecore/linux_pcmcia.h | 1100 |
4 files changed, 1264 insertions, 8 deletions
diff --git a/libopie2/opiecore/linux/opcmciasystem.cpp b/libopie2/opiecore/linux/opcmciasystem.cpp index c310b85..7bd7178 100644 --- a/libopie2/opiecore/linux/opcmciasystem.cpp +++ b/libopie2/opiecore/linux/opcmciasystem.cpp | |||
@@ -47,2 +47,5 @@ using namespace Opie::Core; | |||
47 | #include <sys/stat.h> | 47 | #include <sys/stat.h> |
48 | #include <unistd.h> | ||
49 | |||
50 | #define PROC_DEVICES "/proc/devices" | ||
48 | 51 | ||
@@ -55,4 +58,30 @@ OPcmciaSystem* OPcmciaSystem::_instance = 0; | |||
55 | OPcmciaSystem::OPcmciaSystem() | 58 | OPcmciaSystem::OPcmciaSystem() |
59 | :_major( 0 ) | ||
56 | { | 60 | { |
57 | qDebug( "OPcmciaSystem::OPcmciaSystem()" ); | 61 | qDebug( "OPcmciaSystem::OPcmciaSystem()" ); |
62 | |||
63 | // get major node number out of /proc/devices | ||
64 | QFile procfile( PROC_DEVICES ); | ||
65 | if ( procfile.exists() && procfile.open( IO_ReadOnly ) ) | ||
66 | { | ||
67 | QTextStream devstream( &procfile ); | ||
68 | devstream.readLine(); // skip header | ||
69 | while ( !devstream.atEnd() && !_major ) | ||
70 | { | ||
71 | int nodenumber; | ||
72 | QString driver; | ||
73 | devstream >> nodenumber >> driver; | ||
74 | if ( driver == "pcmcia" ) | ||
75 | { | ||
76 | qDebug( "OPcmciaSystem::OPcmciaSystem(): gotcha! pcmcia node number = %d", nodenumber ); | ||
77 | _major = nodenumber; | ||
78 | break; | ||
79 | } | ||
80 | } | ||
81 | } | ||
82 | else | ||
83 | { | ||
84 | qWarning( "OPcmciaSystem::OPcmciaSystem() - can't open /proc/devices - continuing with limited functionality." ); | ||
85 | } | ||
86 | |||
58 | synchronize(); | 87 | synchronize(); |
@@ -89,3 +118,3 @@ void OPcmciaSystem::synchronize() | |||
89 | { | 118 | { |
90 | _interfaces.append( new OPcmciaSocket( numSocket, this, (const char*) cardName ) ); | 119 | _interfaces.append( new OPcmciaSocket( _major, numSocket, this, (const char*) cardName ) ); |
91 | } | 120 | } |
@@ -141,7 +170,9 @@ OPcmciaSystem::CardIterator OPcmciaSystem::iterator() const | |||
141 | 170 | ||
142 | OPcmciaSocket::OPcmciaSocket( int socket, QObject* parent, const char* name ) | 171 | OPcmciaSocket::OPcmciaSocket( int major, int socket, QObject* parent, const char* name ) |
143 | :QObject( parent, name ), _socket( socket ) | 172 | :QObject( parent, name ), _major( major ), _socket( socket ) |
144 | { | 173 | { |
145 | odebug << "OPcmciaSocket::OPcmciaSocket()" << oendl; | 174 | qDebug( "OPcmciaSocket::OPcmciaSocket()" ); |
175 | |||
146 | init(); | 176 | init(); |
177 | buildInformation(); | ||
147 | } | 178 | } |
@@ -151,2 +182,4 @@ OPcmciaSocket::~OPcmciaSocket() | |||
151 | { | 182 | { |
183 | qDebug( "OPcmciaSocket::~OPcmciaSocket()" ); | ||
184 | cleanup(); | ||
152 | } | 185 | } |
@@ -156,4 +189,92 @@ OPcmciaSocket::~OPcmciaSocket() | |||
156 | { | 189 | { |
190 | // open control socket and gather file descriptor | ||
191 | if ( _major ) | ||
192 | { | ||
193 | dev_t dev = ::makedev( _major, _socket ); | ||
194 | QString filename = QString().sprintf( "/tmp/opcmciasystem-%d", ::getpid() ); | ||
195 | if ( ::mknod( (const char*) filename, ( S_IFCHR|S_IREAD|S_IWRITE ), dev ) == 0 ) | ||
196 | { | ||
197 | _fd = ::open( (const char*) filename, O_RDONLY); | ||
198 | if ( !_fd ) | ||
199 | { | ||
200 | qWarning( "OPcmciaSocket::init() - can't open control socket (%s)", strerror( errno ) ); | ||
201 | } | ||
202 | else | ||
203 | { | ||
204 | ::unlink( (const char*) filename ); | ||
205 | } | ||
206 | } | ||
207 | else | ||
208 | { | ||
209 | qWarning( "OPcmciaSocket::init() - can't create device node (%s)", strerror( errno ) ); | ||
210 | } | ||
211 | } | ||
212 | } | ||
213 | |||
214 | /* internal */ void OPcmciaSocket::buildInformation() | ||
215 | { | ||
216 | cistpl_vers_1_t *vers = &_ioctlarg.tuple_parse.parse.version_1; | ||
217 | cistpl_manfid_t *manfid = &_ioctlarg.tuple_parse.parse.manfid; | ||
218 | cistpl_funcid_t *funcid = &_ioctlarg.tuple_parse.parse.funcid; | ||
219 | config_info_t config; | ||
220 | |||
221 | if ( getTuple( CISTPL_VERS_1 ) ) | ||
222 | { | ||
223 | for ( int i = 0; i < CISTPL_VERS_1_MAX_PROD_STRINGS; ++i ) | ||
224 | { | ||
225 | qDebug( " PRODID = '%s'", vers->str+vers->ofs[i] ); | ||
226 | _productId += vers->str+vers->ofs[i]; | ||
227 | } | ||
228 | } | ||
229 | /* | ||
230 | for (i = 0; i < 4; i++) | ||
231 | printf("PRODID_%d=\"%s\"\n", i+1, | ||
232 | (i < vers->ns) ? vers->str+vers->ofs[i] : ""); | ||
233 | *manfid = (cistpl_manfid_t) { 0, 0 }; | ||
234 | get_tuple(fd, CISTPL_MANFID, &arg); | ||
235 | printf("MANFID=%04x,%04x\n", manfid->manf, manfid->card); | ||
236 | *funcid = (cistpl_funcid_t) { 0xff, 0xff }; | ||
237 | get_tuple(fd, CISTPL_FUNCID, &arg); | ||
238 | printf("FUNCID=%d\n", funcid->func); | ||
239 | config.Function = config.ConfigBase = 0; | ||
240 | */ | ||
157 | } | 241 | } |
158 | 242 | ||
243 | /* internal */ void OPcmciaSocket::cleanup() | ||
244 | { | ||
245 | // close control socket | ||
246 | } | ||
247 | |||
248 | /* internal */ bool OPcmciaSocket::getTuple( cisdata_t tuple ) | ||
249 | { | ||
250 | _ioctlarg.tuple.DesiredTuple = tuple; | ||
251 | _ioctlarg.tuple.Attributes = TUPLE_RETURN_COMMON; | ||
252 | _ioctlarg.tuple.TupleOffset = 0; | ||
253 | |||
254 | int result; | ||
255 | result = ::ioctl(_fd, DS_GET_FIRST_TUPLE, &_ioctlarg); | ||
256 | if ( result != 0 ) | ||
257 | { | ||
258 | qWarning( "OPcmciaSocket::getTuple() - DS_GET_FIRST_TUPLE failed (%s)", strerror( errno ) ); | ||
259 | return false; | ||
260 | } | ||
261 | |||
262 | result = ::ioctl(_fd, DS_GET_TUPLE_DATA, &_ioctlarg); | ||
263 | if ( result != 0 ) | ||
264 | { | ||
265 | qWarning( "OPcmciaSocket::getTuple() - DS_GET_TUPLE_DATA failed (%s)", strerror( errno ) ); | ||
266 | return false; | ||
267 | } | ||
268 | |||
269 | result = ::ioctl(_fd, DS_PARSE_TUPLE, &_ioctlarg); | ||
270 | if ( result != 0 ) | ||
271 | { | ||
272 | qWarning( "OPcmciaSocket::getTuple() - DS_PARSE_TUPLE failed (%s)", strerror( errno ) ); | ||
273 | return false; | ||
274 | } | ||
275 | |||
276 | return true; | ||
277 | } | ||
278 | |||
279 | |||
159 | /* internal */ bool OPcmciaSocket::command( const QString& cmd ) | 280 | /* internal */ bool OPcmciaSocket::command( const QString& cmd ) |
@@ -218 +339,14 @@ bool OPcmciaSocket::reset() | |||
218 | } | 339 | } |
340 | |||
341 | const QStringList& OPcmciaSocket::productIdentity() const | ||
342 | { | ||
343 | return _productId; | ||
344 | } | ||
345 | |||
346 | #if 0 | ||
347 | const QPair& OPcmciaSocket::manufacturerIdentity() const | ||
348 | { | ||
349 | return _manufId; | ||
350 | } | ||
351 | #endif | ||
352 | |||
diff --git a/libopie2/opiecore/linux/opcmciasystem.h b/libopie2/opiecore/linux/opcmciasystem.h index 630a434..ef34964 100644 --- a/libopie2/opiecore/linux/opcmciasystem.h +++ b/libopie2/opiecore/linux/opcmciasystem.h | |||
@@ -32,2 +32,4 @@ | |||
32 | 32 | ||
33 | #include "linux_pcmcia.h" | ||
34 | |||
33 | #include <qobject.h> | 35 | #include <qobject.h> |
@@ -94,2 +96,5 @@ class OPcmciaSystem : public QObject | |||
94 | CardList _interfaces; | 96 | CardList _interfaces; |
97 | int _major; | ||
98 | |||
99 | private: | ||
95 | class Private; | 100 | class Private; |
@@ -110,5 +115,5 @@ class OPcmciaSocket : public QObject | |||
110 | * Constructor. Normally you don't create @ref OPcmciaSocket objects yourself, | 115 | * Constructor. Normally you don't create @ref OPcmciaSocket objects yourself, |
111 | * but access them via @ref OPcmciaSystem::card(). | 116 | * but access them via @ref OPcmciaSystem::socket(). |
112 | */ | 117 | */ |
113 | OPcmciaSocket( int socket, QObject* parent, const char* name ); | 118 | OPcmciaSocket( int major, int socket, QObject* parent, const char* name ); |
114 | /** | 119 | /** |
@@ -162,4 +167,15 @@ class OPcmciaSocket : public QObject | |||
162 | bool reset(); | 167 | bool reset(); |
168 | /** | ||
169 | * @returns a list of product IDs | ||
170 | */ | ||
171 | const QStringList& productIdentity() const; | ||
172 | /** | ||
173 | * @returns the manufacturer ID pair | ||
174 | */ | ||
175 | #if 0 | ||
176 | const QPair& manufacturerIdentity() const; | ||
177 | #endif | ||
163 | 178 | ||
164 | protected: | 179 | private: |
180 | QStringList _productId; | ||
165 | 181 | ||
@@ -167,4 +183,10 @@ class OPcmciaSocket : public QObject | |||
167 | void init(); | 183 | void init(); |
184 | void buildInformation(); | ||
185 | void cleanup(); | ||
168 | bool command( const QString& cmd ); | 186 | bool command( const QString& cmd ); |
187 | bool getTuple( cisdata_t tuple ); | ||
188 | int _major; | ||
169 | int _socket; | 189 | int _socket; |
190 | int _fd; | ||
191 | ds_ioctl_arg_t _ioctlarg; | ||
170 | 192 | ||
diff --git a/libopie2/opiecore/linux_inotify.h b/libopie2/opiecore/linux_inotify.h index 7e19bb4..70e3be8 100644 --- a/libopie2/opiecore/linux_inotify.h +++ b/libopie2/opiecore/linux_inotify.h | |||
@@ -46,3 +46,3 @@ struct inotify_watch_request { | |||
46 | #define IN_MOVED_TO 0x00000080/* File was moved to Y */ | 46 | #define IN_MOVED_TO 0x00000080/* File was moved to Y */ |
47 | #define IN_DELETE_SUBDIR 0x00000100/* Subdir was deleted */ | 47 | #define IN_DELETE_SUBDIR 0x00000100/* Subdir was deleted */ |
48 | #define IN_DELETE_FILE 0x00000200/* Subfile was deleted */ | 48 | #define IN_DELETE_FILE 0x00000200/* Subfile was deleted */ |
diff --git a/libopie2/opiecore/linux_pcmcia.h b/libopie2/opiecore/linux_pcmcia.h new file mode 100644 index 0000000..5d84f57 --- a/dev/null +++ b/libopie2/opiecore/linux_pcmcia.h | |||
@@ -0,0 +1,1100 @@ | |||
1 | #ifndef _LINUX_PCMCIA_H | ||
2 | #define _LINUX_PCMCIA_H | ||
3 | |||
4 | // condensed pcmcia card services header file | ||
5 | |||
6 | #ifdef __KERNEL__ | ||
7 | #include <linux/types.h> | ||
8 | #else | ||
9 | #include <sys/types.h> | ||
10 | #endif | ||
11 | |||
12 | #ifdef __arm__ | ||
13 | typedef u_int ioaddr_t; | ||
14 | #else | ||
15 | typedef u_short ioaddr_t; | ||
16 | #endif | ||
17 | |||
18 | typedef u_short socket_t; | ||
19 | typedef u_int event_t; | ||
20 | typedef u_char cisdata_t; | ||
21 | typedef u_short page_t; | ||
22 | |||
23 | struct client_t; | ||
24 | typedef struct client_t *client_handle_t; | ||
25 | |||
26 | struct window_t; | ||
27 | typedef struct window_t *window_handle_t; | ||
28 | |||
29 | struct region_t; | ||
30 | typedef struct region_t *memory_handle_t; | ||
31 | |||
32 | struct eraseq_t; | ||
33 | typedef struct eraseq_t *eraseq_handle_t; | ||
34 | |||
35 | #ifndef DEV_NAME_LEN | ||
36 | #define DEV_NAME_LEN 32 | ||
37 | #endif | ||
38 | |||
39 | typedef char dev_info_t[DEV_NAME_LEN]; | ||
40 | |||
41 | #define CISTPL_NULL 0x00 | ||
42 | #define CISTPL_DEVICE 0x01 | ||
43 | #define CISTPL_LONGLINK_CB 0x02 | ||
44 | #define CISTPL_INDIRECT 0x03 | ||
45 | #define CISTPL_CONFIG_CB 0x04 | ||
46 | #define CISTPL_CFTABLE_ENTRY_CB 0x05 | ||
47 | #define CISTPL_LONGLINK_MFC 0x06 | ||
48 | #define CISTPL_BAR 0x07 | ||
49 | #define CISTPL_PWR_MGMNT 0x08 | ||
50 | #define CISTPL_EXTDEVICE 0x09 | ||
51 | #define CISTPL_CHECKSUM 0x10 | ||
52 | #define CISTPL_LONGLINK_A 0x11 | ||
53 | #define CISTPL_LONGLINK_C 0x12 | ||
54 | #define CISTPL_LINKTARGET 0x13 | ||
55 | #define CISTPL_NO_LINK 0x14 | ||
56 | #define CISTPL_VERS_1 0x15 | ||
57 | #define CISTPL_ALTSTR 0x16 | ||
58 | #define CISTPL_DEVICE_A 0x17 | ||
59 | #define CISTPL_JEDEC_C 0x18 | ||
60 | #define CISTPL_JEDEC_A 0x19 | ||
61 | #define CISTPL_CONFIG 0x1a | ||
62 | #define CISTPL_CFTABLE_ENTRY 0x1b | ||
63 | #define CISTPL_DEVICE_OC 0x1c | ||
64 | #define CISTPL_DEVICE_OA 0x1d | ||
65 | #define CISTPL_DEVICE_GEO 0x1e | ||
66 | #define CISTPL_DEVICE_GEO_A 0x1f | ||
67 | #define CISTPL_MANFID 0x20 | ||
68 | #define CISTPL_FUNCID 0x21 | ||
69 | #define CISTPL_FUNCE 0x22 | ||
70 | #define CISTPL_SWIL 0x23 | ||
71 | #define CISTPL_END 0xff | ||
72 | /* Layer 2 tuples */ | ||
73 | #define CISTPL_VERS_2 0x40 | ||
74 | #define CISTPL_FORMAT 0x41 | ||
75 | #define CISTPL_GEOMETRY 0x42 | ||
76 | #define CISTPL_BYTEORDER 0x43 | ||
77 | #define CISTPL_DATE 0x44 | ||
78 | #define CISTPL_BATTERY 0x45 | ||
79 | #define CISTPL_FORMAT_A 0x47 | ||
80 | /* Layer 3 tuples */ | ||
81 | #define CISTPL_ORG 0x46 | ||
82 | #define CISTPL_SPCL 0x90 | ||
83 | |||
84 | typedef struct cistpl_longlink_t { | ||
85 | u_int addr; | ||
86 | } cistpl_longlink_t; | ||
87 | |||
88 | typedef struct cistpl_checksum_t { | ||
89 | u_short addr; | ||
90 | u_short len; | ||
91 | u_char sum; | ||
92 | } cistpl_checksum_t; | ||
93 | |||
94 | #define CISTPL_MAX_FUNCTIONS 8 | ||
95 | #define CISTPL_MFC_ATTR 0x00 | ||
96 | #define CISTPL_MFC_COMMON 0x01 | ||
97 | |||
98 | typedef struct cistpl_longlink_mfc_t { | ||
99 | u_char nfn; | ||
100 | struct { | ||
101 | u_char space; | ||
102 | u_int addr; | ||
103 | } fn[CISTPL_MAX_FUNCTIONS]; | ||
104 | } cistpl_longlink_mfc_t; | ||
105 | |||
106 | #define CISTPL_MAX_ALTSTR_STRINGS 4 | ||
107 | |||
108 | typedef struct cistpl_altstr_t { | ||
109 | u_char ns; | ||
110 | u_char ofs[CISTPL_MAX_ALTSTR_STRINGS]; | ||
111 | char str[254]; | ||
112 | } cistpl_altstr_t; | ||
113 | |||
114 | #define CISTPL_DTYPE_NULL 0x00 | ||
115 | #define CISTPL_DTYPE_ROM 0x01 | ||
116 | #define CISTPL_DTYPE_OTPROM 0x02 | ||
117 | #define CISTPL_DTYPE_EPROM 0x03 | ||
118 | #define CISTPL_DTYPE_EEPROM 0x04 | ||
119 | #define CISTPL_DTYPE_FLASH 0x05 | ||
120 | #define CISTPL_DTYPE_SRAM 0x06 | ||
121 | #define CISTPL_DTYPE_DRAM 0x07 | ||
122 | #define CISTPL_DTYPE_FUNCSPEC 0x0d | ||
123 | #define CISTPL_DTYPE_EXTEND 0x0e | ||
124 | |||
125 | #define CISTPL_MAX_DEVICES 4 | ||
126 | |||
127 | typedef struct cistpl_device_t { | ||
128 | u_char ndev; | ||
129 | struct { | ||
130 | u_char type; | ||
131 | u_char wp; | ||
132 | u_int speed; | ||
133 | u_int size; | ||
134 | } dev[CISTPL_MAX_DEVICES]; | ||
135 | } cistpl_device_t; | ||
136 | |||
137 | #define CISTPL_DEVICE_MWAIT 0x01 | ||
138 | #define CISTPL_DEVICE_3VCC 0x02 | ||
139 | |||
140 | typedef struct cistpl_device_o_t { | ||
141 | u_char flags; | ||
142 | cistpl_device_t device; | ||
143 | } cistpl_device_o_t; | ||
144 | |||
145 | #define CISTPL_VERS_1_MAX_PROD_STRINGS 4 | ||
146 | |||
147 | typedef struct cistpl_vers_1_t { | ||
148 | u_char major; | ||
149 | u_char minor; | ||
150 | u_char ns; | ||
151 | u_char ofs[CISTPL_VERS_1_MAX_PROD_STRINGS]; | ||
152 | char str[254]; | ||
153 | } cistpl_vers_1_t; | ||
154 | |||
155 | typedef struct cistpl_jedec_t { | ||
156 | u_char nid; | ||
157 | struct { | ||
158 | u_char mfr; | ||
159 | u_char info; | ||
160 | } id[CISTPL_MAX_DEVICES]; | ||
161 | } cistpl_jedec_t; | ||
162 | |||
163 | typedef struct cistpl_manfid_t { | ||
164 | u_short manf; | ||
165 | u_short card; | ||
166 | } cistpl_manfid_t; | ||
167 | |||
168 | #define CISTPL_FUNCID_MULTI 0x00 | ||
169 | #define CISTPL_FUNCID_MEMORY 0x01 | ||
170 | #define CISTPL_FUNCID_SERIAL 0x02 | ||
171 | #define CISTPL_FUNCID_PARALLEL 0x03 | ||
172 | #define CISTPL_FUNCID_FIXED 0x04 | ||
173 | #define CISTPL_FUNCID_VIDEO 0x05 | ||
174 | #define CISTPL_FUNCID_NETWORK 0x06 | ||
175 | #define CISTPL_FUNCID_AIMS 0x07 | ||
176 | #define CISTPL_FUNCID_SCSI 0x08 | ||
177 | |||
178 | #define CISTPL_SYSINIT_POST 0x01 | ||
179 | #define CISTPL_SYSINIT_ROM 0x02 | ||
180 | |||
181 | typedef struct cistpl_funcid_t { | ||
182 | u_char func; | ||
183 | u_char sysinit; | ||
184 | } cistpl_funcid_t; | ||
185 | |||
186 | typedef struct cistpl_funce_t { | ||
187 | u_char type; | ||
188 | u_char data[0]; | ||
189 | } cistpl_funce_t; | ||
190 | |||
191 | /*====================================================================== | ||
192 | |||
193 | Modem Function Extension Tuples | ||
194 | |||
195 | ======================================================================*/ | ||
196 | |||
197 | #define CISTPL_FUNCE_SERIAL_IF 0x00 | ||
198 | #define CISTPL_FUNCE_SERIAL_CAP 0x01 | ||
199 | #define CISTPL_FUNCE_SERIAL_SERV_DATA 0x02 | ||
200 | #define CISTPL_FUNCE_SERIAL_SERV_FAX 0x03 | ||
201 | #define CISTPL_FUNCE_SERIAL_SERV_VOICE 0x04 | ||
202 | #define CISTPL_FUNCE_SERIAL_CAP_DATA 0x05 | ||
203 | #define CISTPL_FUNCE_SERIAL_CAP_FAX 0x06 | ||
204 | #define CISTPL_FUNCE_SERIAL_CAP_VOICE 0x07 | ||
205 | #define CISTPL_FUNCE_SERIAL_IF_DATA 0x08 | ||
206 | #define CISTPL_FUNCE_SERIAL_IF_FAX 0x09 | ||
207 | #define CISTPL_FUNCE_SERIAL_IF_VOICE 0x0a | ||
208 | |||
209 | /* UART identification */ | ||
210 | #define CISTPL_SERIAL_UART_8250 0x00 | ||
211 | #define CISTPL_SERIAL_UART_16450 0x01 | ||
212 | #define CISTPL_SERIAL_UART_16550 0x02 | ||
213 | #define CISTPL_SERIAL_UART_8251 0x03 | ||
214 | #define CISTPL_SERIAL_UART_8530 0x04 | ||
215 | #define CISTPL_SERIAL_UART_85230 0x05 | ||
216 | |||
217 | /* UART capabilities */ | ||
218 | #define CISTPL_SERIAL_UART_SPACE 0x01 | ||
219 | #define CISTPL_SERIAL_UART_MARK 0x02 | ||
220 | #define CISTPL_SERIAL_UART_ODD 0x04 | ||
221 | #define CISTPL_SERIAL_UART_EVEN 0x08 | ||
222 | #define CISTPL_SERIAL_UART_5BIT 0x01 | ||
223 | #define CISTPL_SERIAL_UART_6BIT 0x02 | ||
224 | #define CISTPL_SERIAL_UART_7BIT 0x04 | ||
225 | #define CISTPL_SERIAL_UART_8BIT 0x08 | ||
226 | #define CISTPL_SERIAL_UART_1STOP 0x10 | ||
227 | #define CISTPL_SERIAL_UART_MSTOP 0x20 | ||
228 | #define CISTPL_SERIAL_UART_2STOP 0x40 | ||
229 | |||
230 | typedef struct cistpl_serial_t { | ||
231 | u_char uart_type; | ||
232 | u_char uart_cap_0; | ||
233 | u_char uart_cap_1; | ||
234 | } cistpl_serial_t; | ||
235 | |||
236 | typedef struct cistpl_modem_cap_t { | ||
237 | u_char flow; | ||
238 | u_char cmd_buf; | ||
239 | u_char rcv_buf_0, rcv_buf_1, rcv_buf_2; | ||
240 | u_char xmit_buf_0, xmit_buf_1, xmit_buf_2; | ||
241 | } cistpl_modem_cap_t; | ||
242 | |||
243 | #define CISTPL_SERIAL_MOD_103 0x01 | ||
244 | #define CISTPL_SERIAL_MOD_V21 0x02 | ||
245 | #define CISTPL_SERIAL_MOD_V23 0x04 | ||
246 | #define CISTPL_SERIAL_MOD_V22 0x08 | ||
247 | #define CISTPL_SERIAL_MOD_212A 0x10 | ||
248 | #define CISTPL_SERIAL_MOD_V22BIS 0x20 | ||
249 | #define CISTPL_SERIAL_MOD_V26 0x40 | ||
250 | #define CISTPL_SERIAL_MOD_V26BIS 0x80 | ||
251 | #define CISTPL_SERIAL_MOD_V27BIS 0x01 | ||
252 | #define CISTPL_SERIAL_MOD_V29 0x02 | ||
253 | #define CISTPL_SERIAL_MOD_V32 0x04 | ||
254 | #define CISTPL_SERIAL_MOD_V32BIS 0x08 | ||
255 | #define CISTPL_SERIAL_MOD_V34 0x10 | ||
256 | |||
257 | #define CISTPL_SERIAL_ERR_MNP2_4 0x01 | ||
258 | #define CISTPL_SERIAL_ERR_V42_LAPM 0x02 | ||
259 | |||
260 | #define CISTPL_SERIAL_CMPR_V42BIS 0x01 | ||
261 | #define CISTPL_SERIAL_CMPR_MNP5 0x02 | ||
262 | |||
263 | #define CISTPL_SERIAL_CMD_AT1 0x01 | ||
264 | #define CISTPL_SERIAL_CMD_AT2 0x02 | ||
265 | #define CISTPL_SERIAL_CMD_AT3 0x04 | ||
266 | #define CISTPL_SERIAL_CMD_MNP_AT 0x08 | ||
267 | #define CISTPL_SERIAL_CMD_V25BIS 0x10 | ||
268 | #define CISTPL_SERIAL_CMD_V25A 0x20 | ||
269 | #define CISTPL_SERIAL_CMD_DMCL 0x40 | ||
270 | |||
271 | typedef struct cistpl_data_serv_t { | ||
272 | u_char max_data_0; | ||
273 | u_char max_data_1; | ||
274 | u_char modulation_0; | ||
275 | u_char modulation_1; | ||
276 | u_char error_control; | ||
277 | u_char compression; | ||
278 | u_char cmd_protocol; | ||
279 | u_char escape; | ||
280 | u_char encrypt; | ||
281 | u_char misc_features; | ||
282 | u_char ccitt_code[0]; | ||
283 | } cistpl_data_serv_t; | ||
284 | |||
285 | typedef struct cistpl_fax_serv_t { | ||
286 | u_char max_data_0; | ||
287 | u_char max_data_1; | ||
288 | u_char modulation; | ||
289 | u_char encrypt; | ||
290 | u_char features_0; | ||
291 | u_char features_1; | ||
292 | u_char ccitt_code[0]; | ||
293 | } cistpl_fax_serv_t; | ||
294 | |||
295 | typedef struct cistpl_voice_serv_t { | ||
296 | u_char max_data_0; | ||
297 | u_char max_data_1; | ||
298 | } cistpl_voice_serv_t; | ||
299 | |||
300 | /*====================================================================== | ||
301 | |||
302 | LAN Function Extension Tuples | ||
303 | |||
304 | ======================================================================*/ | ||
305 | |||
306 | #define CISTPL_FUNCE_LAN_TECH 0x01 | ||
307 | #define CISTPL_FUNCE_LAN_SPEED 0x02 | ||
308 | #define CISTPL_FUNCE_LAN_MEDIA 0x03 | ||
309 | #define CISTPL_FUNCE_LAN_NODE_ID 0x04 | ||
310 | #define CISTPL_FUNCE_LAN_CONNECTOR 0x05 | ||
311 | |||
312 | /* LAN technologies */ | ||
313 | #define CISTPL_LAN_TECH_ARCNET 0x01 | ||
314 | #define CISTPL_LAN_TECH_ETHERNET 0x02 | ||
315 | #define CISTPL_LAN_TECH_TOKENRING 0x03 | ||
316 | #define CISTPL_LAN_TECH_LOCALTALK 0x04 | ||
317 | #define CISTPL_LAN_TECH_FDDI 0x05 | ||
318 | #define CISTPL_LAN_TECH_ATM 0x06 | ||
319 | #define CISTPL_LAN_TECH_WIRELESS 0x07 | ||
320 | |||
321 | typedef struct cistpl_lan_tech_t { | ||
322 | u_char tech; | ||
323 | } cistpl_lan_tech_t; | ||
324 | |||
325 | typedef struct cistpl_lan_speed_t { | ||
326 | u_int speed; | ||
327 | } cistpl_lan_speed_t; | ||
328 | |||
329 | /* LAN media definitions */ | ||
330 | #define CISTPL_LAN_MEDIA_UTP 0x01 | ||
331 | #define CISTPL_LAN_MEDIA_STP 0x02 | ||
332 | #define CISTPL_LAN_MEDIA_THIN_COAX 0x03 | ||
333 | #define CISTPL_LAN_MEDIA_THICK_COAX 0x04 | ||
334 | #define CISTPL_LAN_MEDIA_FIBER 0x05 | ||
335 | #define CISTPL_LAN_MEDIA_900MHZ 0x06 | ||
336 | #define CISTPL_LAN_MEDIA_2GHZ 0x07 | ||
337 | #define CISTPL_LAN_MEDIA_5GHZ 0x08 | ||
338 | #define CISTPL_LAN_MEDIA_DIFF_IR 0x09 | ||
339 | #define CISTPL_LAN_MEDIA_PTP_IR 0x0a | ||
340 | |||
341 | typedef struct cistpl_lan_media_t { | ||
342 | u_char media; | ||
343 | } cistpl_lan_media_t; | ||
344 | |||
345 | typedef struct cistpl_lan_node_id_t { | ||
346 | u_char nb; | ||
347 | u_char id[16]; | ||
348 | } cistpl_lan_node_id_t; | ||
349 | |||
350 | typedef struct cistpl_lan_connector_t { | ||
351 | u_char code; | ||
352 | } cistpl_lan_connector_t; | ||
353 | |||
354 | /*====================================================================== | ||
355 | |||
356 | IDE Function Extension Tuples | ||
357 | |||
358 | ======================================================================*/ | ||
359 | |||
360 | #define CISTPL_IDE_INTERFACE 0x01 | ||
361 | |||
362 | typedef struct cistpl_ide_interface_t { | ||
363 | u_char interface; | ||
364 | } cistpl_ide_interface_t; | ||
365 | |||
366 | /* First feature byte */ | ||
367 | #define CISTPL_IDE_SILICON 0x04 | ||
368 | #define CISTPL_IDE_UNIQUE 0x08 | ||
369 | #define CISTPL_IDE_DUAL 0x10 | ||
370 | |||
371 | /* Second feature byte */ | ||
372 | #define CISTPL_IDE_HAS_SLEEP 0x01 | ||
373 | #define CISTPL_IDE_HAS_STANDBY 0x02 | ||
374 | #define CISTPL_IDE_HAS_IDLE 0x04 | ||
375 | #define CISTPL_IDE_LOW_POWER 0x08 | ||
376 | #define CISTPL_IDE_REG_INHIBIT 0x10 | ||
377 | #define CISTPL_IDE_HAS_INDEX 0x20 | ||
378 | #define CISTPL_IDE_IOIS16 0x40 | ||
379 | |||
380 | typedef struct cistpl_ide_feature_t { | ||
381 | u_char feature1; | ||
382 | u_char feature2; | ||
383 | } cistpl_ide_feature_t; | ||
384 | |||
385 | #define CISTPL_FUNCE_IDE_IFACE 0x01 | ||
386 | #define CISTPL_FUNCE_IDE_MASTER 0x02 | ||
387 | #define CISTPL_FUNCE_IDE_SLAVE 0x03 | ||
388 | |||
389 | /*====================================================================== | ||
390 | |||
391 | Configuration Table Entries | ||
392 | |||
393 | ======================================================================*/ | ||
394 | |||
395 | #define CISTPL_BAR_SPACE 0x07 | ||
396 | #define CISTPL_BAR_SPACE_IO 0x10 | ||
397 | #define CISTPL_BAR_PREFETCH 0x20 | ||
398 | #define CISTPL_BAR_CACHEABLE 0x40 | ||
399 | #define CISTPL_BAR_1MEG_MAP 0x80 | ||
400 | |||
401 | typedef struct cistpl_bar_t { | ||
402 | u_char attr; | ||
403 | u_int size; | ||
404 | } cistpl_bar_t; | ||
405 | |||
406 | typedef struct cistpl_config_t { | ||
407 | u_char last_idx; | ||
408 | u_int base; | ||
409 | u_int rmask[4]; | ||
410 | u_char subtuples; | ||
411 | } cistpl_config_t; | ||
412 | |||
413 | /* These are bits in the 'present' field, and indices in 'param' */ | ||
414 | #define CISTPL_POWER_VNOM 0 | ||
415 | #define CISTPL_POWER_VMIN 1 | ||
416 | #define CISTPL_POWER_VMAX 2 | ||
417 | #define CISTPL_POWER_ISTATIC 3 | ||
418 | #define CISTPL_POWER_IAVG 4 | ||
419 | #define CISTPL_POWER_IPEAK 5 | ||
420 | #define CISTPL_POWER_IDOWN 6 | ||
421 | |||
422 | #define CISTPL_POWER_HIGHZ_OK 0x01 | ||
423 | #define CISTPL_POWER_HIGHZ_REQ 0x02 | ||
424 | |||
425 | typedef struct cistpl_power_t { | ||
426 | u_char present; | ||
427 | u_char flags; | ||
428 | u_int param[7]; | ||
429 | } cistpl_power_t; | ||
430 | |||
431 | typedef struct cistpl_timing_t { | ||
432 | u_int wait, waitscale; | ||
433 | u_int ready, rdyscale; | ||
434 | u_int reserved, rsvscale; | ||
435 | } cistpl_timing_t; | ||
436 | |||
437 | #define CISTPL_IO_LINES_MASK 0x1f | ||
438 | #define CISTPL_IO_8BIT 0x20 | ||
439 | #define CISTPL_IO_16BIT 0x40 | ||
440 | #define CISTPL_IO_RANGE 0x80 | ||
441 | |||
442 | #define CISTPL_IO_MAX_WIN 16 | ||
443 | |||
444 | typedef struct cistpl_io_t { | ||
445 | u_char flags; | ||
446 | u_char nwin; | ||
447 | struct { | ||
448 | u_int base; | ||
449 | u_int len; | ||
450 | } win[CISTPL_IO_MAX_WIN]; | ||
451 | } cistpl_io_t; | ||
452 | |||
453 | typedef struct cistpl_irq_t { | ||
454 | u_int IRQInfo1; | ||
455 | u_int IRQInfo2; | ||
456 | } cistpl_irq_t; | ||
457 | |||
458 | #define CISTPL_MEM_MAX_WIN 8 | ||
459 | |||
460 | typedef struct cistpl_mem_t { | ||
461 | u_char flags; | ||
462 | u_char nwin; | ||
463 | struct { | ||
464 | u_int len; | ||
465 | u_int card_addr; | ||
466 | u_int host_addr; | ||
467 | } win[CISTPL_MEM_MAX_WIN]; | ||
468 | } cistpl_mem_t; | ||
469 | |||
470 | #define CISTPL_CFTABLE_DEFAULT 0x0001 | ||
471 | #define CISTPL_CFTABLE_BVDS 0x0002 | ||
472 | #define CISTPL_CFTABLE_WP 0x0004 | ||
473 | #define CISTPL_CFTABLE_RDYBSY 0x0008 | ||
474 | #define CISTPL_CFTABLE_MWAIT 0x0010 | ||
475 | #define CISTPL_CFTABLE_AUDIO 0x0800 | ||
476 | #define CISTPL_CFTABLE_READONLY 0x1000 | ||
477 | #define CISTPL_CFTABLE_PWRDOWN 0x2000 | ||
478 | |||
479 | typedef struct cistpl_cftable_entry_t { | ||
480 | u_char index; | ||
481 | u_short flags; | ||
482 | u_char interface; | ||
483 | cistpl_power_t vcc, vpp1, vpp2; | ||
484 | cistpl_timing_t timing; | ||
485 | cistpl_io_t io; | ||
486 | cistpl_irq_t irq; | ||
487 | cistpl_mem_t mem; | ||
488 | u_char subtuples; | ||
489 | } cistpl_cftable_entry_t; | ||
490 | |||
491 | #define CISTPL_CFTABLE_MASTER 0x000100 | ||
492 | #define CISTPL_CFTABLE_INVALIDATE 0x000200 | ||
493 | #define CISTPL_CFTABLE_VGA_PALETTE 0x000400 | ||
494 | #define CISTPL_CFTABLE_PARITY 0x000800 | ||
495 | #define CISTPL_CFTABLE_WAIT 0x001000 | ||
496 | #define CISTPL_CFTABLE_SERR 0x002000 | ||
497 | #define CISTPL_CFTABLE_FAST_BACK 0x004000 | ||
498 | #define CISTPL_CFTABLE_BINARY_AUDIO 0x010000 | ||
499 | #define CISTPL_CFTABLE_PWM_AUDIO 0x020000 | ||
500 | |||
501 | typedef struct cistpl_cftable_entry_cb_t { | ||
502 | u_char index; | ||
503 | u_int flags; | ||
504 | cistpl_power_t vcc, vpp1, vpp2; | ||
505 | u_char io; | ||
506 | cistpl_irq_t irq; | ||
507 | u_char mem; | ||
508 | u_char subtuples; | ||
509 | } cistpl_cftable_entry_cb_t; | ||
510 | |||
511 | typedef struct cistpl_device_geo_t { | ||
512 | u_char ngeo; | ||
513 | struct { | ||
514 | u_char buswidth; | ||
515 | u_int erase_block; | ||
516 | u_int read_block; | ||
517 | u_int write_block; | ||
518 | u_int partition; | ||
519 | u_int interleave; | ||
520 | } geo[CISTPL_MAX_DEVICES]; | ||
521 | } cistpl_device_geo_t; | ||
522 | |||
523 | typedef struct cistpl_vers_2_t { | ||
524 | u_char vers; | ||
525 | u_char comply; | ||
526 | u_short dindex; | ||
527 | u_char vspec8, vspec9; | ||
528 | u_char nhdr; | ||
529 | u_char vendor, info; | ||
530 | char str[244]; | ||
531 | } cistpl_vers_2_t; | ||
532 | |||
533 | typedef struct cistpl_org_t { | ||
534 | u_char data_org; | ||
535 | char desc[30]; | ||
536 | } cistpl_org_t; | ||
537 | |||
538 | #define CISTPL_ORG_FS 0x00 | ||
539 | #define CISTPL_ORG_APPSPEC 0x01 | ||
540 | #define CISTPL_ORG_XIP 0x02 | ||
541 | |||
542 | typedef struct cistpl_format_t { | ||
543 | u_char type; | ||
544 | u_char edc; | ||
545 | u_int offset; | ||
546 | u_int length; | ||
547 | } cistpl_format_t; | ||
548 | |||
549 | #define CISTPL_FORMAT_DISK 0x00 | ||
550 | #define CISTPL_FORMAT_MEM 0x01 | ||
551 | |||
552 | #define CISTPL_EDC_NONE 0x00 | ||
553 | #define CISTPL_EDC_CKSUM 0x01 | ||
554 | #define CISTPL_EDC_CRC 0x02 | ||
555 | #define CISTPL_EDC_PCC 0x03 | ||
556 | |||
557 | typedef union cisparse_t { | ||
558 | cistpl_device_t device; | ||
559 | cistpl_checksum_t checksum; | ||
560 | cistpl_longlink_t longlink; | ||
561 | cistpl_longlink_mfc_t longlink_mfc; | ||
562 | cistpl_vers_1_t version_1; | ||
563 | cistpl_altstr_t altstr; | ||
564 | cistpl_jedec_t jedec; | ||
565 | cistpl_manfid_t manfid; | ||
566 | cistpl_funcid_t funcid; | ||
567 | cistpl_funce_t funce; | ||
568 | cistpl_bar_t bar; | ||
569 | cistpl_config_t config; | ||
570 | cistpl_cftable_entry_t cftable_entry; | ||
571 | cistpl_cftable_entry_cb_t cftable_entry_cb; | ||
572 | cistpl_device_geo_t device_geo; | ||
573 | cistpl_vers_2_t vers_2; | ||
574 | cistpl_org_t org; | ||
575 | cistpl_format_t format; | ||
576 | } cisparse_t; | ||
577 | |||
578 | typedef struct tuple_t { | ||
579 | u_int Attributes; | ||
580 | cisdata_t DesiredTuple; | ||
581 | u_int Flags; /* internal use */ | ||
582 | u_int LinkOffset; /* internal use */ | ||
583 | u_int CISOffset; /* internal use */ | ||
584 | cisdata_t TupleCode; | ||
585 | cisdata_t TupleLink; | ||
586 | cisdata_t TupleOffset; | ||
587 | cisdata_t TupleDataMax; | ||
588 | cisdata_t TupleDataLen; | ||
589 | cisdata_t *TupleData; | ||
590 | } tuple_t; | ||
591 | |||
592 | /* Special cisdata_t value */ | ||
593 | #define RETURN_FIRST_TUPLE 0xff | ||
594 | |||
595 | /* Attributes for tuple calls */ | ||
596 | #define TUPLE_RETURN_LINK 0x01 | ||
597 | #define TUPLE_RETURN_COMMON 0x02 | ||
598 | |||
599 | /* For ValidateCIS */ | ||
600 | typedef struct cisinfo_t { | ||
601 | u_int Chains; | ||
602 | } cisinfo_t; | ||
603 | |||
604 | #define CISTPL_MAX_CIS_SIZE 0x200 | ||
605 | |||
606 | /* For ReplaceCIS */ | ||
607 | typedef struct cisdump_t { | ||
608 | u_int Length; | ||
609 | cisdata_t Data[CISTPL_MAX_CIS_SIZE]; | ||
610 | } cisdump_t; | ||
611 | |||
612 | #endif /* LINUX_CISTPL_H */ | ||
613 | |||
614 | /* For AccessConfigurationRegister */ | ||
615 | typedef struct conf_reg_t { | ||
616 | u_char Function; | ||
617 | u_int Action; | ||
618 | off_t Offset; | ||
619 | u_int Value; | ||
620 | } conf_reg_t; | ||
621 | |||
622 | /* Actions */ | ||
623 | #define CS_READ 1 | ||
624 | #define CS_WRITE 2 | ||
625 | |||
626 | /* for AdjustResourceInfo */ | ||
627 | typedef struct adjust_t { | ||
628 | u_int Action; | ||
629 | u_int Resource; | ||
630 | u_int Attributes; | ||
631 | union { | ||
632 | struct memory { | ||
633 | u_long Base; | ||
634 | u_long Size; | ||
635 | } memory; | ||
636 | struct io { | ||
637 | ioaddr_t BasePort; | ||
638 | ioaddr_t NumPorts; | ||
639 | u_int IOAddrLines; | ||
640 | } io; | ||
641 | struct irq { | ||
642 | u_int IRQ; | ||
643 | } irq; | ||
644 | } resource; | ||
645 | } adjust_t; | ||
646 | |||
647 | /* Action field */ | ||
648 | #define REMOVE_MANAGED_RESOURCE 1 | ||
649 | #define ADD_MANAGED_RESOURCE 2 | ||
650 | #define GET_FIRST_MANAGED_RESOURCE 3 | ||
651 | #define GET_NEXT_MANAGED_RESOURCE 4 | ||
652 | /* Resource field */ | ||
653 | #define RES_MEMORY_RANGE 1 | ||
654 | #define RES_IO_RANGE 2 | ||
655 | #define RES_IRQ 3 | ||
656 | /* Attribute field */ | ||
657 | #define RES_IRQ_TYPE 0x03 | ||
658 | #define RES_IRQ_TYPE_EXCLUSIVE 0 | ||
659 | #define RES_IRQ_TYPE_TIME 1 | ||
660 | #define RES_IRQ_TYPE_DYNAMIC 2 | ||
661 | #define RES_IRQ_CSC 0x04 | ||
662 | #define RES_SHARED 0x08 | ||
663 | #define RES_RESERVED 0x10 | ||
664 | #define RES_ALLOCATED 0x20 | ||
665 | #define RES_REMOVED 0x40 | ||
666 | |||
667 | typedef struct servinfo_t { | ||
668 | char Signature[2]; | ||
669 | u_int Count; | ||
670 | u_int Revision; | ||
671 | u_int CSLevel; | ||
672 | char *VendorString; | ||
673 | } servinfo_t; | ||
674 | |||
675 | typedef struct event_callback_args_t { | ||
676 | client_handle_t client_handle; | ||
677 | void *info; | ||
678 | void *mtdrequest; | ||
679 | void *buffer; | ||
680 | void *misc; | ||
681 | void *client_data; | ||
682 | struct bus_operations *bus; | ||
683 | } event_callback_args_t; | ||
684 | |||
685 | /* for GetConfigurationInfo */ | ||
686 | typedef struct config_info_t { | ||
687 | u_char Function; | ||
688 | u_int Attributes; | ||
689 | u_int Vcc, Vpp1, Vpp2; | ||
690 | u_int IntType; | ||
691 | u_int ConfigBase; | ||
692 | u_char Status, Pin, Copy, Option, ExtStatus; | ||
693 | u_int Present; | ||
694 | u_int CardValues; | ||
695 | u_int AssignedIRQ; | ||
696 | u_int IRQAttributes; | ||
697 | ioaddr_t BasePort1; | ||
698 | ioaddr_t NumPorts1; | ||
699 | u_int Attributes1; | ||
700 | ioaddr_t BasePort2; | ||
701 | ioaddr_t NumPorts2; | ||
702 | u_int Attributes2; | ||
703 | u_int IOAddrLines; | ||
704 | } config_info_t; | ||
705 | |||
706 | /* For CardValues field */ | ||
707 | #define CV_OPTION_VALUE 0x01 | ||
708 | #define CV_STATUS_VALUE 0x02 | ||
709 | #define CV_PIN_REPLACEMENT 0x04 | ||
710 | #define CV_COPY_VALUE 0x08 | ||
711 | #define CV_EXT_STATUS 0x10 | ||
712 | |||
713 | /* For GetFirst/NextClient */ | ||
714 | typedef struct client_req_t { | ||
715 | socket_t Socket; | ||
716 | u_int Attributes; | ||
717 | } client_req_t; | ||
718 | |||
719 | #define CLIENT_THIS_SOCKET 0x01 | ||
720 | |||
721 | /* For RegisterClient */ | ||
722 | typedef struct client_reg_t { | ||
723 | dev_info_t *dev_info; | ||
724 | u_int Attributes; | ||
725 | u_int EventMask; | ||
726 | int (*event_handler)(event_t event, int priority, | ||
727 | event_callback_args_t *); | ||
728 | event_callback_args_t event_callback_args; | ||
729 | u_int Version; | ||
730 | } client_reg_t; | ||
731 | |||
732 | /* ModifyConfiguration */ | ||
733 | typedef struct modconf_t { | ||
734 | u_int Attributes; | ||
735 | u_int Vcc, Vpp1, Vpp2; | ||
736 | } modconf_t; | ||
737 | |||
738 | /* Attributes for ModifyConfiguration */ | ||
739 | #define CONF_IRQ_CHANGE_VALID 0x100 | ||
740 | #define CONF_VCC_CHANGE_VALID 0x200 | ||
741 | #define CONF_VPP1_CHANGE_VALID 0x400 | ||
742 | #define CONF_VPP2_CHANGE_VALID 0x800 | ||
743 | |||
744 | /* For RequestConfiguration */ | ||
745 | typedef struct config_req_t { | ||
746 | u_int Attributes; | ||
747 | u_int Vcc, Vpp1, Vpp2; | ||
748 | u_int IntType; | ||
749 | u_int ConfigBase; | ||
750 | u_char Status, Pin, Copy, ExtStatus; | ||
751 | u_char ConfigIndex; | ||
752 | u_int Present; | ||
753 | } config_req_t; | ||
754 | |||
755 | /* Attributes for RequestConfiguration */ | ||
756 | #define CONF_ENABLE_IRQ 0x01 | ||
757 | #define CONF_ENABLE_DMA 0x02 | ||
758 | #define CONF_ENABLE_SPKR 0x04 | ||
759 | #define CONF_VALID_CLIENT 0x100 | ||
760 | |||
761 | /* IntType field */ | ||
762 | #define INT_MEMORY 0x01 | ||
763 | #define INT_MEMORY_AND_IO 0x02 | ||
764 | #define INT_CARDBUS 0x04 | ||
765 | #define INT_ZOOMED_VIDEO 0x08 | ||
766 | |||
767 | /* For RequestIO and ReleaseIO */ | ||
768 | typedef struct io_req_t { | ||
769 | ioaddr_t BasePort1; | ||
770 | ioaddr_t NumPorts1; | ||
771 | u_int Attributes1; | ||
772 | ioaddr_t BasePort2; | ||
773 | ioaddr_t NumPorts2; | ||
774 | u_int Attributes2; | ||
775 | u_int IOAddrLines; | ||
776 | } io_req_t; | ||
777 | |||
778 | /* Attributes for RequestIO and ReleaseIO */ | ||
779 | #define IO_SHARED 0x01 | ||
780 | #define IO_FIRST_SHARED 0x02 | ||
781 | #define IO_FORCE_ALIAS_ACCESS 0x04 | ||
782 | #define IO_DATA_PATH_WIDTH 0x18 | ||
783 | #define IO_DATA_PATH_WIDTH_8 0x00 | ||
784 | #define IO_DATA_PATH_WIDTH_16 0x08 | ||
785 | #define IO_DATA_PATH_WIDTH_AUTO 0x10 | ||
786 | |||
787 | /* For RequestIRQ and ReleaseIRQ */ | ||
788 | typedef struct irq_req_t { | ||
789 | u_int Attributes; | ||
790 | u_int AssignedIRQ; | ||
791 | u_int IRQInfo1, IRQInfo2; | ||
792 | void *Handler; | ||
793 | void *Instance; | ||
794 | } irq_req_t; | ||
795 | |||
796 | /* Attributes for RequestIRQ and ReleaseIRQ */ | ||
797 | #define IRQ_TYPE 0x03 | ||
798 | #define IRQ_TYPE_EXCLUSIVE 0x00 | ||
799 | #define IRQ_TYPE_TIME 0x01 | ||
800 | #define IRQ_TYPE_DYNAMIC_SHARING 0x02 | ||
801 | #define IRQ_FORCED_PULSE 0x04 | ||
802 | #define IRQ_FIRST_SHARED 0x08 | ||
803 | #define IRQ_HANDLE_PRESENT 0x10 | ||
804 | #define IRQ_PULSE_ALLOCATED 0x100 | ||
805 | |||
806 | /* Bits in IRQInfo1 field */ | ||
807 | #define IRQ_MASK 0x0f | ||
808 | #define IRQ_NMI_ID 0x01 | ||
809 | #define IRQ_IOCK_ID 0x02 | ||
810 | #define IRQ_BERR_ID 0x04 | ||
811 | #define IRQ_VEND_ID 0x08 | ||
812 | #define IRQ_INFO2_VALID 0x10 | ||
813 | #define IRQ_LEVEL_ID 0x20 | ||
814 | #define IRQ_PULSE_ID 0x40 | ||
815 | #define IRQ_SHARE_ID 0x80 | ||
816 | |||
817 | typedef struct eventmask_t { | ||
818 | u_int Attributes; | ||
819 | u_int EventMask; | ||
820 | } eventmask_t; | ||
821 | |||
822 | #define CONF_EVENT_MASK_VALID 0x01 | ||
823 | |||
824 | /* Configuration registers present */ | ||
825 | #define PRESENT_OPTION 0x001 | ||
826 | #define PRESENT_STATUS 0x002 | ||
827 | #define PRESENT_PIN_REPLACE 0x004 | ||
828 | #define PRESENT_COPY 0x008 | ||
829 | #define PRESENT_EXT_STATUS 0x010 | ||
830 | #define PRESENT_IOBASE_0 0x020 | ||
831 | #define PRESENT_IOBASE_1 0x040 | ||
832 | #define PRESENT_IOBASE_2 0x080 | ||
833 | #define PRESENT_IOBASE_3 0x100 | ||
834 | #define PRESENT_IOSIZE 0x200 | ||
835 | |||
836 | /* For GetMemPage, MapMemPage */ | ||
837 | typedef struct memreq_t { | ||
838 | u_int CardOffset; | ||
839 | page_t Page; | ||
840 | } memreq_t; | ||
841 | |||
842 | /* For ModifyWindow */ | ||
843 | typedef struct modwin_t { | ||
844 | u_int Attributes; | ||
845 | u_int AccessSpeed; | ||
846 | } modwin_t; | ||
847 | |||
848 | /* For RequestWindow */ | ||
849 | typedef struct win_req_t { | ||
850 | u_int Attributes; | ||
851 | u_long Base; | ||
852 | u_int Size; | ||
853 | u_int AccessSpeed; | ||
854 | } win_req_t; | ||
855 | |||
856 | /* Attributes for RequestWindow */ | ||
857 | #define WIN_ADDR_SPACE 0x0001 | ||
858 | #define WIN_ADDR_SPACE_MEM 0x0000 | ||
859 | #define WIN_ADDR_SPACE_IO 0x0001 | ||
860 | #define WIN_MEMORY_TYPE 0x0002 | ||
861 | #define WIN_MEMORY_TYPE_CM 0x0000 | ||
862 | #define WIN_MEMORY_TYPE_AM 0x0002 | ||
863 | #define WIN_ENABLE 0x0004 | ||
864 | #define WIN_DATA_WIDTH 0x0018 | ||
865 | #define WIN_DATA_WIDTH_8 0x0000 | ||
866 | #define WIN_DATA_WIDTH_16 0x0008 | ||
867 | #define WIN_DATA_WIDTH_32 0x0010 | ||
868 | #define WIN_PAGED 0x0020 | ||
869 | #define WIN_SHARED 0x0040 | ||
870 | #define WIN_FIRST_SHARED 0x0080 | ||
871 | #define WIN_USE_WAIT 0x0100 | ||
872 | #define WIN_STRICT_ALIGN 0x0200 | ||
873 | #define WIN_MAP_BELOW_1MB 0x0400 | ||
874 | #define WIN_PREFETCH 0x0800 | ||
875 | #define WIN_CACHEABLE 0x1000 | ||
876 | #define WIN_BAR_MASK 0xe000 | ||
877 | #define WIN_BAR_SHIFT 13 | ||
878 | |||
879 | /* Attributes for RegisterClient */ | ||
880 | #define INFO_MASTER_CLIENT 0x01 | ||
881 | #define INFO_IO_CLIENT 0x02 | ||
882 | #define INFO_MTD_CLIENT 0x04 | ||
883 | #define INFO_MEM_CLIENT 0x08 | ||
884 | #define MAX_NUM_CLIENTS 3 | ||
885 | |||
886 | #define INFO_CARD_SHARE 0x10 | ||
887 | #define INFO_CARD_EXCL 0x20 | ||
888 | |||
889 | typedef struct cs_status_t { | ||
890 | u_char Function; | ||
891 | event_t CardState; | ||
892 | event_t SocketState; | ||
893 | } cs_status_t; | ||
894 | |||
895 | typedef struct error_info_t { | ||
896 | int func; | ||
897 | int retcode; | ||
898 | } error_info_t; | ||
899 | |||
900 | /* Special stuff for binding drivers to sockets */ | ||
901 | typedef struct bind_req_t { | ||
902 | socket_t Socket; | ||
903 | u_char Function; | ||
904 | dev_info_t *dev_info; | ||
905 | } bind_req_t; | ||
906 | |||
907 | /* Flag to bind to all functions */ | ||
908 | #define BIND_FN_ALL 0xff | ||
909 | |||
910 | typedef struct mtd_bind_t { | ||
911 | socket_t Socket; | ||
912 | u_int Attributes; | ||
913 | u_int CardOffset; | ||
914 | dev_info_t *dev_info; | ||
915 | } mtd_bind_t; | ||
916 | |||
917 | /* For GetFirstRegion and GetNextRegion */ | ||
918 | typedef struct region_info_t { | ||
919 | u_int Attributes; | ||
920 | u_int CardOffset; | ||
921 | u_int RegionSize; | ||
922 | u_int AccessSpeed; | ||
923 | u_int BlockSize; | ||
924 | u_int PartMultiple; | ||
925 | u_char JedecMfr, JedecInfo; | ||
926 | memory_handle_t next; | ||
927 | } region_info_t; | ||
928 | |||
929 | #define REGION_TYPE 0x0001 | ||
930 | #define REGION_TYPE_CM 0x0000 | ||
931 | #define REGION_TYPE_AM 0x0001 | ||
932 | #define REGION_PREFETCH 0x0008 | ||
933 | #define REGION_CACHEABLE 0x0010 | ||
934 | #define REGION_BAR_MASK 0xe000 | ||
935 | #define REGION_BAR_SHIFT 13 | ||
936 | |||
937 | /* For OpenMemory */ | ||
938 | typedef struct open_mem_t { | ||
939 | u_int Attributes; | ||
940 | u_int Offset; | ||
941 | } open_mem_t; | ||
942 | |||
943 | /* Attributes for OpenMemory */ | ||
944 | #define MEMORY_TYPE 0x0001 | ||
945 | #define MEMORY_TYPE_CM 0x0000 | ||
946 | #define MEMORY_TYPE_AM 0x0001 | ||
947 | #define MEMORY_EXCLUSIVE 0x0002 | ||
948 | #define MEMORY_PREFETCH 0x0008 | ||
949 | #define MEMORY_CACHEABLE 0x0010 | ||
950 | #define MEMORY_BAR_MASK 0xe000 | ||
951 | #define MEMORY_BAR_SHIFT 13 | ||
952 | |||
953 | typedef struct eraseq_entry_t { | ||
954 | memory_handle_t Handle; | ||
955 | u_char State; | ||
956 | u_int Size; | ||
957 | u_int Offset; | ||
958 | void *Optional; | ||
959 | } eraseq_entry_t; | ||
960 | |||
961 | typedef struct eraseq_hdr_t { | ||
962 | int QueueEntryCnt; | ||
963 | eraseq_entry_t *QueueEntryArray; | ||
964 | } eraseq_hdr_t; | ||
965 | |||
966 | /* Events */ | ||
967 | #define CS_EVENT_PRI_LOW 0 | ||
968 | #define CS_EVENT_PRI_HIGH 1 | ||
969 | |||
970 | #define CS_EVENT_WRITE_PROTECT 0x000001 | ||
971 | #define CS_EVENT_CARD_LOCK 0x000002 | ||
972 | #define CS_EVENT_CARD_INSERTION 0x000004 | ||
973 | #define CS_EVENT_CARD_REMOVAL 0x000008 | ||
974 | #define CS_EVENT_BATTERY_DEAD 0x000010 | ||
975 | #define CS_EVENT_BATTERY_LOW 0x000020 | ||
976 | #define CS_EVENT_READY_CHANGE 0x000040 | ||
977 | #define CS_EVENT_CARD_DETECT 0x000080 | ||
978 | #define CS_EVENT_RESET_REQUEST 0x000100 | ||
979 | #define CS_EVENT_RESET_PHYSICAL 0x000200 | ||
980 | #define CS_EVENT_CARD_RESET 0x000400 | ||
981 | #define CS_EVENT_REGISTRATION_COMPLETE 0x000800 | ||
982 | #define CS_EVENT_RESET_COMPLETE 0x001000 | ||
983 | #define CS_EVENT_PM_SUSPEND 0x002000 | ||
984 | #define CS_EVENT_PM_RESUME 0x004000 | ||
985 | #define CS_EVENT_INSERTION_REQUEST 0x008000 | ||
986 | #define CS_EVENT_EJECTION_REQUEST 0x010000 | ||
987 | #define CS_EVENT_MTD_REQUEST 0x020000 | ||
988 | #define CS_EVENT_ERASE_COMPLETE 0x040000 | ||
989 | #define CS_EVENT_REQUEST_ATTENTION 0x080000 | ||
990 | #define CS_EVENT_CB_DETECT 0x100000 | ||
991 | #define CS_EVENT_3VCARD 0x200000 | ||
992 | #define CS_EVENT_XVCARD 0x400000 | ||
993 | |||
994 | /* Return codes */ | ||
995 | #define CS_SUCCESS 0x00 | ||
996 | #define CS_BAD_ADAPTER 0x01 | ||
997 | #define CS_BAD_ATTRIBUTE 0x02 | ||
998 | #define CS_BAD_BASE 0x03 | ||
999 | #define CS_BAD_EDC 0x04 | ||
1000 | #define CS_BAD_IRQ 0x06 | ||
1001 | #define CS_BAD_OFFSET 0x07 | ||
1002 | #define CS_BAD_PAGE 0x08 | ||
1003 | #define CS_READ_FAILURE 0x09 | ||
1004 | #define CS_BAD_SIZE 0x0a | ||
1005 | #define CS_BAD_SOCKET 0x0b | ||
1006 | #define CS_BAD_TYPE 0x0d | ||
1007 | #define CS_BAD_VCC 0x0e | ||
1008 | #define CS_BAD_VPP 0x0f | ||
1009 | #define CS_BAD_WINDOW 0x11 | ||
1010 | #define CS_WRITE_FAILURE 0x12 | ||
1011 | #define CS_NO_CARD 0x14 | ||
1012 | #define CS_UNSUPPORTED_FUNCTION 0x15 | ||
1013 | #define CS_UNSUPPORTED_MODE 0x16 | ||
1014 | #define CS_BAD_SPEED 0x17 | ||
1015 | #define CS_BUSY 0x18 | ||
1016 | #define CS_GENERAL_FAILURE 0x19 | ||
1017 | #define CS_WRITE_PROTECTED 0x1a | ||
1018 | #define CS_BAD_ARG_LENGTH 0x1b | ||
1019 | #define CS_BAD_ARGS 0x1c | ||
1020 | #define CS_CONFIGURATION_LOCKED 0x1d | ||
1021 | #define CS_IN_USE 0x1e | ||
1022 | #define CS_NO_MORE_ITEMS 0x1f | ||
1023 | #define CS_OUT_OF_RESOURCE 0x20 | ||
1024 | #define CS_BAD_HANDLE 0x21 | ||
1025 | |||
1026 | #define CS_BAD_TUPLE 0x40 | ||
1027 | |||
1028 | |||
1029 | |||
1030 | typedef struct tuple_parse_t { | ||
1031 | tuple_t tuple; | ||
1032 | cisdata_t data[255]; | ||
1033 | cisparse_t parse; | ||
1034 | } tuple_parse_t; | ||
1035 | |||
1036 | typedef struct win_info_t { | ||
1037 | window_handle_thandle; | ||
1038 | win_req_t window; | ||
1039 | memreq_t map; | ||
1040 | } win_info_t; | ||
1041 | |||
1042 | typedef struct bind_info_t { | ||
1043 | dev_info_t dev_info; | ||
1044 | u_char function; | ||
1045 | struct dev_link_t*instance; | ||
1046 | char name[DEV_NAME_LEN]; | ||
1047 | u_short major, minor; | ||
1048 | void *next; | ||
1049 | } bind_info_t; | ||
1050 | |||
1051 | typedef struct mtd_info_t { | ||
1052 | dev_info_t dev_info; | ||
1053 | u_int Attributes; | ||
1054 | u_int CardOffset; | ||
1055 | } mtd_info_t; | ||
1056 | |||
1057 | typedef union ds_ioctl_arg_t { | ||
1058 | servinfo_t servinfo; | ||
1059 | adjust_t adjust; | ||
1060 | config_info_tconfig; | ||
1061 | tuple_t tuple; | ||
1062 | tuple_parse_ttuple_parse; | ||
1063 | client_req_tclient_req; | ||
1064 | cs_status_t status; | ||
1065 | conf_reg_t conf_reg; | ||
1066 | cisinfo_t cisinfo; | ||
1067 | region_info_tregion; | ||
1068 | bind_info_t bind_info; | ||
1069 | mtd_info_t mtd_info; | ||
1070 | win_info_t win_info; | ||
1071 | cisdump_t cisdump; | ||
1072 | } ds_ioctl_arg_t; | ||
1073 | |||
1074 | #define DS_GET_CARD_SERVICES_INFO_IOR ('d', 1, servinfo_t) | ||
1075 | #define DS_ADJUST_RESOURCE_INFO _IOWR('d', 2, adjust_t) | ||
1076 | #define DS_GET_CONFIGURATION_INFO_IOWR('d', 3, config_info_t) | ||
1077 | #define DS_GET_FIRST_TUPLE _IOWR('d', 4, tuple_t) | ||
1078 | #define DS_GET_NEXT_TUPLE _IOWR('d', 5, tuple_t) | ||
1079 | #define DS_GET_TUPLE_DATA _IOWR('d', 6, tuple_parse_t) | ||
1080 | #define DS_PARSE_TUPLE _IOWR('d', 7, tuple_parse_t) | ||
1081 | #define DS_RESET_CARD _IO ('d', 8) | ||
1082 | #define DS_GET_STATUS _IOWR('d', 9, cs_status_t) | ||
1083 | #define DS_ACCESS_CONFIGURATION_REGISTER _IOWR('d', 10, conf_reg_t) | ||
1084 | #define DS_VALIDATE_CIS _IOR ('d', 11, cisinfo_t) | ||
1085 | #define DS_SUSPEND_CARD _IO ('d', 12) | ||
1086 | #define DS_RESUME_CARD _IO ('d', 13) | ||
1087 | #define DS_EJECT_CARD _IO ('d', 14) | ||
1088 | #define DS_INSERT_CARD _IO ('d', 15) | ||
1089 | #define DS_GET_FIRST_REGION _IOWR('d', 16, region_info_t) | ||
1090 | #define DS_GET_NEXT_REGION _IOWR('d', 17, region_info_t) | ||
1091 | #define DS_REPLACE_CIS _IOWR('d', 18, cisdump_t) | ||
1092 | #define DS_GET_FIRST_WINDOW _IOR ('d', 19, win_info_t) | ||
1093 | #define DS_GET_NEXT_WINDOW _IOWR('d', 20, win_info_t) | ||
1094 | #define DS_GET_MEM_PAGE _IOWR('d', 21, win_info_t) | ||
1095 | |||
1096 | #define DS_BIND_REQUEST _IOWR('d', 60, bind_info_t) | ||
1097 | #define DS_GET_DEVICE_INFO _IOWR('d', 61, bind_info_t) | ||
1098 | #define DS_GET_NEXT_DEVICE _IOWR('d', 62, bind_info_t) | ||
1099 | #define DS_UNBIND_REQUEST _IOW ('d', 63, bind_info_t) | ||
1100 | #define DS_BIND_MTD _IOWR('d', 64, mtd_info_t) | ||