cis_handlers.h revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright (c) 1995-2001 by Sun Microsystems, Inc.
* All rights reserved.
*/
#ifndef _CIS_HANDLERS_H
#define _CIS_HANDLERS_H
#pragma ident "%Z%%M% %I% %E% SMI"
#ifdef __cplusplus
extern "C" {
#endif
/*
* This is the CIS tuple handler header file.
*
* Each tuple that we recognize and are prepared to handle is assigned a
* cistpl_callout_t structure. This lets us specify a handler for
* this tuple, as well as flags that describe this tuple and which
* are used by the CIS interpreter and tuple parser.
*/
typedef struct cistpl_callout_t {
char *text; /* name of tuple */
/*
* Flags that are used by a tuple handler to specify what action it
* should perform.
*/
/*
* This flag is returned by tuple handlers if they encounter an error. It
* is returned by cis_list_lcreate if any of the tuple handlers have
* return an error while processing the CIS.
*
* Note that the following bit is reserved:
* #define BAD_CIS_ADDR 0x080000000
* It appears in cis.h and is used to indicate that cis_list_create
* tried to read past the end of the mapped in CIS space.
*/
/*
* General-use constants and macros that aren't specific to a tuple.
*/
/*
* Constants, macros and structures used by cistpl_devspeed and
* cis_convert_devspeed functions.
*/
(CISTPL_DEVSPEED_MAX_TBL - 1)]
(CISTPL_DEVSPEED_MAX_MAN - 1)]
(CISTPL_DEVSPEED_MAX_EXP - 1)]
typedef struct cistpl_devspeed_struct_t {
/*
* Constants, flags and structure typedefs that are used by specific tuples.
*
* CISTPL_DEVICE, CISTPL_DEVICE_A, CISTPL_DEVICE_OC and CISTPL_DEVICE_OA
*/
/*
* Flags for cistpl_device_node_t->flags member for CISTPL_DEVICE
* and CISTPL_DEVICE_A tuples
*/
/*
* Flags and values for cistpl_device_node_t->flags member for
* CISTPL_DEVICE_OC and CISTPL_DEVICE_OA tuples
*/
/*
* CISTPL_DEVICE_MAX_DEVICES defines the maximum number of devices that
* we can parse in a CISTPL_DEVICE{...} tuple
*/
#define CISTPL_DEVICE_MAX_DEVICES 10
/*
* CISTPL_DEVICE_SPEED_SIZE_IGNORE if the device speed is set to this, then
* ignore the speed and size values
*/
typedef struct cistpl_device_node_t {
typedef struct cistpl_device_t {
/*
* CISTPL_CONFIG
*/
typedef struct cistpl_config_t {
/*
* CISTPL_VERS_1
*/
typedef struct cistpl_vers_1_t {
/* pointers to product information strings */
/*
* CISTPL_VERS_2
*/
typedef struct cistpl_vers_2_t {
/* formatted card */
/* about card */
/*
* CISTPL_JEDEC_A and CISTPL_JEDEC_C
*/
#define CISTPL_JEDEC_MAX_IDENTIFIERS 4
typedef struct jedec_ident_t {
typedef struct cistpl_jedec_t {
/*
* CISTPL_FORMAT and CISTPL_FORMAT_A
*
* These tuples describe the data recording format for a region.
*/
typedef struct cistpl_format_t {
union {
struct disk {
} disk;
struct mem {
} mem;
} dev;
/*
* device format types
*/
/*
* error detection code types
*/
#define EDC_LENGTH_MASK 0x07
#define EDC_TYPE_MASK 0x0f
#define EDC_TYPE_SHIFT 3
/*
* flags for memory-like devices
*/
/*
* CISTPL_GEOMETRY
*/
typedef struct cistpl_geometry_t {
/*
* CISTPL_BYTEORDER
*/
typedef struct cistpl_byteorder_t {
/*
* byte order and mapping codes
*/
/*
* CISTPL_DATE
*/
typedef struct cistpl_date_t {
/*
* CISTPL_BATTERY
*/
typedef struct cistpl_battery_t {
/*
* CISTPL_ORG
*/
typedef struct cistpl_org_t {
/* this organization */
} cistpl_org_t;
/*
* CISTPL_MANFID
*/
typedef struct cistpl_manfid_t {
/*
* CISTPL_FUNCID
*/
typedef struct cistpl_funcid_t {
/*
* Function types for CISTPL_FUNCID; note that the TPLFUNC_UNKNOWN is
* not defined by the PCMCIA standard.
*
* Definitions for cistpl_funcid_t->function
*/
/*
* Definitions for cistpl_funcid_t->sysinit
*/
/*
* CISTPL_FUNCE
*/
typedef struct cistpl_funce_t {
union {
struct serial {
} serial;
struct modem {
} modem;
struct data_modem {
/* err correct proto and non-CCITT modulation */
} data_modem;
struct fax {
} fax;
struct voice {
} voice;
struct lan {
} lan;
} data;
/* serial port subfunctions */
#define TPLFE_SUB_SERIAL 0 /* serial port */
/* modem subfunctions for description of capabilities */
/* serial port subfunctions for description of capabilities */
/* serial port UART definitions */
#define TPLFE_UA_8250 0 /* Intel 8250 */
/* serial port capabilities definitions */
/* modem flow control methods */
/* modem modulation standards */
/* modem error correction/detection protocols */
/* modem data compression protocols */
/* modem command protocols */
/* modem escape mechanism */
/* modem miscellaneous features */
/* fax modulation standards */
/* fax feature selection */
/* LAN tuple definitions */
#define TPLFE_NETWORK_INFO 0x00
/* LAN technology types */
#define TPLFE_LAN_TECH_ARCNET 1
#define TPLFE_LAN_TECH_ETHERNET 2
#define TPLFE_LAN_TECH_TOKENRING 3
#define TPLFE_LAN_TECH_LOCALTALK 4
#define TPLFE_LAN_TECH_FDDI 5
#define TPLFE_LAN_TECH_ATM 6
#define TPLFE_LAN_TECH_WIRELESS 7
/* LAN media types */
#define TPLFE_LAN_MEDIA_INHERENT 0
#define TPLFE_LAN_MEDIA_UTP 1
#define TPLFE_LAN_MEDIA_STP 2
#define TPLFE_LAN_MEDIA_THIN_COAX 3
#define TPLFE_LAN_MEDIA_THICK_COAX 4
#define TPLFE_LAN_MEDIA_FIBER 5
#define TPLFE_LAN_MEDIA_SSR_902 6
#define TPLFE_LAN_MEDIA_SSR_2_4 7
#define TPLFE_LAN_MEDIA_SSR_5_4 8
#define TPLFE_LAN_MEDIA_DIFFUSE_IR 9
#define TPLFE_LAN_MEDIA_PTP_IR 10
/*
* CISTPL_CFTABLE_ENTRY
*
* These flags and macros are used internally to the handler.
*/
/* mask to get the config entry number from TPCE_INDX */
#define CISTPL_CFTABLE_TPCE_CFGENTRYM 0x03f
/* default config bit in TPCE_INDX */
#define CISTPL_CFTABLE_TPCE_DEFAULTM 0x040
/* interface config byte follows */
#define CISTPL_CFTABLE_TPCE_IFM 0x080
/* power bit mask for tpce_fs */
#define CISTPL_CFTABLE_TPCE_FS_PWRM 0x003
/* Vcc, Vpp1 and Vpp2 descriptions */
#define CISTPL_CFTABLE_TPCE_FS_PWR_VPP2M 0x003
/* Vcc and Vpp1=Vpp2 descriptions */
#define CISTPL_CFTABLE_TPCE_FS_PWR_VPP1M 0x002
/* Vcc description only */
#define CISTPL_CFTABLE_TPCE_FS_PWR_VCCM 0x001
#define CISTPL_CFTABLE_PD_NC_SLEEPM 0x07d
/* zero value required */
#define CISTPL_CFTABLE_PD_ZEROM 0x07e
/* no connection ever */
#define CISTPL_CFTABLE_PD_NCM 0x07f
/* timing data exists */
#define CISTPL_CFTABLE_TPCE_FS_TDM 0x004
/* WAIT scale mask */
#define CISTPL_CFTABLE_TPCE_FS_TD_WAITM 0x003
#define CISTPL_CFTABLE_TPCE_FS_TD_RDYM 0x01c
/* RSVD scale mask */
#define CISTPL_CFTABLE_TPCE_FS_TD_RSVDM 0x0e0
/* I/O addr lines mask */
#define CISTPL_CFTABLE_TPCE_FS_IO_ALM 0x01f
/* RANGE bit in TPCE_IO */
#define CISTPL_CFTABLE_TPCE_FS_IO_RANGEM 0x080
/* max of 16 I/O ranges */
#define CISTPL_CFTABLE_ENTRY_MAX_IO_RANGES 16
/* extended IRQ mask exists */
#define CISTPL_CFTABLE_TPCE_FS_IRQ_MASKM 0x010
/* space selection byte ... */
#define CISTPL_CFTABLE_TPCE_FS_MEM3M 0x060
/* length (2 bytes) and card address (2 bytes) */
#define CISTPL_CFTABLE_TPCE_FS_MEM2M 0x040
/* single 2-byte length */
#define CISTPL_CFTABLE_TPCE_FS_MEM1M 0x020
/* max of 8 mem space descriptors */
#define CISTPL_CFTABLE_ENTRY_MAX_MEM_WINDOWS 8
#define CISTPL_CFTABLE_TPCE_FS_MEM_PGSIZE 256
/* host addr info present */
#define CISTPL_CFTABLE_TPCE_FS_MEM_HOSTM 0x080
/*
* Constants, macros, structures and flags used by cistpl_pd_parse()
* cistpl_expd_parse() and the CISTPL_CFTABLE_ENTRY tuple handler.
*/
typedef struct cistpl_pd_struct_t {
/*
* These flags are passed to the caller in the cistpl_cftable_entry_t->flags
* field and indicate what interface information is available. The low
* order byte of this field is reserved and no flags should be defined
* to exist there.
*/
/* interface config description present flags */
/*
* When the CISTPL_CFTABLE_TPCE_IF flag is set, the following flags
* are available in the ifc member of the cistpl_cftable_entry_t
* structure.
*/
/* power description present flags */
/* timing description present flags */
/* I/O description present flags */
/* IRQ description present flags */
/* memory space description present flags */
/* misc description present flags */
/* additional information tuples present flags */
/*
* Power description flags and structures.
*
* The following eight values represent what the power description structure
* parameter selection byte tells us is present. A copy of this byte
* is in the low order byte of each parameter's flag field.
*/
/* max current required averaged over 1 second */
#define CISTPL_CFTABLE_PD_AVGI 0x010
/* maximum current required averaged over 10mS */
#define CISTPL_CFTABLE_PD_PEAKI 0x020
/* power down supply curent required */
#define CISTPL_CFTABLE_PD_PDOWNI 0x040
/* power supply is about to blow up */
#define CISTPL_CFTABLE_PD_RFU 0x080
/*
* The following flags are in this field. The low order byte of each
* of these flags fields also contains a copy of the power description
* structure parameter selection byte as read from the tuple, that's why
* we start the flag values at 0x0100 and go up from there.
*/
/* this parameter exists */
#define CISTPL_CFTABLE_PD_EXISTS 0x000000100
/* multiply return value by 10 */
#define CISTPL_CFTABLE_PD_MUL10 0x000000200
#define CISTPL_CFTABLE_PD_NC_SLEEP 0x000001000
/* zero value required */
#define CISTPL_CFTABLE_PD_ZERO 0x000002000
/* no connection ever */
#define CISTPL_CFTABLE_PD_NC 0x000004000
typedef struct cistpl_cftable_entry_pwr_t {
/* averaged over 1 sec. */
/* averaged over 10mS */
/*
* Flags for the global power description structure. These show up in
* the flags field of the structure.
*/
typedef struct cistpl_cftable_entry_pd_t {
/*
* Device speed structure. Each field is only valid if the
* CISTPL_CFTABLE_TPCE_FS_TD flag is set.
*
* The following flags describe which timing information is available.
* They appear in the flags field of the device speed structure.
*/
/* WAIT timing exists */
#define CISTPL_CFTABLE_TPCE_FS_TD_WAIT 0x000000001
#define CISTPL_CFTABLE_TPCE_FS_TD_RDY 0x000000002
/* RSVD timing exists */
#define CISTPL_CFTABLE_TPCE_FS_TD_RSVD 0x000000004
typedef struct cistpl_cftable_entry_speed_t {
/*
* Device I/O range description structures. Only valid if the
* CISTPL_CFTABLE_TPCE_FS_IO flag is set.
*
* The following flags describe the IO description information. They
* appear in the flags field of the IO space description structure.
*/
typedef struct cistpl_cftable_entry_io_range_t {
typedef struct cistpl_cftable_entry_io_t {
/*
* Device IRQ description structure. Only valid if the
* CISTPL_CFTABLE_TPCE_FS_IRQ flag is set.
*/
typedef struct cistpl_cftable_entry_irq_t {
/*
* Device memory space description structure. Only valid if the
* CISTPL_CFTABLE_TPCE_FS_MEM flag is set.
*
* The following flags describe the memory description information. They
* appear in the flags field of the memory space description structure.
*/
/* space descriptors */
#define CISTPL_CFTABLE_TPCE_FS_MEM3 0x000000001
/* host_addr=card_addr */
#define CISTPL_CFTABLE_TPCE_FS_MEM2 0x000000002
/* card address=0, any host address */
#define CISTPL_CFTABLE_TPCE_FS_MEM1 0x000000004
/* if host address is present in MEM3 */
#define CISTPL_CFTABLE_TPCE_FS_MEM_HOST 0x000000008
typedef struct cistpl_cftable_entry_mem_window_t {
typedef struct cistpl_cftable_entry_mem_t {
/*
* Devices misc description structure. Only valid if the
* CISTPL_CFTABLE_TPCE_FS_MISC flag is set.
*/
typedef struct cistpl_cftable_entry_misc_t {
/*
* Additional information sub-tuples defines and structure
*/
typedef struct cistpl_cftable_entry_stce_ev_t {
char stev_strs[CIS_MAX_TUPLE_DATA_LEN];
typedef struct cistpl_cftable_entry_stce_pd_t {
char stpd_strs[CIS_MAX_TUPLE_DATA_LEN];
/*
* cistpl_cftable_entry_t - this is the struct that the caller passes
* to the CISTPL_CFTABLE_ENTRY handler
*/
typedef struct cistpl_cftable_entry_t {
/*
* CISTPL_LINKTARGET
*
* This tuple is used to verify that tuple chains other than the primary
* chain which starts at offset 0 in Attribute Memory are valid. All
* secondary tuple chains are required to contain this tuple as the
* first tuple of the chain.
* This tuple must have a link field of at least MIN_LINKTARGET_LENGTH and
* must contain the byte pattern CISTPL_LINKTARGET_MAGIC.
* LINKTARGET_AC_HEADER_LENGTH is the number of bytes contained in a
* valid CISTPL_LINKTARGET tuple header.
*/
#define MIN_LINKTARGET_LENGTH 3
#define CISTPL_LINKTARGET_MAGIC "CIS"
#define LINKTARGET_AC_HEADER_LENGTH 2
typedef struct cistpl_linktarget_t {
char tpltg_tag[CIS_MAX_TUPLE_DATA_LEN];
/*
* CISTPL_LONGLINK_A and CISTPL_LONGLINK_C
*
* Both of these tuples are processed the same way. The target address is
* really an offset from the beginning of the specified address space
* and is not a virtual address.
* This tuple must have a link field of at least MIN_LONGLINK_AC_LENGTH.
*/
#define MIN_LONGLINK_AC_LENGTH 4
typedef struct cistpl_longlink_ac_t {
/*
* Flags for cistpl_longlink_ac_t->flags
*/
/*
* CISTPL_LONGLINK_MFC
*
* This tuple describes the start of the function-specific CIS for each
* function on a multi-function card.
*
* This tuple must have a link field of at least MIN_LONGLINK_AC_LENGTH.
*/
#define MIN_LONGLINK_MFC_LENGTH 6
#define MIN_LONGLINK_MFC_NREGS 1
typedef struct cis_function_t {
typedef struct cistpl_longlink_mfc_t {
/*
* Flags for cistpl_longlink_mfc_t->function[n]->tas
*/
/*
* CISTPL_LONGLINK_CB
*
* This tuple describes the start of a function's CIS chain
* for CardBus cards
*/
typedef struct cistpl_longlink_cb_t {
union {
/* device-dependant config space info */
struct {
} cfg;
/* memory space info */
struct {
} mem;
/* expansion ROM space info */
struct {
} rom;
} space;
/*
* Flags for cistpl_longlink_cb_t->flags
*/
/*
* CISTPL_SPCL
*
* This tuple is the Special Purpose tuple and it's contents are dependant
* on the meaning of the header information in this tuple.
*/
typedef struct cistpl_spcl_t {
/*
* Flags for cistpl_spcl_t->seq
*/
/*
* CISTPL_SWIL
*
* This tuple describes the software interleaving of data within a
* partition on the card.
*/
typedef struct cistpl_swil_t {
/*
* CISTPL_BAR
*
* This tuple describes the CardBus Base Address Registers
*/
typedef struct cistpl_bar_t {
} cistpl_bar_t;
/*
* Flags for cistpl_bar_t->attributes
*/
/*
* CISTPL_DEVICEGEO and CISTPL_DEVICEGEO_A
*
* These tuples describe the device geometry of memory partitions.
*/
#define CISTPL_DEVICEGEO_MAX_PARTITIONS 42
typedef struct cistpl_devicegeo_info_t {
typedef struct cistpl_devicegeo_t {
/*
* The cistpl_get_tuple_name_t used to support the HANDTPL_RETURN_NAME
* operation of the CIS parser.
*/
typedef struct cistpl_get_tuple_name_t {
char name[CIS_MAX_TUPLE_NAME_LEN];
/*
* cisparse_t - the structure that unifies all tuple parsing structures
*/
typedef union cisparse_t {
/* members below are for legacy support - REMOVE THEM BEFORE FCS!! */
} cisparse_t;
#ifdef __cplusplus
}
#endif
#endif /* _CIS_HANDLERS_H */