ReactOS 0.4.15-dev-8131-g4988de4
miniport.c File Reference
#include "precomp.h"
#include <debug.h>
Include dependency graph for miniport.c:

Go to the source code of this file.

Macros

#define NDEBUG
 

Functions

static NTSTATUS InitializeConfiguration (_In_ PPORT_CONFIGURATION_INFORMATION PortConfig, _In_ PHW_INITIALIZATION_DATA InitData, _In_ ULONG BusNumber, _In_ ULONG SlotNumber)
 
static VOID AssignResourcesToConfiguration (_In_ PPORT_CONFIGURATION_INFORMATION PortConfiguration, _In_ PCM_RESOURCE_LIST ResourceList, _In_ ULONG NumberOfAccessRanges)
 
NTSTATUS MiniportInitialize (_In_ PMINIPORT Miniport, _In_ PFDO_DEVICE_EXTENSION DeviceExtension, _In_ PHW_INITIALIZATION_DATA InitData)
 
NTSTATUS MiniportFindAdapter (_In_ PMINIPORT Miniport)
 
NTSTATUS MiniportHwInitialize (_In_ PMINIPORT Miniport)
 
BOOLEAN MiniportHwInterrupt (_In_ PMINIPORT Miniport)
 
BOOLEAN MiniportStartIo (_In_ PMINIPORT Miniport, _In_ PSCSI_REQUEST_BLOCK Srb)
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 12 of file miniport.c.

Function Documentation

◆ AssignResourcesToConfiguration()

static VOID AssignResourcesToConfiguration ( _In_ PPORT_CONFIGURATION_INFORMATION  PortConfiguration,
_In_ PCM_RESOURCE_LIST  ResourceList,
_In_ ULONG  NumberOfAccessRanges 
)
static

Definition at line 96 of file miniport.c.

100{
101 PCM_FULL_RESOURCE_DESCRIPTOR FullDescriptor;
102 PCM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptor;
103 PCM_PARTIAL_RESOURCE_LIST PartialResourceList;
104 PACCESS_RANGE AccessRange;
105 INT i, j;
106 ULONG RangeNumber = 0, Interrupt = 0, Dma = 0;
107
108 DPRINT1("AssignResourceToConfiguration(%p %p %lu)\n",
109 PortConfiguration, ResourceList, NumberOfAccessRanges);
110
111 FullDescriptor = &ResourceList->List[0];
112 for (i = 0; i < ResourceList->Count; i++)
113 {
114 PartialResourceList = &FullDescriptor->PartialResourceList;
115
116 for (j = 0; j < PartialResourceList->Count; j++)
117 {
118 PartialDescriptor = &PartialResourceList->PartialDescriptors[j];
119
120 switch (PartialDescriptor->Type)
121 {
123 DPRINT1("Port: 0x%I64x (0x%lx)\n",
124 PartialDescriptor->u.Port.Start.QuadPart,
125 PartialDescriptor->u.Port.Length);
126 if (RangeNumber < NumberOfAccessRanges)
127 {
128 AccessRange = &((*(PortConfiguration->AccessRanges))[RangeNumber]);
129 AccessRange->RangeStart = PartialDescriptor->u.Port.Start;
130 AccessRange->RangeLength = PartialDescriptor->u.Port.Length;
131 AccessRange->RangeInMemory = FALSE;
132 RangeNumber++;
133 }
134 break;
135
137 DPRINT1("Memory: 0x%I64x (0x%lx)\n",
138 PartialDescriptor->u.Memory.Start.QuadPart,
139 PartialDescriptor->u.Memory.Length);
140 if (RangeNumber < NumberOfAccessRanges)
141 {
142 AccessRange = &((*(PortConfiguration->AccessRanges))[RangeNumber]);
143 AccessRange->RangeStart = PartialDescriptor->u.Memory.Start;
144 AccessRange->RangeLength = PartialDescriptor->u.Memory.Length;
145 AccessRange->RangeInMemory = TRUE;
146 RangeNumber++;
147 }
148 break;
149
151 DPRINT1("Interrupt: Level %lu Vector %lu\n",
152 PartialDescriptor->u.Interrupt.Level,
153 PartialDescriptor->u.Interrupt.Vector);
154 if (Interrupt == 0)
155 {
156 /* Copy interrupt data */
157 PortConfiguration->BusInterruptLevel = PartialDescriptor->u.Interrupt.Level;
158 PortConfiguration->BusInterruptVector = PartialDescriptor->u.Interrupt.Vector;
159
160 /* Set interrupt mode accordingly to the resource */
161 if (PartialDescriptor->Flags == CM_RESOURCE_INTERRUPT_LATCHED)
162 {
163 PortConfiguration->InterruptMode = Latched;
164 }
165 else if (PartialDescriptor->Flags == CM_RESOURCE_INTERRUPT_LEVEL_SENSITIVE)
166 {
167 PortConfiguration->InterruptMode = LevelSensitive;
168 }
169 }
170 else if (Interrupt == 1)
171 {
172 /* Copy interrupt data */
173 PortConfiguration->BusInterruptLevel2 = PartialDescriptor->u.Interrupt.Level;
174 PortConfiguration->BusInterruptVector2 = PartialDescriptor->u.Interrupt.Vector;
175
176 /* Set interrupt mode accordingly to the resource */
177 if (PartialDescriptor->Flags == CM_RESOURCE_INTERRUPT_LATCHED)
178 {
179 PortConfiguration->InterruptMode2 = Latched;
180 }
181 else if (PartialDescriptor->Flags == CM_RESOURCE_INTERRUPT_LEVEL_SENSITIVE)
182 {
183 PortConfiguration->InterruptMode2 = LevelSensitive;
184 }
185 }
186 Interrupt++;
187 break;
188
190 DPRINT1("Dma: Channel: %lu Port: %lu\n",
191 PartialDescriptor->u.Dma.Channel,
192 PartialDescriptor->u.Dma.Port);
193 if (Dma == 0)
194 {
195 PortConfiguration->DmaChannel = PartialDescriptor->u.Dma.Channel;
196 PortConfiguration->DmaPort = PartialDescriptor->u.Dma.Port;
197
198 if (PartialDescriptor->Flags & CM_RESOURCE_DMA_8)
199 PortConfiguration->DmaWidth = Width8Bits;
200 else if ((PartialDescriptor->Flags & CM_RESOURCE_DMA_16) ||
201 (PartialDescriptor->Flags & CM_RESOURCE_DMA_8_AND_16))
202 PortConfiguration->DmaWidth = Width16Bits;
203 else if (PartialDescriptor->Flags & CM_RESOURCE_DMA_32)
204 PortConfiguration->DmaWidth = Width32Bits;
205 }
206 else if (Dma == 1)
207 {
208 PortConfiguration->DmaChannel2 = PartialDescriptor->u.Dma.Channel;
209 PortConfiguration->DmaPort2 = PartialDescriptor->u.Dma.Port;
210
211 if (PartialDescriptor->Flags & CM_RESOURCE_DMA_8)
212 PortConfiguration->DmaWidth2 = Width8Bits;
213 else if ((PartialDescriptor->Flags & CM_RESOURCE_DMA_16) ||
214 (PartialDescriptor->Flags & CM_RESOURCE_DMA_8_AND_16))
215 PortConfiguration->DmaWidth2 = Width16Bits;
216 else if (PartialDescriptor->Flags & CM_RESOURCE_DMA_32)
217 PortConfiguration->DmaWidth2 = Width32Bits;
218 }
219 Dma++;
220 break;
221
222 default:
223 DPRINT1("Other: %u\n", PartialDescriptor->Type);
224 break;
225 }
226 }
227
228 /* Advance to next CM_FULL_RESOURCE_DESCRIPTOR block in memory. */
229 FullDescriptor = (PCM_FULL_RESOURCE_DESCRIPTOR)(FullDescriptor->PartialResourceList.PartialDescriptors +
230 FullDescriptor->PartialResourceList.Count);
231 }
232}
#define DPRINT1
Definition: precomp.h:8
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
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 CmResourceTypeMemory
Definition: hwresource.cpp:125
#define CmResourceTypeDma
Definition: hwresource.cpp:126
#define CmResourceTypePort
Definition: hwresource.cpp:123
#define CmResourceTypeInterrupt
Definition: hwresource.cpp:124
#define CM_RESOURCE_DMA_8_AND_16
Definition: cmtypes.h:134
#define CM_RESOURCE_DMA_8
Definition: cmtypes.h:131
#define CM_RESOURCE_INTERRUPT_LEVEL_SENSITIVE
Definition: cmtypes.h:143
#define CM_RESOURCE_DMA_32
Definition: cmtypes.h:133
#define CM_RESOURCE_DMA_16
Definition: cmtypes.h:132
#define CM_RESOURCE_INTERRUPT_LATCHED
Definition: cmtypes.h:144
@ Latched
Definition: miniport.h:81
@ LevelSensitive
Definition: miniport.h:80
@ Width16Bits
Definition: miniport.h:106
@ Width8Bits
Definition: miniport.h:105
@ Width32Bits
Definition: miniport.h:107
ULONG RangeLength
Definition: srb.h:42
BOOLEAN RangeInMemory
Definition: srb.h:43
SCSI_PHYSICAL_ADDRESS RangeStart
Definition: srb.h:41
CM_PARTIAL_RESOURCE_LIST PartialResourceList
Definition: hwresource.cpp:160
struct _CM_PARTIAL_RESOURCE_DESCRIPTOR::@396::@402 Dma
union _CM_PARTIAL_RESOURCE_DESCRIPTOR::@396 u
struct _CM_PARTIAL_RESOURCE_DESCRIPTOR::@396::@398 Port
struct _CM_PARTIAL_RESOURCE_DESCRIPTOR::@396::@399 Interrupt
struct _CM_PARTIAL_RESOURCE_DESCRIPTOR::@396::@401 Memory
CM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptors[1]
Definition: hwresource.cpp:119
int32_t INT
Definition: typedefs.h:58
uint32_t ULONG
Definition: typedefs.h:59
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_INTERRUPT_CONFIG _In_opt_ PWDF_OBJECT_ATTRIBUTES _Out_ WDFINTERRUPT * Interrupt
Definition: wdfinterrupt.h:379
_Must_inspect_result_ _In_ WDFIORESREQLIST _In_opt_ PWDF_OBJECT_ATTRIBUTES _Out_ WDFIORESLIST * ResourceList
Definition: wdfresource.h:309

Referenced by MiniportInitialize().

◆ InitializeConfiguration()

static NTSTATUS InitializeConfiguration ( _In_ PPORT_CONFIGURATION_INFORMATION  PortConfig,
_In_ PHW_INITIALIZATION_DATA  InitData,
_In_ ULONG  BusNumber,
_In_ ULONG  SlotNumber 
)
static

Definition at line 20 of file miniport.c.

25{
27 ULONG i;
28
29 DPRINT1("InitializeConfiguration(%p %p %lu %lu)\n",
30 PortConfig, InitData, BusNumber, SlotNumber);
31
32 /* Get the configurration information */
33 ConfigInfo = IoGetConfigurationInformation();
34
35 /* Initialize the port configuration */
36 RtlZeroMemory(PortConfig,
38
39 PortConfig->Length = sizeof(PORT_CONFIGURATION_INFORMATION);
40 PortConfig->SystemIoBusNumber = BusNumber;
41 PortConfig->SlotNumber = SlotNumber;
42 PortConfig->AdapterInterfaceType = InitData->AdapterInterfaceType;
43
44 PortConfig->MaximumTransferLength = SP_UNINITIALIZED_VALUE;
45 PortConfig->DmaChannel = SP_UNINITIALIZED_VALUE;
46 PortConfig->DmaPort = SP_UNINITIALIZED_VALUE;
47
48 PortConfig->InterruptMode = LevelSensitive;
49
50 PortConfig->Master = TRUE;
51 PortConfig->AtdiskPrimaryClaimed = ConfigInfo->AtDiskPrimaryAddressClaimed;
52 PortConfig->AtdiskSecondaryClaimed = ConfigInfo->AtDiskSecondaryAddressClaimed;
53 PortConfig->Dma32BitAddresses = TRUE;
54 PortConfig->DemandMode = FALSE;
55 PortConfig->MapBuffers = InitData->MapBuffers;
56
57 PortConfig->NeedPhysicalAddresses = TRUE;
58 PortConfig->TaggedQueuing = TRUE;
59 PortConfig->AutoRequestSense = TRUE;
60 PortConfig->MultipleRequestPerLu = TRUE;
61 PortConfig->ReceiveEvent = InitData->ReceiveEvent;
62 PortConfig->RealModeInitialized = FALSE;
63 PortConfig->BufferAccessScsiPortControlled = TRUE;
64 PortConfig->MaximumNumberOfTargets = SCSI_MAXIMUM_TARGETS_PER_BUS;
65
66 PortConfig->SpecificLuExtensionSize = InitData->SpecificLuExtensionSize;
67 PortConfig->SrbExtensionSize = InitData->SrbExtensionSize;
68 PortConfig->MaximumNumberOfLogicalUnits = SCSI_MAXIMUM_LOGICAL_UNITS;
69 PortConfig->WmiDataProvider = TRUE;
70
71 PortConfig->NumberOfAccessRanges = InitData->NumberOfAccessRanges;
72 DPRINT1("NumberOfAccessRanges: %lu\n", PortConfig->NumberOfAccessRanges);
73 if (PortConfig->NumberOfAccessRanges != 0)
74 {
75 PortConfig->AccessRanges = ExAllocatePoolWithTag(NonPagedPool,
76 PortConfig->NumberOfAccessRanges * sizeof(ACCESS_RANGE),
78 if (PortConfig->AccessRanges == NULL)
79 return STATUS_NO_MEMORY;
80
81 RtlZeroMemory(PortConfig->AccessRanges,
82 PortConfig->NumberOfAccessRanges * sizeof(ACCESS_RANGE));
83 }
84
85 for (i = 0; i < RTL_NUMBER_OF(PortConfig->InitiatorBusId); i++)
86 {
87 PortConfig->InitiatorBusId[i] = (CCHAR)SP_UNINITIALIZED_VALUE;
88 }
89
90 return STATUS_SUCCESS;
91}
#define RTL_NUMBER_OF(x)
Definition: RtlRegistry.c:12
#define NULL
Definition: types.h:112
#define SCSI_MAXIMUM_TARGETS_PER_BUS
Definition: srb.h:22
#define SCSI_MAXIMUM_LOGICAL_UNITS
Definition: srb.h:21
struct _PORT_CONFIGURATION_INFORMATION PORT_CONFIGURATION_INFORMATION
#define SP_UNINITIALIZED_VALUE
Definition: srb.h:232
#define TAG_ACCRESS_RANGE
Definition: precomp.h:29
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
#define NonPagedPool
Definition: env_spec_w32.h:307
PCONFIGURATION_INFORMATION NTAPI IoGetConfigurationInformation(VOID)
Returns a pointer to the I/O manager's global configuration information structure.
Definition: iorsrce.c:998
#define STATUS_NO_MEMORY
Definition: ntstatus.h:260
#define STATUS_SUCCESS
Definition: shellext.h:65
BOOLEAN AtDiskPrimaryAddressClaimed
Definition: iotypes.h:4482
BOOLEAN AtDiskSecondaryAddressClaimed
Definition: iotypes.h:4483
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
char CCHAR
Definition: typedefs.h:51
_In_ WDFIORESREQLIST _In_ ULONG SlotNumber
Definition: wdfresource.h:68
_In_opt_ PUNICODE_STRING _In_ PDRIVER_OBJECT _In_ PDEVICE_OBJECT _In_ INTERFACE_TYPE _In_ ULONG BusNumber
Definition: halfuncs.h:160

Referenced by MiniportInitialize().

◆ MiniportFindAdapter()

NTSTATUS MiniportFindAdapter ( _In_ PMINIPORT  Miniport)

Definition at line 285 of file miniport.c.

287{
291
292 DPRINT1("MiniportFindAdapter(%p)\n", Miniport);
293
294 /* Call the miniport HwFindAdapter routine */
295 Result = Miniport->InitData->HwFindAdapter(&Miniport->MiniportExtension->HwDeviceExtension,
296 NULL,
297 NULL,
298 NULL,
299 &Miniport->PortConfig,
300 &Reserved);
301 DPRINT1("HwFindAdapter() returned %lu\n", Result);
302
303 /* Convert the result to a status code */
304 switch (Result)
305 {
307 DPRINT1("SP_RETURN_NOT_FOUND\n");
309 break;
310
311 case SP_RETURN_FOUND:
312 DPRINT1("SP_RETURN_FOUND\n");
314 break;
315
316 case SP_RETURN_ERROR:
317 DPRINT1("SP_RETURN_ERROR\n");
319 break;
320
322 DPRINT1("SP_RETURN_BAD_CONFIG\n");
324 break;
325
326 default:
327 DPRINT1("Unknown result: %lu\n", Result);
329 break;
330 }
331
332 return Status;
333}
unsigned char BOOLEAN
LONG NTSTATUS
Definition: precomp.h:26
#define SP_RETURN_ERROR
Definition: srb.h:523
#define SP_RETURN_FOUND
Definition: srb.h:522
#define SP_RETURN_BAD_CONFIG
Definition: srb.h:524
#define SP_RETURN_NOT_FOUND
Definition: srb.h:521
Status
Definition: gdiplustypes.h:25
#define STATUS_INTERNAL_ERROR
Definition: ntstatus.h:465
#define STATUS_DEVICE_CONFIGURATION_ERROR
Definition: ntstatus.h:619
#define STATUS_ADAPTER_HARDWARE_ERROR
Definition: ntstatus.h:430
#define STATUS_NOT_FOUND
Definition: shellext.h:72
_Reserved_ PVOID Reserved
Definition: winddi.h:3974
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
Definition: wsk.h:409

Referenced by PortFdoStartMiniport().

◆ MiniportHwInitialize()

NTSTATUS MiniportHwInitialize ( _In_ PMINIPORT  Miniport)

Definition at line 337 of file miniport.c.

339{
341
342 DPRINT1("MiniportHwInitialize(%p)\n", Miniport);
343
344 /* Call the miniport HwInitialize routine */
345 Result = Miniport->InitData->HwInitialize(&Miniport->MiniportExtension->HwDeviceExtension);
346 DPRINT1("HwInitialize() returned %u\n", Result);
347
349}
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132

Referenced by PortFdoStartMiniport().

◆ MiniportHwInterrupt()

BOOLEAN MiniportHwInterrupt ( _In_ PMINIPORT  Miniport)

Definition at line 353 of file miniport.c.

355{
357
358 DPRINT1("MiniportHwInterrupt(%p)\n",
359 Miniport);
360
361 Result = Miniport->InitData->HwInterrupt(&Miniport->MiniportExtension->HwDeviceExtension);
362 DPRINT1("HwInterrupt() returned %u\n", Result);
363
364 return Result;
365}

Referenced by PortFdoInterruptRoutine().

◆ MiniportInitialize()

NTSTATUS MiniportInitialize ( _In_ PMINIPORT  Miniport,
_In_ PFDO_DEVICE_EXTENSION  DeviceExtension,
_In_ PHW_INITIALIZATION_DATA  InitData 
)

Definition at line 236 of file miniport.c.

240{
241 PMINIPORT_DEVICE_EXTENSION MiniportExtension;
242 ULONG Size;
244
245 DPRINT1("MiniportInitialize(%p %p %p)\n",
246 Miniport, DeviceExtension, InitData);
247
248 Miniport->DeviceExtension = DeviceExtension;
249 Miniport->InitData = InitData;
250
251 /* Calculate the miniport device extension size */
253 Miniport->InitData->DeviceExtensionSize;
254
255 /* Allocate and initialize the miniport device extension */
256 MiniportExtension = ExAllocatePoolWithTag(NonPagedPool,
257 Size,
259 if (MiniportExtension == NULL)
260 return STATUS_NO_MEMORY;
261
262 RtlZeroMemory(MiniportExtension, Size);
263
264 MiniportExtension->Miniport = Miniport;
265 Miniport->MiniportExtension = MiniportExtension;
266
267 /* Initialize the port configuration */
268 Status = InitializeConfiguration(&Miniport->PortConfig,
269 InitData,
270 DeviceExtension->BusNumber,
271 DeviceExtension->SlotNumber);
272 if (!NT_SUCCESS(Status))
273 return Status;
274
275 /* Assign the resources to the port configuration */
276 AssignResourcesToConfiguration(&Miniport->PortConfig,
277 DeviceExtension->AllocatedResources,
278 InitData->NumberOfAccessRanges);
279
280 return STATUS_SUCCESS;
281}
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define TAG_MINIPORT_DATA
Definition: precomp.h:28
struct _MINIPORT_DEVICE_EXTENSION MINIPORT_DEVICE_EXTENSION
static VOID AssignResourcesToConfiguration(_In_ PPORT_CONFIGURATION_INFORMATION PortConfiguration, _In_ PCM_RESOURCE_LIST ResourceList, _In_ ULONG NumberOfAccessRanges)
Definition: miniport.c:96
static NTSTATUS InitializeConfiguration(_In_ PPORT_CONFIGURATION_INFORMATION PortConfig, _In_ PHW_INITIALIZATION_DATA InitData, _In_ ULONG BusNumber, _In_ ULONG SlotNumber)
Definition: miniport.c:20
struct _MINIPORT * Miniport
Definition: precomp.h:72
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
Definition: wdfdevice.h:4533

◆ MiniportStartIo()

BOOLEAN MiniportStartIo ( _In_ PMINIPORT  Miniport,
_In_ PSCSI_REQUEST_BLOCK  Srb 
)

Definition at line 369 of file miniport.c.

372{
374
375 DPRINT1("MiniportHwStartIo(%p %p)\n",
376 Miniport, Srb);
377
378 Result = Miniport->InitData->HwStartIo(&Miniport->MiniportExtension->HwDeviceExtension, Srb);
379 DPRINT1("HwStartIo() returned %u\n", Result);
380
381 return Result;
382}
_In_ PSCSI_REQUEST_BLOCK Srb
Definition: cdrom.h:989