1141963Swpaul/*-
2141963Swpaul * Copyright (c) 2005
3141963Swpaul *      Bill Paul <wpaul@windriver.com>.  All rights reserved.
4141963Swpaul *
5141963Swpaul * Redistribution and use in source and binary forms, with or without
6141963Swpaul * modification, are permitted provided that the following conditions
7141963Swpaul * are met:
8141963Swpaul * 1. Redistributions of source code must retain the above copyright
9141963Swpaul *    notice, this list of conditions and the following disclaimer.
10141963Swpaul * 2. Redistributions in binary form must reproduce the above copyright
11141963Swpaul *    notice, this list of conditions and the following disclaimer in the
12141963Swpaul *    documentation and/or other materials provided with the distribution.
13141963Swpaul * 3. All advertising materials mentioning features or use of this software
14141963Swpaul *    must display the following acknowledgement:
15141963Swpaul *      This product includes software developed by Bill Paul.
16141963Swpaul * 4. Neither the name of the author nor the names of any co-contributors
17141963Swpaul *    may be used to endorse or promote products derived from this software
18141963Swpaul *    without specific prior written permission.
19141963Swpaul *
20141963Swpaul * THIS SOFTWARE IS PROVIDED BY Bill Paul AND CONTRIBUTORS ``AS IS'' AND
21141963Swpaul * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22141963Swpaul * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23141963Swpaul * ARE DISCLAIMED.  IN NO EVENT SHALL Bill Paul OR THE VOICES IN HIS HEAD
24141963Swpaul * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25141963Swpaul * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26141963Swpaul * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27141963Swpaul * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28141963Swpaul * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29141963Swpaul * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
30141963Swpaul * THE POSSIBILITY OF SUCH DAMAGE.
31141963Swpaul *
32123474Swpaul * $FreeBSD$
33123474Swpaul */
34123474Swpaul
35141963Swpaul#ifndef _RESOURCE_VAR_H_
36189488Sweongyo#define	_RESOURCE_VAR_H_
37141963Swpaul
38123474Swpaultypedef int cm_resource_type;
39123474Swpaul
40123474Swpaulstruct physaddr {
41189488Sweongyo	uint64_t		np_quad;
42141963Swpaul#ifdef notdef
43189488Sweongyo	uint32_t		np_low;
44189488Sweongyo	uint32_t		np_high;
45141963Swpaul#endif
46123474Swpaul};
47123474Swpaul
48123474Swpaultypedef struct physaddr physaddr;
49123474Swpaul
50123474Swpaulenum interface_type {
51189488Sweongyo	InterfaceTypeUndefined = -1,
52189488Sweongyo	Internal,
53189488Sweongyo	Isa,
54189488Sweongyo	Eisa,
55189488Sweongyo	MicroChannel,
56189488Sweongyo	TurboChannel,
57189488Sweongyo	PCIBus,
58189488Sweongyo	VMEBus,
59189488Sweongyo	NuBus,
60189488Sweongyo	PCMCIABus,
61189488Sweongyo	CBus,
62189488Sweongyo	MPIBus,
63189488Sweongyo	MPSABus,
64189488Sweongyo	ProcessorInternal,
65189488Sweongyo	InternalPowerBus,
66189488Sweongyo	PNPISABus,
67189488Sweongyo	PNPBus,
68189488Sweongyo	MaximumInterfaceType
69123474Swpaul};
70123474Swpaul
71123474Swpaultypedef enum interface_type interface_type;
72123474Swpaul
73189488Sweongyo#define	CmResourceTypeNull                0   /* ResType_All or ResType_None (0x0000) */
74189488Sweongyo#define	CmResourceTypePort                1   /* ResType_IO (0x0002) */
75189488Sweongyo#define	CmResourceTypeInterrupt           2   /* ResType_IRQ (0x0004) */
76189488Sweongyo#define	CmResourceTypeMemory              3   /* ResType_Mem (0x0001) */
77189488Sweongyo#define	CmResourceTypeDma                 4   /* ResType_DMA (0x0003) */
78189488Sweongyo#define	CmResourceTypeDeviceSpecific      5   /* ResType_ClassSpecific (0xFFFF) */
79189488Sweongyo#define	CmResourceTypeBusNumber           6   /* ResType_BusNumber (0x0006) */
80189488Sweongyo#define	CmResourceTypeMaximum             7
81189488Sweongyo#define	CmResourceTypeNonArbitrated     128   /* Not arbitrated if 0x80 bit set */
82189488Sweongyo#define	CmResourceTypeConfigData        128   /* ResType_Reserved (0x8000) */
83189488Sweongyo#define	CmResourceTypeDevicePrivate     129   /* ResType_DevicePrivate (0x8001) */
84189488Sweongyo#define	CmResourceTypePcCardConfig      130   /* ResType_PcCardConfig (0x8002) */
85123474Swpaul
86123474Swpaulenum cm_share_disposition {
87123474Swpaul    CmResourceShareUndetermined = 0,    /* Reserved */
88123474Swpaul    CmResourceShareDeviceExclusive,
89123474Swpaul    CmResourceShareDriverExclusive,
90123474Swpaul    CmResourceShareShared
91123474Swpaul};
92123474Swpaul
93123474Swpaultypedef enum cm_share_disposition cm_share_disposition;
94123474Swpaul
95123474Swpaul/* Define the bit masks for Flags when type is CmResourceTypeInterrupt */
96123474Swpaul
97189488Sweongyo#define	CM_RESOURCE_INTERRUPT_LEVEL_SENSITIVE	0
98189488Sweongyo#define	CM_RESOURCE_INTERRUPT_LATCHED		1
99123474Swpaul
100123474Swpaul/* Define the bit masks for Flags when type is CmResourceTypeMemory */
101123474Swpaul
102189488Sweongyo#define	CM_RESOURCE_MEMORY_READ_WRITE		0x0000
103189488Sweongyo#define	CM_RESOURCE_MEMORY_READ_ONLY		0x0001
104189488Sweongyo#define	CM_RESOURCE_MEMORY_WRITE_ONLY		0x0002
105189488Sweongyo#define	CM_RESOURCE_MEMORY_PREFETCHABLE		0x0004
106123474Swpaul
107189488Sweongyo#define	CM_RESOURCE_MEMORY_COMBINEDWRITE	0x0008
108189488Sweongyo#define	CM_RESOURCE_MEMORY_24			0x0010
109189488Sweongyo#define	CM_RESOURCE_MEMORY_CACHEABLE		0x0020
110123474Swpaul
111123474Swpaul/* Define the bit masks for Flags when type is CmResourceTypePort */
112123474Swpaul
113189488Sweongyo#define	CM_RESOURCE_PORT_MEMORY			0x0000
114189488Sweongyo#define	CM_RESOURCE_PORT_IO			0x0001
115189488Sweongyo#define	CM_RESOURCE_PORT_10_BIT_DECODE		0x0004
116189488Sweongyo#define	CM_RESOURCE_PORT_12_BIT_DECODE		0x0008
117189488Sweongyo#define	CM_RESOURCE_PORT_16_BIT_DECODE		0x0010
118189488Sweongyo#define	CM_RESOURCE_PORT_POSITIVE_DECODE	0x0020
119189488Sweongyo#define	CM_RESOURCE_PORT_PASSIVE_DECODE		0x0040
120189488Sweongyo#define	CM_RESOURCE_PORT_WINDOW_DECODE		0x0080
121123474Swpaul
122123474Swpaul/* Define the bit masks for Flags when type is CmResourceTypeDma */
123123474Swpaul
124189488Sweongyo#define	CM_RESOURCE_DMA_8			0x0000
125189488Sweongyo#define	CM_RESOURCE_DMA_16			0x0001
126189488Sweongyo#define	CM_RESOURCE_DMA_32			0x0002
127189488Sweongyo#define	CM_RESOURCE_DMA_8_AND_16		0x0004
128189488Sweongyo#define	CM_RESOURCE_DMA_BUS_MASTER		0x0008
129189488Sweongyo#define	CM_RESOURCE_DMA_TYPE_A			0x0010
130189488Sweongyo#define	CM_RESOURCE_DMA_TYPE_B			0x0020
131189488Sweongyo#define	CM_RESOURCE_DMA_TYPE_F			0x0040
132123474Swpaul
133123474Swpaulstruct cm_partial_resource_desc {
134123474Swpaul	uint8_t			cprd_type;
135123474Swpaul	uint8_t			cprd_sharedisp;
136127552Swpaul	uint16_t		cprd_flags;
137123474Swpaul	union {
138123474Swpaul		struct {
139123474Swpaul			physaddr		cprd_start;
140123474Swpaul			uint32_t		cprd_len;
141123474Swpaul		} cprd_generic;
142123474Swpaul		struct {
143123474Swpaul			physaddr		cprd_start;
144123474Swpaul			uint32_t		cprd_len;
145123474Swpaul		} cprd_port;
146123474Swpaul		struct {
147123474Swpaul			uint32_t		cprd_level;
148123474Swpaul			uint32_t		cprd_vector;
149123474Swpaul			uint32_t		cprd_affinity;
150123474Swpaul		} cprd_intr;
151123474Swpaul		struct {
152123474Swpaul			physaddr		cprd_start;
153123474Swpaul			uint32_t		cprd_len;
154123474Swpaul		} cprd_mem;
155123474Swpaul		struct {
156123474Swpaul			uint32_t		cprd_chan;
157123474Swpaul			uint32_t		cprd_port;
158123474Swpaul			uint32_t		cprd_rsvd;
159123474Swpaul		} cprd_dmachan;
160123474Swpaul		struct {
161123474Swpaul			uint32_t		cprd_data[3];
162123474Swpaul		} cprd_devpriv;
163123474Swpaul		struct {
164123474Swpaul			uint32_t		cprd_datasize;
165123474Swpaul			uint32_t		cprd_rsvd1;
166123474Swpaul			uint32_t		cprd_rsvd2;
167123474Swpaul		} cprd_devspec;
168141963Swpaul	} u __attribute__((packed));
169123474Swpaul};
170123474Swpaul
171123474Swpaultypedef struct cm_partial_resource_desc cm_partial_resource_desc;
172123474Swpaul
173123474Swpaulstruct cm_partial_resource_list {
174123474Swpaul	uint16_t		cprl_version;
175123474Swpaul	uint16_t		cprl_revision;
176123474Swpaul	uint32_t		cprl_count;
177123474Swpaul	cm_partial_resource_desc	cprl_partial_descs[1];
178123474Swpaul};
179123474Swpaul
180123474Swpaultypedef struct cm_partial_resource_list cm_partial_resource_list;
181123474Swpaul
182123474Swpaulstruct cm_full_resource_list {
183123474Swpaul	interface_type		cfrl_type;
184123474Swpaul	uint32_t		cfrl_busnum;
185123474Swpaul	cm_partial_resource_desc	cfrl_partiallist;
186123474Swpaul};
187123474Swpaul
188123474Swpaultypedef struct cm_full_resource_list cm_full_resource_list;
189123474Swpaul
190123474Swpaulstruct cm_resource_list {
191123474Swpaul	uint32_t		crl_count;
192123474Swpaul	cm_full_resource_list	crl_rlist;
193123474Swpaul};
194123474Swpaul
195123474Swpaultypedef struct cm_resource_list cm_resource_list;
196123474Swpaul
197123474Swpaultypedef cm_partial_resource_list ndis_resource_list;
198141963Swpaul
199141963Swpaul#endif /* _RESOURCE_VAR_H_ */
200