| # Copyright 2019 The Fuchsia Authors. All rights reserved. |
| # Use of this source code is governed by a BSD-style license that can be |
| # found in the LICENSE file. |
| |
| import("//build/bind/bind.gni") |
| import("//build/drivers.gni") |
| import("pci.gni") |
| |
| group("pci") { |
| deps = [ ":bus-pci" ] |
| } |
| |
| # The userspace PCI bus driver uses this set, as well as the |
| # automated tests. |
| source_set("user_pci") { |
| visibility = [ |
| ":*", |
| "test/:*", |
| ] |
| |
| sources = [ |
| "allocation.cc", |
| "bridge.cc", |
| "bus.cc", |
| "bus_device_interface.cc", |
| "bus_inspect.cc", |
| "capabilities/msix.cc", |
| "capabilities/power_management.cc", |
| "composite.cc", |
| "config.cc", |
| "device.cc", |
| "device_caps.cc", |
| "device_inspect.cc", |
| "device_irqs.cc", |
| "device_service.cc", |
| "fidl.cc", |
| "upstream_node.cc", |
| ] |
| |
| deps = [ "//src/devices/bind/fuchsia.acpi:fuchsia.acpi_cpp" ] |
| |
| public_deps = [ |
| "//sdk/banjo/fuchsia.hardware.pciroot:fuchsia.hardware.pciroot_banjo_cpp", |
| "//sdk/fidl/fuchsia.hardware.pci:fuchsia.hardware.pci_bindlib_cpp", |
| "//sdk/fidl/fuchsia.hardware.pci:fuchsia.hardware.pci_cpp", |
| "//sdk/fidl/fuchsia.hardware.sysmem:fuchsia.hardware.sysmem_bindlib_cpp", |
| "//sdk/fidl/fuchsia.io:fuchsia.io_cpp", |
| "//sdk/lib/component/outgoing/cpp", |
| "//src/devices/bind/fuchsia:fuchsia_cpp", |
| "//src/devices/bind/fuchsia.acpi:fuchsia.acpi_cpp", |
| "//src/devices/lib/driver", |
| "//src/devices/lib/driver:driver_runtime", |
| "//src/devices/pci/lib/device-protocol-pci", |
| "//src/devices/pci/lib/pci", |
| "//src/lib/ddk", |
| "//src/lib/ddk:ddk-deprecated-binding-headers", |
| "//src/lib/ddktl", |
| "//zircon/system/ulib/fbl", |
| "//zircon/system/ulib/hwreg", |
| "//zircon/system/ulib/inspect", |
| "//zircon/system/ulib/pretty", |
| "//zircon/system/ulib/region-alloc", |
| "//zircon/system/ulib/zircon-internal", |
| "//zircon/system/ulib/zx", |
| |
| # TODO(https://fxbug.dev/42109087): This shouldn't be here if the mmio code is actually |
| # used in the test too. Anything using that needs to be separately |
| # compiled for the test using the mock version. |
| "//src/devices/lib/mmio", |
| ] |
| |
| # TODO(https://fxbug.dev/42136089): delete the below and fix compiler warnings |
| configs += [ "//build/config:Wno-conversion" ] |
| } |
| |
| driver_bind_rules("pci_bind") { |
| rules = "pci.bind" |
| tests = "pci_bind_tests.json" |
| deps = [ |
| "//src/devices/bind/fuchsia.pci", |
| "//src/devices/bind/fuchsia.platform", |
| ] |
| } |
| |
| if (platform_enable_user_pci) { |
| fuchsia_driver("bus-pci-driver") { |
| output_name = "bus-pci" |
| configs += [ |
| "//build/config:all_source", |
| "//build/config/fuchsia:enable_zircon_asserts", |
| ] |
| |
| sources = [ |
| # The driver needs bind glue, unlike tests. |
| "bind.cc", |
| ] |
| deps = [ |
| ":pci_bind", |
| ":user_pci", |
| "//src/devices/lib/driver", |
| ] |
| } |
| |
| fuchsia_driver_component("bus-pci") { |
| component_name = "bus-pci" |
| deps = [ ":bus-pci-driver" ] |
| info = "bus-pci-info.json" |
| manifest = "meta/pci.cml" |
| } |
| |
| fuchsia_driver_package("package") { |
| package_name = "bus-pci" |
| driver_components = [ ":bus-pci" ] |
| } |
| } else { # Kernel PCI |
| fuchsia_driver("bus-pci-driver") { |
| output_name = "bus-pci" |
| configs += [ |
| "//build/config:all_source", |
| "//build/config/fuchsia:enable_zircon_asserts", |
| ] |
| sources = [ |
| "composite.cc", |
| "kpci.cc", |
| ] |
| deps = [ |
| ":pci_bind", |
| "//sdk/banjo/fuchsia.hardware.pciroot:fuchsia.hardware.pciroot_banjo_cpp", |
| "//sdk/fidl/fuchsia.hardware.pci:fuchsia.hardware.pci_bindlib_cpp", |
| "//sdk/fidl/fuchsia.hardware.pci:fuchsia.hardware.pci_cpp", |
| "//sdk/fidl/fuchsia.hardware.sysmem:fuchsia.hardware.sysmem_bindlib_cpp", |
| "//sdk/lib/component/outgoing/cpp", |
| "//sdk/lib/driver/runtime:driver_runtime_cpp", |
| "//sdk/lib/fidl", |
| "//src/devices/bind/fuchsia:fuchsia_cpp", |
| "//src/devices/bind/fuchsia.acpi:fuchsia.acpi_cpp", |
| "//src/devices/bus/lib/device-protocol-pdev", |
| "//src/devices/lib/driver", |
| "//src/devices/lib/driver:driver_runtime", |
| "//src/devices/pci/lib/device-protocol-pci", |
| "//src/devices/pci/lib/pci", |
| "//src/lib/ddk", |
| "//src/lib/ddktl", |
| "//zircon/system/ulib/async-loop:async-loop-cpp", |
| "//zircon/system/ulib/pretty", |
| ] |
| |
| # TODO(https://fxbug.dev/42136089): delete the below and fix compiler warnings |
| configs += [ "//build/config:Wno-conversion" ] |
| } |
| |
| fuchsia_driver_component("bus-pci") { |
| component_name = "bus-pci" |
| deps = [ ":bus-pci-driver" ] |
| info = "bus-pci-info.json" |
| manifest = "meta/kpci.cml" |
| } |
| |
| fuchsia_driver_package("package") { |
| package_name = "bus-pci" |
| driver_components = [ ":bus-pci" ] |
| } |
| } |
| |
| group("tests") { |
| testonly = true |
| deps = [ |
| ":pci_bind_test", |
| "test:pci-driver-test", |
| "test:pci-unit-test", |
| ] |
| } |