1 /* SPDX-License-Identifier: GPL-2.0-only */
5 * The initial developer of the original code is David A. Hinds
6 * <dahinds@users.sourceforge.net>. Portions created by David A. Hinds
7 * are Copyright (C) 1999 David A. Hinds. All Rights Reserved.
9 * (C) 1999 David A. Hinds
12 #ifndef _LINUX_CISTPL_H
13 #define _LINUX_CISTPL_H
15 typedef unsigned char cisdata_t
;
17 #define CISTPL_NULL 0x00
18 #define CISTPL_DEVICE 0x01
19 #define CISTPL_LONGLINK_CB 0x02
20 #define CISTPL_INDIRECT 0x03
21 #define CISTPL_CONFIG_CB 0x04
22 #define CISTPL_CFTABLE_ENTRY_CB 0x05
23 #define CISTPL_LONGLINK_MFC 0x06
24 #define CISTPL_BAR 0x07
25 #define CISTPL_PWR_MGMNT 0x08
26 #define CISTPL_EXTDEVICE 0x09
27 #define CISTPL_CHECKSUM 0x10
28 #define CISTPL_LONGLINK_A 0x11
29 #define CISTPL_LONGLINK_C 0x12
30 #define CISTPL_LINKTARGET 0x13
31 #define CISTPL_NO_LINK 0x14
32 #define CISTPL_VERS_1 0x15
33 #define CISTPL_ALTSTR 0x16
34 #define CISTPL_DEVICE_A 0x17
35 #define CISTPL_JEDEC_C 0x18
36 #define CISTPL_JEDEC_A 0x19
37 #define CISTPL_CONFIG 0x1a
38 #define CISTPL_CFTABLE_ENTRY 0x1b
39 #define CISTPL_DEVICE_OC 0x1c
40 #define CISTPL_DEVICE_OA 0x1d
41 #define CISTPL_DEVICE_GEO 0x1e
42 #define CISTPL_DEVICE_GEO_A 0x1f
43 #define CISTPL_MANFID 0x20
44 #define CISTPL_FUNCID 0x21
45 #define CISTPL_FUNCE 0x22
46 #define CISTPL_SWIL 0x23
47 #define CISTPL_END 0xff
49 #define CISTPL_VERS_2 0x40
50 #define CISTPL_FORMAT 0x41
51 #define CISTPL_GEOMETRY 0x42
52 #define CISTPL_BYTEORDER 0x43
53 #define CISTPL_DATE 0x44
54 #define CISTPL_BATTERY 0x45
55 #define CISTPL_FORMAT_A 0x47
57 #define CISTPL_ORG 0x46
58 #define CISTPL_SPCL 0x90
60 typedef struct cistpl_longlink_t
{
64 typedef struct cistpl_checksum_t
{
70 #define CISTPL_MAX_FUNCTIONS 8
71 #define CISTPL_MFC_ATTR 0x00
72 #define CISTPL_MFC_COMMON 0x01
74 typedef struct cistpl_longlink_mfc_t
{
79 } fn
[CISTPL_MAX_FUNCTIONS
];
80 } cistpl_longlink_mfc_t
;
82 #define CISTPL_MAX_ALTSTR_STRINGS 4
84 typedef struct cistpl_altstr_t
{
86 u_char ofs
[CISTPL_MAX_ALTSTR_STRINGS
];
90 #define CISTPL_DTYPE_NULL 0x00
91 #define CISTPL_DTYPE_ROM 0x01
92 #define CISTPL_DTYPE_OTPROM 0x02
93 #define CISTPL_DTYPE_EPROM 0x03
94 #define CISTPL_DTYPE_EEPROM 0x04
95 #define CISTPL_DTYPE_FLASH 0x05
96 #define CISTPL_DTYPE_SRAM 0x06
97 #define CISTPL_DTYPE_DRAM 0x07
98 #define CISTPL_DTYPE_FUNCSPEC 0x0d
99 #define CISTPL_DTYPE_EXTEND 0x0e
101 #define CISTPL_MAX_DEVICES 4
103 typedef struct cistpl_device_t
{
110 } dev
[CISTPL_MAX_DEVICES
];
113 #define CISTPL_DEVICE_MWAIT 0x01
114 #define CISTPL_DEVICE_3VCC 0x02
116 typedef struct cistpl_device_o_t
{
118 cistpl_device_t device
;
121 #define CISTPL_VERS_1_MAX_PROD_STRINGS 4
123 typedef struct cistpl_vers_1_t
{
127 u_char ofs
[CISTPL_VERS_1_MAX_PROD_STRINGS
];
131 typedef struct cistpl_jedec_t
{
136 } id
[CISTPL_MAX_DEVICES
];
139 typedef struct cistpl_manfid_t
{
144 #define CISTPL_FUNCID_MULTI 0x00
145 #define CISTPL_FUNCID_MEMORY 0x01
146 #define CISTPL_FUNCID_SERIAL 0x02
147 #define CISTPL_FUNCID_PARALLEL 0x03
148 #define CISTPL_FUNCID_FIXED 0x04
149 #define CISTPL_FUNCID_VIDEO 0x05
150 #define CISTPL_FUNCID_NETWORK 0x06
151 #define CISTPL_FUNCID_AIMS 0x07
152 #define CISTPL_FUNCID_SCSI 0x08
154 #define CISTPL_SYSINIT_POST 0x01
155 #define CISTPL_SYSINIT_ROM 0x02
157 typedef struct cistpl_funcid_t
{
162 typedef struct cistpl_funce_t
{
167 /*======================================================================
169 Modem Function Extension Tuples
171 ======================================================================*/
173 #define CISTPL_FUNCE_SERIAL_IF 0x00
174 #define CISTPL_FUNCE_SERIAL_CAP 0x01
175 #define CISTPL_FUNCE_SERIAL_SERV_DATA 0x02
176 #define CISTPL_FUNCE_SERIAL_SERV_FAX 0x03
177 #define CISTPL_FUNCE_SERIAL_SERV_VOICE 0x04
178 #define CISTPL_FUNCE_SERIAL_CAP_DATA 0x05
179 #define CISTPL_FUNCE_SERIAL_CAP_FAX 0x06
180 #define CISTPL_FUNCE_SERIAL_CAP_VOICE 0x07
181 #define CISTPL_FUNCE_SERIAL_IF_DATA 0x08
182 #define CISTPL_FUNCE_SERIAL_IF_FAX 0x09
183 #define CISTPL_FUNCE_SERIAL_IF_VOICE 0x0a
185 /* UART identification */
186 #define CISTPL_SERIAL_UART_8250 0x00
187 #define CISTPL_SERIAL_UART_16450 0x01
188 #define CISTPL_SERIAL_UART_16550 0x02
189 #define CISTPL_SERIAL_UART_8251 0x03
190 #define CISTPL_SERIAL_UART_8530 0x04
191 #define CISTPL_SERIAL_UART_85230 0x05
193 /* UART capabilities */
194 #define CISTPL_SERIAL_UART_SPACE 0x01
195 #define CISTPL_SERIAL_UART_MARK 0x02
196 #define CISTPL_SERIAL_UART_ODD 0x04
197 #define CISTPL_SERIAL_UART_EVEN 0x08
198 #define CISTPL_SERIAL_UART_5BIT 0x01
199 #define CISTPL_SERIAL_UART_6BIT 0x02
200 #define CISTPL_SERIAL_UART_7BIT 0x04
201 #define CISTPL_SERIAL_UART_8BIT 0x08
202 #define CISTPL_SERIAL_UART_1STOP 0x10
203 #define CISTPL_SERIAL_UART_MSTOP 0x20
204 #define CISTPL_SERIAL_UART_2STOP 0x40
206 typedef struct cistpl_serial_t
{
212 typedef struct cistpl_modem_cap_t
{
215 u_char rcv_buf_0
, rcv_buf_1
, rcv_buf_2
;
216 u_char xmit_buf_0
, xmit_buf_1
, xmit_buf_2
;
217 } cistpl_modem_cap_t
;
219 #define CISTPL_SERIAL_MOD_103 0x01
220 #define CISTPL_SERIAL_MOD_V21 0x02
221 #define CISTPL_SERIAL_MOD_V23 0x04
222 #define CISTPL_SERIAL_MOD_V22 0x08
223 #define CISTPL_SERIAL_MOD_212A 0x10
224 #define CISTPL_SERIAL_MOD_V22BIS 0x20
225 #define CISTPL_SERIAL_MOD_V26 0x40
226 #define CISTPL_SERIAL_MOD_V26BIS 0x80
227 #define CISTPL_SERIAL_MOD_V27BIS 0x01
228 #define CISTPL_SERIAL_MOD_V29 0x02
229 #define CISTPL_SERIAL_MOD_V32 0x04
230 #define CISTPL_SERIAL_MOD_V32BIS 0x08
231 #define CISTPL_SERIAL_MOD_V34 0x10
233 #define CISTPL_SERIAL_ERR_MNP2_4 0x01
234 #define CISTPL_SERIAL_ERR_V42_LAPM 0x02
236 #define CISTPL_SERIAL_CMPR_V42BIS 0x01
237 #define CISTPL_SERIAL_CMPR_MNP5 0x02
239 #define CISTPL_SERIAL_CMD_AT1 0x01
240 #define CISTPL_SERIAL_CMD_AT2 0x02
241 #define CISTPL_SERIAL_CMD_AT3 0x04
242 #define CISTPL_SERIAL_CMD_MNP_AT 0x08
243 #define CISTPL_SERIAL_CMD_V25BIS 0x10
244 #define CISTPL_SERIAL_CMD_V25A 0x20
245 #define CISTPL_SERIAL_CMD_DMCL 0x40
247 typedef struct cistpl_data_serv_t
{
252 u_char error_control
;
257 u_char misc_features
;
258 u_char ccitt_code
[0];
259 } cistpl_data_serv_t
;
261 typedef struct cistpl_fax_serv_t
{
268 u_char ccitt_code
[0];
271 typedef struct cistpl_voice_serv_t
{
274 } cistpl_voice_serv_t
;
276 /*======================================================================
278 LAN Function Extension Tuples
280 ======================================================================*/
282 #define CISTPL_FUNCE_LAN_TECH 0x01
283 #define CISTPL_FUNCE_LAN_SPEED 0x02
284 #define CISTPL_FUNCE_LAN_MEDIA 0x03
285 #define CISTPL_FUNCE_LAN_NODE_ID 0x04
286 #define CISTPL_FUNCE_LAN_CONNECTOR 0x05
288 /* LAN technologies */
289 #define CISTPL_LAN_TECH_ARCNET 0x01
290 #define CISTPL_LAN_TECH_ETHERNET 0x02
291 #define CISTPL_LAN_TECH_TOKENRING 0x03
292 #define CISTPL_LAN_TECH_LOCALTALK 0x04
293 #define CISTPL_LAN_TECH_FDDI 0x05
294 #define CISTPL_LAN_TECH_ATM 0x06
295 #define CISTPL_LAN_TECH_WIRELESS 0x07
297 typedef struct cistpl_lan_tech_t
{
301 typedef struct cistpl_lan_speed_t
{
303 } cistpl_lan_speed_t
;
305 /* LAN media definitions */
306 #define CISTPL_LAN_MEDIA_UTP 0x01
307 #define CISTPL_LAN_MEDIA_STP 0x02
308 #define CISTPL_LAN_MEDIA_THIN_COAX 0x03
309 #define CISTPL_LAN_MEDIA_THICK_COAX 0x04
310 #define CISTPL_LAN_MEDIA_FIBER 0x05
311 #define CISTPL_LAN_MEDIA_900MHZ 0x06
312 #define CISTPL_LAN_MEDIA_2GHZ 0x07
313 #define CISTPL_LAN_MEDIA_5GHZ 0x08
314 #define CISTPL_LAN_MEDIA_DIFF_IR 0x09
315 #define CISTPL_LAN_MEDIA_PTP_IR 0x0a
317 typedef struct cistpl_lan_media_t
{
319 } cistpl_lan_media_t
;
321 typedef struct cistpl_lan_node_id_t
{
324 } cistpl_lan_node_id_t
;
326 typedef struct cistpl_lan_connector_t
{
328 } cistpl_lan_connector_t
;
330 /*======================================================================
332 IDE Function Extension Tuples
334 ======================================================================*/
336 #define CISTPL_IDE_INTERFACE 0x01
338 typedef struct cistpl_ide_interface_t
{
340 } cistpl_ide_interface_t
;
342 /* First feature byte */
343 #define CISTPL_IDE_SILICON 0x04
344 #define CISTPL_IDE_UNIQUE 0x08
345 #define CISTPL_IDE_DUAL 0x10
347 /* Second feature byte */
348 #define CISTPL_IDE_HAS_SLEEP 0x01
349 #define CISTPL_IDE_HAS_STANDBY 0x02
350 #define CISTPL_IDE_HAS_IDLE 0x04
351 #define CISTPL_IDE_LOW_POWER 0x08
352 #define CISTPL_IDE_REG_INHIBIT 0x10
353 #define CISTPL_IDE_HAS_INDEX 0x20
354 #define CISTPL_IDE_IOIS16 0x40
356 typedef struct cistpl_ide_feature_t
{
359 } cistpl_ide_feature_t
;
361 #define CISTPL_FUNCE_IDE_IFACE 0x01
362 #define CISTPL_FUNCE_IDE_MASTER 0x02
363 #define CISTPL_FUNCE_IDE_SLAVE 0x03
365 /*======================================================================
367 Configuration Table Entries
369 ======================================================================*/
371 #define CISTPL_BAR_SPACE 0x07
372 #define CISTPL_BAR_SPACE_IO 0x10
373 #define CISTPL_BAR_PREFETCH 0x20
374 #define CISTPL_BAR_CACHEABLE 0x40
375 #define CISTPL_BAR_1MEG_MAP 0x80
377 typedef struct cistpl_bar_t
{
382 typedef struct cistpl_config_t
{
389 /* These are bits in the 'present' field, and indices in 'param' */
390 #define CISTPL_POWER_VNOM 0
391 #define CISTPL_POWER_VMIN 1
392 #define CISTPL_POWER_VMAX 2
393 #define CISTPL_POWER_ISTATIC 3
394 #define CISTPL_POWER_IAVG 4
395 #define CISTPL_POWER_IPEAK 5
396 #define CISTPL_POWER_IDOWN 6
398 #define CISTPL_POWER_HIGHZ_OK 0x01
399 #define CISTPL_POWER_HIGHZ_REQ 0x02
401 typedef struct cistpl_power_t
{
407 typedef struct cistpl_timing_t
{
408 u_int wait
, waitscale
;
409 u_int ready
, rdyscale
;
410 u_int reserved
, rsvscale
;
413 #define CISTPL_IO_LINES_MASK 0x1f
414 #define CISTPL_IO_8BIT 0x20
415 #define CISTPL_IO_16BIT 0x40
416 #define CISTPL_IO_RANGE 0x80
418 #define CISTPL_IO_MAX_WIN 16
420 typedef struct cistpl_io_t
{
426 } win
[CISTPL_IO_MAX_WIN
];
429 typedef struct cistpl_irq_t
{
434 #define CISTPL_MEM_MAX_WIN 8
436 typedef struct cistpl_mem_t
{
443 } win
[CISTPL_MEM_MAX_WIN
];
446 #define CISTPL_CFTABLE_DEFAULT 0x0001
447 #define CISTPL_CFTABLE_BVDS 0x0002
448 #define CISTPL_CFTABLE_WP 0x0004
449 #define CISTPL_CFTABLE_RDYBSY 0x0008
450 #define CISTPL_CFTABLE_MWAIT 0x0010
451 #define CISTPL_CFTABLE_AUDIO 0x0800
452 #define CISTPL_CFTABLE_READONLY 0x1000
453 #define CISTPL_CFTABLE_PWRDOWN 0x2000
455 typedef struct cistpl_cftable_entry_t
{
459 cistpl_power_t vcc
, vpp1
, vpp2
;
460 cistpl_timing_t timing
;
465 } cistpl_cftable_entry_t
;
467 #define CISTPL_CFTABLE_MASTER 0x000100
468 #define CISTPL_CFTABLE_INVALIDATE 0x000200
469 #define CISTPL_CFTABLE_VGA_PALETTE 0x000400
470 #define CISTPL_CFTABLE_PARITY 0x000800
471 #define CISTPL_CFTABLE_WAIT 0x001000
472 #define CISTPL_CFTABLE_SERR 0x002000
473 #define CISTPL_CFTABLE_FAST_BACK 0x004000
474 #define CISTPL_CFTABLE_BINARY_AUDIO 0x010000
475 #define CISTPL_CFTABLE_PWM_AUDIO 0x020000
477 typedef struct cistpl_cftable_entry_cb_t
{
480 cistpl_power_t vcc
, vpp1
, vpp2
;
485 } cistpl_cftable_entry_cb_t
;
487 typedef struct cistpl_device_geo_t
{
496 } geo
[CISTPL_MAX_DEVICES
];
497 } cistpl_device_geo_t
;
499 typedef struct cistpl_vers_2_t
{
503 u_char vspec8
, vspec9
;
509 typedef struct cistpl_org_t
{
514 #define CISTPL_ORG_FS 0x00
515 #define CISTPL_ORG_APPSPEC 0x01
516 #define CISTPL_ORG_XIP 0x02
518 typedef struct cistpl_format_t
{
525 #define CISTPL_FORMAT_DISK 0x00
526 #define CISTPL_FORMAT_MEM 0x01
528 #define CISTPL_EDC_NONE 0x00
529 #define CISTPL_EDC_CKSUM 0x01
530 #define CISTPL_EDC_CRC 0x02
531 #define CISTPL_EDC_PCC 0x03
533 typedef union cisparse_t
{
534 cistpl_device_t device
;
535 cistpl_checksum_t checksum
;
536 cistpl_longlink_t longlink
;
537 cistpl_longlink_mfc_t longlink_mfc
;
538 cistpl_vers_1_t version_1
;
539 cistpl_altstr_t altstr
;
540 cistpl_jedec_t jedec
;
541 cistpl_manfid_t manfid
;
542 cistpl_funcid_t funcid
;
543 cistpl_funce_t funce
;
545 cistpl_config_t config
;
546 cistpl_cftable_entry_t cftable_entry
;
547 cistpl_cftable_entry_cb_t cftable_entry_cb
;
548 cistpl_device_geo_t device_geo
;
549 cistpl_vers_2_t vers_2
;
551 cistpl_format_t format
;
554 typedef struct tuple_t
{
556 cisdata_t DesiredTuple
;
557 u_int Flags
; /* internal use */
558 u_int LinkOffset
; /* internal use */
559 u_int CISOffset
; /* internal use */
562 cisdata_t TupleOffset
;
563 cisdata_t TupleDataMax
;
564 cisdata_t TupleDataLen
;
565 cisdata_t
*TupleData
;
568 /* Special cisdata_t value */
569 #define RETURN_FIRST_TUPLE 0xff
571 /* Attributes for tuple calls */
572 #define TUPLE_RETURN_LINK 0x01
573 #define TUPLE_RETURN_COMMON 0x02
575 #define CISTPL_MAX_CIS_SIZE 0x200
577 #endif /* LINUX_CISTPL_H */