ReactOS  0.4.14-dev-57-g333b8f1
misc.c File Reference
#include "precomp.h"
#include <debug.h>
Include dependency graph for misc.c:

Go to the source code of this file.

Macros

#define NDEBUG
 

Functions

static NTSTATUS NTAPI ForwardIrpAndWaitCompletion (_In_ PDEVICE_OBJECT DeviceObject, _In_ PIRP Irp, _In_ PVOID Context)
 
NTSTATUS ForwardIrpAndWait (_In_ PDEVICE_OBJECT LowerDevice, _In_ PIRP Irp)
 
NTSTATUS NTAPI ForwardIrpAndForget (_In_ PDEVICE_OBJECT LowerDevice, _In_ PIRP Irp)
 
INTERFACE_TYPE GetBusInterface (PDEVICE_OBJECT DeviceObject)
 
static ULONG GetResourceListSize (PCM_RESOURCE_LIST ResourceList)
 
PCM_RESOURCE_LIST CopyResourceList (POOL_TYPE PoolType, PCM_RESOURCE_LIST Source)
 
NTSTATUS QueryBusInterface (PDEVICE_OBJECT DeviceObject, PGUID Guid, USHORT Size, USHORT Version, PBUS_INTERFACE_STANDARD Interface, PVOID InterfaceSpecificData)
 
BOOLEAN TranslateResourceListAddress (PFDO_DEVICE_EXTENSION DeviceExtension, INTERFACE_TYPE BusType, ULONG SystemIoBusNumber, STOR_PHYSICAL_ADDRESS IoAddress, ULONG NumberOfBytes, BOOLEAN InIoSpace, PPHYSICAL_ADDRESS TranslatedAddress)
 
NTSTATUS GetResourceListInterrupt (PFDO_DEVICE_EXTENSION DeviceExtension, PULONG Vector, PKIRQL Irql, KINTERRUPT_MODE *InterruptMode, PBOOLEAN ShareVector, PKAFFINITY Affinity)
 
NTSTATUS AllocateAddressMapping (PMAPPED_ADDRESS *MappedAddressList, STOR_PHYSICAL_ADDRESS IoAddress, PVOID MappedAddress, ULONG NumberOfBytes, ULONG BusNumber)
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 12 of file misc.c.

Function Documentation

◆ AllocateAddressMapping()

NTSTATUS AllocateAddressMapping ( PMAPPED_ADDRESS MappedAddressList,
STOR_PHYSICAL_ADDRESS  IoAddress,
PVOID  MappedAddress,
ULONG  NumberOfBytes,
ULONG  BusNumber 
)

Definition at line 331 of file misc.c.

337 {
339 
340  DPRINT1("AllocateAddressMapping()\n");
341 
343  sizeof(MAPPED_ADDRESS),
345  if (Mapping == NULL)
346  {
347  DPRINT1("No memory!\n");
348  return STATUS_NO_MEMORY;
349  }
350 
352 
353  Mapping->NextMappedAddress = *MappedAddressList;
354  *MappedAddressList = Mapping;
355 
356  Mapping->IoAddress = IoAddress;
357  Mapping->MappedAddress = MappedAddress;
358  Mapping->NumberOfBytes = NumberOfBytes;
359  Mapping->BusNumber = BusNumber;
360 
361  return STATUS_SUCCESS;
362 }
static PVOID Mapping[EMS_PHYSICAL_PAGES]
Definition: emsdrv.c:41
#define TAG_ADDRESS_MAPPING
Definition: precomp.h:31
smooth NULL
Definition: ftsmooth.c:416
_In_opt_ PUNICODE_STRING _In_ PDRIVER_OBJECT _In_ PDEVICE_OBJECT _In_ INTERFACE_TYPE _In_ ULONG BusNumber
Definition: halfuncs.h:156
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
#define STATUS_NO_MEMORY
Definition: ntstatus.h:246
#define DPRINT1
Definition: precomp.h:8
_Must_inspect_result_ typedef _In_ PHYSICAL_ADDRESS _Inout_ PLARGE_INTEGER NumberOfBytes
Definition: iotypes.h:998
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
return STATUS_SUCCESS
Definition: btrfs.c:2966

Referenced by StorPortGetDeviceBase().

◆ CopyResourceList()

PCM_RESOURCE_LIST CopyResourceList ( POOL_TYPE  PoolType,
PCM_RESOURCE_LIST  Source 
)

Definition at line 132 of file misc.c.

135 {
137  ULONG Size;
138 
139  DPRINT1("CopyResourceList(%lu %p)\n",
140  PoolType, Source);
141 
142  /* Get the size of the resource list */
144 
145  /* Allocate a new buffer */
147  Size,
149  if (Destination == NULL)
150  return NULL;
151 
152  /* Copy the resource list */
154  Source,
155  Size);
156 
157  return Destination;
158 }
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
#define TAG_RESOURCE_LIST
Definition: precomp.h:30
smooth NULL
Definition: ftsmooth.c:416
static ULONG GetResourceListSize(PCM_RESOURCE_LIST ResourceList)
Definition: misc.c:101
_In_ PUNICODE_STRING _Inout_ PUNICODE_STRING Destination
Definition: rtlfuncs.h:2891
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:359
#define DPRINT1
Definition: precomp.h:8
unsigned int ULONG
Definition: retypes.h:1
_In_ UINT _In_ UINT _In_ PNDIS_PACKET Source
Definition: ndis.h:3167
_Must_inspect_result_ _In_ FLT_CONTEXT_TYPE _In_ SIZE_T _In_ POOL_TYPE PoolType
Definition: fltkernel.h:1444

Referenced by PortFdoStartDevice().

◆ ForwardIrpAndForget()

NTSTATUS NTAPI ForwardIrpAndForget ( _In_ PDEVICE_OBJECT  LowerDevice,
_In_ PIRP  Irp 
)

Definition at line 61 of file misc.c.

64 {
65  ASSERT(LowerDevice);
66 
68  return IoCallDriver(LowerDevice, Irp);
69 }
_In_ PIRP Irp
Definition: csq.h:116
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
NTSTATUS NTAPI IoCallDriver(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: irp.c:1218
#define IoSkipCurrentIrpStackLocation(Irp)
Definition: ntifs_ex.h:421

◆ ForwardIrpAndWait()

NTSTATUS ForwardIrpAndWait ( _In_ PDEVICE_OBJECT  LowerDevice,
_In_ PIRP  Irp 
)

Definition at line 33 of file misc.c.

36 {
37  KEVENT Event;
39 
40  ASSERT(LowerDevice);
41 
44 
46 
47  Status = IoCallDriver(LowerDevice, Irp);
48  if (Status == STATUS_PENDING)
49  {
51  if (NT_SUCCESS(Status))
52  Status = Irp->IoStatus.Status;
53  }
54 
55  return Status;
56 }
#define TRUE
Definition: types.h:120
_In_ PIRP Irp
Definition: csq.h:116
LONG NTSTATUS
Definition: precomp.h:26
NTSTATUS NTAPI KeWaitForSingleObject(IN PVOID Object, IN KWAIT_REASON WaitReason, IN KPROCESSOR_MODE WaitMode, IN BOOLEAN Alertable, IN PLARGE_INTEGER Timeout OPTIONAL)
Definition: wait.c:416
#define IoSetCompletionRoutine(_Irp, _CompletionRoutine, _Context, _InvokeOnSuccess, _InvokeOnError, _InvokeOnCancel)
Definition: irp.cpp:515
FORCEINLINE VOID IoCopyCurrentIrpStackLocationToNext(_Inout_ PIRP Irp)
Definition: iofuncs.h:2820
_In_ PVOID _In_ ULONG Event
Definition: iotypes.h:435
smooth NULL
Definition: ftsmooth.c:416
static NTSTATUS NTAPI ForwardIrpAndWaitCompletion(_In_ PDEVICE_OBJECT DeviceObject, _In_ PIRP Irp, _In_ PVOID Context)
Definition: misc.c:21
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define STATUS_PENDING
Definition: ntstatus.h:82
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
Status
Definition: gdiplustypes.h:24
#define KeInitializeEvent(pEvt, foo, foo2)
Definition: env_spec_w32.h:477
NTSTATUS NTAPI IoCallDriver(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: irp.c:1218

◆ ForwardIrpAndWaitCompletion()

static NTSTATUS NTAPI ForwardIrpAndWaitCompletion ( _In_ PDEVICE_OBJECT  DeviceObject,
_In_ PIRP  Irp,
_In_ PVOID  Context 
)
static

Definition at line 21 of file misc.c.

25 {
26  if (Irp->PendingReturned)
29 }
#define STATUS_MORE_PROCESSING_REQUIRED
Definition: shellext.h:63
_In_ PIRP Irp
Definition: csq.h:116
LONG NTAPI KeSetEvent(IN PKEVENT Event, IN KPRIORITY Increment, IN BOOLEAN Wait)
Definition: eventobj.c:159
#define IO_NO_INCREMENT
Definition: iotypes.h:566

Referenced by ForwardIrpAndWait().

◆ GetBusInterface()

INTERFACE_TYPE GetBusInterface ( PDEVICE_OBJECT  DeviceObject)

Definition at line 73 of file misc.c.

75 {
76  GUID Guid;
77  ULONG Length;
79 
82  sizeof(Guid),
83  &Guid,
84  &Length);
85  if (!NT_SUCCESS(Status))
87 
88  if (RtlCompareMemory(&Guid, &GUID_BUS_TYPE_PCMCIA, sizeof(GUID)) == sizeof(GUID))
89  return PCMCIABus;
90  else if (RtlCompareMemory(&Guid, &GUID_BUS_TYPE_PCI, sizeof(GUID)) == sizeof(GUID))
91  return PCIBus;
92  else if (RtlCompareMemory(&Guid, &GUID_BUS_TYPE_ISAPNP, sizeof(GUID)) == sizeof(GUID))
93  return PNPISABus;
94 
96 }
LONG NTSTATUS
Definition: precomp.h:26
static GUID * Guid
Definition: apphelp.c:93
NTSTATUS NTAPI IoGetDeviceProperty(IN PDEVICE_OBJECT DeviceObject, IN DEVICE_REGISTRY_PROPERTY DeviceProperty, IN ULONG BufferLength, OUT PVOID PropertyBuffer, OUT PULONG ResultLength)
Definition: pnpmgr.c:4228
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
Status
Definition: gdiplustypes.h:24
IN PDEVICE_OBJECT DeviceObject
Definition: fatprocs.h:1560
unsigned int ULONG
Definition: retypes.h:1
#define RtlCompareMemory(s1, s2, l)
Definition: env_spec_w32.h:465

◆ GetResourceListInterrupt()

NTSTATUS GetResourceListInterrupt ( PFDO_DEVICE_EXTENSION  DeviceExtension,
PULONG  Vector,
PKIRQL  Irql,
KINTERRUPT_MODE InterruptMode,
PBOOLEAN  ShareVector,
PKAFFINITY  Affinity 
)

Definition at line 282 of file misc.c.

289 {
290  PCM_FULL_RESOURCE_DESCRIPTOR FullDescriptor;
291  PCM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptor;
292  INT i, j;
293 
294  DPRINT1("GetResourceListInterrupt(%p)\n",
295  DeviceExtension);
296 
297  FullDescriptor = DeviceExtension->TranslatedResources->List;
298  for (i = 0; i < DeviceExtension->TranslatedResources->Count; i++)
299  {
300  for (j = 0; j < FullDescriptor->PartialResourceList.Count; j++)
301  {
302  PartialDescriptor = FullDescriptor->PartialResourceList.PartialDescriptors + j;
303 
304  switch (PartialDescriptor->Type)
305  {
307  DPRINT1("Interrupt: Level %lu Vector %lu\n",
308  PartialDescriptor->u.Interrupt.Level,
309  PartialDescriptor->u.Interrupt.Vector);
310 
311  *Vector = PartialDescriptor->u.Interrupt.Vector;
312  *Irql = (KIRQL)PartialDescriptor->u.Interrupt.Level;
314  *ShareVector = (PartialDescriptor->ShareDisposition == CmResourceShareShared) ? TRUE : FALSE;
315  *Affinity = PartialDescriptor->u.Interrupt.Affinity;
316 
317  return STATUS_SUCCESS;
318  }
319  }
320 
321  /* Advance to next CM_FULL_RESOURCE_DESCRIPTOR block in memory. */
322  FullDescriptor = (PCM_FULL_RESOURCE_DESCRIPTOR)(FullDescriptor->PartialResourceList.PartialDescriptors +
323  FullDescriptor->PartialResourceList.Count);
324  }
325 
326  return STATUS_NOT_FOUND;
327 }
#define TRUE
Definition: types.h:120
_In_ PKSERVICE_ROUTINE _In_opt_ PVOID _In_opt_ PKSPIN_LOCK _In_ ULONG _In_ KIRQL _In_ KIRQL _In_ KINTERRUPT_MODE InterruptMode
Definition: iofuncs.h:798
CM_FULL_RESOURCE_DESCRIPTOR List[1]
Definition: hwresource.cpp:165
_In_ PKSERVICE_ROUTINE _In_opt_ PVOID _In_opt_ PKSPIN_LOCK _In_ ULONG _In_ KIRQL _In_ KIRQL _In_ KINTERRUPT_MODE _In_ BOOLEAN ShareVector
Definition: iofuncs.h:798
struct _CM_PARTIAL_RESOURCE_DESCRIPTOR::@371::@374 Interrupt
_Out_ PKIRQL Irql
Definition: csq.h:179
int32_t INT
Definition: typedefs.h:56
UCHAR KIRQL
Definition: env_spec_w32.h:591
CM_PARTIAL_RESOURCE_LIST PartialResourceList
Definition: hwresource.cpp:160
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
struct _CM_FULL_RESOURCE_DESCRIPTOR * PCM_FULL_RESOURCE_DESCRIPTOR
union _CM_PARTIAL_RESOURCE_DESCRIPTOR::@371 u
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 GLint GLint j
Definition: glfuncs.h:250
#define STATUS_NOT_FOUND
Definition: shellext.h:67
_In_ ULONG _In_ ULONG _In_ ULONG _Out_ PKIRQL _Out_ PKAFFINITY Affinity
Definition: halfuncs.h:170
CM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptors[1]
Definition: hwresource.cpp:119
#define CmResourceTypeInterrupt
Definition: hwresource.cpp:124
#define DPRINT1
Definition: precomp.h:8
PCM_RESOURCE_LIST TranslatedResources
Definition: precomp.h:104
#define CM_RESOURCE_INTERRUPT_LATCHED
Definition: cmtypes.h:144
return STATUS_SUCCESS
Definition: btrfs.c:2966

Referenced by PortFdoConnectInterrupt().

◆ GetResourceListSize()

static ULONG GetResourceListSize ( PCM_RESOURCE_LIST  ResourceList)
static

Definition at line 101 of file misc.c.

103 {
105  ULONG Size;
106 
107  DPRINT1("GetResourceListSize(%p)\n", ResourceList);
108 
109  Size = sizeof(CM_RESOURCE_LIST);
110  if (ResourceList->Count == 0)
111  {
112  DPRINT1("Size: 0x%lx (%u)\n", Size, Size);
113  return Size;
114  }
115 
116  DPRINT1("ResourceList->Count: %lu\n", ResourceList->Count);
117 
118  Descriptor = &ResourceList->List[0];
119 
120  DPRINT1("PartialResourceList->Count: %lu\n", Descriptor->PartialResourceList.Count);
121 
122  /* Add the size of the partial descriptors */
123  if (Descriptor->PartialResourceList.Count > 1)
124  Size += (Descriptor->PartialResourceList.Count - 1) * sizeof(CM_PARTIAL_RESOURCE_DESCRIPTOR);
125 
126  DPRINT1("Size: 0x%lx (%u)\n", Size, Size);
127  return Size;
128 }
const MUI_LANGUAGE_RESOURCE ResourceList[]
Definition: muilanguages.h:414
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:359
struct _CM_RESOURCE_LIST CM_RESOURCE_LIST
#define DPRINT1
Definition: precomp.h:8
unsigned int ULONG
Definition: retypes.h:1
_In_ PSTORAGE_PROPERTY_ID _Outptr_ PSTORAGE_DESCRIPTOR_HEADER * Descriptor
Definition: classpnp.h:966

Referenced by CopyResourceList().

◆ QueryBusInterface()

NTSTATUS QueryBusInterface ( PDEVICE_OBJECT  DeviceObject,
PGUID  Guid,
USHORT  Size,
USHORT  Version,
PBUS_INTERFACE_STANDARD  Interface,
PVOID  InterfaceSpecificData 
)

Definition at line 162 of file misc.c.

169 {
170  KEVENT Event;
172  PIRP Irp;
174  PIO_STACK_LOCATION Stack;
175 
177 
179  DeviceObject,
180  NULL,
181  0,
182  NULL,
183  &Event,
184  &IoStatus);
185  if (Irp == NULL)
187 
189 
190  Stack->MajorFunction = IRP_MJ_PNP;
192  Stack->Parameters.QueryInterface.InterfaceType = Guid;
193  Stack->Parameters.QueryInterface.Size = Size;
194  Stack->Parameters.QueryInterface.Version = Version;
195  Stack->Parameters.QueryInterface.Interface = (PINTERFACE)Interface;
196  Stack->Parameters.QueryInterface.InterfaceSpecificData = InterfaceSpecificData;
197 
198  Irp->IoStatus.Status = STATUS_NOT_SUPPORTED;
199 
201  if (Status == STATUS_PENDING)
202  {
204 
205  Status=IoStatus.Status;
206  }
207 
208  return Status;
209 }
IN PVOID IN PVOID IN USHORT Version
Definition: pci.h:359
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
IN PLARGE_INTEGER IN ULONG IN BOOLEAN IN ULONG IN BOOLEAN OUT PIO_STATUS_BLOCK IoStatus
Definition: fatprocs.h:2650
PIRP NTAPI IoBuildSynchronousFsdRequest(IN ULONG MajorFunction, IN PDEVICE_OBJECT DeviceObject, IN PVOID Buffer, IN ULONG Length, IN PLARGE_INTEGER StartingOffset, IN PKEVENT Event, IN PIO_STATUS_BLOCK IoStatusBlock)
Definition: irp.c:1069
_In_ PIRP Irp
Definition: csq.h:116
#define IRP_MJ_PNP
Definition: cdrw_usr.h:52
LONG NTSTATUS
Definition: precomp.h:26
NTSTATUS NTAPI KeWaitForSingleObject(IN PVOID Object, IN KWAIT_REASON WaitReason, IN KPROCESSOR_MODE WaitMode, IN BOOLEAN Alertable, IN PLARGE_INTEGER Timeout OPTIONAL)
Definition: wait.c:416
_In_ PVOID _In_ ULONG Event
Definition: iotypes.h:435
static GUID * Guid
Definition: apphelp.c:93
smooth NULL
Definition: ftsmooth.c:416
struct _INTERFACE * PINTERFACE
IN PVOID IN PVOID IN USHORT IN USHORT IN PINTERFACE Interface
Definition: pci.h:359
#define STATUS_PENDING
Definition: ntstatus.h:82
#define IRP_MN_QUERY_INTERFACE
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:359
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetNextIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2647
Status
Definition: gdiplustypes.h:24
IN PDEVICE_OBJECT DeviceObject
Definition: fatprocs.h:1560
#define KeInitializeEvent(pEvt, foo, foo2)
Definition: env_spec_w32.h:477
NTSTATUS NTAPI IoCallDriver(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: irp.c:1218
HRESULT QueryInterface([in] REFIID riid, [out, iid_is(riid)] void **ppvObject)
#define STATUS_NOT_SUPPORTED
Definition: ntstatus.h:409
struct _NAMED_PIPE_CREATE_PARAMETERS * Parameters
Definition: iotypes.h:2772

Referenced by PortFdoStartDevice().

◆ TranslateResourceListAddress()

BOOLEAN TranslateResourceListAddress ( PFDO_DEVICE_EXTENSION  DeviceExtension,
INTERFACE_TYPE  BusType,
ULONG  SystemIoBusNumber,
STOR_PHYSICAL_ADDRESS  IoAddress,
ULONG  NumberOfBytes,
BOOLEAN  InIoSpace,
PPHYSICAL_ADDRESS  TranslatedAddress 
)

Definition at line 213 of file misc.c.

221 {
222  PCM_FULL_RESOURCE_DESCRIPTOR FullDescriptorA, FullDescriptorT;
223  PCM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptorA, PartialDescriptorT;
224  INT i, j;
225 
226  DPRINT1("TranslateResourceListAddress(%p)\n", DeviceExtension);
227 
228  FullDescriptorA = DeviceExtension->AllocatedResources->List;
229  FullDescriptorT = DeviceExtension->TranslatedResources->List;
230  for (i = 0; i < DeviceExtension->AllocatedResources->Count; i++)
231  {
232  for (j = 0; j < FullDescriptorA->PartialResourceList.Count; j++)
233  {
234  PartialDescriptorA = FullDescriptorA->PartialResourceList.PartialDescriptors + j;
235  PartialDescriptorT = FullDescriptorT->PartialResourceList.PartialDescriptors + j;
236 
237  switch (PartialDescriptorA->Type)
238  {
239  case CmResourceTypePort:
240  DPRINT1("Port: 0x%I64x (0x%lx)\n",
241  PartialDescriptorA->u.Port.Start.QuadPart,
242  PartialDescriptorA->u.Port.Length);
243  if (InIoSpace &&
244  IoAddress.QuadPart >= PartialDescriptorA->u.Port.Start.QuadPart &&
245  IoAddress.QuadPart + NumberOfBytes <= PartialDescriptorA->u.Port.Start.QuadPart + PartialDescriptorA->u.Port.Length)
246  {
247  TranslatedAddress->QuadPart = PartialDescriptorT->u.Port.Start.QuadPart +
248  (IoAddress.QuadPart - PartialDescriptorA->u.Port.Start.QuadPart);
249  return TRUE;
250  }
251  break;
252 
254  DPRINT1("Memory: 0x%I64x (0x%lx)\n",
255  PartialDescriptorA->u.Memory.Start.QuadPart,
256  PartialDescriptorA->u.Memory.Length);
257  if (!InIoSpace &&
258  IoAddress.QuadPart >= PartialDescriptorA->u.Memory.Start.QuadPart &&
259  IoAddress.QuadPart + NumberOfBytes <= PartialDescriptorA->u.Memory.Start.QuadPart + PartialDescriptorA->u.Memory.Length)
260  {
261  TranslatedAddress->QuadPart = PartialDescriptorT->u.Memory.Start.QuadPart +
262  (IoAddress.QuadPart - PartialDescriptorA->u.Memory.Start.QuadPart);
263  return TRUE;
264  }
265  break;
266  }
267  }
268 
269  /* Advance to next CM_FULL_RESOURCE_DESCRIPTOR block in memory. */
270  FullDescriptorA = (PCM_FULL_RESOURCE_DESCRIPTOR)(FullDescriptorA->PartialResourceList.PartialDescriptors +
271  FullDescriptorA->PartialResourceList.Count);
272 
273  FullDescriptorT = (PCM_FULL_RESOURCE_DESCRIPTOR)(FullDescriptorT->PartialResourceList.PartialDescriptors +
274  FullDescriptorT->PartialResourceList.Count);
275  }
276 
277  return FALSE;
278 }
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
Definition: glfuncs.h:240
#define TRUE
Definition: types.h:120
CM_FULL_RESOURCE_DESCRIPTOR List[1]
Definition: hwresource.cpp:165
_In_ ULONG _In_ PHYSICAL_ADDRESS _Inout_ PULONG _Out_ PPHYSICAL_ADDRESS TranslatedAddress
Definition: iofuncs.h:2268
int32_t INT
Definition: typedefs.h:56
#define CmResourceTypePort
Definition: hwresource.cpp:123
struct _CM_PARTIAL_RESOURCE_DESCRIPTOR::@371::@376 Memory
CM_PARTIAL_RESOURCE_LIST PartialResourceList
Definition: hwresource.cpp:160
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
struct _CM_FULL_RESOURCE_DESCRIPTOR * PCM_FULL_RESOURCE_DESCRIPTOR
union _CM_PARTIAL_RESOURCE_DESCRIPTOR::@371 u
struct _CM_PARTIAL_RESOURCE_DESCRIPTOR::@371::@373 Port
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 GLint GLint j
Definition: glfuncs.h:250
CM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptors[1]
Definition: hwresource.cpp:119
#define DPRINT1
Definition: precomp.h:8
PCM_RESOURCE_LIST TranslatedResources
Definition: precomp.h:104
#define CmResourceTypeMemory
Definition: hwresource.cpp:125
LONGLONG QuadPart
Definition: typedefs.h:112
PCM_RESOURCE_LIST AllocatedResources
Definition: precomp.h:103

Referenced by StorPortGetDeviceBase().