blob: 6a69bea58b299ae6048d9397b3299a716b1dfbbc [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/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",
]
}
if (enable_user_pci) {
driver("bus-pci") {
sources = [
# The driver needs bind glue, unlike tests.
"bind.cpp",
]
deps = [
":user_pci",
]
}
driver("bus-pci.proxy") {
sources = [
"device_proxy.cpp",
]
deps = [
"$zx/system/banjo/ddk.protocol.pci",
"$zx/system/ulib/ddk",
"$zx/system/ulib/ddktl",
"$zx/system/ulib/pretty",
]
}
} 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",
]
}
}
test("pci_tests") {
sources = [
"test/allocation_tests.cpp",
"test/config_tests.cpp",
"test/device_tests.cpp",
"test/main.cpp",
]
deps = [
":user_pci",
"$zx/system/dev/lib/fake_ddk",
"$zx/system/ulib/hwreg",
"$zx/system/ulib/zxtest",
]
}