cardbus_cis.h revision 82378
160484Sobrien/*
2218822Sdim * Copyright (c) 2000,2001 Jonathan Chen.
3218822Sdim * All rights reserved.
460484Sobrien *
560484Sobrien * Redistribution and use in source and binary forms, with or without
660484Sobrien * modification, are permitted provided that the following conditions
760484Sobrien * are met:
860484Sobrien * 1. Redistributions of source code must retain the above copyright
960484Sobrien *    notice, this list of conditions, and the following disclaimer,
1060484Sobrien *    without modification, immediately at the beginning of the file.
1160484Sobrien * 2. Redistributions in binary form must reproduce the above copyright
1260484Sobrien *    notice, this list of conditions and the following disclaimer in
1360484Sobrien *    the documentation and/or other materials provided with the
1460484Sobrien *    distribution.
1560484Sobrien *
1660484Sobrien * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
1760484Sobrien * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1860484Sobrien * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19218822Sdim * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
20218822Sdim * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2160484Sobrien * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2260484Sobrien * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2360484Sobrien * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2460484Sobrien * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25218822Sdim * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2660484Sobrien * SUCH DAMAGE.
2760484Sobrien *
2860484Sobrien * $FreeBSD: head/sys/dev/cardbus/cardbus_cis.h 82378 2001-08-27 00:09:42Z jon $
2960484Sobrien */
3060484Sobrien
3160484Sobrien/*
3260484Sobrien * Cardbus CIS definitions
3360484Sobrien */
3460484Sobrien
3560484Sobrienstruct cis_tupleinfo;
3660484Sobrien
3789857Sobrienint	cardbus_do_cis(device_t, device_t);
3860484Sobrienint	cardbus_cis_read(device_t, device_t, u_int8_t, struct cis_tupleinfo**,
39130561Sobrien	    int*);
40130561Sobrienvoid	cardbus_cis_free(device_t, struct cis_tupleinfo*, int*);
41130561Sobrien
42130561Sobrien#define	MAXTUPLESIZE		0x400
43130561Sobrien
44130561Sobrien/* CIS TUPLES */
45130561Sobrien
46130561Sobrien#define	CISTPL_NULL		0x00
47130561Sobrien#define	CISTPL_DEVICE		0x01
48130561Sobrien#define	CISTPL_LONG_LINK_CB	0x02
49130561Sobrien#define	CISTPL_INDIRECT		0x03
50130561Sobrien#define	CISTPL_CONFIG_CB	0x04
51130561Sobrien#define	CISTPL_CFTABLE_ENTRY_CB	0x05
52130561Sobrien#define	CISTPL_LONGLINK_MFC	0x06
53130561Sobrien#define	CISTPL_BAR		0x07
54130561Sobrien#define	CISTPL_PWR_MGMNT	0x08
55130561Sobrien#define	CISTPL_EXTDEVICE	0x09
56130561Sobrien#define	CISTPL_CHECKSUM		0x10
57130561Sobrien#define	CISTPL_LONGLINK_A	0x11
58130561Sobrien#define	CISTPL_LONGLINK_C	0x12
59130561Sobrien#define	CISTPL_LINKTARGET	0x13
60130561Sobrien#define	CISTPL_NO_LINK		0x14
61130561Sobrien#define	CISTPL_VERS_1		0x15
62130561Sobrien#define	CISTPL_ALTSTR		0x16
63218822Sdim#define	CISTPL_DEVICE_A		0x17
64218822Sdim#define	CISTPL_JEDEC_C		0x18
65218822Sdim#define	CISTPL_JEDEC_A		0x19
6660484Sobrien#define	CISTPL_CONFIG		0x1A
67#define	CISTPL_CFTABLE_ENTRY	0x1B
68#define	CISTPL_DEVICE_OC	0x1C
69#define	CISTPL_DEVICE_OA	0x1D
70#define	CISTPL_DEVICE_GEO	0x1E
71#define	CISTPL_DEVICE_GEO_A	0x1F
72#define	CISTPL_MANFID		0x20
73#define	CISTPL_FUNCID		0x21
74#define	CISTPL_FUNCE		0x22
75#define	CISTPL_SWIL		0x23
76#define	CISTPL_VERS_2		0x40
77#define	CISTPL_FORMAT		0x41
78#define	CISTPL_GEOMETRY		0x42
79#define	CISTPL_BYTEORDER	0x43
80#define	CISTPL_DATE		0x44
81#define	CISTPL_BATTERY		0x45
82#define	CISTPL_ORG		0x46
83#define	CISTPL_CUSTOMSTART	0x80
84#define	CISTPL_END		0xFF
85
86#define	CISTPL_GENERIC		-1	/* catchall */
87
88/* BAR */
89#define	TPL_BAR_REG_ASI_MASK			0x07
90#define	TPL_BAR_REG_AS				0x10
91#define	TPL_BAR_REG_PREFETCHABLE_ONLY		0x20
92#define	TPL_BAR_REG_PREFETCHABLE_CACHEABLE	0x40
93#define	TPL_BAR_REG_PREFETCHABLE		0x60
94#define	TPL_BAR_REG_BELOW1MB			0x80
95
96/* CISTPL_FUNC */
97#define	TPL_FUNC_MF		0	/* multi function tuple */
98#define	TPL_FUNC_MEM		1	/* memory */
99#define	TPL_FUNC_SERIAL		2	/* serial, including modem and fax */
100#define	TPL_FUNC_PARALLEL	3	/* parallel, including printer and SCSI */
101#define	TPL_FUNC_DISK		4	/* Disk */
102#define	TPL_FUNC_VIDEO		5	/* Video Adaptor */
103#define	TPL_FUNC_LAN		6	/* LAN Adaptor */
104#define	TPL_FUNC_AIMS		7	/* Auto Inclement Mass Strages */
105
106/* TPL_FUNC_LAN */
107#define	TPL_FUNCE_LAN_TECH	1	/* technology */
108#define	TPL_FUNCE_LAN_SPEED	2	/* speed */
109#define	TPL_FUNCE_LAN_MEDIA	2	/* which media do you use? */
110#define	TPL_FUNCE_LAN_NID	4	/* node id (address) */
111#define	TPL_FUNCE_LAN_CONN	5	/* connector type (shape) */
112