1 /*-
2 * SPDX-License-Identifier: BSD-4-Clause
3 *
4 * Copyright (c) 2005
5 * Bill Paul <wpaul@windriver.com>. All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 * 3. All advertising materials mentioning features or use of this software
16 * must display the following acknowledgement:
17 * This product includes software developed by Bill Paul.
18 * 4. Neither the name of the author nor the names of any co-contributors
19 * may be used to endorse or promote products derived from this software
20 * without specific prior written permission.
21 *
22 * THIS SOFTWARE IS PROVIDED BY Bill Paul AND CONTRIBUTORS ``AS IS'' AND
23 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25 * ARE DISCLAIMED. IN NO EVENT SHALL Bill Paul OR THE VOICES IN HIS HEAD
26 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
27 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
28 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
29 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
30 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
31 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
32 * THE POSSIBILITY OF SUCH DAMAGE.
33 *
34 * $FreeBSD$
35 */
36
37 #ifndef _RESOURCE_VAR_H_
38 #define _RESOURCE_VAR_H_
39
40 typedef int cm_resource_type;
41
42 struct physaddr {
43 uint64_t np_quad;
44 #ifdef notdef
45 uint32_t np_low;
46 uint32_t np_high;
47 #endif
48 };
49
50 typedef struct physaddr physaddr;
51
52 enum interface_type {
53 InterfaceTypeUndefined = -1,
54 Internal,
55 Isa,
56 Eisa,
57 MicroChannel,
58 TurboChannel,
59 PCIBus,
60 VMEBus,
61 NuBus,
62 PCMCIABus,
63 CBus,
64 MPIBus,
65 MPSABus,
66 ProcessorInternal,
67 InternalPowerBus,
68 PNPISABus,
69 PNPBus,
70 MaximumInterfaceType
71 };
72
73 typedef enum interface_type interface_type;
74
75 #define CmResourceTypeNull 0 /* ResType_All or ResType_None (0x0000) */
76 #define CmResourceTypePort 1 /* ResType_IO (0x0002) */
77 #define CmResourceTypeInterrupt 2 /* ResType_IRQ (0x0004) */
78 #define CmResourceTypeMemory 3 /* ResType_Mem (0x0001) */
79 #define CmResourceTypeDma 4 /* ResType_DMA (0x0003) */
80 #define CmResourceTypeDeviceSpecific 5 /* ResType_ClassSpecific (0xFFFF) */
81 #define CmResourceTypeBusNumber 6 /* ResType_BusNumber (0x0006) */
82 #define CmResourceTypeMaximum 7
83 #define CmResourceTypeNonArbitrated 128 /* Not arbitrated if 0x80 bit set */
84 #define CmResourceTypeConfigData 128 /* ResType_Reserved (0x8000) */
85 #define CmResourceTypeDevicePrivate 129 /* ResType_DevicePrivate (0x8001) */
86 #define CmResourceTypePcCardConfig 130 /* ResType_PcCardConfig (0x8002) */
87
88 enum cm_share_disposition {
89 CmResourceShareUndetermined = 0, /* Reserved */
90 CmResourceShareDeviceExclusive,
91 CmResourceShareDriverExclusive,
92 CmResourceShareShared
93 };
94
95 typedef enum cm_share_disposition cm_share_disposition;
96
97 /* Define the bit masks for Flags when type is CmResourceTypeInterrupt */
98
99 #define CM_RESOURCE_INTERRUPT_LEVEL_SENSITIVE 0
100 #define CM_RESOURCE_INTERRUPT_LATCHED 1
101
102 /* Define the bit masks for Flags when type is CmResourceTypeMemory */
103
104 #define CM_RESOURCE_MEMORY_READ_WRITE 0x0000
105 #define CM_RESOURCE_MEMORY_READ_ONLY 0x0001
106 #define CM_RESOURCE_MEMORY_WRITE_ONLY 0x0002
107 #define CM_RESOURCE_MEMORY_PREFETCHABLE 0x0004
108
109 #define CM_RESOURCE_MEMORY_COMBINEDWRITE 0x0008
110 #define CM_RESOURCE_MEMORY_24 0x0010
111 #define CM_RESOURCE_MEMORY_CACHEABLE 0x0020
112
113 /* Define the bit masks for Flags when type is CmResourceTypePort */
114
115 #define CM_RESOURCE_PORT_MEMORY 0x0000
116 #define CM_RESOURCE_PORT_IO 0x0001
117 #define CM_RESOURCE_PORT_10_BIT_DECODE 0x0004
118 #define CM_RESOURCE_PORT_12_BIT_DECODE 0x0008
119 #define CM_RESOURCE_PORT_16_BIT_DECODE 0x0010
120 #define CM_RESOURCE_PORT_POSITIVE_DECODE 0x0020
121 #define CM_RESOURCE_PORT_PASSIVE_DECODE 0x0040
122 #define CM_RESOURCE_PORT_WINDOW_DECODE 0x0080
123
124 /* Define the bit masks for Flags when type is CmResourceTypeDma */
125
126 #define CM_RESOURCE_DMA_8 0x0000
127 #define CM_RESOURCE_DMA_16 0x0001
128 #define CM_RESOURCE_DMA_32 0x0002
129 #define CM_RESOURCE_DMA_8_AND_16 0x0004
130 #define CM_RESOURCE_DMA_BUS_MASTER 0x0008
131 #define CM_RESOURCE_DMA_TYPE_A 0x0010
132 #define CM_RESOURCE_DMA_TYPE_B 0x0020
133 #define CM_RESOURCE_DMA_TYPE_F 0x0040
134
135 struct cm_partial_resource_desc {
136 uint8_t cprd_type;
137 uint8_t cprd_sharedisp;
138 uint16_t cprd_flags;
139 union {
140 struct {
141 physaddr cprd_start;
142 uint32_t cprd_len;
143 } cprd_generic;
144 struct {
145 physaddr cprd_start;
146 uint32_t cprd_len;
147 } cprd_port;
148 struct {
149 uint32_t cprd_level;
150 uint32_t cprd_vector;
151 uint32_t cprd_affinity;
152 } cprd_intr;
153 struct {
154 physaddr cprd_start;
155 uint32_t cprd_len;
156 } cprd_mem;
157 struct {
158 uint32_t cprd_chan;
159 uint32_t cprd_port;
160 uint32_t cprd_rsvd;
161 } cprd_dmachan;
162 struct {
163 uint32_t cprd_data[3];
164 } cprd_devpriv;
165 struct {
166 uint32_t cprd_datasize;
167 uint32_t cprd_rsvd1;
168 uint32_t cprd_rsvd2;
169 } cprd_devspec;
170 } u __attribute__((packed));
171 };
172
173 typedef struct cm_partial_resource_desc cm_partial_resource_desc;
174
175 struct cm_partial_resource_list {
176 uint16_t cprl_version;
177 uint16_t cprl_revision;
178 uint32_t cprl_count;
179 cm_partial_resource_desc cprl_partial_descs[1];
180 };
181
182 typedef struct cm_partial_resource_list cm_partial_resource_list;
183
184 struct cm_full_resource_list {
185 interface_type cfrl_type;
186 uint32_t cfrl_busnum;
187 cm_partial_resource_desc cfrl_partiallist;
188 };
189
190 typedef struct cm_full_resource_list cm_full_resource_list;
191
192 struct cm_resource_list {
193 uint32_t crl_count;
194 cm_full_resource_list crl_rlist;
195 };
196
197 typedef struct cm_resource_list cm_resource_list;
198
199 typedef cm_partial_resource_list ndis_resource_list;
200
201 #endif /* _RESOURCE_VAR_H_ */
Cache object: d4e3f14b8a6bdb4293bc0b07b1feb04e
|