Hi all:
Been away from WDM for a bit and need some refreshing. Please bear with me.
In general…How does one get the pci configuration space information of
one’s device in DriverEntry. Do you use
IRP_MN_READ_CONFIG/IRP_MN_WRITE_CONFIG?
I have seen a sample of code in the DDK that initializes an IRP, uses
IOGetAttachedDeviceReference (routine takes a DeviceObject as argument to
obtain a ‘targetObject’) and the issues the irp to this targetObject to
config info. If I create a DeviceObject in DriverEntry and then make this
call, will I obtain the correct config space information? Does this method
work across Win2000, WinXP, and Win98???
Is there any OS supported way to enumerate the pci bus(ala HalGetBusData) in
DriverEntry?
Thanks for any information and suggestions.
-Barry
For a WDM driver you should device specific stuff when you get
IRP_MN_START_DEVICE. Your DriverEntry should just initialize driver specific
stuff. When you get a start IRP you can actually send an IRP called
IRP_MN_QUERY_INTERFACE to your bus driver with GUID_BUS_INTERFACE_STANDARD.
PCI bus driver exposes GetBusData and SetBusData interfaces via the
structure BUS_INTERFACE_STANDARD. You can use this to read the config space.
In theory you don’t need these interfaces because PnP passes the device’s
configuration information as parameters to the START IRP and you should rely
on those.
–
Nar Ganapathy
Windows Core OS group
This posting is provided “AS IS” with no warranties, and confers no rights.
“Fisher, Barry” wrote in message
news:xxxxx@ntdev…
>
> Hi all:
> Been away from WDM for a bit and need some refreshing. Please bear with
me.
> In general…How does one get the pci configuration space information of
> one’s device in DriverEntry. Do you use
> IRP_MN_READ_CONFIG/IRP_MN_WRITE_CONFIG?
> I have seen a sample of code in the DDK that initializes an IRP, uses
> IOGetAttachedDeviceReference (routine takes a DeviceObject as argument to
> obtain a ‘targetObject’) and the issues the irp to this targetObject to
> config info. If I create a DeviceObject in DriverEntry and then make this
> call, will I obtain the correct config space information? Does this method
> work across Win2000, WinXP, and Win98???
>
> Is there any OS supported way to enumerate the pci bus(ala HalGetBusData)
in
> DriverEntry?
>
> Thanks for any information and suggestions.
> -Barry
>
>
>
In DriverEntry, if you absolutely have to do it there you can still run the
PCI bus using the HAL functions. True they are deprecated in 2000 and
above, but then doing this in DE is fairly deprecated in and of itself.
Using the IRP_MN_READ/WRITE_CONFIG in AddDevice is the recommended way, but
is going to require the proper underlying PDO, supplied by the call to
AddDevice. You don’t have that PDO, or any DO for that matter, in DE, so the
chances are moot of that working without you doing a hell of a lot of work
to find the proper PDO. Once you done the AddDevice logic, most of what you
is going to be presented during IRP_MN_START_DEVICE.
–
Gary G. Little
xxxxx@broadstor.com
xxxxx@inland.net
“Fisher, Barry” wrote in message
news:xxxxx@ntdev…
>
> Hi all:
> Been away from WDM for a bit and need some refreshing. Please bear with
me.
> In general…How does one get the pci configuration space information of
> one’s device in DriverEntry. Do you use
> IRP_MN_READ_CONFIG/IRP_MN_WRITE_CONFIG?
> I have seen a sample of code in the DDK that initializes an IRP, uses
> IOGetAttachedDeviceReference (routine takes a DeviceObject as argument to
> obtain a ‘targetObject’) and the issues the irp to this targetObject to
> config info. If I create a DeviceObject in DriverEntry and then make this
> call, will I obtain the correct config space information? Does this method
> work across Win2000, WinXP, and Win98???
>
> Is there any OS supported way to enumerate the pci bus(ala HalGetBusData)
in
> DriverEntry?
>
> Thanks for any information and suggestions.
> -Barry
>
>
>
For getting the PCI info you desire from your device:
http://support.microsoft.com/default.aspx?ID=KB;EN-US;Q253232&
As far as using HAL functions for PCI config info, as I understand it, they
do not work correctly, (i.e. the slot info and such that you get back may be
incorrect). I would not use these functions.
–
Bill McKenzie
Windows DDK MVP
OSR - Windows System Software Development, Training, and Consulting
“Fisher, Barry” wrote in message
news:xxxxx@ntdev…
>
> Hi all:
> Been away from WDM for a bit and need some refreshing. Please bear with
me.
> In general…How does one get the pci configuration space information of
> one’s device in DriverEntry. Do you use
> IRP_MN_READ_CONFIG/IRP_MN_WRITE_CONFIG?
> I have seen a sample of code in the DDK that initializes an IRP, uses
> IOGetAttachedDeviceReference (routine takes a DeviceObject as argument to
> obtain a ‘targetObject’) and the issues the irp to this targetObject to
> config info. If I create a DeviceObject in DriverEntry and then make this
> call, will I obtain the correct config space information? Does this method
> work across Win2000, WinXP, and Win98???
>
> Is there any OS supported way to enumerate the pci bus(ala HalGetBusData)
in
> DriverEntry?
>
> Thanks for any information and suggestions.
> -Barry
>
>
>