ReactOS 0.4.15-dev-8131-g4988de4
arbiter.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  _ARBITER_ORDERING
 
struct  _ARBITER_ORDERING_LIST
 
struct  _ARBITER_ALTERNATIVE
 
struct  _ARBITER_ALLOCATION_STATE
 
struct  _ARBITER_INSTANCE
 

Macros

#define ARBITER_SIGNATURE   'sbrA'
 
#define TAG_ARBITER   'MbrA'
 
#define TAG_ARB_ALLOCATION   'AbrA'
 
#define TAG_ARB_RANGE   'RbrA'
 

Typedefs

typedef struct _ARBITER_ORDERING ARBITER_ORDERING
 
typedef struct _ARBITER_ORDERINGPARBITER_ORDERING
 
typedef struct _ARBITER_ORDERING_LIST ARBITER_ORDERING_LIST
 
typedef struct _ARBITER_ORDERING_LISTPARBITER_ORDERING_LIST
 
typedef struct _ARBITER_ALTERNATIVE ARBITER_ALTERNATIVE
 
typedef struct _ARBITER_ALTERNATIVEPARBITER_ALTERNATIVE
 
typedef struct _ARBITER_ALLOCATION_STATE ARBITER_ALLOCATION_STATE
 
typedef struct _ARBITER_ALLOCATION_STATEPARBITER_ALLOCATION_STATE
 
typedef struct _ARBITER_INSTANCEPARBITER_INSTANCE
 
typedef NTSTATUS(NTAPIPARB_UNPACK_REQUIREMENT) (_In_ PIO_RESOURCE_DESCRIPTOR IoDescriptor, _Out_ PUINT64 OutMinimumAddress, _Out_ PUINT64 OutMaximumAddress, _Out_ PUINT32 OutLength, _Out_ PUINT32 OutAlignment)
 
typedef NTSTATUS(NTAPIPARB_PACK_RESOURCE) (_In_ PIO_RESOURCE_DESCRIPTOR IoDescriptor, _In_ UINT64 Start, _Out_ PCM_PARTIAL_RESOURCE_DESCRIPTOR CmDescriptor)
 
typedef NTSTATUS(NTAPIPARB_UNPACK_RESOURCE) (_In_ PCM_PARTIAL_RESOURCE_DESCRIPTOR CmDescriptor, _Out_ PUINT64 Start, _Out_ PUINT32 OutLength)
 
typedef INT32(NTAPIPARB_SCORE_REQUIREMENT) (_In_ PIO_RESOURCE_DESCRIPTOR IoDescriptor)
 
typedef NTSTATUS(NTAPIPARB_TEST_ALLOCATION) (_In_ PARBITER_INSTANCE Arbiter, _In_ PLIST_ENTRY ArbitrationList)
 
typedef NTSTATUS(NTAPIPARB_RETEST_ALLOCATION) (_In_ PARBITER_INSTANCE Arbiter, _In_ PLIST_ENTRY ArbitrationList)
 
typedef NTSTATUS(NTAPIPARB_COMMIT_ALLOCATION) (_In_ PARBITER_INSTANCE Arbiter)
 
typedef NTSTATUS(NTAPIPARB_ROLLBACK_ALLOCATION) (_In_ PARBITER_INSTANCE Arbiter)
 
typedef NTSTATUS(NTAPIPARB_BOOT_ALLOCATION) (_In_ PARBITER_INSTANCE Arbiter, _In_ PLIST_ENTRY ArbitrationList)
 
typedef NTSTATUS(NTAPIPARB_QUERY_ARBITRATE) (_In_ PARBITER_INSTANCE Arbiter)
 
typedef NTSTATUS(NTAPIPARB_QUERY_CONFLICT) (_In_ PARBITER_INSTANCE Arbiter)
 
typedef NTSTATUS(NTAPIPARB_ADD_RESERVED) (_In_ PARBITER_INSTANCE Arbiter)
 
typedef NTSTATUS(NTAPIPARB_START_ARBITER) (_In_ PARBITER_INSTANCE Arbiter)
 
typedef NTSTATUS(NTAPIPARB_PREPROCESS_ENTRY) (_In_ PARBITER_INSTANCE Arbiter, _Inout_ PARBITER_ALLOCATION_STATE ArbState)
 
typedef NTSTATUS(NTAPIPARB_ALLOCATE_ENTRY) (_In_ PARBITER_INSTANCE Arbiter, _Inout_ PARBITER_ALLOCATION_STATE ArbState)
 
typedef BOOLEAN(NTAPIPARB_GET_NEXT_ALLOCATION_RANGE) (_In_ PARBITER_INSTANCE Arbiter, _Inout_ PARBITER_ALLOCATION_STATE ArbState)
 
typedef BOOLEAN(NTAPIPARB_FIND_SUITABLE_RANGE) (_In_ PARBITER_INSTANCE Arbiter, _Inout_ PARBITER_ALLOCATION_STATE ArbState)
 
typedef VOID(NTAPIPARB_ADD_ALLOCATION) (_In_ PARBITER_INSTANCE Arbiter, _Inout_ PARBITER_ALLOCATION_STATE ArbState)
 
typedef VOID(NTAPIPARB_BACKTRACK_ALLOCATION) (_In_ PARBITER_INSTANCE Arbiter, _Inout_ PARBITER_ALLOCATION_STATE ArbState)
 
typedef NTSTATUS(NTAPIPARB_OVERRIDE_CONFLICT) (_In_ PARBITER_INSTANCE Arbiter)
 
typedef struct _ARBITER_INSTANCE ARBITER_INSTANCE
 
typedef NTSTATUS(NTAPIPARB_TRANSLATE_ORDERING) (_Out_ PIO_RESOURCE_DESCRIPTOR OutIoDescriptor, _In_ PIO_RESOURCE_DESCRIPTOR IoDescriptor)
 

Functions

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)
 

Macro Definition Documentation

◆ ARBITER_SIGNATURE

#define ARBITER_SIGNATURE   'sbrA'

Definition at line 10 of file arbiter.h.

◆ TAG_ARB_ALLOCATION

#define TAG_ARB_ALLOCATION   'AbrA'

Definition at line 12 of file arbiter.h.

◆ TAG_ARB_RANGE

#define TAG_ARB_RANGE   'RbrA'

Definition at line 13 of file arbiter.h.

◆ TAG_ARBITER

#define TAG_ARBITER   'MbrA'

Definition at line 11 of file arbiter.h.

Typedef Documentation

◆ ARBITER_ALLOCATION_STATE

◆ ARBITER_ALTERNATIVE

◆ ARBITER_INSTANCE

◆ ARBITER_ORDERING

◆ ARBITER_ORDERING_LIST

◆ PARB_ADD_ALLOCATION

typedef VOID(NTAPI * PARB_ADD_ALLOCATION) (_In_ PARBITER_INSTANCE Arbiter, _Inout_ PARBITER_ALLOCATION_STATE ArbState)

Definition at line 162 of file arbiter.h.

◆ PARB_ADD_RESERVED

typedef NTSTATUS(NTAPI * PARB_ADD_RESERVED) (_In_ PARBITER_INSTANCE Arbiter)

Definition at line 127 of file arbiter.h.

◆ PARB_ALLOCATE_ENTRY

typedef NTSTATUS(NTAPI * PARB_ALLOCATE_ENTRY) (_In_ PARBITER_INSTANCE Arbiter, _Inout_ PARBITER_ALLOCATION_STATE ArbState)

Definition at line 144 of file arbiter.h.

◆ PARB_BACKTRACK_ALLOCATION

typedef VOID(NTAPI * PARB_BACKTRACK_ALLOCATION) (_In_ PARBITER_INSTANCE Arbiter, _Inout_ PARBITER_ALLOCATION_STATE ArbState)

Definition at line 168 of file arbiter.h.

◆ PARB_BOOT_ALLOCATION

typedef NTSTATUS(NTAPI * PARB_BOOT_ALLOCATION) (_In_ PARBITER_INSTANCE Arbiter, _In_ PLIST_ENTRY ArbitrationList)

Definition at line 108 of file arbiter.h.

◆ PARB_COMMIT_ALLOCATION

typedef NTSTATUS(NTAPI * PARB_COMMIT_ALLOCATION) (_In_ PARBITER_INSTANCE Arbiter)

Definition at line 98 of file arbiter.h.

◆ PARB_FIND_SUITABLE_RANGE

typedef BOOLEAN(NTAPI * PARB_FIND_SUITABLE_RANGE) (_In_ PARBITER_INSTANCE Arbiter, _Inout_ PARBITER_ALLOCATION_STATE ArbState)

Definition at line 156 of file arbiter.h.

◆ PARB_GET_NEXT_ALLOCATION_RANGE

typedef BOOLEAN(NTAPI * PARB_GET_NEXT_ALLOCATION_RANGE) (_In_ PARBITER_INSTANCE Arbiter, _Inout_ PARBITER_ALLOCATION_STATE ArbState)

Definition at line 150 of file arbiter.h.

◆ PARB_OVERRIDE_CONFLICT

typedef NTSTATUS(NTAPI * PARB_OVERRIDE_CONFLICT) (_In_ PARBITER_INSTANCE Arbiter)

Definition at line 175 of file arbiter.h.

◆ PARB_PACK_RESOURCE

typedef NTSTATUS(NTAPI * PARB_PACK_RESOURCE) (_In_ PIO_RESOURCE_DESCRIPTOR IoDescriptor, _In_ UINT64 Start, _Out_ PCM_PARTIAL_RESOURCE_DESCRIPTOR CmDescriptor)

Definition at line 67 of file arbiter.h.

◆ PARB_PREPROCESS_ENTRY

typedef NTSTATUS(NTAPI * PARB_PREPROCESS_ENTRY) (_In_ PARBITER_INSTANCE Arbiter, _Inout_ PARBITER_ALLOCATION_STATE ArbState)

Definition at line 138 of file arbiter.h.

◆ PARB_QUERY_ARBITRATE

typedef NTSTATUS(NTAPI * PARB_QUERY_ARBITRATE) (_In_ PARBITER_INSTANCE Arbiter)

Definition at line 115 of file arbiter.h.

◆ PARB_QUERY_CONFLICT

typedef NTSTATUS(NTAPI * PARB_QUERY_CONFLICT) (_In_ PARBITER_INSTANCE Arbiter)

Definition at line 121 of file arbiter.h.

◆ PARB_RETEST_ALLOCATION

typedef NTSTATUS(NTAPI * PARB_RETEST_ALLOCATION) (_In_ PARBITER_INSTANCE Arbiter, _In_ PLIST_ENTRY ArbitrationList)

Definition at line 92 of file arbiter.h.

◆ PARB_ROLLBACK_ALLOCATION

typedef NTSTATUS(NTAPI * PARB_ROLLBACK_ALLOCATION) (_In_ PARBITER_INSTANCE Arbiter)

Definition at line 103 of file arbiter.h.

◆ PARB_SCORE_REQUIREMENT

typedef INT32(NTAPI * PARB_SCORE_REQUIREMENT) (_In_ PIO_RESOURCE_DESCRIPTOR IoDescriptor)

Definition at line 81 of file arbiter.h.

◆ PARB_START_ARBITER

typedef NTSTATUS(NTAPI * PARB_START_ARBITER) (_In_ PARBITER_INSTANCE Arbiter)

Definition at line 133 of file arbiter.h.

◆ PARB_TEST_ALLOCATION

typedef NTSTATUS(NTAPI * PARB_TEST_ALLOCATION) (_In_ PARBITER_INSTANCE Arbiter, _In_ PLIST_ENTRY ArbitrationList)

Definition at line 86 of file arbiter.h.

◆ PARB_TRANSLATE_ORDERING

typedef NTSTATUS(NTAPI * PARB_TRANSLATE_ORDERING) (_Out_ PIO_RESOURCE_DESCRIPTOR OutIoDescriptor, _In_ PIO_RESOURCE_DESCRIPTOR IoDescriptor)

Definition at line 221 of file arbiter.h.

◆ PARB_UNPACK_REQUIREMENT

typedef NTSTATUS(NTAPI * PARB_UNPACK_REQUIREMENT) (_In_ PIO_RESOURCE_DESCRIPTOR IoDescriptor, _Out_ PUINT64 OutMinimumAddress, _Out_ PUINT64 OutMaximumAddress, _Out_ PUINT32 OutLength, _Out_ PUINT32 OutAlignment)

Definition at line 58 of file arbiter.h.

◆ PARB_UNPACK_RESOURCE

typedef NTSTATUS(NTAPI * PARB_UNPACK_RESOURCE) (_In_ PCM_PARTIAL_RESOURCE_DESCRIPTOR CmDescriptor, _Out_ PUINT64 Start, _Out_ PUINT32 OutLength)

Definition at line 74 of file arbiter.h.

◆ PARBITER_ALLOCATION_STATE

◆ PARBITER_ALTERNATIVE

◆ PARBITER_INSTANCE

Definition at line 56 of file arbiter.h.

◆ PARBITER_ORDERING

◆ PARBITER_ORDERING_LIST

Function Documentation

◆ ArbInitializeArbiterInstance()

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 at line 282 of file arbiter.c.

289{
291
292 PAGED_CODE();
293
294 DPRINT("ArbInitializeArbiterInstance: '%S'\n", ArbiterName);
295
296 ASSERT(Arbiter->UnpackRequirement != NULL);
297 ASSERT(Arbiter->PackResource != NULL);
298 ASSERT(Arbiter->UnpackResource != NULL);
299 ASSERT(Arbiter->MutexEvent == NULL);
300 ASSERT(Arbiter->Allocation == NULL);
301 ASSERT(Arbiter->PossibleAllocation == NULL);
302 ASSERT(Arbiter->AllocationStack == NULL);
303
304 Arbiter->Signature = ARBITER_SIGNATURE;
305 Arbiter->BusDeviceObject = BusDeviceObject;
306
307 Arbiter->MutexEvent = ExAllocatePoolWithTag(NonPagedPool, sizeof(KEVENT), TAG_ARBITER);
308 if (!Arbiter->MutexEvent)
309 {
310 DPRINT1("ArbInitializeArbiterInstance: STATUS_INSUFFICIENT_RESOURCES\n");
312 }
313
314 KeInitializeEvent(Arbiter->MutexEvent, SynchronizationEvent, TRUE);
315
316 Arbiter->AllocationStack = ExAllocatePoolWithTag(PagedPool, PAGE_SIZE, TAG_ARB_ALLOCATION);
317 if (!Arbiter->AllocationStack)
318 {
319 DPRINT1("ArbInitializeArbiterInstance: STATUS_INSUFFICIENT_RESOURCES\n");
320 ExFreePoolWithTag(Arbiter->MutexEvent, TAG_ARBITER);
322 }
323
324 Arbiter->AllocationStackMaxSize = PAGE_SIZE;
325
326 Arbiter->Allocation = ExAllocatePoolWithTag(PagedPool, sizeof(RTL_RANGE_LIST), TAG_ARB_RANGE);
327 if (!Arbiter->Allocation)
328 {
329 DPRINT1("ArbInitializeArbiterInstance: STATUS_INSUFFICIENT_RESOURCES\n");
330 ExFreePoolWithTag(Arbiter->AllocationStack, TAG_ARB_ALLOCATION);
331 ExFreePoolWithTag(Arbiter->MutexEvent, TAG_ARBITER);
333 }
334
335 Arbiter->PossibleAllocation = ExAllocatePoolWithTag(PagedPool, sizeof(RTL_RANGE_LIST), TAG_ARB_RANGE);
336 if (!Arbiter->PossibleAllocation)
337 {
338 DPRINT1("ArbInitializeArbiterInstance: STATUS_INSUFFICIENT_RESOURCES\n");
339 ExFreePoolWithTag(Arbiter->Allocation, TAG_ARB_RANGE);
340 ExFreePoolWithTag(Arbiter->AllocationStack, TAG_ARB_ALLOCATION);
341 ExFreePoolWithTag(Arbiter->MutexEvent, TAG_ARBITER);
343 }
344
345 RtlInitializeRangeList(Arbiter->Allocation);
346 RtlInitializeRangeList(Arbiter->PossibleAllocation);
347
348 Arbiter->Name = ArbiterName;
349 Arbiter->ResourceType = ResourceType;
350 Arbiter->TransactionInProgress = FALSE;
351
352 if (!Arbiter->TestAllocation)
353 Arbiter->TestAllocation = ArbTestAllocation;
354
355 if (!Arbiter->RetestAllocation)
356 Arbiter->RetestAllocation = ArbRetestAllocation;
357
358 if (!Arbiter->CommitAllocation)
359 Arbiter->CommitAllocation = ArbCommitAllocation;
360
361 if (!Arbiter->RollbackAllocation)
362 Arbiter->RollbackAllocation = ArbRollbackAllocation;
363
364 if (!Arbiter->AddReserved)
365 Arbiter->AddReserved = ArbAddReserved;
366
367 if (!Arbiter->PreprocessEntry)
368 Arbiter->PreprocessEntry = ArbPreprocessEntry;
369
370 if (!Arbiter->AllocateEntry)
371 Arbiter->AllocateEntry = ArbAllocateEntry;
372
373 if (!Arbiter->GetNextAllocationRange)
374 Arbiter->GetNextAllocationRange = ArbGetNextAllocationRange;
375
376 if (!Arbiter->FindSuitableRange)
377 Arbiter->FindSuitableRange = ArbFindSuitableRange;
378
379 if (!Arbiter->AddAllocation)
380 Arbiter->AddAllocation = ArbAddAllocation;
381
382 if (!Arbiter->BacktrackAllocation)
383 Arbiter->BacktrackAllocation = ArbBacktrackAllocation;
384
385 if (!Arbiter->OverrideConflict)
386 Arbiter->OverrideConflict = ArbOverrideConflict;
387
388 if (!Arbiter->BootAllocation)
389 Arbiter->BootAllocation = ArbBootAllocation;
390
391 if (!Arbiter->QueryConflict)
392 Arbiter->QueryConflict = ArbQueryConflict;
393
394 if (!Arbiter->StartArbiter)
395 Arbiter->StartArbiter = ArbStartArbiter;
396
397 Status = ArbBuildAssignmentOrdering(Arbiter, OrderName, OrderName, TranslateOrderingFunction);
398 if (NT_SUCCESS(Status))
399 {
400 return STATUS_SUCCESS;
401 }
402
403 DPRINT1("ArbInitializeArbiterInstance: Status %X\n", Status);
404
405 return Status;
406}
#define PAGED_CODE()
NTSTATUS NTAPI ArbOverrideConflict(_In_ PARBITER_INSTANCE Arbiter)
Definition: arbiter.c:165
BOOLEAN NTAPI ArbGetNextAllocationRange(_In_ PARBITER_INSTANCE Arbiter, _Inout_ PARBITER_ALLOCATION_STATE ArbState)
Definition: arbiter.c:114
VOID NTAPI ArbAddAllocation(_In_ PARBITER_INSTANCE Arbiter, _Inout_ PARBITER_ALLOCATION_STATE ArbState)
Definition: arbiter.c:140
NTSTATUS NTAPI ArbRetestAllocation(_In_ PARBITER_INSTANCE Arbiter, _In_ PLIST_ENTRY ArbitrationList)
Definition: arbiter.c:39
NTSTATUS NTAPI ArbAddReserved(_In_ PARBITER_INSTANCE Arbiter)
Definition: arbiter.c:77
NTSTATUS NTAPI ArbStartArbiter(_In_ PARBITER_INSTANCE Arbiter)
Definition: arbiter.c:204
BOOLEAN NTAPI ArbFindSuitableRange(_In_ PARBITER_INSTANCE Arbiter, _Inout_ PARBITER_ALLOCATION_STATE ArbState)
Definition: arbiter.c:127
NTSTATUS NTAPI ArbCommitAllocation(_In_ PARBITER_INSTANCE Arbiter)
Definition: arbiter.c:52
NTSTATUS NTAPI ArbPreprocessEntry(_In_ PARBITER_INSTANCE Arbiter, _Inout_ PARBITER_ALLOCATION_STATE ArbState)
Definition: arbiter.c:89
VOID NTAPI ArbBacktrackAllocation(_In_ PARBITER_INSTANCE Arbiter, _Inout_ PARBITER_ALLOCATION_STATE ArbState)
Definition: arbiter.c:152
NTSTATUS NTAPI ArbQueryConflict(_In_ PARBITER_INSTANCE Arbiter)
Definition: arbiter.c:191
NTSTATUS NTAPI ArbAllocateEntry(_In_ PARBITER_INSTANCE Arbiter, _Inout_ PARBITER_ALLOCATION_STATE ArbState)
Definition: arbiter.c:101
NTSTATUS NTAPI ArbBuildAssignmentOrdering(_Inout_ PARBITER_INSTANCE ArbInstance, _In_ PCWSTR OrderName, _In_ PCWSTR ReservedOrderName, _In_ PARB_TRANSLATE_ORDERING TranslateOrderingFunction)
Definition: arbiter.c:267
NTSTATUS NTAPI ArbBootAllocation(_In_ PARBITER_INSTANCE Arbiter, _In_ PLIST_ENTRY ArbitrationList)
Definition: arbiter.c:177
NTSTATUS NTAPI ArbTestAllocation(_In_ PARBITER_INSTANCE Arbiter, _In_ PLIST_ENTRY ArbitrationList)
Definition: arbiter.c:26
NTSTATUS NTAPI ArbRollbackAllocation(_In_ PARBITER_INSTANCE Arbiter)
Definition: arbiter.c:64
#define TAG_ARB_ALLOCATION
Definition: arbiter.h:12
#define ARBITER_SIGNATURE
Definition: arbiter.h:10
#define TAG_ARBITER
Definition: arbiter.h:11
#define TAG_ARB_RANGE
Definition: arbiter.h:13
LONG NTSTATUS
Definition: precomp.h:26
#define DPRINT1
Definition: precomp.h:8
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
#define KeInitializeEvent(pEvt, foo, foo2)
Definition: env_spec_w32.h:477
#define PAGE_SIZE
Definition: env_spec_w32.h:49
#define NonPagedPool
Definition: env_spec_w32.h:307
#define PagedPool
Definition: env_spec_w32.h:308
Status
Definition: gdiplustypes.h:25
#define ASSERT(a)
Definition: mode.c:44
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1109
NTSYSAPI VOID NTAPI RtlInitializeRangeList(_Out_ PRTL_RANGE_LIST RangeList)
@ SynchronizationEvent
#define STATUS_SUCCESS
Definition: shellext.h:65
#define DPRINT
Definition: sndvol32.h:73
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158

Referenced by arbusno_Initializer(), IopBusNumberInitialize(), IopDmaInitialize(), IopIrqInitialize(), IopMemInitialize(), and IopPortInitialize().