get pnp allocated resources

Hi,

I am to convert a nt4 driver to pnp compatible to run on windows server 2008.
Presently I am using IOAssignResources, HalGetinterruptvector() and then the translated allocated resources[level, vector, affinity] recieved from HalGetinterruptvector() is passed to IOConnectInterrupt to register an ISR.
I am using a timer based interrupt in the old driver.

Now I have to remove the IOAssignResources, HalGetinterruptvector() functions since the driver is pnp it should directly give me the translated allocated resources in the IRP_MN_START_DEVICE IRP.

But in my case I am not getting the allocated resources.
My driver is a virtual driver and so has no device id. So I think that the pnp manager may not be able to allocate the resources.

Is there anyway to get the allocated resources for the virtual driver I have ?

RKP

Could you give more details how come that your virtual
driver should touch a real hardware?
Does it use the resources of some other device or the system board?
Should it be converted to a PnP filter driver or something else?

– pa

xxxxx@patni.com wrote:

Hi,

I am to convert a nt4 driver to pnp compatible to run on windows server 2008.
Presently I am using IOAssignResources, HalGetinterruptvector() and then the translated allocated resources[level, vector, affinity] recieved from HalGetinterruptvector() is passed to IOConnectInterrupt to register an ISR.
I am using a timer based interrupt in the old driver.

Now I have to remove the IOAssignResources, HalGetinterruptvector() functions since the driver is pnp it should directly give me the translated allocated resources in the IRP_MN_START_DEVICE IRP.

But in my case I am not getting the allocated resources.
My driver is a virtual driver and so has no device id. So I think that the pnp manager may not be able to allocate the resources.

Is there anyway to get the allocated resources for the virtual driver I have ?

RKP

Thanks Pavel for the reply.

The present driver is a virtual driver and reads data directly from a pin of a hardware chip.
The present virtual driver registers a system timer interrupt at irq 0. At each interrupt it reads the data directly from the hardware port using functions like _inbyte etc. So to register the IRQ, interrupt it uses IOAssignResources, HalGetinterruptvector().
Also the interrupt type is ISA.
Since the HalGetinterruptvector is failing in nt5 we are not able to register the interrupt, we are to convert it to pnp compatible so that we can get the allocated resources.

As per the DDK help I tried using IoReportResourceForDetection in adddevice but it fails with error “conflicting address” might be because of the IRQ 0 which are using.

Look up LogConfig in the WDK documentation, it tells you how to specify
resources in the INF file that will then be provided to the driver. You
should not need to do any special coding in the driver to get the resources.


Don Burn (MVP, Windows DDK)
Windows Filesystem and Driver Consulting
Website: http://www.windrvr.com
Blog: http://msmvps.com/blogs/WinDrvr

wrote in message news:xxxxx@ntdev…
> Thanks Pavel for the reply.
>
> The present driver is a virtual driver and reads data directly from a pin
> of a hardware chip.
> The present virtual driver registers a system timer interrupt at irq 0. At
> each interrupt it reads the data directly from the hardware port using
> functions like _inbyte etc. So to register the IRQ, interrupt it uses
> IOAssignResources, HalGetinterruptvector().
> Also the interrupt type is ISA.
> Since the HalGetinterruptvector is failing in nt5 we are not able to
> register the interrupt, we are to convert it to pnp compatible so that we
> can get the allocated resources.
>
> As per the DDK help I tried using IoReportResourceForDetection in
> adddevice but it fails with error “conflicting address” might be because
> of the IRQ 0 which are using.
>
>
>
> Information from ESET NOD32 Antivirus, version of virus
> signature database 4140 (20090609)

>
> The message was checked by ESET NOD32 Antivirus.
>
> http://www.eset.com
>
>
>

Information from ESET NOD32 Antivirus, version of virus signature database 4140 (20090609)

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com

Hi Don,

Will you please eloborate the need for the use of logconfig and not converting the driver to pnp.

You have it wrong. You convert the driver to PnP, but since the resources
are not PnP in the sense that they do not have a PnP Identifier you can
indicate the driver should load for, you instead put the resources you want
in the INF file. The Plug and Play subsystem will then give you those
resources assigned to your driver in the AddDevice routine. Take a look at
http://msdn.microsoft.com/en-us/library/ms794353.aspx


Don Burn (MVP, Windows DDK)
Windows Filesystem and Driver Consulting
Website: http://www.windrvr.com
Blog: http://msmvps.com/blogs/WinDrvr

wrote in message news:xxxxx@ntdev…
> Hi Don,
>
> Will you please eloborate the need for the use of logconfig and not
> converting the driver to pnp.
>
>
>
> Information from ESET NOD32 Antivirus, version of virus
> signature database 4140 (20090609)

>
> The message was checked by ESET NOD32 Antivirus.
>
> http://www.eset.com
>
>
>

Information from ESET NOD32 Antivirus, version of virus signature database 4140 (20090609)

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com

First, ‘virtual’ means no (none, not any, nothing) hardware.

Second, NT4 provided timer callbacks so hacking and getting your driver on
the hardware timer interrupt was and remains a bad idea. There are several
different timer callbacks provided in current operating systems. Each
miniport seems to have their own version even if it is just a wrapper around
one of the standard ones.

Third, follow Don’s advice to place your hardware resources in the INF file
since they are not PnP. Note, that if your driver is using standard
hardware resources normally used by the HAL or other parts of the OS, it
probably will not work.

Fourth, if the hardware is not a standard chipset device you might consider
having it redesigned to be a PnP device on a standard bus such as PCI, USB,
etc.

wrote in message news:xxxxx@ntdev…
> Hi,
>
> I am to convert a nt4 driver to pnp compatible to run on windows server
> 2008.
> Presently I am using IOAssignResources, HalGetinterruptvector() and then
> the translated allocated resources[level, vector, affinity] recieved
> from HalGetinterruptvector() is passed to IOConnectInterrupt to register
> an ISR.
> I am using a timer based interrupt in the old driver.
>
> Now I have to remove the IOAssignResources, HalGetinterruptvector()
> functions since the driver is pnp it should directly give me the
> translated allocated resources in the IRP_MN_START_DEVICE IRP.
>
> But in my case I am not getting the allocated resources.
> My driver is a virtual driver and so has no device id. So I think that the
> pnp manager may not be able to allocate the resources.
>
> Is there anyway to get the allocated resources for the virtual driver I
> have ?
>
> RKP
>
>

xxxxx@patni.com wrote:

Thanks Pavel for the reply.

The present driver is a virtual driver and reads data directly from a pin of a hardware chip.
The present virtual driver registers a system timer interrupt at irq 0. At each interrupt it reads the data directly from the hardware port using functions like _inbyte etc. So to register the IRQ, interrupt it uses IOAssignResources, HalGetinterruptvector().
Also the interrupt type is ISA.
Since the HalGetinterruptvector is failing in nt5 we are not able to register the interrupt, we are to convert it to pnp compatible so that we can get the allocated resources.

As per the DDK help I tried using IoReportResourceForDetection in adddevice but it fails with error “conflicting address” might be because of the IRQ 0 which are using.

What is this “hardware chip”? a GPIO pin of the CPU,
or something attached to PCI, or to a serial/parallel port??

– pa

yes pavel its a gpio pin of the cpu

I tried using Logconfig. But was not successful.
FYI in the present driver the chip mentioned is actually the gpio pin of the cpu.

To convert the drv to pnp:

  1. In the driverentry I am only setting the entrypoint routines.
  2. In the adddevice I am creating device, attaching it to device stack, creating symbolic link.
  3. In the dispatch routine I am waiting for the IRP_MN_START_DEVICE irp. Now I am not using IOAssignresources, Halgetinterruptvector().
    After doing the Logconfig changes, I was expecting to get the allocated resources in the dispatch pnp in the irp stack, but I did not get it.
    Moreover I did not recieve the IRP_MN_START_DEVICE IRP.

Following are changes I did in the inf file for logconfig:
[Manufacturer]
%CCC%=CCC_MODEL,NTamd64

; CCCInstall below is the DDInstall section of the inf
; CCC_COMPATIBLE_ID below is just a string say “xyz”
[CCC_MODEL]
%CCC_INSTALL%=CCCInstall, %CCC_COMPATIBLE_ID%

[CCCInstall]
.
.
.
LogConfig=get_rescouce

[get_rescoucre]
ConfigPriority=NORMAL
IRQConfig=0

Since I did not have device I did not use something like below in the model section:
Syntax: %< dev id. >.DeviceDesc% = DDInstall,< compatible id >
Eg.: %< dev id. >.DeviceDesc% = CCCInstall,CCC

Do I need to do any more changes to get the resources ?

pavel the present driver is reading the gpio pin. But I will have to confirm whether its a gpio pin of cpu or a hardware attached to the isa bus
Adding some more info:
Presently the driver is running on windows server 2003 while we are to move it to server 2008.
In 2003 the driver was able to get irq 0 from the system timer and assign it to hbd driver but in 2008 its not able to do so

You have to have a model section. For the INF to work you need to treat
this as a device, it is just that you add the LogConfig data to supply the
resources. Take a look at the bus.inf from Toaster, you will need
something similar. And run ChkInf against the INF file and fix all errors
and warnings before trying to load your driver.


Don Burn (MVP, Windows DDK)
Windows Filesystem and Driver Consulting
Website: http://www.windrvr.com
Blog: http://msmvps.com/blogs/WinDrvr

wrote in message news:xxxxx@ntdev…
>I tried using Logconfig. But was not successful.
> FYI in the present driver the chip mentioned is actually the gpio pin of
> the cpu.
>
> To convert the drv to pnp:
> 1) In the driverentry I am only setting the entrypoint routines.
> 2) In the adddevice I am creating device, attaching it to device stack,
> creating symbolic link.
> 3) In the dispatch routine I am waiting for the IRP_MN_START_DEVICE irp.
> Now I am not using IOAssignresources, Halgetinterruptvector().
> After doing the Logconfig changes, I was expecting to get the allocated
> resources in the dispatch pnp in the irp stack, but I did not get it.
> Moreover I did not recieve the IRP_MN_START_DEVICE IRP.
>
> Following are changes I did in the inf file for logconfig:
> [Manufacturer]
> %CCC%=CCC_MODEL,NTamd64
>
> ; CCCInstall below is the DDInstall section of the inf
> ; CCC_COMPATIBLE_ID below is just a string say “xyz”
> [CCC_MODEL]
> %CCC_INSTALL%=CCCInstall, %CCC_COMPATIBLE_ID%
>
>
> [CCCInstall]
> .
> .
> .
> LogConfig=get_rescouce
>
>
> [get_rescoucre]
> ConfigPriority=NORMAL
> IRQConfig=0
>
>
> Since I did not have device I did not use something like below in the
> model section:
> Syntax: %< dev id. >.DeviceDesc% = DDInstall,< compatible id >
> Eg.: %< dev id. >.DeviceDesc% = CCCInstall,CCC
>
>
> Do I need to do any more changes to get the resources ?
>
>
>
> Information from ESET NOD32 Antivirus, version of virus
> signature database 4143 (20090610)

>
> The message was checked by ESET NOD32 Antivirus.
>
> http://www.eset.com
>
>
>

Information from ESET NOD32 Antivirus, version of virus signature database 4143 (20090610)

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com

xxxxx@patni.com wrote:

pavel the present driver is reading the gpio pin. But I will have to confirm whether its a gpio pin of cpu or a hardware attached to the isa bus
Adding some more info:
Presently the driver is running on windows server 2003 while we are to move it to server 2008.
In 2003 the driver was able to get irq 0 from the system timer and assign it to hbd driver but in 2008 its not able to do so

The i/o resource and interrupt 0 are two independent issues.
So, WS2008 is not likely to give you irq 0 any longer - anything
unsupported breaks sooner or later.
Why not to use the standard kernel timers?

– pa

Don I tried using the syntax for model device as in toaster’s bus.inf. But still did not succeed. As said earlier did not recieve the needed IRP_MN_START_DEVICE IRP and the resources.
In device manager in the properties of my driver the resources tab gets added but not the resources.
I think pavel is right that win2k8 will not take the irq0 from the system timer and give it to my driver.
I may have to look for some free irq.

Pavel regarding the kernel timers I will have to explore the suggestion.
But is not there any other way to recieve the interrupt like using IRQ which is presntly failing ?

You had asked about the gpio pin ? Do you have any inputs related to that ?

What does the SetupApi log indicate? What are you going to do with a “free
irq”? There is nothing to trigger it.


Don Burn (MVP, Windows DDK)
Windows Filesystem and Driver Consulting
Website: http://www.windrvr.com
Blog: http://msmvps.com/blogs/WinDrvr

wrote in message news:xxxxx@ntdev…
> Don I tried using the syntax for model device as in toaster’s bus.inf. But
> still did not succeed. As said earlier did not recieve the needed
> IRP_MN_START_DEVICE IRP and the resources.
> In device manager in the properties of my driver the resources tab gets
> added but not the resources.
> I think pavel is right that win2k8 will not take the irq0 from the system
> timer and give it to my driver.
> I may have to look for some free irq.
>
>
>
> Information from ESET NOD32 Antivirus, version of virus
> signature database 4147 (20090611)

>
> The message was checked by ESET NOD32 Antivirus.
>
> http://www.eset.com
>
>
>

Information from ESET NOD32 Antivirus, version of virus signature database 4147 (20090611)

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com

oh yes don even if get a free irq there will be no thing to trigger it.
I did not use the setupapi of the toaster example. I built my driver and installed it using devcon.
I modified the drivers inf file as in the bus.inf.

xxxxx@patni.com wrote:

Pavel regarding the kernel timers I will have to explore the suggestion.
But is not there any other way to recieve the interrupt like using IRQ which is presntly failing ?

You had asked about the gpio pin ? Do you have any inputs related to that ?

  1. Use the standard timer: KeSetTimer(Ex).
    Hooking the system timer or other interrupts you don’t own is not good.

  2. Just read the i/o port of the GPIO register (or MSR).
    Chances are it will just work.

Regards,
– pa

we cannot use the kernel timer due to the design restrictions and also its a little unreliable
so we wil have to use some logic based on interrupts.

Unreliable due to latency? Or something else?

d

Sent from my phone with no t9, all spilling mistakes are not intentional.

-----Original Message-----
From: xxxxx@patni.com
Sent: Thursday, June 11, 2009 5:43 AM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] get pnp allocated resources

we cannot use the kernel timer due to the design restrictions and also its a little unreliable
so we wil have to use some logic based on interrupts.


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer