What I am doing here is check if a possible root port is on the devicetree. If it is a non NULL value is returned is it isn't a NULL value is returned and the PCI device shouldn't be accessed. Previously this returned the bug message which is fine for standard accesses but shouldn't be done if you just want to check if a device is on the tree.

Sorry, missed that there was a null check already.

For my understanding? How can I avoid the __SIMPLE_DEVICE__ stuff? The return is different in both cases (or is there an alternative I am not aware of?)

Kyösti worked on making the two cases compatible. I don't know
the exact plan. While they are incompatible, one shouldn't use
the same code for both cases. Beside the type conflict, they
have very different environments. In ramstage, one is supposed
to use the devicetree (at least after device enumeration, which
is the case here, AFAICS). In SMM, there is no enumeration,
hence all possible devices are tried.

If I wanted to implement this properly for ramstage, it would
be a loop over bus 0:

    for (dev = bus->children; dev; dev = dev->sibling) {
if (dev->path.type != PCI)
continue;
if (PCI_SLOT(dev->path.pci.devfn) != PCH_DEV_SLOT_PCIE && ...)
continue;
            /* check this dev */
}

View Change

1 comment:

To view, visit change 38750. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: I6bc04e48e97b0a29aef8aa050d3aad116cff1a14
Gerrit-Change-Number: 38750
Gerrit-PatchSet: 3
Gerrit-Owner: Wim Vervoorn <wvervoorn@eltan.com>
Gerrit-Reviewer: Frans Hendriks <fhendriks@eltan.com>
Gerrit-Reviewer: Nico Huber <nico.h@gmx.de>
Gerrit-Reviewer: Patrick Rudolph <siro@das-labor.org>
Gerrit-Reviewer: Wim Vervoorn <wvervoorn@eltan.com>
Gerrit-Reviewer: build bot (Jenkins) <no-reply@coreboot.org>
Gerrit-CC: Paul Menzel <paulepanter@users.sourceforge.net>
Gerrit-Comment-Date: Tue, 11 Feb 2020 14:38:59 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Wim Vervoorn <wvervoorn@eltan.com>
Comment-In-Reply-To: Nico Huber <nico.h@gmx.de>
Gerrit-MessageType: comment