Commit Graph

3 Commits

Author SHA1 Message Date
Rong Liu df64877c50 dm: PTM: Check PTM root has more than one child
Add one more sanity check: If the root port has more than
	one child, we won't enable PTM on the guest.
	This is not necessarily an error.  We flag it as
	error just because we don't have this type of hw
	configuration at development time thus this configuration
	is not tested.

Tracked-On: #5915
Signed-off-by: Rong Liu <rong.l.liu@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
2021-05-19 13:54:24 +08:00
Rong Liu a7b0d9848f dm: PTM: Get # of children of a pci bridge or pci bus
Add functionality to build and cache pci hierarchy, which are mainly
    used to retrieve # of children of pci bridge or pci bus.

    get_device_count_on_bus(): get # of child devices on a pci bus
    get_device_count_on_bridge(): recursively get # of child devices on a pci bridge
    scan_pci(): build and cache pci hierarchy
    pci_find_root_port(): find root port of a pci device
    clean_pci_cache(): free pci cache
    scan_pci_test(): test of scan pci hierarchy (disabled)

Tracked-On: #5915
Signed-off-by: Rong Liu <rong.l.liu@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
2021-05-19 13:54:24 +08:00
Rong Liu d3185f8a0c dm: PTM: Add a few pci utility functions
Add a few pci utility functions to help easy access of pci
    functionalities.
    1. pci_find_capability(): find position of specified pci capability register
    2. pci_find_ext_cap(): find extend capability register position from cap_id
    3. pci_pcie_type(): find pci-e device type
    4. is_root_port(): check whether pdev is a pci root port
    5. is_bridge(): check whether pdev is a bridge

Tracked-On: #5915
Signed-off-by: Rong Liu <rong.l.liu@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
2021-05-19 13:54:24 +08:00