18#define ARBITER_ALLOCATE_DEADLINE (10ULL * 1000 * 1000)
19#define ARBITER_ALLOCATE_HARD_DEADLINE (10ULL * 1000 * 1000 * 10)
101 ArbitrationList->Flink = Sorted.
Flink;
102 Sorted.
Flink->Blink = ArbitrationList;
103 ArbitrationList->Blink = Sorted.
Blink;
104 Sorted.
Blink->Flink = ArbitrationList;
134 Current->Flags &= ~ARBITER_STATE_FLAG_WORKSPACE;
175 while (Range !=
NULL)
177 if ((Range->
Start <= Maximum) && (Range->
End >= Minimum))
180 DPRINT1(
" 0x%I64x..0x%I64x held by %p, attributes 0x%x%s\n",
191 DPRINT1(
" nothing holds 0x%I64x..0x%I64x, so it is outside what this "
192 "arbiter was given\n",
251 DPRINT1(
"Arbiter %ws: abandoning allocation at entry %u, the search "
252 "is not terminating\n",
253 Arbiter->Name ? Arbiter->Name :
L"(unnamed)",
256 if (ArbState->Entry !=
NULL)
280 Backtracking =
FALSE;
282 if (FailedAlternative ==
NULL || FailedAlternative->
Length == 0)
285 Arbiter->BacktrackAllocation(Arbiter,
Current);
298 RetrySameRange =
TRUE;
300 else if (!DeadlineReported)
302 DeadlineReported =
TRUE;
303 DPRINT1(
"Arbiter %ws: allocation deadline expired, giving up "
304 "range refinement\n",
305 Arbiter->Name ? Arbiter->Name :
L"(unnamed)");
314 if (!Arbiter->GetNextAllocationRange(Arbiter,
Current))
317 RetrySameRange =
FALSE;
319 if (Arbiter->FindSuitableRange(Arbiter,
Current))
328 if (
Current->CurrentAlternative->Length != 0)
329 Arbiter->AddAllocation(Arbiter,
Current);
347 DPRINT1(
"Arbiter %ws: nowhere to put 0x%I64x..0x%I64x\n",
348 Arbiter->Name ? Arbiter->Name :
L"(unnamed)",
364 Current->Entry->SelectedAlternative =
Current->CurrentAlternative->Descriptor;
366 if (
Current->Entry->Assignment !=
NULL && Arbiter->PackResource !=
NULL)
368 Status = Arbiter->PackResource(
Current->CurrentAlternative->Descriptor,
#define ARBITER_STATE_FLAG_WORKSPACE
#define ARBITER_STATE_FLAG_MCFG_CONFLICT
#define ARBITER_ALTERNATIVE_FLAG_FIXED
#define NT_SUCCESS(StatCode)
#define InsertTailList(ListHead, Entry)
#define IsListEmpty(ListHead)
#define RemoveHeadList(ListHead)
#define InitializeListHead(ListHead)
#define ExFreePoolWithTag(_P, _T)
NTSYSAPI NTSTATUS NTAPI RtlGetNextRange(_Inout_ PRTL_RANGE_LIST_ITERATOR Iterator, _Outptr_ PRTL_RANGE *Range, _In_ BOOLEAN MoveForwards)
NTSYSAPI NTSTATUS NTAPI RtlGetFirstRange(_In_ PRTL_RANGE_LIST RangeList, _Out_ PRTL_RANGE_LIST_ITERATOR Iterator, _Outptr_ PRTL_RANGE *Range)
#define UNREFERENCED_PARAMETER(P)
#define STATUS_BAD_MCFG_TABLE
#define KeQueryInterruptTime()
#define ARBITER_ALLOCATE_HARD_DEADLINE
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,...
#define ARBITER_ALLOCATE_DEADLINE
static VOID ArbpReportConflictingRanges(_In_ PARBITER_INSTANCE Arbiter, _In_ ULONGLONG Minimum, _In_ ULONGLONG Maximum)
Says what an arbiter is already holding across a window.
NTSTATUS NTAPI ArbiterLibSortArbitrationList(_Inout_ PLIST_ENTRY ArbitrationList)
Orders an arbitration list most-constrained first, so fixed requirements are placed before flexible o...
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.
static VOID ArbpFreeAllocationWorkSpaces(_Inout_ PARBITER_ALLOCATION_STATE ArbState)
Releases the per-entry workspace a PreprocessEntry override allocated, across the whole allocation st...
struct _LIST_ENTRY * Blink
struct _LIST_ENTRY * Flink
#define CONTAINING_RECORD(address, type, field)
#define STATUS_UNSUCCESSFUL
_In_ WDFCHILDLIST _In_ PWDF_CHILD_LIST_ITERATOR Iterator
@ ArbiterResultExternalConflict
@ ArbiterResultNullRequest
_In_ ULONG _In_ ULONG _Out_ PULONG _In_ PVOID WorkSpace