26#include "FxSupportPch.hpp"
29#if defined(EVENT_TRACING)
32#include "FxResourceCollectionUm.tmh"
50 ULONG numRegisterDesc;
65 "Resource Descriptor not found %!STATUS!",
status);
75 if (numRegisterDesc == 0) {
92 "Failed to allocate memory for resource table"
107 "Resource Descriptor not found %!STATUS!",
status);
168 "Resource Descriptor not found %!STATUS!",
status);
177 if (numPortDesc == 0) {
194 "Failed to allocate memory for resource table"
209 "Resource Descriptor not found %!STATUS!",
status);
263 Entry->ClearMappedAddress();
300 ULONGLONG driverStartPa, driverEndPa, systemStartPa, systemEndPa;
316 hr = ULongLongAdd(driverStartPa,
Size, &tmp);
318 "when computing register address range",
SUCCEEDED(
hr)),
321 driverEndPa = tmp - 1;
336 systemStartPa =
entry->m_StartPa.QuadPart;
337 systemEndPa = systemStartPa +
entry->m_Length - 1;
339 if (driverStartPa >= systemStartPa &&
340 driverEndPa <= systemEndPa) {
343 "mapping of same resource, or multiple mapping in same resource"
459 *UsermodeBaseAddress =
entry->m_StartUsermodeVa;
512 start = SystemAddress;
520 "when computing register address range",
SUCCEEDED(
hr)),
533 end <= entry->m_EndSystemVa) {
628 PVOID usermodeAddress;
643 CHECK(
"Invalid physical address or number of bytes provided",
653 usermodeAddress =
NULL;
655 if(
GetDevice()->AreRegistersMappedToUsermode()) {
725 ULONGLONG driverStartPa, driverEndPa, systemStartPa, systemEndPa;
734 hr = ULongLongAdd(driverStartPa,
Length, &tmp);
736 "when computing port address range",
SUCCEEDED(
hr)),
739 driverEndPa = tmp - 1;
744 systemStartPa =
entry->m_StartPa.QuadPart;
745 systemEndPa =
entry->m_EndPa.QuadPart;
747 if (driverStartPa >= systemStartPa &&
748 driverEndPa <= systemEndPa) {
772 if (pDescriptor ==
NULL) {
775 "Resource Descriptor not found %!STATUS!",
status);
779 if (pDescriptor->
Type == CmResourceTypeConnection) {
HRESULT ValidatePortAddressRange(__in PVOID Address, __in SIZE_T Length)
VOID DeletePortResourceTable(VOID)
BOOLEAN m_HasConnectionResources
PCM_PARTIAL_RESOURCE_DESCRIPTOR GetDescriptor(__in ULONG Index)
VOID ValidateResourceUnmap(VOID)
FxRegisterResourceInfo * m_RegisterResourceTable
HRESULT ValidateAndClearMapping(__in PVOID Address, __in SIZE_T Length)
NTSTATUS BuildPortResourceTable(VOID)
HRESULT ValidateRegisterSystemBaseAddress(__in PVOID Address, __out PVOID *UsermodeBaseAddress)
SIZE_T GetResourceLength(__in PCM_PARTIAL_RESOURCE_DESCRIPTOR Descriptor, __out_opt PHYSICAL_ADDRESS *Start)
VOID DeleteRegisterResourceTable(VOID)
HRESULT ValidateRegisterPhysicalAddressRange(__in PHYSICAL_ADDRESS PhysicalAddress, __in SIZE_T Size, __out FxRegisterResourceInfo **TableEntry)
ULONG m_RegisterResourceTableSizeCe
FxPortResourceInfo * m_PortResourceTable
HRESULT ValidateRegisterSystemAddressRange(__in PVOID SystemAddress, __in SIZE_T Length, __out_opt PVOID *UsermodeAddress)
__inline void LockResourceTable()
_Must_inspect_result_ NTSTATUS CheckForConnectionResources(VOID)
ULONG m_PortResourceTableSizeCe
HRESULT MapIoSpaceWorker(__in PHYSICAL_ADDRESS PhysicalAddress, __in SIZE_T NumberOfBytes, __in MEMORY_CACHING_TYPE CacheType, __deref_out VOID **PseudoBaseAddress)
NTSTATUS BuildRegisterResourceTable(VOID)
VOID UpdateRegisterResourceEntryLocked(__in FxRegisterResourceInfo *Entry, __in PVOID SystemMappedAddress, __in SIZE_T NumberOfBytes, __in PVOID UsermodeMappedAddress)
VOID ClearRegisterResourceEntryLocked(__in FxRegisterResourceInfo *Entry)
__inline void UnlockResourceTable()
__inline PFX_DRIVER_GLOBALS GetDriverGlobals(VOID)
#define NT_SUCCESS(StatCode)
DoTraceLevelMessage(pFxDriverGlobals, TRACE_LEVEL_VERBOSE, TRACINGPNP, "Enter, WDFDEVICE %p", Device)
_Must_inspect_result_ _In_ WDFDEVICE _In_ PHYSICAL_ADDRESS _In_ SIZE_T _In_ MEMORY_CACHING_TYPE _Out_ PVOID * PseudoBaseAddress
IWudfDeviceStack * deviceStack
FX_VERIFY_WITH_NAME(DRIVER(BadArgument, TODO), CHECK(ERROR_STRING_HW_ACCESS_NOT_ALLOWED,(pDevice->IsDirectHardwareAccessAllowed()==TRUE)), DriverGlobals->DriverName)
GLuint GLuint GLsizei count
GLuint GLsizei GLsizei * length
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 const GLfloat const GLdouble const GLfloat GLint i
#define CmResourceTypeMemory
#define CmResourceTypePort
Windows helper functions for integer overflow prevention.
static const WCHAR desc[]
#define _Must_inspect_result_
_In_ ULONG _In_ ULONG _In_ ULONG Length
#define TRACE_LEVEL_ERROR
base of all file and directory entries
VOID SetPhysicalAddress(__in PHYSICAL_ADDRESS StartPa, __in SIZE_T Length)
static NTSTATUS _CreateAndInit(_In_ PFX_DRIVER_GLOBALS DriverGlobals, _In_ ULONG Count, _Out_ FxPortResourceInfo **PortTable)
static NTSTATUS _CreateAndInit(_In_ PFX_DRIVER_GLOBALS DriverGlobals, _In_ ULONG Count, _Out_ FxRegisterResourceInfo **RegisterTable)
VOID SetPhysicalAddress(__in PHYSICAL_ADDRESS StartPa, __in SIZE_T Length)
#define STATUS_INVALID_DEVICE_STATE
_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
#define CM_RESOURCE_MEMORY_LARGE_40
#define CM_RESOURCE_MEMORY_LARGE_64
#define CM_RESOURCE_MEMORY_LARGE_48
#define CmResourceTypeMemoryLarge
_Must_inspect_result_ typedef _In_ PHYSICAL_ADDRESS PhysicalAddress
_Must_inspect_result_ typedef _In_ ULONG TableEntry
_Must_inspect_result_ typedef _In_ PHYSICAL_ADDRESS _Inout_ PLARGE_INTEGER NumberOfBytes
_Must_inspect_result_ _In_ PHYSICAL_ADDRESS _In_ PHYSICAL_ADDRESS _In_opt_ PHYSICAL_ADDRESS _In_ MEMORY_CACHING_TYPE CacheType
enum _MEMORY_CACHING_TYPE MEMORY_CACHING_TYPE