device: Allow virtual/generic devices under PCI in devicetree
commitbf6962225659818c308ad323e35f181ce9c9c13b
authorDuncan Laurie <dlaurie@google.com>
Sun, 18 Oct 2020 22:10:00 +0000 (18 15:10 -0700)
committerDuncan Laurie <dlaurie@chromium.org>
Wed, 21 Oct 2020 15:35:33 +0000 (21 15:35 +0000)
treedf7b2d7a041eca67d22708c54930d00b6bfb6743
parent3e4a14e153f6c77c257e03584364c58f1a2ae8dc
device: Allow virtual/generic devices under PCI in devicetree

This change allows a generic device to be described in the devicetree
under a PCI device, such as a root port.

Previously any device under a PCI device was expected to also be a PCI
device and that does not allow for a virtual/generic device to be
present, for example to provide ACPI properties for a root port.

The changes are:
- Ignore non-PCI devices found under a PCI device when scanning and do
not print an error for each devfn scanned.
- Don't treat non-PCI devices as leftover and remove them, instead
enable them as a static device.
- Don't attempt to configure a static device in the tree that is not a
PCIe device type.

With these changes it is now possible to have a generic device under a
PCI device, for example in a USB4/TBT root port (PCIe hotplug device)
this generic device will add ACPI properties for the PCIe tunnel routed
to the external port:

device pci 07.0 on
  chip soc/intel/common/block/pcie
    device generic 0 on end
  end
end

TEST=boot on volteer with the USB4 root port devices in chipset.cb and
ensure they are enabled properly and there are no errors printed in the
coreboot log, and that the device properties are created in the SSDT.

Signed-off-by: Duncan Laurie <dlaurie@google.com>
Change-Id: I56a491808067dc862a7adfd46852f0bd6b41cd95
Reviewed-on: https://review.coreboot.org/c/coreboot/+/46542
Reviewed-by: Furquan Shaikh <furquan@google.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
src/device/pci_device.c
src/device/pciexp_device.c