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
6 * published by the Free Software Foundation.
8 * The initial developer of the original code is David A. Hinds
9 * <dahinds@users.sourceforge.net>. Portions created by David A. Hinds
10 * are Copyright (C) 1999 David A. Hinds. All Rights Reserved.
12 * (C) 1999 David A. Hinds
15 #ifndef _LINUX_CISTPL_H
16 #define _LINUX_CISTPL_H
18 #define CISTPL_NULL 0x00
19 #define CISTPL_DEVICE 0x01
20 #define CISTPL_LONGLINK_CB 0x02
21 #define CISTPL_INDIRECT 0x03
22 #define CISTPL_CONFIG_CB 0x04
23 #define CISTPL_CFTABLE_ENTRY_CB 0x05
24 #define CISTPL_LONGLINK_MFC 0x06
25 #define CISTPL_BAR 0x07
26 #define CISTPL_PWR_MGMNT 0x08
27 #define CISTPL_EXTDEVICE 0x09
28 #define CISTPL_CHECKSUM 0x10
29 #define CISTPL_LONGLINK_A 0x11
30 #define CISTPL_LONGLINK_C 0x12
31 #define CISTPL_LINKTARGET 0x13
32 #define CISTPL_NO_LINK 0x14
33 #define CISTPL_VERS_1 0x15
34 #define CISTPL_ALTSTR 0x16
35 #define CISTPL_DEVICE_A 0x17
36 #define CISTPL_JEDEC_C 0x18
37 #define CISTPL_JEDEC_A 0x19
38 #define CISTPL_CONFIG 0x1a
39 #define CISTPL_CFTABLE_ENTRY 0x1b
40 #define CISTPL_DEVICE_OC 0x1c
41 #define CISTPL_DEVICE_OA 0x1d
42 #define CISTPL_DEVICE_GEO 0x1e
43 #define CISTPL_DEVICE_GEO_A 0x1f
44 #define CISTPL_MANFID 0x20
45 #define CISTPL_FUNCID 0x21
46 #define CISTPL_FUNCE 0x22
47 #define CISTPL_SWIL 0x23
48 #define CISTPL_END 0xff
50 #define CISTPL_VERS_2 0x40
51 #define CISTPL_FORMAT 0x41
52 #define CISTPL_GEOMETRY 0x42
53 #define CISTPL_BYTEORDER 0x43
54 #define CISTPL_DATE 0x44
55 #define CISTPL_BATTERY 0x45
56 #define CISTPL_FORMAT_A 0x47
58 #define CISTPL_ORG 0x46
59 #define CISTPL_SPCL 0x90
61 typedef struct cistpl_longlink_t {
65 typedef struct cistpl_checksum_t {
71 #define CISTPL_MAX_FUNCTIONS 8
72 #define CISTPL_MFC_ATTR 0x00
73 #define CISTPL_MFC_COMMON 0x01
75 typedef struct cistpl_longlink_mfc_t {
80 } fn[CISTPL_MAX_FUNCTIONS];
81 } cistpl_longlink_mfc_t;
83 #define CISTPL_MAX_ALTSTR_STRINGS 4
85 typedef struct cistpl_altstr_t {
87 u_char ofs[CISTPL_MAX_ALTSTR_STRINGS];
91 #define CISTPL_DTYPE_NULL 0x00
92 #define CISTPL_DTYPE_ROM 0x01
93 #define CISTPL_DTYPE_OTPROM 0x02
94 #define CISTPL_DTYPE_EPROM 0x03
95 #define CISTPL_DTYPE_EEPROM 0x04
96 #define CISTPL_DTYPE_FLASH 0x05
97 #define CISTPL_DTYPE_SRAM 0x06
98 #define CISTPL_DTYPE_DRAM 0x07
99 #define CISTPL_DTYPE_FUNCSPEC 0x0d
100 #define CISTPL_DTYPE_EXTEND 0x0e
102 #define CISTPL_MAX_DEVICES 4
104 typedef struct cistpl_device_t {
111 } dev[CISTPL_MAX_DEVICES];
114 #define CISTPL_DEVICE_MWAIT 0x01
115 #define CISTPL_DEVICE_3VCC 0x02
117 typedef struct cistpl_device_o_t {
119 cistpl_device_t device;
122 #define CISTPL_VERS_1_MAX_PROD_STRINGS 4
124 typedef struct cistpl_vers_1_t {
128 u_char ofs[CISTPL_VERS_1_MAX_PROD_STRINGS];
132 typedef struct cistpl_jedec_t {
137 } id[CISTPL_MAX_DEVICES];
140 typedef struct cistpl_manfid_t {
145 #define CISTPL_FUNCID_MULTI 0x00
146 #define CISTPL_FUNCID_MEMORY 0x01
147 #define CISTPL_FUNCID_SERIAL 0x02
148 #define CISTPL_FUNCID_PARALLEL 0x03
149 #define CISTPL_FUNCID_FIXED 0x04
150 #define CISTPL_FUNCID_VIDEO 0x05
151 #define CISTPL_FUNCID_NETWORK 0x06
152 #define CISTPL_FUNCID_AIMS 0x07
153 #define CISTPL_FUNCID_SCSI 0x08
155 #define CISTPL_SYSINIT_POST 0x01
156 #define CISTPL_SYSINIT_ROM 0x02
158 typedef struct cistpl_funcid_t {
163 typedef struct cistpl_funce_t {
168 /*======================================================================
170 Modem Function Extension Tuples
172 ======================================================================*/
174 #define CISTPL_FUNCE_SERIAL_IF 0x00
175 #define CISTPL_FUNCE_SERIAL_CAP 0x01
176 #define CISTPL_FUNCE_SERIAL_SERV_DATA 0x02
177 #define CISTPL_FUNCE_SERIAL_SERV_FAX 0x03
178 #define CISTPL_FUNCE_SERIAL_SERV_VOICE 0x04
179 #define CISTPL_FUNCE_SERIAL_CAP_DATA 0x05
180 #define CISTPL_FUNCE_SERIAL_CAP_FAX 0x06
181 #define CISTPL_FUNCE_SERIAL_CAP_VOICE 0x07
182 #define CISTPL_FUNCE_SERIAL_IF_DATA 0x08
183 #define CISTPL_FUNCE_SERIAL_IF_FAX 0x09
184 #define CISTPL_FUNCE_SERIAL_IF_VOICE 0x0a
186 /* UART identification */
187 #define CISTPL_SERIAL_UART_8250 0x00
188 #define CISTPL_SERIAL_UART_16450 0x01
189 #define CISTPL_SERIAL_UART_16550 0x02
190 #define CISTPL_SERIAL_UART_8251 0x03
191 #define CISTPL_SERIAL_UART_8530 0x04
192 #define CISTPL_SERIAL_UART_85230 0x05
194 /* UART capabilities */
195 #define CISTPL_SERIAL_UART_SPACE 0x01
196 #define CISTPL_SERIAL_UART_MARK 0x02
197 #define CISTPL_SERIAL_UART_ODD 0x04
198 #define CISTPL_SERIAL_UART_EVEN 0x08
199 #define CISTPL_SERIAL_UART_5BIT 0x01
200 #define CISTPL_SERIAL_UART_6BIT 0x02
201 #define CISTPL_SERIAL_UART_7BIT 0x04
202 #define CISTPL_SERIAL_UART_8BIT 0x08
203 #define CISTPL_SERIAL_UART_1STOP 0x10
204 #define CISTPL_SERIAL_UART_MSTOP 0x20
205 #define CISTPL_SERIAL_UART_2STOP 0x40
207 typedef struct cistpl_serial_t {
213 typedef struct cistpl_modem_cap_t {
216 u_char rcv_buf_0, rcv_buf_1, rcv_buf_2;
217 u_char xmit_buf_0, xmit_buf_1, xmit_buf_2;
218 } cistpl_modem_cap_t;
220 #define CISTPL_SERIAL_MOD_103 0x01
221 #define CISTPL_SERIAL_MOD_V21 0x02
222 #define CISTPL_SERIAL_MOD_V23 0x04
223 #define CISTPL_SERIAL_MOD_V22 0x08
224 #define CISTPL_SERIAL_MOD_212A 0x10
225 #define CISTPL_SERIAL_MOD_V22BIS 0x20
226 #define CISTPL_SERIAL_MOD_V26 0x40
227 #define CISTPL_SERIAL_MOD_V26BIS 0x80
228 #define CISTPL_SERIAL_MOD_V27BIS 0x01
229 #define CISTPL_SERIAL_MOD_V29 0x02
230 #define CISTPL_SERIAL_MOD_V32 0x04
231 #define CISTPL_SERIAL_MOD_V32BIS 0x08
232 #define CISTPL_SERIAL_MOD_V34 0x10
234 #define CISTPL_SERIAL_ERR_MNP2_4 0x01
235 #define CISTPL_SERIAL_ERR_V42_LAPM 0x02
237 #define CISTPL_SERIAL_CMPR_V42BIS 0x01
238 #define CISTPL_SERIAL_CMPR_MNP5 0x02
240 #define CISTPL_SERIAL_CMD_AT1 0x01
241 #define CISTPL_SERIAL_CMD_AT2 0x02
242 #define CISTPL_SERIAL_CMD_AT3 0x04
243 #define CISTPL_SERIAL_CMD_MNP_AT 0x08
244 #define CISTPL_SERIAL_CMD_V25BIS 0x10
245 #define CISTPL_SERIAL_CMD_V25A 0x20
246 #define CISTPL_SERIAL_CMD_DMCL 0x40
248 typedef struct cistpl_data_serv_t {
253 u_char error_control;
258 u_char misc_features;
259 u_char ccitt_code[0];
260 } cistpl_data_serv_t;
262 typedef struct cistpl_fax_serv_t {
269 u_char ccitt_code[0];
272 typedef struct cistpl_voice_serv_t {
275 } cistpl_voice_serv_t;
277 /*======================================================================
279 LAN Function Extension Tuples
281 ======================================================================*/
283 #define CISTPL_FUNCE_LAN_TECH 0x01
284 #define CISTPL_FUNCE_LAN_SPEED 0x02
285 #define CISTPL_FUNCE_LAN_MEDIA 0x03
286 #define CISTPL_FUNCE_LAN_NODE_ID 0x04
287 #define CISTPL_FUNCE_LAN_CONNECTOR 0x05
289 /* LAN technologies */
290 #define CISTPL_LAN_TECH_ARCNET 0x01
291 #define CISTPL_LAN_TECH_ETHERNET 0x02
292 #define CISTPL_LAN_TECH_TOKENRING 0x03
293 #define CISTPL_LAN_TECH_LOCALTALK 0x04
294 #define CISTPL_LAN_TECH_FDDI 0x05
295 #define CISTPL_LAN_TECH_ATM 0x06
296 #define CISTPL_LAN_TECH_WIRELESS 0x07
298 typedef struct cistpl_lan_tech_t {
302 typedef struct cistpl_lan_speed_t {
304 } cistpl_lan_speed_t;
306 /* LAN media definitions */
307 #define CISTPL_LAN_MEDIA_UTP 0x01
308 #define CISTPL_LAN_MEDIA_STP 0x02
309 #define CISTPL_LAN_MEDIA_THIN_COAX 0x03
310 #define CISTPL_LAN_MEDIA_THICK_COAX 0x04
311 #define CISTPL_LAN_MEDIA_FIBER 0x05
312 #define CISTPL_LAN_MEDIA_900MHZ 0x06
313 #define CISTPL_LAN_MEDIA_2GHZ 0x07
314 #define CISTPL_LAN_MEDIA_5GHZ 0x08
315 #define CISTPL_LAN_MEDIA_DIFF_IR 0x09
316 #define CISTPL_LAN_MEDIA_PTP_IR 0x0a
318 typedef struct cistpl_lan_media_t {
320 } cistpl_lan_media_t;
322 typedef struct cistpl_lan_node_id_t {
325 } cistpl_lan_node_id_t;
327 typedef struct cistpl_lan_connector_t {
329 } cistpl_lan_connector_t;
331 /*======================================================================
333 IDE Function Extension Tuples
335 ======================================================================*/
337 #define CISTPL_IDE_INTERFACE 0x01
339 typedef struct cistpl_ide_interface_t {
341 } cistpl_ide_interface_t;
343 /* First feature byte */
344 #define CISTPL_IDE_SILICON 0x04
345 #define CISTPL_IDE_UNIQUE 0x08
346 #define CISTPL_IDE_DUAL 0x10
348 /* Second feature byte */
349 #define CISTPL_IDE_HAS_SLEEP 0x01
350 #define CISTPL_IDE_HAS_STANDBY 0x02
351 #define CISTPL_IDE_HAS_IDLE 0x04
352 #define CISTPL_IDE_LOW_POWER 0x08
353 #define CISTPL_IDE_REG_INHIBIT 0x10
354 #define CISTPL_IDE_HAS_INDEX 0x20
355 #define CISTPL_IDE_IOIS16 0x40
357 typedef struct cistpl_ide_feature_t {
360 } cistpl_ide_feature_t;
362 #define CISTPL_FUNCE_IDE_IFACE 0x01
363 #define CISTPL_FUNCE_IDE_MASTER 0x02
364 #define CISTPL_FUNCE_IDE_SLAVE 0x03
366 /*======================================================================
368 Configuration Table Entries
370 ======================================================================*/
372 #define CISTPL_BAR_SPACE 0x07
373 #define CISTPL_BAR_SPACE_IO 0x10
374 #define CISTPL_BAR_PREFETCH 0x20
375 #define CISTPL_BAR_CACHEABLE 0x40
376 #define CISTPL_BAR_1MEG_MAP 0x80
378 typedef struct cistpl_bar_t {
383 typedef struct cistpl_config_t {
390 /* These are bits in the 'present' field, and indices in 'param' */
391 #define CISTPL_POWER_VNOM 0
392 #define CISTPL_POWER_VMIN 1
393 #define CISTPL_POWER_VMAX 2
394 #define CISTPL_POWER_ISTATIC 3
395 #define CISTPL_POWER_IAVG 4
396 #define CISTPL_POWER_IPEAK 5
397 #define CISTPL_POWER_IDOWN 6
399 #define CISTPL_POWER_HIGHZ_OK 0x01
400 #define CISTPL_POWER_HIGHZ_REQ 0x02
402 typedef struct cistpl_power_t {
408 typedef struct cistpl_timing_t {
409 u_int wait, waitscale;
410 u_int ready, rdyscale;
411 u_int reserved, rsvscale;
414 #define CISTPL_IO_LINES_MASK 0x1f
415 #define CISTPL_IO_8BIT 0x20
416 #define CISTPL_IO_16BIT 0x40
417 #define CISTPL_IO_RANGE 0x80
419 #define CISTPL_IO_MAX_WIN 16
421 typedef struct cistpl_io_t {
427 } win[CISTPL_IO_MAX_WIN];
430 typedef struct cistpl_irq_t {
435 #define CISTPL_MEM_MAX_WIN 8
437 typedef struct cistpl_mem_t {
444 } win[CISTPL_MEM_MAX_WIN];
447 #define CISTPL_CFTABLE_DEFAULT 0x0001
448 #define CISTPL_CFTABLE_BVDS 0x0002
449 #define CISTPL_CFTABLE_WP 0x0004
450 #define CISTPL_CFTABLE_RDYBSY 0x0008
451 #define CISTPL_CFTABLE_MWAIT 0x0010
452 #define CISTPL_CFTABLE_AUDIO 0x0800
453 #define CISTPL_CFTABLE_READONLY 0x1000
454 #define CISTPL_CFTABLE_PWRDOWN 0x2000
456 typedef struct cistpl_cftable_entry_t {
460 cistpl_power_t vcc, vpp1, vpp2;
461 cistpl_timing_t timing;
466 } cistpl_cftable_entry_t;
468 #define CISTPL_CFTABLE_MASTER 0x000100
469 #define CISTPL_CFTABLE_INVALIDATE 0x000200
470 #define CISTPL_CFTABLE_VGA_PALETTE 0x000400
471 #define CISTPL_CFTABLE_PARITY 0x000800
472 #define CISTPL_CFTABLE_WAIT 0x001000
473 #define CISTPL_CFTABLE_SERR 0x002000
474 #define CISTPL_CFTABLE_FAST_BACK 0x004000
475 #define CISTPL_CFTABLE_BINARY_AUDIO 0x010000
476 #define CISTPL_CFTABLE_PWM_AUDIO 0x020000
478 typedef struct cistpl_cftable_entry_cb_t {
481 cistpl_power_t vcc, vpp1, vpp2;
486 } cistpl_cftable_entry_cb_t;
488 typedef struct cistpl_device_geo_t {
497 } geo[CISTPL_MAX_DEVICES];
498 } cistpl_device_geo_t;
500 typedef struct cistpl_vers_2_t {
504 u_char vspec8, vspec9;
510 typedef struct cistpl_org_t {
515 #define CISTPL_ORG_FS 0x00
516 #define CISTPL_ORG_APPSPEC 0x01
517 #define CISTPL_ORG_XIP 0x02
519 typedef struct cistpl_format_t {
526 #define CISTPL_FORMAT_DISK 0x00
527 #define CISTPL_FORMAT_MEM 0x01
529 #define CISTPL_EDC_NONE 0x00
530 #define CISTPL_EDC_CKSUM 0x01
531 #define CISTPL_EDC_CRC 0x02
532 #define CISTPL_EDC_PCC 0x03
534 typedef union cisparse_t {
535 cistpl_device_t device;
536 cistpl_checksum_t checksum;
537 cistpl_longlink_t longlink;
538 cistpl_longlink_mfc_t longlink_mfc;
539 cistpl_vers_1_t version_1;
540 cistpl_altstr_t altstr;
541 cistpl_jedec_t jedec;
542 cistpl_manfid_t manfid;
543 cistpl_funcid_t funcid;
544 cistpl_funce_t funce;
546 cistpl_config_t config;
547 cistpl_cftable_entry_t cftable_entry;
548 cistpl_cftable_entry_cb_t cftable_entry_cb;
549 cistpl_device_geo_t device_geo;
550 cistpl_vers_2_t vers_2;
552 cistpl_format_t format;
555 typedef struct tuple_t {
557 cisdata_t DesiredTuple;
558 u_int Flags; /* internal use */
559 u_int LinkOffset; /* internal use */
560 u_int CISOffset; /* internal use */
563 cisdata_t TupleOffset;
564 cisdata_t TupleDataMax;
565 cisdata_t TupleDataLen;
566 cisdata_t *TupleData;
569 /* Special cisdata_t value */
570 #define RETURN_FIRST_TUPLE 0xff
572 /* Attributes for tuple calls */
573 #define TUPLE_RETURN_LINK 0x01
574 #define TUPLE_RETURN_COMMON 0x02
576 /* For ValidateCIS */
577 typedef struct cisinfo_t {
581 #define CISTPL_MAX_CIS_SIZE 0x200
584 typedef struct cisdump_t {
586 cisdata_t Data[CISTPL_MAX_CIS_SIZE];
590 int pcmcia_replace_cis(struct pcmcia_socket *s, cisdump_t *cis);
592 /* don't use outside of PCMCIA core yet */
593 int pccard_get_next_tuple(struct pcmcia_socket *s, unsigned int func, tuple_t *tuple);
594 int pccard_get_first_tuple(struct pcmcia_socket *s, unsigned int function, tuple_t *tuple);
595 int pccard_get_tuple_data(struct pcmcia_socket *s, tuple_t *tuple);
596 int pccard_parse_tuple(tuple_t *tuple, cisparse_t *parse);
598 int pccard_validate_cis(struct pcmcia_socket *s, unsigned int function, cisinfo_t *info);
600 /* ... but use these wrappers instead */
601 #define pcmcia_get_first_tuple(p_dev, tuple) \
602 pccard_get_first_tuple(p_dev->socket, p_dev->func, tuple)
604 #define pcmcia_get_next_tuple(p_dev, tuple) \
605 pccard_get_next_tuple(p_dev->socket, p_dev->func, tuple)
607 #define pcmcia_get_tuple_data(p_dev, tuple) \
608 pccard_get_tuple_data(p_dev->socket, tuple)
610 #define pcmcia_parse_tuple(p_dev, tuple, parse) \
611 pccard_parse_tuple(tuple, parse)
613 #define pcmcia_validate_cis(p_dev, info) \
614 pccard_validate_cis(p_dev->socket, p_dev->func, info)
616 #endif /* LINUX_CISTPL_H */