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