33#define MEMORY_24_BIT_MAX_ADDRESS 0xFFFFFF
150 if (*OutAlignment == 0)
193 CmDescriptor->Type = IoDescriptor->Type;
194 CmDescriptor->Flags = IoDescriptor->Flags;
195 CmDescriptor->ShareDisposition = IoDescriptor->ShareDisposition;
197 CmDescriptor->u.Generic.Start.QuadPart =
Start;
198 CmDescriptor->u.Generic.Length = IoDescriptor->u.Generic.Length;
264 UINT64 Minimum, Maximum, AlignedMinimum;
276 if (AlignedMinimum < Minimum || AlignedMinimum > Maximum)
280 Span = Maximum - AlignedMinimum;
326 *OutIoDescriptor = *IoDescriptor;
328 SourceType = IoDescriptor->Type;
336 MinimumType = SourceType;
340 IoDescriptor->u.Generic.MinimumAddress,
341 &OutIoDescriptor->u.Generic.MinimumAddress,
344 IoDescriptor->u.Generic.MaximumAddress,
345 &OutIoDescriptor->u.Generic.MaximumAddress,
443 DPRINT1(
"IopArbMemInitialize: Reserving page 0 failed with %X\n",
Status);
static _Out_opt_ PULONGLONG _Out_opt_ PULONGLONG MinimumAddress
static _Out_opt_ PULONGLONG Start
static _Out_opt_ PULONGLONG _Out_opt_ PULONGLONG _Out_opt_ PULONGLONG MaximumAddress
COMPILER_DEPENDENT_UINT64 UINT64
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)
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.
#define ARBITER_RANGE_BOOT_ALLOCATED
static NTSTATUS IopArbMemTranslateAddress(_In_ UCHAR SourceType, _In_ PHYSICAL_ADDRESS SourceAddress, _Out_ PPHYSICAL_ADDRESS TranslatedAddress, _Out_ PUCHAR TranslatedType)
Translates one bus-relative address to a system-physical one on the ISA bus, and reports the space it...
#define MEMORY_24_BIT_MAX_ADDRESS
static NTSTATUS NTAPI IopArbMemPackResource(_In_ PIO_RESOURCE_DESCRIPTOR IoDescriptor, _In_ UINT64 Start, _Out_ PCM_PARTIAL_RESOURCE_DESCRIPTOR CmDescriptor)
Materialises the arbiter's chosen placement as an assigned CM descriptor. The PackResource callback o...
static NTSTATUS NTAPI IopArbMemTranslateOrdering(_Out_ PIO_RESOURCE_DESCRIPTOR OutIoDescriptor, _In_ PIO_RESOURCE_DESCRIPTOR IoDescriptor)
Translates one registry allocation-ordering window from the bus-relative addresses it is written in i...
ULONGLONG NTAPI RtlIoDecodeMemIoResource(_In_ PIO_RESOURCE_DESCRIPTOR Descriptor, _Out_opt_ PULONGLONG Alignment, _Out_opt_ PULONGLONG MinimumAddress, _Out_opt_ PULONGLONG MaximumAddress)
static NTSTATUS NTAPI IopArbMemUnpackRequirements(_In_ PIO_RESOURCE_DESCRIPTOR IoDescriptor, _Out_ PUINT64 OutMinimumAddress, _Out_ PUINT64 OutMaximumAddress, _Out_ PUINT64 OutLength, _Out_ PUINT64 OutAlignment)
Extracts the placement window from one memory requirement. The UnpackRequirement callback of the Root...
ULONGLONG NTAPI RtlCmDecodeMemIoResource(_In_ PCM_PARTIAL_RESOURCE_DESCRIPTOR Descriptor, _Out_opt_ PULONGLONG Start)
ARBITER_INSTANCE IopRootMemArbiter
static NTSTATUS NTAPI IopArbMemUnpackResource(_In_ PCM_PARTIAL_RESOURCE_DESCRIPTOR CmDescriptor, _Out_ PUINT64 Start, _Out_ PUINT64 OutLength)
Reads the placement back out of an already-assigned descriptor (a firmware boot configuration,...
static BOOLEAN NTAPI IopArbMemFindSuitableRange(_In_ PARBITER_INSTANCE Arbiter, _Inout_ PARBITER_ALLOCATION_STATE ArbState)
The Root Memory arbiter's FindSuitableRange: the engine search, incremented for a device asking to ke...
static INT32 NTAPI IopArbMemScoreRequirement(_In_ PIO_RESOURCE_DESCRIPTOR IoDescriptor)
Scores how constrained a requirement is: the number of distinct aligned addresses it could be placed ...
NTSTATUS NTAPI IopArbMemInitialize(VOID)
Initialize the RootMemoryArbiter.
unsigned __int64 * PUINT64
#define NT_SUCCESS(StatCode)
union Alignment_ Alignment
BOOLEAN NTAPI HalTranslateBusAddress(IN INTERFACE_TYPE InterfaceType, IN ULONG BusNumber, IN PHYSICAL_ADDRESS BusAddress, IN OUT PULONG AddressSpace, OUT PPHYSICAL_ADDRESS TranslatedAddress)
#define CM_RESOURCE_MEMORY_24
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)
__GNU_EXTENSION typedef unsigned __int64 * PULONGLONG
_In_ ULONG _In_ ULONG _In_ ULONG Length
#define CmResourceTypeNull
#define CmResourceTypeMemory
#define CmResourceTypePort
PARB_UNPACK_RESOURCE UnpackResource
PARB_SCORE_REQUIREMENT ScoreRequirement
PRTL_RANGE_LIST Allocation
PARB_UNPACK_REQUIREMENT UnpackRequirement
PARB_FIND_SUITABLE_RANGE FindSuitableRange
PARB_PACK_RESOURCE PackResource
#define STATUS_INVALID_PARAMETER
#define STATUS_UNSUCCESSFUL
_Must_inspect_result_ _In_ WDFIORESLIST _In_ PIO_RESOURCE_DESCRIPTOR Descriptor
#define CmResourceTypeMemoryLarge
_In_ ULONG _In_ PHYSICAL_ADDRESS _Inout_ PULONG _Out_ PPHYSICAL_ADDRESS TranslatedAddress
_In_ ULONG _In_ PHYSICAL_ADDRESS _Inout_ PULONG AddressSpace
#define ARBITER_FLAG_BOOT_CONFIG
_Must_inspect_result_ typedef _In_ PHYSICAL_ADDRESS SourceAddress