17#define PCI_RBAR_SIZE_TO_LENGTH(Bit) (1ULL << ((Bit) + 20))
81 State->SizeMask[BarIndex])
86 State->SizeMask[BarIndex] = SizeMask;
89 DPRINT1(
"PCI: BAR %lu of %p is resizable, sizes 0x%08lx\n",
113 Limit->u.Memory.MinimumAddress.QuadPart,
114 Limit->u.Memory.MaximumAddress.QuadPart);
157 SizeMask =
PdoExtension->ResizableBarState.SizeMask[BarIndex];
163 if ((Largest <= Limit->
u.Memory.Length) ||
171 if ((Smallest >
Limit->u.Memory.Length) &&
172 (Smallest < Largest) &&
198 if (!Megabytes || (Megabytes & (Megabytes - 1)) || (
Length & 0xFFFFF))
201 if (!(
State->SizeMask[BarIndex] & Megabytes))
211 Control &= ~PCI_RBAR_CONTROL_SIZE_MASK;
215 DPRINT(
"PCI: BAR %lu of %p resized to %I64u MB\n", BarIndex,
PdoExtension, Megabytes);
252 if (!
PdoExtension->ResizableBarState.SizeMask[BarIndex])
ULONGLONG NTAPI RtlCmDecodeMemIoResource(_In_ PCM_PARTIAL_RESOURCE_DESCRIPTOR Descriptor, _Out_opt_ PULONGLONG Start)
#define NT_SUCCESS(StatCode)
VOID NTAPI PciWriteDeviceConfig(IN PPCI_PDO_EXTENSION DeviceExtension, IN PVOID Buffer, IN ULONG Offset, IN ULONG Length)
#define PCI_RBAR_CONTROL_SIZE_SHIFT
#define PCI_RBAR_CONTROL_SIZE_MASK
#define PCI_RBAR_CONTROL_BAR_INDEX_MASK
#define PCI_RBAR_ENTRY_CONTROL(n)
#define PCI_RBAR_CAPABILITY_SIZES_SHIFT
#define PCI_RBAR_ENTRY_CAPABILITY(n)
#define PCI_RBAR_CONTROL_COUNT_SHIFT
#define PCI_RBAR_MAX_ENTRIES
#define PCI_RBAR_CONTROL_COUNT_MASK
#define PCI_RBAR_EXTENDED_CAP_ID
VOID NTAPI PciReadDeviceConfig(IN PPCI_PDO_EXTENSION DeviceExtension, IN PVOID Buffer, IN ULONG Offset, IN ULONG Length)
ULONG NTAPI PciReadDeviceExtendedCapability(_In_ PPCI_PDO_EXTENSION DeviceExtension, _In_ ULONG CapabilityId, _Out_writes_bytes_(Length) PPCI_EXPRESS_ENHANCED_CAPABILITY_HEADER Buffer, _In_ ULONG Length)
Finds an extended capability and reads it into the caller's buffer.
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble * u
#define _Out_writes_opt_(s)
_In_ ULONG _In_ ULONG Offset
_In_ ULONG _In_ ULONG _In_ ULONG Length
static BOOLEAN NTAPI PciFillResizedBarRequirement(_Out_ PIO_RESOURCE_DESCRIPTOR Descriptor, _In_ PIO_RESOURCE_DESCRIPTOR Limit, _In_ ULONGLONG Length, _In_ UCHAR Option)
VOID NTAPI PciApplyResizableBarSizes(_In_ PPCI_PDO_EXTENSION PdoExtension)
Sets every resizable BAR to the length it was assigned. The memory decode has to be off,...
ULONG NTAPI PciAddResizableBarRequirements(_In_ PPCI_PDO_EXTENSION PdoExtension, _In_ ULONG BarIndex, _In_ PIO_RESOURCE_DESCRIPTOR Limit, _Out_writes_opt_(2) PIO_RESOURCE_DESCRIPTOR Descriptors)
Writes the requirements for the sizes a resizable BAR can grow to. They go ahead of the default requi...
VOID NTAPI PciGetResizableBarCapability(_Inout_ PPCI_PDO_EXTENSION PdoExtension)
Records which BARs of a new function can be resized and the sizes each of them supports.
static VOID NTAPI PciSelectResizableBarSize(_In_ PPCI_PDO_EXTENSION PdoExtension, _In_ ULONG BarIndex, _In_ ULONGLONG Length)
#define PCI_RBAR_SIZE_TO_LENGTH(Bit)
#define CmResourceTypeMemory
#define FIELD_OFFSET(t, f)
#define RtlCopyMemory(Destination, Source, Length)
#define RtlZeroMemory(Destination, Length)
_Must_inspect_result_ _In_ WDFIORESLIST _In_ PIO_RESOURCE_DESCRIPTOR Descriptor
_In_ WDF_WMI_PROVIDER_CONTROL Control
NTSYSAPI CCHAR WINAPI RtlFindMostSignificantBit(ULONGLONG)
NTSYSAPI CCHAR WINAPI RtlFindLeastSignificantBit(ULONGLONG)
@ CmResourceShareDeviceExclusive
#define CmResourceTypeMemoryLarge
#define IO_RESOURCE_ALTERNATIVE
#define PCI_ENABLE_MEMORY_SPACE
#define IO_RESOURCE_PREFERRED
_In_ LONG _In_ LONG Limit
NTSYSAPI NTSTATUS NTAPI RtlIoEncodeMemIoResource(_In_ struct _IO_RESOURCE_DESCRIPTOR *Descriptor, _In_ UCHAR Type, _In_ ULONGLONG Length, _In_ ULONGLONG Alignment, _In_ ULONGLONG MinimumAddress, _In_ ULONGLONG MaximumAddress)