[version roller] Update dependencies
SDK version updated from 10.20221013.1.1 to 10.20221021.1.1
Breaking changes that are fixed:
- Logger is a pointer (fxr/736386)
- zx::status -> zx::result (fxr/740373)
- platform-passthrough -> pt in devfs path (fxr/744043)
Change-Id: I81da2048779ecea61c953ec1f6a108a2c73f7fd7
Reviewed-on: https://fuchsia-review.googlesource.com/c/sdk-samples/drivers/+/746182
Reviewed-by: Atul Sharma <atshar@google.com>
Reviewed-by: Chase Latta <chaselatta@google.com>
Commit-Queue: Atul Sharma <atshar@google.com>
diff --git a/scripts/smoke_test.sh b/scripts/smoke_test.sh
index 7a39be8..4395a5e 100755
--- a/scripts/smoke_test.sh
+++ b/scripts/smoke_test.sh
@@ -105,7 +105,7 @@
print_and_run tools/ffx repository list
# register a driver and verify that it registered succesfully
- print_and_run tools/bazel run src/qemu_edu/drivers:pkg.component | check_output "Node 'root.sys.platform.platform-passthrough.PCI0.bus.00_06_0_.pci-00_06.0-fidl'"
+ print_and_run tools/bazel run src/qemu_edu/drivers:pkg.component | check_output "Node 'root.sys.platform.pt.PCI0.bus.00_06_0_.pci-00_06.0-fidl'"
# wait for driver to load
sleep 1
@@ -123,9 +123,9 @@
# TODO: fxb/113254 | check_output "Liveness check passed"
print_and_run tools/bazel run --config=fuchsia_x64 //src/qemu_edu/tools:pkg.eductl_tool -- fact 12
# TODO: fxb/113254 | check_output "479001600"
- print_and_run tools/ffx component show qemu_edu.cm | check_output "Moniker: /bootstrap/universe-pkg-drivers:root.sys.platform.platform-passthrough.PCI0.bus.00_06_0_.pci-00_06.0-fidl"
- print_and_run tools/ffx driver list-devices | check_output "root.sys.platform.platform-passthrough.PCI0.bus.00_06_0"
- print_and_run tools/ffx driver list-devices root.sys.platform.platform-passthrough.PCI0.bus.00_06_0_ --verbose | check_output "Name : 00_06_0_"
+ print_and_run tools/ffx component show qemu_edu.cm | check_output "Moniker: /bootstrap/universe-pkg-drivers:root.sys.platform.pt.PCI0.bus.00_06_0_.pci-00_06.0-fidl"
+ print_and_run tools/ffx driver list-devices | check_output "root.sys.platform.pt.PCI0.bus.00_06_0"
+ print_and_run tools/ffx driver list-devices root.sys.platform.pt.PCI0.bus.00_06_0_ --verbose | check_output "Name : 00_06_0_"
print_and_run tools/ffx driver list-hosts | check_output "fuchsia-pkg://bazel.pkg.component/qemu_edu#meta/qemu_edu.cm"
print_and_run tools/ffx driver lspci | check_output "Host bridge:"
# check debugging tools work
diff --git a/src/acpi_multiply/controller/acpi_controller.cc b/src/acpi_multiply/controller/acpi_controller.cc
index ba7c943..fc2586d 100644
--- a/src/acpi_multiply/controller/acpi_controller.cc
+++ b/src/acpi_multiply/controller/acpi_controller.cc
@@ -9,7 +9,7 @@
namespace acpi_multiply {
-zx::status<> AcpiMultiplyController::Start() {
+zx::result<> AcpiMultiplyController::Start() {
node_.Bind(std::move(node()));
auto server_result = InitializeServer();
@@ -45,7 +45,7 @@
return zx::ok();
}
-zx::status<> AcpiMultiplyController::InitializeServer() {
+zx::result<> AcpiMultiplyController::InitializeServer() {
// Allocate an MMIO buffer representing the ACPI multiply device
zx::vmo vmo;
zx_status_t raw_status = zx::vmo::create(zx_system_get_page_size(), 0, &vmo);
@@ -69,12 +69,12 @@
return zx::error(raw_status);
}
- server_ = std::make_shared<AcpiDeviceServer>(std::move(irq), std::move(buffer.value()), logger_,
+ server_ = std::make_shared<AcpiDeviceServer>(std::move(irq), std::move(buffer.value()), &logger(),
dispatcher());
return zx::ok();
}
-zx::status<> AcpiMultiplyController::AddChild() {
+zx::result<> AcpiMultiplyController::AddChild() {
fidl::Arena arena;
// Offer fuchsia.hardware.acpi.Service to the driver that binds to the node.
auto offers = fidl::VectorView<fuchsia_component_decl::wire::Offer>(arena, 1);
diff --git a/src/acpi_multiply/controller/acpi_controller.h b/src/acpi_multiply/controller/acpi_controller.h
index e01c6e6..284c2b8 100644
--- a/src/acpi_multiply/controller/acpi_controller.h
+++ b/src/acpi_multiply/controller/acpi_controller.h
@@ -27,11 +27,11 @@
virtual ~AcpiMultiplyController() = default;
- zx::status<> Start() override;
+ zx::result<> Start() override;
private:
- zx::status<> InitializeServer();
- zx::status<> AddChild();
+ zx::result<> InitializeServer();
+ zx::result<> AddChild();
fidl::WireSyncClient<fuchsia_driver_framework::Node> node_;
fidl::WireSyncClient<fuchsia_driver_framework::NodeController> controller_;
diff --git a/src/acpi_multiply/controller/acpi_server.h b/src/acpi_multiply/controller/acpi_server.h
index df4a0bd..5e87d04 100644
--- a/src/acpi_multiply/controller/acpi_server.h
+++ b/src/acpi_multiply/controller/acpi_server.h
@@ -14,7 +14,7 @@
// FIDL server implementation for the `fuchsia.hardware.acpi/Device` protocol
class AcpiDeviceServer : public fidl::WireServer<fuchsia_hardware_acpi::Device> {
public:
- AcpiDeviceServer(zx::interrupt irq, fdf::MmioBuffer buffer, driver::Logger& logger,
+ AcpiDeviceServer(zx::interrupt irq, fdf::MmioBuffer buffer, driver::Logger* logger,
async_dispatcher_t* dispatcher)
: irq_(std::move(irq)),
buffer_(std::move(buffer)),
@@ -74,7 +74,7 @@
private:
zx::interrupt irq_;
fdf::MmioBuffer buffer_;
- driver::Logger& logger_;
+ driver::Logger* logger_;
async_dispatcher_t* dispatcher_;
};
diff --git a/src/acpi_multiply/driver/acpi_multiply.cc b/src/acpi_multiply/driver/acpi_multiply.cc
index 8c125b8..c4cd059 100644
--- a/src/acpi_multiply/driver/acpi_multiply.cc
+++ b/src/acpi_multiply/driver/acpi_multiply.cc
@@ -12,7 +12,7 @@
namespace acpi_multiply {
-zx::status<> AcpiMultiplyDriver::Start() {
+zx::result<> AcpiMultiplyDriver::Start() {
// Connect to the ACPI protocol exposed by the parent driver.
auto client_endpoint =
driver::Connect<fuchsia_hardware_acpi::Service::Device>(*context().incoming(), "default");
@@ -23,7 +23,7 @@
auto acpi_client = fidl::WireSyncClient(std::move(*client_endpoint));
// Initialize ACPI hardware resources
- multiplier_ = std::make_shared<AcpiMultiplier>(logger_, dispatcher(), std::move(acpi_client));
+ multiplier_ = std::make_shared<AcpiMultiplier>(&logger(), dispatcher(), std::move(acpi_client));
auto init_result = multiplier_->SetupMmioAndInterrupts();
if (init_result.is_error()) {
FDF_SLOG(ERROR, "Failed to initialize ACPI resources.",
@@ -38,7 +38,7 @@
auto result = service.add_device(
[this](fidl::ServerEnd<fuchsia_examples_acpi_multiply::Device> request) -> void {
- AcpiMultiplyServer::BindDeviceClient(logger_, dispatcher(), multiplier_,
+ AcpiMultiplyServer::BindDeviceClient(&logger(), dispatcher(), multiplier_,
std::move(request));
});
ZX_ASSERT(result.is_ok());
@@ -59,7 +59,7 @@
return;
}
- auto server_impl = std::make_unique<AcpiMultiplyServer>(logger_, multiplier_);
+ auto server_impl = std::make_unique<AcpiMultiplyServer>(&logger(), multiplier_);
fidl::BindServer(dispatcher(), std::move(endpoints->server), std::move(server_impl),
std::mem_fn(&AcpiMultiplyServer::OnUnbound));
client_.Bind(std::move(endpoints->client), dispatcher());
diff --git a/src/acpi_multiply/driver/acpi_multiply.h b/src/acpi_multiply/driver/acpi_multiply.h
index 40c4887..ab5dfef 100644
--- a/src/acpi_multiply/driver/acpi_multiply.h
+++ b/src/acpi_multiply/driver/acpi_multiply.h
@@ -20,7 +20,7 @@
virtual ~AcpiMultiplyDriver() = default;
- zx::status<> Start() override;
+ zx::result<> Start() override;
private:
std::shared_ptr<AcpiMultiplier> multiplier_;
diff --git a/src/acpi_multiply/driver/multiplier.cc b/src/acpi_multiply/driver/multiplier.cc
index 8f1c0c9..aebf94f 100644
--- a/src/acpi_multiply/driver/multiplier.cc
+++ b/src/acpi_multiply/driver/multiplier.cc
@@ -9,7 +9,7 @@
namespace acpi_multiply {
// Configure the hardware resources for the ACPI multiplier device.
-zx::status<> AcpiMultiplier::SetupMmioAndInterrupts() {
+zx::result<> AcpiMultiplier::SetupMmioAndInterrupts() {
// Get interrupt.
auto irq_result = acpi_->MapInterrupt(0);
if (!irq_result.ok() || irq_result->is_error()) {
@@ -51,9 +51,10 @@
fidl::VectorView<fuchsia_hardware_acpi::wire::Object>(arena, 0));
if (!result.ok() || result->is_error()) {
FDF_SLOG(ERROR, "Failed to send EvaluateObject",
- KV("error", (const char*)(result.ok()
- ? std::to_string(fidl::ToUnderlying(result->error_value())).data()
- : result.FormatDescription().data())));
+ KV("error",
+ (const char*)(result.ok()
+ ? std::to_string(fidl::ToUnderlying(result->error_value())).data()
+ : result.FormatDescription().data())));
current_op_->callback(zx::error(ZX_ERR_INTERNAL));
current_op_ = std::nullopt;
return;
diff --git a/src/acpi_multiply/driver/multiplier.h b/src/acpi_multiply/driver/multiplier.h
index 4e0bc87..655482d 100644
--- a/src/acpi_multiply/driver/multiplier.h
+++ b/src/acpi_multiply/driver/multiplier.h
@@ -18,11 +18,11 @@
// Invokes ACPI methods using a fuchsia.hardware.acpi client.
class AcpiMultiplier {
public:
- explicit AcpiMultiplier(driver::Logger& logger, async_dispatcher_t* dispatcher,
+ explicit AcpiMultiplier(driver::Logger* logger, async_dispatcher_t* dispatcher,
fidl::WireSyncClient<fuchsia_hardware_acpi::Device> acpi)
: logger_(logger), dispatcher_(dispatcher), acpi_(std::move(acpi)) {}
- zx::status<> SetupMmioAndInterrupts();
+ zx::result<> SetupMmioAndInterrupts();
// Structure to return operation results to FIDL callers.
struct MultiplyResult {
@@ -47,7 +47,7 @@
void DoMultiply(Operation operation);
- driver::Logger& logger_;
+ driver::Logger* logger_;
async_dispatcher_t* const dispatcher_;
std::optional<fdf::MmioBuffer> mmio_;
diff --git a/src/acpi_multiply/driver/multiply_server.cc b/src/acpi_multiply/driver/multiply_server.cc
index 2bcc91d..c8f20a0 100644
--- a/src/acpi_multiply/driver/multiply_server.cc
+++ b/src/acpi_multiply/driver/multiply_server.cc
@@ -9,7 +9,7 @@
// Static
// Handle incoming connection requests from FIDL clients
fidl::ServerBindingRef<fuchsia_examples_acpi_multiply::Device> AcpiMultiplyServer::BindDeviceClient(
- driver::Logger& logger, async_dispatcher_t* dispatcher,
+ driver::Logger* logger, async_dispatcher_t* dispatcher,
std::weak_ptr<AcpiMultiplier> multiplier,
fidl::ServerEnd<fuchsia_examples_acpi_multiply::Device> request) {
// Bind each connection request to a unique FIDL server instance
diff --git a/src/acpi_multiply/driver/multiply_server.h b/src/acpi_multiply/driver/multiply_server.h
index d1ed5ad..78f35e1 100644
--- a/src/acpi_multiply/driver/multiply_server.h
+++ b/src/acpi_multiply/driver/multiply_server.h
@@ -15,11 +15,11 @@
// FIDL server implementation for the `fuchsia.examples.acpi.multiply/Device` protocol
class AcpiMultiplyServer : public fidl::WireServer<fuchsia_examples_acpi_multiply::Device> {
public:
- AcpiMultiplyServer(driver::Logger& logger, std::weak_ptr<AcpiMultiplier> multiplier)
+ AcpiMultiplyServer(driver::Logger* logger, std::weak_ptr<AcpiMultiplier> multiplier)
: logger_(logger), multiplier_(multiplier) {}
static fidl::ServerBindingRef<fuchsia_examples_acpi_multiply::Device> BindDeviceClient(
- driver::Logger& logger, async_dispatcher_t* dispatcher,
+ driver::Logger* logger, async_dispatcher_t* dispatcher,
std::weak_ptr<AcpiMultiplier> multiplier,
fidl::ServerEnd<fuchsia_examples_acpi_multiply::Device> request);
@@ -31,7 +31,7 @@
void Multiply(MultiplyRequestView request, MultiplyCompleter::Sync& completer) override;
private:
- driver::Logger& logger_;
+ driver::Logger* logger_;
std::weak_ptr<AcpiMultiplier> multiplier_;
};
diff --git a/src/bind_library/child/child-driver.cc b/src/bind_library/child/child-driver.cc
index 457afde..28b3020 100644
--- a/src/bind_library/child/child-driver.cc
+++ b/src/bind_library/child/child-driver.cc
@@ -9,7 +9,7 @@
namespace child_driver {
-zx::status<> ChildDriver::Start() {
+zx::result<> ChildDriver::Start() {
auto connect_result =
driver::Connect<fuchsia_examples_gizmo::Service::Testing>(*context().incoming());
if (connect_result.is_error()) {
diff --git a/src/bind_library/child/child-driver.h b/src/bind_library/child/child-driver.h
index ed548bf..34c4e53 100644
--- a/src/bind_library/child/child-driver.h
+++ b/src/bind_library/child/child-driver.h
@@ -11,13 +11,11 @@
class ChildDriver : public driver::DriverBase {
public:
- ChildDriver(driver::DriverStartArgs start_args,
- fdf::UnownedDispatcher driver_dispatcher)
- : driver::DriverBase("child-driver", std::move(start_args),
- std::move(driver_dispatcher)) {}
+ ChildDriver(driver::DriverStartArgs start_args, fdf::UnownedDispatcher driver_dispatcher)
+ : driver::DriverBase("child-driver", std::move(start_args), std::move(driver_dispatcher)) {}
virtual ~ChildDriver() = default;
- zx::status<> Start() override;
+ zx::result<> Start() override;
};
} // namespace child_driver
diff --git a/src/bind_library/parent/gizmo_server.h b/src/bind_library/parent/gizmo_server.h
index f16e983..d6d1154 100644
--- a/src/bind_library/parent/gizmo_server.h
+++ b/src/bind_library/parent/gizmo_server.h
@@ -12,7 +12,7 @@
class GizmoServer : public fidl::WireServer<fuchsia_examples_gizmo::TestingProtocol> {
public:
- GizmoServer(driver::Logger& logger) : logger_(logger) {}
+ GizmoServer(driver::Logger* logger) : logger_(logger) {}
virtual ~GizmoServer() = default;
static fidl::ServerBindingRef<fuchsia_examples_gizmo::TestingProtocol> BindDeviceClient(
@@ -39,7 +39,7 @@
}
private:
- driver::Logger& logger_;
+ driver::Logger* logger_;
};
} // namespace parent_driver
diff --git a/src/bind_library/parent/parent-driver.cc b/src/bind_library/parent/parent-driver.cc
index 6e75f31..e52330a 100644
--- a/src/bind_library/parent/parent-driver.cc
+++ b/src/bind_library/parent/parent-driver.cc
@@ -12,9 +12,9 @@
namespace parent_driver {
-zx::status<> ParentDriver::Start() {
+zx::result<> ParentDriver::Start() {
node_.Bind(std::move(node()), dispatcher());
- gizmo_server_ = std::make_shared<GizmoServer>(logger_);
+ gizmo_server_ = std::make_shared<GizmoServer>(&logger());
// Add gizmo fuchsia_examples_gizmo::Service to outgoing.
{
@@ -41,7 +41,7 @@
return zx::ok();
}
-zx::status<> ParentDriver::AddChild() {
+zx::result<> ParentDriver::AddChild() {
fidl::Arena arena;
// Offer `fuchsia.examples.gizmo.Service` to the driver that binds to the node.
diff --git a/src/bind_library/parent/parent-driver.h b/src/bind_library/parent/parent-driver.h
index 05c0b81..c8236e9 100644
--- a/src/bind_library/parent/parent-driver.h
+++ b/src/bind_library/parent/parent-driver.h
@@ -17,10 +17,10 @@
: driver::DriverBase("parent-driver", std::move(start_args), std::move(driver_dispatcher)) {}
virtual ~ParentDriver() = default;
- zx::status<> Start() override;
+ zx::result<> Start() override;
private:
- zx::status<> AddChild();
+ zx::result<> AddChild();
fidl::WireClient<fuchsia_driver_framework::Node> node_;
std::shared_ptr<GizmoServer> gizmo_server_;
diff --git a/src/composite_sample/controller/controller.cc b/src/composite_sample/controller/controller.cc
index 06c4e20..9eeaf20 100644
--- a/src/composite_sample/controller/controller.cc
+++ b/src/composite_sample/controller/controller.cc
@@ -13,7 +13,7 @@
const std::string_view kNodeOne = "node-one";
const std::string_view kNodeTwo = "node-two";
-zx::status<> ControllerDriver::Start() {
+zx::result<> ControllerDriver::Start() {
node_.Bind(std::move(node()), dispatcher());
compat_server_one_ = compat::DeviceServer(std::string(kNodeOne), 0, "/topo/one");
@@ -37,7 +37,7 @@
return zx::ok();
}
-zx::status<> ControllerDriver::AddChild(
+zx::result<> ControllerDriver::AddChild(
std::string_view name, compat::DeviceServer& compat,
fidl::WireClient<fuchsia_driver_framework::NodeController>& controller) {
fidl::Arena arena;
diff --git a/src/composite_sample/controller/controller.h b/src/composite_sample/controller/controller.h
index 24c8dba..0576306 100644
--- a/src/composite_sample/controller/controller.h
+++ b/src/composite_sample/controller/controller.h
@@ -17,10 +17,10 @@
std::move(driver_dispatcher)) {}
virtual ~ControllerDriver() = default;
- zx::status<> Start() override;
+ zx::result<> Start() override;
private:
- zx::status<> AddChild(std::string_view name, compat::DeviceServer& compat,
+ zx::result<> AddChild(std::string_view name, compat::DeviceServer& compat,
fidl::WireClient<fuchsia_driver_framework::NodeController>& controller);
fidl::WireClient<fuchsia_driver_framework::Node> node_;
diff --git a/src/composite_sample/driver/composite_sample.cc b/src/composite_sample/driver/composite_sample.cc
index bb50f54..7005ecc 100644
--- a/src/composite_sample/driver/composite_sample.cc
+++ b/src/composite_sample/driver/composite_sample.cc
@@ -9,7 +9,7 @@
namespace composite_sample {
-zx::status<> CompositeSampleDriver::Start() {
+zx::result<> CompositeSampleDriver::Start() {
auto result = PrintTopologicalPath("acpi-GFBY");
if (result.is_error()) {
FDF_SLOG(ERROR, "Failed to print topological path for \"acpi-GFBY\"",
@@ -28,7 +28,7 @@
}
// Print the topological path for a given parent device node.
-zx::status<> CompositeSampleDriver::PrintTopologicalPath(std::string_view name) {
+zx::result<> CompositeSampleDriver::PrintTopologicalPath(std::string_view name) {
// Connect to the parent device node.
auto parent =
driver::Connect<fuchsia_driver_compat::Service::Device>(*context().incoming(), name);
diff --git a/src/composite_sample/driver/composite_sample.h b/src/composite_sample/driver/composite_sample.h
index 42526f2..091b4b1 100644
--- a/src/composite_sample/driver/composite_sample.h
+++ b/src/composite_sample/driver/composite_sample.h
@@ -18,10 +18,10 @@
virtual ~CompositeSampleDriver() = default;
- zx::status<> Start() override;
+ zx::result<> Start() override;
private:
- zx::status<> PrintTopologicalPath(std::string_view name);
+ zx::result<> PrintTopologicalPath(std::string_view name);
};
} // namespace composite_sample
diff --git a/src/example_driver/example_driver.cc b/src/example_driver/example_driver.cc
index 2a0345a..7ac48b9 100644
--- a/src/example_driver/example_driver.cc
+++ b/src/example_driver/example_driver.cc
@@ -11,7 +11,7 @@
namespace example_driver {
-zx::status<> ExampleDriver::Start() {
+zx::result<> ExampleDriver::Start() {
// Connect to the parent device node.
auto parent =
driver::Connect<fuchsia_driver_compat::Service::Device>(*context().incoming(), "default");
diff --git a/src/example_driver/example_driver.h b/src/example_driver/example_driver.h
index 8e1adb0..7a6bb53 100644
--- a/src/example_driver/example_driver.h
+++ b/src/example_driver/example_driver.h
@@ -15,7 +15,7 @@
: driver::DriverBase("example-driver", std::move(start_args), std::move(driver_dispatcher)) {}
virtual ~ExampleDriver() = default;
- zx::status<> Start() override;
+ zx::result<> Start() override;
};
} // namespace example_driver
diff --git a/src/i2c_temperature/controller/i2c_controller.cc b/src/i2c_temperature/controller/i2c_controller.cc
index 34b7713..8ddbe2f 100644
--- a/src/i2c_temperature/controller/i2c_controller.cc
+++ b/src/i2c_temperature/controller/i2c_controller.cc
@@ -10,9 +10,9 @@
namespace i2c_temperature {
-zx::status<> I2cTemperatureController::Start() {
+zx::result<> I2cTemperatureController::Start() {
node_.Bind(std::move(node()), dispatcher());
- i2c_server_ = std::make_shared<I2cDeviceServer>(logger_);
+ i2c_server_ = std::make_shared<I2cDeviceServer>(&logger());
// Serve the fuchsia.hardware.i2c/Device protocol to clients through the
// fuchsia.hardware.i2c/Service wrapper.
@@ -39,7 +39,7 @@
return zx::ok();
}
-zx::status<> I2cTemperatureController::AddChild() {
+zx::result<> I2cTemperatureController::AddChild() {
fidl::Arena arena;
// [START add_child_offer]
diff --git a/src/i2c_temperature/controller/i2c_controller.h b/src/i2c_temperature/controller/i2c_controller.h
index 496e9cc..a8d0b3d 100644
--- a/src/i2c_temperature/controller/i2c_controller.h
+++ b/src/i2c_temperature/controller/i2c_controller.h
@@ -22,10 +22,10 @@
virtual ~I2cTemperatureController() = default;
- zx::status<> Start() override;
+ zx::result<> Start() override;
private:
- zx::status<> AddChild();
+ zx::result<> AddChild();
fidl::WireSharedClient<fuchsia_driver_framework::Node> node_;
fidl::WireSharedClient<fuchsia_driver_framework::NodeController> controller_;
diff --git a/src/i2c_temperature/controller/i2c_server.h b/src/i2c_temperature/controller/i2c_server.h
index b25fec1..da42c1b 100644
--- a/src/i2c_temperature/controller/i2c_server.h
+++ b/src/i2c_temperature/controller/i2c_server.h
@@ -16,8 +16,7 @@
static constexpr uint32_t kTempIncrement = 5;
public:
- I2cDeviceServer(driver::Logger& logger)
- : logger_(logger), temperature_(kStartingTemp) {}
+ I2cDeviceServer(driver::Logger* logger) : logger_(logger), temperature_(kStartingTemp) {}
static fidl::ServerBindingRef<fuchsia_hardware_i2c::Device> BindDeviceClient(
std::shared_ptr<I2cDeviceServer> server_impl, async_dispatcher_t* dispatcher,
@@ -31,7 +30,7 @@
private:
void HandleWrite(const fidl::VectorView<uint8_t> write_data);
- driver::Logger& logger_;
+ driver::Logger* logger_;
uint32_t temperature_;
};
diff --git a/src/i2c_temperature/driver/i2c_channel.cc b/src/i2c_temperature/driver/i2c_channel.cc
index e97f064..3c7b64c 100644
--- a/src/i2c_temperature/driver/i2c_channel.cc
+++ b/src/i2c_temperature/driver/i2c_channel.cc
@@ -19,12 +19,12 @@
return zx::ok(be16toh(value));
}
-zx::status<> I2cChannel::Write16(uint16_t value) {
+zx::result<> I2cChannel::Write16(uint16_t value) {
value = htobe16(value);
return WriteReadSync(reinterpret_cast<uint8_t*>(&value), sizeof(value), nullptr, 0);
}
-zx::status<> I2cChannel::WriteReadSync(const uint8_t* tx_buf, size_t tx_len, uint8_t* rx_buf,
+zx::result<> I2cChannel::WriteReadSync(const uint8_t* tx_buf, size_t tx_len, uint8_t* rx_buf,
size_t rx_len) {
if (tx_len > fuchsia_hardware_i2c::wire::kMaxTransferSize ||
rx_len > fuchsia_hardware_i2c::wire::kMaxTransferSize) {
diff --git a/src/i2c_temperature/driver/i2c_channel.h b/src/i2c_temperature/driver/i2c_channel.h
index 7c4e74e..82225ea 100644
--- a/src/i2c_temperature/driver/i2c_channel.h
+++ b/src/i2c_temperature/driver/i2c_channel.h
@@ -23,10 +23,10 @@
// Functions that perform read/write transactions through the client.
// The values are transferred across the I2C channel in big-endian order.
zx::status<uint16_t> Read16();
- zx::status<> Write16(uint16_t value);
+ zx::result<> Write16(uint16_t value);
private:
- zx::status<> WriteReadSync(const uint8_t* tx_buf, size_t tx_len, uint8_t* rx_buf, size_t rx_len);
+ zx::result<> WriteReadSync(const uint8_t* tx_buf, size_t tx_len, uint8_t* rx_buf, size_t rx_len);
fidl::WireClient<fuchsia_hardware_i2c::Device> fidl_client_;
};
diff --git a/src/i2c_temperature/driver/i2c_temperature.cc b/src/i2c_temperature/driver/i2c_temperature.cc
index d8709a9..4865032 100644
--- a/src/i2c_temperature/driver/i2c_temperature.cc
+++ b/src/i2c_temperature/driver/i2c_temperature.cc
@@ -12,7 +12,7 @@
namespace i2c_temperature {
-zx::status<> I2cTemperatureDriver::Start() {
+zx::result<> I2cTemperatureDriver::Start() {
// Connect to the I2C bus controller.
auto channel_result = SetupI2cChannel();
if (channel_result.is_error()) {
@@ -26,7 +26,7 @@
auto result = service.add_device(
[this](fidl::ServerEnd<fuchsia_examples_i2c_temperature::Device> request) -> void {
- I2cTemperatureServer::BindDeviceClient(dispatcher(), logger_, i2c_channel_,
+ I2cTemperatureServer::BindDeviceClient(dispatcher(), &logger(), i2c_channel_,
std::move(request));
});
ZX_ASSERT(result.is_ok());
@@ -59,7 +59,7 @@
}
// Connect to the `fuchsia.hardware.i2c/Device` protocol offered by the parent device node.
-zx::status<> I2cTemperatureDriver::SetupI2cChannel() {
+zx::result<> I2cTemperatureDriver::SetupI2cChannel() {
auto client_endpoint =
driver::Connect<fuchsia_hardware_i2c::Service::Device>(*context().incoming(), "default");
if (client_endpoint.status_value() != ZX_OK) {
diff --git a/src/i2c_temperature/driver/i2c_temperature.h b/src/i2c_temperature/driver/i2c_temperature.h
index 680b84b..6445147 100644
--- a/src/i2c_temperature/driver/i2c_temperature.h
+++ b/src/i2c_temperature/driver/i2c_temperature.h
@@ -20,10 +20,10 @@
virtual ~I2cTemperatureDriver() = default;
- zx::status<> Start() override;
+ zx::result<> Start() override;
private:
- zx::status<> SetupI2cChannel();
+ zx::result<> SetupI2cChannel();
std::shared_ptr<I2cChannel> i2c_channel_;
};
diff --git a/src/i2c_temperature/driver/temperature_server.cc b/src/i2c_temperature/driver/temperature_server.cc
index f46c487..923ca36 100644
--- a/src/i2c_temperature/driver/temperature_server.cc
+++ b/src/i2c_temperature/driver/temperature_server.cc
@@ -15,7 +15,7 @@
// Handle incoming connection requests from FIDL clients
fidl::ServerBindingRef<fuchsia_examples_i2c_temperature::Device>
I2cTemperatureServer::BindDeviceClient(
- async_dispatcher_t* dispatcher, driver::Logger& logger, std::weak_ptr<I2cChannel> i2c_channel,
+ async_dispatcher_t* dispatcher, driver::Logger* logger, std::weak_ptr<I2cChannel> i2c_channel,
fidl::ServerEnd<fuchsia_examples_i2c_temperature::Device> request) {
// Bind each connection request to the shared instance.
auto server_impl = std::make_unique<I2cTemperatureServer>(logger, i2c_channel);
diff --git a/src/i2c_temperature/driver/temperature_server.h b/src/i2c_temperature/driver/temperature_server.h
index 2bc52e5..ba00fb2 100644
--- a/src/i2c_temperature/driver/temperature_server.h
+++ b/src/i2c_temperature/driver/temperature_server.h
@@ -15,11 +15,11 @@
// FIDL server implementation for the `fuchsia.examples.i2c.temperature/Device` protocol
class I2cTemperatureServer : public fidl::WireServer<fuchsia_examples_i2c_temperature::Device> {
public:
- I2cTemperatureServer(driver::Logger& logger, std::weak_ptr<I2cChannel> i2c_channel)
+ I2cTemperatureServer(driver::Logger* logger, std::weak_ptr<I2cChannel> i2c_channel)
: logger_(logger), i2c_channel_(i2c_channel) {}
static fidl::ServerBindingRef<fuchsia_examples_i2c_temperature::Device> BindDeviceClient(
- async_dispatcher_t* dispatcher, driver::Logger& logger, std::weak_ptr<I2cChannel> i2c_channel,
+ async_dispatcher_t* dispatcher, driver::Logger* logger, std::weak_ptr<I2cChannel> i2c_channel,
fidl::ServerEnd<fuchsia_examples_i2c_temperature::Device> request);
void OnUnbound(fidl::UnbindInfo info,
@@ -32,7 +32,7 @@
void ResetSensor(ResetSensorCompleter::Sync& completer) override;
private:
- driver::Logger& logger_;
+ driver::Logger* logger_;
std::weak_ptr<I2cChannel> i2c_channel_;
};
diff --git a/src/input_sample/input_sample.cc b/src/input_sample/input_sample.cc
index f2015b6..b569f2f 100644
--- a/src/input_sample/input_sample.cc
+++ b/src/input_sample/input_sample.cc
@@ -11,7 +11,7 @@
namespace input_sample {
-zx::status<> InputSampleDriver::Start() {
+zx::result<> InputSampleDriver::Start() {
// Connect to the parent device node.
auto parent =
driver::Connect<fuchsia_driver_compat::Service::Device>(*context().incoming(), "default");
@@ -23,7 +23,7 @@
// Add the fuchsia.input.report/InputDevice protocol to be served as "/svc/input-sample"
auto result = context().outgoing()->component().AddProtocol<fuchsia_input_report::InputDevice>(
[this](fidl::ServerEnd<fuchsia_input_report::InputDevice> request) {
- InputSampleServer::BindDeviceClient(logger_, dispatcher(), input_report_readers_,
+ InputSampleServer::BindDeviceClient(&logger(), dispatcher(), input_report_readers_,
std::move(request));
},
name());
diff --git a/src/input_sample/input_sample.h b/src/input_sample/input_sample.h
index d13b4db..27f53ff 100644
--- a/src/input_sample/input_sample.h
+++ b/src/input_sample/input_sample.h
@@ -18,7 +18,7 @@
: driver::DriverBase("input-sample", std::move(start_args), std::move(driver_dispatcher)) {}
virtual ~InputSampleDriver() = default;
- zx::status<> Start() override;
+ zx::result<> Start() override;
private:
void SendFakeReport();
diff --git a/src/input_sample/input_server.cc b/src/input_sample/input_server.cc
index 81b4c30..07f7767 100644
--- a/src/input_sample/input_server.cc
+++ b/src/input_sample/input_server.cc
@@ -34,7 +34,7 @@
// Static
// Handle incoming connection requests from FIDL clients
fidl::ServerBindingRef<fuchsia_input_report::InputDevice> InputSampleServer::BindDeviceClient(
- driver::Logger& logger, async_dispatcher_t* dispatcher,
+ driver::Logger* logger, async_dispatcher_t* dispatcher,
std::weak_ptr<input_report_reader::InputReportReaderManager<SampleInputReport>>
input_report_readers,
fidl::ServerEnd<fuchsia_input_report::InputDevice> request) {
diff --git a/src/input_sample/input_server.h b/src/input_sample/input_server.h
index de8e3b8..6301b43 100644
--- a/src/input_sample/input_server.h
+++ b/src/input_sample/input_server.h
@@ -28,13 +28,13 @@
// FIDL server implementation for the `fuchsia.input.report/InputDevice` protocol
class InputSampleServer : public fidl::WireServer<fuchsia_input_report::InputDevice> {
public:
- InputSampleServer(driver::Logger& logger, async_dispatcher_t* dispatcher,
+ InputSampleServer(driver::Logger* logger, async_dispatcher_t* dispatcher,
std::weak_ptr<input_report_reader::InputReportReaderManager<SampleInputReport>>
input_report_readers)
: logger_(logger), dispatcher_(dispatcher), input_report_readers_(input_report_readers) {}
static fidl::ServerBindingRef<fuchsia_input_report::InputDevice> BindDeviceClient(
- driver::Logger& logger, async_dispatcher_t* dispatcher,
+ driver::Logger* logger, async_dispatcher_t* dispatcher,
std::weak_ptr<input_report_reader::InputReportReaderManager<SampleInputReport>>
input_report_readers,
fidl::ServerEnd<fuchsia_input_report::InputDevice> request);
@@ -66,7 +66,7 @@
}
private:
- driver::Logger& logger_;
+ driver::Logger* logger_;
async_dispatcher_t* const dispatcher_;
std::weak_ptr<input_report_reader::InputReportReaderManager<SampleInputReport>>
input_report_readers_;
diff --git a/src/qemu_edu/drivers/edu_device.cc b/src/qemu_edu/drivers/edu_device.cc
index 4663b90..764a7c1 100644
--- a/src/qemu_edu/drivers/edu_device.cc
+++ b/src/qemu_edu/drivers/edu_device.cc
@@ -12,7 +12,7 @@
// [START interrupt_mmio]
// Initialize PCI device hardware resources
-zx::status<> QemuEduDevice::MapInterruptAndMmio() {
+zx::result<> QemuEduDevice::MapInterruptAndMmio() {
// Retrieve the Base Address Register (BAR) for PCI Region 0
auto bar = pci_->GetBar(0);
if (!bar.ok()) {
diff --git a/src/qemu_edu/drivers/edu_device.h b/src/qemu_edu/drivers/edu_device.h
index 0867c39..ebed2e0 100644
--- a/src/qemu_edu/drivers/edu_device.h
+++ b/src/qemu_edu/drivers/edu_device.h
@@ -59,11 +59,11 @@
// [END class_header]
// [START public_main]
public:
- explicit QemuEduDevice(driver::Logger& logger, async_dispatcher_t* dispatcher,
+ explicit QemuEduDevice(driver::Logger* logger, async_dispatcher_t* dispatcher,
fidl::ClientEnd<fuchsia_hardware_pci::Device> pci)
: dispatcher_(dispatcher), logger_(logger), pci_(std::move(pci)) {}
- zx::status<> MapInterruptAndMmio();
+ zx::result<> MapInterruptAndMmio();
// [END public_main]
// [START public_registers]
@@ -81,7 +81,7 @@
async_dispatcher_t* const dispatcher_;
- driver::Logger& logger_;
+ driver::Logger* logger_;
fidl::WireSyncClient<fuchsia_hardware_pci::Device> pci_;
std::optional<fdf::MmioBuffer> mmio_;
zx::interrupt irq_;
diff --git a/src/qemu_edu/drivers/edu_server.h b/src/qemu_edu/drivers/edu_server.h
index c3e03d0..78642ed 100644
--- a/src/qemu_edu/drivers/edu_server.h
+++ b/src/qemu_edu/drivers/edu_server.h
@@ -20,11 +20,11 @@
// FIDL server implementation for the `fuchsia.examples.qemuedu/Device` protocol.
class QemuEduServer : public fidl::WireServer<fuchsia_examples_qemuedu::Device> {
public:
- explicit QemuEduServer(driver::Logger& logger, std::weak_ptr<edu_device::QemuEduDevice> device)
+ explicit QemuEduServer(driver::Logger* logger, std::weak_ptr<edu_device::QemuEduDevice> device)
: logger_(logger), device_(std::move(device)) {}
static fidl::ServerBindingRef<fuchsia_examples_qemuedu::Device> BindDeviceClient(
- driver::Logger& logger, async_dispatcher_t* dispatcher,
+ driver::Logger* logger, async_dispatcher_t* dispatcher,
std::weak_ptr<edu_device::QemuEduDevice> device,
fidl::ServerEnd<fuchsia_examples_qemuedu::Device> request) {
// Bind each connection request to a unique FIDL server instance
@@ -50,7 +50,7 @@
void LivenessCheck(LivenessCheckCompleter::Sync& completer) override;
private:
- driver::Logger& logger_;
+ driver::Logger* logger_;
std::weak_ptr<edu_device::QemuEduDevice> device_;
};
// [END fidl_server]
diff --git a/src/qemu_edu/drivers/qemu_edu.cc b/src/qemu_edu/drivers/qemu_edu.cc
index e17aa0b..d0e3fe2 100644
--- a/src/qemu_edu/drivers/qemu_edu.cc
+++ b/src/qemu_edu/drivers/qemu_edu.cc
@@ -20,7 +20,7 @@
// [START start_method_start]
// Initialize this driver instance
-zx::status<> QemuEduDriver::Start() {
+zx::result<> QemuEduDriver::Start() {
// [END start_method_start]
// [START connect_device]
// Connect to the parent device node.
@@ -50,7 +50,7 @@
// [START hw_resources]
// Map hardware resources from the PCI device
- device_ = std::make_shared<edu_device::QemuEduDevice>(logger(), dispatcher(),
+ device_ = std::make_shared<edu_device::QemuEduDevice>(&logger(), dispatcher(),
std::move(pci_endpoints->client));
auto pci_status = device_->MapInterruptAndMmio();
if (pci_status.is_error()) {
@@ -72,7 +72,7 @@
auto result =
service.add_device([this](fidl::ServerEnd<fuchsia_examples_qemuedu::Device> request) -> void {
- QemuEduServer::BindDeviceClient(logger(), dispatcher(), device_, std::move(request));
+ QemuEduServer::BindDeviceClient(&logger(), dispatcher(), device_, std::move(request));
});
ZX_ASSERT(result.is_ok());
@@ -112,6 +112,9 @@
node().reset();
return;
}
+
+ FDF_SLOG(INFO, "Exported", KV("service_path", service_path.c_str()),
+ KV("devfs_path", devfs_path.c_str()));
});
// [END devfs_export]
diff --git a/src/qemu_edu/drivers/qemu_edu.h b/src/qemu_edu/drivers/qemu_edu.h
index 486970a..c7969e6 100644
--- a/src/qemu_edu/drivers/qemu_edu.h
+++ b/src/qemu_edu/drivers/qemu_edu.h
@@ -29,7 +29,7 @@
virtual ~QemuEduDriver() = default;
// Start hook called by the driver factory.
- zx::status<> Start() override;
+ zx::result<> Start() override;
// [END public_main]
// [START private_main]
diff --git a/src/qemu_edu/tests/qemu_edu_system_test.cc b/src/qemu_edu/tests/qemu_edu_system_test.cc
index a55f07e..c3f7770 100644
--- a/src/qemu_edu/tests/qemu_edu_system_test.cc
+++ b/src/qemu_edu/tests/qemu_edu_system_test.cc
@@ -5,19 +5,17 @@
// [START imports]
#include <dirent.h>
#include <fcntl.h>
+#include <fidl/fuchsia.examples.qemuedu/cpp/wire.h>
#include <lib/fdio/directory.h>
#include <sys/types.h>
#include <gtest/gtest.h>
-
-#include <fidl/fuchsia.examples.qemuedu/cpp/wire.h>
// [END imports]
// [START main_body]
namespace {
-constexpr char kEduDevicePath[] =
- "/dev/sys/platform/platform-passthrough/PCI0/bus/00:06.0_/qemu-edu";
+constexpr char kEduDevicePath[] = "/dev/sys/platform/pt/PCI0/bus/00:06.0_/qemu-edu";
class QemuEduSystemTest : public testing::Test {
public:
diff --git a/src/qemu_edu/tools/eductl.cc b/src/qemu_edu/tools/eductl.cc
index c282a7c..b654fb3 100644
--- a/src/qemu_edu/tools/eductl.cc
+++ b/src/qemu_edu/tools/eductl.cc
@@ -21,8 +21,7 @@
// [END fidl_imports]
// [START device_path]
-constexpr char kEduDevicePath[] =
- "/dev/sys/platform/platform-passthrough/PCI0/bus/00:06.0_/qemu-edu";
+constexpr char kEduDevicePath[] = "/dev/sys/platform/pt/PCI0/bus/00:06.0_/qemu-edu";
// [END device_path]
// [START cli_helpers]
diff --git a/third_party/sdk-integration b/third_party/sdk-integration
index c3f409b..dae671c 160000
--- a/third_party/sdk-integration
+++ b/third_party/sdk-integration
@@ -1 +1 @@
-Subproject commit c3f409b50df57093a74ea7107c186be151d0cba5
+Subproject commit dae671c83ccf72d65594179b16cb881637f3f137