xref: /freebsd/sys/dev/cardbus/cardbus_cis.h (revision 0c95c70577625851a3ccf05da8396cfe4d278279)
10db7e66cSJonathan Chen /*
20db7e66cSJonathan Chen  * Copyright (c) 2000,2001 Jonathan Chen.
30db7e66cSJonathan Chen  * All rights reserved.
40db7e66cSJonathan Chen  *
50db7e66cSJonathan Chen  * Redistribution and use in source and binary forms, with or without
60db7e66cSJonathan Chen  * modification, are permitted provided that the following conditions
70db7e66cSJonathan Chen  * are met:
80db7e66cSJonathan Chen  * 1. Redistributions of source code must retain the above copyright
90db7e66cSJonathan Chen  *    notice, this list of conditions, and the following disclaimer,
100db7e66cSJonathan Chen  *    without modification, immediately at the beginning of the file.
110db7e66cSJonathan Chen  * 2. Redistributions in binary form must reproduce the above copyright
120db7e66cSJonathan Chen  *    notice, this list of conditions and the following disclaimer in
130db7e66cSJonathan Chen  *    the documentation and/or other materials provided with the
140db7e66cSJonathan Chen  *    distribution.
150db7e66cSJonathan Chen  *
160db7e66cSJonathan Chen  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
170db7e66cSJonathan Chen  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
180db7e66cSJonathan Chen  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
190db7e66cSJonathan Chen  * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
200db7e66cSJonathan Chen  * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
210db7e66cSJonathan Chen  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
220db7e66cSJonathan Chen  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
230db7e66cSJonathan Chen  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
240db7e66cSJonathan Chen  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
250db7e66cSJonathan Chen  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
260db7e66cSJonathan Chen  * SUCH DAMAGE.
270db7e66cSJonathan Chen  *
280db7e66cSJonathan Chen  * $FreeBSD$
290db7e66cSJonathan Chen  */
300db7e66cSJonathan Chen 
310db7e66cSJonathan Chen /*
320db7e66cSJonathan Chen  * Cardbus CIS definitions
330db7e66cSJonathan Chen  */
340db7e66cSJonathan Chen 
350c95c705SJonathan Chen struct cis_tupleinfo;
360c95c705SJonathan Chen 
370db7e66cSJonathan Chen int cardbus_do_cis(device_t dev, device_t child);
380c95c705SJonathan Chen int cardbus_cis_read(device_t dev, device_t child, u_int8_t id,
390c95c705SJonathan Chen 		     struct cis_tupleinfo** buff, int* nret);
400c95c705SJonathan Chen void cardbus_cis_free(device_t dev, struct cis_tupleinfo *buff, int* nret);
410db7e66cSJonathan Chen 
420db7e66cSJonathan Chen #define MAXTUPLESIZE		0x400
430db7e66cSJonathan Chen 
440db7e66cSJonathan Chen /* CIS TUPLES */
450db7e66cSJonathan Chen 
460db7e66cSJonathan Chen #define CISTPL_NULL		0x00
470db7e66cSJonathan Chen #define CISTPL_DEVICE		0x01
480db7e66cSJonathan Chen #define CISTPL_LONG_LINK_CB	0x02
490db7e66cSJonathan Chen #define CISTPL_INDIRECT		0x03
500db7e66cSJonathan Chen #define CISTPL_CONFIG_CB	0x04
510db7e66cSJonathan Chen #define CISTPL_CFTABLE_ENTRY_CB	0x05
520db7e66cSJonathan Chen #define CISTPL_LONGLINK_MFC	0x06
530db7e66cSJonathan Chen #define CISTPL_BAR		0x07
540db7e66cSJonathan Chen #define CISTPL_PWR_MGMNT	0x08
550db7e66cSJonathan Chen #define CISTPL_EXTDEVICE	0x09
560db7e66cSJonathan Chen #define CISTPL_CHECKSUM		0x10
570db7e66cSJonathan Chen #define CISTPL_LONGLINK_A	0x11
580db7e66cSJonathan Chen #define CISTPL_LONGLINK_C	0x12
590db7e66cSJonathan Chen #define CISTPL_LINKTARGET	0x13
600db7e66cSJonathan Chen #define CISTPL_NO_LINK		0x14
610db7e66cSJonathan Chen #define CISTPL_VERS_1		0x15
620db7e66cSJonathan Chen #define CISTPL_ALTSTR		0x16
630db7e66cSJonathan Chen #define CISTPL_DEVICE_A		0x17
640db7e66cSJonathan Chen #define CISTPL_JEDEC_C		0x18
650db7e66cSJonathan Chen #define CISTPL_JEDEC_A		0x19
660db7e66cSJonathan Chen #define CISTPL_CONFIG		0x1A
670db7e66cSJonathan Chen #define CISTPL_CFTABLE_ENTRY	0x1B
680db7e66cSJonathan Chen #define CISTPL_DEVICE_OC	0x1C
690db7e66cSJonathan Chen #define CISTPL_DEVICE_OA	0x1D
700db7e66cSJonathan Chen #define CISTPL_DEVICE_GEO	0x1E
710db7e66cSJonathan Chen #define CISTPL_DEVICE_GEO_A	0x1F
720db7e66cSJonathan Chen #define CISTPL_MANFID		0x20
730db7e66cSJonathan Chen #define CISTPL_FUNCID		0x21
740db7e66cSJonathan Chen #define CISTPL_FUNCE		0x22
750db7e66cSJonathan Chen #define CISTPL_SWIL		0x23
760db7e66cSJonathan Chen #define CISTPL_VERS_2		0x40
770db7e66cSJonathan Chen #define CISTPL_FORMAT		0x41
780db7e66cSJonathan Chen #define CISTPL_GEOMETRY		0x42
790db7e66cSJonathan Chen #define CISTPL_BYTEORDER	0x43
800db7e66cSJonathan Chen #define CISTPL_DATE		0x44
810db7e66cSJonathan Chen #define CISTPL_BATTERY		0x45
820db7e66cSJonathan Chen #define CISTPL_ORG		0x46
8349f158ccSJonathan Chen #define CISTPL_CUSTOMSTART	0x80
840db7e66cSJonathan Chen #define CISTPL_END		0xFF
850db7e66cSJonathan Chen 
860c95c705SJonathan Chen #define CISTPL_GENERIC		-1	/* catchall */
870c95c705SJonathan Chen 
880db7e66cSJonathan Chen /* BAR */
890db7e66cSJonathan Chen #define TPL_BAR_REG_ASI_MASK	0x07
90d58b9dbcSJonathan Chen #define TPL_BAR_REG_AS		0x10
910db7e66cSJonathan Chen 
920db7e66cSJonathan Chen /* CISTPL_FUNC */
930db7e66cSJonathan Chen #define TPL_FUNC_MF		0	/* multi function tuple */
940db7e66cSJonathan Chen #define TPL_FUNC_MEM		1	/* memory */
950db7e66cSJonathan Chen #define TPL_FUNC_SERIAL		2	/* serial, including modem and fax */
960db7e66cSJonathan Chen #define TPL_FUNC_PARALLEL	3	/* parallel, including printer and SCSI */
970db7e66cSJonathan Chen #define TPL_FUNC_DISK		4	/* Disk */
980db7e66cSJonathan Chen #define TPL_FUNC_VIDEO		5	/* Video Adaptor */
990db7e66cSJonathan Chen #define TPL_FUNC_LAN		6	/* LAN Adaptor */
1000db7e66cSJonathan Chen #define TPL_FUNC_AIMS		7	/* Auto Inclement Mass Strages */
1010db7e66cSJonathan Chen 
1020db7e66cSJonathan Chen /* TPL_FUNC_LAN */
1030db7e66cSJonathan Chen #define TPL_FUNCE_LAN_TECH	1	/* technology */
1040db7e66cSJonathan Chen #define TPL_FUNCE_LAN_SPEED	2	/* speed */
1050db7e66cSJonathan Chen #define TPL_FUNCE_LAN_MEDIA	2	/* which media do you use? */
1060db7e66cSJonathan Chen #define TPL_FUNCE_LAN_NID	4	/* node id (address) */
1070db7e66cSJonathan Chen #define TPL_FUNCE_LAN_CONN	5	/* connector type (shape) */
108