Skip to main content

fidl_fuchsia_hardware_cpu_ctrl/
fidl_fuchsia_hardware_cpu_ctrl.rs

1// WARNING: This file is machine generated by fidlgen.
2
3#![warn(clippy::all)]
4#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
5
6use bitflags::bitflags;
7use fidl::client::QueryResponseFut;
8use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
9use fidl::endpoints::{ControlHandle as _, Responder as _};
10pub use fidl_fuchsia_hardware_cpu_ctrl_common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
15pub struct DeviceMarker;
16
17impl fidl::endpoints::ProtocolMarker for DeviceMarker {
18    type Proxy = DeviceProxy;
19    type RequestStream = DeviceRequestStream;
20    #[cfg(target_os = "fuchsia")]
21    type SynchronousProxy = DeviceSynchronousProxy;
22
23    const DEBUG_NAME: &'static str = "(anonymous) Device";
24}
25pub type DeviceGetOperatingPointInfoResult = Result<CpuOperatingPointInfo, i32>;
26pub type DeviceSetCurrentOperatingPointResult = Result<u32, i32>;
27pub type DeviceSetMinimumOperatingPointLimitResult = Result<(), i32>;
28pub type DeviceSetMaximumOperatingPointLimitResult = Result<(), i32>;
29pub type DeviceSetOperatingPointLimitsResult = Result<(), i32>;
30pub type DeviceGetCurrentOperatingPointLimitsResult = Result<(u32, u32), i32>;
31pub type DeviceGetOperatingPointCountResult = Result<u32, i32>;
32pub type DeviceGetRelativePerformanceResult = Result<u8, i32>;
33pub type DeviceGetRelativePerformance2Result = Result<u64, i32>;
34
35pub trait DeviceProxyInterface: Send + Sync {
36    type GetOperatingPointInfoResponseFut: std::future::Future<Output = Result<DeviceGetOperatingPointInfoResult, fidl::Error>>
37        + Send;
38    fn r#get_operating_point_info(&self, opp: u32) -> Self::GetOperatingPointInfoResponseFut;
39    type GetCurrentOperatingPointResponseFut: std::future::Future<Output = Result<u32, fidl::Error>>
40        + Send;
41    fn r#get_current_operating_point(&self) -> Self::GetCurrentOperatingPointResponseFut;
42    type SetCurrentOperatingPointResponseFut: std::future::Future<Output = Result<DeviceSetCurrentOperatingPointResult, fidl::Error>>
43        + Send;
44    fn r#set_current_operating_point(
45        &self,
46        requested_opp: u32,
47    ) -> Self::SetCurrentOperatingPointResponseFut;
48    type SetMinimumOperatingPointLimitResponseFut: std::future::Future<Output = Result<DeviceSetMinimumOperatingPointLimitResult, fidl::Error>>
49        + Send;
50    fn r#set_minimum_operating_point_limit(
51        &self,
52        minimum_opp: u32,
53    ) -> Self::SetMinimumOperatingPointLimitResponseFut;
54    type SetMaximumOperatingPointLimitResponseFut: std::future::Future<Output = Result<DeviceSetMaximumOperatingPointLimitResult, fidl::Error>>
55        + Send;
56    fn r#set_maximum_operating_point_limit(
57        &self,
58        maximum_opp: u32,
59    ) -> Self::SetMaximumOperatingPointLimitResponseFut;
60    type SetOperatingPointLimitsResponseFut: std::future::Future<Output = Result<DeviceSetOperatingPointLimitsResult, fidl::Error>>
61        + Send;
62    fn r#set_operating_point_limits(
63        &self,
64        minimum_opp: u32,
65        maximum_opp: u32,
66    ) -> Self::SetOperatingPointLimitsResponseFut;
67    type GetCurrentOperatingPointLimitsResponseFut: std::future::Future<
68            Output = Result<DeviceGetCurrentOperatingPointLimitsResult, fidl::Error>,
69        > + Send;
70    fn r#get_current_operating_point_limits(
71        &self,
72    ) -> Self::GetCurrentOperatingPointLimitsResponseFut;
73    type GetOperatingPointCountResponseFut: std::future::Future<Output = Result<DeviceGetOperatingPointCountResult, fidl::Error>>
74        + Send;
75    fn r#get_operating_point_count(&self) -> Self::GetOperatingPointCountResponseFut;
76    type GetNumLogicalCoresResponseFut: std::future::Future<Output = Result<u64, fidl::Error>>
77        + Send;
78    fn r#get_num_logical_cores(&self) -> Self::GetNumLogicalCoresResponseFut;
79    type GetLogicalCoreIdResponseFut: std::future::Future<Output = Result<u64, fidl::Error>> + Send;
80    fn r#get_logical_core_id(&self, index: u64) -> Self::GetLogicalCoreIdResponseFut;
81    type GetDomainIdResponseFut: std::future::Future<Output = Result<u32, fidl::Error>> + Send;
82    fn r#get_domain_id(&self) -> Self::GetDomainIdResponseFut;
83    type GetRelativePerformanceResponseFut: std::future::Future<Output = Result<DeviceGetRelativePerformanceResult, fidl::Error>>
84        + Send;
85    fn r#get_relative_performance(&self) -> Self::GetRelativePerformanceResponseFut;
86    type GetRelativePerformance2ResponseFut: std::future::Future<Output = Result<DeviceGetRelativePerformance2Result, fidl::Error>>
87        + Send;
88    fn r#get_relative_performance2(&self) -> Self::GetRelativePerformance2ResponseFut;
89}
90#[derive(Debug)]
91#[cfg(target_os = "fuchsia")]
92pub struct DeviceSynchronousProxy {
93    client: fidl::client::sync::Client,
94}
95
96#[cfg(target_os = "fuchsia")]
97impl fidl::endpoints::SynchronousProxy for DeviceSynchronousProxy {
98    type Proxy = DeviceProxy;
99    type Protocol = DeviceMarker;
100
101    fn from_channel(inner: fidl::Channel) -> Self {
102        Self::new(inner)
103    }
104
105    fn into_channel(self) -> fidl::Channel {
106        self.client.into_channel()
107    }
108
109    fn as_channel(&self) -> &fidl::Channel {
110        self.client.as_channel()
111    }
112}
113
114#[cfg(target_os = "fuchsia")]
115impl DeviceSynchronousProxy {
116    pub fn new(channel: fidl::Channel) -> Self {
117        Self { client: fidl::client::sync::Client::new(channel) }
118    }
119
120    pub fn into_channel(self) -> fidl::Channel {
121        self.client.into_channel()
122    }
123
124    /// Waits until an event arrives and returns it. It is safe for other
125    /// threads to make concurrent requests while waiting for an event.
126    pub fn wait_for_event(
127        &self,
128        deadline: zx::MonotonicInstant,
129    ) -> Result<DeviceEvent, fidl::Error> {
130        DeviceEvent::decode(self.client.wait_for_event::<DeviceMarker>(deadline)?)
131    }
132
133    /// Returns information about a given operating point for this performance
134    /// domain.
135    pub fn r#get_operating_point_info(
136        &self,
137        mut opp: u32,
138        ___deadline: zx::MonotonicInstant,
139    ) -> Result<DeviceGetOperatingPointInfoResult, fidl::Error> {
140        let _response = self.client.send_query::<
141            DeviceGetOperatingPointInfoRequest,
142            fidl::encoding::ResultType<DeviceGetOperatingPointInfoResponse, i32>,
143            DeviceMarker,
144        >(
145            (opp,),
146            0x6594a9234fc958e2,
147            fidl::encoding::DynamicFlags::empty(),
148            ___deadline,
149        )?;
150        Ok(_response.map(|x| x.info))
151    }
152
153    /// Gets the current operating point of the device.
154    pub fn r#get_current_operating_point(
155        &self,
156        ___deadline: zx::MonotonicInstant,
157    ) -> Result<u32, fidl::Error> {
158        let _response = self.client.send_query::<
159            fidl::encoding::EmptyPayload,
160            DeviceGetCurrentOperatingPointResponse,
161            DeviceMarker,
162        >(
163            (),
164            0x52de67a5993f5fe1,
165            fidl::encoding::DynamicFlags::empty(),
166            ___deadline,
167        )?;
168        Ok(_response.out_opp)
169    }
170
171    /// Set the operating point of this device to the requested operating point.
172    ///
173    /// Operating points are in numeric P-state order, such that the maximum
174    /// operating performance point is 0 and the minimum is n-1, where n is the
175    /// number of operating points returned by GetOperatingPointCount().
176    ///
177    /// The requested operating point may be clamped to the range [min, max]
178    /// when operating point limits are supported. See SetOperatingPointLimits
179    /// for details.
180    ///
181    /// Returns ZX_OK, if the device is in a working state and the operating
182    /// point is changed to requested_opp successfully. out_opp will be same as
183    /// requested_opp.
184    ///
185    /// Returns ZX_ERR_OUT_OF_RANGE if the minimum_opp is outside of the range
186    /// [n-1, 0], where n is the number of operating points returned by
187    /// GetOperatingPointCount().
188    ///
189    /// Returns error status, if switching to the requested_opp was
190    /// unsuccessful. out_opp is the operating performance point (OPP) that the
191    /// device is currently in.
192    pub fn r#set_current_operating_point(
193        &self,
194        mut requested_opp: u32,
195        ___deadline: zx::MonotonicInstant,
196    ) -> Result<DeviceSetCurrentOperatingPointResult, fidl::Error> {
197        let _response = self.client.send_query::<
198            DeviceSetCurrentOperatingPointRequest,
199            fidl::encoding::ResultType<DeviceSetCurrentOperatingPointResponse, i32>,
200            DeviceMarker,
201        >(
202            (requested_opp,),
203            0x34a7828b5ca53fd,
204            fidl::encoding::DynamicFlags::empty(),
205            ___deadline,
206        )?;
207        Ok(_response.map(|x| x.out_opp))
208    }
209
210    /// Sets the minimum operating point to use, particularly when the kernel
211    /// automatically controls the operating points of this device.
212    ///
213    /// See SetOperatingPointLimits for details on the semantics of operating
214    /// point limits.
215    ///
216    /// Returns ZX_OK on success.
217    ///
218    /// Returns ZX_ERR_OUT_OF_RANGE if the minimum_opp is outside of the range
219    /// [n-1, 0], where n is the number of operating points returned by
220    /// GetOperatingPointCount().
221    ///
222    /// Returns ZX_ERR_NOT_SUPPORTED if the device does not support limits.
223    pub fn r#set_minimum_operating_point_limit(
224        &self,
225        mut minimum_opp: u32,
226        ___deadline: zx::MonotonicInstant,
227    ) -> Result<DeviceSetMinimumOperatingPointLimitResult, fidl::Error> {
228        let _response = self.client.send_query::<
229            DeviceSetMinimumOperatingPointLimitRequest,
230            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
231            DeviceMarker,
232        >(
233            (minimum_opp,),
234            0x5467de86fa3fdfe7,
235            fidl::encoding::DynamicFlags::empty(),
236            ___deadline,
237        )?;
238        Ok(_response.map(|x| x))
239    }
240
241    /// Sets the maximum operating point to use, particularly when the kernel
242    /// automatically controls the operating points of this device.
243    ///
244    /// See SetOperatingPointLimits for details on the semantics of operating
245    /// point limits.
246    ///
247    /// Returns ZX_OK on success.
248    ///
249    /// Returns ZX_ERR_OUT_OF_RANGE if the maximum_opp is outside of the range
250    /// [n-1, 0], where n is the number of operating points returned by
251    /// GetOperatingPointCount().
252    ///
253    /// Returns ZX_ERR_NOT_SUPPORTED if the device does not support limits.
254    pub fn r#set_maximum_operating_point_limit(
255        &self,
256        mut maximum_opp: u32,
257        ___deadline: zx::MonotonicInstant,
258    ) -> Result<DeviceSetMaximumOperatingPointLimitResult, fidl::Error> {
259        let _response = self.client.send_query::<
260            DeviceSetMaximumOperatingPointLimitRequest,
261            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
262            DeviceMarker,
263        >(
264            (maximum_opp,),
265            0x385fa4d74481fbfd,
266            fidl::encoding::DynamicFlags::empty(),
267            ___deadline,
268        )?;
269        Ok(_response.map(|x| x))
270    }
271
272    /// Sets the operational boundaries (minimum and maximum operating points)
273    /// for the device, when supported.
274    ///
275    /// Limits define the allowable performance range for the performance
276    /// domain. They are primarily used for:
277    /// * Thermal Mitigation: Progressively lowering the maximum operating point
278    ///   (moving from 0 toward n-1) to reduce power dissipation.
279    /// * Performance Boosting: Raising the minimum operating point (moving
280    ///   from n-1 toward 0) when automatic performance matching is insufficient
281    ///   for the current workload.
282    ///
283    /// Limits are useful on platforms where ether hardware or the kernel
284    /// automatically manages performance. By setting boundaries, userspace can
285    /// enforce power and performance policies while allowing the underlying
286    /// system to react to high-fidelity signals in real-time.
287    ///
288    /// When limits are applied, the active operating point is clamped to the range:
289    /// `[max(minimum_opp, maximim_opp), maximum_opp]`.
290    ///
291    /// Note that `maximim_opp` and `minimum_opp` reside in the P-state range [n-1, 0].
292    /// This logic ensures that the `minimum_opp` can be adjusted independently while
293    /// always respecting the ceiling imposed by the `maximim_opp`.
294    ///
295    /// Set the operating point limits to (n-1, 0) to effectively remove the limits.
296    ///
297    /// Returns ZX_OK on success.
298    ///
299    /// Returns ZX_ERR_OUT_OF_RANGE if the minimum_opp or maximum_opp is outside
300    /// of the range [n-1, 0], where n is the number of operating points
301    /// returned by GetOperatingPointCount().
302    ///
303    /// Returns ZX_ERR_NOT_SUPPORTED if the device does not support limits.
304    pub fn r#set_operating_point_limits(
305        &self,
306        mut minimum_opp: u32,
307        mut maximum_opp: u32,
308        ___deadline: zx::MonotonicInstant,
309    ) -> Result<DeviceSetOperatingPointLimitsResult, fidl::Error> {
310        let _response = self.client.send_query::<
311            DeviceSetOperatingPointLimitsRequest,
312            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
313            DeviceMarker,
314        >(
315            (minimum_opp, maximum_opp,),
316            0x30aa7514dd598b23,
317            fidl::encoding::DynamicFlags::empty(),
318            ___deadline,
319        )?;
320        Ok(_response.map(|x| x))
321    }
322
323    /// Returns the current minimum and maximum operating point limits.
324    ///
325    /// Returns ZX_OK on success.
326    ///
327    /// Returns ZX_ERR_NOT_SUPPORTED if the device does not support limits.
328    pub fn r#get_current_operating_point_limits(
329        &self,
330        ___deadline: zx::MonotonicInstant,
331    ) -> Result<DeviceGetCurrentOperatingPointLimitsResult, fidl::Error> {
332        let _response =
333            self.client.send_query::<fidl::encoding::EmptyPayload, fidl::encoding::ResultType<
334                DeviceGetCurrentOperatingPointLimitsResponse,
335                i32,
336            >, DeviceMarker>(
337                (),
338                0x7aefe3d765cfc6a7,
339                fidl::encoding::DynamicFlags::empty(),
340                ___deadline,
341            )?;
342        Ok(_response.map(|x| (x.minimum_opp, x.maximum_opp)))
343    }
344
345    /// Returns the number of operating points within this performance domain.
346    pub fn r#get_operating_point_count(
347        &self,
348        ___deadline: zx::MonotonicInstant,
349    ) -> Result<DeviceGetOperatingPointCountResult, fidl::Error> {
350        let _response = self.client.send_query::<
351            fidl::encoding::EmptyPayload,
352            fidl::encoding::ResultType<DeviceGetOperatingPointCountResponse, i32>,
353            DeviceMarker,
354        >(
355            (),
356            0x13e70ec7131889ba,
357            fidl::encoding::DynamicFlags::empty(),
358            ___deadline,
359        )?;
360        Ok(_response.map(|x| x.count))
361    }
362
363    /// Returns the number of logical cores contained within this performance
364    /// domain.
365    pub fn r#get_num_logical_cores(
366        &self,
367        ___deadline: zx::MonotonicInstant,
368    ) -> Result<u64, fidl::Error> {
369        let _response = self.client.send_query::<
370            fidl::encoding::EmptyPayload,
371            DeviceGetNumLogicalCoresResponse,
372            DeviceMarker,
373        >(
374            (),
375            0x74e304c90ca165c5,
376            fidl::encoding::DynamicFlags::empty(),
377            ___deadline,
378        )?;
379        Ok(_response.count)
380    }
381
382    /// Returns a global system-wide core ID for the nth core in this
383    /// performance domain. `index` must be a value in the range [0, n) where
384    /// n is the value returned by GetNumLogicalCores().
385    pub fn r#get_logical_core_id(
386        &self,
387        mut index: u64,
388        ___deadline: zx::MonotonicInstant,
389    ) -> Result<u64, fidl::Error> {
390        let _response = self.client.send_query::<
391            DeviceGetLogicalCoreIdRequest,
392            DeviceGetLogicalCoreIdResponse,
393            DeviceMarker,
394        >(
395            (index,),
396            0x7168f98ddbd26058,
397            fidl::encoding::DynamicFlags::empty(),
398            ___deadline,
399        )?;
400        Ok(_response.id)
401    }
402
403    /// Returns the id of this performance domain within its package. This
404    /// number should be stable across boots, but clients should prefer to use
405    /// GetRelativePerformance to differentiate cores if possible.
406    pub fn r#get_domain_id(&self, ___deadline: zx::MonotonicInstant) -> Result<u32, fidl::Error> {
407        let _response = self
408            .client
409            .send_query::<fidl::encoding::EmptyPayload, DeviceGetDomainIdResponse, DeviceMarker>(
410                (),
411                0x3030f85bdc1ef321,
412                fidl::encoding::DynamicFlags::empty(),
413                ___deadline,
414            )?;
415        Ok(_response.domain_id)
416    }
417
418    /// The relative performance of this domain as configured by the platform,
419    /// if known. The highest performance domain should return 255, while others
420    /// should return N/255 fractional values relative to that domain.
421    /// Returns ZX_ERR_NOT_SUPPORTED if the performance level is unknown.
422    pub fn r#get_relative_performance(
423        &self,
424        ___deadline: zx::MonotonicInstant,
425    ) -> Result<DeviceGetRelativePerformanceResult, fidl::Error> {
426        let _response = self.client.send_query::<
427            fidl::encoding::EmptyPayload,
428            fidl::encoding::ResultType<DeviceGetRelativePerformanceResponse, i32>,
429            DeviceMarker,
430        >(
431            (),
432            0x41c37eaf0c26a3d3,
433            fidl::encoding::DynamicFlags::empty(),
434            ___deadline,
435        )?;
436        Ok(_response.map(|x| x.relative_performance))
437    }
438
439    /// The relative performance of this domain as configured by the platform,
440    /// if known.
441    ///
442    /// The relative performance is a unitless value. To calculate normalized
443    /// performance rates from the relative rates, a user would need to query
444    /// each performance domain to determine the maximum performance value
445    /// before calculating normalized values.
446    ///
447    /// Returns ZX_ERR_NOT_SUPPORTED if the performance level is unknown.
448    pub fn r#get_relative_performance2(
449        &self,
450        ___deadline: zx::MonotonicInstant,
451    ) -> Result<DeviceGetRelativePerformance2Result, fidl::Error> {
452        let _response = self.client.send_query::<
453            fidl::encoding::EmptyPayload,
454            fidl::encoding::FlexibleResultType<DeviceGetRelativePerformance2Response, i32>,
455            DeviceMarker,
456        >(
457            (),
458            0x48831ad9a7fc2e38,
459            fidl::encoding::DynamicFlags::FLEXIBLE,
460            ___deadline,
461        )?
462        .into_result::<DeviceMarker>("get_relative_performance2")?;
463        Ok(_response.map(|x| x.relative_performance))
464    }
465}
466
467#[cfg(target_os = "fuchsia")]
468impl From<DeviceSynchronousProxy> for zx::NullableHandle {
469    fn from(value: DeviceSynchronousProxy) -> Self {
470        value.into_channel().into()
471    }
472}
473
474#[cfg(target_os = "fuchsia")]
475impl From<fidl::Channel> for DeviceSynchronousProxy {
476    fn from(value: fidl::Channel) -> Self {
477        Self::new(value)
478    }
479}
480
481#[cfg(target_os = "fuchsia")]
482impl fidl::endpoints::FromClient for DeviceSynchronousProxy {
483    type Protocol = DeviceMarker;
484
485    fn from_client(value: fidl::endpoints::ClientEnd<DeviceMarker>) -> Self {
486        Self::new(value.into_channel())
487    }
488}
489
490#[derive(Debug, Clone)]
491pub struct DeviceProxy {
492    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
493}
494
495impl fidl::endpoints::Proxy for DeviceProxy {
496    type Protocol = DeviceMarker;
497
498    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
499        Self::new(inner)
500    }
501
502    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
503        self.client.into_channel().map_err(|client| Self { client })
504    }
505
506    fn as_channel(&self) -> &::fidl::AsyncChannel {
507        self.client.as_channel()
508    }
509}
510
511impl DeviceProxy {
512    /// Create a new Proxy for fuchsia.hardware.cpu.ctrl/Device.
513    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
514        let protocol_name = <DeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
515        Self { client: fidl::client::Client::new(channel, protocol_name) }
516    }
517
518    /// Get a Stream of events from the remote end of the protocol.
519    ///
520    /// # Panics
521    ///
522    /// Panics if the event stream was already taken.
523    pub fn take_event_stream(&self) -> DeviceEventStream {
524        DeviceEventStream { event_receiver: self.client.take_event_receiver() }
525    }
526
527    /// Returns information about a given operating point for this performance
528    /// domain.
529    pub fn r#get_operating_point_info(
530        &self,
531        mut opp: u32,
532    ) -> fidl::client::QueryResponseFut<
533        DeviceGetOperatingPointInfoResult,
534        fidl::encoding::DefaultFuchsiaResourceDialect,
535    > {
536        DeviceProxyInterface::r#get_operating_point_info(self, opp)
537    }
538
539    /// Gets the current operating point of the device.
540    pub fn r#get_current_operating_point(
541        &self,
542    ) -> fidl::client::QueryResponseFut<u32, fidl::encoding::DefaultFuchsiaResourceDialect> {
543        DeviceProxyInterface::r#get_current_operating_point(self)
544    }
545
546    /// Set the operating point of this device to the requested operating point.
547    ///
548    /// Operating points are in numeric P-state order, such that the maximum
549    /// operating performance point is 0 and the minimum is n-1, where n is the
550    /// number of operating points returned by GetOperatingPointCount().
551    ///
552    /// The requested operating point may be clamped to the range [min, max]
553    /// when operating point limits are supported. See SetOperatingPointLimits
554    /// for details.
555    ///
556    /// Returns ZX_OK, if the device is in a working state and the operating
557    /// point is changed to requested_opp successfully. out_opp will be same as
558    /// requested_opp.
559    ///
560    /// Returns ZX_ERR_OUT_OF_RANGE if the minimum_opp is outside of the range
561    /// [n-1, 0], where n is the number of operating points returned by
562    /// GetOperatingPointCount().
563    ///
564    /// Returns error status, if switching to the requested_opp was
565    /// unsuccessful. out_opp is the operating performance point (OPP) that the
566    /// device is currently in.
567    pub fn r#set_current_operating_point(
568        &self,
569        mut requested_opp: u32,
570    ) -> fidl::client::QueryResponseFut<
571        DeviceSetCurrentOperatingPointResult,
572        fidl::encoding::DefaultFuchsiaResourceDialect,
573    > {
574        DeviceProxyInterface::r#set_current_operating_point(self, requested_opp)
575    }
576
577    /// Sets the minimum operating point to use, particularly when the kernel
578    /// automatically controls the operating points of this device.
579    ///
580    /// See SetOperatingPointLimits for details on the semantics of operating
581    /// point limits.
582    ///
583    /// Returns ZX_OK on success.
584    ///
585    /// Returns ZX_ERR_OUT_OF_RANGE if the minimum_opp is outside of the range
586    /// [n-1, 0], where n is the number of operating points returned by
587    /// GetOperatingPointCount().
588    ///
589    /// Returns ZX_ERR_NOT_SUPPORTED if the device does not support limits.
590    pub fn r#set_minimum_operating_point_limit(
591        &self,
592        mut minimum_opp: u32,
593    ) -> fidl::client::QueryResponseFut<
594        DeviceSetMinimumOperatingPointLimitResult,
595        fidl::encoding::DefaultFuchsiaResourceDialect,
596    > {
597        DeviceProxyInterface::r#set_minimum_operating_point_limit(self, minimum_opp)
598    }
599
600    /// Sets the maximum operating point to use, particularly when the kernel
601    /// automatically controls the operating points of this device.
602    ///
603    /// See SetOperatingPointLimits for details on the semantics of operating
604    /// point limits.
605    ///
606    /// Returns ZX_OK on success.
607    ///
608    /// Returns ZX_ERR_OUT_OF_RANGE if the maximum_opp is outside of the range
609    /// [n-1, 0], where n is the number of operating points returned by
610    /// GetOperatingPointCount().
611    ///
612    /// Returns ZX_ERR_NOT_SUPPORTED if the device does not support limits.
613    pub fn r#set_maximum_operating_point_limit(
614        &self,
615        mut maximum_opp: u32,
616    ) -> fidl::client::QueryResponseFut<
617        DeviceSetMaximumOperatingPointLimitResult,
618        fidl::encoding::DefaultFuchsiaResourceDialect,
619    > {
620        DeviceProxyInterface::r#set_maximum_operating_point_limit(self, maximum_opp)
621    }
622
623    /// Sets the operational boundaries (minimum and maximum operating points)
624    /// for the device, when supported.
625    ///
626    /// Limits define the allowable performance range for the performance
627    /// domain. They are primarily used for:
628    /// * Thermal Mitigation: Progressively lowering the maximum operating point
629    ///   (moving from 0 toward n-1) to reduce power dissipation.
630    /// * Performance Boosting: Raising the minimum operating point (moving
631    ///   from n-1 toward 0) when automatic performance matching is insufficient
632    ///   for the current workload.
633    ///
634    /// Limits are useful on platforms where ether hardware or the kernel
635    /// automatically manages performance. By setting boundaries, userspace can
636    /// enforce power and performance policies while allowing the underlying
637    /// system to react to high-fidelity signals in real-time.
638    ///
639    /// When limits are applied, the active operating point is clamped to the range:
640    /// `[max(minimum_opp, maximim_opp), maximum_opp]`.
641    ///
642    /// Note that `maximim_opp` and `minimum_opp` reside in the P-state range [n-1, 0].
643    /// This logic ensures that the `minimum_opp` can be adjusted independently while
644    /// always respecting the ceiling imposed by the `maximim_opp`.
645    ///
646    /// Set the operating point limits to (n-1, 0) to effectively remove the limits.
647    ///
648    /// Returns ZX_OK on success.
649    ///
650    /// Returns ZX_ERR_OUT_OF_RANGE if the minimum_opp or maximum_opp is outside
651    /// of the range [n-1, 0], where n is the number of operating points
652    /// returned by GetOperatingPointCount().
653    ///
654    /// Returns ZX_ERR_NOT_SUPPORTED if the device does not support limits.
655    pub fn r#set_operating_point_limits(
656        &self,
657        mut minimum_opp: u32,
658        mut maximum_opp: u32,
659    ) -> fidl::client::QueryResponseFut<
660        DeviceSetOperatingPointLimitsResult,
661        fidl::encoding::DefaultFuchsiaResourceDialect,
662    > {
663        DeviceProxyInterface::r#set_operating_point_limits(self, minimum_opp, maximum_opp)
664    }
665
666    /// Returns the current minimum and maximum operating point limits.
667    ///
668    /// Returns ZX_OK on success.
669    ///
670    /// Returns ZX_ERR_NOT_SUPPORTED if the device does not support limits.
671    pub fn r#get_current_operating_point_limits(
672        &self,
673    ) -> fidl::client::QueryResponseFut<
674        DeviceGetCurrentOperatingPointLimitsResult,
675        fidl::encoding::DefaultFuchsiaResourceDialect,
676    > {
677        DeviceProxyInterface::r#get_current_operating_point_limits(self)
678    }
679
680    /// Returns the number of operating points within this performance domain.
681    pub fn r#get_operating_point_count(
682        &self,
683    ) -> fidl::client::QueryResponseFut<
684        DeviceGetOperatingPointCountResult,
685        fidl::encoding::DefaultFuchsiaResourceDialect,
686    > {
687        DeviceProxyInterface::r#get_operating_point_count(self)
688    }
689
690    /// Returns the number of logical cores contained within this performance
691    /// domain.
692    pub fn r#get_num_logical_cores(
693        &self,
694    ) -> fidl::client::QueryResponseFut<u64, fidl::encoding::DefaultFuchsiaResourceDialect> {
695        DeviceProxyInterface::r#get_num_logical_cores(self)
696    }
697
698    /// Returns a global system-wide core ID for the nth core in this
699    /// performance domain. `index` must be a value in the range [0, n) where
700    /// n is the value returned by GetNumLogicalCores().
701    pub fn r#get_logical_core_id(
702        &self,
703        mut index: u64,
704    ) -> fidl::client::QueryResponseFut<u64, fidl::encoding::DefaultFuchsiaResourceDialect> {
705        DeviceProxyInterface::r#get_logical_core_id(self, index)
706    }
707
708    /// Returns the id of this performance domain within its package. This
709    /// number should be stable across boots, but clients should prefer to use
710    /// GetRelativePerformance to differentiate cores if possible.
711    pub fn r#get_domain_id(
712        &self,
713    ) -> fidl::client::QueryResponseFut<u32, fidl::encoding::DefaultFuchsiaResourceDialect> {
714        DeviceProxyInterface::r#get_domain_id(self)
715    }
716
717    /// The relative performance of this domain as configured by the platform,
718    /// if known. The highest performance domain should return 255, while others
719    /// should return N/255 fractional values relative to that domain.
720    /// Returns ZX_ERR_NOT_SUPPORTED if the performance level is unknown.
721    pub fn r#get_relative_performance(
722        &self,
723    ) -> fidl::client::QueryResponseFut<
724        DeviceGetRelativePerformanceResult,
725        fidl::encoding::DefaultFuchsiaResourceDialect,
726    > {
727        DeviceProxyInterface::r#get_relative_performance(self)
728    }
729
730    /// The relative performance of this domain as configured by the platform,
731    /// if known.
732    ///
733    /// The relative performance is a unitless value. To calculate normalized
734    /// performance rates from the relative rates, a user would need to query
735    /// each performance domain to determine the maximum performance value
736    /// before calculating normalized values.
737    ///
738    /// Returns ZX_ERR_NOT_SUPPORTED if the performance level is unknown.
739    pub fn r#get_relative_performance2(
740        &self,
741    ) -> fidl::client::QueryResponseFut<
742        DeviceGetRelativePerformance2Result,
743        fidl::encoding::DefaultFuchsiaResourceDialect,
744    > {
745        DeviceProxyInterface::r#get_relative_performance2(self)
746    }
747}
748
749impl DeviceProxyInterface for DeviceProxy {
750    type GetOperatingPointInfoResponseFut = fidl::client::QueryResponseFut<
751        DeviceGetOperatingPointInfoResult,
752        fidl::encoding::DefaultFuchsiaResourceDialect,
753    >;
754    fn r#get_operating_point_info(&self, mut opp: u32) -> Self::GetOperatingPointInfoResponseFut {
755        fn _decode(
756            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
757        ) -> Result<DeviceGetOperatingPointInfoResult, fidl::Error> {
758            let _response = fidl::client::decode_transaction_body::<
759                fidl::encoding::ResultType<DeviceGetOperatingPointInfoResponse, i32>,
760                fidl::encoding::DefaultFuchsiaResourceDialect,
761                0x6594a9234fc958e2,
762            >(_buf?)?;
763            Ok(_response.map(|x| x.info))
764        }
765        self.client.send_query_and_decode::<
766            DeviceGetOperatingPointInfoRequest,
767            DeviceGetOperatingPointInfoResult,
768        >(
769            (opp,),
770            0x6594a9234fc958e2,
771            fidl::encoding::DynamicFlags::empty(),
772            _decode,
773        )
774    }
775
776    type GetCurrentOperatingPointResponseFut =
777        fidl::client::QueryResponseFut<u32, fidl::encoding::DefaultFuchsiaResourceDialect>;
778    fn r#get_current_operating_point(&self) -> Self::GetCurrentOperatingPointResponseFut {
779        fn _decode(
780            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
781        ) -> Result<u32, fidl::Error> {
782            let _response = fidl::client::decode_transaction_body::<
783                DeviceGetCurrentOperatingPointResponse,
784                fidl::encoding::DefaultFuchsiaResourceDialect,
785                0x52de67a5993f5fe1,
786            >(_buf?)?;
787            Ok(_response.out_opp)
788        }
789        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, u32>(
790            (),
791            0x52de67a5993f5fe1,
792            fidl::encoding::DynamicFlags::empty(),
793            _decode,
794        )
795    }
796
797    type SetCurrentOperatingPointResponseFut = fidl::client::QueryResponseFut<
798        DeviceSetCurrentOperatingPointResult,
799        fidl::encoding::DefaultFuchsiaResourceDialect,
800    >;
801    fn r#set_current_operating_point(
802        &self,
803        mut requested_opp: u32,
804    ) -> Self::SetCurrentOperatingPointResponseFut {
805        fn _decode(
806            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
807        ) -> Result<DeviceSetCurrentOperatingPointResult, fidl::Error> {
808            let _response = fidl::client::decode_transaction_body::<
809                fidl::encoding::ResultType<DeviceSetCurrentOperatingPointResponse, i32>,
810                fidl::encoding::DefaultFuchsiaResourceDialect,
811                0x34a7828b5ca53fd,
812            >(_buf?)?;
813            Ok(_response.map(|x| x.out_opp))
814        }
815        self.client.send_query_and_decode::<
816            DeviceSetCurrentOperatingPointRequest,
817            DeviceSetCurrentOperatingPointResult,
818        >(
819            (requested_opp,),
820            0x34a7828b5ca53fd,
821            fidl::encoding::DynamicFlags::empty(),
822            _decode,
823        )
824    }
825
826    type SetMinimumOperatingPointLimitResponseFut = fidl::client::QueryResponseFut<
827        DeviceSetMinimumOperatingPointLimitResult,
828        fidl::encoding::DefaultFuchsiaResourceDialect,
829    >;
830    fn r#set_minimum_operating_point_limit(
831        &self,
832        mut minimum_opp: u32,
833    ) -> Self::SetMinimumOperatingPointLimitResponseFut {
834        fn _decode(
835            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
836        ) -> Result<DeviceSetMinimumOperatingPointLimitResult, fidl::Error> {
837            let _response = fidl::client::decode_transaction_body::<
838                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
839                fidl::encoding::DefaultFuchsiaResourceDialect,
840                0x5467de86fa3fdfe7,
841            >(_buf?)?;
842            Ok(_response.map(|x| x))
843        }
844        self.client.send_query_and_decode::<
845            DeviceSetMinimumOperatingPointLimitRequest,
846            DeviceSetMinimumOperatingPointLimitResult,
847        >(
848            (minimum_opp,),
849            0x5467de86fa3fdfe7,
850            fidl::encoding::DynamicFlags::empty(),
851            _decode,
852        )
853    }
854
855    type SetMaximumOperatingPointLimitResponseFut = fidl::client::QueryResponseFut<
856        DeviceSetMaximumOperatingPointLimitResult,
857        fidl::encoding::DefaultFuchsiaResourceDialect,
858    >;
859    fn r#set_maximum_operating_point_limit(
860        &self,
861        mut maximum_opp: u32,
862    ) -> Self::SetMaximumOperatingPointLimitResponseFut {
863        fn _decode(
864            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
865        ) -> Result<DeviceSetMaximumOperatingPointLimitResult, fidl::Error> {
866            let _response = fidl::client::decode_transaction_body::<
867                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
868                fidl::encoding::DefaultFuchsiaResourceDialect,
869                0x385fa4d74481fbfd,
870            >(_buf?)?;
871            Ok(_response.map(|x| x))
872        }
873        self.client.send_query_and_decode::<
874            DeviceSetMaximumOperatingPointLimitRequest,
875            DeviceSetMaximumOperatingPointLimitResult,
876        >(
877            (maximum_opp,),
878            0x385fa4d74481fbfd,
879            fidl::encoding::DynamicFlags::empty(),
880            _decode,
881        )
882    }
883
884    type SetOperatingPointLimitsResponseFut = fidl::client::QueryResponseFut<
885        DeviceSetOperatingPointLimitsResult,
886        fidl::encoding::DefaultFuchsiaResourceDialect,
887    >;
888    fn r#set_operating_point_limits(
889        &self,
890        mut minimum_opp: u32,
891        mut maximum_opp: u32,
892    ) -> Self::SetOperatingPointLimitsResponseFut {
893        fn _decode(
894            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
895        ) -> Result<DeviceSetOperatingPointLimitsResult, fidl::Error> {
896            let _response = fidl::client::decode_transaction_body::<
897                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
898                fidl::encoding::DefaultFuchsiaResourceDialect,
899                0x30aa7514dd598b23,
900            >(_buf?)?;
901            Ok(_response.map(|x| x))
902        }
903        self.client.send_query_and_decode::<
904            DeviceSetOperatingPointLimitsRequest,
905            DeviceSetOperatingPointLimitsResult,
906        >(
907            (minimum_opp, maximum_opp,),
908            0x30aa7514dd598b23,
909            fidl::encoding::DynamicFlags::empty(),
910            _decode,
911        )
912    }
913
914    type GetCurrentOperatingPointLimitsResponseFut = fidl::client::QueryResponseFut<
915        DeviceGetCurrentOperatingPointLimitsResult,
916        fidl::encoding::DefaultFuchsiaResourceDialect,
917    >;
918    fn r#get_current_operating_point_limits(
919        &self,
920    ) -> Self::GetCurrentOperatingPointLimitsResponseFut {
921        fn _decode(
922            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
923        ) -> Result<DeviceGetCurrentOperatingPointLimitsResult, fidl::Error> {
924            let _response = fidl::client::decode_transaction_body::<
925                fidl::encoding::ResultType<DeviceGetCurrentOperatingPointLimitsResponse, i32>,
926                fidl::encoding::DefaultFuchsiaResourceDialect,
927                0x7aefe3d765cfc6a7,
928            >(_buf?)?;
929            Ok(_response.map(|x| (x.minimum_opp, x.maximum_opp)))
930        }
931        self.client.send_query_and_decode::<
932            fidl::encoding::EmptyPayload,
933            DeviceGetCurrentOperatingPointLimitsResult,
934        >(
935            (),
936            0x7aefe3d765cfc6a7,
937            fidl::encoding::DynamicFlags::empty(),
938            _decode,
939        )
940    }
941
942    type GetOperatingPointCountResponseFut = fidl::client::QueryResponseFut<
943        DeviceGetOperatingPointCountResult,
944        fidl::encoding::DefaultFuchsiaResourceDialect,
945    >;
946    fn r#get_operating_point_count(&self) -> Self::GetOperatingPointCountResponseFut {
947        fn _decode(
948            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
949        ) -> Result<DeviceGetOperatingPointCountResult, fidl::Error> {
950            let _response = fidl::client::decode_transaction_body::<
951                fidl::encoding::ResultType<DeviceGetOperatingPointCountResponse, i32>,
952                fidl::encoding::DefaultFuchsiaResourceDialect,
953                0x13e70ec7131889ba,
954            >(_buf?)?;
955            Ok(_response.map(|x| x.count))
956        }
957        self.client.send_query_and_decode::<
958            fidl::encoding::EmptyPayload,
959            DeviceGetOperatingPointCountResult,
960        >(
961            (),
962            0x13e70ec7131889ba,
963            fidl::encoding::DynamicFlags::empty(),
964            _decode,
965        )
966    }
967
968    type GetNumLogicalCoresResponseFut =
969        fidl::client::QueryResponseFut<u64, fidl::encoding::DefaultFuchsiaResourceDialect>;
970    fn r#get_num_logical_cores(&self) -> Self::GetNumLogicalCoresResponseFut {
971        fn _decode(
972            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
973        ) -> Result<u64, fidl::Error> {
974            let _response = fidl::client::decode_transaction_body::<
975                DeviceGetNumLogicalCoresResponse,
976                fidl::encoding::DefaultFuchsiaResourceDialect,
977                0x74e304c90ca165c5,
978            >(_buf?)?;
979            Ok(_response.count)
980        }
981        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, u64>(
982            (),
983            0x74e304c90ca165c5,
984            fidl::encoding::DynamicFlags::empty(),
985            _decode,
986        )
987    }
988
989    type GetLogicalCoreIdResponseFut =
990        fidl::client::QueryResponseFut<u64, fidl::encoding::DefaultFuchsiaResourceDialect>;
991    fn r#get_logical_core_id(&self, mut index: u64) -> Self::GetLogicalCoreIdResponseFut {
992        fn _decode(
993            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
994        ) -> Result<u64, fidl::Error> {
995            let _response = fidl::client::decode_transaction_body::<
996                DeviceGetLogicalCoreIdResponse,
997                fidl::encoding::DefaultFuchsiaResourceDialect,
998                0x7168f98ddbd26058,
999            >(_buf?)?;
1000            Ok(_response.id)
1001        }
1002        self.client.send_query_and_decode::<DeviceGetLogicalCoreIdRequest, u64>(
1003            (index,),
1004            0x7168f98ddbd26058,
1005            fidl::encoding::DynamicFlags::empty(),
1006            _decode,
1007        )
1008    }
1009
1010    type GetDomainIdResponseFut =
1011        fidl::client::QueryResponseFut<u32, fidl::encoding::DefaultFuchsiaResourceDialect>;
1012    fn r#get_domain_id(&self) -> Self::GetDomainIdResponseFut {
1013        fn _decode(
1014            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1015        ) -> Result<u32, fidl::Error> {
1016            let _response = fidl::client::decode_transaction_body::<
1017                DeviceGetDomainIdResponse,
1018                fidl::encoding::DefaultFuchsiaResourceDialect,
1019                0x3030f85bdc1ef321,
1020            >(_buf?)?;
1021            Ok(_response.domain_id)
1022        }
1023        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, u32>(
1024            (),
1025            0x3030f85bdc1ef321,
1026            fidl::encoding::DynamicFlags::empty(),
1027            _decode,
1028        )
1029    }
1030
1031    type GetRelativePerformanceResponseFut = fidl::client::QueryResponseFut<
1032        DeviceGetRelativePerformanceResult,
1033        fidl::encoding::DefaultFuchsiaResourceDialect,
1034    >;
1035    fn r#get_relative_performance(&self) -> Self::GetRelativePerformanceResponseFut {
1036        fn _decode(
1037            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1038        ) -> Result<DeviceGetRelativePerformanceResult, fidl::Error> {
1039            let _response = fidl::client::decode_transaction_body::<
1040                fidl::encoding::ResultType<DeviceGetRelativePerformanceResponse, i32>,
1041                fidl::encoding::DefaultFuchsiaResourceDialect,
1042                0x41c37eaf0c26a3d3,
1043            >(_buf?)?;
1044            Ok(_response.map(|x| x.relative_performance))
1045        }
1046        self.client.send_query_and_decode::<
1047            fidl::encoding::EmptyPayload,
1048            DeviceGetRelativePerformanceResult,
1049        >(
1050            (),
1051            0x41c37eaf0c26a3d3,
1052            fidl::encoding::DynamicFlags::empty(),
1053            _decode,
1054        )
1055    }
1056
1057    type GetRelativePerformance2ResponseFut = fidl::client::QueryResponseFut<
1058        DeviceGetRelativePerformance2Result,
1059        fidl::encoding::DefaultFuchsiaResourceDialect,
1060    >;
1061    fn r#get_relative_performance2(&self) -> Self::GetRelativePerformance2ResponseFut {
1062        fn _decode(
1063            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1064        ) -> Result<DeviceGetRelativePerformance2Result, fidl::Error> {
1065            let _response = fidl::client::decode_transaction_body::<
1066                fidl::encoding::FlexibleResultType<DeviceGetRelativePerformance2Response, i32>,
1067                fidl::encoding::DefaultFuchsiaResourceDialect,
1068                0x48831ad9a7fc2e38,
1069            >(_buf?)?
1070            .into_result::<DeviceMarker>("get_relative_performance2")?;
1071            Ok(_response.map(|x| x.relative_performance))
1072        }
1073        self.client.send_query_and_decode::<
1074            fidl::encoding::EmptyPayload,
1075            DeviceGetRelativePerformance2Result,
1076        >(
1077            (),
1078            0x48831ad9a7fc2e38,
1079            fidl::encoding::DynamicFlags::FLEXIBLE,
1080            _decode,
1081        )
1082    }
1083}
1084
1085pub struct DeviceEventStream {
1086    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1087}
1088
1089impl std::marker::Unpin for DeviceEventStream {}
1090
1091impl futures::stream::FusedStream for DeviceEventStream {
1092    fn is_terminated(&self) -> bool {
1093        self.event_receiver.is_terminated()
1094    }
1095}
1096
1097impl futures::Stream for DeviceEventStream {
1098    type Item = Result<DeviceEvent, fidl::Error>;
1099
1100    fn poll_next(
1101        mut self: std::pin::Pin<&mut Self>,
1102        cx: &mut std::task::Context<'_>,
1103    ) -> std::task::Poll<Option<Self::Item>> {
1104        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1105            &mut self.event_receiver,
1106            cx
1107        )?) {
1108            Some(buf) => std::task::Poll::Ready(Some(DeviceEvent::decode(buf))),
1109            None => std::task::Poll::Ready(None),
1110        }
1111    }
1112}
1113
1114#[derive(Debug)]
1115pub enum DeviceEvent {
1116    #[non_exhaustive]
1117    _UnknownEvent {
1118        /// Ordinal of the event that was sent.
1119        ordinal: u64,
1120    },
1121}
1122
1123impl DeviceEvent {
1124    /// Decodes a message buffer as a [`DeviceEvent`].
1125    fn decode(
1126        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1127    ) -> Result<DeviceEvent, fidl::Error> {
1128        let (bytes, _handles) = buf.split_mut();
1129        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1130        debug_assert_eq!(tx_header.tx_id, 0);
1131        match tx_header.ordinal {
1132            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
1133                Ok(DeviceEvent::_UnknownEvent { ordinal: tx_header.ordinal })
1134            }
1135            _ => Err(fidl::Error::UnknownOrdinal {
1136                ordinal: tx_header.ordinal,
1137                protocol_name: <DeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1138            }),
1139        }
1140    }
1141}
1142
1143/// A Stream of incoming requests for fuchsia.hardware.cpu.ctrl/Device.
1144pub struct DeviceRequestStream {
1145    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1146    is_terminated: bool,
1147}
1148
1149impl std::marker::Unpin for DeviceRequestStream {}
1150
1151impl futures::stream::FusedStream for DeviceRequestStream {
1152    fn is_terminated(&self) -> bool {
1153        self.is_terminated
1154    }
1155}
1156
1157impl fidl::endpoints::RequestStream for DeviceRequestStream {
1158    type Protocol = DeviceMarker;
1159    type ControlHandle = DeviceControlHandle;
1160
1161    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1162        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1163    }
1164
1165    fn control_handle(&self) -> Self::ControlHandle {
1166        DeviceControlHandle { inner: self.inner.clone() }
1167    }
1168
1169    fn into_inner(
1170        self,
1171    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1172    {
1173        (self.inner, self.is_terminated)
1174    }
1175
1176    fn from_inner(
1177        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1178        is_terminated: bool,
1179    ) -> Self {
1180        Self { inner, is_terminated }
1181    }
1182}
1183
1184impl futures::Stream for DeviceRequestStream {
1185    type Item = Result<DeviceRequest, fidl::Error>;
1186
1187    fn poll_next(
1188        mut self: std::pin::Pin<&mut Self>,
1189        cx: &mut std::task::Context<'_>,
1190    ) -> std::task::Poll<Option<Self::Item>> {
1191        let this = &mut *self;
1192        if this.inner.check_shutdown(cx) {
1193            this.is_terminated = true;
1194            return std::task::Poll::Ready(None);
1195        }
1196        if this.is_terminated {
1197            panic!("polled DeviceRequestStream after completion");
1198        }
1199        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1200            |bytes, handles| {
1201                match this.inner.channel().read_etc(cx, bytes, handles) {
1202                    std::task::Poll::Ready(Ok(())) => {}
1203                    std::task::Poll::Pending => return std::task::Poll::Pending,
1204                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1205                        this.is_terminated = true;
1206                        return std::task::Poll::Ready(None);
1207                    }
1208                    std::task::Poll::Ready(Err(e)) => {
1209                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1210                            e.into(),
1211                        ))));
1212                    }
1213                }
1214
1215                // A message has been received from the channel
1216                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1217
1218                std::task::Poll::Ready(Some(match header.ordinal {
1219                    0x6594a9234fc958e2 => {
1220                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1221                        let mut req = fidl::new_empty!(
1222                            DeviceGetOperatingPointInfoRequest,
1223                            fidl::encoding::DefaultFuchsiaResourceDialect
1224                        );
1225                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceGetOperatingPointInfoRequest>(&header, _body_bytes, handles, &mut req)?;
1226                        let control_handle = DeviceControlHandle { inner: this.inner.clone() };
1227                        Ok(DeviceRequest::GetOperatingPointInfo {
1228                            opp: req.opp,
1229
1230                            responder: DeviceGetOperatingPointInfoResponder {
1231                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1232                                tx_id: header.tx_id,
1233                            },
1234                        })
1235                    }
1236                    0x52de67a5993f5fe1 => {
1237                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1238                        let mut req = fidl::new_empty!(
1239                            fidl::encoding::EmptyPayload,
1240                            fidl::encoding::DefaultFuchsiaResourceDialect
1241                        );
1242                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1243                        let control_handle = DeviceControlHandle { inner: this.inner.clone() };
1244                        Ok(DeviceRequest::GetCurrentOperatingPoint {
1245                            responder: DeviceGetCurrentOperatingPointResponder {
1246                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1247                                tx_id: header.tx_id,
1248                            },
1249                        })
1250                    }
1251                    0x34a7828b5ca53fd => {
1252                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1253                        let mut req = fidl::new_empty!(
1254                            DeviceSetCurrentOperatingPointRequest,
1255                            fidl::encoding::DefaultFuchsiaResourceDialect
1256                        );
1257                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceSetCurrentOperatingPointRequest>(&header, _body_bytes, handles, &mut req)?;
1258                        let control_handle = DeviceControlHandle { inner: this.inner.clone() };
1259                        Ok(DeviceRequest::SetCurrentOperatingPoint {
1260                            requested_opp: req.requested_opp,
1261
1262                            responder: DeviceSetCurrentOperatingPointResponder {
1263                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1264                                tx_id: header.tx_id,
1265                            },
1266                        })
1267                    }
1268                    0x5467de86fa3fdfe7 => {
1269                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1270                        let mut req = fidl::new_empty!(
1271                            DeviceSetMinimumOperatingPointLimitRequest,
1272                            fidl::encoding::DefaultFuchsiaResourceDialect
1273                        );
1274                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceSetMinimumOperatingPointLimitRequest>(&header, _body_bytes, handles, &mut req)?;
1275                        let control_handle = DeviceControlHandle { inner: this.inner.clone() };
1276                        Ok(DeviceRequest::SetMinimumOperatingPointLimit {
1277                            minimum_opp: req.minimum_opp,
1278
1279                            responder: DeviceSetMinimumOperatingPointLimitResponder {
1280                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1281                                tx_id: header.tx_id,
1282                            },
1283                        })
1284                    }
1285                    0x385fa4d74481fbfd => {
1286                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1287                        let mut req = fidl::new_empty!(
1288                            DeviceSetMaximumOperatingPointLimitRequest,
1289                            fidl::encoding::DefaultFuchsiaResourceDialect
1290                        );
1291                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceSetMaximumOperatingPointLimitRequest>(&header, _body_bytes, handles, &mut req)?;
1292                        let control_handle = DeviceControlHandle { inner: this.inner.clone() };
1293                        Ok(DeviceRequest::SetMaximumOperatingPointLimit {
1294                            maximum_opp: req.maximum_opp,
1295
1296                            responder: DeviceSetMaximumOperatingPointLimitResponder {
1297                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1298                                tx_id: header.tx_id,
1299                            },
1300                        })
1301                    }
1302                    0x30aa7514dd598b23 => {
1303                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1304                        let mut req = fidl::new_empty!(
1305                            DeviceSetOperatingPointLimitsRequest,
1306                            fidl::encoding::DefaultFuchsiaResourceDialect
1307                        );
1308                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceSetOperatingPointLimitsRequest>(&header, _body_bytes, handles, &mut req)?;
1309                        let control_handle = DeviceControlHandle { inner: this.inner.clone() };
1310                        Ok(DeviceRequest::SetOperatingPointLimits {
1311                            minimum_opp: req.minimum_opp,
1312                            maximum_opp: req.maximum_opp,
1313
1314                            responder: DeviceSetOperatingPointLimitsResponder {
1315                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1316                                tx_id: header.tx_id,
1317                            },
1318                        })
1319                    }
1320                    0x7aefe3d765cfc6a7 => {
1321                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1322                        let mut req = fidl::new_empty!(
1323                            fidl::encoding::EmptyPayload,
1324                            fidl::encoding::DefaultFuchsiaResourceDialect
1325                        );
1326                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1327                        let control_handle = DeviceControlHandle { inner: this.inner.clone() };
1328                        Ok(DeviceRequest::GetCurrentOperatingPointLimits {
1329                            responder: DeviceGetCurrentOperatingPointLimitsResponder {
1330                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1331                                tx_id: header.tx_id,
1332                            },
1333                        })
1334                    }
1335                    0x13e70ec7131889ba => {
1336                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1337                        let mut req = fidl::new_empty!(
1338                            fidl::encoding::EmptyPayload,
1339                            fidl::encoding::DefaultFuchsiaResourceDialect
1340                        );
1341                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1342                        let control_handle = DeviceControlHandle { inner: this.inner.clone() };
1343                        Ok(DeviceRequest::GetOperatingPointCount {
1344                            responder: DeviceGetOperatingPointCountResponder {
1345                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1346                                tx_id: header.tx_id,
1347                            },
1348                        })
1349                    }
1350                    0x74e304c90ca165c5 => {
1351                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1352                        let mut req = fidl::new_empty!(
1353                            fidl::encoding::EmptyPayload,
1354                            fidl::encoding::DefaultFuchsiaResourceDialect
1355                        );
1356                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1357                        let control_handle = DeviceControlHandle { inner: this.inner.clone() };
1358                        Ok(DeviceRequest::GetNumLogicalCores {
1359                            responder: DeviceGetNumLogicalCoresResponder {
1360                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1361                                tx_id: header.tx_id,
1362                            },
1363                        })
1364                    }
1365                    0x7168f98ddbd26058 => {
1366                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1367                        let mut req = fidl::new_empty!(
1368                            DeviceGetLogicalCoreIdRequest,
1369                            fidl::encoding::DefaultFuchsiaResourceDialect
1370                        );
1371                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceGetLogicalCoreIdRequest>(&header, _body_bytes, handles, &mut req)?;
1372                        let control_handle = DeviceControlHandle { inner: this.inner.clone() };
1373                        Ok(DeviceRequest::GetLogicalCoreId {
1374                            index: req.index,
1375
1376                            responder: DeviceGetLogicalCoreIdResponder {
1377                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1378                                tx_id: header.tx_id,
1379                            },
1380                        })
1381                    }
1382                    0x3030f85bdc1ef321 => {
1383                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1384                        let mut req = fidl::new_empty!(
1385                            fidl::encoding::EmptyPayload,
1386                            fidl::encoding::DefaultFuchsiaResourceDialect
1387                        );
1388                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1389                        let control_handle = DeviceControlHandle { inner: this.inner.clone() };
1390                        Ok(DeviceRequest::GetDomainId {
1391                            responder: DeviceGetDomainIdResponder {
1392                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1393                                tx_id: header.tx_id,
1394                            },
1395                        })
1396                    }
1397                    0x41c37eaf0c26a3d3 => {
1398                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1399                        let mut req = fidl::new_empty!(
1400                            fidl::encoding::EmptyPayload,
1401                            fidl::encoding::DefaultFuchsiaResourceDialect
1402                        );
1403                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1404                        let control_handle = DeviceControlHandle { inner: this.inner.clone() };
1405                        Ok(DeviceRequest::GetRelativePerformance {
1406                            responder: DeviceGetRelativePerformanceResponder {
1407                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1408                                tx_id: header.tx_id,
1409                            },
1410                        })
1411                    }
1412                    0x48831ad9a7fc2e38 => {
1413                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1414                        let mut req = fidl::new_empty!(
1415                            fidl::encoding::EmptyPayload,
1416                            fidl::encoding::DefaultFuchsiaResourceDialect
1417                        );
1418                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1419                        let control_handle = DeviceControlHandle { inner: this.inner.clone() };
1420                        Ok(DeviceRequest::GetRelativePerformance2 {
1421                            responder: DeviceGetRelativePerformance2Responder {
1422                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1423                                tx_id: header.tx_id,
1424                            },
1425                        })
1426                    }
1427                    _ if header.tx_id == 0
1428                        && header
1429                            .dynamic_flags()
1430                            .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
1431                    {
1432                        Ok(DeviceRequest::_UnknownMethod {
1433                            ordinal: header.ordinal,
1434                            control_handle: DeviceControlHandle { inner: this.inner.clone() },
1435                            method_type: fidl::MethodType::OneWay,
1436                        })
1437                    }
1438                    _ if header
1439                        .dynamic_flags()
1440                        .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
1441                    {
1442                        this.inner.send_framework_err(
1443                            fidl::encoding::FrameworkErr::UnknownMethod,
1444                            header.tx_id,
1445                            header.ordinal,
1446                            header.dynamic_flags(),
1447                            (bytes, handles),
1448                        )?;
1449                        Ok(DeviceRequest::_UnknownMethod {
1450                            ordinal: header.ordinal,
1451                            control_handle: DeviceControlHandle { inner: this.inner.clone() },
1452                            method_type: fidl::MethodType::TwoWay,
1453                        })
1454                    }
1455                    _ => Err(fidl::Error::UnknownOrdinal {
1456                        ordinal: header.ordinal,
1457                        protocol_name:
1458                            <DeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1459                    }),
1460                }))
1461            },
1462        )
1463    }
1464}
1465
1466#[derive(Debug)]
1467pub enum DeviceRequest {
1468    /// Returns information about a given operating point for this performance
1469    /// domain.
1470    GetOperatingPointInfo { opp: u32, responder: DeviceGetOperatingPointInfoResponder },
1471    /// Gets the current operating point of the device.
1472    GetCurrentOperatingPoint { responder: DeviceGetCurrentOperatingPointResponder },
1473    /// Set the operating point of this device to the requested operating point.
1474    ///
1475    /// Operating points are in numeric P-state order, such that the maximum
1476    /// operating performance point is 0 and the minimum is n-1, where n is the
1477    /// number of operating points returned by GetOperatingPointCount().
1478    ///
1479    /// The requested operating point may be clamped to the range [min, max]
1480    /// when operating point limits are supported. See SetOperatingPointLimits
1481    /// for details.
1482    ///
1483    /// Returns ZX_OK, if the device is in a working state and the operating
1484    /// point is changed to requested_opp successfully. out_opp will be same as
1485    /// requested_opp.
1486    ///
1487    /// Returns ZX_ERR_OUT_OF_RANGE if the minimum_opp is outside of the range
1488    /// [n-1, 0], where n is the number of operating points returned by
1489    /// GetOperatingPointCount().
1490    ///
1491    /// Returns error status, if switching to the requested_opp was
1492    /// unsuccessful. out_opp is the operating performance point (OPP) that the
1493    /// device is currently in.
1494    SetCurrentOperatingPoint {
1495        requested_opp: u32,
1496        responder: DeviceSetCurrentOperatingPointResponder,
1497    },
1498    /// Sets the minimum operating point to use, particularly when the kernel
1499    /// automatically controls the operating points of this device.
1500    ///
1501    /// See SetOperatingPointLimits for details on the semantics of operating
1502    /// point limits.
1503    ///
1504    /// Returns ZX_OK on success.
1505    ///
1506    /// Returns ZX_ERR_OUT_OF_RANGE if the minimum_opp is outside of the range
1507    /// [n-1, 0], where n is the number of operating points returned by
1508    /// GetOperatingPointCount().
1509    ///
1510    /// Returns ZX_ERR_NOT_SUPPORTED if the device does not support limits.
1511    SetMinimumOperatingPointLimit {
1512        minimum_opp: u32,
1513        responder: DeviceSetMinimumOperatingPointLimitResponder,
1514    },
1515    /// Sets the maximum operating point to use, particularly when the kernel
1516    /// automatically controls the operating points of this device.
1517    ///
1518    /// See SetOperatingPointLimits for details on the semantics of operating
1519    /// point limits.
1520    ///
1521    /// Returns ZX_OK on success.
1522    ///
1523    /// Returns ZX_ERR_OUT_OF_RANGE if the maximum_opp is outside of the range
1524    /// [n-1, 0], where n is the number of operating points returned by
1525    /// GetOperatingPointCount().
1526    ///
1527    /// Returns ZX_ERR_NOT_SUPPORTED if the device does not support limits.
1528    SetMaximumOperatingPointLimit {
1529        maximum_opp: u32,
1530        responder: DeviceSetMaximumOperatingPointLimitResponder,
1531    },
1532    /// Sets the operational boundaries (minimum and maximum operating points)
1533    /// for the device, when supported.
1534    ///
1535    /// Limits define the allowable performance range for the performance
1536    /// domain. They are primarily used for:
1537    /// * Thermal Mitigation: Progressively lowering the maximum operating point
1538    ///   (moving from 0 toward n-1) to reduce power dissipation.
1539    /// * Performance Boosting: Raising the minimum operating point (moving
1540    ///   from n-1 toward 0) when automatic performance matching is insufficient
1541    ///   for the current workload.
1542    ///
1543    /// Limits are useful on platforms where ether hardware or the kernel
1544    /// automatically manages performance. By setting boundaries, userspace can
1545    /// enforce power and performance policies while allowing the underlying
1546    /// system to react to high-fidelity signals in real-time.
1547    ///
1548    /// When limits are applied, the active operating point is clamped to the range:
1549    /// `[max(minimum_opp, maximim_opp), maximum_opp]`.
1550    ///
1551    /// Note that `maximim_opp` and `minimum_opp` reside in the P-state range [n-1, 0].
1552    /// This logic ensures that the `minimum_opp` can be adjusted independently while
1553    /// always respecting the ceiling imposed by the `maximim_opp`.
1554    ///
1555    /// Set the operating point limits to (n-1, 0) to effectively remove the limits.
1556    ///
1557    /// Returns ZX_OK on success.
1558    ///
1559    /// Returns ZX_ERR_OUT_OF_RANGE if the minimum_opp or maximum_opp is outside
1560    /// of the range [n-1, 0], where n is the number of operating points
1561    /// returned by GetOperatingPointCount().
1562    ///
1563    /// Returns ZX_ERR_NOT_SUPPORTED if the device does not support limits.
1564    SetOperatingPointLimits {
1565        minimum_opp: u32,
1566        maximum_opp: u32,
1567        responder: DeviceSetOperatingPointLimitsResponder,
1568    },
1569    /// Returns the current minimum and maximum operating point limits.
1570    ///
1571    /// Returns ZX_OK on success.
1572    ///
1573    /// Returns ZX_ERR_NOT_SUPPORTED if the device does not support limits.
1574    GetCurrentOperatingPointLimits { responder: DeviceGetCurrentOperatingPointLimitsResponder },
1575    /// Returns the number of operating points within this performance domain.
1576    GetOperatingPointCount { responder: DeviceGetOperatingPointCountResponder },
1577    /// Returns the number of logical cores contained within this performance
1578    /// domain.
1579    GetNumLogicalCores { responder: DeviceGetNumLogicalCoresResponder },
1580    /// Returns a global system-wide core ID for the nth core in this
1581    /// performance domain. `index` must be a value in the range [0, n) where
1582    /// n is the value returned by GetNumLogicalCores().
1583    GetLogicalCoreId { index: u64, responder: DeviceGetLogicalCoreIdResponder },
1584    /// Returns the id of this performance domain within its package. This
1585    /// number should be stable across boots, but clients should prefer to use
1586    /// GetRelativePerformance to differentiate cores if possible.
1587    GetDomainId { responder: DeviceGetDomainIdResponder },
1588    /// The relative performance of this domain as configured by the platform,
1589    /// if known. The highest performance domain should return 255, while others
1590    /// should return N/255 fractional values relative to that domain.
1591    /// Returns ZX_ERR_NOT_SUPPORTED if the performance level is unknown.
1592    GetRelativePerformance { responder: DeviceGetRelativePerformanceResponder },
1593    /// The relative performance of this domain as configured by the platform,
1594    /// if known.
1595    ///
1596    /// The relative performance is a unitless value. To calculate normalized
1597    /// performance rates from the relative rates, a user would need to query
1598    /// each performance domain to determine the maximum performance value
1599    /// before calculating normalized values.
1600    ///
1601    /// Returns ZX_ERR_NOT_SUPPORTED if the performance level is unknown.
1602    GetRelativePerformance2 { responder: DeviceGetRelativePerformance2Responder },
1603    /// An interaction was received which does not match any known method.
1604    #[non_exhaustive]
1605    _UnknownMethod {
1606        /// Ordinal of the method that was called.
1607        ordinal: u64,
1608        control_handle: DeviceControlHandle,
1609        method_type: fidl::MethodType,
1610    },
1611}
1612
1613impl DeviceRequest {
1614    #[allow(irrefutable_let_patterns)]
1615    pub fn into_get_operating_point_info(
1616        self,
1617    ) -> Option<(u32, DeviceGetOperatingPointInfoResponder)> {
1618        if let DeviceRequest::GetOperatingPointInfo { opp, responder } = self {
1619            Some((opp, responder))
1620        } else {
1621            None
1622        }
1623    }
1624
1625    #[allow(irrefutable_let_patterns)]
1626    pub fn into_get_current_operating_point(
1627        self,
1628    ) -> Option<(DeviceGetCurrentOperatingPointResponder)> {
1629        if let DeviceRequest::GetCurrentOperatingPoint { responder } = self {
1630            Some((responder))
1631        } else {
1632            None
1633        }
1634    }
1635
1636    #[allow(irrefutable_let_patterns)]
1637    pub fn into_set_current_operating_point(
1638        self,
1639    ) -> Option<(u32, DeviceSetCurrentOperatingPointResponder)> {
1640        if let DeviceRequest::SetCurrentOperatingPoint { requested_opp, responder } = self {
1641            Some((requested_opp, responder))
1642        } else {
1643            None
1644        }
1645    }
1646
1647    #[allow(irrefutable_let_patterns)]
1648    pub fn into_set_minimum_operating_point_limit(
1649        self,
1650    ) -> Option<(u32, DeviceSetMinimumOperatingPointLimitResponder)> {
1651        if let DeviceRequest::SetMinimumOperatingPointLimit { minimum_opp, responder } = self {
1652            Some((minimum_opp, responder))
1653        } else {
1654            None
1655        }
1656    }
1657
1658    #[allow(irrefutable_let_patterns)]
1659    pub fn into_set_maximum_operating_point_limit(
1660        self,
1661    ) -> Option<(u32, DeviceSetMaximumOperatingPointLimitResponder)> {
1662        if let DeviceRequest::SetMaximumOperatingPointLimit { maximum_opp, responder } = self {
1663            Some((maximum_opp, responder))
1664        } else {
1665            None
1666        }
1667    }
1668
1669    #[allow(irrefutable_let_patterns)]
1670    pub fn into_set_operating_point_limits(
1671        self,
1672    ) -> Option<(u32, u32, DeviceSetOperatingPointLimitsResponder)> {
1673        if let DeviceRequest::SetOperatingPointLimits { minimum_opp, maximum_opp, responder } = self
1674        {
1675            Some((minimum_opp, maximum_opp, responder))
1676        } else {
1677            None
1678        }
1679    }
1680
1681    #[allow(irrefutable_let_patterns)]
1682    pub fn into_get_current_operating_point_limits(
1683        self,
1684    ) -> Option<(DeviceGetCurrentOperatingPointLimitsResponder)> {
1685        if let DeviceRequest::GetCurrentOperatingPointLimits { responder } = self {
1686            Some((responder))
1687        } else {
1688            None
1689        }
1690    }
1691
1692    #[allow(irrefutable_let_patterns)]
1693    pub fn into_get_operating_point_count(self) -> Option<(DeviceGetOperatingPointCountResponder)> {
1694        if let DeviceRequest::GetOperatingPointCount { responder } = self {
1695            Some((responder))
1696        } else {
1697            None
1698        }
1699    }
1700
1701    #[allow(irrefutable_let_patterns)]
1702    pub fn into_get_num_logical_cores(self) -> Option<(DeviceGetNumLogicalCoresResponder)> {
1703        if let DeviceRequest::GetNumLogicalCores { responder } = self {
1704            Some((responder))
1705        } else {
1706            None
1707        }
1708    }
1709
1710    #[allow(irrefutable_let_patterns)]
1711    pub fn into_get_logical_core_id(self) -> Option<(u64, DeviceGetLogicalCoreIdResponder)> {
1712        if let DeviceRequest::GetLogicalCoreId { index, responder } = self {
1713            Some((index, responder))
1714        } else {
1715            None
1716        }
1717    }
1718
1719    #[allow(irrefutable_let_patterns)]
1720    pub fn into_get_domain_id(self) -> Option<(DeviceGetDomainIdResponder)> {
1721        if let DeviceRequest::GetDomainId { responder } = self { Some((responder)) } else { None }
1722    }
1723
1724    #[allow(irrefutable_let_patterns)]
1725    pub fn into_get_relative_performance(self) -> Option<(DeviceGetRelativePerformanceResponder)> {
1726        if let DeviceRequest::GetRelativePerformance { responder } = self {
1727            Some((responder))
1728        } else {
1729            None
1730        }
1731    }
1732
1733    #[allow(irrefutable_let_patterns)]
1734    pub fn into_get_relative_performance2(
1735        self,
1736    ) -> Option<(DeviceGetRelativePerformance2Responder)> {
1737        if let DeviceRequest::GetRelativePerformance2 { responder } = self {
1738            Some((responder))
1739        } else {
1740            None
1741        }
1742    }
1743
1744    /// Name of the method defined in FIDL
1745    pub fn method_name(&self) -> &'static str {
1746        match *self {
1747            DeviceRequest::GetOperatingPointInfo { .. } => "get_operating_point_info",
1748            DeviceRequest::GetCurrentOperatingPoint { .. } => "get_current_operating_point",
1749            DeviceRequest::SetCurrentOperatingPoint { .. } => "set_current_operating_point",
1750            DeviceRequest::SetMinimumOperatingPointLimit { .. } => {
1751                "set_minimum_operating_point_limit"
1752            }
1753            DeviceRequest::SetMaximumOperatingPointLimit { .. } => {
1754                "set_maximum_operating_point_limit"
1755            }
1756            DeviceRequest::SetOperatingPointLimits { .. } => "set_operating_point_limits",
1757            DeviceRequest::GetCurrentOperatingPointLimits { .. } => {
1758                "get_current_operating_point_limits"
1759            }
1760            DeviceRequest::GetOperatingPointCount { .. } => "get_operating_point_count",
1761            DeviceRequest::GetNumLogicalCores { .. } => "get_num_logical_cores",
1762            DeviceRequest::GetLogicalCoreId { .. } => "get_logical_core_id",
1763            DeviceRequest::GetDomainId { .. } => "get_domain_id",
1764            DeviceRequest::GetRelativePerformance { .. } => "get_relative_performance",
1765            DeviceRequest::GetRelativePerformance2 { .. } => "get_relative_performance2",
1766            DeviceRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
1767                "unknown one-way method"
1768            }
1769            DeviceRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
1770                "unknown two-way method"
1771            }
1772        }
1773    }
1774}
1775
1776#[derive(Debug, Clone)]
1777pub struct DeviceControlHandle {
1778    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1779}
1780
1781impl DeviceControlHandle {
1782    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
1783        self.inner.shutdown_with_epitaph(status.into())
1784    }
1785}
1786
1787impl fidl::endpoints::ControlHandle for DeviceControlHandle {
1788    fn shutdown(&self) {
1789        self.inner.shutdown()
1790    }
1791
1792    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
1793        self.inner.shutdown_with_epitaph(status)
1794    }
1795
1796    fn is_closed(&self) -> bool {
1797        self.inner.channel().is_closed()
1798    }
1799    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1800        self.inner.channel().on_closed()
1801    }
1802
1803    #[cfg(target_os = "fuchsia")]
1804    fn signal_peer(
1805        &self,
1806        clear_mask: zx::Signals,
1807        set_mask: zx::Signals,
1808    ) -> Result<(), zx_status::Status> {
1809        use fidl::Peered;
1810        self.inner.channel().signal_peer(clear_mask, set_mask)
1811    }
1812}
1813
1814impl DeviceControlHandle {}
1815
1816#[must_use = "FIDL methods require a response to be sent"]
1817#[derive(Debug)]
1818pub struct DeviceGetOperatingPointInfoResponder {
1819    control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
1820    tx_id: u32,
1821}
1822
1823/// Set the the channel to be shutdown (see [`DeviceControlHandle::shutdown`])
1824/// if the responder is dropped without sending a response, so that the client
1825/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1826impl std::ops::Drop for DeviceGetOperatingPointInfoResponder {
1827    fn drop(&mut self) {
1828        self.control_handle.shutdown();
1829        // Safety: drops once, never accessed again
1830        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1831    }
1832}
1833
1834impl fidl::endpoints::Responder for DeviceGetOperatingPointInfoResponder {
1835    type ControlHandle = DeviceControlHandle;
1836
1837    fn control_handle(&self) -> &DeviceControlHandle {
1838        &self.control_handle
1839    }
1840
1841    fn drop_without_shutdown(mut self) {
1842        // Safety: drops once, never accessed again due to mem::forget
1843        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1844        // Prevent Drop from running (which would shut down the channel)
1845        std::mem::forget(self);
1846    }
1847}
1848
1849impl DeviceGetOperatingPointInfoResponder {
1850    /// Sends a response to the FIDL transaction.
1851    ///
1852    /// Sets the channel to shutdown if an error occurs.
1853    pub fn send(self, mut result: Result<&CpuOperatingPointInfo, i32>) -> Result<(), fidl::Error> {
1854        let _result = self.send_raw(result);
1855        if _result.is_err() {
1856            self.control_handle.shutdown();
1857        }
1858        self.drop_without_shutdown();
1859        _result
1860    }
1861
1862    /// Similar to "send" but does not shutdown the channel if an error occurs.
1863    pub fn send_no_shutdown_on_err(
1864        self,
1865        mut result: Result<&CpuOperatingPointInfo, i32>,
1866    ) -> Result<(), fidl::Error> {
1867        let _result = self.send_raw(result);
1868        self.drop_without_shutdown();
1869        _result
1870    }
1871
1872    fn send_raw(&self, mut result: Result<&CpuOperatingPointInfo, i32>) -> Result<(), fidl::Error> {
1873        self.control_handle.inner.send::<fidl::encoding::ResultType<
1874            DeviceGetOperatingPointInfoResponse,
1875            i32,
1876        >>(
1877            result.map(|info| (info,)),
1878            self.tx_id,
1879            0x6594a9234fc958e2,
1880            fidl::encoding::DynamicFlags::empty(),
1881        )
1882    }
1883}
1884
1885#[must_use = "FIDL methods require a response to be sent"]
1886#[derive(Debug)]
1887pub struct DeviceGetCurrentOperatingPointResponder {
1888    control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
1889    tx_id: u32,
1890}
1891
1892/// Set the the channel to be shutdown (see [`DeviceControlHandle::shutdown`])
1893/// if the responder is dropped without sending a response, so that the client
1894/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1895impl std::ops::Drop for DeviceGetCurrentOperatingPointResponder {
1896    fn drop(&mut self) {
1897        self.control_handle.shutdown();
1898        // Safety: drops once, never accessed again
1899        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1900    }
1901}
1902
1903impl fidl::endpoints::Responder for DeviceGetCurrentOperatingPointResponder {
1904    type ControlHandle = DeviceControlHandle;
1905
1906    fn control_handle(&self) -> &DeviceControlHandle {
1907        &self.control_handle
1908    }
1909
1910    fn drop_without_shutdown(mut self) {
1911        // Safety: drops once, never accessed again due to mem::forget
1912        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1913        // Prevent Drop from running (which would shut down the channel)
1914        std::mem::forget(self);
1915    }
1916}
1917
1918impl DeviceGetCurrentOperatingPointResponder {
1919    /// Sends a response to the FIDL transaction.
1920    ///
1921    /// Sets the channel to shutdown if an error occurs.
1922    pub fn send(self, mut out_opp: u32) -> Result<(), fidl::Error> {
1923        let _result = self.send_raw(out_opp);
1924        if _result.is_err() {
1925            self.control_handle.shutdown();
1926        }
1927        self.drop_without_shutdown();
1928        _result
1929    }
1930
1931    /// Similar to "send" but does not shutdown the channel if an error occurs.
1932    pub fn send_no_shutdown_on_err(self, mut out_opp: u32) -> Result<(), fidl::Error> {
1933        let _result = self.send_raw(out_opp);
1934        self.drop_without_shutdown();
1935        _result
1936    }
1937
1938    fn send_raw(&self, mut out_opp: u32) -> Result<(), fidl::Error> {
1939        self.control_handle.inner.send::<DeviceGetCurrentOperatingPointResponse>(
1940            (out_opp,),
1941            self.tx_id,
1942            0x52de67a5993f5fe1,
1943            fidl::encoding::DynamicFlags::empty(),
1944        )
1945    }
1946}
1947
1948#[must_use = "FIDL methods require a response to be sent"]
1949#[derive(Debug)]
1950pub struct DeviceSetCurrentOperatingPointResponder {
1951    control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
1952    tx_id: u32,
1953}
1954
1955/// Set the the channel to be shutdown (see [`DeviceControlHandle::shutdown`])
1956/// if the responder is dropped without sending a response, so that the client
1957/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1958impl std::ops::Drop for DeviceSetCurrentOperatingPointResponder {
1959    fn drop(&mut self) {
1960        self.control_handle.shutdown();
1961        // Safety: drops once, never accessed again
1962        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1963    }
1964}
1965
1966impl fidl::endpoints::Responder for DeviceSetCurrentOperatingPointResponder {
1967    type ControlHandle = DeviceControlHandle;
1968
1969    fn control_handle(&self) -> &DeviceControlHandle {
1970        &self.control_handle
1971    }
1972
1973    fn drop_without_shutdown(mut self) {
1974        // Safety: drops once, never accessed again due to mem::forget
1975        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1976        // Prevent Drop from running (which would shut down the channel)
1977        std::mem::forget(self);
1978    }
1979}
1980
1981impl DeviceSetCurrentOperatingPointResponder {
1982    /// Sends a response to the FIDL transaction.
1983    ///
1984    /// Sets the channel to shutdown if an error occurs.
1985    pub fn send(self, mut result: Result<u32, i32>) -> Result<(), fidl::Error> {
1986        let _result = self.send_raw(result);
1987        if _result.is_err() {
1988            self.control_handle.shutdown();
1989        }
1990        self.drop_without_shutdown();
1991        _result
1992    }
1993
1994    /// Similar to "send" but does not shutdown the channel if an error occurs.
1995    pub fn send_no_shutdown_on_err(self, mut result: Result<u32, i32>) -> Result<(), fidl::Error> {
1996        let _result = self.send_raw(result);
1997        self.drop_without_shutdown();
1998        _result
1999    }
2000
2001    fn send_raw(&self, mut result: Result<u32, i32>) -> Result<(), fidl::Error> {
2002        self.control_handle.inner.send::<fidl::encoding::ResultType<
2003            DeviceSetCurrentOperatingPointResponse,
2004            i32,
2005        >>(
2006            result.map(|out_opp| (out_opp,)),
2007            self.tx_id,
2008            0x34a7828b5ca53fd,
2009            fidl::encoding::DynamicFlags::empty(),
2010        )
2011    }
2012}
2013
2014#[must_use = "FIDL methods require a response to be sent"]
2015#[derive(Debug)]
2016pub struct DeviceSetMinimumOperatingPointLimitResponder {
2017    control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
2018    tx_id: u32,
2019}
2020
2021/// Set the the channel to be shutdown (see [`DeviceControlHandle::shutdown`])
2022/// if the responder is dropped without sending a response, so that the client
2023/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2024impl std::ops::Drop for DeviceSetMinimumOperatingPointLimitResponder {
2025    fn drop(&mut self) {
2026        self.control_handle.shutdown();
2027        // Safety: drops once, never accessed again
2028        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2029    }
2030}
2031
2032impl fidl::endpoints::Responder for DeviceSetMinimumOperatingPointLimitResponder {
2033    type ControlHandle = DeviceControlHandle;
2034
2035    fn control_handle(&self) -> &DeviceControlHandle {
2036        &self.control_handle
2037    }
2038
2039    fn drop_without_shutdown(mut self) {
2040        // Safety: drops once, never accessed again due to mem::forget
2041        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2042        // Prevent Drop from running (which would shut down the channel)
2043        std::mem::forget(self);
2044    }
2045}
2046
2047impl DeviceSetMinimumOperatingPointLimitResponder {
2048    /// Sends a response to the FIDL transaction.
2049    ///
2050    /// Sets the channel to shutdown if an error occurs.
2051    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2052        let _result = self.send_raw(result);
2053        if _result.is_err() {
2054            self.control_handle.shutdown();
2055        }
2056        self.drop_without_shutdown();
2057        _result
2058    }
2059
2060    /// Similar to "send" but does not shutdown the channel if an error occurs.
2061    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2062        let _result = self.send_raw(result);
2063        self.drop_without_shutdown();
2064        _result
2065    }
2066
2067    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2068        self.control_handle
2069            .inner
2070            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
2071                result,
2072                self.tx_id,
2073                0x5467de86fa3fdfe7,
2074                fidl::encoding::DynamicFlags::empty(),
2075            )
2076    }
2077}
2078
2079#[must_use = "FIDL methods require a response to be sent"]
2080#[derive(Debug)]
2081pub struct DeviceSetMaximumOperatingPointLimitResponder {
2082    control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
2083    tx_id: u32,
2084}
2085
2086/// Set the the channel to be shutdown (see [`DeviceControlHandle::shutdown`])
2087/// if the responder is dropped without sending a response, so that the client
2088/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2089impl std::ops::Drop for DeviceSetMaximumOperatingPointLimitResponder {
2090    fn drop(&mut self) {
2091        self.control_handle.shutdown();
2092        // Safety: drops once, never accessed again
2093        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2094    }
2095}
2096
2097impl fidl::endpoints::Responder for DeviceSetMaximumOperatingPointLimitResponder {
2098    type ControlHandle = DeviceControlHandle;
2099
2100    fn control_handle(&self) -> &DeviceControlHandle {
2101        &self.control_handle
2102    }
2103
2104    fn drop_without_shutdown(mut self) {
2105        // Safety: drops once, never accessed again due to mem::forget
2106        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2107        // Prevent Drop from running (which would shut down the channel)
2108        std::mem::forget(self);
2109    }
2110}
2111
2112impl DeviceSetMaximumOperatingPointLimitResponder {
2113    /// Sends a response to the FIDL transaction.
2114    ///
2115    /// Sets the channel to shutdown if an error occurs.
2116    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2117        let _result = self.send_raw(result);
2118        if _result.is_err() {
2119            self.control_handle.shutdown();
2120        }
2121        self.drop_without_shutdown();
2122        _result
2123    }
2124
2125    /// Similar to "send" but does not shutdown the channel if an error occurs.
2126    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2127        let _result = self.send_raw(result);
2128        self.drop_without_shutdown();
2129        _result
2130    }
2131
2132    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2133        self.control_handle
2134            .inner
2135            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
2136                result,
2137                self.tx_id,
2138                0x385fa4d74481fbfd,
2139                fidl::encoding::DynamicFlags::empty(),
2140            )
2141    }
2142}
2143
2144#[must_use = "FIDL methods require a response to be sent"]
2145#[derive(Debug)]
2146pub struct DeviceSetOperatingPointLimitsResponder {
2147    control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
2148    tx_id: u32,
2149}
2150
2151/// Set the the channel to be shutdown (see [`DeviceControlHandle::shutdown`])
2152/// if the responder is dropped without sending a response, so that the client
2153/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2154impl std::ops::Drop for DeviceSetOperatingPointLimitsResponder {
2155    fn drop(&mut self) {
2156        self.control_handle.shutdown();
2157        // Safety: drops once, never accessed again
2158        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2159    }
2160}
2161
2162impl fidl::endpoints::Responder for DeviceSetOperatingPointLimitsResponder {
2163    type ControlHandle = DeviceControlHandle;
2164
2165    fn control_handle(&self) -> &DeviceControlHandle {
2166        &self.control_handle
2167    }
2168
2169    fn drop_without_shutdown(mut self) {
2170        // Safety: drops once, never accessed again due to mem::forget
2171        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2172        // Prevent Drop from running (which would shut down the channel)
2173        std::mem::forget(self);
2174    }
2175}
2176
2177impl DeviceSetOperatingPointLimitsResponder {
2178    /// Sends a response to the FIDL transaction.
2179    ///
2180    /// Sets the channel to shutdown if an error occurs.
2181    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2182        let _result = self.send_raw(result);
2183        if _result.is_err() {
2184            self.control_handle.shutdown();
2185        }
2186        self.drop_without_shutdown();
2187        _result
2188    }
2189
2190    /// Similar to "send" but does not shutdown the channel if an error occurs.
2191    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2192        let _result = self.send_raw(result);
2193        self.drop_without_shutdown();
2194        _result
2195    }
2196
2197    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2198        self.control_handle
2199            .inner
2200            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
2201                result,
2202                self.tx_id,
2203                0x30aa7514dd598b23,
2204                fidl::encoding::DynamicFlags::empty(),
2205            )
2206    }
2207}
2208
2209#[must_use = "FIDL methods require a response to be sent"]
2210#[derive(Debug)]
2211pub struct DeviceGetCurrentOperatingPointLimitsResponder {
2212    control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
2213    tx_id: u32,
2214}
2215
2216/// Set the the channel to be shutdown (see [`DeviceControlHandle::shutdown`])
2217/// if the responder is dropped without sending a response, so that the client
2218/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2219impl std::ops::Drop for DeviceGetCurrentOperatingPointLimitsResponder {
2220    fn drop(&mut self) {
2221        self.control_handle.shutdown();
2222        // Safety: drops once, never accessed again
2223        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2224    }
2225}
2226
2227impl fidl::endpoints::Responder for DeviceGetCurrentOperatingPointLimitsResponder {
2228    type ControlHandle = DeviceControlHandle;
2229
2230    fn control_handle(&self) -> &DeviceControlHandle {
2231        &self.control_handle
2232    }
2233
2234    fn drop_without_shutdown(mut self) {
2235        // Safety: drops once, never accessed again due to mem::forget
2236        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2237        // Prevent Drop from running (which would shut down the channel)
2238        std::mem::forget(self);
2239    }
2240}
2241
2242impl DeviceGetCurrentOperatingPointLimitsResponder {
2243    /// Sends a response to the FIDL transaction.
2244    ///
2245    /// Sets the channel to shutdown if an error occurs.
2246    pub fn send(self, mut result: Result<(u32, u32), i32>) -> Result<(), fidl::Error> {
2247        let _result = self.send_raw(result);
2248        if _result.is_err() {
2249            self.control_handle.shutdown();
2250        }
2251        self.drop_without_shutdown();
2252        _result
2253    }
2254
2255    /// Similar to "send" but does not shutdown the channel if an error occurs.
2256    pub fn send_no_shutdown_on_err(
2257        self,
2258        mut result: Result<(u32, u32), i32>,
2259    ) -> Result<(), fidl::Error> {
2260        let _result = self.send_raw(result);
2261        self.drop_without_shutdown();
2262        _result
2263    }
2264
2265    fn send_raw(&self, mut result: Result<(u32, u32), i32>) -> Result<(), fidl::Error> {
2266        self.control_handle.inner.send::<fidl::encoding::ResultType<
2267            DeviceGetCurrentOperatingPointLimitsResponse,
2268            i32,
2269        >>(
2270            result,
2271            self.tx_id,
2272            0x7aefe3d765cfc6a7,
2273            fidl::encoding::DynamicFlags::empty(),
2274        )
2275    }
2276}
2277
2278#[must_use = "FIDL methods require a response to be sent"]
2279#[derive(Debug)]
2280pub struct DeviceGetOperatingPointCountResponder {
2281    control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
2282    tx_id: u32,
2283}
2284
2285/// Set the the channel to be shutdown (see [`DeviceControlHandle::shutdown`])
2286/// if the responder is dropped without sending a response, so that the client
2287/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2288impl std::ops::Drop for DeviceGetOperatingPointCountResponder {
2289    fn drop(&mut self) {
2290        self.control_handle.shutdown();
2291        // Safety: drops once, never accessed again
2292        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2293    }
2294}
2295
2296impl fidl::endpoints::Responder for DeviceGetOperatingPointCountResponder {
2297    type ControlHandle = DeviceControlHandle;
2298
2299    fn control_handle(&self) -> &DeviceControlHandle {
2300        &self.control_handle
2301    }
2302
2303    fn drop_without_shutdown(mut self) {
2304        // Safety: drops once, never accessed again due to mem::forget
2305        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2306        // Prevent Drop from running (which would shut down the channel)
2307        std::mem::forget(self);
2308    }
2309}
2310
2311impl DeviceGetOperatingPointCountResponder {
2312    /// Sends a response to the FIDL transaction.
2313    ///
2314    /// Sets the channel to shutdown if an error occurs.
2315    pub fn send(self, mut result: Result<u32, i32>) -> Result<(), fidl::Error> {
2316        let _result = self.send_raw(result);
2317        if _result.is_err() {
2318            self.control_handle.shutdown();
2319        }
2320        self.drop_without_shutdown();
2321        _result
2322    }
2323
2324    /// Similar to "send" but does not shutdown the channel if an error occurs.
2325    pub fn send_no_shutdown_on_err(self, mut result: Result<u32, i32>) -> Result<(), fidl::Error> {
2326        let _result = self.send_raw(result);
2327        self.drop_without_shutdown();
2328        _result
2329    }
2330
2331    fn send_raw(&self, mut result: Result<u32, i32>) -> Result<(), fidl::Error> {
2332        self.control_handle.inner.send::<fidl::encoding::ResultType<
2333            DeviceGetOperatingPointCountResponse,
2334            i32,
2335        >>(
2336            result.map(|count| (count,)),
2337            self.tx_id,
2338            0x13e70ec7131889ba,
2339            fidl::encoding::DynamicFlags::empty(),
2340        )
2341    }
2342}
2343
2344#[must_use = "FIDL methods require a response to be sent"]
2345#[derive(Debug)]
2346pub struct DeviceGetNumLogicalCoresResponder {
2347    control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
2348    tx_id: u32,
2349}
2350
2351/// Set the the channel to be shutdown (see [`DeviceControlHandle::shutdown`])
2352/// if the responder is dropped without sending a response, so that the client
2353/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2354impl std::ops::Drop for DeviceGetNumLogicalCoresResponder {
2355    fn drop(&mut self) {
2356        self.control_handle.shutdown();
2357        // Safety: drops once, never accessed again
2358        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2359    }
2360}
2361
2362impl fidl::endpoints::Responder for DeviceGetNumLogicalCoresResponder {
2363    type ControlHandle = DeviceControlHandle;
2364
2365    fn control_handle(&self) -> &DeviceControlHandle {
2366        &self.control_handle
2367    }
2368
2369    fn drop_without_shutdown(mut self) {
2370        // Safety: drops once, never accessed again due to mem::forget
2371        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2372        // Prevent Drop from running (which would shut down the channel)
2373        std::mem::forget(self);
2374    }
2375}
2376
2377impl DeviceGetNumLogicalCoresResponder {
2378    /// Sends a response to the FIDL transaction.
2379    ///
2380    /// Sets the channel to shutdown if an error occurs.
2381    pub fn send(self, mut count: u64) -> Result<(), fidl::Error> {
2382        let _result = self.send_raw(count);
2383        if _result.is_err() {
2384            self.control_handle.shutdown();
2385        }
2386        self.drop_without_shutdown();
2387        _result
2388    }
2389
2390    /// Similar to "send" but does not shutdown the channel if an error occurs.
2391    pub fn send_no_shutdown_on_err(self, mut count: u64) -> Result<(), fidl::Error> {
2392        let _result = self.send_raw(count);
2393        self.drop_without_shutdown();
2394        _result
2395    }
2396
2397    fn send_raw(&self, mut count: u64) -> Result<(), fidl::Error> {
2398        self.control_handle.inner.send::<DeviceGetNumLogicalCoresResponse>(
2399            (count,),
2400            self.tx_id,
2401            0x74e304c90ca165c5,
2402            fidl::encoding::DynamicFlags::empty(),
2403        )
2404    }
2405}
2406
2407#[must_use = "FIDL methods require a response to be sent"]
2408#[derive(Debug)]
2409pub struct DeviceGetLogicalCoreIdResponder {
2410    control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
2411    tx_id: u32,
2412}
2413
2414/// Set the the channel to be shutdown (see [`DeviceControlHandle::shutdown`])
2415/// if the responder is dropped without sending a response, so that the client
2416/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2417impl std::ops::Drop for DeviceGetLogicalCoreIdResponder {
2418    fn drop(&mut self) {
2419        self.control_handle.shutdown();
2420        // Safety: drops once, never accessed again
2421        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2422    }
2423}
2424
2425impl fidl::endpoints::Responder for DeviceGetLogicalCoreIdResponder {
2426    type ControlHandle = DeviceControlHandle;
2427
2428    fn control_handle(&self) -> &DeviceControlHandle {
2429        &self.control_handle
2430    }
2431
2432    fn drop_without_shutdown(mut self) {
2433        // Safety: drops once, never accessed again due to mem::forget
2434        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2435        // Prevent Drop from running (which would shut down the channel)
2436        std::mem::forget(self);
2437    }
2438}
2439
2440impl DeviceGetLogicalCoreIdResponder {
2441    /// Sends a response to the FIDL transaction.
2442    ///
2443    /// Sets the channel to shutdown if an error occurs.
2444    pub fn send(self, mut id: u64) -> Result<(), fidl::Error> {
2445        let _result = self.send_raw(id);
2446        if _result.is_err() {
2447            self.control_handle.shutdown();
2448        }
2449        self.drop_without_shutdown();
2450        _result
2451    }
2452
2453    /// Similar to "send" but does not shutdown the channel if an error occurs.
2454    pub fn send_no_shutdown_on_err(self, mut id: u64) -> Result<(), fidl::Error> {
2455        let _result = self.send_raw(id);
2456        self.drop_without_shutdown();
2457        _result
2458    }
2459
2460    fn send_raw(&self, mut id: u64) -> Result<(), fidl::Error> {
2461        self.control_handle.inner.send::<DeviceGetLogicalCoreIdResponse>(
2462            (id,),
2463            self.tx_id,
2464            0x7168f98ddbd26058,
2465            fidl::encoding::DynamicFlags::empty(),
2466        )
2467    }
2468}
2469
2470#[must_use = "FIDL methods require a response to be sent"]
2471#[derive(Debug)]
2472pub struct DeviceGetDomainIdResponder {
2473    control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
2474    tx_id: u32,
2475}
2476
2477/// Set the the channel to be shutdown (see [`DeviceControlHandle::shutdown`])
2478/// if the responder is dropped without sending a response, so that the client
2479/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2480impl std::ops::Drop for DeviceGetDomainIdResponder {
2481    fn drop(&mut self) {
2482        self.control_handle.shutdown();
2483        // Safety: drops once, never accessed again
2484        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2485    }
2486}
2487
2488impl fidl::endpoints::Responder for DeviceGetDomainIdResponder {
2489    type ControlHandle = DeviceControlHandle;
2490
2491    fn control_handle(&self) -> &DeviceControlHandle {
2492        &self.control_handle
2493    }
2494
2495    fn drop_without_shutdown(mut self) {
2496        // Safety: drops once, never accessed again due to mem::forget
2497        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2498        // Prevent Drop from running (which would shut down the channel)
2499        std::mem::forget(self);
2500    }
2501}
2502
2503impl DeviceGetDomainIdResponder {
2504    /// Sends a response to the FIDL transaction.
2505    ///
2506    /// Sets the channel to shutdown if an error occurs.
2507    pub fn send(self, mut domain_id: u32) -> Result<(), fidl::Error> {
2508        let _result = self.send_raw(domain_id);
2509        if _result.is_err() {
2510            self.control_handle.shutdown();
2511        }
2512        self.drop_without_shutdown();
2513        _result
2514    }
2515
2516    /// Similar to "send" but does not shutdown the channel if an error occurs.
2517    pub fn send_no_shutdown_on_err(self, mut domain_id: u32) -> Result<(), fidl::Error> {
2518        let _result = self.send_raw(domain_id);
2519        self.drop_without_shutdown();
2520        _result
2521    }
2522
2523    fn send_raw(&self, mut domain_id: u32) -> Result<(), fidl::Error> {
2524        self.control_handle.inner.send::<DeviceGetDomainIdResponse>(
2525            (domain_id,),
2526            self.tx_id,
2527            0x3030f85bdc1ef321,
2528            fidl::encoding::DynamicFlags::empty(),
2529        )
2530    }
2531}
2532
2533#[must_use = "FIDL methods require a response to be sent"]
2534#[derive(Debug)]
2535pub struct DeviceGetRelativePerformanceResponder {
2536    control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
2537    tx_id: u32,
2538}
2539
2540/// Set the the channel to be shutdown (see [`DeviceControlHandle::shutdown`])
2541/// if the responder is dropped without sending a response, so that the client
2542/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2543impl std::ops::Drop for DeviceGetRelativePerformanceResponder {
2544    fn drop(&mut self) {
2545        self.control_handle.shutdown();
2546        // Safety: drops once, never accessed again
2547        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2548    }
2549}
2550
2551impl fidl::endpoints::Responder for DeviceGetRelativePerformanceResponder {
2552    type ControlHandle = DeviceControlHandle;
2553
2554    fn control_handle(&self) -> &DeviceControlHandle {
2555        &self.control_handle
2556    }
2557
2558    fn drop_without_shutdown(mut self) {
2559        // Safety: drops once, never accessed again due to mem::forget
2560        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2561        // Prevent Drop from running (which would shut down the channel)
2562        std::mem::forget(self);
2563    }
2564}
2565
2566impl DeviceGetRelativePerformanceResponder {
2567    /// Sends a response to the FIDL transaction.
2568    ///
2569    /// Sets the channel to shutdown if an error occurs.
2570    pub fn send(self, mut result: Result<u8, i32>) -> Result<(), fidl::Error> {
2571        let _result = self.send_raw(result);
2572        if _result.is_err() {
2573            self.control_handle.shutdown();
2574        }
2575        self.drop_without_shutdown();
2576        _result
2577    }
2578
2579    /// Similar to "send" but does not shutdown the channel if an error occurs.
2580    pub fn send_no_shutdown_on_err(self, mut result: Result<u8, i32>) -> Result<(), fidl::Error> {
2581        let _result = self.send_raw(result);
2582        self.drop_without_shutdown();
2583        _result
2584    }
2585
2586    fn send_raw(&self, mut result: Result<u8, i32>) -> Result<(), fidl::Error> {
2587        self.control_handle.inner.send::<fidl::encoding::ResultType<
2588            DeviceGetRelativePerformanceResponse,
2589            i32,
2590        >>(
2591            result.map(|relative_performance| (relative_performance,)),
2592            self.tx_id,
2593            0x41c37eaf0c26a3d3,
2594            fidl::encoding::DynamicFlags::empty(),
2595        )
2596    }
2597}
2598
2599#[must_use = "FIDL methods require a response to be sent"]
2600#[derive(Debug)]
2601pub struct DeviceGetRelativePerformance2Responder {
2602    control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
2603    tx_id: u32,
2604}
2605
2606/// Set the the channel to be shutdown (see [`DeviceControlHandle::shutdown`])
2607/// if the responder is dropped without sending a response, so that the client
2608/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2609impl std::ops::Drop for DeviceGetRelativePerformance2Responder {
2610    fn drop(&mut self) {
2611        self.control_handle.shutdown();
2612        // Safety: drops once, never accessed again
2613        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2614    }
2615}
2616
2617impl fidl::endpoints::Responder for DeviceGetRelativePerformance2Responder {
2618    type ControlHandle = DeviceControlHandle;
2619
2620    fn control_handle(&self) -> &DeviceControlHandle {
2621        &self.control_handle
2622    }
2623
2624    fn drop_without_shutdown(mut self) {
2625        // Safety: drops once, never accessed again due to mem::forget
2626        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2627        // Prevent Drop from running (which would shut down the channel)
2628        std::mem::forget(self);
2629    }
2630}
2631
2632impl DeviceGetRelativePerformance2Responder {
2633    /// Sends a response to the FIDL transaction.
2634    ///
2635    /// Sets the channel to shutdown if an error occurs.
2636    pub fn send(self, mut result: Result<u64, i32>) -> Result<(), fidl::Error> {
2637        let _result = self.send_raw(result);
2638        if _result.is_err() {
2639            self.control_handle.shutdown();
2640        }
2641        self.drop_without_shutdown();
2642        _result
2643    }
2644
2645    /// Similar to "send" but does not shutdown the channel if an error occurs.
2646    pub fn send_no_shutdown_on_err(self, mut result: Result<u64, i32>) -> Result<(), fidl::Error> {
2647        let _result = self.send_raw(result);
2648        self.drop_without_shutdown();
2649        _result
2650    }
2651
2652    fn send_raw(&self, mut result: Result<u64, i32>) -> Result<(), fidl::Error> {
2653        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
2654            DeviceGetRelativePerformance2Response,
2655            i32,
2656        >>(
2657            fidl::encoding::FlexibleResult::new(
2658                result.map(|relative_performance| (relative_performance,)),
2659            ),
2660            self.tx_id,
2661            0x48831ad9a7fc2e38,
2662            fidl::encoding::DynamicFlags::FLEXIBLE,
2663        )
2664    }
2665}
2666
2667#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2668pub struct ServiceMarker;
2669
2670#[cfg(target_os = "fuchsia")]
2671impl fidl::endpoints::ServiceMarker for ServiceMarker {
2672    type Proxy = ServiceProxy;
2673    type Request = ServiceRequest;
2674    const SERVICE_NAME: &'static str = "fuchsia.hardware.cpu.ctrl.Service";
2675}
2676
2677/// A request for one of the member protocols of Service.
2678///
2679#[cfg(target_os = "fuchsia")]
2680pub enum ServiceRequest {
2681    Device(DeviceRequestStream),
2682}
2683
2684#[cfg(target_os = "fuchsia")]
2685impl fidl::endpoints::ServiceRequest for ServiceRequest {
2686    type Service = ServiceMarker;
2687
2688    fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
2689        match name {
2690            "device" => Self::Device(
2691                <DeviceRequestStream as fidl::endpoints::RequestStream>::from_channel(_channel),
2692            ),
2693            _ => panic!("no such member protocol name for service Service"),
2694        }
2695    }
2696
2697    fn member_names() -> &'static [&'static str] {
2698        &["device"]
2699    }
2700}
2701#[cfg(target_os = "fuchsia")]
2702pub struct ServiceProxy(#[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>);
2703
2704#[cfg(target_os = "fuchsia")]
2705impl fidl::endpoints::ServiceProxy for ServiceProxy {
2706    type Service = ServiceMarker;
2707
2708    fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
2709        Self(opener)
2710    }
2711}
2712
2713#[cfg(target_os = "fuchsia")]
2714impl ServiceProxy {
2715    pub fn connect_to_device(&self) -> Result<DeviceProxy, fidl::Error> {
2716        let (proxy, server_end) = fidl::endpoints::create_proxy::<DeviceMarker>();
2717        self.connect_channel_to_device(server_end)?;
2718        Ok(proxy)
2719    }
2720
2721    /// Like `connect_to_device`, but returns a sync proxy.
2722    /// See [`Self::connect_to_device`] for more details.
2723    pub fn connect_to_device_sync(&self) -> Result<DeviceSynchronousProxy, fidl::Error> {
2724        let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<DeviceMarker>();
2725        self.connect_channel_to_device(server_end)?;
2726        Ok(proxy)
2727    }
2728
2729    /// Like `connect_to_device`, but accepts a server end.
2730    /// See [`Self::connect_to_device`] for more details.
2731    pub fn connect_channel_to_device(
2732        &self,
2733        server_end: fidl::endpoints::ServerEnd<DeviceMarker>,
2734    ) -> Result<(), fidl::Error> {
2735        self.0.open_member("device", server_end.into_channel())
2736    }
2737
2738    pub fn instance_name(&self) -> &str {
2739        self.0.instance_name()
2740    }
2741}
2742
2743mod internal {
2744    use super::*;
2745}