xref: /freebsd/sys/dev/cardbus/cardbus_cis.h (revision 63fa9f4c0df3db694d5fc73334e820ca55fb769e)
1 /*
2  * Copyright (c) 2000,2001 Jonathan Chen.
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  * 1. Redistributions of source code must retain the above copyright
9  *    notice, this list of conditions, and the following disclaimer,
10  *    without modification, immediately at the beginning of the file.
11  * 2. Redistributions in binary form must reproduce the above copyright
12  *    notice, this list of conditions and the following disclaimer in
13  *    the documentation and/or other materials provided with the
14  *    distribution.
15  *
16  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
17  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19  * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
20  * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26  * SUCH DAMAGE.
27  *
28  * $FreeBSD$
29  */
30 
31 /*
32  * Cardbus CIS definitions
33  */
34 
35 struct cis_tupleinfo;
36 
37 int	cardbus_do_cis(device_t, device_t);
38 int	cardbus_cis_read(device_t, device_t, u_int8_t, struct cis_tupleinfo**,
39 	    int*);
40 void	cardbus_cis_free(device_t, struct cis_tupleinfo*, int*);
41 
42 #define	MAXTUPLESIZE		0x400
43 
44 /* CIS TUPLES */
45 
46 #define	CISTPL_NULL		0x00
47 #define	CISTPL_DEVICE		0x01
48 #define	CISTPL_LONG_LINK_CB	0x02
49 #define	CISTPL_INDIRECT		0x03
50 #define	CISTPL_CONFIG_CB	0x04
51 #define	CISTPL_CFTABLE_ENTRY_CB	0x05
52 #define	CISTPL_LONGLINK_MFC	0x06
53 #define	CISTPL_BAR		0x07
54 #define	CISTPL_PWR_MGMNT	0x08
55 #define	CISTPL_EXTDEVICE	0x09
56 #define	CISTPL_CHECKSUM		0x10
57 #define	CISTPL_LONGLINK_A	0x11
58 #define	CISTPL_LONGLINK_C	0x12
59 #define	CISTPL_LINKTARGET	0x13
60 #define	CISTPL_NO_LINK		0x14
61 #define	CISTPL_VERS_1		0x15
62 #define	CISTPL_ALTSTR		0x16
63 #define	CISTPL_DEVICE_A		0x17
64 #define	CISTPL_JEDEC_C		0x18
65 #define	CISTPL_JEDEC_A		0x19
66 #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