578 lines · c
1/* SPDX-License-Identifier: GPL-2.0-only */2/*3 * cistpl.h4 *5 * The initial developer of the original code is David A. Hinds6 * <dahinds@users.sourceforge.net>. Portions created by David A. Hinds7 * are Copyright (C) 1999 David A. Hinds. All Rights Reserved.8 *9 * (C) 1999 David A. Hinds10 */11 12#ifndef _LINUX_CISTPL_H13#define _LINUX_CISTPL_H14 15typedef unsigned char cisdata_t;16 17#define CISTPL_NULL 0x0018#define CISTPL_DEVICE 0x0119#define CISTPL_LONGLINK_CB 0x0220#define CISTPL_INDIRECT 0x0321#define CISTPL_CONFIG_CB 0x0422#define CISTPL_CFTABLE_ENTRY_CB 0x0523#define CISTPL_LONGLINK_MFC 0x0624#define CISTPL_BAR 0x0725#define CISTPL_PWR_MGMNT 0x0826#define CISTPL_EXTDEVICE 0x0927#define CISTPL_CHECKSUM 0x1028#define CISTPL_LONGLINK_A 0x1129#define CISTPL_LONGLINK_C 0x1230#define CISTPL_LINKTARGET 0x1331#define CISTPL_NO_LINK 0x1432#define CISTPL_VERS_1 0x1533#define CISTPL_ALTSTR 0x1634#define CISTPL_DEVICE_A 0x1735#define CISTPL_JEDEC_C 0x1836#define CISTPL_JEDEC_A 0x1937#define CISTPL_CONFIG 0x1a38#define CISTPL_CFTABLE_ENTRY 0x1b39#define CISTPL_DEVICE_OC 0x1c40#define CISTPL_DEVICE_OA 0x1d41#define CISTPL_DEVICE_GEO 0x1e42#define CISTPL_DEVICE_GEO_A 0x1f43#define CISTPL_MANFID 0x2044#define CISTPL_FUNCID 0x2145#define CISTPL_FUNCE 0x2246#define CISTPL_SWIL 0x2347#define CISTPL_END 0xff48/* Layer 2 tuples */49#define CISTPL_VERS_2 0x4050#define CISTPL_FORMAT 0x4151#define CISTPL_GEOMETRY 0x4252#define CISTPL_BYTEORDER 0x4353#define CISTPL_DATE 0x4454#define CISTPL_BATTERY 0x4555#define CISTPL_FORMAT_A 0x4756/* Layer 3 tuples */57#define CISTPL_ORG 0x4658#define CISTPL_SPCL 0x9059 60typedef struct cistpl_longlink_t {61 u_int addr;62} cistpl_longlink_t;63 64typedef struct cistpl_checksum_t {65 u_short addr;66 u_short len;67 u_char sum;68} cistpl_checksum_t;69 70#define CISTPL_MAX_FUNCTIONS 871#define CISTPL_MFC_ATTR 0x0072#define CISTPL_MFC_COMMON 0x0173 74typedef struct cistpl_longlink_mfc_t {75 u_char nfn;76 struct {77 u_char space;78 u_int addr;79 } fn[CISTPL_MAX_FUNCTIONS];80} cistpl_longlink_mfc_t;81 82#define CISTPL_MAX_ALTSTR_STRINGS 483 84typedef struct cistpl_altstr_t {85 u_char ns;86 u_char ofs[CISTPL_MAX_ALTSTR_STRINGS];87 char str[254];88} cistpl_altstr_t;89 90#define CISTPL_DTYPE_NULL 0x0091#define CISTPL_DTYPE_ROM 0x0192#define CISTPL_DTYPE_OTPROM 0x0293#define CISTPL_DTYPE_EPROM 0x0394#define CISTPL_DTYPE_EEPROM 0x0495#define CISTPL_DTYPE_FLASH 0x0596#define CISTPL_DTYPE_SRAM 0x0697#define CISTPL_DTYPE_DRAM 0x0798#define CISTPL_DTYPE_FUNCSPEC 0x0d99#define CISTPL_DTYPE_EXTEND 0x0e100 101#define CISTPL_MAX_DEVICES 4102 103typedef struct cistpl_device_t {104 u_char ndev;105 struct {106 u_char type;107 u_char wp;108 u_int speed;109 u_int size;110 } dev[CISTPL_MAX_DEVICES];111} cistpl_device_t;112 113#define CISTPL_DEVICE_MWAIT 0x01114#define CISTPL_DEVICE_3VCC 0x02115 116typedef struct cistpl_device_o_t {117 u_char flags;118 cistpl_device_t device;119} cistpl_device_o_t;120 121#define CISTPL_VERS_1_MAX_PROD_STRINGS 4122 123typedef struct cistpl_vers_1_t {124 u_char major;125 u_char minor;126 u_char ns;127 u_char ofs[CISTPL_VERS_1_MAX_PROD_STRINGS];128 char str[254];129} cistpl_vers_1_t;130 131typedef struct cistpl_jedec_t {132 u_char nid;133 struct {134 u_char mfr;135 u_char info;136 } id[CISTPL_MAX_DEVICES];137} cistpl_jedec_t;138 139typedef struct cistpl_manfid_t {140 u_short manf;141 u_short card;142} cistpl_manfid_t;143 144#define CISTPL_FUNCID_MULTI 0x00145#define CISTPL_FUNCID_MEMORY 0x01146#define CISTPL_FUNCID_SERIAL 0x02147#define CISTPL_FUNCID_PARALLEL 0x03148#define CISTPL_FUNCID_FIXED 0x04149#define CISTPL_FUNCID_VIDEO 0x05150#define CISTPL_FUNCID_NETWORK 0x06151#define CISTPL_FUNCID_AIMS 0x07152#define CISTPL_FUNCID_SCSI 0x08153 154#define CISTPL_SYSINIT_POST 0x01155#define CISTPL_SYSINIT_ROM 0x02156 157typedef struct cistpl_funcid_t {158 u_char func;159 u_char sysinit;160} cistpl_funcid_t;161 162typedef struct cistpl_funce_t {163 u_char type;164 u_char data[];165} cistpl_funce_t;166 167/*======================================================================168 169 Modem Function Extension Tuples170 171======================================================================*/172 173#define CISTPL_FUNCE_SERIAL_IF 0x00174#define CISTPL_FUNCE_SERIAL_CAP 0x01175#define CISTPL_FUNCE_SERIAL_SERV_DATA 0x02176#define CISTPL_FUNCE_SERIAL_SERV_FAX 0x03177#define CISTPL_FUNCE_SERIAL_SERV_VOICE 0x04178#define CISTPL_FUNCE_SERIAL_CAP_DATA 0x05179#define CISTPL_FUNCE_SERIAL_CAP_FAX 0x06180#define CISTPL_FUNCE_SERIAL_CAP_VOICE 0x07181#define CISTPL_FUNCE_SERIAL_IF_DATA 0x08182#define CISTPL_FUNCE_SERIAL_IF_FAX 0x09183#define CISTPL_FUNCE_SERIAL_IF_VOICE 0x0a184 185/* UART identification */186#define CISTPL_SERIAL_UART_8250 0x00187#define CISTPL_SERIAL_UART_16450 0x01188#define CISTPL_SERIAL_UART_16550 0x02189#define CISTPL_SERIAL_UART_8251 0x03190#define CISTPL_SERIAL_UART_8530 0x04191#define CISTPL_SERIAL_UART_85230 0x05192 193/* UART capabilities */194#define CISTPL_SERIAL_UART_SPACE 0x01195#define CISTPL_SERIAL_UART_MARK 0x02196#define CISTPL_SERIAL_UART_ODD 0x04197#define CISTPL_SERIAL_UART_EVEN 0x08198#define CISTPL_SERIAL_UART_5BIT 0x01199#define CISTPL_SERIAL_UART_6BIT 0x02200#define CISTPL_SERIAL_UART_7BIT 0x04201#define CISTPL_SERIAL_UART_8BIT 0x08202#define CISTPL_SERIAL_UART_1STOP 0x10203#define CISTPL_SERIAL_UART_MSTOP 0x20204#define CISTPL_SERIAL_UART_2STOP 0x40205 206typedef struct cistpl_serial_t {207 u_char uart_type;208 u_char uart_cap_0;209 u_char uart_cap_1;210} cistpl_serial_t;211 212typedef struct cistpl_modem_cap_t {213 u_char flow;214 u_char cmd_buf;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;218 219#define CISTPL_SERIAL_MOD_103 0x01220#define CISTPL_SERIAL_MOD_V21 0x02221#define CISTPL_SERIAL_MOD_V23 0x04222#define CISTPL_SERIAL_MOD_V22 0x08223#define CISTPL_SERIAL_MOD_212A 0x10224#define CISTPL_SERIAL_MOD_V22BIS 0x20225#define CISTPL_SERIAL_MOD_V26 0x40226#define CISTPL_SERIAL_MOD_V26BIS 0x80227#define CISTPL_SERIAL_MOD_V27BIS 0x01228#define CISTPL_SERIAL_MOD_V29 0x02229#define CISTPL_SERIAL_MOD_V32 0x04230#define CISTPL_SERIAL_MOD_V32BIS 0x08231#define CISTPL_SERIAL_MOD_V34 0x10232 233#define CISTPL_SERIAL_ERR_MNP2_4 0x01234#define CISTPL_SERIAL_ERR_V42_LAPM 0x02235 236#define CISTPL_SERIAL_CMPR_V42BIS 0x01237#define CISTPL_SERIAL_CMPR_MNP5 0x02238 239#define CISTPL_SERIAL_CMD_AT1 0x01240#define CISTPL_SERIAL_CMD_AT2 0x02241#define CISTPL_SERIAL_CMD_AT3 0x04242#define CISTPL_SERIAL_CMD_MNP_AT 0x08243#define CISTPL_SERIAL_CMD_V25BIS 0x10244#define CISTPL_SERIAL_CMD_V25A 0x20245#define CISTPL_SERIAL_CMD_DMCL 0x40246 247typedef struct cistpl_data_serv_t {248 u_char max_data_0;249 u_char max_data_1;250 u_char modulation_0;251 u_char modulation_1;252 u_char error_control;253 u_char compression;254 u_char cmd_protocol;255 u_char escape;256 u_char encrypt;257 u_char misc_features;258 u_char ccitt_code[];259} cistpl_data_serv_t;260 261typedef struct cistpl_fax_serv_t {262 u_char max_data_0;263 u_char max_data_1;264 u_char modulation;265 u_char encrypt;266 u_char features_0;267 u_char features_1;268 u_char ccitt_code[];269} cistpl_fax_serv_t;270 271typedef struct cistpl_voice_serv_t {272 u_char max_data_0;273 u_char max_data_1;274} cistpl_voice_serv_t;275 276/*======================================================================277 278 LAN Function Extension Tuples279 280======================================================================*/281 282#define CISTPL_FUNCE_LAN_TECH 0x01283#define CISTPL_FUNCE_LAN_SPEED 0x02284#define CISTPL_FUNCE_LAN_MEDIA 0x03285#define CISTPL_FUNCE_LAN_NODE_ID 0x04286#define CISTPL_FUNCE_LAN_CONNECTOR 0x05287 288/* LAN technologies */289#define CISTPL_LAN_TECH_ARCNET 0x01290#define CISTPL_LAN_TECH_ETHERNET 0x02291#define CISTPL_LAN_TECH_TOKENRING 0x03292#define CISTPL_LAN_TECH_LOCALTALK 0x04293#define CISTPL_LAN_TECH_FDDI 0x05294#define CISTPL_LAN_TECH_ATM 0x06295#define CISTPL_LAN_TECH_WIRELESS 0x07296 297typedef struct cistpl_lan_tech_t {298 u_char tech;299} cistpl_lan_tech_t;300 301typedef struct cistpl_lan_speed_t {302 u_int speed;303} cistpl_lan_speed_t;304 305/* LAN media definitions */306#define CISTPL_LAN_MEDIA_UTP 0x01307#define CISTPL_LAN_MEDIA_STP 0x02308#define CISTPL_LAN_MEDIA_THIN_COAX 0x03309#define CISTPL_LAN_MEDIA_THICK_COAX 0x04310#define CISTPL_LAN_MEDIA_FIBER 0x05311#define CISTPL_LAN_MEDIA_900MHZ 0x06312#define CISTPL_LAN_MEDIA_2GHZ 0x07313#define CISTPL_LAN_MEDIA_5GHZ 0x08314#define CISTPL_LAN_MEDIA_DIFF_IR 0x09315#define CISTPL_LAN_MEDIA_PTP_IR 0x0a316 317typedef struct cistpl_lan_media_t {318 u_char media;319} cistpl_lan_media_t;320 321typedef struct cistpl_lan_node_id_t {322 u_char nb;323 u_char id[16];324} cistpl_lan_node_id_t;325 326typedef struct cistpl_lan_connector_t {327 u_char code;328} cistpl_lan_connector_t;329 330/*======================================================================331 332 IDE Function Extension Tuples333 334======================================================================*/335 336#define CISTPL_IDE_INTERFACE 0x01337 338typedef struct cistpl_ide_interface_t {339 u_char interface;340} cistpl_ide_interface_t;341 342/* First feature byte */343#define CISTPL_IDE_SILICON 0x04344#define CISTPL_IDE_UNIQUE 0x08345#define CISTPL_IDE_DUAL 0x10346 347/* Second feature byte */348#define CISTPL_IDE_HAS_SLEEP 0x01349#define CISTPL_IDE_HAS_STANDBY 0x02350#define CISTPL_IDE_HAS_IDLE 0x04351#define CISTPL_IDE_LOW_POWER 0x08352#define CISTPL_IDE_REG_INHIBIT 0x10353#define CISTPL_IDE_HAS_INDEX 0x20354#define CISTPL_IDE_IOIS16 0x40355 356typedef struct cistpl_ide_feature_t {357 u_char feature1;358 u_char feature2;359} cistpl_ide_feature_t;360 361#define CISTPL_FUNCE_IDE_IFACE 0x01362#define CISTPL_FUNCE_IDE_MASTER 0x02363#define CISTPL_FUNCE_IDE_SLAVE 0x03364 365/*======================================================================366 367 Configuration Table Entries368 369======================================================================*/370 371#define CISTPL_BAR_SPACE 0x07372#define CISTPL_BAR_SPACE_IO 0x10373#define CISTPL_BAR_PREFETCH 0x20374#define CISTPL_BAR_CACHEABLE 0x40375#define CISTPL_BAR_1MEG_MAP 0x80376 377typedef struct cistpl_bar_t {378 u_char attr;379 u_int size;380} cistpl_bar_t;381 382typedef struct cistpl_config_t {383 u_char last_idx;384 u_int base;385 u_int rmask[4];386 u_char subtuples;387} cistpl_config_t;388 389/* These are bits in the 'present' field, and indices in 'param' */390#define CISTPL_POWER_VNOM 0391#define CISTPL_POWER_VMIN 1392#define CISTPL_POWER_VMAX 2393#define CISTPL_POWER_ISTATIC 3394#define CISTPL_POWER_IAVG 4395#define CISTPL_POWER_IPEAK 5396#define CISTPL_POWER_IDOWN 6397 398#define CISTPL_POWER_HIGHZ_OK 0x01399#define CISTPL_POWER_HIGHZ_REQ 0x02400 401typedef struct cistpl_power_t {402 u_char present;403 u_char flags;404 u_int param[7];405} cistpl_power_t;406 407typedef struct cistpl_timing_t {408 u_int wait, waitscale;409 u_int ready, rdyscale;410 u_int reserved, rsvscale;411} cistpl_timing_t;412 413#define CISTPL_IO_LINES_MASK 0x1f414#define CISTPL_IO_8BIT 0x20415#define CISTPL_IO_16BIT 0x40416#define CISTPL_IO_RANGE 0x80417 418#define CISTPL_IO_MAX_WIN 16419 420typedef struct cistpl_io_t {421 u_char flags;422 u_char nwin;423 struct {424 u_int base;425 u_int len;426 } win[CISTPL_IO_MAX_WIN];427} cistpl_io_t;428 429typedef struct cistpl_irq_t {430 u_int IRQInfo1;431 u_int IRQInfo2;432} cistpl_irq_t;433 434#define CISTPL_MEM_MAX_WIN 8435 436typedef struct cistpl_mem_t {437 u_char flags;438 u_char nwin;439 struct {440 u_int len;441 u_int card_addr;442 u_int host_addr;443 } win[CISTPL_MEM_MAX_WIN];444} cistpl_mem_t;445 446#define CISTPL_CFTABLE_DEFAULT 0x0001447#define CISTPL_CFTABLE_BVDS 0x0002448#define CISTPL_CFTABLE_WP 0x0004449#define CISTPL_CFTABLE_RDYBSY 0x0008450#define CISTPL_CFTABLE_MWAIT 0x0010451#define CISTPL_CFTABLE_AUDIO 0x0800452#define CISTPL_CFTABLE_READONLY 0x1000453#define CISTPL_CFTABLE_PWRDOWN 0x2000454 455typedef struct cistpl_cftable_entry_t {456 u_char index;457 u_short flags;458 u_char interface;459 cistpl_power_t vcc, vpp1, vpp2;460 cistpl_timing_t timing;461 cistpl_io_t io;462 cistpl_irq_t irq;463 cistpl_mem_t mem;464 u_char subtuples;465} cistpl_cftable_entry_t;466 467#define CISTPL_CFTABLE_MASTER 0x000100468#define CISTPL_CFTABLE_INVALIDATE 0x000200469#define CISTPL_CFTABLE_VGA_PALETTE 0x000400470#define CISTPL_CFTABLE_PARITY 0x000800471#define CISTPL_CFTABLE_WAIT 0x001000472#define CISTPL_CFTABLE_SERR 0x002000473#define CISTPL_CFTABLE_FAST_BACK 0x004000474#define CISTPL_CFTABLE_BINARY_AUDIO 0x010000475#define CISTPL_CFTABLE_PWM_AUDIO 0x020000476 477typedef struct cistpl_cftable_entry_cb_t {478 u_char index;479 u_int flags;480 cistpl_power_t vcc, vpp1, vpp2;481 u_char io;482 cistpl_irq_t irq;483 u_char mem;484 u_char subtuples;485} cistpl_cftable_entry_cb_t;486 487typedef struct cistpl_device_geo_t {488 u_char ngeo;489 struct {490 u_char buswidth;491 u_int erase_block;492 u_int read_block;493 u_int write_block;494 u_int partition;495 u_int interleave;496 } geo[CISTPL_MAX_DEVICES];497} cistpl_device_geo_t;498 499typedef struct cistpl_vers_2_t {500 u_char vers;501 u_char comply;502 u_short dindex;503 u_char vspec8, vspec9;504 u_char nhdr;505 u_char vendor, info;506 char str[244];507} cistpl_vers_2_t;508 509typedef struct cistpl_org_t {510 u_char data_org;511 char desc[30];512} cistpl_org_t;513 514#define CISTPL_ORG_FS 0x00515#define CISTPL_ORG_APPSPEC 0x01516#define CISTPL_ORG_XIP 0x02517 518typedef struct cistpl_format_t {519 u_char type;520 u_char edc;521 u_int offset;522 u_int length;523} cistpl_format_t;524 525#define CISTPL_FORMAT_DISK 0x00526#define CISTPL_FORMAT_MEM 0x01527 528#define CISTPL_EDC_NONE 0x00529#define CISTPL_EDC_CKSUM 0x01530#define CISTPL_EDC_CRC 0x02531#define CISTPL_EDC_PCC 0x03532 533typedef 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;544 cistpl_bar_t bar;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;550 cistpl_org_t org;551 cistpl_format_t format;552} cisparse_t;553 554typedef struct tuple_t {555 u_int Attributes;556 cisdata_t DesiredTuple;557 u_int Flags; /* internal use */558 u_int LinkOffset; /* internal use */559 u_int CISOffset; /* internal use */560 cisdata_t TupleCode;561 cisdata_t TupleLink;562 cisdata_t TupleOffset;563 cisdata_t TupleDataMax;564 cisdata_t TupleDataLen;565 cisdata_t *TupleData;566} tuple_t;567 568/* Special cisdata_t value */569#define RETURN_FIRST_TUPLE 0xff570 571/* Attributes for tuple calls */572#define TUPLE_RETURN_LINK 0x01573#define TUPLE_RETURN_COMMON 0x02574 575#define CISTPL_MAX_CIS_SIZE 0x200576 577#endif /* LINUX_CISTPL_H */578