Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

assign.c File Reference

#include "iop.h"

Go to the source code of this file.

Classes

struct  POWNER
struct  TENTRY
struct  _LTENTRY
struct  TENTRIESBYTYPE
struct  IO_TRACK_CONFLICT
struct  DIR_REQUIRED_RESOURCE
struct  _DIR_RESOURCE_LIST
struct  _DIR_RESREQ_LIST
struct  USED_HEAP

Defines

#define IDBG   DBG
#define PAGED   1
#define INLINE   __inline
#define STATIC   static
#define HRESOURCE_MAP   0
#define HDEVICE_STORAGE   1
#define HCURRENT_CONTROL_SET   2
#define HSYSTEMRESOURCES   3
#define HORDERING   4
#define HRESERVEDRESOURCES   5
#define HBUSVALUES   6
#define HOWNER_MAP   7
#define MAX_REG_HANDLES   8
#define INVALID_HANDLE   (HANDLE) -1
#define BUFFERSIZE   (2048 + sizeof( KEY_FULL_INFORMATION ))
#define MAX_ENTRIES   50
#define SCONFLICT   5
#define DoesTEntryCollide(a, b)   ( (a).EAddr >= (b).BAddr && (a).BAddr <= (b).EAddr && ((a).Affinity & (b).Affinity) )
#define CHECK_STATUS(a, b)   { if(!NT_SUCCESS(a)) goto Exit; }
#define DBGMSG(a)
#define IDBGMSG(a)

Typedefs

typedef * PTENTRY
typedef _LTENTRY LTENTRY
typedef _LTENTRYPLTENTRY
typedef * PTENTRIESBYTYPE
typedef * PIO_TRACK_CONFLICT
typedef * PDIR_REQUIRED_RESOURCE
typedef _DIR_RESOURCE_LIST DIR_RESOURCE_LIST
typedef _DIR_RESOURCE_LISTPDIR_RESOURCE_LIST
typedef _DIR_RESREQ_LIST DIR_RESREQ_LIST
typedef _DIR_RESREQ_LISTPDIR_RESREQ_LIST
typedef * PUSED_HEAP

Functions

PIO_RESOURCE_REQUIREMENTS_LIST IopGetResourceReqRegistryValue (IN PDIR_RESREQ_LIST Dir, IN HANDLE KeyHandle, IN PWSTR ValueName)
NTSTATUS IopAssignResourcesPhase1 (IN PIO_RESOURCE_REQUIREMENTS_LIST IoResources, IN PIO_RESOURCE_REQUIREMENTS_LIST *CopiedList)
NTSTATUS IopAssignResourcesPhase2 (IN PDIR_RESREQ_LIST Dir, IN PUNICODE_STRING DriverClassName, IN PDRIVER_OBJECT DriverObject, IN PDEVICE_OBJECT DeviceObject)
PDIR_RESOURCE_LIST IopAssignResourcesPhase3 (IN PDIR_RESREQ_LIST Dir)
PCM_RESOURCE_LIST IopAssignResourcesPhase4 (IN PDIR_RESREQ_LIST Dir, IN PDIR_RESOURCE_LIST CurList, OUT PULONG Length)
STATIC VOID IopLogConflict (IN PDRIVER_OBJECT DriverObject, IN PDIR_RESREQ_LIST Dir, IN NTSTATUS FinalStatus)
STATIC PVOID IopAllocateDirPool (IN PDIR_RESREQ_LIST Dir, IN ULONG Length)
INLINE PTENTRY IopNewTransEntry (IN PDIR_RESREQ_LIST Dir, IN PTENTRIESBYTYPE pTypes, IN ULONG Type)
STATIC NTSTATUS IopAddCmDescriptorToInUseList (IN PDIR_RESREQ_LIST Dir, IN PTENTRIESBYTYPE pTypes, IN PCM_PARTIAL_RESOURCE_DESCRIPTOR CmDesc, IN POWNER Owner)
ULONG IopFindCollisionInTList (IN PTENTRY SEntry, IN PLTENTRY List)
VOID IopPickupCollisionInTList (IN PDIR_RESOURCE_LIST CurList, IN UCHAR Type, IN LONGLONG BAddr, IN PTENTRY SEntry, IN PLTENTRY List)
NTSTATUS IopBuildResourceDir (IN PDIR_RESREQ_LIST ParentDir, IN PDIR_RESREQ_LIST *DirResourceList, IN PIO_RESOURCE_REQUIREMENTS_LIST IoResources)
VOID IopFreeResourceDir (IN PDIR_RESREQ_LIST DirResourceList)
VOID IopSortDescriptors (IN OUT PDIR_RESREQ_LIST Dir)
NTSTATUS IopCatagorizeDescriptors (IN OUT PDIR_RESREQ_LIST Dir)
ULONG IopDescriptorSortingWeight (IN PIO_RESOURCE_DESCRIPTOR Descriptor)
BOOLEAN IopGenNextValidResourceList (IN ULONG level, IN PDIR_RESOURCE_LIST CurList, IN PDIR_RESREQ_LIST Dir)
BOOLEAN IopGenNextValidDescriptor (IN ULONG level, IN PDIR_RESOURCE_LIST CurList, IN PDIR_RESREQ_LIST Dir, IN PULONG collisionlevel)
BOOLEAN IopSlotResourceOwner (IN PDIR_RESREQ_LIST Dir, IN PDRIVER_OBJECT DriverObject, IN PDEVICE_OBJECT DeviceObject OPTIONAL, IN PIO_RESOURCE_REQUIREMENTS_LIST IoResources, IN BOOLEAN AddOwner)
NTSTATUS IoAssignResources (IN PUNICODE_STRING RegistryPath, IN PUNICODE_STRING DriverClassName OPTIONAL, IN PDRIVER_OBJECT DriverObject, IN PDEVICE_OBJECT DeviceObject OPTIONAL, IN PIO_RESOURCE_REQUIREMENTS_LIST RequestedResources, IN OUT PCM_RESOURCE_LIST *pAllocatedResources)

Variables

WCHAR IopWstrOtherDrivers []
WCHAR IopWstrAssignedResources []
WCHAR IopWstrRequestedResources []
WCHAR IopWstrSystemResources []
WCHAR IopWstrReservedResources []
WCHAR IopWstrAssignmentOrdering []
WCHAR IopWstrBusValues []
WCHAR IopWstrTranslated []
WCHAR IopWstrBusTranslated []


Define Documentation

#define BUFFERSIZE   (2048 + sizeof( KEY_FULL_INFORMATION ))
 

Definition at line 71 of file assign.c.

#define CHECK_STATUS a,
 )     { if(!NT_SUCCESS(a)) goto Exit; }
 

Definition at line 342 of file assign.c.

#define DBGMSG  ) 
 

Definition at line 348 of file assign.c.

Referenced by KeSetPhysicalCacheTypeRange(), KiAmdK6FindFreeRegion(), KiAmdK6InitializeMTRR(), KiAmdK6MtrrCommitChanges(), KiAmdK6MtrrSetMemoryType(), KiCompleteEffectiveRangeChange(), KiInitializeMTRR(), and KiRemoveRange().

#define DoesTEntryCollide a,
 )     ( (a).EAddr >= (b).BAddr && (a).BAddr <= (b).EAddr && ((a).Affinity & (b).Affinity) )
 

Definition at line 98 of file assign.c.

#define HBUSVALUES   6
 

Definition at line 65 of file assign.c.

#define HCURRENT_CONTROL_SET   2
 

Definition at line 61 of file assign.c.

#define HDEVICE_STORAGE   1
 

Definition at line 60 of file assign.c.

#define HORDERING   4
 

Definition at line 63 of file assign.c.

#define HOWNER_MAP   7
 

Definition at line 66 of file assign.c.

#define HRESERVEDRESOURCES   5
 

Definition at line 64 of file assign.c.

#define HRESOURCE_MAP   0
 

Definition at line 59 of file assign.c.

#define HSYSTEMRESOURCES   3
 

Definition at line 62 of file assign.c.

#define IDBG   DBG
 

Definition at line 28 of file assign.c.

#define IDBGMSG  ) 
 

Definition at line 354 of file assign.c.

#define INLINE   __inline
 

Definition at line 30 of file assign.c.

#define INVALID_HANDLE   (HANDLE) -1
 

Definition at line 69 of file assign.c.

#define MAX_ENTRIES   50
 

Definition at line 72 of file assign.c.

#define MAX_REG_HANDLES   8
 

Definition at line 67 of file assign.c.

#define PAGED   1
 

Definition at line 29 of file assign.c.

#define SCONFLICT   5
 

Definition at line 73 of file assign.c.

#define STATIC   static
 

Definition at line 31 of file assign.c.


Typedef Documentation

typedef struct _DIR_RESOURCE_LIST DIR_RESOURCE_LIST
 

typedef struct _DIR_RESREQ_LIST DIR_RESREQ_LIST
 

typedef struct _LTENTRY LTENTRY
 

typedef * PDIR_REQUIRED_RESOURCE
 

typedef struct _DIR_RESOURCE_LIST * PDIR_RESOURCE_LIST
 

typedef struct _DIR_RESREQ_LIST * PDIR_RESREQ_LIST
 

typedef * PIO_TRACK_CONFLICT
 

typedef struct _LTENTRY * PLTENTRY
 

typedef * PTENTRIESBYTYPE
 

typedef * PTENTRY
 

typedef * PUSED_HEAP
 


Function Documentation

NTSTATUS IoAssignResources IN PUNICODE_STRING  RegistryPath,
IN PUNICODE_STRING DriverClassName  OPTIONAL,
IN PDRIVER_OBJECT  DriverObject,
IN PDEVICE_OBJECT DeviceObject  OPTIONAL,
IN PIO_RESOURCE_REQUIREMENTS_LIST  RequestedResources,
IN OUT PCM_RESOURCE_LIST *  pAllocatedResources
 

Definition at line 394 of file assign.c.

References ArbiterRequestLegacyAssigned, DNF_LEGACY_RESOURCE_DEVICENODE, IopLegacyResourceAllocation(), KeBugCheckEx(), NULL, and PNP_ERR_INVALID_PDO.

00404 : 00405 00406 This routine takes an input request of RequestedResources, and returned 00407 allocated resources in pAllocatedResources. The allocated resources are 00408 automatically recorded in the registry under the ResourceMap for the 00409 DriverClassName/DriverObject/DeviceObject requestor. 00410 00411 Arguments: 00412 00413 RegistryPath 00414 For a simple driver, this would be the value passed to the drivers 00415 initialization function. For drivers call IoAssignResources with 00416 multiple DeviceObjects are responsible for passing in a unique 00417 RegistryPath for each object. 00418 00419 The registry path is checked for: 00420 RegitryPath: 00421 AssignedSystemResources. 00422 00423 AssignSystemResources is of type REG_RESOURCE_REQUIREMENTS_LIST 00424 00425 If present, IoAssignResources will attempt to use these settings to 00426 satisify the requested resources. If the listed settings do 00427 not conform to the resource requirements, then IoAssignResources 00428 will fail. 00429 00430 Note: IoAssignResources may store other internal binary information 00431 in the supplied RegisteryPath. 00432 00433 DriverObject: 00434 The driver object of the caller. 00435 00436 DeviceObject: 00437 If non-null, then requested resoruce list refers to this device. 00438 If null, the requested resource list refers to the driver. 00439 00440 DriverClassName 00441 Used to partition allocated resources into different device classes. 00442 00443 RequestedResources 00444 A list of resources to allocate. 00445 00446 Allocated resources may be appended or freed by re-invoking 00447 IoAssignResources with the same RegistryPath, DriverObject and 00448 DeviceObject. (editing requirements on a resource list by using 00449 sucessive calls is not preferred driver behaviour). 00450 00451 AllocatedResources 00452 Returns the allocated resources for the requested resource list. 00453 00454 Note that the driver is responsible for passing in a pointer to 00455 an uninitialized pointer. IoAssignResources will initialize the 00456 pointer to point to the allocated CM_RESOURCE_LIST. The driver 00457 is responisble for returning the memory back to pool when it is 00458 done with them structure. 00459 00460 Return Value: 00461 00462 The status returned is the final completion status of the operation. 00463 00464 --*/ 00465 { 00466 if (DeviceObject) { 00467 00468 if ( DeviceObject->DeviceObjectExtension->DeviceNode && 00469 !(((PDEVICE_NODE)DeviceObject->DeviceObjectExtension->DeviceNode)->Flags & DNF_LEGACY_RESOURCE_DEVICENODE)) { 00470 00471 KeBugCheckEx(PNP_DETECTED_FATAL_ERROR, PNP_ERR_INVALID_PDO, (ULONG_PTR)DeviceObject, 0, 0); 00472 00473 } 00474 00475 } 00476 00477 if (RequestedResources) { 00478 00479 if (RequestedResources->AlternativeLists == 0 || 00480 RequestedResources->List[0].Count == 0) { 00481 00482 RequestedResources = NULL; 00483 00484 } 00485 } 00486 00487 if (pAllocatedResources) { 00488 00489 *pAllocatedResources = NULL; 00490 00491 } 00492 00493 return IopLegacyResourceAllocation ( ArbiterRequestLegacyAssigned, 00494 DriverObject, 00495 DeviceObject, 00496 RequestedResources, 00497 pAllocatedResources); 00498 } #if 0

STATIC NTSTATUS IopAddCmDescriptorToInUseList IN PDIR_RESREQ_LIST  Dir,
IN PTENTRIESBYTYPE  pTypes,
IN PCM_PARTIAL_RESOURCE_DESCRIPTOR  CmDesc,
IN POWNER  Owner
 

STATIC PVOID IopAllocateDirPool IN PDIR_RESREQ_LIST  Dir,
IN ULONG  Length
 

NTSTATUS IopAssignResourcesPhase1 IN PIO_RESOURCE_REQUIREMENTS_LIST  IoResources,
IN PIO_RESOURCE_REQUIREMENTS_LIST *  CopiedList
 

NTSTATUS IopAssignResourcesPhase2 IN PDIR_RESREQ_LIST  Dir,
IN PUNICODE_STRING  DriverClassName,
IN PDRIVER_OBJECT  DriverObject,
IN PDEVICE_OBJECT  DeviceObject
 

PDIR_RESOURCE_LIST IopAssignResourcesPhase3 IN PDIR_RESREQ_LIST  Dir  ) 
 

PCM_RESOURCE_LIST IopAssignResourcesPhase4 IN PDIR_RESREQ_LIST  Dir,
IN PDIR_RESOURCE_LIST  CurList,
OUT PULONG  Length
 

NTSTATUS IopBuildResourceDir IN PDIR_RESREQ_LIST  ParentDir,
IN PDIR_RESREQ_LIST DirResourceList,
IN PIO_RESOURCE_REQUIREMENTS_LIST  IoResources
 

NTSTATUS IopCatagorizeDescriptors IN OUT PDIR_RESREQ_LIST  Dir  ) 
 

ULONG IopDescriptorSortingWeight IN PIO_RESOURCE_DESCRIPTOR  Descriptor  ) 
 

ULONG IopFindCollisionInTList IN PTENTRY  SEntry,
IN PLTENTRY  List
 

VOID IopFreeResourceDir IN PDIR_RESREQ_LIST  DirResourceList  ) 
 

BOOLEAN IopGenNextValidDescriptor IN ULONG  level,
IN PDIR_RESOURCE_LIST  CurList,
IN PDIR_RESREQ_LIST  Dir,
IN PULONG  collisionlevel
 

BOOLEAN IopGenNextValidResourceList IN ULONG  level,
IN PDIR_RESOURCE_LIST  CurList,
IN PDIR_RESREQ_LIST  Dir
 

PIO_RESOURCE_REQUIREMENTS_LIST IopGetResourceReqRegistryValue IN PDIR_RESREQ_LIST  Dir,
IN HANDLE  KeyHandle,
IN PWSTR  ValueName
 

STATIC VOID IopLogConflict IN PDRIVER_OBJECT  DriverObject,
IN PDIR_RESREQ_LIST  Dir,
IN NTSTATUS  FinalStatus
 

INLINE PTENTRY IopNewTransEntry IN PDIR_RESREQ_LIST  Dir,
IN PTENTRIESBYTYPE  pTypes,
IN ULONG  Type
 

VOID IopPickupCollisionInTList IN PDIR_RESOURCE_LIST  CurList,
IN UCHAR  Type,
IN LONGLONG  BAddr,
IN PTENTRY  SEntry,
IN PLTENTRY  List
 

BOOLEAN IopSlotResourceOwner IN PDIR_RESREQ_LIST  Dir,
IN PDRIVER_OBJECT  DriverObject,
IN PDEVICE_OBJECT DeviceObject  OPTIONAL,
IN PIO_RESOURCE_REQUIREMENTS_LIST  IoResources,
IN BOOLEAN  AddOwner
 

VOID IopSortDescriptors IN OUT PDIR_RESREQ_LIST  Dir  ) 
 


Variable Documentation

WCHAR IopWstrAssignedResources[]
 

Definition at line 50 of file assign.c.

WCHAR IopWstrAssignmentOrdering[]
 

Definition at line 54 of file assign.c.

WCHAR IopWstrBusTranslated[]
 

Definition at line 57 of file assign.c.

WCHAR IopWstrBusValues[]
 

Definition at line 55 of file assign.c.

WCHAR IopWstrOtherDrivers[]
 

Definition at line 49 of file assign.c.

WCHAR IopWstrRequestedResources[]
 

Definition at line 51 of file assign.c.

WCHAR IopWstrReservedResources[]
 

Definition at line 53 of file assign.c.

WCHAR IopWstrSystemResources[]
 

Definition at line 52 of file assign.c.

WCHAR IopWstrTranslated[]
 

Definition at line 56 of file assign.c.

Referenced by IopBuildCmResourceList(), IopInitializeResourceMap(), and IoReportHalResourceUsage().


Generated on Sat May 15 19:42:56 2004 for test by doxygen 1.3.7