Merge from vendor branch OPENSSH:
[dragonfly.git] / sys / emulation / ndis / resource_var.h
1 /*
2  * $FreeBSD: src/sys/compat/ndis/resource_var.h,v 1.2 2004/03/29 02:15:29 wpaul Exp $
3  * $DragonFly: src/sys/emulation/ndis/resource_var.h,v 1.1 2004/07/29 20:51:34 dillon Exp $
4  */
5
6 typedef int cm_resource_type;
7
8 struct physaddr {
9         uint64_t                np_quad;
10 };
11
12 typedef struct physaddr physaddr;
13
14 enum interface_type {
15         InterfaceTypeUndefined = -1,
16         Internal,
17         Isa,
18         Eisa,
19         MicroChannel,
20         TurboChannel,
21         PCIBus,
22         VMEBus,
23         NuBus,
24         PCMCIABus,
25         CBus,
26         MPIBus,
27         MPSABus,
28         ProcessorInternal,
29         InternalPowerBus,
30         PNPISABus,
31         PNPBus,
32         MaximumInterfaceType
33 };
34
35 typedef enum interface_type interface_type;
36
37 #define CmResourceTypeNull                0   /* ResType_All or ResType_None (0x0000) */
38 #define CmResourceTypePort                1   /* ResType_IO (0x0002) */
39 #define CmResourceTypeInterrupt           2   /* ResType_IRQ (0x0004) */
40 #define CmResourceTypeMemory              3   /* ResType_Mem (0x0001) */
41 #define CmResourceTypeDma                 4   /* ResType_DMA (0x0003) */
42 #define CmResourceTypeDeviceSpecific      5   /* ResType_ClassSpecific (0xFFFF) */
43 #define CmResourceTypeBusNumber           6   /* ResType_BusNumber (0x0006) */
44 #define CmResourceTypeMaximum             7
45 #define CmResourceTypeNonArbitrated     128   /* Not arbitrated if 0x80 bit set */
46 #define CmResourceTypeConfigData        128   /* ResType_Reserved (0x8000) */
47 #define CmResourceTypeDevicePrivate     129   /* ResType_DevicePrivate (0x8001) */
48 #define CmResourceTypePcCardConfig      130   /* ResType_PcCardConfig (0x8002) */
49
50 enum cm_share_disposition {
51     CmResourceShareUndetermined = 0,    /* Reserved */
52     CmResourceShareDeviceExclusive,
53     CmResourceShareDriverExclusive,
54     CmResourceShareShared
55 };
56
57 typedef enum cm_share_disposition cm_share_disposition;
58
59 /* Define the bit masks for Flags when type is CmResourceTypeInterrupt */
60
61 #define CM_RESOURCE_INTERRUPT_LEVEL_SENSITIVE 0
62 #define CM_RESOURCE_INTERRUPT_LATCHED         1
63
64 /* Define the bit masks for Flags when type is CmResourceTypeMemory */
65
66 #define CM_RESOURCE_MEMORY_READ_WRITE       0x0000
67 #define CM_RESOURCE_MEMORY_READ_ONLY        0x0001
68 #define CM_RESOURCE_MEMORY_WRITE_ONLY       0x0002
69 #define CM_RESOURCE_MEMORY_PREFETCHABLE     0x0004
70
71 #define CM_RESOURCE_MEMORY_COMBINEDWRITE    0x0008
72 #define CM_RESOURCE_MEMORY_24               0x0010
73 #define CM_RESOURCE_MEMORY_CACHEABLE        0x0020
74
75 /* Define the bit masks for Flags when type is CmResourceTypePort */
76
77 #define CM_RESOURCE_PORT_MEMORY                             0x0000
78 #define CM_RESOURCE_PORT_IO                                 0x0001
79 #define CM_RESOURCE_PORT_10_BIT_DECODE                      0x0004
80 #define CM_RESOURCE_PORT_12_BIT_DECODE                      0x0008
81 #define CM_RESOURCE_PORT_16_BIT_DECODE                      0x0010
82 #define CM_RESOURCE_PORT_POSITIVE_DECODE                    0x0020
83 #define CM_RESOURCE_PORT_PASSIVE_DECODE                     0x0040
84 #define CM_RESOURCE_PORT_WINDOW_DECODE                      0x0080
85
86 /* Define the bit masks for Flags when type is CmResourceTypeDma */
87
88 #define CM_RESOURCE_DMA_8                   0x0000
89 #define CM_RESOURCE_DMA_16                  0x0001
90 #define CM_RESOURCE_DMA_32                  0x0002
91 #define CM_RESOURCE_DMA_8_AND_16            0x0004
92 #define CM_RESOURCE_DMA_BUS_MASTER          0x0008
93 #define CM_RESOURCE_DMA_TYPE_A              0x0010
94 #define CM_RESOURCE_DMA_TYPE_B              0x0020
95 #define CM_RESOURCE_DMA_TYPE_F              0x0040
96
97 struct cm_partial_resource_desc {
98         uint8_t                 cprd_type;
99         uint8_t                 cprd_sharedisp;
100         uint16_t                cprd_flags;
101         union {
102                 struct {
103                         physaddr                cprd_start;
104                         uint32_t                cprd_len;
105                 } cprd_generic;
106                 struct {
107                         physaddr                cprd_start;
108                         uint32_t                cprd_len;
109                 } cprd_port;
110                 struct {
111                         uint32_t                cprd_level;
112                         uint32_t                cprd_vector;
113                         uint32_t                cprd_affinity;
114                 } cprd_intr;
115                 struct {
116                         physaddr                cprd_start;
117                         uint32_t                cprd_len;
118                 } cprd_mem;
119                 struct {
120                         uint32_t                cprd_chan;
121                         uint32_t                cprd_port;
122                         uint32_t                cprd_rsvd;
123                 } cprd_dmachan;
124                 struct {
125                         uint32_t                cprd_data[3];
126                 } cprd_devpriv;
127                 struct {
128                         uint32_t                cprd_datasize;
129                         uint32_t                cprd_rsvd1;
130                         uint32_t                cprd_rsvd2;
131                 } cprd_devspec;
132         } u;
133 };
134
135 typedef struct cm_partial_resource_desc cm_partial_resource_desc;
136
137 struct cm_partial_resource_list {
138         uint16_t                cprl_version;
139         uint16_t                cprl_revision;
140         uint32_t                cprl_count;
141         cm_partial_resource_desc        cprl_partial_descs[1];
142 };
143
144 typedef struct cm_partial_resource_list cm_partial_resource_list;
145
146 struct cm_full_resource_list {
147         interface_type          cfrl_type;
148         uint32_t                cfrl_busnum;
149         cm_partial_resource_desc        cfrl_partiallist;
150 };
151
152 typedef struct cm_full_resource_list cm_full_resource_list;
153
154 struct cm_resource_list {
155         uint32_t                crl_count;
156         cm_full_resource_list   crl_rlist;
157 };
158
159 typedef struct cm_resource_list cm_resource_list;
160
161 typedef cm_partial_resource_list ndis_resource_list;