ReactOS 0.4.15-dev-5666-gc548b97
FxCmResList Class Reference

#include <fxresource.hpp>

Inheritance diagram for FxCmResList:
Collaboration diagram for FxCmResList:

Public Member Functions

WDFCMRESLIST GetHandle (VOID)
 
_Must_inspect_result_ NTSTATUS BuildFromWdmList (__in PCM_RESOURCE_LIST ResourceList, __in UCHAR AccessFlags)
 
_Must_inspect_result_ PCM_RESOURCE_LIST CreateWdmList (__in __drv_strictTypeMatch(__drv_typeExpr) POOL_TYPE PoolType=PagedPool)
 
ULONG GetCount (VOID)
 
PCM_PARTIAL_RESOURCE_DESCRIPTOR GetDescriptor (__in ULONG Index)
 
__inline void LockResourceTable ()
 
__inline void UnlockResourceTable ()
 
NTSTATUS BuildRegisterResourceTable (VOID)
 
NTSTATUS BuildPortResourceTable (VOID)
 
VOID UpdateRegisterResourceEntryLocked (__in FxRegisterResourceInfo *Entry, __in PVOID SystemMappedAddress, __in SIZE_T NumberOfBytes, __in PVOID UsermodeMappedAddress)
 
VOID ClearRegisterResourceEntryLocked (__in FxRegisterResourceInfo *Entry)
 
HRESULT ValidateRegisterPhysicalAddressRange (__in PHYSICAL_ADDRESS PhysicalAddress, __in SIZE_T Size, __out FxRegisterResourceInfo **TableEntry)
 
HRESULT ValidateRegisterSystemBaseAddress (__in PVOID Address, __out PVOID *UsermodeBaseAddress)
 
HRESULT ValidateRegisterSystemAddressRange (__in PVOID SystemAddress, __in SIZE_T Length, __out_opt PVOID *UsermodeAddress)
 
HRESULT ValidateAndClearMapping (__in PVOID Address, __in SIZE_T Length)
 
HRESULT ValidatePortAddressRange (__in PVOID Address, __in SIZE_T Length)
 
SIZE_T GetResourceLength (__in PCM_PARTIAL_RESOURCE_DESCRIPTOR Descriptor, __out_opt PHYSICAL_ADDRESS *Start)
 
HRESULT MapIoSpaceWorker (__in PHYSICAL_ADDRESS PhysicalAddress, __in SIZE_T NumberOfBytes, __in MEMORY_CACHING_TYPE CacheType, __deref_out VOID **PseudoBaseAddress)
 
VOID ValidateResourceUnmap (VOID)
 
VOID DeleteRegisterResourceTable (VOID)
 
VOID DeletePortResourceTable (VOID)
 
_Must_inspect_result_ NTSTATUS CheckForConnectionResources (VOID)
 
BOOLEAN HasConnectionResources (VOID)
 
- Public Member Functions inherited from FxResourceCollection
BOOLEAN RemoveAndDelete (__in ULONG Index)
 
_Must_inspect_result_ NTSTATUS AddAt (__in ULONG Index, __in FxObject *Object)
 
BOOLEAN IsRemoveAllowed (VOID)
 
BOOLEAN IsAddAllowed (VOID)
 
VOID MarkChanged (VOID)
 
BOOLEAN IsChanged (VOID)
 
- Public Member Functions inherited from FxCollection
 FxCollection (__in PFX_DRIVER_GLOBALS FxDriverGlobals)
 
 ~FxCollection (VOID)
 
BOOLEAN Add (__in FxObject *Item)
 
VOID StealCollection (__in FxCollection *Collection)
 
- Public Member Functions inherited from FxNonPagedObject
 FxNonPagedObject (__in WDFTYPE Type, __in USHORT Size, __in PFX_DRIVER_GLOBALS FxDriverGlobals)
 
 FxNonPagedObject (__in WDFTYPE Type, __in USHORT Size, __in PFX_DRIVER_GLOBALS FxDriverGlobals, __in FxObjectType ObjectType)
 
virtual ~FxNonPagedObject (VOID)
 
 _Acquires_lock_ (this->m_NPLock.m_Lock) __drv_maxIRQL(DISPATCH_LEVEL) __drv_setsIRQL(DISPATCH_LEVEL) VOID Lock(__out __drv_deref(__drv_savesIRQL) PKIRQL PreviousIrql)
 
 _Releases_lock_ (this->m_NPLock.m_Lock) __drv_requiresIRQL(DISPATCH_LEVEL) __inline VOID Unlock(__in __drv_restoresIRQL KIRQL PreviousIrql)
 
 _Acquires_lock_ (this->m_NPLock.m_Lock) __drv_requiresIRQL(DISPATCH_LEVEL) VOID LockAtDispatch(VOID)
 
 _Requires_lock_held_ (this->m_NPLock.m_Lock) _Releases_lock_(this -> m_NPLock.m_Lock) __drv_requiresIRQL(DISPATCH_LEVEL) __inline VOID UnlockFromDispatch(VOID)
 
- Public Member Functions inherited from FxObject
PVOID GetCOMWrapper ()
 
void SetCOMWrapper (__drv_aliasesMem PVOID Wrapper)
 
 FxObject (__in WDFTYPE Type, __in USHORT Size, __in PFX_DRIVER_GLOBALS FxDriverGlobals)
 
virtual ~FxObject (VOID)
 
PVOID __inline operator new (__in size_t Size, __in PFX_DRIVER_GLOBALS FxDriverGlobals, __in FxObjectType Type)
 
PVOID __inline operator new (__in size_t Size, __in PFX_DRIVER_GLOBALS FxDriverGlobals, __in_opt PWDF_OBJECT_ATTRIBUTES Attributes, __in USHORT ExtraSize=0)
 
VOID operator delete (__in PVOID Memory)
 
VOID SetNoContextHeader (VOID)
 
PVOID __inline GetObjectHandle (VOID)
 
__inline FxContextHeaderGetContextHeader (VOID)
 
__inline PFX_DRIVER_GLOBALS GetDriverGlobals (VOID)
 
WDFTYPE GetType (VOID)
 
USHORT GetObjectSize (VOID)
 
LONG GetRefCnt (VOID)
 
FxTagTrackerGetTagTracker (VOID)
 
CfxDeviceGetDevice (VOID)
 
CfxDeviceBaseGetDeviceBase (VOID)
 
VOID SetDeviceBase (__in CfxDeviceBase *DeviceBase)
 
__inline VOID CallCleanup (VOID)
 
ULONG __inline AddRef (__in_opt PVOID Tag=NULL, __in LONG Line=0, __in_opt PSTR File=NULL)
 
virtual ULONG Release (__in_opt PVOID Tag=NULL, __in LONG Line=0, __in_opt PSTR File=NULL)
 
virtual ULONG AddRefOverride (__in WDFOBJECT_OFFSET Offset, __in_opt PVOID Tag=NULL, __in LONG Line=0, __in_opt PSTR File=NULL)
 
virtual ULONG ReleaseOverride (__in WDFOBJECT_OFFSET Offset, __in_opt PVOID Tag=NULL, __in LONG Line=0, __in_opt PSTR File=NULL)
 
virtual _Must_inspect_result_ NTSTATUS QueryInterface (__in FxQueryInterfaceParams *Params)
 
VOID MarkTraceState (VOID)
 
BOOLEAN __inline IsTraceState (VOID)
 
VOID __inline TraceDroppedEvent (__in FxObjectDroppedEvent Event)
 
VOID MarkPassiveDispose (__in FxObjectLockState State=ObjectLock)
 
VOID MarkPassiveCallbacks (__in FxObjectLockState State=ObjectLock)
 
VOID MarkForceDisposeThread (__in FxObjectLockState State=ObjectLock)
 
BOOLEAN IsPassiveCallbacks (__in BOOLEAN AcquireLock=TRUE)
 
BOOLEAN IsPassiveDispose (__in BOOLEAN AcquireLock=TRUE)
 
BOOLEAN IsForceDisposeThread (__in BOOLEAN AcquireLock=TRUE)
 
VOID MarkCommitted (VOID)
 
BOOLEAN IsCommitted (VOID)
 
VOID MarkDisposeOverride (__in FxObjectLockState State=ObjectLock)
 
VOID MarkNoDeleteDDI (__in FxObjectLockState State=ObjectLock)
 
BOOLEAN IsNoDeleteDDI (VOID)
 
_Must_inspect_result_ NTSTATUS Commit (__in_opt PWDF_OBJECT_ATTRIBUTES Attributes, __out_opt WDFOBJECT *ObjectHandle, __in_opt FxObject *Parent=NULL, __in BOOLEAN AssignDriverAsDefaultParent=TRUE)
 
VOID DeleteFromFailedCreate (VOID)
 
VOID ClearEvtCallbacks (VOID)
 
BOOLEAN EarlyDispose (VOID)
 
virtual VOID DeleteObject (VOID)
 
virtual BOOLEAN Dispose (VOID)
 
_Must_inspect_result_ NTSTATUS AssignParentObject (__in FxObject *ParentObject)
 
_Must_inspect_result_ NTSTATUS AddContext (__in FxContextHeader *Header, __in PVOID *Context, __in PWDF_OBJECT_ATTRIBUTES Attributes)
 
_Must_inspect_result_ NTSTATUS RemoveParentAssignment (VOID)
 
_Must_inspect_result_ FxObjectGetParentObjectReferenced (__in PVOID Tag)
 
BOOLEAN IsDisposed (VOID)
 
- Public Member Functions inherited from FxCollectionInternal
 FxCollectionInternal (VOID)
 
 ~FxCollectionInternal (VOID)
 
_Must_inspect_result_ FxCollectionEntryFindEntry (__in ULONG Index)
 
_Must_inspect_result_ FxCollectionEntryFindEntryByObject (__in FxObject *Object)
 
ULONG Count (VOID)
 
BOOLEAN Add (__in PFX_DRIVER_GLOBALS FxDriverGlobals, __in FxObject *Item)
 
_Must_inspect_result_ FxObjectGetItem (__in ULONG Index)
 
_Must_inspect_result_ FxObjectGetFirstItem (VOID)
 
_Must_inspect_result_ FxObjectGetLastItem (VOID)
 
NTSTATUS Remove (__in ULONG Index)
 
VOID CleanupEntry (__in FxCollectionEntry *Entry)
 
VOID CleanupEntryObject (__in FxObject *Object)
 
NTSTATUS RemoveEntry (__in FxCollectionEntry *Entry)
 
_Must_inspect_result_ NTSTATUS RemoveItem (__in FxObject *Item)
 
_Must_inspect_result_ FxCollectionEntryStart (VOID)
 
_Must_inspect_result_ FxCollectionEntryEnd (VOID)
 
VOID Clear (VOID)
 

Static Public Member Functions

static _Must_inspect_result_ NTSTATUS _CreateAndInit (__in FxCmResList **ResourceList, __in PFX_DRIVER_GLOBALS FxDriverGlobals, __in CfxDevice *Device, __in_opt PWDF_OBJECT_ATTRIBUTES ListAttributes, __in UCHAR AccessFlags)
 
- Static Public Member Functions inherited from FxObject
static FxObject_FromDisposeEntry (__in PSINGLE_LIST_ENTRY Entry)
 
static FxObject_GetObjectFromHandle (__in WDFOBJECT Handle, __inout PWDFOBJECT_OFFSET ObjectOffset)
 
static PVOID __inline _ToHandle (__in FxObject *Object)
 
static VOID __inline _ReferenceActual (__in WDFOBJECT Object, __in_opt PVOID Tag, __in LONG Line, __in PSTR File)
 
static VOID __inline _DereferenceActual (__in WDFOBJECT Object, __in_opt PVOID Tag, __in LONG Line, __in PSTR File)
 
static PVOID _GetDebugBase (__in FxObject *Object)
 
static PFX_POOL_HEADER _CleanupPointer (__in PFX_DRIVER_GLOBALS FxDriverGlobals, __in FxObject *Object)
 
static _Must_inspect_result_ NTSTATUS _GetEffectiveLock (__in FxObject *Object, __in_opt IFxHasCallbacks *Callbacks, __in BOOLEAN AutomaticLocking, __in BOOLEAN PassiveCallbacks, __out FxCallbackLock **CallbackLock, __out_opt FxObject **CallbackLockObject)
 
static _Must_inspect_result_ NTSTATUS _ObjectQuery (_In_ FxObject *Object, _In_ CONST GUID *Guid, _In_ ULONG QueryBufferLength, _Out_writes_bytes_(QueryBufferLength) PVOID QueryBuffer)
 

Protected Member Functions

 FxCmResList (__in PFX_DRIVER_GLOBALS FxDriverGlobals, __in UCHAR AccessFlags)
 
 ~FxCmResList ()
 
- Protected Member Functions inherited from FxResourceCollection
 FxResourceCollection (__in PFX_DRIVER_GLOBALS FxDriverGlobals, __in WDFTYPE Type, __in USHORT Size, __in UCHAR AccessFlags=FxResourceNoAccess)
 
- Protected Member Functions inherited from FxCollection
 FxCollection (__in PFX_DRIVER_GLOBALS FxDriverGlobals, __in WDFTYPE Type, __in USHORT Size)
 
- Protected Member Functions inherited from FxObject
 FxObject (__in WDFTYPE Type, __in USHORT Size, __in PFX_DRIVER_GLOBALS FxDriverGlobals, __in FxObjectType ObjectType)
 
FxObjectDebugExtensionGetDebugExtension (VOID)
 
BOOLEAN IsDebug (VOID)
 
VOID AllocateTagTracker (__in WDFTYPE Type)
 
virtual VOID SelfDestruct (VOID)
 
PVOID __inline GetObjectHandleUnchecked (VOID)
 
VOID __inline DestroyChildren (VOID)
 
VOID DeleteEarlyDisposedObject (VOID)
 
- Protected Member Functions inherited from FxCollectionInternal
_Must_inspect_result_ FxCollectionEntryAllocateEntry (__in PFX_DRIVER_GLOBALS FxDriverGlobals)
 
VOID AddEntry (__in FxCollectionEntry *Node, __in FxObject *Item)
 

Protected Attributes

FxRegisterResourceInfom_RegisterResourceTable
 
ULONG m_RegisterResourceTableSizeCe
 
FxPortResourceInfom_PortResourceTable
 
ULONG m_PortResourceTableSizeCe
 
BOOLEAN m_HasConnectionResources
 
MxLock m_ResourceTableLock
 
- Protected Attributes inherited from FxObject
union {
   CfxDeviceBase *   m_DeviceBase
 
   CfxDevice *   m_Device
 
}; 
 
- Protected Attributes inherited from FxCollectionInternal
ULONG m_Count
 
LIST_ENTRY m_ListHead
 

Additional Inherited Members

- Public Attributes inherited from FxResourceCollection
UCHAR m_AccessFlags
 
BOOLEAN m_Changed
 
- Static Protected Member Functions inherited from FxObject
static PVOID _GetBase (__in FxObject *Object)
 

Detailed Description

Definition at line 348 of file fxresource.hpp.

Constructor & Destructor Documentation

◆ FxCmResList()

FxCmResList::FxCmResList ( __in PFX_DRIVER_GLOBALS  FxDriverGlobals,
__in UCHAR  AccessFlags 
)
inlineprotected

Definition at line 377 of file fxresource.hpp.

380 : FxResourceCollection(FxDriverGlobals,
382 sizeof(FxCmResList),
383 AccessFlags)
384 {
385#if (FX_CORE_MODE==FX_CORE_USER_MODE)
391#endif // FX_CORE_USER_MODE
392 }
BOOLEAN m_HasConnectionResources
Definition: fxresource.hpp:367
FxRegisterResourceInfo * m_RegisterResourceTable
Definition: fxresource.hpp:355
ULONG m_RegisterResourceTableSizeCe
Definition: fxresource.hpp:356
FxPortResourceInfo * m_PortResourceTable
Definition: fxresource.hpp:361
ULONG m_PortResourceTableSizeCe
Definition: fxresource.hpp:362
#define NULL
Definition: types.h:112
#define FALSE
Definition: types.h:117
@ FX_TYPE_CM_RES_LIST
Definition: fxtypes.h:89

◆ ~FxCmResList()

FxCmResList::~FxCmResList ( )
protected

Definition at line 35 of file fxresourcecollectionkm.cpp.

36{
37}

Member Function Documentation

◆ _CreateAndInit()

static _Must_inspect_result_ NTSTATUS FxCmResList::_CreateAndInit ( __in FxCmResList **  ResourceList,
__in PFX_DRIVER_GLOBALS  FxDriverGlobals,
__in CfxDevice Device,
__in_opt PWDF_OBJECT_ATTRIBUTES  ListAttributes,
__in UCHAR  AccessFlags 
)
inlinestatic

Definition at line 400 of file fxresource.hpp.

407 {
408 NTSTATUS ntStatus;
409 FxCmResList *resList = NULL;
410
412
413 //
414 // Initialize
415 //
417
418 //
419 // Allocate a new resource list object
420 //
421 resList = new(FxDriverGlobals, ListAttributes)
422 FxCmResList(FxDriverGlobals, AccessFlags);
423
424 if (resList == NULL) {
425
427
428 DoTraceLevelMessage(FxDriverGlobals, TRACE_LEVEL_ERROR,
430 "Failed to allocate FxCmResList, "
431 "returning %!STATUS!",
432 ntStatus);
433 goto exit;
434 }
435
436 *ResourceList = resList;
437 ntStatus = STATUS_SUCCESS;
438
439 exit:
440 if (!NT_SUCCESS(ntStatus)) {
441 if (NULL != resList) {
442 resList->DeleteFromFailedCreate();
443 }
444 }
445 return ntStatus;
446 }
LONG NTSTATUS
Definition: precomp.h:26
VOID DeleteFromFailedCreate(VOID)
Definition: fxobject.cpp:391
#define TRACINGDEVICE
Definition: dbgtrace.h:58
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
DoTraceLevelMessage(pFxDriverGlobals, TRACE_LEVEL_VERBOSE, TRACINGPNP, "Enter, WDFDEVICE %p", Device)
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:317
#define exit(n)
Definition: config.h:202
#define STATUS_SUCCESS
Definition: shellext.h:65
#define TRACE_LEVEL_ERROR
Definition: storswtr.h:27
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
_Must_inspect_result_ _In_ WDFDEVICE Device
Definition: wdfchildlist.h:474
_Must_inspect_result_ _In_ WDFIORESREQLIST _In_opt_ PWDF_OBJECT_ATTRIBUTES _Out_ WDFIORESLIST * ResourceList
Definition: wdfresource.h:309

Referenced by FxPkgPnp::Initialize(), and FxPkgPdo::PnpQueryResources().

◆ BuildFromWdmList()

_Must_inspect_result_ NTSTATUS FxCmResList::BuildFromWdmList ( __in PCM_RESOURCE_LIST  ResourceList,
__in UCHAR  AccessFlags 
)

Definition at line 289 of file fxresourcecollection.cpp.

308{
310
311 //
312 // Predispose to success
313 //
315
316 Clear();
317
318 m_AccessFlags = AccessFlags;
319
320 if (WdmResourceList != NULL) {
322 ULONG count, i;
323
324 //
325 // We only expect to see one full resource descriptor.
326 //
327 ASSERT(WdmResourceList->Count == 1);
328
329 count = WdmResourceList->List[0].PartialResourceList.Count;
330 pDescriptor = WdmResourceList->List[0].PartialResourceList.PartialDescriptors;
331
332 for(i = 0; i < count; i++, pDescriptor++) {
333 FxResourceCm *pResource;
334
335 pResource = new(GetDriverGlobals())
336 FxResourceCm(GetDriverGlobals(), pDescriptor);
337
338 if (pResource == NULL) {
340 }
341
342 if (NT_SUCCESS(status)) {
343 status = pResource->AssignParentObject(this);
344
345 //
346 // Since we control our own lifetime here, the assign should
347 // always work.
348 //
350
352 }
353
354 if (!NT_SUCCESS(status)) {
355 Clear();
356 break;
357 }
358 }
359 }
360
361 return status;
362}
BOOLEAN Add(__in FxObject *Item)
_Must_inspect_result_ NTSTATUS AssignParentObject(__in FxObject *ParentObject)
Definition: fxobject.cpp:529
__inline PFX_DRIVER_GLOBALS GetDriverGlobals(VOID)
Definition: fxobject.hpp:734
GLuint GLuint GLsizei count
Definition: gl.h:1545
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
Definition: glfuncs.h:248
unsigned int ULONG
Definition: retypes.h:1
#define ASSERT(a)
Definition: mode.c:44
static void Clear(void)
Definition: treeview.c:386
Definition: ps.c:97

Referenced by FxPkgPnp::PnpMatchResources(), and FxPkgFdo::PnpSendStartDeviceDownTheStackOverload().

◆ BuildPortResourceTable()

NTSTATUS FxCmResList::BuildPortResourceTable ( VOID  )

Definition at line 146 of file fxresourcecollectionum.cpp.

149{
150 ULONG count;
151 ULONG i, index;
153 ULONG numPortDesc;
154 BOOLEAN locked = FALSE;
156
157 count = GetCount();
158 numPortDesc = 0;
159
160 //
161 // count number of register descriptors
162 //
163 for (i = 0; i < count; i++) {
165 if (desc == NULL) {
168 "Resource Descriptor not found %!STATUS!", status);
169 goto exit;
170 }
171
172 if (desc->Type == CmResourceTypePort) {
173 numPortDesc++;
174 }
175 }
176
177 if (numPortDesc == 0) {
178 return STATUS_SUCCESS;
179 }
180
181 //
182 // allocate table
183 //
185 locked = TRUE;
186
189 numPortDesc,
191 );
192 if (!NT_SUCCESS(status)) {
194 "Failed to allocate memory for resource table"
195 " %!STATUS!", status);
196 goto exit;
197 }
198 m_PortResourceTableSizeCe = numPortDesc;
199
200 //
201 // Populate table
202 //
203 index = 0;
204 for (i = 0; i < count; i++) {
206 if (desc == NULL) {
209 "Resource Descriptor not found %!STATUS!", status);
210 goto exit;
211 }
212
213 if (desc->Type == CmResourceTypePort) {
214 SIZE_T len;
216
217 //
218 // This will populate Length, StartPa and EndPa
219 //
221 if (len) {
223 }
224
225 index++;
226 }
227 }
228
229exit:
230
231 if (!NT_SUCCESS(status)) {
232 if (m_PortResourceTable != NULL) {
233 delete [] m_PortResourceTable;
236 }
237 }
238
239 if (locked) {
241 }
242
243 return status;
244}
unsigned char BOOLEAN
#define index(s, c)
Definition: various.h:29
PCM_PARTIAL_RESOURCE_DESCRIPTOR GetDescriptor(__in ULONG Index)
SIZE_T GetResourceLength(__in PCM_PARTIAL_RESOURCE_DESCRIPTOR Descriptor, __out_opt PHYSICAL_ADDRESS *Start)
__inline void LockResourceTable()
Definition: fxresource.hpp:487
__inline void UnlockResourceTable()
Definition: fxresource.hpp:500
#define TRACINGPNP
Definition: dbgtrace.h:67
#define TRUE
Definition: types.h:120
return pList GetCount()
GLuint index
Definition: glext.h:6031
GLenum GLsizei len
Definition: glext.h:6722
#define CmResourceTypePort
Definition: hwresource.cpp:123
static const WCHAR desc[]
Definition: protectdata.c:36
static int ** pa
Definition: server.c:126
VOID SetPhysicalAddress(__in PHYSICAL_ADDRESS StartPa, __in SIZE_T Length)
Definition: fxresource.hpp:205
static NTSTATUS _CreateAndInit(_In_ PFX_DRIVER_GLOBALS DriverGlobals, _In_ ULONG Count, _Out_ FxPortResourceInfo **PortTable)
Definition: fxresource.hpp:166
ULONG_PTR SIZE_T
Definition: typedefs.h:80
#define STATUS_INVALID_DEVICE_STATE
Definition: udferr_usr.h:178

Referenced by __drv_when().

◆ BuildRegisterResourceTable()

NTSTATUS FxCmResList::BuildRegisterResourceTable ( VOID  )

Definition at line 43 of file fxresourcecollectionum.cpp.

46{
48 ULONG i, index;
50 ULONG numRegisterDesc;
51 BOOLEAN locked = FALSE;
53
54 count = GetCount();
55 numRegisterDesc = 0;
56
57 //
58 // count number of register descriptors
59 //
60 for (i = 0; i < count; i++) {
62 if (desc == NULL) {
65 "Resource Descriptor not found %!STATUS!", status);
66 goto exit;
67 }
68
69 if (desc->Type == CmResourceTypeMemory ||
71 numRegisterDesc++;
72 }
73 }
74
75 if (numRegisterDesc == 0) {
76 return STATUS_SUCCESS;
77 }
78
79 //
80 // allocate table
81 //
83 locked = TRUE;
84
87 numRegisterDesc,
89 );
90 if (!NT_SUCCESS(status)) {
92 "Failed to allocate memory for resource table"
93 " %!STATUS!", status);
94 goto exit;
95 }
96 m_RegisterResourceTableSizeCe = numRegisterDesc;
97
98 //
99 // Populate table
100 //
101 index = 0;
102 for (i = 0; i < count; i++) {
104 if (desc == NULL) {
107 "Resource Descriptor not found %!STATUS!", status);
108 goto exit;
109 }
110
111 if (desc->Type == CmResourceTypeMemory ||
113 SIZE_T len;
115
116 //
117 // This will populate Length and StartPa
118 //
120 if (len) {
122 }
123
124 index++;
125 }
126 }
127
128exit:
129
130 if (!NT_SUCCESS(status)) {
132 delete [] m_RegisterResourceTable;
135 }
136 }
137
138 if (locked) {
140 }
141
142 return status;
143}
#define CmResourceTypeMemory
Definition: hwresource.cpp:125
static NTSTATUS _CreateAndInit(_In_ PFX_DRIVER_GLOBALS DriverGlobals, _In_ ULONG Count, _Out_ FxRegisterResourceInfo **RegisterTable)
Definition: fxresource.hpp:71
VOID SetPhysicalAddress(__in PHYSICAL_ADDRESS StartPa, __in SIZE_T Length)
Definition: fxresource.hpp:113
#define CmResourceTypeMemoryLarge
Definition: cmtypes.h:231

Referenced by __drv_when().

◆ CheckForConnectionResources()

_Must_inspect_result_ NTSTATUS FxCmResList::CheckForConnectionResources ( VOID  )

Definition at line 758 of file fxresourcecollectionum.cpp.

761{
763 ULONG i;
764 ULONG count;
766
768 count = GetCount();
769
770 for (i = 0; i < count; i++) {
771 pDescriptor = GetDescriptor(i);
772 if (pDescriptor == NULL) {
775 "Resource Descriptor not found %!STATUS!", status);
776 goto exit;
777 }
778
779 if (pDescriptor->Type == CmResourceTypeConnection) {
781 break;
782 }
783 }
784
785exit:
786 return status;
787}

Referenced by __drv_when().

◆ ClearRegisterResourceEntryLocked()

VOID FxCmResList::ClearRegisterResourceEntryLocked ( __in FxRegisterResourceInfo Entry)

Definition at line 259 of file fxresourcecollectionum.cpp.

262{
263 Entry->ClearMappedAddress();
264}
base of all file and directory entries
Definition: entries.h:83

Referenced by ValidateAndClearMapping().

◆ CreateWdmList()

_Must_inspect_result_ PCM_RESOURCE_LIST FxCmResList::CreateWdmList ( __in __drv_strictTypeMatch(__drv_typeExpr) POOL_TYPE  PoolType = PagedPool)

Definition at line 366 of file fxresourcecollection.cpp.

382{
383 PCM_RESOURCE_LIST pWdmResourceList;
384 ULONG size;
386
387 pWdmResourceList = NULL;
389
390 if (Count()) {
391 //
392 // NOTE: This function assumes all resources are on the same bus
393 // and therefore there is only one FULL_RESOURCE_DESCRIPTOR.
394 //
395 size = sizeof(CM_RESOURCE_LIST) +
396 (sizeof(CM_PARTIAL_RESOURCE_DESCRIPTOR) * (Count() - 1));
397
398 pWdmResourceList = (PCM_RESOURCE_LIST)
400
401 if (pWdmResourceList != NULL) {
404
405 RtlZeroMemory(pWdmResourceList, size);
406
407 pWdmResourceList->Count = 1; // We only return one full descriptor
408
409 pWdmResourceList->List[0].PartialResourceList.Version = 1;
410 pWdmResourceList->List[0].PartialResourceList.Revision = 1;
411 pWdmResourceList->List[0].PartialResourceList.Count = Count();
412
413 pDescriptor =
414 pWdmResourceList->List[0].PartialResourceList.PartialDescriptors;
415
416 end = End();
417 for (cur = Start(); cur != end; cur = cur->Next()) {
418 FxResourceCm *pResource;
419
420 pResource = (FxResourceCm*) cur->m_Object;
421
422 RtlCopyMemory(pDescriptor,
423 &pResource->m_Descriptor,
424 sizeof(pResource->m_Descriptor));
425 pDescriptor++;
426 }
427 }
428 }
429
430 return pWdmResourceList;
431}
FxObject * m_Object
FxCollectionEntry * Next(VOID)
CM_PARTIAL_RESOURCE_DESCRIPTOR m_Descriptor
Definition: fxresource.hpp:251
static __inline PVOID MxAllocatePoolWithTag(__in POOL_TYPE PoolType, __in SIZE_T NumberOfBytes, __in ULONG Tag)
Definition: mxmemorykm.h:30
PFX_DRIVER_GLOBALS pFxDriverGlobals
FxCollectionEntry * cur
GLuint GLuint end
Definition: gl.h:1545
GLsizeiptr size
Definition: glext.h:5919
struct _CM_RESOURCE_LIST CM_RESOURCE_LIST
struct _CM_RESOURCE_LIST * PCM_RESOURCE_LIST
int Count
Definition: noreturn.cpp:7
_Must_inspect_result_ FxCollectionEntry * End(VOID)
CM_PARTIAL_RESOURCE_LIST PartialResourceList
Definition: hwresource.cpp:160
CM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptors[1]
Definition: hwresource.cpp:119
CM_FULL_RESOURCE_DESCRIPTOR List[1]
Definition: hwresource.cpp:165
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
@ Start
Definition: partlist.h:33
_Must_inspect_result_ _In_ WDFDEVICE _In_ DEVICE_REGISTRY_PROPERTY _In_ _Strict_type_match_ POOL_TYPE PoolType
Definition: wdfdevice.h:3815

Referenced by FxPkgFdo::PnpSendStartDeviceDownTheStackOverload().

◆ DeletePortResourceTable()

VOID FxCmResList::DeletePortResourceTable ( VOID  )
inline

Definition at line 595 of file fxresource.hpp.

598 {
600 if (m_PortResourceTable != NULL) {
601 delete [] m_PortResourceTable;
604 }
606 }

Referenced by FxPkgPnp::PnpReleaseHardware().

◆ DeleteRegisterResourceTable()

VOID FxCmResList::DeleteRegisterResourceTable ( VOID  )
inline

Definition at line 581 of file fxresource.hpp.

Referenced by FxPkgPnp::PnpReleaseHardware().

◆ GetCount()

ULONG FxCmResList::GetCount ( VOID  )

Definition at line 434 of file fxresourcecollection.cpp.

437{
438 ULONG count;
439 KIRQL irql;
440
441 Lock(&irql);
442 count = Count();
443 Unlock(irql);
444
445 return count;
446}
KIRQL irql
Definition: wave.h:1
UCHAR KIRQL
Definition: env_spec_w32.h:591
@ Unlock
Definition: ntsecapi.h:294
_Must_inspect_result_ _In_opt_ PWDF_OBJECT_ATTRIBUTES _Out_ WDFWAITLOCK * Lock
Definition: wdfsync.h:127

◆ GetDescriptor()

PCM_PARTIAL_RESOURCE_DESCRIPTOR FxCmResList::GetDescriptor ( __in ULONG  Index)

Definition at line 449 of file fxresourcecollection.cpp.

452{
454 KIRQL irql;
455
456 Lock(&irql);
458 Unlock(irql);
459
460 if (pObject == NULL) {
461 return NULL;
462 }
463 else {
464 //
465 // Copy the current descriptor to the clone and return it
466 //
467 RtlCopyMemory(&pObject->m_DescriptorClone,
468 &pObject->m_Descriptor,
469 sizeof(pObject->m_Descriptor));
470
471 return &pObject->m_DescriptorClone;
472 }
473}
FxObject * pObject
_Must_inspect_result_ FxObject * GetItem(__in ULONG Index)
_In_ WDFCOLLECTION _In_ ULONG Index

Referenced by BuildPortResourceTable(), BuildRegisterResourceTable(), and CheckForConnectionResources().

◆ GetHandle()

WDFCMRESLIST FxCmResList::GetHandle ( VOID  )
inline

Definition at line 449 of file fxresource.hpp.

452 {
453 return (WDFCMRESLIST) GetObjectHandle();
454 }
return pObject GetObjectHandle()

Referenced by __drv_when(), FxPkgPnp::PnpReleaseHardware(), and FxPkgFdo::PnpSendStartDeviceDownTheStackOverload().

◆ GetResourceLength()

SIZE_T FxCmResList::GetResourceLength ( __in PCM_PARTIAL_RESOURCE_DESCRIPTOR  Descriptor,
__out_opt PHYSICAL_ADDRESS Start 
)

Definition at line 551 of file fxresourcecollectionum.cpp.

573{
575
576 length = 0;
577
580 (Descriptor->Type == CmResourceTypePort));
581
582 //
583 // If it is not large memory resource than length is in u.Memory.Length.
584 // For large memory resource, the length is given by different fields in
585 // CM_PARTIAL_RESOURCE_DESCRIPTOR structure.
586 //
587 if ((Descriptor->Type == CmResourceTypeMemory) ||
588 (Descriptor->Type == CmResourceTypePort)) {
589 length = Descriptor->u.Memory.Length;
590
591 } else if (Descriptor->Flags & CM_RESOURCE_MEMORY_LARGE_40) {
592 length = (((ULONGLONG)Descriptor->u.Memory40.Length40) << 8);
593
594 } else if (Descriptor->Flags & CM_RESOURCE_MEMORY_LARGE_48) {
595 length = (((ULONGLONG)Descriptor->u.Memory48.Length48) << 16);
596
597 } else if (Descriptor->Flags & CM_RESOURCE_MEMORY_LARGE_64) {
598 length = (((ULONGLONG)Descriptor->u.Memory64.Length64) << 32);
599
600 } else {
601 //
602 // It should not be possible to get here.
603 //
604 ASSERT(FALSE);
605 }
606
607 if (Start != NULL) {
608 *Start = Descriptor->u.Generic.Start;
609 }
610
611 //
612 // large memory descriptor is only supported on 64-bit so the casting
613 // below is ok.
614 //
615 return (SIZE_T) length;
616}
GLuint GLsizei GLsizei * length
Definition: glext.h:6040
uint64_t ULONGLONG
Definition: typedefs.h:67
_Must_inspect_result_ _In_ WDFIORESLIST _In_ PIO_RESOURCE_DESCRIPTOR Descriptor
Definition: wdfresource.h:342
#define CM_RESOURCE_MEMORY_LARGE_40
Definition: cmtypes.h:283
#define CM_RESOURCE_MEMORY_LARGE_64
Definition: cmtypes.h:285
#define CM_RESOURCE_MEMORY_LARGE_48
Definition: cmtypes.h:284

Referenced by BuildPortResourceTable(), and BuildRegisterResourceTable().

◆ HasConnectionResources()

BOOLEAN FxCmResList::HasConnectionResources ( VOID  )
inline

Definition at line 615 of file fxresource.hpp.

618 {
620 }

Referenced by FxDevice::IsInterruptAccessAllowed().

◆ LockResourceTable()

__inline void FxCmResList::LockResourceTable ( )
inline

◆ MapIoSpaceWorker()

HRESULT FxCmResList::MapIoSpaceWorker ( __in PHYSICAL_ADDRESS  PhysicalAddress,
__in SIZE_T  NumberOfBytes,
__in MEMORY_CACHING_TYPE  CacheType,
__deref_out VOID **  PseudoBaseAddress 
)

Definition at line 619 of file fxresourcecollectionum.cpp.

625{
626 IWudfDeviceStack *deviceStack;
628 PVOID usermodeAddress;
629 HRESULT hr;
630 FxRegisterResourceInfo* resEntry;
631
632 //
633 // check if this physical resource is among the assigned resources.
634 // If it is, retrieve the table entry corresponding to to register res.
635 //
637
640 &resEntry);
641
642 FX_VERIFY_WITH_NAME(DRIVER(BadArgument, TODO),
643 CHECK("Invalid physical address or number of bytes provided",
644 (SUCCEEDED(hr))), GetDriverGlobals()->Public.DriverName);
645
647
648 //
649 // Call host
650 //
651 deviceStack = GetDevice()->GetDeviceStack();
653 usermodeAddress = NULL;
654
655 if(GetDevice()->AreRegistersMappedToUsermode()) {
656 hr = deviceStack->MapIoSpace(PhysicalAddress,
658 CacheType,
660 &usermodeAddress);
661 }
662 else {
663 hr = deviceStack->MapIoSpace(PhysicalAddress,
665 CacheType,
667 NULL);
668 }
669
670 if (SUCCEEDED(hr)) {
671 //
672 // update the mapped resource list entry and add it to list
673 //
677 usermodeAddress);
678
679 //
680 // Convert system address to pseudo (opaque) base address
681 //
682 *PseudoBaseAddress = GetDevice()->GetPseudoAddressFromSystemAddress(
684 );
685 }
686
688
689 return hr;
690}
#define TODO
Definition: SAX2.c:44
HRESULT ValidateRegisterPhysicalAddressRange(__in PHYSICAL_ADDRESS PhysicalAddress, __in SIZE_T Size, __out FxRegisterResourceInfo **TableEntry)
VOID UpdateRegisterResourceEntryLocked(__in FxRegisterResourceInfo *Entry, __in PVOID SystemMappedAddress, __in SIZE_T NumberOfBytes, __in PVOID UsermodeMappedAddress)
return pList GetDevice()
_Must_inspect_result_ _In_ WDFDEVICE _In_ PHYSICAL_ADDRESS _In_ SIZE_T _In_ MEMORY_CACHING_TYPE _Out_ PVOID * PseudoBaseAddress
IWudfDeviceStack * deviceStack
PVOID systemAddress
FX_VERIFY_WITH_NAME(DRIVER(BadArgument, TODO), CHECK(ERROR_STRING_HW_ACCESS_NOT_ALLOWED,(pDevice->IsDirectHardwareAccessAllowed()==TRUE)), DriverGlobals->DriverName)
#define SUCCEEDED(hr)
Definition: intsafe.h:50
#define CHECK(type, val, base, expected)
HRESULT hr
Definition: shlfolder.c:183
_Must_inspect_result_ typedef _In_ PHYSICAL_ADDRESS PhysicalAddress
Definition: iotypes.h:1098
_Must_inspect_result_ typedef _In_ PHYSICAL_ADDRESS _Inout_ PLARGE_INTEGER NumberOfBytes
Definition: iotypes.h:1036
_Must_inspect_result_ _In_ PHYSICAL_ADDRESS _In_ PHYSICAL_ADDRESS _In_opt_ PHYSICAL_ADDRESS _In_ MEMORY_CACHING_TYPE CacheType
Definition: mmfuncs.h:217

◆ UnlockResourceTable()

◆ UpdateRegisterResourceEntryLocked()

VOID FxCmResList::UpdateRegisterResourceEntryLocked ( __in FxRegisterResourceInfo Entry,
__in PVOID  SystemMappedAddress,
__in SIZE_T  NumberOfBytes,
__in PVOID  UsermodeMappedAddress 
)

Definition at line 248 of file fxresourcecollectionum.cpp.

254{
255 Entry->SetMappedAddress(SystemMappedAddress, NumberOfBytes, UsermodeMappedAddress);
256}

Referenced by MapIoSpaceWorker().

◆ ValidateAndClearMapping()

HRESULT FxCmResList::ValidateAndClearMapping ( __in PVOID  Address,
__in SIZE_T  Length 
)

Definition at line 363 of file fxresourcecollectionum.cpp.

389{
391 ULONG i;
393
395
396 for (i = 0; i < m_RegisterResourceTableSizeCe; i++) {
398
399 if (NULL != entry->m_StartSystemVa &&
400 Address == entry->m_StartSystemVa &&
401 Length == entry->m_MappedLength) {
402 //
403 // there is a valid mapping. clear it.
404 //
405 FX_VERIFY_WITH_NAME(INTERNAL, CHECK_NOT_NULL(entry->m_EndSystemVa),
406 GetDriverGlobals()->Public.DriverName);
407
409
410 hr = S_OK;
411 break;
412 }
413 }
414
416
417 return hr;
418}
VOID ClearRegisterResourceEntryLocked(__in FxRegisterResourceInfo *Entry)
#define E_INVALIDARG
Definition: ddrawi.h:101
#define S_OK
Definition: intsafe.h:52
uint32_t entry
Definition: isohybrid.c:63
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:102
static WCHAR Address[46]
Definition: ping.c:68

◆ ValidatePortAddressRange()

HRESULT FxCmResList::ValidatePortAddressRange ( __in PVOID  Address,
__in SIZE_T  Length 
)

Definition at line 718 of file fxresourcecollectionum.cpp.

722{
723 ULONG i;
724 HRESULT hr;
725 ULONGLONG driverStartPa, driverEndPa, systemStartPa, systemEndPa;
726 ULONGLONG tmp;
728
729 driverStartPa = (ULONGLONG)Address;
730
731 //
732 // driverEndPa = driverStartPa + Length - 1;
733 //
734 hr = ULongLongAdd(driverStartPa, Length, &tmp);
735 FX_VERIFY_WITH_NAME(DRIVER(BadArgument, TODO), CHECK("Integer overflow occurred"
736 "when computing port address range", SUCCEEDED(hr)),
737 GetDriverGlobals()->Public.DriverName);
738
739 driverEndPa = tmp - 1;
740
741 for (i = 0; i < m_PortResourceTableSizeCe; i++) {
743
744 systemStartPa = entry->m_StartPa.QuadPart;
745 systemEndPa = entry->m_EndPa.QuadPart;
746
747 if (driverStartPa >= systemStartPa &&
748 driverEndPa <= systemEndPa) {
749 return S_OK;
750 }
751 }
752
753 return E_INVALIDARG;
754}

◆ ValidateRegisterPhysicalAddressRange()

HRESULT FxCmResList::ValidateRegisterPhysicalAddressRange ( __in PHYSICAL_ADDRESS  PhysicalAddress,
__in SIZE_T  Size,
__out FxRegisterResourceInfo **  TableEntry 
)

Definition at line 267 of file fxresourcecollectionum.cpp.

297{
298 ULONG i;
299 HRESULT hr;
300 ULONGLONG driverStartPa, driverEndPa, systemStartPa, systemEndPa;
301 ULONGLONG tmp;
303
304 *TableEntry = NULL;
305
306 //
307 // Physical address is of LONGLONG type (signed) we need to cast it to
308 // ULONGLONG for comparision because in a LONGLONG comprison, the
309 // result is different when highest bit is set vs when it is not set.
310 //
311 driverStartPa = PhysicalAddress.QuadPart;
312
313 //
314 // driverEndPa = driverStartPa + Size - 1;
315 //
316 hr = ULongLongAdd(driverStartPa, Size, &tmp);
317 FX_VERIFY_WITH_NAME(DRIVER(BadArgument, TODO), CHECK("Integer overflow occurred"
318 "when computing register address range", SUCCEEDED(hr)),
319 GetDriverGlobals()->Public.DriverName);
320
321 driverEndPa = tmp - 1;
322
323 //
324 // We allow one physical address range mapping only. The base address and
325 // length can be flexible within the assigned range.
326 //
327 for (i = 0; i < m_RegisterResourceTableSizeCe; i++) {
329
330 //
331 // No need to do int overflow safe additon here since start address and
332 // length are assigned by pnp manager. Note that we don't store endPa in
333 // resource table the way we do for SystemVa is because endPa is not
334 // needed in hot path so can be computed using length.
335 //
336 systemStartPa = entry->m_StartPa.QuadPart;
337 systemEndPa = systemStartPa + entry->m_Length - 1;
338
339 if (driverStartPa >= systemStartPa &&
340 driverEndPa <= systemEndPa) {
341
342 FX_VERIFY_WITH_NAME(DRIVER(BadArgument, TODO), CHECK("Attempt to do multiple "
343 "mapping of same resource, or multiple mapping in same resource"
344 " range",
345 (entry->m_StartSystemVa == NULL)), GetDriverGlobals()->Public.DriverName);
346 FX_VERIFY_WITH_NAME(INTERNAL, CHECK_NULL(entry->m_EndSystemVa),
347 GetDriverGlobals()->Public.DriverName);
348 FX_VERIFY_WITH_NAME(INTERNAL, CHECK_NULL(entry->m_StartUsermodeVa),
349 GetDriverGlobals()->Public.DriverName);
350 FX_VERIFY_WITH_NAME(INTERNAL, CHECK("Mapped length not zero",
351 (entry->m_MappedLength == 0)), GetDriverGlobals()->Public.DriverName);
352
353 *TableEntry = entry;
354
355 return S_OK;
356 }
357 }
358
359 return E_INVALIDARG;
360}
LONGLONG QuadPart
Definition: typedefs.h:114
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
Definition: wdfdevice.h:4533
_Must_inspect_result_ typedef _In_ ULONG TableEntry
Definition: iotypes.h:4303

Referenced by MapIoSpaceWorker().

◆ ValidateRegisterSystemAddressRange()

HRESULT FxCmResList::ValidateRegisterSystemAddressRange ( __in PVOID  SystemAddress,
__in SIZE_T  Length,
__out_opt PVOID UsermodeAddress 
)

Definition at line 471 of file fxresourcecollectionum.cpp.

500{
503 SIZE_T offset = 0;
504 ULONG i;
505 PVOID start = NULL;
506 PVOID end = NULL;
507 ULONG_PTR tmp;
508
509 //
510 // compute system address range to look for
511 //
512 start = SystemAddress;
513
514 //
515 // Use interger overflow safe functions
516 // end = ((PUCHAR)SystemAddress) + Length - 1;
517 //
518 hr = ULongPtrAdd((ULONG_PTR) start, Length, &tmp);
519 FX_VERIFY_WITH_NAME(DRIVER(BadArgument, TODO), CHECK("Integer overflow occurred"
520 "when computing register address range", SUCCEEDED(hr)),
521 GetDriverGlobals()->Public.DriverName);
522
523 end = (PVOID)(tmp - 1);
524
525 //
526 // check if range is in the register resource table
527 //
529 for (i = 0; i < m_RegisterResourceTableSizeCe; i++) {
531
532 if (start >= entry->m_StartSystemVa &&
533 end <= entry->m_EndSystemVa) {
534 hr = S_OK;
535 break;
536 }
537 }
538
539 //
540 // compute the corresponding usermode address
541 //
542 if (SUCCEEDED(hr) && UsermodeAddress != NULL) {
543 offset = ((PUCHAR)SystemAddress) - ((PUCHAR)entry->m_StartSystemVa);
544 *UsermodeAddress = ((PUCHAR)entry->m_StartUsermodeVa) + offset;
545 }
546
547 return hr;
548}
GLuint start
Definition: gl.h:1545
GLintptr offset
Definition: glext.h:5920
void * PVOID
Definition: retypes.h:9
unsigned char * PUCHAR
Definition: retypes.h:3
uint32_t ULONG_PTR
Definition: typedefs.h:65

Referenced by if(), and LockResourceTable().

◆ ValidateRegisterSystemBaseAddress()

HRESULT FxCmResList::ValidateRegisterSystemBaseAddress ( __in PVOID  Address,
__out PVOID UsermodeBaseAddress 
)

Definition at line 421 of file fxresourcecollectionum.cpp.

446{
447 ULONG i;
449
451 for (i = 0; i < m_RegisterResourceTableSizeCe; i++) {
453
454 if (Address == entry->m_StartSystemVa) {
455
456 FX_VERIFY_WITH_NAME(INTERNAL, CHECK_NOT_NULL(entry->m_StartUsermodeVa),
457 GetDriverGlobals()->Public.DriverName);
458
459 *UsermodeBaseAddress = entry->m_StartUsermodeVa;
460
462 return S_OK;
463 }
464 }
465
467 return E_INVALIDARG;
468}

◆ ValidateResourceUnmap()

VOID FxCmResList::ValidateResourceUnmap ( VOID  )

Definition at line 693 of file fxresourcecollectionum.cpp.

696{
697 ULONG i;
699
700 //
701 // make sure driver has unmapped its resources. No need to
702 // acquire the resource validation table lock as this is called in
703 // ReleaseHardware pnp callback and cannot race with another framework
704 // pnp callback that updates this table (PrepareHardware) so no invalid
705 // access. If a driver thread unmaps after ReleaseHardware return then also
706 // it will be a valid access of table entry.
707 //
708
709 for (i = 0; i < m_RegisterResourceTableSizeCe; i++) {
711
712 FX_VERIFY_WITH_NAME(DRIVER(BadArgument, TODO), CHECK("Driver did not unmap its "
713 "register resources", (entry->m_StartSystemVa == NULL)), GetDriverGlobals()->Public.DriverName);
714 }
715}

Referenced by FxPkgPnp::PnpReleaseHardware().

Member Data Documentation

◆ m_HasConnectionResources

BOOLEAN FxCmResList::m_HasConnectionResources
protected

◆ m_PortResourceTable

FxPortResourceInfo* FxCmResList::m_PortResourceTable
protected

◆ m_PortResourceTableSizeCe

ULONG FxCmResList::m_PortResourceTableSizeCe
protected

◆ m_RegisterResourceTable

◆ m_RegisterResourceTableSizeCe

◆ m_ResourceTableLock

MxLock FxCmResList::m_ResourceTableLock
protected

Definition at line 372 of file fxresource.hpp.

Referenced by LockResourceTable(), and UnlockResourceTable().


The documentation for this class was generated from the following files: