Hi,

in the past my (WDM based) driver needed to extract the pci bus number and
the slot (device - i.e the location on the bus) number for a device. this was
easy to do using the HalGetBusData routines.
nowdays, these routine are obsolete and my new driver is WDF based. though,
i still need to get these numbers (bus & slot(device) numbers) and having
trouble with the device number.
using the WDF routine "WdfDeviceAllocAndQueryProperty" i'm able to retrieve
the bus number easily using the "DevicePropertyBusNumber" prperty. BUT,
extracting the slot(device) number is something i cant figure out (i can only
get it by using the WdfDeviceAllocAndQueryProperty routine with a
DevicePropertyLocationInformation attribute but then i have to parse a string
which not seems like a good way).
so, my question is how is the best way to replace the HalGetBusData routine
for extracting a devices slot(device) number. can i somehoe use the
PCI_SLOT_NUMBER structure along with "IRP_MN_READ_CONFIG" ?

thanks a lot,
kobi.

RE: pci slot (device) number by kobin

kobin
Sun Feb 03 06:07:00 CST 2008


Hi again,

well.. i think i might have found the answer -
it seems that if i use the "WdfDeviceAllocAndQueryProperty" with
"DevicePropertyAddress" attribute, the device number hides in the buffer's
high bits (high word of the answer).

am i correct ? is this the best way to retrieve the device number ?

thanks.
kobi.

"kobi n" wrote:

> Hi,
>
> in the past my (WDM based) driver needed to extract the pci bus number and
> the slot (device - i.e the location on the bus) number for a device. this was
> easy to do using the HalGetBusData routines.
> nowdays, these routine are obsolete and my new driver is WDF based. though,
> i still need to get these numbers (bus & slot(device) numbers) and having
> trouble with the device number.
> using the WDF routine "WdfDeviceAllocAndQueryProperty" i'm able to retrieve
> the bus number easily using the "DevicePropertyBusNumber" prperty. BUT,
> extracting the slot(device) number is something i cant figure out (i can only
> get it by using the WdfDeviceAllocAndQueryProperty routine with a
> DevicePropertyLocationInformation attribute but then i have to parse a string
> which not seems like a good way).
> so, my question is how is the best way to replace the HalGetBusData routine
> for extracting a devices slot(device) number. can i somehoe use the
> PCI_SLOT_NUMBER structure along with "IRP_MN_READ_CONFIG" ?
>
> thanks a lot,
> kobi.

Re: pci slot (device) number by Mark

Mark
Sun Feb 03 16:23:25 CST 2008

On Feb 3, 7:07=A0am, kobi n <ko...@discussions.microsoft.com> wrote:
> Hi again,
>
> well.. i think i might have found the answer -
> it seems that if i use the "WdfDeviceAllocAndQueryProperty" with
> "DevicePropertyAddress" attribute, the device number hides in the buffer's=

> high bits (high word of the answer).
>
> am i correct ? =A0is this the best way to retrieve the device number ?
>
> thanks.
> kobi.
>
>
>
> "kobi n" wrote:
> > Hi,
>
> > in the past my (WDM based) driver needed to extract the pci bus number a=
nd
> > the slot (device - i.e the location on the bus) number for a device. thi=
s was
> > easy to do using the HalGetBusData routines.
> > nowdays, these routine are obsolete and my new driver is WDF based. thou=
gh,
> > i still need to get these numbers (bus & slot(device) numbers) and havin=
g
> > trouble with the device number.
> > using the WDF routine "WdfDeviceAllocAndQueryProperty" i'm able to retri=
eve
> > the bus number easily using the "DevicePropertyBusNumber" prperty. BUT,
> > extracting the slot(device) number is something i cant figure out (i can=
only
> > get it by using the WdfDeviceAllocAndQueryProperty routine with a
> > DevicePropertyLocationInformation attribute but then i have to parse a s=
tring
> > which not seems like a good way).
> > so, my question is how is the best way to replace the HalGetBusData rout=
ine
> > for extracting a devices slot(device) number. =A0 =A0can i somehoe use t=
he
> > PCI_SLOT_NUMBER structure along with "IRP_MN_READ_CONFIG" ?
>
> > thanks a lot,
> > kobi.- Hide quoted text -
>
> - Show quoted text -

If you are the function driver then you do not need the device and
function number for your device in order to get the configuration
data. See http://support.microsoft.com/kb/253232 or the article I
wrote a long time ago here: http://www.hollistech.com/Resources/Misc%20artic=
les/getbusdata.doc

Re: pci slot (device) number by Tim

Tim
Mon Feb 04 22:20:55 CST 2008

kobi n <kobin@discussions.microsoft.com> wrote:
>
>in the past my (WDM based) driver needed to extract the pci bus number and
>the slot (device - i.e the location on the bus) number for a device. this was
>easy to do using the HalGetBusData routines.
>nowdays, these routine are obsolete and my new driver is WDF based. though,
>i still need to get these numbers (bus & slot(device) numbers)...

Why?
--
Tim Roberts, timr@probo.com
Providenza & Boekelheide, Inc.

Re: pci slot (device) number by kobin

kobin
Wed Feb 06 08:38:00 CST 2008

it would be hard to answer "why" without going to much detalis, but basically
i have a machine which is filled with many of my boards (pci cards). my
application needs to know the physical order of the boards on the PCI slots
(whos the most left one, whos on its right and so on).
i can achieve this kind of mapping using the bus and device values of the
device.


"Tim Roberts" wrote:

> kobi n <kobin@discussions.microsoft.com> wrote:
> >
> >in the past my (WDM based) driver needed to extract the pci bus number and
> >the slot (device - i.e the location on the bus) number for a device. this was
> >easy to do using the HalGetBusData routines.
> >nowdays, these routine are obsolete and my new driver is WDF based. though,
> >i still need to get these numbers (bus & slot(device) numbers)...
>
> Why?
> --
> Tim Roberts, timr@probo.com
> Providenza & Boekelheide, Inc.
>

Re: pci slot (device) number by Don

Don
Wed Feb 06 08:43:43 CST 2008

You do realize that there is no guaranteed physical mapping of PCI slots.
I.E. slot number from left to right can be in any order including commonly
intermixed. Not only that the major vendors have revised boards in the
middle of production and changed the ordering.

--
Don Burn (MVP, Windows DDK)
Windows 2k/XP/2k3 Filesystem and Driver Consulting
Website: http://www.windrvr.com
Blog: http://msmvps.com/blogs/WinDrvr
Remove StopSpam to reply



"kobi n" <kobin@discussions.microsoft.com> wrote in message
news:7F594AE3-A759-493F-A0C2-AE54D5CCF3D5@microsoft.com...
> it would be hard to answer "why" without going to much detalis, but
> basically
> i have a machine which is filled with many of my boards (pci cards). my
> application needs to know the physical order of the boards on the PCI
> slots
> (whos the most left one, whos on its right and so on).
> i can achieve this kind of mapping using the bus and device values of the
> device.
>
>
> "Tim Roberts" wrote:
>
>> kobi n <kobin@discussions.microsoft.com> wrote:
>> >
>> >in the past my (WDM based) driver needed to extract the pci bus number
>> >and
>> >the slot (device - i.e the location on the bus) number for a device.
>> >this was
>> >easy to do using the HalGetBusData routines.
>> >nowdays, these routine are obsolete and my new driver is WDF based.
>> >though,
>> >i still need to get these numbers (bus & slot(device) numbers)...
>>
>> Why?
>> --
>> Tim Roberts, timr@probo.com
>> Providenza & Boekelheide, Inc.
>>



Re: pci slot (device) number by kobin

kobin
Wed Feb 06 09:36:00 CST 2008

Yes. I'm aware of it.
our mapping method also relies on a backplane specific configuration (for
few backplanes types that we hold) and that's how i'm sure that a device on
bus X is on the left or right of device Y (only for that specific backplane
!!).
this method is about to be replaced but still needs to operate and that's
the reason i need this info.

thanks.

"Don Burn" wrote:

> You do realize that there is no guaranteed physical mapping of PCI slots.
> I.E. slot number from left to right can be in any order including commonly
> intermixed. Not only that the major vendors have revised boards in the
> middle of production and changed the ordering.
>
> --
> Don Burn (MVP, Windows DDK)
> Windows 2k/XP/2k3 Filesystem and Driver Consulting
> Website: http://www.windrvr.com
> Blog: http://msmvps.com/blogs/WinDrvr
> Remove StopSpam to reply
>
>
>
> "kobi n" <kobin@discussions.microsoft.com> wrote in message
> news:7F594AE3-A759-493F-A0C2-AE54D5CCF3D5@microsoft.com...
> > it would be hard to answer "why" without going to much detalis, but
> > basically
> > i have a machine which is filled with many of my boards (pci cards). my
> > application needs to know the physical order of the boards on the PCI
> > slots
> > (whos the most left one, whos on its right and so on).
> > i can achieve this kind of mapping using the bus and device values of the
> > device.
> >
> >
> > "Tim Roberts" wrote:
> >
> >> kobi n <kobin@discussions.microsoft.com> wrote:
> >> >
> >> >in the past my (WDM based) driver needed to extract the pci bus number
> >> >and
> >> >the slot (device - i.e the location on the bus) number for a device.
> >> >this was
> >> >easy to do using the HalGetBusData routines.
> >> >nowdays, these routine are obsolete and my new driver is WDF based.
> >> >though,
> >> >i still need to get these numbers (bus & slot(device) numbers)...
> >>
> >> Why?
> >> --
> >> Tim Roberts, timr@probo.com
> >> Providenza & Boekelheide, Inc.
> >>
>
>
>