Import 2.3.18pre1
[davej-history.git] / include / pcmcia / cistpl.h
blob200665387368fe7457fcbe0db5aa40a309453131
1 /*
2 * cistpl.h 1.30 1999/08/28 04:12:32
4 * The contents of this file are subject to the Mozilla Public License
5 * Version 1.1 (the "License"); you may not use this file except in
6 * compliance with the License. You may obtain a copy of the License
7 * at http://www.mozilla.org/MPL/
9 * Software distributed under the License is distributed on an "AS IS"
10 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
11 * the License for the specific language governing rights and
12 * limitations under the License.
14 * The initial developer of the original code is David A. Hinds
15 * <dhinds@hyper.stanford.edu>. Portions created by David A. Hinds
16 * are Copyright (C) 1999 David A. Hinds. All Rights Reserved.
18 * Alternatively, the contents of this file may be used under the
19 * terms of the GNU Public License version 2 (the "GPL"), in which
20 * case the provisions of the GPL are applicable instead of the
21 * above. If you wish to allow the use of your version of this file
22 * only under the terms of the GPL and not to allow others to use
23 * your version of this file under the MPL, indicate your decision by
24 * deleting the provisions above and replace them with the notice and
25 * other provisions required by the GPL. If you do not delete the
26 * provisions above, a recipient may use your version of this file
27 * under either the MPL or the GPL.
30 #ifndef _LINUX_CISTPL_H
31 #define _LINUX_CISTPL_H
33 #define CISTPL_NULL 0x00
34 #define CISTPL_DEVICE 0x01
35 #define CISTPL_LONGLINK_CB 0x02
36 #define CISTPL_CONFIG_CB 0x04
37 #define CISTPL_CFTABLE_ENTRY_CB 0x05
38 #define CISTPL_LONGLINK_MFC 0x06
39 #define CISTPL_BAR 0x07
40 #define CISTPL_CHECKSUM 0x10
41 #define CISTPL_LONGLINK_A 0x11
42 #define CISTPL_LONGLINK_C 0x12
43 #define CISTPL_LINKTARGET 0x13
44 #define CISTPL_NO_LINK 0x14
45 #define CISTPL_VERS_1 0x15
46 #define CISTPL_ALTSTR 0x16
47 #define CISTPL_DEVICE_A 0x17
48 #define CISTPL_JEDEC_C 0x18
49 #define CISTPL_JEDEC_A 0x19
50 #define CISTPL_CONFIG 0x1a
51 #define CISTPL_CFTABLE_ENTRY 0x1b
52 #define CISTPL_DEVICE_OC 0x1c
53 #define CISTPL_DEVICE_OA 0x1d
54 #define CISTPL_DEVICE_GEO 0x1e
55 #define CISTPL_DEVICE_GEO_A 0x1f
56 #define CISTPL_MANFID 0x20
57 #define CISTPL_FUNCID 0x21
58 #define CISTPL_FUNCE 0x22
59 #define CISTPL_SWIL 0x23
60 #define CISTPL_END 0xff
61 /* Layer 2 tuples */
62 #define CISTPL_VERS_2 0x40
63 #define CISTPL_FORMAT 0x41
64 #define CISTPL_GEOMETRY 0x42
65 #define CISTPL_BYTEORDER 0x43
66 #define CISTPL_DATE 0x44
67 #define CISTPL_BATTERY 0x45
68 /* Layer 3 tuples */
69 #define CISTPL_ORG 0x46
71 typedef struct cistpl_longlink_t {
72 u_int addr;
73 } cistpl_longlink_t;
75 typedef struct cistpl_checksum_t {
76 u_short addr;
77 u_short len;
78 u_char sum;
79 } cistpl_checksum_t;
81 #define CISTPL_MAX_FUNCTIONS 8
82 #define CISTPL_MFC_ATTR 0x00
83 #define CISTPL_MFC_COMMON 0x01
85 typedef struct cistpl_longlink_mfc_t {
86 u_char nfn;
87 struct {
88 u_char space;
89 u_int addr;
90 } fn[CISTPL_MAX_FUNCTIONS];
91 } cistpl_longlink_mfc_t;
93 #define CISTPL_MAX_ALTSTR_STRINGS 4
95 typedef struct cistpl_altstr_t {
96 u_char ns;
97 u_char ofs[CISTPL_MAX_ALTSTR_STRINGS];
98 char str[254];
99 } cistpl_altstr_t;
101 #define CISTPL_DTYPE_NULL 0x00
102 #define CISTPL_DTYPE_ROM 0x01
103 #define CISTPL_DTYPE_OTPROM 0x02
104 #define CISTPL_DTYPE_EPROM 0x03
105 #define CISTPL_DTYPE_EEPROM 0x04
106 #define CISTPL_DTYPE_FLASH 0x05
107 #define CISTPL_DTYPE_SRAM 0x06
108 #define CISTPL_DTYPE_DRAM 0x07
109 #define CISTPL_DTYPE_FUNCSPEC 0x0d
110 #define CISTPL_DTYPE_EXTEND 0x0e
112 #define CISTPL_MAX_DEVICES 4
114 typedef struct cistpl_device_t {
115 u_char ndev;
116 struct {
117 u_char type;
118 u_char wp;
119 u_int speed;
120 u_int size;
121 } dev[CISTPL_MAX_DEVICES];
122 } cistpl_device_t;
124 #define CISTPL_DEVICE_MWAIT 0x01
125 #define CISTPL_DEVICE_3VCC 0x02
127 typedef struct cistpl_device_o_t {
128 u_char flags;
129 cistpl_device_t device;
130 } cistpl_device_o_t;
132 #define CISTPL_VERS_1_MAX_PROD_STRINGS 4
134 typedef struct cistpl_vers_1_t {
135 u_char major;
136 u_char minor;
137 u_char ns;
138 u_char ofs[CISTPL_VERS_1_MAX_PROD_STRINGS];
139 char str[254];
140 } cistpl_vers_1_t;
142 typedef struct cistpl_jedec_t {
143 u_char nid;
144 struct {
145 u_char mfr;
146 u_char info;
147 } id[CISTPL_MAX_DEVICES];
148 } cistpl_jedec_t;
150 typedef struct cistpl_manfid_t {
151 u_short manf;
152 u_short card;
153 } cistpl_manfid_t;
155 #define CISTPL_FUNCID_MULTI 0x00
156 #define CISTPL_FUNCID_MEMORY 0x01
157 #define CISTPL_FUNCID_SERIAL 0x02
158 #define CISTPL_FUNCID_PARALLEL 0x03
159 #define CISTPL_FUNCID_FIXED 0x04
160 #define CISTPL_FUNCID_VIDEO 0x05
161 #define CISTPL_FUNCID_NETWORK 0x06
162 #define CISTPL_FUNCID_AIMS 0x07
163 #define CISTPL_FUNCID_SCSI 0x08
165 #define CISTPL_SYSINIT_POST 0x01
166 #define CISTPL_SYSINIT_ROM 0x02
168 typedef struct cistpl_funcid_t {
169 u_char func;
170 u_char sysinit;
171 } cistpl_funcid_t;
173 typedef struct cistpl_funce_t {
174 u_char type;
175 u_char data[0];
176 } cistpl_funce_t;
178 /*======================================================================
180 Modem Function Extension Tuples
182 ======================================================================*/
184 #define CISTPL_FUNCE_SERIAL_IF 0x00
185 #define CISTPL_FUNCE_SERIAL_CAP 0x01
186 #define CISTPL_FUNCE_SERIAL_SERV_DATA 0x02
187 #define CISTPL_FUNCE_SERIAL_SERV_FAX 0x03
188 #define CISTPL_FUNCE_SERIAL_SERV_VOICE 0x04
189 #define CISTPL_FUNCE_SERIAL_CAP_DATA 0x05
190 #define CISTPL_FUNCE_SERIAL_CAP_FAX 0x06
191 #define CISTPL_FUNCE_SERIAL_CAP_VOICE 0x07
192 #define CISTPL_FUNCE_SERIAL_IF_DATA 0x08
193 #define CISTPL_FUNCE_SERIAL_IF_FAX 0x09
194 #define CISTPL_FUNCE_SERIAL_IF_VOICE 0x0a
196 /* UART identification */
197 #define CISTPL_SERIAL_UART_8250 0x00
198 #define CISTPL_SERIAL_UART_16450 0x01
199 #define CISTPL_SERIAL_UART_16550 0x02
200 #define CISTPL_SERIAL_UART_8251 0x03
201 #define CISTPL_SERIAL_UART_8530 0x04
202 #define CISTPL_SERIAL_UART_85230 0x05
204 /* UART capabilities */
205 #define CISTPL_SERIAL_UART_SPACE 0x01
206 #define CISTPL_SERIAL_UART_MARK 0x02
207 #define CISTPL_SERIAL_UART_ODD 0x04
208 #define CISTPL_SERIAL_UART_EVEN 0x08
209 #define CISTPL_SERIAL_UART_5BIT 0x01
210 #define CISTPL_SERIAL_UART_6BIT 0x02
211 #define CISTPL_SERIAL_UART_7BIT 0x04
212 #define CISTPL_SERIAL_UART_8BIT 0x08
213 #define CISTPL_SERIAL_UART_1STOP 0x10
214 #define CISTPL_SERIAL_UART_MSTOP 0x20
215 #define CISTPL_SERIAL_UART_2STOP 0x40
217 typedef struct cistpl_serial_t {
218 u_char uart_type;
219 u_char uart_cap_0;
220 u_char uart_cap_1;
221 } cistpl_serial_t;
223 typedef struct cistpl_modem_cap_t {
224 u_char flow;
225 u_char cmd_buf;
226 u_char rcv_buf_0, rcv_buf_1, rcv_buf_2;
227 u_char xmit_buf_0, xmit_buf_1, xmit_buf_2;
228 } cistpl_modem_cap_t;
230 #define CISTPL_SERIAL_MOD_103 0x01
231 #define CISTPL_SERIAL_MOD_V21 0x02
232 #define CISTPL_SERIAL_MOD_V23 0x04
233 #define CISTPL_SERIAL_MOD_V22 0x08
234 #define CISTPL_SERIAL_MOD_212A 0x10
235 #define CISTPL_SERIAL_MOD_V22BIS 0x20
236 #define CISTPL_SERIAL_MOD_V26 0x40
237 #define CISTPL_SERIAL_MOD_V26BIS 0x80
238 #define CISTPL_SERIAL_MOD_V27BIS 0x01
239 #define CISTPL_SERIAL_MOD_V29 0x02
240 #define CISTPL_SERIAL_MOD_V32 0x04
241 #define CISTPL_SERIAL_MOD_V32BIS 0x08
242 #define CISTPL_SERIAL_MOD_V34 0x10
244 #define CISTPL_SERIAL_ERR_MNP2_4 0x01
245 #define CISTPL_SERIAL_ERR_V42_LAPM 0x02
247 #define CISTPL_SERIAL_CMPR_V42BIS 0x01
248 #define CISTPL_SERIAL_CMPR_MNP5 0x02
250 #define CISTPL_SERIAL_CMD_AT1 0x01
251 #define CISTPL_SERIAL_CMD_AT2 0x02
252 #define CISTPL_SERIAL_CMD_AT3 0x04
253 #define CISTPL_SERIAL_CMD_MNP_AT 0x08
254 #define CISTPL_SERIAL_CMD_V25BIS 0x10
255 #define CISTPL_SERIAL_CMD_V25A 0x20
256 #define CISTPL_SERIAL_CMD_DMCL 0x40
258 typedef struct cistpl_data_serv_t {
259 u_char max_data_0;
260 u_char max_data_1;
261 u_char modulation_0;
262 u_char modulation_1;
263 u_char error_control;
264 u_char compression;
265 u_char cmd_protocol;
266 u_char escape;
267 u_char encrypt;
268 u_char misc_features;
269 u_char ccitt_code[0];
270 } cistpl_data_serv_t;
272 typedef struct cistpl_fax_serv_t {
273 u_char max_data_0;
274 u_char max_data_1;
275 u_char modulation;
276 u_char encrypt;
277 u_char features_0;
278 u_char features_1;
279 u_char ccitt_code[0];
280 } cistpl_fax_serv_t;
282 typedef struct cistpl_voice_serv_t {
283 u_char max_data_0;
284 u_char max_data_1;
285 } cistpl_voice_serv_t;
287 /*======================================================================
289 LAN Function Extension Tuples
291 ======================================================================*/
293 #define CISTPL_FUNCE_LAN_TECH 0x01
294 #define CISTPL_FUNCE_LAN_SPEED 0x02
295 #define CISTPL_FUNCE_LAN_MEDIA 0x03
296 #define CISTPL_FUNCE_LAN_NODE_ID 0x04
297 #define CISTPL_FUNCE_LAN_CONNECTOR 0x05
299 /* LAN technologies */
300 #define CISTPL_LAN_TECH_ARCNET 0x01
301 #define CISTPL_LAN_TECH_ETHERNET 0x02
302 #define CISTPL_LAN_TECH_TOKENRING 0x03
303 #define CISTPL_LAN_TECH_LOCALTALK 0x04
304 #define CISTPL_LAN_TECH_FDDI 0x05
305 #define CISTPL_LAN_TECH_ATM 0x06
306 #define CISTPL_LAN_TECH_WIRELESS 0x07
308 typedef struct cistpl_lan_tech_t {
309 u_char tech;
310 } cistpl_lan_tech_t;
312 typedef struct cistpl_lan_speed_t {
313 u_int speed;
314 } cistpl_lan_speed_t;
316 /* LAN media definitions */
317 #define CISTPL_LAN_MEDIA_UTP 0x01
318 #define CISTPL_LAN_MEDIA_STP 0x02
319 #define CISTPL_LAN_MEDIA_THIN_COAX 0x03
320 #define CISTPL_LAN_MEDIA_THICK_COAX 0x04
321 #define CISTPL_LAN_MEDIA_FIBER 0x05
322 #define CISTPL_LAN_MEDIA_900MHZ 0x06
323 #define CISTPL_LAN_MEDIA_2GHZ 0x07
324 #define CISTPL_LAN_MEDIA_5GHZ 0x08
325 #define CISTPL_LAN_MEDIA_DIFF_IR 0x09
326 #define CISTPL_LAN_MEDIA_PTP_IR 0x0a
328 typedef struct cistpl_lan_media_t {
329 u_char media;
330 } cistpl_lan_media_t;
332 typedef struct cistpl_lan_node_id_t {
333 u_char nb;
334 u_char id[16];
335 } cistpl_lan_node_id_t;
337 typedef struct cistpl_lan_connector_t {
338 u_char code;
339 } cistpl_lan_connector_t;
341 /*======================================================================
343 IDE Function Extension Tuples
345 ======================================================================*/
347 #define CISTPL_IDE_INTERFACE 0x01
349 typedef struct cistpl_ide_interface_t {
350 u_char interface;
351 } cistpl_ide_interface_t;
353 /* First feature byte */
354 #define CISTPL_IDE_SILICON 0x04
355 #define CISTPL_IDE_UNIQUE 0x08
356 #define CISTPL_IDE_DUAL 0x10
358 /* Second feature byte */
359 #define CISTPL_IDE_HAS_SLEEP 0x01
360 #define CISTPL_IDE_HAS_STANDBY 0x02
361 #define CISTPL_IDE_HAS_IDLE 0x04
362 #define CISTPL_IDE_LOW_POWER 0x08
363 #define CISTPL_IDE_REG_INHIBIT 0x10
364 #define CISTPL_IDE_HAS_INDEX 0x20
365 #define CISTPL_IDE_IOIS16 0x40
367 typedef struct cistpl_ide_feature_t {
368 u_char feature1;
369 u_char feature2;
370 } cistpl_ide_feature_t;
372 #define CISTPL_FUNCE_IDE_IFACE 0x01
373 #define CISTPL_FUNCE_IDE_MASTER 0x02
374 #define CISTPL_FUNCE_IDE_SLAVE 0x03
376 /*======================================================================
378 Configuration Table Entries
380 ======================================================================*/
382 #define CISTPL_BAR_SPACE 0x07
383 #define CISTPL_BAR_SPACE_IO 0x10
384 #define CISTPL_BAR_PREFETCH 0x20
385 #define CISTPL_BAR_CACHEABLE 0x40
386 #define CISTPL_BAR_1MEG_MAP 0x80
388 typedef struct cistpl_bar_t {
389 u_char attr;
390 u_int size;
391 } cistpl_bar_t;
393 typedef struct cistpl_config_t {
394 u_char last_idx;
395 u_int base;
396 u_int rmask[4];
397 u_char subtuples;
398 } cistpl_config_t;
400 /* These are bits in the 'present' field, and indices in 'param' */
401 #define CISTPL_POWER_VNOM 0
402 #define CISTPL_POWER_VMIN 1
403 #define CISTPL_POWER_VMAX 2
404 #define CISTPL_POWER_ISTATIC 3
405 #define CISTPL_POWER_IAVG 4
406 #define CISTPL_POWER_IPEAK 5
407 #define CISTPL_POWER_IDOWN 6
409 #define CISTPL_POWER_HIGHZ_OK 0x01
410 #define CISTPL_POWER_HIGHZ_REQ 0x02
412 typedef struct cistpl_power_t {
413 u_char present;
414 u_char flags;
415 u_int param[7];
416 } cistpl_power_t;
418 typedef struct cistpl_timing_t {
419 u_int wait, waitscale;
420 u_int ready, rdyscale;
421 u_int reserved, rsvscale;
422 } cistpl_timing_t;
424 #define CISTPL_IO_LINES_MASK 0x1f
425 #define CISTPL_IO_8BIT 0x20
426 #define CISTPL_IO_16BIT 0x40
427 #define CISTPL_IO_RANGE 0x80
429 #define CISTPL_IO_MAX_WIN 16
431 typedef struct cistpl_io_t {
432 u_char flags;
433 u_char nwin;
434 struct {
435 u_int base;
436 u_int len;
437 } win[CISTPL_IO_MAX_WIN];
438 } cistpl_io_t;
440 typedef struct cistpl_irq_t {
441 u_int IRQInfo1;
442 u_int IRQInfo2;
443 } cistpl_irq_t;
445 #define CISTPL_MEM_MAX_WIN 8
447 typedef struct cistpl_mem_t {
448 u_char flags;
449 u_char nwin;
450 struct {
451 u_int len;
452 u_int card_addr;
453 u_int host_addr;
454 } win[CISTPL_MEM_MAX_WIN];
455 } cistpl_mem_t;
457 #define CISTPL_CFTABLE_DEFAULT 0x0001
458 #define CISTPL_CFTABLE_BVDS 0x0002
459 #define CISTPL_CFTABLE_WP 0x0004
460 #define CISTPL_CFTABLE_RDYBSY 0x0008
461 #define CISTPL_CFTABLE_MWAIT 0x0010
462 #define CISTPL_CFTABLE_AUDIO 0x0800
463 #define CISTPL_CFTABLE_READONLY 0x1000
464 #define CISTPL_CFTABLE_PWRDOWN 0x2000
466 typedef struct cistpl_cftable_entry_t {
467 u_char index;
468 u_short flags;
469 u_char interface;
470 cistpl_power_t vcc, vpp1, vpp2;
471 cistpl_timing_t timing;
472 cistpl_io_t io;
473 cistpl_irq_t irq;
474 cistpl_mem_t mem;
475 u_char subtuples;
476 } cistpl_cftable_entry_t;
478 #define CISTPL_CFTABLE_MASTER 0x000100
479 #define CISTPL_CFTABLE_INVALIDATE 0x000200
480 #define CISTPL_CFTABLE_VGA_PALETTE 0x000400
481 #define CISTPL_CFTABLE_PARITY 0x000800
482 #define CISTPL_CFTABLE_WAIT 0x001000
483 #define CISTPL_CFTABLE_SERR 0x002000
484 #define CISTPL_CFTABLE_FAST_BACK 0x004000
485 #define CISTPL_CFTABLE_BINARY_AUDIO 0x010000
486 #define CISTPL_CFTABLE_PWM_AUDIO 0x020000
488 typedef struct cistpl_cftable_entry_cb_t {
489 u_char index;
490 u_int flags;
491 cistpl_power_t vcc, vpp1, vpp2;
492 u_char io;
493 cistpl_irq_t irq;
494 u_char mem;
495 u_char subtuples;
496 } cistpl_cftable_entry_cb_t;
498 typedef struct cistpl_device_geo_t {
499 u_char ngeo;
500 struct {
501 u_char buswidth;
502 u_int erase_block;
503 u_int read_block;
504 u_int write_block;
505 u_int partition;
506 u_int interleave;
507 } geo[CISTPL_MAX_DEVICES];
508 } cistpl_device_geo_t;
510 typedef struct cistpl_vers_2_t {
511 u_char vers;
512 u_char comply;
513 u_short dindex;
514 u_char vspec8, vspec9;
515 u_char nhdr;
516 u_char vendor, info;
517 char str[244];
518 } cistpl_vers_2_t;
520 typedef struct cistpl_org_t {
521 u_char data_org;
522 char desc[30];
523 } cistpl_org_t;
525 #define CISTPL_ORG_FS 0x00
526 #define CISTPL_ORG_APPSPEC 0x01
527 #define CISTPL_ORG_XIP 0x02
529 typedef union cisparse_t {
530 cistpl_device_t device;
531 cistpl_checksum_t checksum;
532 cistpl_longlink_t longlink;
533 cistpl_longlink_mfc_t longlink_mfc;
534 cistpl_vers_1_t version_1;
535 cistpl_altstr_t altstr;
536 cistpl_jedec_t jedec;
537 cistpl_manfid_t manfid;
538 cistpl_funcid_t funcid;
539 cistpl_funce_t funce;
540 cistpl_bar_t bar;
541 cistpl_config_t config;
542 cistpl_cftable_entry_t cftable_entry;
543 cistpl_cftable_entry_cb_t cftable_entry_cb;
544 cistpl_device_geo_t device_geo;
545 cistpl_vers_2_t vers_2;
546 cistpl_org_t org;
547 } cisparse_t;
549 typedef struct tuple_t {
550 u_int Attributes;
551 cisdata_t DesiredTuple;
552 u_int Flags; /* internal use */
553 u_int LinkOffset; /* internal use */
554 u_int CISOffset; /* internal use */
555 cisdata_t TupleCode;
556 cisdata_t TupleLink;
557 cisdata_t TupleOffset;
558 cisdata_t TupleDataMax;
559 cisdata_t TupleDataLen;
560 cisdata_t *TupleData;
561 } tuple_t;
563 /* Special cisdata_t value */
564 #define RETURN_FIRST_TUPLE 0xff
566 /* Attributes for tuple calls */
567 #define TUPLE_RETURN_LINK 0x01
568 #define TUPLE_RETURN_COMMON 0x02
570 /* For ValidateCIS */
571 typedef struct cisinfo_t {
572 u_int Chains;
573 } cisinfo_t;
575 #define CISTPL_MAX_CIS_SIZE 0x200
577 /* For ReplaceCIS */
578 typedef struct cisdump_t {
579 u_int Length;
580 cisdata_t Data[CISTPL_MAX_CIS_SIZE];
581 } cisdump_t;
583 #endif /* LINUX_CISTPL_H */