<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
</head>
<body>
<p>I tried iPXE for my own custom PCI Express card on a Dell
PowerEdge R7515 server.<br>
I found an interesting problem - the iPXE driver will only find
the card in the first PCIe slot.<br>
I examined this issue in more detail and discovered the following:</p>
<ol>
<li>
<p>The server uses 4 PCI Roots and these roots share same PCI
segment (0)</p>
</li>
<li>
<p>First slot belongs PCI Root with index 0</p>
</li>
<li>
<p>Other slots had a different PCI Root</p>
</li>
<li>
<p>The device binding fails in the <code>efipci_read</code>
function (see the efi_pci.c file) because<code> root->
Pci.Read</code> returns an INVALID PARAMETER error.</p>
</li>
<li>
<p>The <code>efipci_root_open</code> function pairs the PCI
Root with the PCI segment number and thus always finds the
first PCI Root</p>
</li>
</ol>
<p>I think this pairing method is bad. The UEFI specification in
chapter <strong>PCI Root Bridge I/O Overview</strong> says:</p>
<blockquote>
<p>A PCI Host Bridge and PCI Root Bridge are different than a PCI
Segment. A PCI Segment is a<br>
collection of up to 256 PCI busses that share the same PCI
Configuration Space. Depending on<br>
the chipset, a single EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL may
abstract a portion of a PCI<br>
Segment, or an entire PCI Segment. A PCI Host Bridge may produce
one or more PCI Root<br>
Bridges. When a PCI Host Bridge produces multiple PCI Root
Bridges, it is possible to have<br>
more than one PCI Segment.</p>
</blockquote>
<p>I have no idea how reliably fix this issue.</p>
<p>See also <a class="moz-txt-link-freetext" href="https://github.com/ipxe/ipxe/issues/173">https://github.com/ipxe/ipxe/issues/173</a></p>
<p><br>
</p>
</body>
</html>