ReactOS 0.4.17-dev-806-gffa4164
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_ALTERNATIVE
 
struct  _ARBITER_ALLOCATION_STATE
 
struct  _ARBITER_ORDERING
 
struct  _ARBITER_ORDERING_LIST
 
struct  _ARBITER_INSTANCE
 

Macros

#define TAG_ARBITER   'ibrA'
 
#define ARBITER_MAXIMUM_ADDRESS   ((ULONGLONG)~0ULL)
 
#define ARBITER_PRIORITY_NULL   0x00000000
 
#define ARBITER_PRIORITY_PREFERRED_RESERVED   0x7FFFFFFD
 
#define ARBITER_PRIORITY_RESERVED   0x7FFFFFFE
 
#define ARBITER_PRIORITY_EXHAUSTED   0x7FFFFFFF
 
#define ARBITER_ALTERNATIVE_FLAG_SHARED   0x00000001
 
#define ARBITER_ALTERNATIVE_FLAG_FIXED   0x00000002
 
#define ARBITER_ALTERNATIVE_FLAG_BADRANGE   0x00000004
 
#define ARBITER_ALTERNATIVE_FLAG_INACCESSIBLE_OK   0x00000008
 
#define ARBITER_RANGE_BOOT_ALLOCATED   0x01
 
#define ARBITER_RANGE_SHARED_DRIVER   0x02
 
#define ARBITER_RANGE_PORT_ALIAS   0x10
 
#define ARBITER_RANGE_INACCESSIBLE   0x40
 
#define ARBITER_STATE_FLAG_BOOT   0x0004
 
#define ARBITER_STATE_FLAG_NULL_CONFLICT_OK   0x0008
 
#define ARBITER_STATE_FLAG_WORKSPACE   0x0010
 
#define ARBITER_STATE_FLAG_MCFG_CONFLICT   0x0020
 

Typedefs

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_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_INSTANCEPARBITER_INSTANCE
 
typedef NTSTATUS(NTAPIPARB_UNPACK_REQUIREMENT) (_In_ PIO_RESOURCE_DESCRIPTOR IoDescriptor, _Out_ PUINT64 OutMinimumAddress, _Out_ PUINT64 OutMaximumAddress, _Out_ PUINT64 OutLength, _Out_ PUINT64 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_ PUINT64 OutLength)
 
typedef INT32(NTAPIPARB_SCORE_REQUIREMENT) (_In_ PIO_RESOURCE_DESCRIPTOR IoDescriptor)
 
typedef NTSTATUS(NTAPIPARB_TEST_ALLOCATION) (_In_ PARBITER_INSTANCE Arbiter, _Inout_ PARBITER_TEST_ALLOCATION_PARAMETERS Parameters)
 
typedef NTSTATUS(NTAPIPARB_RETEST_ALLOCATION) (_In_ PARBITER_INSTANCE Arbiter, _Inout_ PARBITER_RETEST_ALLOCATION_PARAMETERS Parameters)
 
typedef NTSTATUS(NTAPIPARB_BOOT_ALLOCATION) (_In_ PARBITER_INSTANCE Arbiter, _Inout_ PARBITER_BOOT_ALLOCATION_PARAMETERS Parameters)
 
typedef NTSTATUS(NTAPIPARB_QUERY_ARBITRATE) (_In_ PARBITER_INSTANCE Arbiter, _Inout_ PARBITER_QUERY_ARBITRATE_PARAMETERS Parameters)
 
typedef NTSTATUS(NTAPIPARB_QUERY_CONFLICT) (_In_ PARBITER_INSTANCE Arbiter, _Inout_ PARBITER_QUERY_CONFLICT_PARAMETERS Parameters)
 
typedef NTSTATUS(NTAPIPARB_ADD_RESERVED) (_In_ PARBITER_INSTANCE Arbiter, _Inout_ PARBITER_ADD_RESERVED_PARAMETERS Parameters)
 
typedef NTSTATUS(NTAPIPARB_COMMIT_ALLOCATION) (_In_ PARBITER_INSTANCE Arbiter)
 
typedef NTSTATUS(NTAPIPARB_ROLLBACK_ALLOCATION) (_In_ PARBITER_INSTANCE Arbiter)
 
typedef NTSTATUS(NTAPIPARB_START_ARBITER) (_In_ PARBITER_INSTANCE Arbiter, _In_ PCM_RESOURCE_LIST StartResources)
 
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 BOOLEAN(NTAPIPARB_OVERRIDE_CONFLICT) (_In_ PARBITER_INSTANCE Arbiter, _Inout_ PARBITER_ALLOCATION_STATE ArbState)
 
typedef NTSTATUS(NTAPIPARB_TRANSLATE_ORDERING) (_Out_ PIO_RESOURCE_DESCRIPTOR OutIoDescriptor, _In_ PIO_RESOURCE_DESCRIPTOR IoDescriptor)
 
typedef NTSTATUS(NTAPIPARB_INITIALIZE_RANGE_LIST) (_In_ PARBITER_INSTANCE Arbiter, _In_ ULONG DescriptorCount, _In_ PCM_PARTIAL_RESOURCE_DESCRIPTOR Descriptors, _Inout_ PRTL_RANGE_LIST RangeList)
 
typedef struct _ARBITER_INSTANCE ARBITER_INSTANCE
 

Functions

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)
 
VOID NTAPI ArbiterLibDeleteInstance (_In_ PARBITER_INSTANCE Arbiter)
 
VOID NTAPI ArbiterLibFreeOrderingList (_Inout_ PARBITER_ORDERING_LIST OrderingList)
 
NTSTATUS NTAPI ArbiterLibAddOrdering (_Inout_ PARBITER_ORDERING_LIST OrderingList, _In_ UINT64 Start, _In_ UINT64 End)
 
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.
 
NTSTATUS NTAPI ArbiterLibHandler (_In_ PVOID Context, _In_ ARBITER_ACTION Action, _Inout_ PARBITER_PARAMETERS Parameters)
 The single ARBITER_ACTION dispatcher every exported ARBITER_INTERFACE points its ArbiterHandler at; Context is the ARBITER_INSTANCE.
 
NTSTATUS NTAPI ArbiterLibTestAllocation (_In_ PARBITER_INSTANCE Arbiter, _Inout_ PARBITER_TEST_ALLOCATION_PARAMETERS Parameters)
 The TestAllocation action: tentatively places every entry of the arbitration list, leaving the solution in PossibleAllocation for a later commit or rollback.
 
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, without searching.
 
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 allocation.
 
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.
 
NTSTATUS NTAPI ArbiterLibCommitAllocation (_In_ PARBITER_INSTANCE Arbiter)
 The CommitAllocation action: the tentative PossibleAllocation becomes the committed Allocation, and the old committed list is recycled as the next scratch list.
 
NTSTATUS NTAPI ArbiterLibRollbackAllocation (_In_ PARBITER_INSTANCE Arbiter)
 The RollbackAllocation action: discards the tentative allocation; the committed one is untouched.
 
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 order across the arbiter's ordering list.
 
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.
 
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 device.
 
VOID NTAPI ArbiterLibBacktrackAllocation (_In_ PARBITER_INSTANCE Arbiter, _Inout_ PARBITER_ALLOCATION_STATE ArbState)
 Undoes the last AddAllocation performed for this entry.
 
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 ArbiterLibSortArbitrationList (_Inout_ PLIST_ENTRY ArbitrationList)
 Orders an arbitration list most-constrained first, so fixed requirements are placed before flexible ones can steal their ranges.
 
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, the previous entry's tentative choice is withdrawn and varied, first lower within its window, then via its next window or alternative.
 
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, so arbitration starts from the hardware's real extent.
 
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 window conflicts only with ranges the requesting device itself already owns.
 
NTSTATUS NTAPI ArbiterLibAddInaccessibleAllocationRange (_In_ PARBITER_INSTANCE Arbiter, _In_ PCWSTR OrderingName, _Inout_ PRTL_RANGE_LIST RangeList)
 Carves the firmware-reported inaccessible ranges (Arbiters\InaccessibleRange<OrderingName>) out of a range list as unowned blocking ranges, so they are never handed to a device.
 
NTSTATUS NTAPI ArbiterLibAddMmConfigRangeAsBootReserved (_In_ PARBITER_INSTANCE Arbiter, _Inout_ PRTL_RANGE_LIST RangeList)
 Reserves the PCI-Express enhanced-config (MMCONFIG / ECAM) MMIO window (Arbiters\ReservedResources\MmConfigRange) in a range list, and records it for ArbiterLibIsConflictWithMmConfigRange.
 
BOOLEAN NTAPI ArbiterLibIsConflictWithMmConfigRange (_In_ ULONGLONG Start, _In_ ULONGLONG End)
 Determines whether a range overlaps the recorded MMCONFIG window.
 
VOID NTAPI ArbiterLibReserveRange (_In_ PARBITER_INSTANCE Arbiter, _In_ ULONGLONG Start, _In_ ULONGLONG End, _In_opt_ PVOID Owner, _In_ BOOLEAN Shared)
 Commits a single [Start, End] range into the arbiter as an ordinary allocation owned by Owner.
 
VOID NTAPI ArbiterLibReleaseResources (_In_ PARBITER_INSTANCE Arbiter, _In_ PVOID Owner)
 Releases every committed range owned by Owner.
 
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 ArbiterLibAddReserved (_In_ PARBITER_INSTANCE Arbiter, _Inout_ PARBITER_ADD_RESERVED_PARAMETERS Parameters)
 The AddReserved action default: nothing to reserve.
 
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.
 

Macro Definition Documentation

◆ ARBITER_ALTERNATIVE_FLAG_BADRANGE

#define ARBITER_ALTERNATIVE_FLAG_BADRANGE   0x00000004

Definition at line 33 of file arbiter.h.

◆ ARBITER_ALTERNATIVE_FLAG_FIXED

#define ARBITER_ALTERNATIVE_FLAG_FIXED   0x00000002

Definition at line 32 of file arbiter.h.

◆ ARBITER_ALTERNATIVE_FLAG_INACCESSIBLE_OK

#define ARBITER_ALTERNATIVE_FLAG_INACCESSIBLE_OK   0x00000008

Definition at line 34 of file arbiter.h.

◆ ARBITER_ALTERNATIVE_FLAG_SHARED

#define ARBITER_ALTERNATIVE_FLAG_SHARED   0x00000001

Definition at line 31 of file arbiter.h.

◆ ARBITER_MAXIMUM_ADDRESS

#define ARBITER_MAXIMUM_ADDRESS   ((ULONGLONG)~0ULL)

Definition at line 13 of file arbiter.h.

◆ ARBITER_PRIORITY_EXHAUSTED

#define ARBITER_PRIORITY_EXHAUSTED   0x7FFFFFFF

Definition at line 28 of file arbiter.h.

◆ ARBITER_PRIORITY_NULL

#define ARBITER_PRIORITY_NULL   0x00000000

Definition at line 25 of file arbiter.h.

◆ ARBITER_PRIORITY_PREFERRED_RESERVED

#define ARBITER_PRIORITY_PREFERRED_RESERVED   0x7FFFFFFD

Definition at line 26 of file arbiter.h.

◆ ARBITER_PRIORITY_RESERVED

#define ARBITER_PRIORITY_RESERVED   0x7FFFFFFE

Definition at line 27 of file arbiter.h.

◆ ARBITER_RANGE_BOOT_ALLOCATED

#define ARBITER_RANGE_BOOT_ALLOCATED   0x01

Definition at line 53 of file arbiter.h.

◆ ARBITER_RANGE_INACCESSIBLE

#define ARBITER_RANGE_INACCESSIBLE   0x40

Definition at line 56 of file arbiter.h.

◆ ARBITER_RANGE_PORT_ALIAS

#define ARBITER_RANGE_PORT_ALIAS   0x10

Definition at line 55 of file arbiter.h.

◆ ARBITER_RANGE_SHARED_DRIVER

#define ARBITER_RANGE_SHARED_DRIVER   0x02

Definition at line 54 of file arbiter.h.

◆ ARBITER_STATE_FLAG_BOOT

#define ARBITER_STATE_FLAG_BOOT   0x0004

Definition at line 59 of file arbiter.h.

◆ ARBITER_STATE_FLAG_MCFG_CONFLICT

#define ARBITER_STATE_FLAG_MCFG_CONFLICT   0x0020

Definition at line 62 of file arbiter.h.

◆ ARBITER_STATE_FLAG_NULL_CONFLICT_OK

#define ARBITER_STATE_FLAG_NULL_CONFLICT_OK   0x0008

Definition at line 60 of file arbiter.h.

◆ ARBITER_STATE_FLAG_WORKSPACE

#define ARBITER_STATE_FLAG_WORKSPACE   0x0010

Definition at line 61 of file arbiter.h.

◆ TAG_ARBITER

#define TAG_ARBITER   'ibrA'

Definition at line 10 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 259 of file arbiter.h.

◆ PARB_ADD_RESERVED

Definition at line 171 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 241 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 265 of file arbiter.h.

◆ PARB_BOOT_ALLOCATION

Definition at line 153 of file arbiter.h.

◆ PARB_COMMIT_ALLOCATION

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

Definition at line 219 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 253 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 247 of file arbiter.h.

◆ PARB_INITIALIZE_RANGE_LIST

typedef NTSTATUS(NTAPI * PARB_INITIALIZE_RANGE_LIST) (_In_ PARBITER_INSTANCE Arbiter, _In_ ULONG DescriptorCount, _In_ PCM_PARTIAL_RESOURCE_DESCRIPTOR Descriptors, _Inout_ PRTL_RANGE_LIST RangeList)

Definition at line 284 of file arbiter.h.

◆ PARB_OVERRIDE_CONFLICT

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

Definition at line 271 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 121 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 235 of file arbiter.h.

◆ PARB_QUERY_ARBITRATE

Definition at line 159 of file arbiter.h.

◆ PARB_QUERY_CONFLICT

Definition at line 165 of file arbiter.h.

◆ PARB_RETEST_ALLOCATION

Definition at line 147 of file arbiter.h.

◆ PARB_ROLLBACK_ALLOCATION

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

Definition at line 224 of file arbiter.h.

◆ PARB_SCORE_REQUIREMENT

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

Definition at line 135 of file arbiter.h.

◆ PARB_START_ARBITER

typedef NTSTATUS(NTAPI * PARB_START_ARBITER) (_In_ PARBITER_INSTANCE Arbiter, _In_ PCM_RESOURCE_LIST StartResources)

Definition at line 229 of file arbiter.h.

◆ PARB_TEST_ALLOCATION

Definition at line 141 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 277 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_ PUINT64 OutLength, _Out_ PUINT64 OutAlignment)

Definition at line 112 of file arbiter.h.

◆ PARB_UNPACK_RESOURCE

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

Definition at line 128 of file arbiter.h.

◆ PARBITER_ALLOCATION_STATE

◆ PARBITER_ALTERNATIVE

◆ PARBITER_INSTANCE

Definition at line 110 of file arbiter.h.

◆ PARBITER_ORDERING

◆ PARBITER_ORDERING_LIST

Function Documentation

◆ ArbiterLibAddAllocation()

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 device.

Parameters
[in]ArbiterThe arbiter instance whose PossibleAllocation list receives the range.
[in,out]ArbStateThe allocation state whose Start, End and RangeAttributes describe the placement. The range is owned by the entry's physical device object.
Remarks
ADD_IF_CONFLICT is required because override solutions intentionally overlap existing ranges.

Definition at line 828 of file range.c.

831{
833
834 PAGED_CODE();
835
836 if (ArbState->CurrentAlternative != NULL &&
837 (ArbState->CurrentAlternative->Flags & ARBITER_ALTERNATIVE_FLAG_SHARED))
838 {
840 }
841
842 RtlAddRange(Arbiter->PossibleAllocation,
843 ArbState->Start,
844 ArbState->End,
845 ArbState->RangeAttributes,
846 Flags,
847 NULL,
848 ArbState->Entry ? ArbState->Entry->PhysicalDeviceObject : NULL);
849}
#define PAGED_CODE()
#define ARBITER_ALTERNATIVE_FLAG_SHARED
Definition: arbiter.h:31
_In_ D3DDDI_VIDEO_PRESENT_TARGET_ID _In_ ULONG _In_ ULONG Flags
Definition: dispmprt.h:245
#define NULL
Definition: types.h:112
NTSYSAPI NTSTATUS NTAPI RtlAddRange(_Inout_ PRTL_RANGE_LIST RangeList, _In_ ULONGLONG Start, _In_ ULONGLONG End, _In_ UCHAR Attributes, _In_ ULONG Flags, _In_opt_ PVOID UserData, _In_opt_ PVOID Owner)
#define RTL_RANGE_LIST_ADD_IF_CONFLICT
Definition: rtltypes.h:81
#define RTL_RANGE_LIST_ADD_SHARED
Definition: rtltypes.h:82
uint32_t ULONG
Definition: typedefs.h:59

Referenced by ArbiterLibInitializeInstance().

◆ ArbiterLibAddInaccessibleAllocationRange()

NTSTATUS NTAPI ArbiterLibAddInaccessibleAllocationRange ( _In_ PARBITER_INSTANCE  Arbiter,
_In_ PCWSTR  OrderingName,
_Inout_ PRTL_RANGE_LIST  RangeList 
)

Carves the firmware-reported inaccessible ranges (Arbiters\InaccessibleRange<OrderingName>) out of a range list as unowned blocking ranges, so they are never handed to a device.

Parameters
[in]ArbiterThe arbiter instance the ranges are filtered for.
[in]OrderingNameThe InaccessibleRange value to read.
[in,out]RangeListThe range list to carve the windows out of.
Returns
Returns STATUS_SUCCESS, including when nothing is recorded (an absent value reserves nothing).

Definition at line 634 of file ordering.c.

638{
639 PAGED_CODE();
640 return ArbpForEachRegistryRange(Arbiter, L"InaccessibleRange", OrderingName,
641 NULL, ArbpAddRangeCallback, RangeList);
642}
#define L(x)
Definition: resources.c:13
static VOID NTAPI ArbpAddRangeCallback(_In_ PARBITER_INSTANCE Arbiter, _In_opt_ PVOID Context, _In_ ULONGLONG Start, _In_ ULONGLONG End)
Range callback carving one window out of a range list as an unowned blocking range,...
Definition: ordering.c:490
static NTSTATUS ArbpForEachRegistryRange(_In_ PARBITER_INSTANCE Arbiter, _In_ PCWSTR Subkey, _In_ PCWSTR ValueName, _In_opt_ PARB_TRANSLATE_ORDERING Translate, _In_ PARB_RANGE_CALLBACK Callback, _In_opt_ PVOID Context)
Definition: ordering.c:313

◆ ArbiterLibAddMmConfigRangeAsBootReserved()

NTSTATUS NTAPI ArbiterLibAddMmConfigRangeAsBootReserved ( _In_ PARBITER_INSTANCE  Arbiter,
_Inout_ PRTL_RANGE_LIST  RangeList 
)

Reserves the PCI-Express enhanced-config (MMCONFIG / ECAM) MMIO window (Arbiters\ReservedResources\MmConfigRange) in a range list, and records it for ArbiterLibIsConflictWithMmConfigRange.

Parameters
[in]ArbiterThe arbiter instance the window is filtered for.
[in,out]RangeListThe range list to reserve the window in.
Returns
Returns STATUS_SUCCESS, including on a legacy pre-PCIe machine where the value is simply absent and nothing is reserved.

Definition at line 663 of file ordering.c.

666{
667 PAGED_CODE();
668 return ArbpForEachRegistryRange(Arbiter, L"ReservedResources", L"MmConfigRange",
669 NULL, ArbpMmConfigCallback, RangeList);
670}
static VOID NTAPI ArbpMmConfigCallback(_In_ PARBITER_INSTANCE Arbiter, _In_opt_ PVOID Context, _In_ ULONGLONG Start, _In_ ULONGLONG End)
Range callback recording the MMCONFIG (ECAM) window and reserving it in a range list as a boot alloca...
Definition: ordering.c:523

◆ ArbiterLibAddOrdering()

NTSTATUS NTAPI ArbiterLibAddOrdering ( _Inout_ PARBITER_ORDERING_LIST  OrderingList,
_In_ UINT64  Start,
_In_ UINT64  End 
)

Definition at line 78 of file ordering.c.

82{
83 PAGED_CODE();
84
85 if (End < Start)
87
88 /* Double the array capacity when it fills up, up to the sanity cap. */
89 if (OrderingList->Count == OrderingList->Maximum)
90 {
91 ULONG NewMaximum;
92 PARBITER_ORDERING NewArray;
93
94 NewMaximum = OrderingList->Maximum ? (ULONG)OrderingList->Maximum * 2
96 if (NewMaximum > ARBITER_ORDERING_LIMIT)
98
100 NewMaximum * sizeof(ARBITER_ORDERING),
102 if (NewArray == NULL)
104
105 if (OrderingList->Orderings != NULL)
106 {
107 RtlCopyMemory(NewArray, OrderingList->Orderings,
108 OrderingList->Count * sizeof(ARBITER_ORDERING));
109 ExFreePoolWithTag(OrderingList->Orderings, TAG_ARBITER);
110 }
111
112 OrderingList->Maximum = (UINT16)NewMaximum;
113 OrderingList->Orderings = NewArray;
114 }
115
116 OrderingList->Orderings[OrderingList->Count].Start = Start;
117 OrderingList->Orderings[OrderingList->Count].End = End;
118 OrderingList->Count++;
119 return STATUS_SUCCESS;
120}
static _Out_opt_ PULONGLONG Start
unsigned short UINT16
Definition: actypes.h:129
#define TAG_ARBITER
Definition: arbiter.h:10
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
#define PagedPool
Definition: env_spec_w32.h:308
if(dx< 0)
Definition: linetemp.h:194
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1109
#define ARBITER_ORDERING_LIMIT
Definition: ordering.c:18
#define ARBITER_ORDERING_GRANULARITY
Definition: ordering.c:17
#define STATUS_SUCCESS
Definition: shellext.h:65
UINT64 Start
Definition: arbiter.h:99
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158

Referenced by ArbiterLibDefaultAssignmentOrdering(), ArbpAddOrderingCallback(), ArbpAddReservedCallback(), and ArbpExcludeOrderingRange().

◆ ArbiterLibAddReserved()

NTSTATUS NTAPI ArbiterLibAddReserved ( _In_ PARBITER_INSTANCE  Arbiter,
_Inout_ PARBITER_ADD_RESERVED_PARAMETERS  Parameters 
)

The AddReserved action default: nothing to reserve.

Parameters
[in]ArbiterThe arbiter instance the reservation was aimed at.
[in,out]ParametersThe action parameters (pre-Vista builds receive the requirement and resource descriptors directly).
Returns
Returns STATUS_SUCCESS.

Definition at line 112 of file handler.c.

115{
116 PAGED_CODE();
117 UNREFERENCED_PARAMETER(Arbiter);
119 return STATUS_SUCCESS;
120}
_In_ HANDLE _In_ CONST PDXGKMDT_OPM_GET_INFO_PARAMETERS Parameters
Definition: dispmprt.h:321
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:329

Referenced by ArbiterLibInitializeInstance().

◆ ArbiterLibAllocateEntry()

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, the previous entry's tentative choice is withdrawn and varied, first lower within its window, then via its next window or alternative.

Parameters
[in]ArbiterThe arbiter instance whose walker callbacks (GetNextAllocationRange, FindSuitableRange, AddAllocation, BacktrackAllocation) drive each placement.
[in,out]ArbStateThe first ARBITER_ALLOCATION_STATE of the allocation stack, one per entry in most-constrained-first order, terminated by a state whose Entry is NULL.
Returns
Returns STATUS_SUCCESS once every entry has a placement (the results are packed into each entry's Assignment and Result), STATUS_UNSUCCESSFUL if even the first entry has no solution, or a PreprocessEntry / PackResource failure status.

Definition at line 223 of file entry.c.

226{
227 PARBITER_ALLOCATION_STATE Current = ArbState;
228 BOOLEAN Backtracking = FALSE;
229 BOOLEAN McfgConflict = FALSE;
230 BOOLEAN DeadlineReported = FALSE;
231 ULONGLONG Deadline;
232 ULONGLONG HardDeadline;
234
235 PAGED_CODE();
236
239
240 while (Current >= ArbState && Current->Entry != NULL)
241 {
243 BOOLEAN RetrySameRange = FALSE;
244
245 /*
246 * A search that cannot terminate must fail rather than wedge the
247 * machine.
248 */
249 if (KeQueryInterruptTime() > HardDeadline)
250 {
251 DPRINT1("Arbiter %ws: abandoning allocation at entry %u, the search "
252 "is not terminating\n",
253 Arbiter->Name ? Arbiter->Name : L"(unnamed)",
254 (ULONG)(Current - ArbState));
255
256 if (ArbState->Entry != NULL)
257 ArbState->Entry->Result = ArbiterResultExternalConflict;
258
260 return STATUS_UNSUCCESSFUL;
261 }
262
263 Status = Arbiter->PreprocessEntry(Arbiter, Current);
264 if (!NT_SUCCESS(Status))
265 {
267 return Status;
268 }
269
270 if (Backtracking)
271 {
272 PARBITER_ALTERNATIVE FailedAlternative = Current->CurrentAlternative;
273
274 /*
275 * The entry after this one could not be placed. Withdraw this
276 * entry's tentative choice and vary it: first lower within the same
277 * window, then via the next window / alternative.
278 */
279 (Current + 1)->CurrentAlternative = NULL;
280 Backtracking = FALSE;
281
282 if (FailedAlternative == NULL || FailedAlternative->Length == 0)
283 goto Backtrack; /* Nothing to vary here */
284
285 Arbiter->BacktrackAllocation(Arbiter, Current);
286
287 /*
288 * Retrying one placement lower walks the window down an alignment
289 * unit at a time, so it has to be bounded, or searching a bridge's
290 * multi-gigabyte window will hang the system.
291 */
292 if (Current->Start > Current->CurrentMinimum &&
293 !(FailedAlternative->Flags & ARBITER_ALTERNATIVE_FLAG_FIXED))
294 {
295 if (KeQueryInterruptTime() <= Deadline)
296 {
297 Current->CurrentMaximum = Current->Start - 1;
298 RetrySameRange = TRUE;
299 }
300 else if (!DeadlineReported)
301 {
302 DeadlineReported = TRUE;
303 DPRINT1("Arbiter %ws: allocation deadline expired, giving up "
304 "range refinement\n",
305 Arbiter->Name ? Arbiter->Name : L"(unnamed)");
306 }
307 }
308 }
309
310 for (;;)
311 {
312 if (!RetrySameRange)
313 {
314 if (!Arbiter->GetNextAllocationRange(Arbiter, Current))
315 break;
316 }
317 RetrySameRange = FALSE;
318
319 if (Arbiter->FindSuitableRange(Arbiter, Current))
320 {
321 Found = TRUE;
322 break;
323 }
324 }
325
326 if (Found)
327 {
328 if (Current->CurrentAlternative->Length != 0)
329 Arbiter->AddAllocation(Arbiter, Current);
330 else
332
333 Current++;
334 continue;
335 }
336
337Backtrack:
339 McfgConflict = TRUE;
340
341 if (Current == ArbState)
342 {
343 /* Even the first entry has no solution. */
344 if (Current->Entry != NULL)
346
347 DPRINT1("Arbiter %ws: nowhere to put 0x%I64x..0x%I64x\n",
348 Arbiter->Name ? Arbiter->Name : L"(unnamed)",
349 Current->CurrentMinimum, Current->CurrentMaximum);
351 Current->CurrentMinimum,
352 Current->CurrentMaximum);
353
355 return McfgConflict ? STATUS_BAD_MCFG_TABLE : STATUS_UNSUCCESSFUL;
356 }
357 Backtracking = TRUE;
358 Current--;
359 }
360
361 /* Complete solution found; report it back to the requesters. */
362 for (Current = ArbState; Current->Entry != NULL; ++Current)
363 {
365
366 if (Current->Entry->Assignment != NULL && Arbiter->PackResource != NULL)
367 {
368 Status = Arbiter->PackResource(Current->CurrentAlternative->Descriptor,
369 Current->Start,
370 Current->Entry->Assignment);
371 if (!NT_SUCCESS(Status))
372 {
374 return Status;
375 }
376 }
377
378 if (Current->Entry->Result != ArbiterResultNullRequest)
380 }
381
383 return STATUS_SUCCESS;
384}
unsigned char BOOLEAN
Definition: actypes.h:127
#define ARBITER_STATE_FLAG_MCFG_CONFLICT
Definition: arbiter.h:62
#define ARBITER_ALTERNATIVE_FLAG_FIXED
Definition: arbiter.h:32
LONG NTSTATUS
Definition: precomp.h:26
#define DPRINT1
Definition: precomp.h:8
return Found
Definition: dirsup.c:1270
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:33
Status
Definition: gdiplustypes.h:24
#define STATUS_BAD_MCFG_TABLE
Definition: ntstatus.h:1360
#define KeQueryInterruptTime()
Definition: ke.h:37
#define ARBITER_ALLOCATE_HARD_DEADLINE
Definition: entry.c:19
#define ARBITER_ALLOCATE_DEADLINE
Definition: entry.c:18
static VOID ArbpReportConflictingRanges(_In_ PARBITER_INSTANCE Arbiter, _In_ ULONGLONG Minimum, _In_ ULONGLONG Maximum)
Says what an arbiter is already holding across a window.
Definition: entry.c:161
static VOID ArbpFreeAllocationWorkSpaces(_Inout_ PARBITER_ALLOCATION_STATE ArbState)
Releases the per-entry workspace a PreprocessEntry override allocated, across the whole allocation st...
Definition: entry.c:121
PARBITER_ALTERNATIVE CurrentAlternative
Definition: arbiter.h:88
PARBITER_LIST_ENTRY Entry
Definition: arbiter.h:87
PIO_RESOURCE_DESCRIPTOR Descriptor
Definition: arbiter.h:77
ARBITER_RESULT Result
Definition: iotypes.h:4646
PIO_RESOURCE_DESCRIPTOR SelectedAlternative
Definition: iotypes.h:4645
PCM_PARTIAL_RESOURCE_DESCRIPTOR Assignment
Definition: iotypes.h:4644
uint64_t ULONGLONG
Definition: typedefs.h:67
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
@ ArbiterResultExternalConflict
Definition: iotypes.h:4627
@ ArbiterResultSuccess
Definition: iotypes.h:4626
@ ArbiterResultNullRequest
Definition: iotypes.h:4628

Referenced by ArbiterLibInitializeInstance().

◆ ArbiterLibBacktrackAllocation()

VOID NTAPI ArbiterLibBacktrackAllocation ( _In_ PARBITER_INSTANCE  Arbiter,
_Inout_ PARBITER_ALLOCATION_STATE  ArbState 
)

Undoes the last AddAllocation performed for this entry.

Parameters
[in]ArbiterThe arbiter instance whose PossibleAllocation list the tentative range is deleted from.
[in,out]ArbStateThe allocation state whose Start and End describe the placement being removed sanity checked by the entry's physical device object.

Definition at line 866 of file range.c.

869{
870 PAGED_CODE();
871
872 RtlDeleteRange(Arbiter->PossibleAllocation,
873 ArbState->Start,
874 ArbState->End,
875 ArbState->Entry ? ArbState->Entry->PhysicalDeviceObject : NULL);
876}
NTSYSAPI NTSTATUS NTAPI RtlDeleteRange(_Inout_ PRTL_RANGE_LIST RangeList, _In_ ULONGLONG Start, _In_ ULONGLONG End, _In_ PVOID Owner)

Referenced by ArbiterLibInitializeInstance().

◆ ArbiterLibBootAllocation()

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 allocation.

Parameters
[in]ArbiterThe arbiter instance performing the reservation.
[in,out]ParametersThe action parameters carrying the arbitration list (pre-Vista builds receive the list directly).
Returns
Returns the ArbpBootAllocation status.

Definition at line 684 of file transaction.c.

687{
688 PAGED_CODE();
689 return ArbpBootAllocation(Arbiter, Parameters->ArbitrationList);
690}
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 ...
Definition: transaction.c:582

Referenced by ArbiterLibInitializeInstance().

◆ ArbiterLibCommitAllocation()

NTSTATUS NTAPI ArbiterLibCommitAllocation ( _In_ PARBITER_INSTANCE  Arbiter)

The CommitAllocation action: the tentative PossibleAllocation becomes the committed Allocation, and the old committed list is recycled as the next scratch list.

Parameters
[in]ArbiterThe arbiter instance whose transaction is committed.
Returns
Returns STATUS_SUCCESS.

Definition at line 515 of file transaction.c.

517{
518 PRTL_RANGE_LIST Old = Arbiter->Allocation;
519
520 PAGED_CODE();
521
522 RtlFreeRangeList(Old);
524 Arbiter->Allocation = Arbiter->PossibleAllocation;
525 Arbiter->PossibleAllocation = Old;
526 return STATUS_SUCCESS;
527}
NTSYSAPI VOID NTAPI RtlInitializeRangeList(_Out_ PRTL_RANGE_LIST RangeList)
NTSYSAPI VOID NTAPI RtlFreeRangeList(_In_ PRTL_RANGE_LIST RangeList)

Referenced by ArbiterLibInitializeInstance().

◆ ArbiterLibDefaultAssignmentOrdering()

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.

Parameters
[in,out]ArbiterThe arbiter instance whose OrderingList and ReservedList are (re)created. Callers may rebuild an existing ordering against a different policy table (see pcix!ario_ApplyBrokenVideoHack).
[in]AllocationOrderNameThe AllocationOrder value naming this arbiter's preferred windows. The engine walks the resulting list in index order, so index 0 is the most-preferred window.
[in]ReservedResourcesNameThe ReservedResources value naming this arbiter's last-resort windows: each is recorded in the ReservedList for the engine's final pass and pruned out of every ordering window, so it is only ever offered once all orderings fail.
[in]TranslateOrderingFunctionOptional per-arbiter descriptor translation.
Returns
Returns STATUS_SUCCESS if the ordering was built. Absent registry policy is not a failure; the ordering then holds only the full-range fallback, so the arbiter can always search the whole space.

Definition at line 571 of file ordering.c.

576{
578
579 PAGED_CODE();
580
581 ArbiterLibFreeOrderingList(&Arbiter->OrderingList);
582 ArbiterLibFreeOrderingList(&Arbiter->ReservedList);
583
584 Status = ArbpCreateOrderingList(&Arbiter->OrderingList);
585 if (!NT_SUCCESS(Status))
586 return Status;
587 Status = ArbpCreateOrderingList(&Arbiter->ReservedList);
588 if (!NT_SUCCESS(Status))
589 {
590 ArbiterLibFreeOrderingList(&Arbiter->OrderingList);
591 return Status;
592 }
593
594 ArbpForEachRegistryRange(Arbiter, L"AllocationOrder", AllocationOrderName,
595 TranslateOrderingFunction, ArbpAddOrderingCallback, NULL);
596
597 Status = ArbiterLibAddOrdering(&Arbiter->OrderingList, 0, ARBITER_MAXIMUM_ADDRESS);
598 if (!NT_SUCCESS(Status))
599 return Status;
600
601 /*
602 * The reserved windows come last, after the fallback is in place, so the
603 * pruning punches them out of the fallback too. Otherwise the fallback
604 * pass would hand them out like any other range.
605 */
606 return ArbpForEachRegistryRange(Arbiter, L"ReservedResources", ReservedResourcesName,
607 TranslateOrderingFunction, ArbpAddReservedCallback,
608 NULL);
609}
#define ARBITER_MAXIMUM_ADDRESS
Definition: arbiter.h:13
static VOID NTAPI ArbpAddReservedCallback(_In_ PARBITER_INSTANCE Arbiter, _In_opt_ PVOID Context, _In_ ULONGLONG Start, _In_ ULONGLONG End)
Range callback moving one reserved window into last-resort territory: recorded in the arbiter's Reser...
Definition: ordering.c:456
static NTSTATUS ArbpCreateOrderingList(_Out_ PARBITER_ORDERING_LIST OrderingList)
Definition: ordering.c:37
static VOID NTAPI ArbpAddOrderingCallback(_In_ PARBITER_INSTANCE Arbiter, _In_opt_ PVOID Context, _In_ ULONGLONG Start, _In_ ULONGLONG End)
Definition: ordering.c:415
VOID NTAPI ArbiterLibFreeOrderingList(_Inout_ PARBITER_ORDERING_LIST OrderingList)
Definition: ordering.c:60
NTSTATUS NTAPI ArbiterLibAddOrdering(_Inout_ PARBITER_ORDERING_LIST OrderingList, _In_ UINT64 Start, _In_ UINT64 End)
Definition: ordering.c:78

Referenced by ArbiterLibInitializeInstance(), and ario_ApplyBrokenVideoHack().

◆ ArbiterLibDeleteInstance()

VOID NTAPI ArbiterLibDeleteInstance ( _In_ PARBITER_INSTANCE  Arbiter)

Definition at line 22 of file arbiter.c.

24{
25 PAGED_CODE();
26
27 if (Arbiter->PossibleAllocation)
28 {
29 RtlFreeRangeList(Arbiter->PossibleAllocation);
30 ExFreePoolWithTag(Arbiter->PossibleAllocation, TAG_ARBITER);
31 Arbiter->PossibleAllocation = NULL;
32 }
33
34 if (Arbiter->Allocation)
35 {
36 RtlFreeRangeList(Arbiter->Allocation);
37 ExFreePoolWithTag(Arbiter->Allocation, TAG_ARBITER);
38 Arbiter->Allocation = NULL;
39 }
40
41 if (Arbiter->AllocationStack)
42 {
43 ExFreePoolWithTag(Arbiter->AllocationStack, TAG_ARBITER);
44 Arbiter->AllocationStack = NULL;
45 Arbiter->AllocationStackMaxSize = 0;
46 }
47
48 ArbiterLibFreeOrderingList(&Arbiter->OrderingList);
49 ArbiterLibFreeOrderingList(&Arbiter->ReservedList);
50
51#if (NTDDI_VERSION >= NTDDI_VISTA)
52 if (Arbiter->TransactionEvent)
53 {
54 ExFreePoolWithTag(Arbiter->TransactionEvent, TAG_ARBITER);
55 Arbiter->TransactionEvent = NULL;
56 }
57#endif
58
59 if (Arbiter->MutexEvent)
60 {
61 ExFreePoolWithTag(Arbiter->MutexEvent, TAG_ARBITER);
62 Arbiter->MutexEvent = NULL;
63 }
64}
VOID NTAPI ArbiterLibFreeOrderingList(_Inout_ PARBITER_ORDERING_LIST OrderingList)
Definition: ordering.c:60

Referenced by ArbiterLibInitializeInstance(), and PciArbiterDestructor().

◆ ArbiterLibFindSuitableRange()

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.

Parameters
[in]ArbiterThe arbiter instance whose PossibleAllocation list is searched.
[in,out]ArbStateThe allocation state of the entry being placed. On success, Start and End receive the chosen window.
Returns
Returns TRUE if a placement was found,FALSE if the window cannot satisfy the requirement.
Remarks
Legacy requests treat boot-allocated ranges as available. When RtlFindRange reports a conflict, a driver-exclusive requirement may still share the range (ArbpShareDriverExclusive), and failing that the arbiter's OverrideConflict callback gets a last-chance override. this is how a device is re-assigned its own boot configuration.

Definition at line 717 of file range.c.

720{
721 PARBITER_ALTERNATIVE Alternative = ArbState->CurrentAlternative;
722 ULONG Flags = 0;
724
725 PAGED_CODE();
726
727 if (Alternative == NULL)
728 return FALSE;
729
730 if (ArbState->CurrentMinimum > ArbState->CurrentMaximum)
731 return FALSE;
732
733 if (Alternative->Length == 0)
734 {
735 ArbState->Start = ArbState->CurrentMinimum;
736 ArbState->End = ArbState->CurrentMinimum;
737 return TRUE;
738 }
739
740 /*
741 * Interrupt retention: give the device back its firmware-routed vector rather
742 * than letting the top-down search pick an untranslatable one
743 */
744 if (ArbpReuseOwnedInterrupt(Arbiter, ArbState))
745 return TRUE;
746
747 /* Legacy requests consider preallocated (boot) ranges available. */
748 if (ArbState->Entry != NULL &&
749 (ArbState->Entry->RequestSource == ArbiterRequestLegacyReported ||
750 ArbState->Entry->RequestSource == ArbiterRequestLegacyAssigned))
751 {
752 ArbState->RangeAvailableAttributes |= ARBITER_RANGE_BOOT_ALLOCATED;
753 }
754
755 if (ArbState->Flags & ARBITER_STATE_FLAG_NULL_CONFLICT_OK)
757 if (Alternative->Flags & ARBITER_ALTERNATIVE_FLAG_SHARED)
760 ArbState->RangeAvailableAttributes |= ARBITER_RANGE_INACCESSIBLE;
761
762 Status = RtlFindRange(Arbiter->PossibleAllocation,
763 ArbState->CurrentMinimum,
764 ArbState->CurrentMaximum,
765 Alternative->Length,
766 max(Alternative->Alignment, 1),
767 Flags,
768 ArbState->RangeAvailableAttributes,
769 Arbiter->ConflictCallbackContext,
770 Arbiter->ConflictCallback,
771 &ArbState->Start);
772 if (!NT_SUCCESS(Status))
773 {
774 /*
775 * The window is occupied. A CmResourceShareDriverExclusive requirement
776 * can still succeed by sharing the conflicting range with the same driver
777 * or another root-enumerated device
778 *
779 * This matters a lot because HAL reverses quite a bit and marks it this.
780 * This mechanism is how Windows "internally allows this".
781 */
782 if (ArbpShareDriverExclusive(Arbiter, ArbState))
783 return TRUE;
784 if (Arbiter->OverrideConflict != NULL &&
785 Arbiter->OverrideConflict(Arbiter, ArbState))
786 {
787 return TRUE;
788 }
789
790 /*
791 * A window that only fails because it runs into the MMCONFIG region
792 * points at the firmware's MCFG table rather than at any device.
793 */
794 if (ArbiterLibIsConflictWithMmConfigRange(ArbState->CurrentMinimum,
795 ArbState->CurrentMaximum))
796 {
797 ArbState->Flags |= ARBITER_STATE_FLAG_MCFG_CONFLICT;
798 }
799
800 return FALSE;
801 }
802
803 ArbState->End = ArbState->Start + Alternative->Length - 1;
804 return TRUE;
805}
#define ARBITER_STATE_FLAG_NULL_CONFLICT_OK
Definition: arbiter.h:60
#define ARBITER_RANGE_INACCESSIBLE
Definition: arbiter.h:56
#define ARBITER_ALTERNATIVE_FLAG_INACCESSIBLE_OK
Definition: arbiter.h:34
BOOLEAN NTAPI ArbiterLibIsConflictWithMmConfigRange(_In_ ULONGLONG Start, _In_ ULONGLONG End)
Determines whether a range overlaps the recorded MMCONFIG window.
Definition: ordering.c:689
#define ARBITER_RANGE_BOOT_ALLOCATED
Definition: arbiter.h:53
NTSYSAPI NTSTATUS NTAPI RtlFindRange(_In_ PRTL_RANGE_LIST RangeList, _In_ ULONGLONG Minimum, _In_ ULONGLONG Maximum, _In_ ULONGLONG Length, _In_ ULONGLONG Alignment, _In_ ULONG Flags, _In_ UCHAR AttributeAvailableMask, _In_opt_ PVOID Context, _In_opt_ PRTL_CONFLICT_RANGE_CALLBACK Callback, _Out_ PULONGLONG Start)
#define RTL_RANGE_LIST_NULL_CONFLICT_OK
Definition: rtltypes.h:90
#define RTL_RANGE_LIST_SHARED_OK
Definition: rtltypes.h:89
static BOOLEAN ArbpShareDriverExclusive(_In_ PARBITER_INSTANCE Arbiter, _Inout_ PARBITER_ALLOCATION_STATE ArbState)
Attempts last-chance sharing for a CmResourceShareDriverExclusive requirement whose window RtlFindRan...
Definition: range.c:300
static BOOLEAN ArbpReuseOwnedInterrupt(_In_ PARBITER_INSTANCE Arbiter, _Inout_ PARBITER_ALLOCATION_STATE ArbState)
Hands a device back its own already routed IRQ instead of searching for a fresh one,...
Definition: range.c:401
#define max(a, b)
Definition: svc.c:63
@ ArbiterRequestLegacyAssigned
Definition: iotypes.h:4619
@ ArbiterRequestLegacyReported
Definition: iotypes.h:4617

Referenced by ArbiterLibInitializeInstance(), IopArbMemFindSuitableRange(), and IopArbPortFindSuitableRange().

◆ ArbiterLibFreeOrderingList()

VOID NTAPI ArbiterLibFreeOrderingList ( _Inout_ PARBITER_ORDERING_LIST  OrderingList)

Definition at line 60 of file ordering.c.

62{
63 PAGED_CODE();
64
65 if (OrderingList->Orderings != NULL)
66 ExFreePoolWithTag(OrderingList->Orderings, TAG_ARBITER);
67
68 OrderingList->Orderings = NULL;
69 OrderingList->Count = 0;
70 OrderingList->Maximum = 0;
71}

Referenced by ArbiterLibDefaultAssignmentOrdering(), ArbiterLibDeleteInstance(), ArbpExcludeOrderingRange(), and ario_ApplyBrokenVideoHack().

◆ ArbiterLibGetNextAllocationRange()

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 order across the arbiter's ordering list.

Parameters
[in]ArbiterThe arbiter instance whose ordering list supplies the candidate windows.
[in,out]ArbStateThe allocation state of the entry being placed. On success, CurrentMinimum, CurrentMaximum and CurrentAlternative describe the next window to search; the window is pre-trimmed so an aligned allocation of the required length fits inside it.
Returns
Returns TRUE if a new candidate window was produced, FALSE once every alternative is exhausted.

Definition at line 562 of file range.c.

565{
566 PARBITER_ALTERNATIVE Alternative;
568 UINT64 Minimum, Maximum;
569
570 PAGED_CODE();
571
572 if (ArbState->AlternativeCount == 0)
573 return FALSE;
574
575 for (;;)
576 {
577 /* Advance the alternative we last worked on, or seed all on first entry. */
578 if (ArbState->CurrentAlternative != NULL)
579 {
580 ArbpWritePriority(Arbiter, ArbState->CurrentAlternative);
581 }
582 else
583 {
584 for (Alternative = ArbState->Alternatives;
585 Alternative < &ArbState->Alternatives[ArbState->AlternativeCount];
586 ++Alternative)
587 {
588 Alternative->Priority = ARBITER_PRIORITY_NULL;
589 ArbpWritePriority(Arbiter, Alternative);
590 }
591 }
592
593 /* Pick the best (lowest-priority) alternative. */
594 Lowest = ArbState->Alternatives;
595 for (Alternative = ArbState->Alternatives + 1;
596 Alternative < &ArbState->Alternatives[ArbState->AlternativeCount];
597 ++Alternative)
598 {
599 if (Alternative->Priority < Lowest->Priority)
600 Lowest = Alternative;
601 }
602
604 return FALSE;
605
606 if (Lowest->Priority == ARBITER_PRIORITY_RESERVED ||
608 {
609 /*
610 * Last-resort pass: the reserved windows in turn, then the whole
611 * requirement window (see ArbpTakeReservedWindow).
612 */
613 if (!ArbpTakeReservedWindow(Arbiter, Lowest, &Minimum, &Maximum))
614 {
615 /*
616 * CurrentAlternative must be set before looping. While it is
617 * still NULL, the top of the loop re-seeds every alternative's
618 * priority back to ARBITER_PRIORITY_NULL, which would discard
619 * the EXHAUSTED just recorded and spin forever.
620 */
622 ArbState->CurrentAlternative = Lowest;
623 continue;
624 }
625 }
626 else
627 {
628 PARBITER_ORDERING Ordering;
629 ULONG Index = (Lowest->Priority < 0) ? (ULONG)(-(Lowest->Priority + 1))
630 : (ULONG)(Lowest->Priority - 1);
631 if (Index >= Arbiter->OrderingList.Count)
632 {
634 ArbState->CurrentAlternative = Lowest;
635 continue;
636 }
637 Ordering = &Arbiter->OrderingList.Orderings[Index];
638 Minimum = max(Lowest->Minimum, Ordering->Start);
639 Maximum = min(Lowest->Maximum, Ordering->End);
640 }
641
642 /*
643 * Trim the window so an aligned allocation of the required length is
644 * possible; skip the window entirely if it cannot hold one.
645 */
646 if (Lowest->Length != 0)
647 {
648 UINT64 Alignment = Lowest->Alignment ? Lowest->Alignment : 1;
649 UINT64 LengthMinusOne = Lowest->Length - 1;
650 UINT64 AlignedMax;
651
652 Minimum += Alignment - 1;
653 Minimum -= Minimum % Alignment;
654
655 if (Minimum > Maximum || LengthMinusOne > Maximum - Minimum)
656 {
657 ArbState->CurrentAlternative = Lowest; /* consume this priority */
658 continue;
659 }
660
661 AlignedMax = Maximum - LengthMinusOne;
662 AlignedMax -= AlignedMax % Alignment;
663 if (AlignedMax < Minimum)
664 {
665 ArbState->CurrentAlternative = Lowest; /* no aligned start fits */
666 continue;
667 }
668 Maximum = AlignedMax + LengthMinusOne;
669 }
670 else
671 {
672 Minimum = Lowest->Minimum;
673 Maximum = Lowest->Maximum;
674 }
675
676 if (Minimum != ArbState->CurrentMinimum ||
677 Maximum != ArbState->CurrentMaximum ||
678 ArbState->CurrentAlternative != Lowest)
679 {
680 ArbState->CurrentMinimum = Minimum;
681 ArbState->CurrentMaximum = Maximum;
682 ArbState->CurrentAlternative = Lowest;
683 return TRUE;
684 }
685
686 ArbState->CurrentAlternative = Lowest;
687 }
688}
COMPILER_DEPENDENT_UINT64 UINT64
Definition: actypes.h:131
#define ARBITER_PRIORITY_NULL
Definition: arbiter.h:25
#define ARBITER_PRIORITY_RESERVED
Definition: arbiter.h:27
#define ARBITER_PRIORITY_EXHAUSTED
Definition: arbiter.h:28
#define ARBITER_PRIORITY_PREFERRED_RESERVED
Definition: arbiter.h:26
union Alignment_ Alignment
#define min(a, b)
Definition: monoChain.cc:55
static BOOLEAN ArbpTakeReservedWindow(_In_ PARBITER_INSTANCE Arbiter, _Inout_ PARBITER_ALTERNATIVE Alternative, _Out_ PUINT64 Minimum, _Out_ PUINT64 Maximum)
Takes the next window of the reserved (last-resort) pass for an alternative: each ReservedList range ...
Definition: range.c:472
static VOID ArbpWritePriority(_In_ PARBITER_INSTANCE Arbiter, _Inout_ PARBITER_ALTERNATIVE Alternative)
Writes an alternative's priority to the next ordering-list range it can be satisfied from.
Definition: range.c:116
_In_ WDFCOLLECTION _In_ ULONG Index

Referenced by ArbiterLibInitializeInstance().

◆ ArbiterLibHandler()

NTSTATUS NTAPI ArbiterLibHandler ( _In_ PVOID  Context,
_In_ ARBITER_ACTION  Action,
_Inout_ PARBITER_PARAMETERS  Parameters 
)

The single ARBITER_ACTION dispatcher every exported ARBITER_INTERFACE points its ArbiterHandler at; Context is the ARBITER_INSTANCE.

Parameters
[in]ContextThe ARBITER_INSTANCE the interface was created for.
[in]ActionThe ARBITER_ACTION to perform.
[in,out]ParametersThe parameters union matching the action.
Returns
Returns the dispatched action's status, STATUS_NOT_IMPLEMENTED for a known but unrouted action, or STATUS_INVALID_PARAMETER for an unrecognized one.
Remarks
The call runs under the instance lock, so a Test and its later Commit or Rollback apply to the same transaction. On Vista+ the transaction event tracks that window: Test and Retest arm it, Commit and Rollback resolve it and wake waiters.

Definition at line 164 of file handler.c.

168{
171
172 PAGED_CODE();
173
174 ArbpAcquireLock(Arbiter);
175
176 switch (Action)
177 {
179#if (NTDDI_VERSION >= NTDDI_VISTA)
180 Status = Arbiter->TestAllocation(Arbiter, &Parameters->Parameters.TestAllocation);
181#else
182 Status = Arbiter->TestAllocation(
183 Arbiter,
184 Parameters->Parameters.TestAllocation.ArbitrationList);
185#endif
186 break;
187
189#if (NTDDI_VERSION >= NTDDI_VISTA)
190 Status = Arbiter->RetestAllocation(Arbiter, &Parameters->Parameters.RetestAllocation);
191#else
192 Status = Arbiter->RetestAllocation(
193 Arbiter,
194 Parameters->Parameters.RetestAllocation.ArbitrationList);
195#endif
196 break;
197
199 Status = Arbiter->CommitAllocation(Arbiter);
200 break;
201
203 Status = Arbiter->RollbackAllocation(Arbiter);
204 break;
205
207#if (NTDDI_VERSION >= NTDDI_VISTA)
208 Status = Arbiter->BootAllocation(Arbiter, &Parameters->Parameters.BootAllocation);
209#else
210 Status = Arbiter->BootAllocation(
211 Arbiter,
212 Parameters->Parameters.BootAllocation.ArbitrationList);
213#endif
214 break;
215
217#if (NTDDI_VERSION >= NTDDI_VISTA)
218 Status = Arbiter->QueryConflict(Arbiter, &Parameters->Parameters.QueryConflict);
219#else
220 Status = Arbiter->QueryConflict(
221 Arbiter,
222 Parameters->Parameters.QueryConflict.PhysicalDeviceObject,
223 Parameters->Parameters.QueryConflict.ConflictingResource,
224 Parameters->Parameters.QueryConflict.ConflictCount,
225 Parameters->Parameters.QueryConflict.Conflicts);
226#endif
227 break;
228
230#if (NTDDI_VERSION >= NTDDI_VISTA)
231 Status = Arbiter->QueryArbitrate(Arbiter, &Parameters->Parameters.QueryArbitrate);
232#else
233 Status = Arbiter->QueryArbitrate(
234 Arbiter,
235 Parameters->Parameters.QueryArbitrate.ArbitrationList);
236#endif
237 break;
238
239 /*
240 * Actions the interface defines but this arbiter does not carry
241 * out. AddReserved is one: the instance slot exists and is
242 * defaulted, but nothing routes to it.
243 */
248 break;
249
250 default:
252 break;
253 }
254
255#if (NTDDI_VERSION >= NTDDI_VISTA)
256 /* Track the tested-but-not-yet-committed window for transaction waiters. */
257 if (NT_SUCCESS(Status))
258 {
261 {
262 Arbiter->TransactionInProgress = TRUE;
264 }
267 {
268 Arbiter->TransactionInProgress = FALSE;
270 }
271 }
272#endif
273
274 ArbpReleaseLock(Arbiter);
275 return Status;
276}
struct _ARBITER_INSTANCE * PARBITER_INSTANCE
Definition: arbiter.h:110
#define STATUS_NOT_IMPLEMENTED
Definition: d3dkmdt.h:42
#define KeSetEvent(pEvt, foo, foo2)
Definition: env_spec_w32.h:476
VOID NTAPI KeClearEvent(IN PKEVENT Event)
Definition: eventobj.c:22
static VOID ArbpReleaseLock(_In_ PARBITER_INSTANCE Arbiter)
Releases the arbiter's per-instance lock.
Definition: handler.c:47
static VOID ArbpAcquireLock(_In_ PARBITER_INSTANCE Arbiter)
Acquires the arbiter's per-instance lock: one arbitration at a time.
Definition: handler.c:30
_In_ PVOID Context
Definition: storport.h:2269
PARB_RETEST_ALLOCATION RetestAllocation
Definition: arbiter.h:315
BOOLEAN TransactionInProgress
Definition: arbiter.h:333
PARB_QUERY_ARBITRATE QueryArbitrate
Definition: arbiter.h:319
PARB_BOOT_ALLOCATION BootAllocation
Definition: arbiter.h:318
PARB_TEST_ALLOCATION TestAllocation
Definition: arbiter.h:314
PARB_QUERY_CONFLICT QueryConflict
Definition: arbiter.h:320
PKEVENT TransactionEvent
Definition: arbiter.h:335
PARB_COMMIT_ALLOCATION CommitAllocation
Definition: arbiter.h:316
PARB_ROLLBACK_ALLOCATION RollbackAllocation
Definition: arbiter.h:317
_In_ WDFIOTARGET _In_ _Strict_type_match_ WDF_IO_TARGET_SENT_IO_ACTION Action
Definition: wdfiotarget.h:510
#define IO_NO_INCREMENT
Definition: iotypes.h:598
@ ArbiterActionQueryConflict
Definition: iotypes.h:4556
@ ArbiterActionQueryArbitrate
Definition: iotypes.h:4557
@ ArbiterActionBootAllocation
Definition: iotypes.h:4559
@ ArbiterActionWriteReservedResources
Definition: iotypes.h:4555
@ ArbiterActionAddReserved
Definition: iotypes.h:4558
@ ArbiterActionCommitAllocation
Definition: iotypes.h:4552
@ ArbiterActionRollbackAllocation
Definition: iotypes.h:4553
@ ArbiterActionRetestAllocation
Definition: iotypes.h:4551
@ ArbiterActionQueryAllocatedResources
Definition: iotypes.h:4554
@ ArbiterActionTestAllocation
Definition: iotypes.h:4550

Referenced by PciArbiterConstructor().

◆ ArbiterLibInitializeInstance()

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 
)

Definition at line 69 of file arbiter.c.

76{
78
79 PAGED_CODE();
80
81 DPRINT("ArbiterLibInitializeInstance: '%S'\n", ArbiterName);
82
83 ASSERT(Arbiter->UnpackRequirement != NULL);
84 ASSERT(Arbiter->PackResource != NULL);
85 ASSERT(Arbiter->UnpackResource != NULL);
86 ASSERT(Arbiter->MutexEvent == NULL);
87 ASSERT(Arbiter->Allocation == NULL);
88 ASSERT(Arbiter->PossibleAllocation == NULL);
89 ASSERT(Arbiter->AllocationStack == NULL);
90
91 Arbiter->Signature = ARBITER_SIG;
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;
98#endif
99
100 /* The per-instance lock: a signaled synchronization event used as a mutex. */
101 Arbiter->MutexEvent = ExAllocatePoolWithTag(NonPagedPool, sizeof(KEVENT), TAG_ARBITER);
102 if (!Arbiter->MutexEvent)
103 {
105 goto Failure;
106 }
107 KeInitializeEvent(Arbiter->MutexEvent, SynchronizationEvent, TRUE);
108
109#if (NTDDI_VERSION >= NTDDI_VISTA)
110 /* Vista+: a notification event exposing whether a Test is outstanding. */
111 Arbiter->TransactionEvent = ExAllocatePoolWithTag(NonPagedPool, sizeof(KEVENT), TAG_ARBITER);
112 if (!Arbiter->TransactionEvent)
113 {
115 goto Failure;
116 }
117 KeInitializeEvent(Arbiter->TransactionEvent, NotificationEvent, TRUE);
118#endif
119
120 Arbiter->AllocationStack = ExAllocatePoolWithTag(PagedPool, PAGE_SIZE, TAG_ARBITER);
121 if (!Arbiter->AllocationStack)
122 {
124 goto Failure;
125 }
126 Arbiter->AllocationStackMaxSize = PAGE_SIZE;
127 Arbiter->Allocation = ExAllocatePoolWithTag(PagedPool, sizeof(RTL_RANGE_LIST), TAG_ARBITER);
128 if (!Arbiter->Allocation)
129 {
131 goto Failure;
132 }
133 RtlInitializeRangeList(Arbiter->Allocation);
134
135 Arbiter->PossibleAllocation = ExAllocatePoolWithTag(PagedPool, sizeof(RTL_RANGE_LIST), TAG_ARBITER);
136 if (!Arbiter->PossibleAllocation)
137 {
139 goto Failure;
140 }
141 RtlInitializeRangeList(Arbiter->PossibleAllocation);
142
143 if (!Arbiter->TestAllocation)
144 Arbiter->TestAllocation = ArbiterLibTestAllocation;
145 if (!Arbiter->RetestAllocation)
146 Arbiter->RetestAllocation = ArbiterLibRetestAllocation;
147 if (!Arbiter->CommitAllocation)
148 Arbiter->CommitAllocation = ArbiterLibCommitAllocation;
149 if (!Arbiter->RollbackAllocation)
150 Arbiter->RollbackAllocation = ArbiterLibRollbackAllocation;
151 if (!Arbiter->BootAllocation)
152 Arbiter->BootAllocation = ArbiterLibBootAllocation;
153 if (!Arbiter->AddReserved)
154 Arbiter->AddReserved = ArbiterLibAddReserved;
155 if (!Arbiter->QueryConflict)
156 Arbiter->QueryConflict = ArbiterLibQueryConflict;
157 if (!Arbiter->QueryArbitrate)
158 Arbiter->QueryArbitrate = ArbiterLibQueryArbitrate;
159 if (!Arbiter->StartArbiter)
160 Arbiter->StartArbiter = ArbiterLibStartArbiter;
161 if (!Arbiter->PreprocessEntry)
162 Arbiter->PreprocessEntry = ArbiterLibPreprocessEntry;
163 if (!Arbiter->AllocateEntry)
164 Arbiter->AllocateEntry = ArbiterLibAllocateEntry;
165 if (!Arbiter->GetNextAllocationRange)
166 Arbiter->GetNextAllocationRange = ArbiterLibGetNextAllocationRange;
167 if (!Arbiter->FindSuitableRange)
168 Arbiter->FindSuitableRange = ArbiterLibFindSuitableRange;
169 if (!Arbiter->AddAllocation)
170 Arbiter->AddAllocation = ArbiterLibAddAllocation;
171 if (!Arbiter->BacktrackAllocation)
172 Arbiter->BacktrackAllocation = ArbiterLibBacktrackAllocation;
173 if (!Arbiter->OverrideConflict)
174 Arbiter->OverrideConflict = ArbiterLibOverrideConflict;
175#if (NTDDI_VERSION >= NTDDI_VISTA)
176 if (!Arbiter->InitializeRangeList)
177 Arbiter->InitializeRangeList = ArbiterLibInitializeRangeList;
178#endif
179
180 Status = ArbiterLibDefaultAssignmentOrdering(Arbiter, OrderName, OrderName, TranslateOrderingFunction);
181 if (!NT_SUCCESS(Status))
182 {
183 DPRINT1("ArbiterLibInitializeInstance: ArbiterLibDefaultAssignmentOrdering failed, Status %X\n", Status);
184 goto Failure;
185 }
186
187 return STATUS_SUCCESS;
188
189Failure:
190 DPRINT1("ArbiterLibInitializeInstance: '%S' failed, Status %X\n", ArbiterName, Status);
192 return Status;
193}
VOID NTAPI ArbiterLibDeleteInstance(_In_ PARBITER_INSTANCE Arbiter)
Definition: arbiter.c:22
#define ARBITER_SIG
Definition: arbiter.c:17
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...
Definition: transaction.c:684
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...
Definition: range.c:562
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.
Definition: handler.c:440
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,...
Definition: entry.c:223
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,...
Definition: transaction.c:483
NTSTATUS NTAPI ArbiterLibTestAllocation(_In_ PARBITER_INSTANCE Arbiter, _Inout_ PARBITER_TEST_ALLOCATION_PARAMETERS Parameters)
The TestAllocation action: tentatively places every entry of the arbitration list,...
Definition: transaction.c:447
NTSTATUS NTAPI ArbiterLibAddReserved(_In_ PARBITER_INSTANCE Arbiter, _Inout_ PARBITER_ADD_RESERVED_PARAMETERS Parameters)
The AddReserved action default: nothing to reserve.
Definition: handler.c:112
VOID NTAPI ArbiterLibBacktrackAllocation(_In_ PARBITER_INSTANCE Arbiter, _Inout_ PARBITER_ALLOCATION_STATE ArbState)
Undoes the last AddAllocation performed for this entry.
Definition: range.c:866
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.
Definition: range.c:717
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.
Definition: handler.c:73
NTSTATUS NTAPI ArbiterLibCommitAllocation(_In_ PARBITER_INSTANCE Arbiter)
The CommitAllocation action: the tentative PossibleAllocation becomes the committed Allocation,...
Definition: transaction.c:515
NTSTATUS NTAPI ArbiterLibRollbackAllocation(_In_ PARBITER_INSTANCE Arbiter)
The RollbackAllocation action: discards the tentative allocation; the committed one is untouched.
Definition: transaction.c:543
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.
Definition: entry.c:38
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,...
Definition: handler.c:470
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.
Definition: ordering.c:571
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...
Definition: range.c:48
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...
Definition: range.c:828
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.
Definition: transaction.c:937
#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 ASSERT(a)
Definition: mode.c:44
@ NotificationEvent
@ SynchronizationEvent
#define DPRINT
Definition: sndvol32.h:73

Referenced by arbusno_Initializer(), ario_Initializer(), armem_Initializer(), IopArbBusNumberInitialize(), IopArbDmaInitialize(), IopArbIrqInitialize(), IopArbMemInitialize(), and IopArbPortInitialize().

◆ ArbiterLibInitializeRangeList()

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.

Parameters
[in]ArbiterThe arbiter instance the range list belongs to.
[in]ResourceCountThe number of descriptors in Resources.
[in]ResourcesThe CM partial resource descriptors describing the decoded windows.
[in,out]RangeListThe range list to rebuild from the descriptors.
Returns
Returns STATUS_SUCCESS.

Definition at line 440 of file handler.c.

445{
446 PAGED_CODE();
447 return ArbpSeedRangeList(Arbiter, ResourceCount, Resources, RangeList);
448}
static ULONG ResourceCount
Definition: inbv.c:50
static NTSTATUS ArbpSeedRangeList(_In_ PARBITER_INSTANCE Arbiter, _In_ ULONG ResourceCount, _In_ PCM_PARTIAL_RESOURCE_DESCRIPTOR Resources, _Inout_ PRTL_RANGE_LIST RangeList)
Definition: handler.c:319

Referenced by ArbiterLibInitializeInstance().

◆ ArbiterLibIsConflictWithMmConfigRange()

BOOLEAN NTAPI ArbiterLibIsConflictWithMmConfigRange ( _In_ ULONGLONG  Start,
_In_ ULONGLONG  End 
)

Determines whether a range overlaps the recorded MMCONFIG window.

Parameters
[in]StartThe inclusive start of the range to test.
[in]EndThe inclusive end of the range to test.
Returns
Returns TRUE if [Start, End] overlaps the recorded window, FALSE otherwise or when no window was ever recorded.

Definition at line 689 of file ordering.c.

692{
694 return FALSE; /* No MMCONFIG window recorded */
695
696 return (BOOLEAN)(Start <= ArbpMmConfigEnd && ArbpMmConfigStart <= End);
697}
static ULONGLONG ArbpMmConfigEnd
Definition: ordering.c:29
static ULONGLONG ArbpMmConfigStart
Definition: ordering.c:28

Referenced by ArbiterLibFindSuitableRange().

◆ ArbiterLibOverrideConflict()

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 window conflicts only with ranges the requesting device itself already owns.

Parameters
[in]ArbiterThe arbiter instance whose tentative allocation list is walked.
[in,out]ArbStateThe allocation state of the requirement. On a grant, Start and End receive the requested window.
Returns
Returns TRUE if at least one conflicting range was found and every one of them is owned by the requesting device, FALSE if any conflict belongs to someone else (or to no one).
Remarks
A fixed requirement has one possible placement, so when re-arbitration finds that window occupied by the device's own earlier reservation, there is nowhere else to move it and the self-conflict has to be allowed.

Definition at line 48 of file range.c.

51{
53 PRTL_RANGE Range;
54 BOOLEAN SelfConflictOnly = FALSE;
55
56 PAGED_CODE();
57
58 /*
59 * Only a fixed requirement may reclaim its window. Anything else still
60 * has other placements to try, and letting it overlap would hide
61 * real conflicts.
62 */
63 if (ArbState->CurrentAlternative == NULL ||
64 !(ArbState->CurrentAlternative->Flags & ARBITER_ALTERNATIVE_FLAG_FIXED))
65 {
66 return FALSE;
67 }
68
69 if (ArbState->Entry == NULL || ArbState->Entry->PhysicalDeviceObject == NULL)
70 return FALSE;
71
72 if (!NT_SUCCESS(RtlGetFirstRange(Arbiter->PossibleAllocation, &Iterator, &Range)))
73 return FALSE;
74
75 while (Range != NULL)
76 {
77 /* A range that overlaps the window and is not made available. */
78 if (Range->Start <= ArbState->CurrentMaximum &&
79 Range->End >= ArbState->CurrentMinimum &&
80 !(Range->Attributes & ArbState->RangeAvailableAttributes))
81 {
82 if ((PDEVICE_OBJECT)Range->Owner != ArbState->Entry->PhysicalDeviceObject)
83 return FALSE;
84
85 SelfConflictOnly = TRUE;
86 ArbState->Start = ArbState->CurrentMinimum;
87 ArbState->End = ArbState->CurrentMaximum;
88 }
89
90 if (!NT_SUCCESS(RtlGetNextRange(&Iterator, &Range, TRUE)))
91 break;
92 }
93
94 return SelfConflictOnly;
95}
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)
ULONGLONG End
Definition: rtltypes.h:1497
ULONGLONG Start
Definition: rtltypes.h:1496
UCHAR Attributes
Definition: rtltypes.h:1500
PVOID Owner
Definition: rtltypes.h:1499
_In_ WDFCHILDLIST _In_ PWDF_CHILD_LIST_ITERATOR Iterator
Definition: wdfchildlist.h:656

Referenced by ArbiterLibInitializeInstance().

◆ ArbiterLibPreprocessEntry()

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.

Parameters
[in]ArbiterThe arbiter instance placing the entry.
[in,out]ArbStateThe allocation state of the entry about to be placed.
Returns
Returns STATUS_SUCCESS.

Definition at line 38 of file entry.c.

41{
42 PAGED_CODE();
43
45 UNREFERENCED_PARAMETER(ArbState);
46 return STATUS_SUCCESS;
47}

Referenced by ArbiterLibInitializeInstance().

◆ ArbiterLibQueryArbitrate()

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.

Parameters
[in]ArbiterThe arbiter instance being queried.
[in,out]ParametersThe action parameters carrying the arbitration list (pre-Vista builds receive the list directly).
Returns
Returns STATUS_SUCCESS.

Definition at line 73 of file handler.c.

Referenced by ArbiterLibInitializeInstance().

◆ ArbiterLibQueryConflict()

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.

Parameters
[in]ArbiterThe arbiter instance performing the query.
[in,out]ParametersThe action parameters carrying the device, the candidate resource and the output slots (pre-Vista builds receive them directly).
Returns
Returns the ArbpQueryConflict status.

Definition at line 937 of file transaction.c.

940{
941 PAGED_CODE();
942 return ArbpQueryConflict(Arbiter,
943 Parameters->PhysicalDeviceObject,
944 Parameters->ConflictingResource,
945 Parameters->ConflictCount,
946 Parameters->Conflicts);
947}
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....
Definition: transaction.c:770

Referenced by ArbiterLibInitializeInstance().

◆ ArbiterLibReleaseResources()

VOID NTAPI ArbiterLibReleaseResources ( _In_ PARBITER_INSTANCE  Arbiter,
_In_ PVOID  Owner 
)

Releases every committed range owned by Owner.

Parameters
[in]ArbiterThe arbiter instance to release the ranges from.
[in]OwnerThe owning device object (a removed device's PDO).
Remarks
Without this a torn-down device's ranges stay reserved forever and later devices see phantom conflicts.

Definition at line 561 of file handler.c.

564{
565 PAGED_CODE();
566
567 ArbpAcquireLock(Arbiter);
568 RtlDeleteOwnersRanges(Arbiter->Allocation, Owner);
569 ArbpReleaseLock(Arbiter);
570}
NTSYSAPI NTSTATUS NTAPI RtlDeleteOwnersRanges(_Inout_ PRTL_RANGE_LIST RangeList, _In_ _Maybenull_ PVOID Owner)
_Out_writes_bytes_to_opt_ AbsoluteSecurityDescriptorSize PSECURITY_DESCRIPTOR _Inout_ PULONG _Out_writes_bytes_to_opt_ DaclSize PACL _Inout_ PULONG _Out_writes_bytes_to_opt_ SaclSize PACL _Inout_ PULONG _Out_writes_bytes_to_opt_ OwnerSize PSID Owner
Definition: rtlfuncs.h:1629

◆ ArbiterLibReserveRange()

VOID NTAPI ArbiterLibReserveRange ( _In_ PARBITER_INSTANCE  Arbiter,
_In_ ULONGLONG  Start,
_In_ ULONGLONG  End,
_In_opt_ PVOID  Owner,
_In_ BOOLEAN  Shared 
)

Commits a single [Start, End] range into the arbiter as an ordinary allocation owned by Owner.

Parameters
[in]ArbiterThe arbiter instance to reserve the range in.
[in]StartThe first address (or unit) of the range.
[in]EndThe last address (or unit) of the range, inclusive.
[in]OwnerThe owning device object, or NULL for a system reservation.
[in]SharedTRUE if the range may be shared with other shareable owners.
Remarks
Used to record resources assigned outside the PnP transaction (e.g. a legacy device's IoAssignResources), so later arbitration sees them. Unlike a boot reservation this carries no BOOT_ALLOCATED attribute, so it is not treated as reclaimable.

Definition at line 528 of file handler.c.

534{
535 PAGED_CODE();
536
537 ArbpAcquireLock(Arbiter);
538 RtlAddRange(Arbiter->Allocation, Start, End, 0,
540 NULL, Owner);
541 ArbpReleaseLock(Arbiter);
542}

◆ ArbiterLibRetestAllocation()

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, without searching.

Parameters
[in]ArbiterThe arbiter instance performing the retest.
[in,out]ParametersThe action parameters carrying the arbitration list (pre-Vista builds receive the list directly).
Returns
Returns the ArbpRetestAllocation status.

Definition at line 483 of file transaction.c.

486{
487 PAGED_CODE();
488 return ArbpRetestAllocation(Arbiter, Parameters->ArbitrationList);
489}
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...
Definition: transaction.c:330

Referenced by ArbiterLibInitializeInstance().

◆ ArbiterLibRollbackAllocation()

NTSTATUS NTAPI ArbiterLibRollbackAllocation ( _In_ PARBITER_INSTANCE  Arbiter)

The RollbackAllocation action: discards the tentative allocation; the committed one is untouched.

Parameters
[in]ArbiterThe arbiter instance whose transaction is rolled back.
Returns
Returns STATUS_SUCCESS.

Definition at line 543 of file transaction.c.

545{
546 PAGED_CODE();
547
548 RtlFreeRangeList(Arbiter->PossibleAllocation);
549 RtlInitializeRangeList(Arbiter->PossibleAllocation);
550 return STATUS_SUCCESS;
551}

Referenced by ArbiterLibInitializeInstance().

◆ ArbiterLibSortArbitrationList()

NTSTATUS NTAPI ArbiterLibSortArbitrationList ( _Inout_ PLIST_ENTRY  ArbitrationList)

Orders an arbitration list most-constrained first, so fixed requirements are placed before flexible ones can steal their ranges.

Parameters
[in,out]ArbitrationListThe list of ARBITER_LIST_ENTRY nodes to sort, keyed on the WorkSpace constrainedness score in ascending order. The sort is stable: equally scored entries keep their relative order.
Returns
Returns STATUS_SUCCESS.
Remarks
Without this ordering a wide requirement placed first keeps landing on the one range a later fixed requirement must have, forcing a backtrack for every such collision.

Definition at line 71 of file entry.c.

73{
74 LIST_ENTRY Sorted;
75
76 PAGED_CODE();
77
78 InitializeListHead(&Sorted);
79
80 while (!IsListEmpty(ArbitrationList))
81 {
82 PLIST_ENTRY ListEntry = RemoveHeadList(ArbitrationList);
85
86 for (Position = Sorted.Flink; Position != &Sorted; Position = Position->Flink)
87 {
89 Entry->WorkSpace)
90 {
91 break;
92 }
93 }
94
95 InsertTailList(Position, ListEntry); /* Insert before Position */
96 }
97
98 /* Return the data back to ArbitrationList! */
99 if (!IsListEmpty(&Sorted))
100 {
101 ArbitrationList->Flink = Sorted.Flink;
102 Sorted.Flink->Blink = ArbitrationList;
103 ArbitrationList->Blink = Sorted.Blink;
104 Sorted.Blink->Flink = ArbitrationList;
105 }
106
107 return STATUS_SUCCESS;
108}
#define InsertTailList(ListHead, Entry)
#define IsListEmpty(ListHead)
Definition: env_spec_w32.h:954
#define RemoveHeadList(ListHead)
Definition: env_spec_w32.h:964
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
Entry
Definition: section.c:5216
Definition: iotypes.h:4633
Definition: typedefs.h:120
struct _LIST_ENTRY * Blink
Definition: typedefs.h:122
struct _LIST_ENTRY * Flink
Definition: typedefs.h:121
static COORD Position
Definition: mouse.c:34
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260
_In_ ULONG _In_ ULONG _Out_ PULONG _In_ PVOID WorkSpace
Definition: rtlfuncs.h:2283

Referenced by ArbpTestAllocation().

◆ ArbiterLibStartArbiter()

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, so arbitration starts from the hardware's real extent.

Parameters
[in]ArbiterThe arbiter instance being started.
[in]StartResourcesThe bus's decoded resources; NULL or empty means nothing to seed.
Returns
Returns the range-list initialization status.

Definition at line 470 of file handler.c.

473{
475
476 PAGED_CODE();
477
478 if (StartResources == NULL || StartResources->Count == 0)
479 return STATUS_SUCCESS;
480
481 Full = &StartResources->List[0];
482
483#if (NTDDI_VERSION >= NTDDI_VISTA)
484 /* Vista+ routes through the slot, so an arbiter may override the seeding. */
485 return Arbiter->InitializeRangeList(Arbiter,
486 Full->PartialResourceList.Count,
487 Full->PartialResourceList.PartialDescriptors,
488 Arbiter->Allocation);
489#else
490 return ArbpSeedRangeList(Arbiter,
491 Full->PartialResourceList.Count,
492 Full->PartialResourceList.PartialDescriptors,
493 Arbiter->Allocation);
494#endif
495}
static BOOL Full
Definition: pageheap.c:12

Referenced by ArbiterLibInitializeInstance().

◆ ArbiterLibTestAllocation()

NTSTATUS NTAPI ArbiterLibTestAllocation ( _In_ PARBITER_INSTANCE  Arbiter,
_Inout_ PARBITER_TEST_ALLOCATION_PARAMETERS  Parameters 
)

The TestAllocation action: tentatively places every entry of the arbitration list, leaving the solution in PossibleAllocation for a later commit or rollback.

Parameters
[in]ArbiterThe arbiter instance performing the test.
[in,out]ParametersThe action parameters carrying the arbitration list (pre-Vista builds receive the list directly).
Returns
Returns the ArbpTestAllocation status.

Definition at line 447 of file transaction.c.

450{
451 PAGED_CODE();
452 return ArbpTestAllocation(Arbiter, Parameters->ArbitrationList);
453}
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....
Definition: transaction.c:227

Referenced by ArbiterLibInitializeInstance().