The point of Enumerating the PCI

Comments and questions related to the "Down to the TLP" pages

The point of Enumerating the PCI

Postby Isaac » Wed Jan 07, 2015 8:44 pm

Many webpages talk about enumerating the PCI bus, scanning through all
devices on each bus, etc. But what is the main point of Enumerating
the PCI? What is my operating system supposed to accomplish by
enumerating the PCI? Am I supposed to store a huge array in memory
with each bit or every few bits representing a slot in the PCI and
record each slot's status (i.e. whether there is a device there or
not)? Or is the point the enable bit?

Thank you,
Isaac D. Cohen
Isaac
 
Posts: 7
Joined: Mon Dec 01, 2014 9:20 pm

Re: The point of Enumerating the PCI

Postby support » Thu Jan 08, 2015 7:27 am

Hi,

Bus enumeration is the term used for the initialization of the PCI/PCIe cards attached to a bus. Among others, the host detects where there is a card and where there isn't (and hence assigns it with a bus address -- "enumerates" it) but it also exchanges information with the card. For example, it fetches the Vendor ID and Product ID, which allows it later on to pick the correct driver for it.

The assignment of bus addresses is important for communication with the cards on the bus. For example, when a PCIe card needs to fetch data from the host's RAM (i.e. a DMA read), the card sends a packet requesting the host to send the data to the device at bus address X. The card knows its address through the enumeration. Also, the bus infrastructure (bridges and switches) knows how to route the host's response (the completion packet) to the card based upon the settings that the hosts performed on them during the enumeration.

So the assignment of addresses has an important role in the bus' operation later on.

Regards,
Eli
support
 
Posts: 760
Joined: Tue Apr 24, 2012 3:46 pm

Re: The point of Enumerating the PCI

Postby Isaac » Thu Jan 08, 2015 9:09 pm

How do I assign addresses to the devices?
Isaac
 
Posts: 7
Joined: Mon Dec 01, 2014 9:20 pm

Re: The point of Enumerating the PCI

Postby support » Fri Jan 09, 2015 7:05 am

Could you please say a bit more about what you're trying to accomplish? Assignment of bus addresses is something that is almost always done by some existing software. On PCs it's typically the BIOS, or Linux on embedded processors. Or some other hardware vendor supplied software. So it's quite rarely a need to deal with this issue.

Eli
support
 
Posts: 760
Joined: Tue Apr 24, 2012 3:46 pm

Re: The point of Enumerating the PCI

Postby Isaac » Sat Jan 10, 2015 11:56 pm

Oh. So if I don't have to do it myself (because the BIOS does it for me) how do I find out the numbers that the BIOS gave the PCI devices?
Isaac
 
Posts: 7
Joined: Mon Dec 01, 2014 9:20 pm

Re: The point of Enumerating the PCI

Postby support » Sun Jan 11, 2015 7:01 am

Well, it depends on your situation and why you want to know know the bus address.

In Linux, type "lspci" at shell prompt for a list of detected PCI/PCIe devices along with their bus addresses (a lot of other in-depth information can be obtained with this utility with command-line flags).

In Windows, open the Device Manager, pick a device and select "Properties" on its right-click menu. The device's bus address is given as its "Location" in the "General" tab: PCI bus X, device X function X -- this is the bus address.

If you happen to be on the device side, for example implementing a PCIe device on an FPGA, odds are that you're using some kind of IP core module to encapsulate the PCIe functionality. In this case, the module has some dedicated wires for conveying the address to the user logic.

Regards,
Eli
support
 
Posts: 760
Joined: Tue Apr 24, 2012 3:46 pm

Re: The point of Enumerating the PCI

Postby Isaac » Mon Jan 12, 2015 10:30 pm

lspci gives me a list of devices. But I don't see the device numbers. Here is one of the things on the list:
Code: Select all
02:00.0 USB controller: NEC Corporation uPD720200 USB 3.0 Host Controller (rev 04)

How do I make scene out of this?
Isaac
 
Posts: 7
Joined: Mon Dec 01, 2014 9:20 pm

Re: The point of Enumerating the PCI

Postby support » Tue Jan 13, 2015 6:49 am

The 02:00.0 part gives you the bus address: Bus 2, device 0, function 0.

Eli
support
 
Posts: 760
Joined: Tue Apr 24, 2012 3:46 pm

Re: The point of Enumerating the PCI

Postby Isaac » Tue Jan 13, 2015 9:31 pm

When the BIOS enumerated the PCI devices did it give them additional numbers? If so, where can I find out each device's number?
Isaac
 
Posts: 7
Joined: Mon Dec 01, 2014 9:20 pm

Re: The point of Enumerating the PCI

Postby support » Thu Jan 15, 2015 9:37 am

During the enumeration, several registers are set by the BIOS (or any other software doing this). This issue is quite heavy with details, so I suggest referring to the PCIe spec for more information.

You may use lspci -v or lspci -vv, and some other flags to get an idea about what is configured.

Regards,
Eli
support
 
Posts: 760
Joined: Tue Apr 24, 2012 3:46 pm


Return to General PCIe

cron