Index: sys/dev/pci/pci.c =================================================================== --- sys/dev/pci/pci.c +++ sys/dev/pci/pci.c @@ -34,6 +34,7 @@ #include "opt_acpi.h" #include "opt_iommu.h" #include "opt_bus.h" +#include "opt_platform.h" #include #include @@ -65,6 +66,13 @@ #include #endif +#ifdef FDT +#include +#include +#include +#include +#endif + #include #include #include @@ -138,6 +146,11 @@ static int pci_get_id_method(device_t dev, device_t child, enum pci_id_type type, uintptr_t *rid); +#ifdef FDT +static const struct ofw_bus_devinfo* pci_ofw_get_devinfo(device_t bus, + device_t dev); +#endif + static struct pci_devinfo * pci_fill_devinfo(device_t pcib, device_t bus, int d, int b, int s, int f, uint16_t vid, uint16_t did); @@ -220,6 +233,16 @@ DEVMETHOD(pci_create_iov_child, pci_create_iov_child_method), #endif +#ifdef FDT + /* ofw_bus interface */ + DEVMETHOD(ofw_bus_get_devinfo, pci_ofw_get_devinfo), + DEVMETHOD(ofw_bus_get_compat, ofw_bus_gen_get_compat), + DEVMETHOD(ofw_bus_get_model, ofw_bus_gen_get_model), + DEVMETHOD(ofw_bus_get_name, ofw_bus_gen_get_name), + DEVMETHOD(ofw_bus_get_node, ofw_bus_gen_get_node), + DEVMETHOD(ofw_bus_get_type, ofw_bus_gen_get_type), +#endif + DEVMETHOD_END }; @@ -6257,6 +6280,16 @@ return (PCIB_GET_ID(device_get_parent(dev), child, type, id)); } +#ifdef FDT +/* Pass the request up to our parent. */ +static const struct ofw_bus_devinfo* +pci_ofw_get_devinfo(device_t bus, device_t dev) +{ + + return OFW_BUS_GET_DEVINFO(device_get_parent(bus), dev); +} +#endif + /* Find the upstream port of a given PCI device in a root complex. */ device_t pci_find_pcie_root_port(device_t dev)