ReactOS 0.4.17-dev-1190-g4c812f4
misc.c File Reference
#include "ntdef.h"
#include "precomp.h"
#include <debug.h>
Include dependency graph for misc.c:

Go to the source code of this file.

Macros

#define NDEBUG
 

Functions

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)
 
VOID NTAPI SimpleTimerCallbackDpcRoutine (PKDPC Dpc, PVOID DeferredContext, PVOID SystemArgument1, PVOID SystemArgument2)
 
VOID NTAPI TimerCallbackDpcRoutine (PKDPC Dpc, PVOID DeferredContext, PVOID SystemArgument1, PVOID SystemArgument2)
 
PCSTR GetDeviceType (_In_ PINQUIRYDATA InquiryData)
 
PCSTR GetGenericType (_In_ PINQUIRYDATA InquiryData)
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 13 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 291 of file misc.c.

297{
299
300 DPRINT1("AllocateAddressMapping()\n");
301
303 sizeof(MAPPED_ADDRESS),
305 if (Mapping == NULL)
306 {
307 DPRINT1("No memory!\n");
308 return STATUS_NO_MEMORY;
309 }
310
312
313 Mapping->NextMappedAddress = *MappedAddressList;
314 *MappedAddressList = Mapping;
315
316 Mapping->IoAddress = IoAddress;
317 Mapping->MappedAddress = MappedAddress;
318 Mapping->NumberOfBytes = NumberOfBytes;
319 Mapping->BusNumber = BusNumber;
320
321 return STATUS_SUCCESS;
322}
#define DPRINT1
Definition: precomp.h:8
#define STATUS_NO_MEMORY
Definition: d3dkmdt.h:51
#define NULL
Definition: types.h:112
#define TAG_ADDRESS_MAPPING
Definition: precomp.h:36
static PVOID Mapping[EMS_PHYSICAL_PAGES]
Definition: emsdrv.c:41
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
#define NonPagedPool
Definition: env_spec_w32.h:307
_In_ ULONG BusNumber
Definition: pciidex.h:65
#define STATUS_SUCCESS
Definition: shellext.h:65
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
_Must_inspect_result_ typedef _In_ PHYSICAL_ADDRESS _Inout_ PLARGE_INTEGER NumberOfBytes
Definition: iotypes.h:1036

Referenced by StorPortGetDeviceBase().

◆ CopyResourceList()

PCM_RESOURCE_LIST CopyResourceList ( POOL_TYPE  PoolType,
PCM_RESOURCE_LIST  Source 
)

Definition at line 92 of file misc.c.

95{
97 ULONG Size;
98
99 DPRINT1("CopyResourceList(%lu %p)\n",
101
102 /* Get the size of the resource list */
104
105 /* Allocate a new buffer */
107 Size,
109 if (Destination == NULL)
110 return NULL;
111
112 /* Copy the resource list */
114 Source,
115 Size);
116
117 return Destination;
118}
static ULONG GetResourceListSize(PCM_RESOURCE_LIST ResourceList)
Definition: misc.c:61
#define TAG_RESOURCE_LIST
Definition: precomp.h:35
_In_ UINT _In_ UINT _In_ PNDIS_PACKET Source
Definition: ndis.h:3169
_In_ PUNICODE_STRING _Inout_ PUNICODE_STRING Destination
Definition: rtlfuncs.h:3051
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
uint32_t ULONG
Definition: typedefs.h:59
_Must_inspect_result_ _In_ WDFDEVICE _In_ DEVICE_REGISTRY_PROPERTY _In_ _Strict_type_match_ POOL_TYPE PoolType
Definition: wdfdevice.h:3821
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
Definition: wdfdevice.h:4539

Referenced by PortFdoStartDevice().

◆ ForwardIrpAndForget()

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

Definition at line 21 of file misc.c.

24{
25 ASSERT(LowerDevice);
26
28 return IoCallDriver(LowerDevice, Irp);
29}
_In_ PIRP Irp
Definition: kse.h:79
#define ASSERT(a)
Definition: mode.c:44
#define IoSkipCurrentIrpStackLocation(Irp)
Definition: ntifs_ex.h:421
#define IoCallDriver
Definition: irp.c:1257

◆ GetBusInterface()

INTERFACE_TYPE GetBusInterface ( PDEVICE_OBJECT  DeviceObject)

Definition at line 33 of file misc.c.

35{
36 GUID Guid;
39
42 sizeof(Guid),
43 &Guid,
44 &Length);
45 if (!NT_SUCCESS(Status))
47
48 if (RtlCompareMemory(&Guid, &GUID_BUS_TYPE_PCMCIA, sizeof(GUID)) == sizeof(GUID))
49 return PCMCIABus;
50 else if (RtlCompareMemory(&Guid, &GUID_BUS_TYPE_PCI, sizeof(GUID)) == sizeof(GUID))
51 return PCIBus;
52 else if (RtlCompareMemory(&Guid, &GUID_BUS_TYPE_ISAPNP, sizeof(GUID)) == sizeof(GUID))
53 return PNPISABus;
54
56}
LONG NTSTATUS
Definition: precomp.h:26
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:33
#define RtlCompareMemory(s1, s2, l)
Definition: env_spec_w32.h:465
Status
Definition: gdiplustypes.h:24
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:102
NTSTATUS NTAPI IoGetDeviceProperty(IN PDEVICE_OBJECT DeviceObject, IN DEVICE_REGISTRY_PROPERTY DeviceProperty, IN ULONG BufferLength, OUT PVOID PropertyBuffer, OUT PULONG ResultLength)
Definition: pnpmgr.c:1382
@ InterfaceTypeUndefined
Definition: restypes.h:121
@ PCIBus
Definition: restypes.h:127
@ PNPISABus
Definition: restypes.h:136
@ PCMCIABus
Definition: restypes.h:130
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2061
_Must_inspect_result_ _In_ WDFOBJECT _In_ CONST GUID * Guid
Definition: wdfobject.h:762
@ DevicePropertyBusTypeGuid
Definition: iotypes.h:1207

Referenced by PortFdoStartMiniport().

◆ GetDeviceType()

PCSTR GetDeviceType ( _In_ PINQUIRYDATA  InquiryData)

Definition at line 374 of file misc.c.

376{
377 switch (InquiryData->DeviceType)
378 {
380 return "Disk";
382 return "Sequential";
383 case PRINTER_DEVICE:
384 return "Printer";
385 case PROCESSOR_DEVICE:
386 return "Processor";
388 return "Worm";
390 return "CdRom";
391 case SCANNER_DEVICE:
392 return "Scanner";
393 case OPTICAL_DEVICE:
394 return "Optical";
395 case MEDIUM_CHANGER:
396 return "Changer";
398 return "Net";
400 return "Array";
402 return "Enclosure";
404 return "RBC";
406 return "CardReader";
408 return "Bridge";
409 default:
410 return "Other";
411 }
412}
#define COMMUNICATION_DEVICE
Definition: cdrw_hw.h:1153
#define WRITE_ONCE_READ_MULTIPLE_DEVICE
Definition: cdrw_hw.h:1148
#define DIRECT_ACCESS_DEVICE
Definition: cdrw_hw.h:1144
#define PRINTER_DEVICE
Definition: cdrw_hw.h:1146
#define OPTICAL_DEVICE
Definition: cdrw_hw.h:1151
#define READ_ONLY_DIRECT_ACCESS_DEVICE
Definition: cdrw_hw.h:1149
#define SEQUENTIAL_ACCESS_DEVICE
Definition: cdrw_hw.h:1145
#define PROCESSOR_DEVICE
Definition: cdrw_hw.h:1147
#define MEDIUM_CHANGER
Definition: cdrw_hw.h:1152
#define SCANNER_DEVICE
Definition: cdrw_hw.h:1150
#define BRIDGE_CONTROLLER_DEVICE
Definition: scsi.h:555
#define OPTICAL_CARD_READER_WRITER_DEVICE
Definition: scsi.h:554
#define REDUCED_BLOCK_DEVICE
Definition: scsi.h:553
#define ARRAY_CONTROLLER_DEVICE
Definition: scsi.h:551
#define SCSI_ENCLOSURE_DEVICE
Definition: scsi.h:552

◆ GetGenericType()

PCSTR GetGenericType ( _In_ PINQUIRYDATA  InquiryData)

Definition at line 416 of file misc.c.

418{
419 switch (InquiryData->DeviceType)
420 {
422 return "GenDisk";
423 case PRINTER_DEVICE:
424 return "GenPrinter";
426 return "GenWorm";
428 return "GenCdRom";
429 case SCANNER_DEVICE:
430 return "GenScanner";
431 case OPTICAL_DEVICE:
432 return "GenOptical";
433 case MEDIUM_CHANGER:
434 return "ScsiChanger";
436 return "ScsiNet";
438 return "ScsiArray";
440 return "ScsiEnclosure";
442 return "ScsiRBC";
444 return "ScsiCardReader";
446 return "ScsiBridge";
447 default:
448 return "ScsiOther";
449 }
450}

◆ GetResourceListInterrupt()

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

Definition at line 242 of file misc.c.

249{
250 PCM_FULL_RESOURCE_DESCRIPTOR FullDescriptor;
251 PCM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptor;
252 INT i, j;
253
254 DPRINT1("GetResourceListInterrupt(%p)\n",
255 DeviceExtension);
256
257 FullDescriptor = DeviceExtension->TranslatedResources->List;
258 for (i = 0; i < DeviceExtension->TranslatedResources->Count; i++)
259 {
260 for (j = 0; j < FullDescriptor->PartialResourceList.Count; j++)
261 {
262 PartialDescriptor = FullDescriptor->PartialResourceList.PartialDescriptors + j;
263
264 switch (PartialDescriptor->Type)
265 {
267 DPRINT1("Interrupt: Level %lu Vector %lu\n",
268 PartialDescriptor->u.Interrupt.Level,
269 PartialDescriptor->u.Interrupt.Vector);
270
271 *Vector = PartialDescriptor->u.Interrupt.Vector;
272 *Irql = (KIRQL)PartialDescriptor->u.Interrupt.Level;
274 *ShareVector = (PartialDescriptor->ShareDisposition == CmResourceShareShared) ? TRUE : FALSE;
275 *Affinity = PartialDescriptor->u.Interrupt.Affinity;
276
277 return STATUS_SUCCESS;
278 }
279 }
280
281 /* Advance to next CM_FULL_RESOURCE_DESCRIPTOR block in memory. */
282 FullDescriptor = (PCM_FULL_RESOURCE_DESCRIPTOR)(FullDescriptor->PartialResourceList.PartialDescriptors +
283 FullDescriptor->PartialResourceList.Count);
284 }
285
286 return STATUS_NOT_FOUND;
287}
_Out_ PKIRQL Irql
Definition: csq.h:179
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
UCHAR KIRQL
Definition: env_spec_w32.h:591
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
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
struct _CM_FULL_RESOURCE_DESCRIPTOR * PCM_FULL_RESOURCE_DESCRIPTOR
#define CM_RESOURCE_INTERRUPT_LATCHED
Definition: restypes.h:117
#define CmResourceTypeInterrupt
Definition: restypes.h:105
@ Latched
Definition: miniport.h:81
@ LevelSensitive
Definition: miniport.h:80
#define STATUS_NOT_FOUND
Definition: shellext.h:72
CM_PARTIAL_RESOURCE_LIST PartialResourceList
Definition: restypes.h:145
union _CM_PARTIAL_RESOURCE_DESCRIPTOR::@494 u
struct _CM_PARTIAL_RESOURCE_DESCRIPTOR::@494::@497 Interrupt
CM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptors[1]
Definition: restypes.h:100
CM_FULL_RESOURCE_DESCRIPTOR List[1]
Definition: restypes.h:150
PCM_RESOURCE_LIST TranslatedResources
Definition: precomp.h:243
int32_t INT
Definition: typedefs.h:58
@ CmResourceShareShared
Definition: cmtypes.h:243
_In_ ULONG _In_ ULONG _In_ ULONG _Out_ PKIRQL _Out_ PKAFFINITY Affinity
Definition: halfuncs.h:174
_In_ PKSERVICE_ROUTINE _In_opt_ PVOID _In_opt_ PKSPIN_LOCK _In_ ULONG _In_ KIRQL _In_ KIRQL _In_ KINTERRUPT_MODE InterruptMode
Definition: iofuncs.h:806
_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:807

Referenced by PortFdoConnectInterrupt().

◆ GetResourceListSize()

static ULONG GetResourceListSize ( PCM_RESOURCE_LIST  ResourceList)
static

Definition at line 61 of file misc.c.

63{
65 ULONG Size;
66
67 DPRINT1("GetResourceListSize(%p)\n", ResourceList);
68
69 Size = sizeof(CM_RESOURCE_LIST);
70 if (ResourceList->Count == 0)
71 {
72 DPRINT1("Size: 0x%lx (%u)\n", Size, Size);
73 return Size;
74 }
75
76 DPRINT1("ResourceList->Count: %lu\n", ResourceList->Count);
77
78 Descriptor = &ResourceList->List[0];
79
80 DPRINT1("PartialResourceList->Count: %lu\n", Descriptor->PartialResourceList.Count);
81
82 /* Add the size of the partial descriptors */
83 if (Descriptor->PartialResourceList.Count > 1)
84 Size += (Descriptor->PartialResourceList.Count - 1) * sizeof(CM_PARTIAL_RESOURCE_DESCRIPTOR);
85
86 DPRINT1("Size: 0x%lx (%u)\n", Size, Size);
87 return Size;
88}
struct _CM_RESOURCE_LIST CM_RESOURCE_LIST
_Must_inspect_result_ _In_ WDFIORESREQLIST _In_opt_ PWDF_OBJECT_ATTRIBUTES _Out_ WDFIORESLIST * ResourceList
Definition: wdfresource.h:309
_Must_inspect_result_ _In_ WDFIORESLIST _In_ PIO_RESOURCE_DESCRIPTOR Descriptor
Definition: wdfresource.h:342

Referenced by CopyResourceList().

◆ QueryBusInterface()

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

Definition at line 122 of file misc.c.

129{
132 PIRP Irp;
135
137
140 NULL,
141 0,
142 NULL,
143 &Event,
144 &IoStatus);
145 if (Irp == NULL)
147
149
150 Stack->MajorFunction = IRP_MJ_PNP;
151 Stack->MinorFunction = IRP_MN_QUERY_INTERFACE;
152 Stack->Parameters.QueryInterface.InterfaceType = Guid;
153 Stack->Parameters.QueryInterface.Size = Size;
154 Stack->Parameters.QueryInterface.Version = Version;
155 Stack->Parameters.QueryInterface.Interface = (PINTERFACE)Interface;
156 Stack->Parameters.QueryInterface.InterfaceSpecificData = InterfaceSpecificData;
157
158 Irp->IoStatus.Status = STATUS_NOT_SUPPORTED;
159
161 if (Status == STATUS_PENDING)
162 {
164
165 Status=IoStatus.Status;
166 }
167
168 return Status;
169}
#define IRP_MJ_PNP
Definition: cdrw_usr.h:52
#define STATUS_NOT_SUPPORTED
Definition: d3dkmdt.h:48
_Check_return_ _In_ DXGK_EVENT_TYPE _In_ ULONG Event
Definition: dispmprt.h:1287
#define KeWaitForSingleObject(pEvt, foo, a, b, c)
Definition: env_spec_w32.h:478
#define KeInitializeEvent(pEvt, foo, foo2)
Definition: env_spec_w32.h:477
HRESULT QueryInterface([in] REFIID riid, [out, iid_is(riid)] void **ppvObject)
nsresult QueryInterface(nsIIDRef riid, void **result)
__in UCHAR __in POWER_STATE __in_opt PVOID __in PIO_STATUS_BLOCK IoStatus
Definition: mxum.h:159
#define KernelMode
Definition: asm.h:38
@ NotificationEvent
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:1101
struct _INTERFACE * PINTERFACE
#define STATUS_PENDING
Definition: telnetd.h:14
_In_ UCXUSBDEVICE _In_ ULONG Interface
Definition: ucxusbdevice.h:428
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
_Must_inspect_result_ _In_ WDFDEVICE _In_ LPCGUID _Out_ PINTERFACE _In_ USHORT _In_ USHORT Version
Definition: wdffdo.h:469
_Must_inspect_result_ _In_ WDFDEVICE _In_ LPCGUID _Out_ PINTERFACE _In_ USHORT _In_ USHORT _In_opt_ PVOID InterfaceSpecificData
Definition: wdffdo.h:472
_In_ WDFREQUEST _In_ PIO_STACK_LOCATION Stack
Definition: wdfrequest.h:639
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetNextIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2702
#define IRP_MN_QUERY_INTERFACE
@ Executive
Definition: ketypes.h:467

Referenced by PortFdoStartDevice().

◆ SimpleTimerCallbackDpcRoutine()

VOID NTAPI SimpleTimerCallbackDpcRoutine ( PKDPC  Dpc,
PVOID  DeferredContext,
PVOID  SystemArgument1,
PVOID  SystemArgument2 
)

Definition at line 327 of file misc.c.

332{
336
338
340 NT_ASSERT(FdoExtension->Miniport.MiniportExtension);
341
342 FdoExtension->TimerCallback(&FdoExtension->Miniport.MiniportExtension->HwDeviceExtension);
343}
struct _FDO_DEVICE_EXTENSION * PFDO_DEVICE_EXTENSION
@ FdoExtension
Definition: precomp.h:60
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:329
_Must_inspect_result_ _In_ PWDF_DPC_CONFIG _In_ PWDF_OBJECT_ATTRIBUTES _Out_ WDFDPC * Dpc
Definition: wdfdpc.h:112
_In_opt_ PVOID _In_opt_ PVOID SystemArgument1
Definition: ketypes.h:756
_In_opt_ PVOID DeferredContext
Definition: ketypes.h:755
_In_opt_ PVOID _In_opt_ PVOID _In_opt_ PVOID SystemArgument2
Definition: ketypes.h:757
#define NT_ASSERT
Definition: rtlfuncs.h:3334

Referenced by PortAddDevice().

◆ TimerCallbackDpcRoutine()

VOID NTAPI TimerCallbackDpcRoutine ( PKDPC  Dpc,
PVOID  DeferredContext,
PVOID  SystemArgument1,
PVOID  SystemArgument2 
)

Definition at line 348 of file misc.c.

353{
357
359
360 /*
361 * Miniport can schedule a new timer event inside of callback, we should clear timer activated
362 * status here to ensure timer can be correctly scheduled
363 */
364 TimerEntry->TimerAlreadySet = 0;
365
366 TimerEntry->TimerCallback(TimerEntry->HwDeviceExtension,
367 TimerEntry->Context);
368}
struct _TIMER_ENTRY * PTIMER_ENTRY
Definition: precomp.h:103
PVOID Context
Definition: precomp.h:110
LONG TimerAlreadySet
Definition: precomp.h:107
PHW_TIMER_EX TimerCallback
Definition: precomp.h:109
PVOID HwDeviceExtension
Definition: precomp.h:108

Referenced by StorPortExtendedFunction().

◆ 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 173 of file misc.c.

181{
182 PCM_FULL_RESOURCE_DESCRIPTOR FullDescriptorA, FullDescriptorT;
183 PCM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptorA, PartialDescriptorT;
184 INT i, j;
185
186 DPRINT1("TranslateResourceListAddress(%p)\n", DeviceExtension);
187
188 FullDescriptorA = DeviceExtension->AllocatedResources->List;
189 FullDescriptorT = DeviceExtension->TranslatedResources->List;
190 for (i = 0; i < DeviceExtension->AllocatedResources->Count; i++)
191 {
192 for (j = 0; j < FullDescriptorA->PartialResourceList.Count; j++)
193 {
194 PartialDescriptorA = FullDescriptorA->PartialResourceList.PartialDescriptors + j;
195 PartialDescriptorT = FullDescriptorT->PartialResourceList.PartialDescriptors + j;
196
197 switch (PartialDescriptorA->Type)
198 {
200 DPRINT1("Port: 0x%I64x (0x%lx)\n",
201 PartialDescriptorA->u.Port.Start.QuadPart,
202 PartialDescriptorA->u.Port.Length);
203 if (InIoSpace &&
204 IoAddress.QuadPart >= PartialDescriptorA->u.Port.Start.QuadPart &&
205 IoAddress.QuadPart + NumberOfBytes <= PartialDescriptorA->u.Port.Start.QuadPart + PartialDescriptorA->u.Port.Length)
206 {
207 TranslatedAddress->QuadPart = PartialDescriptorT->u.Port.Start.QuadPart +
208 (IoAddress.QuadPart - PartialDescriptorA->u.Port.Start.QuadPart);
209 return TRUE;
210 }
211 break;
212
214 DPRINT1("Memory: 0x%I64x (0x%lx)\n",
215 PartialDescriptorA->u.Memory.Start.QuadPart,
216 PartialDescriptorA->u.Memory.Length);
217 if (!InIoSpace &&
218 IoAddress.QuadPart >= PartialDescriptorA->u.Memory.Start.QuadPart &&
219 IoAddress.QuadPart + NumberOfBytes <= PartialDescriptorA->u.Memory.Start.QuadPart + PartialDescriptorA->u.Memory.Length)
220 {
221 TranslatedAddress->QuadPart = PartialDescriptorT->u.Memory.Start.QuadPart +
222 (IoAddress.QuadPart - PartialDescriptorA->u.Memory.Start.QuadPart);
223 return TRUE;
224 }
225 break;
226 }
227 }
228
229 /* Advance to next CM_FULL_RESOURCE_DESCRIPTOR block in memory. */
230 FullDescriptorA = (PCM_FULL_RESOURCE_DESCRIPTOR)(FullDescriptorA->PartialResourceList.PartialDescriptors +
231 FullDescriptorA->PartialResourceList.Count);
232
233 FullDescriptorT = (PCM_FULL_RESOURCE_DESCRIPTOR)(FullDescriptorT->PartialResourceList.PartialDescriptors +
234 FullDescriptorT->PartialResourceList.Count);
235 }
236
237 return FALSE;
238}
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 CmResourceTypeMemory
Definition: restypes.h:106
#define CmResourceTypePort
Definition: restypes.h:104
struct _CM_PARTIAL_RESOURCE_DESCRIPTOR::@494::@496 Port
struct _CM_PARTIAL_RESOURCE_DESCRIPTOR::@494::@499 Memory
PCM_RESOURCE_LIST AllocatedResources
Definition: precomp.h:242
LONGLONG QuadPart
Definition: typedefs.h:114
_In_ ULONG _In_ PHYSICAL_ADDRESS _Inout_ PULONG _Out_ PPHYSICAL_ADDRESS TranslatedAddress
Definition: iofuncs.h:2275

Referenced by StorPortGetDeviceBase().