61 &Alternative->Minimum,
62 &Alternative->Maximum,
68#if (NTDDI_VERSION >= NTDDI_VISTA) || defined(__REACTOS__)
69 Alternative->Length =
Length;
79 Alternative->Flags = 0;
85 if (Alternative->Maximum < Alternative->Minimum)
87 else if ((Alternative->Maximum - Alternative->Minimum + 1) == Alternative->Length)
134 ULONG StateCount = EntryCount + 1;
135 ULONG AlternativeCount = 0;
140 for (ListEntry = ArbitrationList->
Flink;
141 ListEntry != ArbitrationList;
142 ListEntry = ListEntry->
Flink)
146 if (
Entry->AlternativeCount == 0)
149 AlternativeCount +=
Entry->AlternativeCount;
155 if (Arbiter->AllocationStackMaxSize <
Size)
160 if (NewStack ==
NULL)
163 if (Arbiter->AllocationStack !=
NULL)
166 Arbiter->AllocationStack = NewStack;
167 Arbiter->AllocationStackMaxSize =
Size;
171 State = Arbiter->AllocationStack;
174 for (ListEntry = ArbitrationList->
Flink;
175 ListEntry != ArbitrationList;
176 ListEntry = ListEntry->
Flink)
181 if (
Entry->AlternativeCount == 0)
185 State->AlternativeCount =
Entry->AlternativeCount;
186 State->Alternatives = Alternative;
233 ULONG EntryCount = 0;
245 for (ListEntry = ArbitrationList->
Flink;
246 ListEntry != ArbitrationList;
247 ListEntry = ListEntry->
Flink)
259 if (
Entry->PhysicalDeviceObject != PreviousOwner)
261 PreviousOwner =
Entry->PhysicalDeviceObject;
266 Entry->WorkSpace = 0;
267 if (Arbiter->ScoreRequirement !=
NULL)
277 Entry->WorkSpace += Score;
288 Status = Arbiter->AllocateEntry(Arbiter, Arbiter->AllocationStack);
343 State.Alternatives = &Alternative;
344 State.CurrentAlternative = &Alternative;
345 State.AlternativeCount = 1;
357 for (ListEntry = ArbitrationList->
Flink;
358 ListEntry != ArbitrationList;
359 ListEntry = ListEntry->
Flink)
364 Entry->PhysicalDeviceObject);
369 for (ListEntry = ArbitrationList->
Flink;
370 ListEntry != ArbitrationList;
371 ListEntry = ListEntry->
Flink)
398 Status = Arbiter->PreprocessEntry(Arbiter, &
State);
403 Arbiter->AddAllocation(Arbiter, &
State);
409 State.Flags &= ~ARBITER_STATE_FLAG_WORKSPACE;
420 State.Flags &= ~ARBITER_STATE_FLAG_WORKSPACE;
446#if (NTDDI_VERSION >= NTDDI_VISTA)
482#if (NTDDI_VERSION >= NTDDI_VISTA)
524 Arbiter->Allocation = Arbiter->PossibleAllocation;
525 Arbiter->PossibleAllocation = Old;
605 for (ListEntry = ArbitrationList->
Flink;
606 ListEntry != ArbitrationList;
607 ListEntry = ListEntry->
Flink)
611 if (
Entry->AlternativeCount == 0)
621 if (Alternative.
Length == 0 ||
631 State.AlternativeCount = 1;
632 State.Alternatives = &Alternative;
633 State.CurrentAlternative = &Alternative;
642 Arbiter->AddAllocation(Arbiter, &
State);
648 if (Arbiter->PackResource !=
NULL &&
Entry->Assignment !=
NULL)
656 Old = Arbiter->Allocation;
659 Arbiter->Allocation = Arbiter->PossibleAllocation;
660 Arbiter->PossibleAllocation = Old;
683#if (NTDDI_VERSION >= NTDDI_VISTA)
778 PVOID SavedContext = Arbiter->ConflictCallbackContext;
797 Arbiter->ConflictCallbackContext = &ConflictingRange;
812 State.CurrentAlternative =
State.Alternatives = &Alternative;
813 State.AlternativeCount = 1;
819 sizeof(
Entry.InterfaceType),
820 &
Entry.InterfaceType,
838 Status = Arbiter->PreprocessEntry(Arbiter, &
State);
850 ConflictingRange =
NULL;
854 if (Arbiter->FindSuitableRange(Arbiter, &
State))
857 if (
Count == Capacity)
861 (Capacity + 5) *
sizeof(*Grown),
875 if (ConflictingRange ==
NULL)
900 *ConflictCount =
Count;
908 State.Flags &= ~ARBITER_STATE_FLAG_WORKSPACE;
912 Arbiter->ConflictCallback = SavedCallback;
913 Arbiter->ConflictCallbackContext = SavedContext;
936#if (NTDDI_VERSION >= NTDDI_VISTA)
958 ConflictCount, Conflicts);
COMPILER_DEPENDENT_UINT64 UINT64
#define ARBITER_ALTERNATIVE_FLAG_BADRANGE
#define ARBITER_ALTERNATIVE_FLAG_SHARED
struct _ARBITER_ALTERNATIVE * PARBITER_ALTERNATIVE
struct _ARBITER_ALLOCATION_STATE ARBITER_ALLOCATION_STATE
#define ARBITER_STATE_FLAG_BOOT
#define ARBITER_PRIORITY_NULL
#define ARBITER_MAXIMUM_ADDRESS
#define ARBITER_STATE_FLAG_WORKSPACE
NTSTATUS NTAPI ArbiterLibSortArbitrationList(_Inout_ PLIST_ENTRY ArbitrationList)
Orders an arbitration list most-constrained first, so fixed requirements are placed before flexible o...
#define ARBITER_ALTERNATIVE_FLAG_INACCESSIBLE_OK
#define ARBITER_ALTERNATIVE_FLAG_FIXED
#define ARBITER_RANGE_BOOT_ALLOCATED
PDEVICE_OBJECT PhysicalDeviceObject
_In_ HANDLE _In_ CONST PDXGKMDT_OPM_GET_INFO_PARAMETERS Parameters
#define NT_SUCCESS(StatCode)
static const WCHAR Cleanup[]
#define ExAllocatePoolWithTag(hernya, size, tag)
struct _DEVICE_OBJECT * PDEVICE_OBJECT
union Alignment_ Alignment
#define ExFreePoolWithTag(_P, _T)
#define CM_RESOURCE_MEMORY_COMPAT_FOR_INACCESSIBLE_RANGE
NTSYSAPI NTSTATUS NTAPI RtlDeleteOwnersRanges(_Inout_ PRTL_RANGE_LIST RangeList, _In_ _Maybenull_ PVOID Owner)
NTSYSAPI VOID NTAPI RtlInitializeRangeList(_Out_ PRTL_RANGE_LIST RangeList)
NTSYSAPI NTSTATUS NTAPI RtlCopyRangeList(_Out_ PRTL_RANGE_LIST CopyRangeList, _In_ PRTL_RANGE_LIST RangeList)
NTSYSAPI VOID NTAPI RtlFreeRangeList(_In_ PRTL_RANGE_LIST RangeList)
BOOLEAN(NTAPI * PRTL_CONFLICT_RANGE_CALLBACK)(PVOID Context, struct _RTL_RANGE *Range)
_In_ ULONG _In_ ULONG _In_ ULONG Length
#define STATUS_DEVICE_CONFIGURATION_ERROR
NTSTATUS NTAPI IoGetDeviceProperty(IN PDEVICE_OBJECT DeviceObject, IN DEVICE_REGISTRY_PROPERTY DeviceProperty, IN ULONG BufferLength, OUT PVOID PropertyBuffer, OUT PULONG ResultLength)
for(i=0;i< sizeof(testsuite)/sizeof(testsuite[0]);++i) ok(call_test(testsuite[i].func)
#define CmResourceTypeMemory
PIO_RESOURCE_DESCRIPTOR Descriptor
PDEVICE_OBJECT OwningObject
struct _LIST_ENTRY * Flink
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...
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 ArbiterLibTestAllocation(_In_ PARBITER_INSTANCE Arbiter, _Inout_ PARBITER_TEST_ALLOCATION_PARAMETERS Parameters)
The TestAllocation action: tentatively places every entry of the arbitration list,...
static NTSTATUS ArbpBootAllocation(_In_ PARBITER_INSTANCE Arbiter, _In_ PLIST_ENTRY ArbitrationList)
Reserves each entry's firmware boot configuration in the committed range list, so devices left where ...
static NTSTATUS ArbpBuildAllocationStack(_In_ PARBITER_INSTANCE Arbiter, _In_ PLIST_ENTRY ArbitrationList, _In_ ULONG EntryCount)
Builds the allocation stack for an arbitration list into Arbiter->AllocationStack: one ARBITER_ALLOCA...
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.
static NTSTATUS ArbpTestAllocation(_In_ PARBITER_INSTANCE Arbiter, _In_ PLIST_ENTRY ArbitrationList)
Test-allocates every entry on an arbitration list into the arbiter's tentative allocation....
static NTSTATUS ArbpQueryConflict(_In_ PARBITER_INSTANCE Arbiter, _In_ PDEVICE_OBJECT PhysicalDeviceObject, _In_ PIO_RESOURCE_DESCRIPTOR ConflictingResource, _Out_ PULONG ConflictCount, _Out_ PARBITER_CONFLICT_INFO *Conflicts)
Enumerates every committed range that conflicts with a candidate resource for a device....
static NTSTATUS ArbpBuildAlternative(_In_ PARBITER_INSTANCE Arbiter, _In_ PIO_RESOURCE_DESCRIPTOR Descriptor, _Out_ PARBITER_ALTERNATIVE Alternative)
Expands one IO_RESOURCE_DESCRIPTOR into an ARBITER_ALTERNATIVE through the arbiter's UnpackRequiremen...
static BOOLEAN NTAPI ArbpQueryConflictCallback(_In_ PVOID Context, _In_ PRTL_RANGE Range)
RtlFindRange conflict callback installed while a conflict query runs: records the range that blocks p...
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.
static NTSTATUS ArbpRetestAllocation(_In_ PARBITER_INSTANCE Arbiter, _In_ PLIST_ENTRY ArbitrationList)
Re-establishes a previously tested solution in the arbiter's tentative allocation without searching a...
#define RtlCopyMemory(Destination, Source, Length)
#define RtlZeroMemory(Destination, Length)
#define CONTAINING_RECORD(address, type, field)
#define STATUS_INVALID_PARAMETER
#define STATUS_INSUFFICIENT_RESOURCES
_In_ WDFCOLLECTION _In_ ULONG Index
_Must_inspect_result_ _In_ WDFDEVICE _In_ DEVICE_REGISTRY_PROPERTY _In_ ULONG _Out_ PULONG ResultLength
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
_Must_inspect_result_ _In_ WDFIORESLIST _In_ PIO_RESOURCE_DESCRIPTOR Descriptor
_Must_inspect_result_ _In_ WDFCMRESLIST List
#define CmResourceTypeMemoryLarge
@ ArbiterRequestPnpEnumerated
@ DevicePropertyBusNumber
@ DevicePropertyLegacyBusType
@ ArbiterResultNullRequest