Merge from vendor branch BSDTAR:
[dragonfly.git] / sys / dev / pccard / cardbus / cardbus_cis.h
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: src/sys/dev/cardbus/cardbus_cis.h,v 1.7 2002/11/27 06:56:29 imp Exp $
29  * $DragonFly: src/sys/dev/pccard/cardbus/cardbus_cis.h,v 1.1 2004/02/10 07:55:47 joerg Exp $
30  */
31
32 /*
33  * Cardbus CIS definitions
34  */
35
36 struct cis_tupleinfo;
37
38 int     cardbus_do_cis(device_t, device_t);
39 int     cardbus_cis_read(device_t, device_t, u_int8_t, struct cis_tupleinfo**,
40             int*);
41 void    cardbus_cis_free(device_t, struct cis_tupleinfo*, int*);
42
43 #define MAXTUPLESIZE            0x400
44
45 /* CIS TUPLES */
46
47 #define CISTPL_NULL             0x00
48 #define CISTPL_DEVICE           0x01
49 #define CISTPL_LONG_LINK_CB     0x02
50 #define CISTPL_INDIRECT         0x03
51 #define CISTPL_CONFIG_CB        0x04
52 #define CISTPL_CFTABLE_ENTRY_CB 0x05
53 #define CISTPL_LONGLINK_MFC     0x06
54 #define CISTPL_BAR              0x07
55 #define CISTPL_PWR_MGMNT        0x08
56 #define CISTPL_EXTDEVICE        0x09
57 #define CISTPL_CHECKSUM         0x10
58 #define CISTPL_LONGLINK_A       0x11
59 #define CISTPL_LONGLINK_C       0x12
60 #define CISTPL_LINKTARGET       0x13
61 #define CISTPL_NO_LINK          0x14
62 #define CISTPL_VERS_1           0x15
63 #define CISTPL_ALTSTR           0x16
64 #define CISTPL_DEVICE_A         0x17
65 #define CISTPL_JEDEC_C          0x18
66 #define CISTPL_JEDEC_A          0x19
67 #define CISTPL_CONFIG           0x1A
68 #define CISTPL_CFTABLE_ENTRY    0x1B
69 #define CISTPL_DEVICE_OC        0x1C
70 #define CISTPL_DEVICE_OA        0x1D
71 #define CISTPL_DEVICE_GEO       0x1E
72 #define CISTPL_DEVICE_GEO_A     0x1F
73 #define CISTPL_MANFID           0x20
74 #define CISTPL_FUNCID           0x21
75 #define CISTPL_FUNCE            0x22
76 #define CISTPL_SWIL             0x23
77 #define CISTPL_VERS_2           0x40
78 #define CISTPL_FORMAT           0x41
79 #define CISTPL_GEOMETRY         0x42
80 #define CISTPL_BYTEORDER        0x43
81 #define CISTPL_DATE             0x44
82 #define CISTPL_BATTERY          0x45
83 #define CISTPL_ORG              0x46
84 #define CISTPL_CUSTOMSTART      0x80
85 #define CISTPL_END              0xFF
86
87 #define CISTPL_GENERIC          -1      /* catchall */
88
89 /* BAR */
90 #define TPL_BAR_REG_ASI_MASK                    0x07
91 #define TPL_BAR_REG_AS                          0x10
92 #define TPL_BAR_REG_PREFETCHABLE_ONLY           0x20
93 #define TPL_BAR_REG_PREFETCHABLE_CACHEABLE      0x40
94 #define TPL_BAR_REG_PREFETCHABLE                0x60
95 #define TPL_BAR_REG_BELOW1MB                    0x80
96
97 /* CISTPL_FUNC */
98 #define TPL_FUNC_MF             0       /* multi function tuple */
99 #define TPL_FUNC_MEM            1       /* memory */
100 #define TPL_FUNC_SERIAL         2       /* serial, including modem and fax */
101 #define TPL_FUNC_PARALLEL       3       /* parallel, including printer and SCSI */
102 #define TPL_FUNC_DISK           4       /* Disk */
103 #define TPL_FUNC_VIDEO          5       /* Video Adaptor */
104 #define TPL_FUNC_LAN            6       /* LAN Adaptor */
105 #define TPL_FUNC_AIMS           7       /* Auto Inclement Mass Strages */
106
107 /* TPL_FUNC_LAN */
108 #define TPL_FUNCE_LAN_TECH      1       /* technology */
109 #define TPL_FUNCE_LAN_SPEED     2       /* speed */
110 #define TPL_FUNCE_LAN_MEDIA     3       /* which media do you use? */
111 #define TPL_FUNCE_LAN_NID       4       /* node id (address) */
112 #define TPL_FUNCE_LAN_CONN      5       /* connector type (shape) */
113
114 /* TPL_FUNC_SERIAL */
115 #define TPL_FUNCE_SER_UART      0       /* UART type */