From: Sergey Alekseev on
Dear Sirs,

I have the following question. I have two equal PCI cards. How can I get the
information about numbers of PCI slots, in which these cards are switched
in, using only driver facilities?

Best regards,

Sergey Alekseev


From: soviet_bloke on
How can I get the
> information about numbers of PCI slots, in which these cards are switched
> in, using only driver facilities?

In x86 world, the whole thing can be done simply by reading
configuration space (i.e. 4-byte write and read from IO ports
respectively CF8h and CFCh). Bit 31 of the value you write to port FC8h
is always 1, and bits 30-24 are always 0. Theoretically you may have up
to 256 buses, so that bits 23-16 of the value you write to port CF8h
indicate bus number, which, unless you target a card that is inserted
into PCI slot, should be 0. Bits 15-11 indicate a device, and and bit
10-8 indicate a function number (if device is present, it has to
support at least one function). The remaining bits indicate read
offset, which for the purpose of your task, should be 0 (by reading 4
bytes from the offset 0, you get 2-byte vendor ID register and 2-byte
device ID register)



I hope now you already understand how to enumerate buses, devices and
functions - you write to port CF8h, and then read data from port CFCh.
Unless the value that you have read from port CFCh happens to be
0xFFFFFFFF, you can be 100% sure that a given device on a given bus
exists, so that the 4-byte value you have read from port CFCh is vendor
ID (bits 0-15) and device ID (bits 16-31). Therefore, you can enumerate
all devices on all buses from 1 to 255, get their vendor and device
IDs, detect your target cards, discover on which buses they are, and,
as a result, get an answer to your original question.....

Anton Bassov




Sergey Alekseev wrote:
> Dear Sirs,
>
> I have the following question. I have two equal PCI cards. How can I get the
> information about numbers of PCI slots, in which these cards are switched
> in, using only driver facilities?
>
> Best regards,
>
> Sergey Alekseev

From: Maxim S. Shatskih on
> I hope now you already understand how to enumerate buses, devices and
> functions - you write to port CF8h, and then read data from port CFCh.

No ways of doing this safely under Windows - ports 0xcf8/0xcfc belong to
PCI.SYS (or the HAL) and you cannot grab the lock which guards them.

--
Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
maxim(a)storagecraft.com
http://www.storagecraft.com

From: soviet_bloke on
> No ways of doing this safely under Windows - ports 0xcf8/0xcfc belong to
> PCI.SYS (or the HAL) and you cannot grab the lock which guards them.


If this is the case, how can bus adapter or controller enumerate
devices that are currently present on its bus, apart from submitting a
request to PCI and providing bus number with it ???

Anton Bassov


Maxim S. Shatskih wrote:
> > I hope now you already understand how to enumerate buses, devices and
> > functions - you write to port CF8h, and then read data from port CFCh.
>
> No ways of doing this safely under Windows - ports 0xcf8/0xcfc belong to
> PCI.SYS (or the HAL) and you cannot grab the lock which guards them.
>
> --
> Maxim Shatskih, Windows DDK MVP
> StorageCraft Corporation
> maxim(a)storagecraft.com
> http://www.storagecraft.com

From: Don Burn on
Well a bus adapter is typically a device unto itself. If they really need
this data they can use the various user space SetupAPI, but touching the
CF8/CFC ports will cause crashes.


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


<soviet_bloke(a)hotmail.com> wrote in message
news:1169317825.566165.241250(a)a75g2000cwd.googlegroups.com...
>> No ways of doing this safely under Windows - ports 0xcf8/0xcfc belong to
>> PCI.SYS (or the HAL) and you cannot grab the lock which guards them.
>
>
> If this is the case, how can bus adapter or controller enumerate
> devices that are currently present on its bus, apart from submitting a
> request to PCI and providing bus number with it ???
>
> Anton Bassov
>
>
> Maxim S. Shatskih wrote:
>> > I hope now you already understand how to enumerate buses, devices and
>> > functions - you write to port CF8h, and then read data from port CFCh.
>>
>> No ways of doing this safely under Windows - ports 0xcf8/0xcfc belong to
>> PCI.SYS (or the HAL) and you cannot grab the lock which guards them.
>>
>> --
>> Maxim Shatskih, Windows DDK MVP
>> StorageCraft Corporation
>> maxim(a)storagecraft.com
>> http://www.storagecraft.com
>


 |  Next  |  Last
Pages: 1 2
Prev: snetcfg hang.
Next: already has a body