blob: 5521c45d18fc97ca91367d74dcd96efbd4f10486 [file] [log] [blame]
# 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("$zx/kernel/params.gni")
group("pci") {
deps = [
":bus-pci",
":bus-pci.proxy",
]
}
# The userspace PCI bus driver uses this set, as well as the
# automated tests.
source_set("user_pci") {
visibility = [ ":*" ]
sources = [
"allocation.cpp",
"bridge.cpp",
"bus.cpp",
"capabilities.cpp",
"config.cpp",
"device.cpp",
"device_protocol.cpp",
"upstream_node.cpp",
]
public_deps = [
"$zx/system/banjo/ddk.protocol.pci",
"$zx/system/banjo/ddk.protocol.pciroot",
"$zx/system/ulib/ddk",
"$zx/system/ulib/ddktl",
"$zx/system/ulib/fbl",
"$zx/system/ulib/hwreg",
"$zx/system/ulib/pretty",
"$zx/system/ulib/region-alloc",
"$zx/system/ulib/zircon",
# TODO(ZX-4062): 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.
"$zx/system/dev/lib/mmio",
]
}
source_set("user_pci.proxy") {
sources = [
"device_proxy.cpp",
]
public_deps = [
"$zx/system/banjo/ddk.protocol.pci",
"$zx/system/ulib/ddk",
"$zx/system/ulib/ddktl",
"$zx/system/ulib/hwreg",
"$zx/system/ulib/pretty",
]
}
if (enable_user_pci) {
driver("bus-pci") {
sources = [
# The driver needs bind glue, unlike tests.
"bind.cpp",
]
deps = [
":user_pci",
]
}
driver("bus-pci.proxy") {
deps = [
":user_pci.proxy",
]
}
} else {
driver("bus-pci") {
sources = [
"kpci/kpci.c",
]
deps = [
"$zx/system/banjo/ddk.protocol.pci",
"$zx/system/banjo/ddk.protocol.pciroot",
"$zx/system/banjo/ddk.protocol.platform.device",
"$zx/system/banjo/ddk.protocol.sysmem",
"$zx/system/ulib/ddk",
"$zx/system/ulib/zircon",
]
}
driver("bus-pci.proxy") {
sources = [
"kpci/proxy.c",
]
deps = [
"$zx/system/banjo/ddk.protocol.pci",
"$zx/system/banjo/ddk.protocol.pciroot",
"$zx/system/banjo/ddk.protocol.platform.device",
"$zx/system/banjo/ddk.protocol.sysmem",
"$zx/system/ulib/ddk",
"$zx/system/ulib/zircon",
]
}
}
# The output of the test code below is made up of several binaries
# pci-unit-test: A binary to run the unit tests defiend in test/
# pci-driver-test: A binary to run the driver tests
# pci_fake.so: A fake bus driver loaded by pci-driver-test to provide a bind
# point for pci_test.so
# pci_fake.proxy.so: The corresponding proxy driver that binds to pci_fake.so
# and loads pci_test.so
# pci_test.so: A zxtest driver to test the PCI protocol
test("pci-unit") {
sources = [
"test/unit/allocation_tests.cpp",
"test/unit/config_tests.cpp",
"test/unit/device_tests.cpp",
]
deps = [
":user_pci",
"$zx/system/dev/lib/fake_ddk",
"$zx/system/ulib/zxtest",
]
}
test("pci-driver") {
sources = [
"test/driver/driver_tests.cpp",
]
deps = [
":pci_fake",
":pci_fake.proxy",
":pci_protocol_test_driver",
"$zx/system/fidl/fuchsia-device-test:c",
"$zx/system/ulib/ddk",
"$zx/system/ulib/ddktl",
"$zx/system/ulib/devmgr-integration-test",
"$zx/system/ulib/driver-integration-test",
"$zx/system/ulib/fbl",
"$zx/system/ulib/fdio",
"$zx/system/ulib/zxtest",
]
}
driver("pci_fake") {
sources = [
"test/driver/fake_bus_driver.cpp",
]
public_deps = [
":user_pci",
"$zx/system/ulib/ddk",
"$zx/system/ulib/ddktl",
"$zx/system/ulib/pretty",
"$zx/system/ulib/zxtest",
]
}
driver("pci_fake.proxy") {
deps = [
":user_pci.proxy",
]
}
driver("pci_protocol_test_driver") {
sources = [
"test/driver/protocol_test_driver.cpp",
]
deps = [
":user_pci",
"$zx/system/fidl/fuchsia-device-test:c",
"$zx/system/ulib/zxtest",
]
}