hi all,
as the HalGetBusData() is depricated, what is the alternate of that?
as per MS documentation we can use IRP_MN_QUERY_INTERFACE and IRP_MN_READ_CONFIG.
i am not clear about the documentation, what it has to do? if i am writing a generic driver and i have to access the pci related information what is the approach?
here is what i am doing,
- Build Irp - IoAllocateIrp()
- get the current Irp stac location and fill the information like Major function as pnp and minor as query infromation,
- parameter in queryinterface - GUID_PCI_BUS_INTERFACE_STANDARD
- then i am calling IoCallDriver()
and my driver crashes at this call? as it throws the error of not setting up the stack location.?
how to set the lower layer stack location whcih is for pci?
also let me know if my approach is not right
thanks,
Hitesh
is this a pnp driver or a driver where you are creating device objects in DriverEntry()? are you being loaded for a specific piece of hardware or are you just trying to probe the entire pci bus?
d
hi Doron,
it is a generic driver and not a Pnp.
Right now i am not creating any device object as i am not referring to any physical device.
but yes i am trying to read any space of any bus,
like function 0 to 31 and bus 0 to n, etc,
is it possible to create a device object for such a situation?
or i can’t create?
thnaks,
Hitesh
When you say generic are you trying to access one devices config space
or a lot of devices. If it one device, convert your driver to PnP and
put it in the stack. Then you can use the interfaces, see the excellent
article on the subject at http://www.hollistech.com/ under Resources.
If you want a driver to access any config space, then you need a PCI bus
filter.
Don Burn (MVP, Windows DKD)
Windows Filesystem and Driver Consulting
Website: http://www.windrvr.com
Blog: http://msmvps.com/blogs/WinDrvr
“xxxxx@yahoo.co.in” wrote in message
news:xxxxx@ntdev:
> hi Doron,
> it is a generic driver and not a Pnp.
> Right now i am not creating any device object as i am not referring to any physical device.
> but yes i am trying to read any space of any bus,
> like function 0 to 31 and bus 0 to n, etc,
>
> is it possible to create a device object for such a situation?
> or i can’t create?
> thnaks,
> Hitesh
xxxxx@yahoo.co.in wrote:
it is a generic driver and not a Pnp.
Right now i am not creating any device object as i am not referring to any physical device.
but yes i am trying to read any space of any bus,
like function 0 to 31 and bus 0 to n, etc,
is it possible to create a device object for such a situation?
or i can’t create?
The problem is that what you are asking is dangerous. In order to
access PCI configuration space at the lowest level, you have to use an
index/data register pair. You write the index to one location, then
read or write the data from another location. There is no interlocking
for this operation. So, if another driver is in the middle of a config
space operation, and you come in on your own, you will screw up both
operations.
The IRP_MN_READ_CONFIG and IRP_MN_WRITE_CONFIG requests do not have this
problem, because they are handled by the PCI driver, which “owns” config
space. It will make sure the operations are done atomically. However,
you can’t issue those requests from an arbitrary driver. They can only
be sent from a driver stack that is handling the device that is being
queried.
How serious is this problem? Well, that depends. There have certainly
been crashes caused by this problem (Don has some horror stories), but
they are admittedly rare. If you are writing a driver to be released to
the general public, then you need to be doing things the Right Way.
That means writing a PCI bus filter driver, so that your driver
participates in ALL of the device stacks. That’s not easy, because bus
filters are not documented. On the other hand, there are not very many
good reasons for a driver to access the configuration space for other
devices.
If you are writing a driver for debug purposes to be used inside your
laboratory, then you can probably decide that the risk is worth taking.
That’s a decision only you can make.
–
Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.
The core question here is “why do you need to do this?” and “What are you
going to do with this information when you have it?” The correct answer
would depend on knowing what you expect to discover and how you expect to
use the information. Partly this is because, for certain purposes, the
correct answer is “don’t do that!”
joe
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of
xxxxx@yahoo.co.in
Sent: Monday, January 31, 2011 4:51 AM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] replacement of HalGetBusData()
hi Doron,
it is a generic driver and not a Pnp.
Right now i am not creating any device object as i am not referring to any
physical device.
but yes i am trying to read any space of any bus,
like function 0 to 31 and bus 0 to n, etc,
is it possible to create a device object for such a situation?
or i can’t create?
thnaks,
Hitesh
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
–
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
The concept of a “generic” PCI driver is a bit scary. You should probably
consider writing a generic PnP driver which is keyed to a particular PCI
vender/deviceid or better still vendor/deviceid/subvendor/subdeviceid tuple.
I’m not sure I can envision the value to having a “generic PCI driver”
except as a starting point for writing real drivers derived from it. In a
given instance of a driver, you would then specify (in the .INF file) the
information that causes this driver to load. You would find out the real
information in the raw and translated resources that come in with the
IRP_MJ_PNP:IRP_MN_START_DEVICE notification. The reason that HalGetBusData
is deprecated is that it has been completely replaced by better mechanisms,
and for good reasons.
joe
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of
xxxxx@yahoo.co.in
Sent: Monday, January 31, 2011 2:45 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] replacement of HalGetBusData()
hi all,
as the HalGetBusData() is depricated, what is the alternate of that?
as per MS documentation we can use IRP_MN_QUERY_INTERFACE and
IRP_MN_READ_CONFIG.
i am not clear about the documentation, what it has to do? if i am writing a
generic driver and i have to access the pci related information what is the
approach?
here is what i am doing,
- Build Irp - IoAllocateIrp()
- get the current Irp stac location and fill the information like Major
function as pnp and minor as query infromation,
- parameter in queryinterface - GUID_PCI_BUS_INTERFACE_STANDARD
- then i am calling IoCallDriver()
and my driver crashes at this call? as it throws the error of not setting up
the stack location.?
how to set the lower layer stack location whcih is for pci?
also let me know if my approach is not right
thanks,
Hitesh
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
–
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
hi all,
my aim is to find the information about the each device connected to the pci bus.
like with the function HalGetBusData() i can scan the full bus starting from function 0 to n, bus 0 to n, like etc.
which i can’t do in my generic driver without using the function HalGetBusData().
as per the solutions provided on web and other samples, i found that i need a device object to send the irp for read and write. and the device objecy will be of perticular device which i can’t use for all device.
- is it the only way by making filter driver of pci bus?
- if there is anyother solution by whcih i can send request to any drivers and get the value,
thanks,
Hitesh
is this for personal knowledge? a product? once you have that list, what do you want to do with it? the point is that your poking around to devices that you do not actually own the hw resources to can be disruptive to the system. Windows was not designed to allow you to do this starting in windows 2000.
d
yes it is for personal purpose.
i read abt the win 2000 and its changes.
but what i am wondering is we can see the complete list of device in device manager.
so it must be supporting some or other interface or driver.
is it through WMI interface?
Hitesh
> is it through WMI interface?
Via CM_xxx and SetupDiXxx, but the Device Manager’s information is the information known to PnP, which is gathered by PCI.SYS which runs some standard poking procedure on PCI config space.
You cannot gather any non-standard information this way.
–
Maxim S. Shatskih
Windows DDK MVP
xxxxx@storagecraft.com
http://www.storagecraft.com
hi maxim,
i was aware about the CM_xxx and SetupDixxx which i have used and it workes fine.
but what i am looking for services of PCI.sys or any other lowest layer driver or API,
like is there any ioctl call or anything which will return info like read write for each request of bus,device,function.
i am looking it in driver not in application.
thanks,
Hitesh
> but what i am looking for services of PCI.sys or any other lowest layer driver or API,
There is no such services.
Yes, Windows from 2000 up made the task of hardware scan of the PCI bus very, very complex. The reason is that the Windows developers considered PnP to be the only valid agent to do such scan.
–
Maxim S. Shatskih
Windows DDK MVP
xxxxx@storagecraft.com
http://www.storagecraft.com
no, there is nothing in KM that allows you to enumerate the device tree (APIs, IOCTLs, whatever) like there is in UM. In KM, it is strictly a 1:1 driver to device relationship, typically a driver does not crawl the pnp tree poking at the devices it does not own. you can ask the question 10 different ways, the answer is still the same.
d
thanks maxim and doron,
just last question,
is it possible with writing filter driver of pci.sys ?
if yes please throw some light,
thanks,
Hitesh