17#define ARBITER_SIG 'sbrA'
27 if (Arbiter->PossibleAllocation)
31 Arbiter->PossibleAllocation =
NULL;
34 if (Arbiter->Allocation)
38 Arbiter->Allocation =
NULL;
41 if (Arbiter->AllocationStack)
44 Arbiter->AllocationStack =
NULL;
45 Arbiter->AllocationStackMaxSize = 0;
51#if (NTDDI_VERSION >= NTDDI_VISTA)
52 if (Arbiter->TransactionEvent)
55 Arbiter->TransactionEvent =
NULL;
59 if (Arbiter->MutexEvent)
62 Arbiter->MutexEvent =
NULL;
72 _In_ CM_RESOURCE_TYPE ResourceType,
81 DPRINT(
"ArbiterLibInitializeInstance: '%S'\n", ArbiterName);
92 Arbiter->BusDeviceObject = BusDeviceObject;
93 Arbiter->Name = ArbiterName;
94 Arbiter->ResourceType = ResourceType;
95 Arbiter->TransactionInProgress =
FALSE;
96#if (NTDDI_VERSION >= NTDDI_VISTA)
97 Arbiter->OrderingName = OrderName;
102 if (!Arbiter->MutexEvent)
109#if (NTDDI_VERSION >= NTDDI_VISTA)
112 if (!Arbiter->TransactionEvent)
121 if (!Arbiter->AllocationStack)
126 Arbiter->AllocationStackMaxSize =
PAGE_SIZE;
128 if (!Arbiter->Allocation)
136 if (!Arbiter->PossibleAllocation)
143 if (!Arbiter->TestAllocation)
145 if (!Arbiter->RetestAllocation)
147 if (!Arbiter->CommitAllocation)
149 if (!Arbiter->RollbackAllocation)
151 if (!Arbiter->BootAllocation)
153 if (!Arbiter->AddReserved)
155 if (!Arbiter->QueryConflict)
157 if (!Arbiter->QueryArbitrate)
159 if (!Arbiter->StartArbiter)
161 if (!Arbiter->PreprocessEntry)
163 if (!Arbiter->AllocateEntry)
165 if (!Arbiter->GetNextAllocationRange)
167 if (!Arbiter->FindSuitableRange)
169 if (!Arbiter->AddAllocation)
171 if (!Arbiter->BacktrackAllocation)
173 if (!Arbiter->OverrideConflict)
175#if (NTDDI_VERSION >= NTDDI_VISTA)
176 if (!Arbiter->InitializeRangeList)
183 DPRINT1(
"ArbiterLibInitializeInstance: ArbiterLibDefaultAssignmentOrdering failed, Status %X\n",
Status);
190 DPRINT1(
"ArbiterLibInitializeInstance: '%S' failed, Status %X\n", ArbiterName,
Status);
VOID NTAPI ArbiterLibDeleteInstance(_In_ PARBITER_INSTANCE Arbiter)
NTSTATUS NTAPI ArbiterLibInitializeInstance(_Inout_ PARBITER_INSTANCE Arbiter, _In_ PDEVICE_OBJECT BusDeviceObject, _In_ CM_RESOURCE_TYPE ResourceType, _In_ PCWSTR ArbiterName, _In_ PCWSTR OrderName, _In_ PARB_TRANSLATE_ORDERING TranslateOrderingFunction)
NTSTATUS NTAPI ArbiterLibBootAllocation(_In_ PARBITER_INSTANCE Arbiter, _Inout_ PARBITER_BOOT_ALLOCATION_PARAMETERS Parameters)
The BootAllocation action: records every entry's firmware boot configuration in the committed allocat...
BOOLEAN NTAPI ArbiterLibGetNextAllocationRange(_In_ PARBITER_INSTANCE Arbiter, _Inout_ PARBITER_ALLOCATION_STATE ArbState)
Moves the working window to the next candidate range, walking the entry's alternatives in priority or...
NTSTATUS NTAPI ArbiterLibInitializeRangeList(_In_ PARBITER_INSTANCE Arbiter, _In_ ULONG ResourceCount, _In_ PCM_PARTIAL_RESOURCE_DESCRIPTOR Resources, _Inout_ PRTL_RANGE_LIST RangeList)
The InitializeRangeList callback default.
NTSTATUS NTAPI ArbiterLibAllocateEntry(_In_ PARBITER_INSTANCE Arbiter, _Inout_ PARBITER_ALLOCATION_STATE ArbState)
Places the whole stack of entries with backtracking: when an entry cannot be placed,...
NTSTATUS NTAPI ArbiterLibRetestAllocation(_In_ PARBITER_INSTANCE Arbiter, _Inout_ PARBITER_RETEST_ALLOCATION_PARAMETERS Parameters)
The RetestAllocation action: deterministically re-establishes the placements a previous test chose,...
NTSTATUS(NTAPI * PARB_TRANSLATE_ORDERING)(_Out_ PIO_RESOURCE_DESCRIPTOR OutIoDescriptor, _In_ PIO_RESOURCE_DESCRIPTOR IoDescriptor)
NTSTATUS NTAPI ArbiterLibTestAllocation(_In_ PARBITER_INSTANCE Arbiter, _Inout_ PARBITER_TEST_ALLOCATION_PARAMETERS Parameters)
The TestAllocation action: tentatively places every entry of the arbitration list,...
NTSTATUS NTAPI ArbiterLibAddReserved(_In_ PARBITER_INSTANCE Arbiter, _Inout_ PARBITER_ADD_RESERVED_PARAMETERS Parameters)
The AddReserved action default: nothing to reserve.
VOID NTAPI ArbiterLibBacktrackAllocation(_In_ PARBITER_INSTANCE Arbiter, _Inout_ PARBITER_ALLOCATION_STATE ArbState)
Undoes the last AddAllocation performed for this entry.
BOOLEAN NTAPI ArbiterLibFindSuitableRange(_In_ PARBITER_INSTANCE Arbiter, _Inout_ PARBITER_ALLOCATION_STATE ArbState)
Finds a free range of the current candidate window in the arbiter's tentative allocation list.
NTSTATUS NTAPI ArbiterLibQueryArbitrate(_In_ PARBITER_INSTANCE Arbiter, _Inout_ PARBITER_QUERY_ARBITRATE_PARAMETERS Parameters)
The QueryArbitrate action default: reports that this arbiter is willing to arbitrate the given list.
NTSTATUS NTAPI ArbiterLibCommitAllocation(_In_ PARBITER_INSTANCE Arbiter)
The CommitAllocation action: the tentative PossibleAllocation becomes the committed Allocation,...
NTSTATUS NTAPI ArbiterLibRollbackAllocation(_In_ PARBITER_INSTANCE Arbiter)
The RollbackAllocation action: discards the tentative allocation; the committed one is untouched.
NTSTATUS NTAPI ArbiterLibPreprocessEntry(_In_ PARBITER_INSTANCE Arbiter, _Inout_ PARBITER_ALLOCATION_STATE ArbState)
Per-entry hook invoked before each placement attempt. The library default does nothing and succeeds.
NTSTATUS NTAPI ArbiterLibStartArbiter(_In_ PARBITER_INSTANCE Arbiter, _In_ PCM_RESOURCE_LIST StartResources)
The StartArbiter action default: seeds the committed allocation with the windows the bus decodes,...
NTSTATUS NTAPI ArbiterLibDefaultAssignmentOrdering(_Inout_ PARBITER_INSTANCE Arbiter, _In_ PCWSTR AllocationOrderName, _In_ PCWSTR ReservedResourcesName, _In_opt_ PARB_TRANSLATE_ORDERING TranslateOrderingFunction)
Builds the arbiter's allocation ordering from the registry policy, most-preferred window first.
BOOLEAN NTAPI ArbiterLibOverrideConflict(_In_ PARBITER_INSTANCE Arbiter, _Inout_ PARBITER_ALLOCATION_STATE ArbState)
The OverrideConflict default, the last of the conflict escapes: grants a FIXED requirement whose wind...
VOID NTAPI ArbiterLibAddAllocation(_In_ PARBITER_INSTANCE Arbiter, _Inout_ PARBITER_ALLOCATION_STATE ArbState)
Records the chosen placement in the arbiter's tentative allocation list, owned by the requesting devi...
VOID NTAPI ArbiterLibFreeOrderingList(_Inout_ PARBITER_ORDERING_LIST OrderingList)
NTSTATUS NTAPI ArbiterLibQueryConflict(_In_ PARBITER_INSTANCE Arbiter, _Inout_ PARBITER_QUERY_CONFLICT_PARAMETERS Parameters)
The QueryConflict action: reports which devices' committed ranges collide with a candidate resource.
#define NT_SUCCESS(StatCode)
#define ExAllocatePoolWithTag(hernya, size, tag)
#define KeInitializeEvent(pEvt, foo, foo2)
#define ExFreePoolWithTag(_P, _T)
NTSYSAPI VOID NTAPI RtlInitializeRangeList(_Out_ PRTL_RANGE_LIST RangeList)
NTSYSAPI VOID NTAPI RtlFreeRangeList(_In_ PRTL_RANGE_LIST RangeList)
#define STATUS_INSUFFICIENT_RESOURCES