ReactOS  0.4.15-dev-4869-g35a816a
arbiter.h
Go to the documentation of this file.
1 /*
2  * PROJECT: ReactOS Kernel&Driver SDK
3  * LICENSE: GPL-2.0-or-later (https://spdx.org/licenses/GPL-2.0-or-later)
4  * PURPOSE: Hardware Resources Arbiter Library
5  * COPYRIGHT: Copyright 2020 Vadim Galyant <vgal@rambler.ru>
6  */
7 
8 #pragma once
9 
10 #define ARBITER_SIGNATURE 'sbrA'
11 #define TAG_ARBITER 'MbrA'
12 #define TAG_ARB_ALLOCATION 'AbrA'
13 #define TAG_ARB_RANGE 'RbrA'
14 
15 typedef struct _ARBITER_ORDERING
16 {
20 
21 typedef struct _ARBITER_ORDERING_LIST
22 {
27 
28 typedef struct _ARBITER_ALTERNATIVE
29 {
39 
41 {
55 
57 
58 typedef NTSTATUS
60  _In_ PIO_RESOURCE_DESCRIPTOR IoDescriptor,
61  _Out_ PUINT64 OutMinimumAddress,
62  _Out_ PUINT64 OutMaximumAddress,
63  _Out_ PUINT32 OutLength,
64  _Out_ PUINT32 OutAlignment
65 );
66 
67 typedef NTSTATUS
69  _In_ PIO_RESOURCE_DESCRIPTOR IoDescriptor,
72 );
73 
74 typedef NTSTATUS
78  _Out_ PUINT32 OutLength
79 );
80 
81 typedef INT32
83  _In_ PIO_RESOURCE_DESCRIPTOR IoDescriptor
84 );
85 
86 typedef NTSTATUS
88  _In_ PARBITER_INSTANCE Arbiter,
89  _In_ PLIST_ENTRY ArbitrationList
90 );
91 
92 typedef NTSTATUS
94  _In_ PARBITER_INSTANCE Arbiter,
95  _In_ PLIST_ENTRY ArbitrationList
96 );
97 
98 typedef NTSTATUS
100  _In_ PARBITER_INSTANCE Arbiter
101 );
102 
103 typedef NTSTATUS
105  _In_ PARBITER_INSTANCE Arbiter
106 );
107 
108 typedef NTSTATUS
110  _In_ PARBITER_INSTANCE Arbiter,
111  _In_ PLIST_ENTRY ArbitrationList
112 );
113 
114 /* Not correct yet, FIXME! */
115 typedef NTSTATUS
117  _In_ PARBITER_INSTANCE Arbiter
118 );
119 
120 /* Not correct yet, FIXME! */
121 typedef NTSTATUS
123  _In_ PARBITER_INSTANCE Arbiter
124 );
125 
126 /* Not correct yet, FIXME! */
127 typedef NTSTATUS
129  _In_ PARBITER_INSTANCE Arbiter
130 );
131 
132 /* Not correct yet, FIXME! */
133 typedef NTSTATUS
135  _In_ PARBITER_INSTANCE Arbiter
136 );
137 
138 typedef NTSTATUS
140  _In_ PARBITER_INSTANCE Arbiter,
142 );
143 
144 typedef NTSTATUS
146  _In_ PARBITER_INSTANCE Arbiter,
148 );
149 
150 typedef BOOLEAN
152  _In_ PARBITER_INSTANCE Arbiter,
154 );
155 
156 typedef BOOLEAN
158  _In_ PARBITER_INSTANCE Arbiter,
160 );
161 
162 typedef VOID
164  _In_ PARBITER_INSTANCE Arbiter,
166 );
167 
168 typedef VOID
170  _In_ PARBITER_INSTANCE Arbiter,
172 );
173 
174 /* Not correct yet, FIXME! */
175 typedef NTSTATUS
177  _In_ PARBITER_INSTANCE Arbiter
178 );
179 
180 typedef struct _ARBITER_INSTANCE
181 {
185  CM_RESOURCE_TYPE ResourceType;
220 
221 typedef NTSTATUS
223  _Out_ PIO_RESOURCE_DESCRIPTOR OutIoDescriptor,
224  _In_ PIO_RESOURCE_DESCRIPTOR IoDescriptor
225 );
226 
227 CODE_SEG("PAGE")
228 NTSTATUS
229 NTAPI
231  _Inout_ PARBITER_INSTANCE Arbiter,
232  _In_ PDEVICE_OBJECT BusDeviceObject,
233  _In_ CM_RESOURCE_TYPE ResourceType,
234  _In_ PCWSTR ArbiterName,
235  _In_ PCWSTR OrderName,
236  _In_ PARB_TRANSLATE_ORDERING TranslateOrderingFunction
237 );
PARB_START_ARBITER StartArbiter
Definition: arbiter.h:206
PARBITER_ALTERNATIVE CurrentAlternative
Definition: arbiter.h:47
const uint16_t * PCWSTR
Definition: typedefs.h:57
NTSTATUS NTAPI ArbInitializeArbiterInstance(_Inout_ PARBITER_INSTANCE Arbiter, _In_ PDEVICE_OBJECT BusDeviceObject, _In_ CM_RESOURCE_TYPE ResourceType, _In_ PCWSTR ArbiterName, _In_ PCWSTR OrderName, _In_ PARB_TRANSLATE_ORDERING TranslateOrderingFunction)
Definition: arbiter.c:282
PARB_RETEST_ALLOCATION RetestAllocation
Definition: arbiter.h:199
NTSTATUS(NTAPI * PARB_START_ARBITER)(_In_ PARBITER_INSTANCE Arbiter)
Definition: arbiter.h:134
INT32(NTAPI * PARB_SCORE_REQUIREMENT)(_In_ PIO_RESOURCE_DESCRIPTOR IoDescriptor)
Definition: arbiter.h:82
struct _ARBITER_ORDERING ARBITER_ORDERING
PARB_PREPROCESS_ENTRY PreprocessEntry
Definition: arbiter.h:207
struct _ARBITER_ALLOCATION_STATE * PARBITER_ALLOCATION_STATE
PARB_QUERY_CONFLICT QueryConflict
Definition: arbiter.h:204
UINT32 Signature
Definition: arbiter.h:182
#define _Inout_
Definition: ms_sal.h:378
#define _Out_
Definition: ms_sal.h:345
PARBITER_ORDERING Orderings
Definition: arbiter.h:25
unsigned int * PUINT32
Definition: basetsd.h:127
struct _ARBITER_INSTANCE ARBITER_INSTANCE
PARBITER_INTERFACE Interface
Definition: arbiter.h:191
LONG NTSTATUS
Definition: precomp.h:26
struct _ARBITER_ALLOCATION_STATE ARBITER_ALLOCATION_STATE
NTSTATUS(NTAPI * PARB_TRANSLATE_ORDERING)(_Out_ PIO_RESOURCE_DESCRIPTOR OutIoDescriptor, _In_ PIO_RESOURCE_DESCRIPTOR IoDescriptor)
Definition: arbiter.h:222
struct _ARBITER_ORDERING_LIST * PARBITER_ORDERING_LIST
NTSTATUS(NTAPI * PARB_UNPACK_REQUIREMENT)(_In_ PIO_RESOURCE_DESCRIPTOR IoDescriptor, _Out_ PUINT64 OutMinimumAddress, _Out_ PUINT64 OutMaximumAddress, _Out_ PUINT32 OutLength, _Out_ PUINT32 OutAlignment)
Definition: arbiter.h:59
PARBITER_LIST_ENTRY Entry
Definition: arbiter.h:46
PARB_ADD_ALLOCATION AddAllocation
Definition: arbiter.h:211
PARB_TEST_ALLOCATION TestAllocation
Definition: arbiter.h:198
Definition: iotypes.h:4630
NTSTATUS(NTAPI * PARB_PACK_RESOURCE)(_In_ PIO_RESOURCE_DESCRIPTOR IoDescriptor, _In_ UINT64 Start, _Out_ PCM_PARTIAL_RESOURCE_DESCRIPTOR CmDescriptor)
Definition: arbiter.h:68
PKEVENT MutexEvent
Definition: arbiter.h:183
uint32_t ULONG_PTR
Definition: typedefs.h:65
PARB_ROLLBACK_ALLOCATION RollbackAllocation
Definition: arbiter.h:201
PRTL_RANGE_LIST Allocation
Definition: arbiter.h:186
PARB_BACKTRACK_ALLOCATION BacktrackAllocation
Definition: arbiter.h:212
NTSTATUS(NTAPI * PARB_UNPACK_RESOURCE)(_In_ PCM_PARTIAL_RESOURCE_DESCRIPTOR CmDescriptor, _Out_ PUINT64 Start, _Out_ PUINT32 OutLength)
Definition: arbiter.h:75
NTSTATUS(* NTAPI)(IN PFILE_FULL_EA_INFORMATION EaBuffer, IN ULONG EaLength, OUT PULONG ErrorOffset)
Definition: IoEaTest.cpp:117
VOID(NTAPI * PARB_ADD_ALLOCATION)(_In_ PARBITER_INSTANCE Arbiter, _Inout_ PARBITER_ALLOCATION_STATE ArbState)
Definition: arbiter.h:163
unsigned int UINT32
PARB_SCORE_REQUIREMENT ScoreRequirement
Definition: arbiter.h:197
ARBITER_ORDERING_LIST ReservedList
Definition: arbiter.h:189
struct _ARBITER_ALTERNATIVE ARBITER_ALTERNATIVE
NTSTATUS(NTAPI * PARB_ADD_RESERVED)(_In_ PARBITER_INSTANCE Arbiter)
Definition: arbiter.h:128
NTSTATUS(NTAPI * PARB_RETEST_ALLOCATION)(_In_ PARBITER_INSTANCE Arbiter, _In_ PLIST_ENTRY ArbitrationList)
Definition: arbiter.h:93
PDEVICE_OBJECT BusDeviceObject
Definition: arbiter.h:216
NTSTATUS(NTAPI * PARB_ROLLBACK_ALLOCATION)(_In_ PARBITER_INSTANCE Arbiter)
Definition: arbiter.h:104
UINT32 AllocationStackMaxSize
Definition: arbiter.h:192
unsigned char BOOLEAN
#define _In_
Definition: ms_sal.h:308
_Reserved_ PVOID Reserved
Definition: winddi.h:3974
PARB_COMMIT_ALLOCATION CommitAllocation
Definition: arbiter.h:200
NTSTATUS(NTAPI * PARB_BOOT_ALLOCATION)(_In_ PARBITER_INSTANCE Arbiter, _In_ PLIST_ENTRY ArbitrationList)
Definition: arbiter.h:109
PARB_UNPACK_REQUIREMENT UnpackRequirement
Definition: arbiter.h:194
struct _ARBITER_ORDERING_LIST ARBITER_ORDERING_LIST
BOOLEAN TransactionInProgress
Definition: arbiter.h:214
NTSTATUS(NTAPI * PARB_QUERY_ARBITRATE)(_In_ PARBITER_INSTANCE Arbiter)
Definition: arbiter.h:116
NTSTATUS(NTAPI * PARB_PREPROCESS_ENTRY)(_In_ PARBITER_INSTANCE Arbiter, _Inout_ PARBITER_ALLOCATION_STATE ArbState)
Definition: arbiter.h:139
ARBITER_ORDERING_LIST OrderingList
Definition: arbiter.h:188
NTSTATUS(NTAPI * PARB_COMMIT_ALLOCATION)(_In_ PARBITER_INSTANCE Arbiter)
Definition: arbiter.h:99
PARB_ADD_RESERVED AddReserved
Definition: arbiter.h:205
UINT64 Start
Definition: arbiter.h:17
Definition: partlist.h:33
struct _ARBITER_INSTANCE * PARBITER_INSTANCE
Definition: arbiter.h:56
NTSTATUS(NTAPI * PARB_QUERY_CONFLICT)(_In_ PARBITER_INSTANCE Arbiter)
Definition: arbiter.h:122
unsigned char UCHAR
Definition: xmlstorage.h:181
NTSTATUS(NTAPI * PARB_TEST_ALLOCATION)(_In_ PARBITER_INSTANCE Arbiter, _In_ PLIST_ENTRY ArbitrationList)
Definition: arbiter.h:87
PVOID ConflictCallbackContext
Definition: arbiter.h:217
NTSTATUS(NTAPI * PARB_OVERRIDE_CONFLICT)(_In_ PARBITER_INSTANCE Arbiter)
Definition: arbiter.h:176
#define NTSTATUS
Definition: precomp.h:20
#define VOID
Definition: acefi.h:82
Definition: typedefs.h:119
PRTL_RANGE_LIST PossibleAllocation
Definition: arbiter.h:187
PARB_PACK_RESOURCE PackResource
Definition: arbiter.h:195
PARBITER_ALLOCATION_STATE AllocationStack
Definition: arbiter.h:193
INT32 ReferenceCount
Definition: arbiter.h:190
BOOLEAN(NTAPI * PARB_GET_NEXT_ALLOCATION_RANGE)(_In_ PARBITER_INSTANCE Arbiter, _Inout_ PARBITER_ALLOCATION_STATE ArbState)
Definition: arbiter.h:151
PARBITER_ALTERNATIVE Alternatives
Definition: arbiter.h:49
PARB_QUERY_ARBITRATE QueryArbitrate
Definition: arbiter.h:203
unsigned short UINT16
PVOID ConflictCallback
Definition: arbiter.h:218
VOID(NTAPI * PARB_BACKTRACK_ALLOCATION)(_In_ PARBITER_INSTANCE Arbiter, _Inout_ PARBITER_ALLOCATION_STATE ArbState)
Definition: arbiter.h:169
PARB_ALLOCATE_ENTRY AllocateEntry
Definition: arbiter.h:208
NTSTATUS(NTAPI * PARB_ALLOCATE_ENTRY)(_In_ PARBITER_INSTANCE Arbiter, _Inout_ PARBITER_ALLOCATION_STATE ArbState)
Definition: arbiter.h:145
#define BOOLEAN
Definition: pedump.c:73
PARB_OVERRIDE_CONFLICT OverrideConflict
Definition: arbiter.h:213
CM_RESOURCE_TYPE ResourceType
Definition: arbiter.h:185
signed int INT32
unsigned long long UINT64
struct _ARBITER_ORDERING * PARBITER_ORDERING
PARB_FIND_SUITABLE_RANGE FindSuitableRange
Definition: arbiter.h:210
BOOLEAN(NTAPI * PARB_FIND_SUITABLE_RANGE)(_In_ PARBITER_INSTANCE Arbiter, _Inout_ PARBITER_ALLOCATION_STATE ArbState)
Definition: arbiter.h:157
static CODE_SEG("PAGE")
Definition: isapnp.c:1482
PARB_BOOT_ALLOCATION BootAllocation
Definition: arbiter.h:202
PARB_GET_NEXT_ALLOCATION_RANGE GetNextAllocationRange
Definition: arbiter.h:209
UCHAR RangeAvailableAttributes
Definition: arbiter.h:52
struct _ARBITER_ALTERNATIVE * PARBITER_ALTERNATIVE
unsigned __int64 * PUINT64
Definition: basetsd.h:189
PARB_UNPACK_RESOURCE UnpackResource
Definition: arbiter.h:196
PIO_RESOURCE_DESCRIPTOR Descriptor
Definition: arbiter.h:36