From: krby_xtrm on
Yes, but based on the code i presented. Should I call StartDevice upon
recieving IRP_MN_START_DEVICE in PciWDMPnp?

There in my StartDevice, i think after the iteration, 'portbase' should
have already the start address for I/O mapped resource of my device, is
that correct?

Is the driver ready to perform I/O operation then?
like READ_PORT_xxx(pdx->portbase + offset) ???

krby_xtrm

From: Don Burn on
Yes it looks like you should have called StartDevice upon recieving
IRP_MN_START_DEVICE. Your device is then ready to perform I/O until a stop
device or related occurs.


--
Don Burn (MVP, Windows DDK)
Windows 2k/XP/2k3 Filesystem and Driver Consulting
Remove StopSpam from the email to reply



"krby_xtrm" <kerby.martino(a)gmail.com> wrote in message
news:1135873624.157616.249550(a)g14g2000cwa.googlegroups.com...
> Yes, but based on the code i presented. Should I call StartDevice upon
> recieving IRP_MN_START_DEVICE in PciWDMPnp?
>
> There in my StartDevice, i think after the iteration, 'portbase' should
> have already the start address for I/O mapped resource of my device, is
> that correct?
>
> Is the driver ready to perform I/O operation then?
> like READ_PORT_xxx(pdx->portbase + offset) ???
>
> krby_xtrm
>


From: Pavel A. on
"krby_xtrm" wrote:
> Yes, but based on the code i presented. Should I call StartDevice upon
> recieving IRP_MN_START_DEVICE in PciWDMPnp?

This depends on your situation. For example, the pcidrv sample from
the DDK 3790.1830 delays the StartDevice processing in the driver
using a worker item. Study this sample, read the comments Eliyas put there...

--PA

> There in my StartDevice, i think after the iteration, 'portbase' should
> have already the start address for I/O mapped resource of my device, is
> that correct?
>
> Is the driver ready to perform I/O operation then?
> like READ_PORT_xxx(pdx->portbase + offset) ???
>
> krby_xtrm
>
>
From: krby_xtrm on
i found this thread:
http://groups.google.com/group/microsoft.public.development.device.drivers/browse_thread/thread/214d3c196479ce01/c687b1aa693e043d?q=pci+startdevice&rnum=6#c687b1aa693e043d

my question is, is that the right way to call StartDevice routine?

-krby-

From: krby_xtrm on
// This is my complete Pnp Dispatch routine:
NTSTATUS PciWDMPnp (IN PDEVICE_OBJECT fdo, IN PIRP Irp)
{
DbgPrint(DRIVERNAME " - Begin WDM Pnp");

PDEVICE_EXTENSION pdx = (PDEVICE_EXTENSION)fdo->DeviceExtension;
PIO_STACK_LOCATION IrpStack = IoGetCurrentIrpStackLocation(Irp); //
obtain current IRP

ULONG MinorFunction = IrpStack->MinorFunction;

// sends an IRP to the driver associated with a specified device
object.
// pdx->LowerDeviceObject, representing the target device for the
requested I/O operation.
NTSTATUS status = IoCallDriver(pdx->LowerDeviceObject, Irp);

// then pass down this Minor Function for the next driver stack:
IoSkipCurrentIrpStackLocation(Irp);

// added 12-30-05
PCM_PARTIAL_RESOURCE_LIST raw;
PCM_PARTIAL_RESOURCE_LIST translated;

switch(MinorFunction)
{
case IRP_MN_START_DEVICE:
// we should check the allocated resource...
KdPrint((DRIVERNAME " - IRP_MN_START_DEVICE"));
if (NULL == IrpStack->Parameters.StartDevice.AllocatedResources) ||
(NULL ==
IrpStack->Parameters.StartDevice.AllocatedResources.Translated)){
status = STATUS_INSUFFICIENT_RESOURCES;
break;
}
raw =
&IrpStack->Parameters.StartDevice.AllocatedResources->List[0].PartialResourceList;
translated =
&IrpStack->Parameters.StartDevice.AllocatedResourcesTranslated->List[0].PartialResourceList;
StartDevice(fdo, raw, translated);
// ~added 12-30-05
case IRP_MN_REMOVE_DEVICE:
KdPrint((DRIVERNAME " - IRP_MN_REMOVE_DEVICE"));
if(pdx->LowerDeviceObject)
IoDetachDevice(pdx->LowerDeviceObject);
IoDeleteDevice(fdo); // delete fdo
break;
}
// call the device below us
IoSkipCurrentIrpStackLocation(Irp);
return IoCallDriver(pdx->LowerDeviceObject, Irp);
}