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)),
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) {
_In_ ULONG _In_ ULONG _In_ ULONG Length
HRESULT ValidateRegisterPhysicalAddressRange(__in PHYSICAL_ADDRESS PhysicalAddress, __in SIZE_T Size, __out FxRegisterResourceInfo **TableEntry)
_Must_inspect_result_ FxCollectionEntry * Start(VOID)
_Must_inspect_result_ _In_ WDFIORESLIST _In_ PIO_RESOURCE_DESCRIPTOR Descriptor
static NTSTATUS _CreateAndInit(_In_ PFX_DRIVER_GLOBALS DriverGlobals, _In_ ULONG Count, _Out_ FxRegisterResourceInfo **RegisterTable)
HRESULT ValidateRegisterSystemBaseAddress(__in PVOID Address, __out PVOID *UsermodeBaseAddress)
VOID DeletePortResourceTable(VOID)
#define CM_RESOURCE_MEMORY_LARGE_48
GLuint GLuint GLsizei count
IN PVOID IN PVOID IN USHORT IN USHORT Size
#define CmResourceTypeMemoryLarge
IWudfDeviceStack * deviceStack
#define CHECK(type, val, base, expected)
HRESULT ValidateAndClearMapping(__in PVOID Address, __in SIZE_T Length)
HRESULT ValidateRegisterSystemAddressRange(__in PVOID SystemAddress, __in SIZE_T Length, __out_opt PVOID *UsermodeAddress)
#define CmResourceTypePort
FxRegisterResourceInfo * m_RegisterResourceTable
FX_VERIFY_WITH_NAME(DRIVER(BadArgument, TODO), CHECK(ERROR_STRING_HW_ACCESS_NOT_ALLOWED,(pDevice->IsDirectHardwareAccessAllowed()==TRUE)), DriverGlobals->DriverName)
NTSTATUS BuildPortResourceTable(VOID)
#define STATUS_INVALID_DEVICE_STATE
__inline void UnlockResourceTable()
VOID DeleteRegisterResourceTable(VOID)
FxPortResourceInfo * m_PortResourceTable
BOOLEAN m_HasConnectionResources
_Must_inspect_result_ _In_ WDFDEVICE _In_ PHYSICAL_ADDRESS _In_ SIZE_T _In_ MEMORY_CACHING_TYPE _Out_ PVOID * PseudoBaseAddress
static const WCHAR desc[]
HRESULT ValidatePortAddressRange(__in PVOID Address, __in SIZE_T Length)
VOID SetPhysicalAddress(__in PHYSICAL_ADDRESS StartPa, __in SIZE_T Length)
GLenum GLuint GLenum GLsizei length
_Must_inspect_result_ _In_ PHYSICAL_ADDRESS _In_ PHYSICAL_ADDRESS _In_opt_ PHYSICAL_ADDRESS _In_ MEMORY_CACHING_TYPE CacheType
PCM_PARTIAL_RESOURCE_DESCRIPTOR GetDescriptor(__in ULONG Index)
VOID ValidateResourceUnmap(VOID)
Windows helper functions for integer overflow prevention.
static NTSTATUS _CreateAndInit(_In_ PFX_DRIVER_GLOBALS DriverGlobals, _In_ ULONG Count, _Out_ FxPortResourceInfo **PortTable)
ULONG m_PortResourceTableSizeCe
IWudfDeviceStack * GetDeviceStack(VOID)
NTSTATUS BuildRegisterResourceTable(VOID)
__inline void LockResourceTable()
#define NT_SUCCESS(StatCode)
SIZE_T GetResourceLength(__in PCM_PARTIAL_RESOURCE_DESCRIPTOR Descriptor, __out_opt PHYSICAL_ADDRESS *Start)
VOID UpdateRegisterResourceEntryLocked(__in FxRegisterResourceInfo *Entry, __in PVOID SystemMappedAddress, __in SIZE_T NumberOfBytes, __in PVOID UsermodeMappedAddress)
_Must_inspect_result_ typedef _In_ PHYSICAL_ADDRESS PhysicalAddress
#define CM_RESOURCE_MEMORY_LARGE_40
#define _Must_inspect_result_
CfxDevice * GetDevice(VOID)
#define TRACE_LEVEL_ERROR
__inline PFX_DRIVER_GLOBALS GetDriverGlobals(VOID)
_Must_inspect_result_ NTSTATUS CheckForConnectionResources(VOID)
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
DoTraceLevelMessage(pFxDriverGlobals, TRACE_LEVEL_VERBOSE, TRACINGPNP, "Enter, WDFDEVICE %p", Device)
_Must_inspect_result_ typedef _In_ PHYSICAL_ADDRESS _Inout_ PLARGE_INTEGER NumberOfBytes
HRESULT MapIoSpaceWorker(__in PHYSICAL_ADDRESS PhysicalAddress, __in SIZE_T NumberOfBytes, __in MEMORY_CACHING_TYPE CacheType, __deref_out VOID **PseudoBaseAddress)
_Must_inspect_result_ typedef _In_ ULONG TableEntry
ULONG m_RegisterResourceTableSizeCe
VOID SetPhysicalAddress(__in PHYSICAL_ADDRESS StartPa, __in SIZE_T Length)
VOID ClearRegisterResourceEntryLocked(__in FxRegisterResourceInfo *Entry)
#define CmResourceTypeMemory
enum _MEMORY_CACHING_TYPE MEMORY_CACHING_TYPE
PVOID GetPseudoAddressFromSystemAddress(__in PVOID SystemAddress)
static SERVICE_STATUS status
base of all file and directory entries
#define CM_RESOURCE_MEMORY_LARGE_64