1#![warn(clippy::all)]
4#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
5
6use bitflags::bitflags;
7use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
8use futures::future::{self, MaybeDone, TryFutureExt};
9use zx_status;
10
11pub const MAX_DVFS_DOMAINS: u32 = 2;
14
15pub const MAX_DVFS_OPPS: u32 = 16;
17
18pub const MAX_TRIP_POINTS: u32 = 16;
20
21pub const THERMAL_STATE_NORMAL: u32 = 0;
23
24pub const THERMAL_STATE_TRIP_VIOLATION: u32 = 1;
25
26#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
29#[repr(u32)]
30pub enum PowerDomain {
31 BigClusterPowerDomain = 0,
32 LittleClusterPowerDomain = 1,
33}
34
35impl PowerDomain {
36 #[inline]
37 pub fn from_primitive(prim: u32) -> Option<Self> {
38 match prim {
39 0 => Some(Self::BigClusterPowerDomain),
40 1 => Some(Self::LittleClusterPowerDomain),
41 _ => None,
42 }
43 }
44
45 #[inline]
46 pub const fn into_primitive(self) -> u32 {
47 self as u32
48 }
49}
50
51#[derive(Clone, Debug, PartialEq, PartialOrd)]
52pub struct DeviceGetDeviceInfoResponse {
53 pub status: i32,
54 pub info: Option<Box<ThermalDeviceInfo>>,
55}
56
57impl fidl::Persistable for DeviceGetDeviceInfoResponse {}
58
59#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
60pub struct DeviceGetDvfsInfoRequest {
61 pub power_domain: PowerDomain,
62}
63
64impl fidl::Persistable for DeviceGetDvfsInfoRequest {}
65
66#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
67pub struct DeviceGetDvfsInfoResponse {
68 pub status: i32,
69 pub info: Option<Box<OperatingPoint>>,
70}
71
72impl fidl::Persistable for DeviceGetDvfsInfoResponse {}
73
74#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
75pub struct DeviceGetDvfsOperatingPointRequest {
76 pub power_domain: PowerDomain,
77}
78
79impl fidl::Persistable for DeviceGetDvfsOperatingPointRequest {}
80
81#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
82#[repr(C)]
83pub struct DeviceGetDvfsOperatingPointResponse {
84 pub status: i32,
85 pub op_idx: u16,
86}
87
88impl fidl::Persistable for DeviceGetDvfsOperatingPointResponse {}
89
90#[derive(Clone, Debug, PartialEq, PartialOrd)]
91pub struct DeviceGetInfoResponse {
92 pub status: i32,
93 pub info: Option<Box<ThermalInfo>>,
94}
95
96impl fidl::Persistable for DeviceGetInfoResponse {}
97
98#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
99pub struct DeviceSetDvfsOperatingPointRequest {
100 pub op_idx: u16,
101 pub power_domain: PowerDomain,
102}
103
104impl fidl::Persistable for DeviceSetDvfsOperatingPointRequest {}
105
106#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
107#[repr(C)]
108pub struct DeviceSetDvfsOperatingPointResponse {
109 pub status: i32,
110}
111
112impl fidl::Persistable for DeviceSetDvfsOperatingPointResponse {}
113
114#[derive(Clone, Copy, Debug, PartialEq, PartialOrd)]
115pub struct DeviceSetTripCelsiusRequest {
116 pub id: u32,
117 pub temp: f32,
118}
119
120impl fidl::Persistable for DeviceSetTripCelsiusRequest {}
121
122#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
123#[repr(C)]
124pub struct DeviceSetTripCelsiusResponse {
125 pub status: i32,
126}
127
128impl fidl::Persistable for DeviceSetTripCelsiusResponse {}
129
130#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
132#[repr(C)]
133pub struct OperatingPoint {
134 pub opp: [OperatingPointEntry; 16],
136 pub latency: u32,
138 pub count: u32,
140}
141
142impl fidl::Persistable for OperatingPoint {}
143
144#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
146#[repr(C)]
147pub struct OperatingPointEntry {
148 pub freq_hz: u32,
150 pub volt_uv: u32,
152}
153
154impl fidl::Persistable for OperatingPointEntry {}
155
156#[derive(Clone, Copy, Debug, PartialEq, PartialOrd)]
157pub struct ThermalDeviceInfo {
158 pub active_cooling: bool,
160 pub passive_cooling: bool,
162 pub gpu_throttling: bool,
164 pub num_trip_points: u32,
166 pub big_little: bool,
168 pub critical_temp_celsius: f32,
170 pub trip_point_info: [ThermalTemperatureInfo; 16],
172 pub opps: [OperatingPoint; 2],
174}
175
176impl fidl::Persistable for ThermalDeviceInfo {}
177impl fidl::Serializable for ThermalDeviceInfo {
178 const SERIALIZABLE_NAME: &'static str = "fuchsia.hardware.thermal.ThermalDeviceInfo";
179}
180
181#[derive(Clone, Copy, Debug, PartialEq, PartialOrd)]
183pub struct ThermalInfo {
184 pub state: u32,
186 pub passive_temp_celsius: f32,
188 pub critical_temp_celsius: f32,
190 pub max_trip_count: u32,
192 pub active_trip: [f32; 16],
194}
195
196impl fidl::Persistable for ThermalInfo {}
197
198#[derive(Clone, Copy, Debug, PartialEq, PartialOrd)]
200pub struct ThermalTemperatureInfo {
201 pub up_temp_celsius: f32,
203 pub down_temp_celsius: f32,
205 pub fan_level: u32,
207 pub big_cluster_dvfs_opp: u16,
209 pub little_cluster_dvfs_opp: u16,
211 pub gpu_clk_freq_source: u32,
213}
214
215impl fidl::Persistable for ThermalTemperatureInfo {}
216
217pub mod device_ordinals {
218 pub const GET_FAN_LEVEL: u64 = 0x63439dc551ef6dea;
219 pub const SET_FAN_LEVEL: u64 = 0x6552ae76e9703ffb;
220 pub const GET_TEMPERATURE_CELSIUS: u64 = 0x755e08b84736133c;
221 pub const GET_SENSOR_NAME: u64 = 0x4cbd7abaeafc02c1;
222 pub const GET_INFO: u64 = 0x350d7a106835fbda;
223 pub const GET_DEVICE_INFO: u64 = 0x5c35349ec9cd7c79;
224 pub const GET_DVFS_INFO: u64 = 0xb2e9de2423e77eb;
225 pub const GET_STATE_CHANGE_EVENT: u64 = 0x3f6e614172af0a87;
226 pub const GET_STATE_CHANGE_PORT: u64 = 0x7eef3857e900208;
227 pub const SET_TRIP_CELSIUS: u64 = 0x25e3eafaa78a203e;
228 pub const GET_DVFS_OPERATING_POINT: u64 = 0x56d566ab5a9ba330;
229 pub const SET_DVFS_OPERATING_POINT: u64 = 0x9c2508074fe4351;
230}
231
232mod internal {
233 use super::*;
234 unsafe impl fidl::encoding::TypeMarker for PowerDomain {
235 type Owned = Self;
236
237 #[inline(always)]
238 fn inline_align(_context: fidl::encoding::Context) -> usize {
239 std::mem::align_of::<u32>()
240 }
241
242 #[inline(always)]
243 fn inline_size(_context: fidl::encoding::Context) -> usize {
244 std::mem::size_of::<u32>()
245 }
246
247 #[inline(always)]
248 fn encode_is_copy() -> bool {
249 true
250 }
251
252 #[inline(always)]
253 fn decode_is_copy() -> bool {
254 false
255 }
256 }
257
258 impl fidl::encoding::ValueTypeMarker for PowerDomain {
259 type Borrowed<'a> = Self;
260 #[inline(always)]
261 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
262 *value
263 }
264 }
265
266 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for PowerDomain {
267 #[inline]
268 unsafe fn encode(
269 self,
270 encoder: &mut fidl::encoding::Encoder<'_, D>,
271 offset: usize,
272 _depth: fidl::encoding::Depth,
273 ) -> fidl::Result<()> {
274 encoder.debug_check_bounds::<Self>(offset);
275 encoder.write_num(self.into_primitive(), offset);
276 Ok(())
277 }
278 }
279
280 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for PowerDomain {
281 #[inline(always)]
282 fn new_empty() -> Self {
283 Self::BigClusterPowerDomain
284 }
285
286 #[inline]
287 unsafe fn decode(
288 &mut self,
289 decoder: &mut fidl::encoding::Decoder<'_, D>,
290 offset: usize,
291 _depth: fidl::encoding::Depth,
292 ) -> fidl::Result<()> {
293 decoder.debug_check_bounds::<Self>(offset);
294 let prim = decoder.read_num::<u32>(offset);
295
296 *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
297 Ok(())
298 }
299 }
300
301 impl fidl::encoding::ValueTypeMarker for DeviceGetDeviceInfoResponse {
302 type Borrowed<'a> = &'a Self;
303 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
304 value
305 }
306 }
307
308 unsafe impl fidl::encoding::TypeMarker for DeviceGetDeviceInfoResponse {
309 type Owned = Self;
310
311 #[inline(always)]
312 fn inline_align(_context: fidl::encoding::Context) -> usize {
313 8
314 }
315
316 #[inline(always)]
317 fn inline_size(_context: fidl::encoding::Context) -> usize {
318 16
319 }
320 }
321
322 unsafe impl<D: fidl::encoding::ResourceDialect>
323 fidl::encoding::Encode<DeviceGetDeviceInfoResponse, D> for &DeviceGetDeviceInfoResponse
324 {
325 #[inline]
326 unsafe fn encode(
327 self,
328 encoder: &mut fidl::encoding::Encoder<'_, D>,
329 offset: usize,
330 _depth: fidl::encoding::Depth,
331 ) -> fidl::Result<()> {
332 encoder.debug_check_bounds::<DeviceGetDeviceInfoResponse>(offset);
333 fidl::encoding::Encode::<DeviceGetDeviceInfoResponse, D>::encode(
335 (
336 <i32 as fidl::encoding::ValueTypeMarker>::borrow(&self.status),
337 <fidl::encoding::Boxed<ThermalDeviceInfo> as fidl::encoding::ValueTypeMarker>::borrow(&self.info),
338 ),
339 encoder, offset, _depth
340 )
341 }
342 }
343 unsafe impl<
344 D: fidl::encoding::ResourceDialect,
345 T0: fidl::encoding::Encode<i32, D>,
346 T1: fidl::encoding::Encode<fidl::encoding::Boxed<ThermalDeviceInfo>, D>,
347 > fidl::encoding::Encode<DeviceGetDeviceInfoResponse, D> for (T0, T1)
348 {
349 #[inline]
350 unsafe fn encode(
351 self,
352 encoder: &mut fidl::encoding::Encoder<'_, D>,
353 offset: usize,
354 depth: fidl::encoding::Depth,
355 ) -> fidl::Result<()> {
356 encoder.debug_check_bounds::<DeviceGetDeviceInfoResponse>(offset);
357 unsafe {
360 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
361 (ptr as *mut u64).write_unaligned(0);
362 }
363 self.0.encode(encoder, offset + 0, depth)?;
365 self.1.encode(encoder, offset + 8, depth)?;
366 Ok(())
367 }
368 }
369
370 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
371 for DeviceGetDeviceInfoResponse
372 {
373 #[inline(always)]
374 fn new_empty() -> Self {
375 Self {
376 status: fidl::new_empty!(i32, D),
377 info: fidl::new_empty!(fidl::encoding::Boxed<ThermalDeviceInfo>, D),
378 }
379 }
380
381 #[inline]
382 unsafe fn decode(
383 &mut self,
384 decoder: &mut fidl::encoding::Decoder<'_, D>,
385 offset: usize,
386 _depth: fidl::encoding::Depth,
387 ) -> fidl::Result<()> {
388 decoder.debug_check_bounds::<Self>(offset);
389 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
391 let padval = unsafe { (ptr as *const u64).read_unaligned() };
392 let mask = 0xffffffff00000000u64;
393 let maskedval = padval & mask;
394 if maskedval != 0 {
395 return Err(fidl::Error::NonZeroPadding {
396 padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
397 });
398 }
399 fidl::decode!(i32, D, &mut self.status, decoder, offset + 0, _depth)?;
400 fidl::decode!(
401 fidl::encoding::Boxed<ThermalDeviceInfo>,
402 D,
403 &mut self.info,
404 decoder,
405 offset + 8,
406 _depth
407 )?;
408 Ok(())
409 }
410 }
411
412 impl fidl::encoding::ValueTypeMarker for DeviceGetDvfsInfoRequest {
413 type Borrowed<'a> = &'a Self;
414 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
415 value
416 }
417 }
418
419 unsafe impl fidl::encoding::TypeMarker for DeviceGetDvfsInfoRequest {
420 type Owned = Self;
421
422 #[inline(always)]
423 fn inline_align(_context: fidl::encoding::Context) -> usize {
424 4
425 }
426
427 #[inline(always)]
428 fn inline_size(_context: fidl::encoding::Context) -> usize {
429 4
430 }
431 }
432
433 unsafe impl<D: fidl::encoding::ResourceDialect>
434 fidl::encoding::Encode<DeviceGetDvfsInfoRequest, D> for &DeviceGetDvfsInfoRequest
435 {
436 #[inline]
437 unsafe fn encode(
438 self,
439 encoder: &mut fidl::encoding::Encoder<'_, D>,
440 offset: usize,
441 _depth: fidl::encoding::Depth,
442 ) -> fidl::Result<()> {
443 encoder.debug_check_bounds::<DeviceGetDvfsInfoRequest>(offset);
444 fidl::encoding::Encode::<DeviceGetDvfsInfoRequest, D>::encode(
446 (<PowerDomain as fidl::encoding::ValueTypeMarker>::borrow(&self.power_domain),),
447 encoder,
448 offset,
449 _depth,
450 )
451 }
452 }
453 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<PowerDomain, D>>
454 fidl::encoding::Encode<DeviceGetDvfsInfoRequest, D> for (T0,)
455 {
456 #[inline]
457 unsafe fn encode(
458 self,
459 encoder: &mut fidl::encoding::Encoder<'_, D>,
460 offset: usize,
461 depth: fidl::encoding::Depth,
462 ) -> fidl::Result<()> {
463 encoder.debug_check_bounds::<DeviceGetDvfsInfoRequest>(offset);
464 self.0.encode(encoder, offset + 0, depth)?;
468 Ok(())
469 }
470 }
471
472 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
473 for DeviceGetDvfsInfoRequest
474 {
475 #[inline(always)]
476 fn new_empty() -> Self {
477 Self { power_domain: fidl::new_empty!(PowerDomain, D) }
478 }
479
480 #[inline]
481 unsafe fn decode(
482 &mut self,
483 decoder: &mut fidl::encoding::Decoder<'_, D>,
484 offset: usize,
485 _depth: fidl::encoding::Depth,
486 ) -> fidl::Result<()> {
487 decoder.debug_check_bounds::<Self>(offset);
488 fidl::decode!(PowerDomain, D, &mut self.power_domain, decoder, offset + 0, _depth)?;
490 Ok(())
491 }
492 }
493
494 impl fidl::encoding::ValueTypeMarker for DeviceGetDvfsInfoResponse {
495 type Borrowed<'a> = &'a Self;
496 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
497 value
498 }
499 }
500
501 unsafe impl fidl::encoding::TypeMarker for DeviceGetDvfsInfoResponse {
502 type Owned = Self;
503
504 #[inline(always)]
505 fn inline_align(_context: fidl::encoding::Context) -> usize {
506 8
507 }
508
509 #[inline(always)]
510 fn inline_size(_context: fidl::encoding::Context) -> usize {
511 16
512 }
513 }
514
515 unsafe impl<D: fidl::encoding::ResourceDialect>
516 fidl::encoding::Encode<DeviceGetDvfsInfoResponse, D> for &DeviceGetDvfsInfoResponse
517 {
518 #[inline]
519 unsafe fn encode(
520 self,
521 encoder: &mut fidl::encoding::Encoder<'_, D>,
522 offset: usize,
523 _depth: fidl::encoding::Depth,
524 ) -> fidl::Result<()> {
525 encoder.debug_check_bounds::<DeviceGetDvfsInfoResponse>(offset);
526 fidl::encoding::Encode::<DeviceGetDvfsInfoResponse, D>::encode(
528 (
529 <i32 as fidl::encoding::ValueTypeMarker>::borrow(&self.status),
530 <fidl::encoding::Boxed<OperatingPoint> as fidl::encoding::ValueTypeMarker>::borrow(&self.info),
531 ),
532 encoder, offset, _depth
533 )
534 }
535 }
536 unsafe impl<
537 D: fidl::encoding::ResourceDialect,
538 T0: fidl::encoding::Encode<i32, D>,
539 T1: fidl::encoding::Encode<fidl::encoding::Boxed<OperatingPoint>, D>,
540 > fidl::encoding::Encode<DeviceGetDvfsInfoResponse, D> for (T0, T1)
541 {
542 #[inline]
543 unsafe fn encode(
544 self,
545 encoder: &mut fidl::encoding::Encoder<'_, D>,
546 offset: usize,
547 depth: fidl::encoding::Depth,
548 ) -> fidl::Result<()> {
549 encoder.debug_check_bounds::<DeviceGetDvfsInfoResponse>(offset);
550 unsafe {
553 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
554 (ptr as *mut u64).write_unaligned(0);
555 }
556 self.0.encode(encoder, offset + 0, depth)?;
558 self.1.encode(encoder, offset + 8, depth)?;
559 Ok(())
560 }
561 }
562
563 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
564 for DeviceGetDvfsInfoResponse
565 {
566 #[inline(always)]
567 fn new_empty() -> Self {
568 Self {
569 status: fidl::new_empty!(i32, D),
570 info: fidl::new_empty!(fidl::encoding::Boxed<OperatingPoint>, D),
571 }
572 }
573
574 #[inline]
575 unsafe fn decode(
576 &mut self,
577 decoder: &mut fidl::encoding::Decoder<'_, D>,
578 offset: usize,
579 _depth: fidl::encoding::Depth,
580 ) -> fidl::Result<()> {
581 decoder.debug_check_bounds::<Self>(offset);
582 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
584 let padval = unsafe { (ptr as *const u64).read_unaligned() };
585 let mask = 0xffffffff00000000u64;
586 let maskedval = padval & mask;
587 if maskedval != 0 {
588 return Err(fidl::Error::NonZeroPadding {
589 padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
590 });
591 }
592 fidl::decode!(i32, D, &mut self.status, decoder, offset + 0, _depth)?;
593 fidl::decode!(
594 fidl::encoding::Boxed<OperatingPoint>,
595 D,
596 &mut self.info,
597 decoder,
598 offset + 8,
599 _depth
600 )?;
601 Ok(())
602 }
603 }
604
605 impl fidl::encoding::ValueTypeMarker for DeviceGetDvfsOperatingPointRequest {
606 type Borrowed<'a> = &'a Self;
607 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
608 value
609 }
610 }
611
612 unsafe impl fidl::encoding::TypeMarker for DeviceGetDvfsOperatingPointRequest {
613 type Owned = Self;
614
615 #[inline(always)]
616 fn inline_align(_context: fidl::encoding::Context) -> usize {
617 4
618 }
619
620 #[inline(always)]
621 fn inline_size(_context: fidl::encoding::Context) -> usize {
622 4
623 }
624 }
625
626 unsafe impl<D: fidl::encoding::ResourceDialect>
627 fidl::encoding::Encode<DeviceGetDvfsOperatingPointRequest, D>
628 for &DeviceGetDvfsOperatingPointRequest
629 {
630 #[inline]
631 unsafe fn encode(
632 self,
633 encoder: &mut fidl::encoding::Encoder<'_, D>,
634 offset: usize,
635 _depth: fidl::encoding::Depth,
636 ) -> fidl::Result<()> {
637 encoder.debug_check_bounds::<DeviceGetDvfsOperatingPointRequest>(offset);
638 fidl::encoding::Encode::<DeviceGetDvfsOperatingPointRequest, D>::encode(
640 (<PowerDomain as fidl::encoding::ValueTypeMarker>::borrow(&self.power_domain),),
641 encoder,
642 offset,
643 _depth,
644 )
645 }
646 }
647 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<PowerDomain, D>>
648 fidl::encoding::Encode<DeviceGetDvfsOperatingPointRequest, D> for (T0,)
649 {
650 #[inline]
651 unsafe fn encode(
652 self,
653 encoder: &mut fidl::encoding::Encoder<'_, D>,
654 offset: usize,
655 depth: fidl::encoding::Depth,
656 ) -> fidl::Result<()> {
657 encoder.debug_check_bounds::<DeviceGetDvfsOperatingPointRequest>(offset);
658 self.0.encode(encoder, offset + 0, depth)?;
662 Ok(())
663 }
664 }
665
666 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
667 for DeviceGetDvfsOperatingPointRequest
668 {
669 #[inline(always)]
670 fn new_empty() -> Self {
671 Self { power_domain: fidl::new_empty!(PowerDomain, D) }
672 }
673
674 #[inline]
675 unsafe fn decode(
676 &mut self,
677 decoder: &mut fidl::encoding::Decoder<'_, D>,
678 offset: usize,
679 _depth: fidl::encoding::Depth,
680 ) -> fidl::Result<()> {
681 decoder.debug_check_bounds::<Self>(offset);
682 fidl::decode!(PowerDomain, D, &mut self.power_domain, decoder, offset + 0, _depth)?;
684 Ok(())
685 }
686 }
687
688 impl fidl::encoding::ValueTypeMarker for DeviceGetDvfsOperatingPointResponse {
689 type Borrowed<'a> = &'a Self;
690 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
691 value
692 }
693 }
694
695 unsafe impl fidl::encoding::TypeMarker for DeviceGetDvfsOperatingPointResponse {
696 type Owned = Self;
697
698 #[inline(always)]
699 fn inline_align(_context: fidl::encoding::Context) -> usize {
700 4
701 }
702
703 #[inline(always)]
704 fn inline_size(_context: fidl::encoding::Context) -> usize {
705 8
706 }
707 }
708
709 unsafe impl<D: fidl::encoding::ResourceDialect>
710 fidl::encoding::Encode<DeviceGetDvfsOperatingPointResponse, D>
711 for &DeviceGetDvfsOperatingPointResponse
712 {
713 #[inline]
714 unsafe fn encode(
715 self,
716 encoder: &mut fidl::encoding::Encoder<'_, D>,
717 offset: usize,
718 _depth: fidl::encoding::Depth,
719 ) -> fidl::Result<()> {
720 encoder.debug_check_bounds::<DeviceGetDvfsOperatingPointResponse>(offset);
721 unsafe {
722 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
724 (buf_ptr as *mut DeviceGetDvfsOperatingPointResponse)
725 .write_unaligned((self as *const DeviceGetDvfsOperatingPointResponse).read());
726 let padding_ptr = buf_ptr.offset(4) as *mut u32;
729 let padding_mask = 0xffff0000u32;
730 padding_ptr.write_unaligned(padding_ptr.read_unaligned() & !padding_mask);
731 }
732 Ok(())
733 }
734 }
735 unsafe impl<
736 D: fidl::encoding::ResourceDialect,
737 T0: fidl::encoding::Encode<i32, D>,
738 T1: fidl::encoding::Encode<u16, D>,
739 > fidl::encoding::Encode<DeviceGetDvfsOperatingPointResponse, D> for (T0, T1)
740 {
741 #[inline]
742 unsafe fn encode(
743 self,
744 encoder: &mut fidl::encoding::Encoder<'_, D>,
745 offset: usize,
746 depth: fidl::encoding::Depth,
747 ) -> fidl::Result<()> {
748 encoder.debug_check_bounds::<DeviceGetDvfsOperatingPointResponse>(offset);
749 unsafe {
752 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(4);
753 (ptr as *mut u32).write_unaligned(0);
754 }
755 self.0.encode(encoder, offset + 0, depth)?;
757 self.1.encode(encoder, offset + 4, depth)?;
758 Ok(())
759 }
760 }
761
762 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
763 for DeviceGetDvfsOperatingPointResponse
764 {
765 #[inline(always)]
766 fn new_empty() -> Self {
767 Self { status: fidl::new_empty!(i32, D), op_idx: fidl::new_empty!(u16, D) }
768 }
769
770 #[inline]
771 unsafe fn decode(
772 &mut self,
773 decoder: &mut fidl::encoding::Decoder<'_, D>,
774 offset: usize,
775 _depth: fidl::encoding::Depth,
776 ) -> fidl::Result<()> {
777 decoder.debug_check_bounds::<Self>(offset);
778 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
779 let ptr = unsafe { buf_ptr.offset(4) };
781 let padval = unsafe { (ptr as *const u32).read_unaligned() };
782 let mask = 0xffff0000u32;
783 let maskedval = padval & mask;
784 if maskedval != 0 {
785 return Err(fidl::Error::NonZeroPadding {
786 padding_start: offset + 4 + ((mask as u64).trailing_zeros() / 8) as usize,
787 });
788 }
789 unsafe {
791 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
792 }
793 Ok(())
794 }
795 }
796
797 impl fidl::encoding::ValueTypeMarker for DeviceGetInfoResponse {
798 type Borrowed<'a> = &'a Self;
799 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
800 value
801 }
802 }
803
804 unsafe impl fidl::encoding::TypeMarker for DeviceGetInfoResponse {
805 type Owned = Self;
806
807 #[inline(always)]
808 fn inline_align(_context: fidl::encoding::Context) -> usize {
809 8
810 }
811
812 #[inline(always)]
813 fn inline_size(_context: fidl::encoding::Context) -> usize {
814 16
815 }
816 }
817
818 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<DeviceGetInfoResponse, D>
819 for &DeviceGetInfoResponse
820 {
821 #[inline]
822 unsafe fn encode(
823 self,
824 encoder: &mut fidl::encoding::Encoder<'_, D>,
825 offset: usize,
826 _depth: fidl::encoding::Depth,
827 ) -> fidl::Result<()> {
828 encoder.debug_check_bounds::<DeviceGetInfoResponse>(offset);
829 fidl::encoding::Encode::<DeviceGetInfoResponse, D>::encode(
831 (
832 <i32 as fidl::encoding::ValueTypeMarker>::borrow(&self.status),
833 <fidl::encoding::Boxed<ThermalInfo> as fidl::encoding::ValueTypeMarker>::borrow(
834 &self.info,
835 ),
836 ),
837 encoder,
838 offset,
839 _depth,
840 )
841 }
842 }
843 unsafe impl<
844 D: fidl::encoding::ResourceDialect,
845 T0: fidl::encoding::Encode<i32, D>,
846 T1: fidl::encoding::Encode<fidl::encoding::Boxed<ThermalInfo>, D>,
847 > fidl::encoding::Encode<DeviceGetInfoResponse, D> for (T0, T1)
848 {
849 #[inline]
850 unsafe fn encode(
851 self,
852 encoder: &mut fidl::encoding::Encoder<'_, D>,
853 offset: usize,
854 depth: fidl::encoding::Depth,
855 ) -> fidl::Result<()> {
856 encoder.debug_check_bounds::<DeviceGetInfoResponse>(offset);
857 unsafe {
860 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
861 (ptr as *mut u64).write_unaligned(0);
862 }
863 self.0.encode(encoder, offset + 0, depth)?;
865 self.1.encode(encoder, offset + 8, depth)?;
866 Ok(())
867 }
868 }
869
870 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for DeviceGetInfoResponse {
871 #[inline(always)]
872 fn new_empty() -> Self {
873 Self {
874 status: fidl::new_empty!(i32, D),
875 info: fidl::new_empty!(fidl::encoding::Boxed<ThermalInfo>, D),
876 }
877 }
878
879 #[inline]
880 unsafe fn decode(
881 &mut self,
882 decoder: &mut fidl::encoding::Decoder<'_, D>,
883 offset: usize,
884 _depth: fidl::encoding::Depth,
885 ) -> fidl::Result<()> {
886 decoder.debug_check_bounds::<Self>(offset);
887 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
889 let padval = unsafe { (ptr as *const u64).read_unaligned() };
890 let mask = 0xffffffff00000000u64;
891 let maskedval = padval & mask;
892 if maskedval != 0 {
893 return Err(fidl::Error::NonZeroPadding {
894 padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
895 });
896 }
897 fidl::decode!(i32, D, &mut self.status, decoder, offset + 0, _depth)?;
898 fidl::decode!(
899 fidl::encoding::Boxed<ThermalInfo>,
900 D,
901 &mut self.info,
902 decoder,
903 offset + 8,
904 _depth
905 )?;
906 Ok(())
907 }
908 }
909
910 impl fidl::encoding::ValueTypeMarker for DeviceSetDvfsOperatingPointRequest {
911 type Borrowed<'a> = &'a Self;
912 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
913 value
914 }
915 }
916
917 unsafe impl fidl::encoding::TypeMarker for DeviceSetDvfsOperatingPointRequest {
918 type Owned = Self;
919
920 #[inline(always)]
921 fn inline_align(_context: fidl::encoding::Context) -> usize {
922 4
923 }
924
925 #[inline(always)]
926 fn inline_size(_context: fidl::encoding::Context) -> usize {
927 8
928 }
929 }
930
931 unsafe impl<D: fidl::encoding::ResourceDialect>
932 fidl::encoding::Encode<DeviceSetDvfsOperatingPointRequest, D>
933 for &DeviceSetDvfsOperatingPointRequest
934 {
935 #[inline]
936 unsafe fn encode(
937 self,
938 encoder: &mut fidl::encoding::Encoder<'_, D>,
939 offset: usize,
940 _depth: fidl::encoding::Depth,
941 ) -> fidl::Result<()> {
942 encoder.debug_check_bounds::<DeviceSetDvfsOperatingPointRequest>(offset);
943 fidl::encoding::Encode::<DeviceSetDvfsOperatingPointRequest, D>::encode(
945 (
946 <u16 as fidl::encoding::ValueTypeMarker>::borrow(&self.op_idx),
947 <PowerDomain as fidl::encoding::ValueTypeMarker>::borrow(&self.power_domain),
948 ),
949 encoder,
950 offset,
951 _depth,
952 )
953 }
954 }
955 unsafe impl<
956 D: fidl::encoding::ResourceDialect,
957 T0: fidl::encoding::Encode<u16, D>,
958 T1: fidl::encoding::Encode<PowerDomain, D>,
959 > fidl::encoding::Encode<DeviceSetDvfsOperatingPointRequest, D> for (T0, T1)
960 {
961 #[inline]
962 unsafe fn encode(
963 self,
964 encoder: &mut fidl::encoding::Encoder<'_, D>,
965 offset: usize,
966 depth: fidl::encoding::Depth,
967 ) -> fidl::Result<()> {
968 encoder.debug_check_bounds::<DeviceSetDvfsOperatingPointRequest>(offset);
969 unsafe {
972 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
973 (ptr as *mut u32).write_unaligned(0);
974 }
975 self.0.encode(encoder, offset + 0, depth)?;
977 self.1.encode(encoder, offset + 4, depth)?;
978 Ok(())
979 }
980 }
981
982 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
983 for DeviceSetDvfsOperatingPointRequest
984 {
985 #[inline(always)]
986 fn new_empty() -> Self {
987 Self {
988 op_idx: fidl::new_empty!(u16, D),
989 power_domain: fidl::new_empty!(PowerDomain, D),
990 }
991 }
992
993 #[inline]
994 unsafe fn decode(
995 &mut self,
996 decoder: &mut fidl::encoding::Decoder<'_, D>,
997 offset: usize,
998 _depth: fidl::encoding::Depth,
999 ) -> fidl::Result<()> {
1000 decoder.debug_check_bounds::<Self>(offset);
1001 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
1003 let padval = unsafe { (ptr as *const u32).read_unaligned() };
1004 let mask = 0xffff0000u32;
1005 let maskedval = padval & mask;
1006 if maskedval != 0 {
1007 return Err(fidl::Error::NonZeroPadding {
1008 padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
1009 });
1010 }
1011 fidl::decode!(u16, D, &mut self.op_idx, decoder, offset + 0, _depth)?;
1012 fidl::decode!(PowerDomain, D, &mut self.power_domain, decoder, offset + 4, _depth)?;
1013 Ok(())
1014 }
1015 }
1016
1017 impl fidl::encoding::ValueTypeMarker for DeviceSetDvfsOperatingPointResponse {
1018 type Borrowed<'a> = &'a Self;
1019 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1020 value
1021 }
1022 }
1023
1024 unsafe impl fidl::encoding::TypeMarker for DeviceSetDvfsOperatingPointResponse {
1025 type Owned = Self;
1026
1027 #[inline(always)]
1028 fn inline_align(_context: fidl::encoding::Context) -> usize {
1029 4
1030 }
1031
1032 #[inline(always)]
1033 fn inline_size(_context: fidl::encoding::Context) -> usize {
1034 4
1035 }
1036 #[inline(always)]
1037 fn encode_is_copy() -> bool {
1038 true
1039 }
1040
1041 #[inline(always)]
1042 fn decode_is_copy() -> bool {
1043 true
1044 }
1045 }
1046
1047 unsafe impl<D: fidl::encoding::ResourceDialect>
1048 fidl::encoding::Encode<DeviceSetDvfsOperatingPointResponse, D>
1049 for &DeviceSetDvfsOperatingPointResponse
1050 {
1051 #[inline]
1052 unsafe fn encode(
1053 self,
1054 encoder: &mut fidl::encoding::Encoder<'_, D>,
1055 offset: usize,
1056 _depth: fidl::encoding::Depth,
1057 ) -> fidl::Result<()> {
1058 encoder.debug_check_bounds::<DeviceSetDvfsOperatingPointResponse>(offset);
1059 unsafe {
1060 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
1062 (buf_ptr as *mut DeviceSetDvfsOperatingPointResponse)
1063 .write_unaligned((self as *const DeviceSetDvfsOperatingPointResponse).read());
1064 }
1067 Ok(())
1068 }
1069 }
1070 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<i32, D>>
1071 fidl::encoding::Encode<DeviceSetDvfsOperatingPointResponse, D> for (T0,)
1072 {
1073 #[inline]
1074 unsafe fn encode(
1075 self,
1076 encoder: &mut fidl::encoding::Encoder<'_, D>,
1077 offset: usize,
1078 depth: fidl::encoding::Depth,
1079 ) -> fidl::Result<()> {
1080 encoder.debug_check_bounds::<DeviceSetDvfsOperatingPointResponse>(offset);
1081 self.0.encode(encoder, offset + 0, depth)?;
1085 Ok(())
1086 }
1087 }
1088
1089 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1090 for DeviceSetDvfsOperatingPointResponse
1091 {
1092 #[inline(always)]
1093 fn new_empty() -> Self {
1094 Self { status: fidl::new_empty!(i32, D) }
1095 }
1096
1097 #[inline]
1098 unsafe fn decode(
1099 &mut self,
1100 decoder: &mut fidl::encoding::Decoder<'_, D>,
1101 offset: usize,
1102 _depth: fidl::encoding::Depth,
1103 ) -> fidl::Result<()> {
1104 decoder.debug_check_bounds::<Self>(offset);
1105 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
1106 unsafe {
1109 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
1110 }
1111 Ok(())
1112 }
1113 }
1114
1115 impl fidl::encoding::ValueTypeMarker for DeviceSetTripCelsiusRequest {
1116 type Borrowed<'a> = &'a Self;
1117 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1118 value
1119 }
1120 }
1121
1122 unsafe impl fidl::encoding::TypeMarker for DeviceSetTripCelsiusRequest {
1123 type Owned = Self;
1124
1125 #[inline(always)]
1126 fn inline_align(_context: fidl::encoding::Context) -> usize {
1127 4
1128 }
1129
1130 #[inline(always)]
1131 fn inline_size(_context: fidl::encoding::Context) -> usize {
1132 8
1133 }
1134 }
1135
1136 unsafe impl<D: fidl::encoding::ResourceDialect>
1137 fidl::encoding::Encode<DeviceSetTripCelsiusRequest, D> for &DeviceSetTripCelsiusRequest
1138 {
1139 #[inline]
1140 unsafe fn encode(
1141 self,
1142 encoder: &mut fidl::encoding::Encoder<'_, D>,
1143 offset: usize,
1144 _depth: fidl::encoding::Depth,
1145 ) -> fidl::Result<()> {
1146 encoder.debug_check_bounds::<DeviceSetTripCelsiusRequest>(offset);
1147 fidl::encoding::Encode::<DeviceSetTripCelsiusRequest, D>::encode(
1149 (
1150 <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.id),
1151 <f32 as fidl::encoding::ValueTypeMarker>::borrow(&self.temp),
1152 ),
1153 encoder,
1154 offset,
1155 _depth,
1156 )
1157 }
1158 }
1159 unsafe impl<
1160 D: fidl::encoding::ResourceDialect,
1161 T0: fidl::encoding::Encode<u32, D>,
1162 T1: fidl::encoding::Encode<f32, D>,
1163 > fidl::encoding::Encode<DeviceSetTripCelsiusRequest, D> for (T0, T1)
1164 {
1165 #[inline]
1166 unsafe fn encode(
1167 self,
1168 encoder: &mut fidl::encoding::Encoder<'_, D>,
1169 offset: usize,
1170 depth: fidl::encoding::Depth,
1171 ) -> fidl::Result<()> {
1172 encoder.debug_check_bounds::<DeviceSetTripCelsiusRequest>(offset);
1173 self.0.encode(encoder, offset + 0, depth)?;
1177 self.1.encode(encoder, offset + 4, depth)?;
1178 Ok(())
1179 }
1180 }
1181
1182 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1183 for DeviceSetTripCelsiusRequest
1184 {
1185 #[inline(always)]
1186 fn new_empty() -> Self {
1187 Self { id: fidl::new_empty!(u32, D), temp: fidl::new_empty!(f32, D) }
1188 }
1189
1190 #[inline]
1191 unsafe fn decode(
1192 &mut self,
1193 decoder: &mut fidl::encoding::Decoder<'_, D>,
1194 offset: usize,
1195 _depth: fidl::encoding::Depth,
1196 ) -> fidl::Result<()> {
1197 decoder.debug_check_bounds::<Self>(offset);
1198 fidl::decode!(u32, D, &mut self.id, decoder, offset + 0, _depth)?;
1200 fidl::decode!(f32, D, &mut self.temp, decoder, offset + 4, _depth)?;
1201 Ok(())
1202 }
1203 }
1204
1205 impl fidl::encoding::ValueTypeMarker for DeviceSetTripCelsiusResponse {
1206 type Borrowed<'a> = &'a Self;
1207 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1208 value
1209 }
1210 }
1211
1212 unsafe impl fidl::encoding::TypeMarker for DeviceSetTripCelsiusResponse {
1213 type Owned = Self;
1214
1215 #[inline(always)]
1216 fn inline_align(_context: fidl::encoding::Context) -> usize {
1217 4
1218 }
1219
1220 #[inline(always)]
1221 fn inline_size(_context: fidl::encoding::Context) -> usize {
1222 4
1223 }
1224 #[inline(always)]
1225 fn encode_is_copy() -> bool {
1226 true
1227 }
1228
1229 #[inline(always)]
1230 fn decode_is_copy() -> bool {
1231 true
1232 }
1233 }
1234
1235 unsafe impl<D: fidl::encoding::ResourceDialect>
1236 fidl::encoding::Encode<DeviceSetTripCelsiusResponse, D> for &DeviceSetTripCelsiusResponse
1237 {
1238 #[inline]
1239 unsafe fn encode(
1240 self,
1241 encoder: &mut fidl::encoding::Encoder<'_, D>,
1242 offset: usize,
1243 _depth: fidl::encoding::Depth,
1244 ) -> fidl::Result<()> {
1245 encoder.debug_check_bounds::<DeviceSetTripCelsiusResponse>(offset);
1246 unsafe {
1247 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
1249 (buf_ptr as *mut DeviceSetTripCelsiusResponse)
1250 .write_unaligned((self as *const DeviceSetTripCelsiusResponse).read());
1251 }
1254 Ok(())
1255 }
1256 }
1257 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<i32, D>>
1258 fidl::encoding::Encode<DeviceSetTripCelsiusResponse, D> for (T0,)
1259 {
1260 #[inline]
1261 unsafe fn encode(
1262 self,
1263 encoder: &mut fidl::encoding::Encoder<'_, D>,
1264 offset: usize,
1265 depth: fidl::encoding::Depth,
1266 ) -> fidl::Result<()> {
1267 encoder.debug_check_bounds::<DeviceSetTripCelsiusResponse>(offset);
1268 self.0.encode(encoder, offset + 0, depth)?;
1272 Ok(())
1273 }
1274 }
1275
1276 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1277 for DeviceSetTripCelsiusResponse
1278 {
1279 #[inline(always)]
1280 fn new_empty() -> Self {
1281 Self { status: fidl::new_empty!(i32, D) }
1282 }
1283
1284 #[inline]
1285 unsafe fn decode(
1286 &mut self,
1287 decoder: &mut fidl::encoding::Decoder<'_, D>,
1288 offset: usize,
1289 _depth: fidl::encoding::Depth,
1290 ) -> fidl::Result<()> {
1291 decoder.debug_check_bounds::<Self>(offset);
1292 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
1293 unsafe {
1296 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
1297 }
1298 Ok(())
1299 }
1300 }
1301
1302 impl fidl::encoding::ValueTypeMarker for OperatingPoint {
1303 type Borrowed<'a> = &'a Self;
1304 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1305 value
1306 }
1307 }
1308
1309 unsafe impl fidl::encoding::TypeMarker for OperatingPoint {
1310 type Owned = Self;
1311
1312 #[inline(always)]
1313 fn inline_align(_context: fidl::encoding::Context) -> usize {
1314 4
1315 }
1316
1317 #[inline(always)]
1318 fn inline_size(_context: fidl::encoding::Context) -> usize {
1319 136
1320 }
1321 #[inline(always)]
1322 fn encode_is_copy() -> bool {
1323 true
1324 }
1325
1326 #[inline(always)]
1327 fn decode_is_copy() -> bool {
1328 true
1329 }
1330 }
1331
1332 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<OperatingPoint, D>
1333 for &OperatingPoint
1334 {
1335 #[inline]
1336 unsafe fn encode(
1337 self,
1338 encoder: &mut fidl::encoding::Encoder<'_, D>,
1339 offset: usize,
1340 _depth: fidl::encoding::Depth,
1341 ) -> fidl::Result<()> {
1342 encoder.debug_check_bounds::<OperatingPoint>(offset);
1343 unsafe {
1344 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
1346 (buf_ptr as *mut OperatingPoint)
1347 .write_unaligned((self as *const OperatingPoint).read());
1348 }
1351 Ok(())
1352 }
1353 }
1354 unsafe impl<
1355 D: fidl::encoding::ResourceDialect,
1356 T0: fidl::encoding::Encode<fidl::encoding::Array<OperatingPointEntry, 16>, D>,
1357 T1: fidl::encoding::Encode<u32, D>,
1358 T2: fidl::encoding::Encode<u32, D>,
1359 > fidl::encoding::Encode<OperatingPoint, D> for (T0, T1, T2)
1360 {
1361 #[inline]
1362 unsafe fn encode(
1363 self,
1364 encoder: &mut fidl::encoding::Encoder<'_, D>,
1365 offset: usize,
1366 depth: fidl::encoding::Depth,
1367 ) -> fidl::Result<()> {
1368 encoder.debug_check_bounds::<OperatingPoint>(offset);
1369 self.0.encode(encoder, offset + 0, depth)?;
1373 self.1.encode(encoder, offset + 128, depth)?;
1374 self.2.encode(encoder, offset + 132, depth)?;
1375 Ok(())
1376 }
1377 }
1378
1379 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for OperatingPoint {
1380 #[inline(always)]
1381 fn new_empty() -> Self {
1382 Self {
1383 opp: fidl::new_empty!(fidl::encoding::Array<OperatingPointEntry, 16>, D),
1384 latency: fidl::new_empty!(u32, D),
1385 count: fidl::new_empty!(u32, D),
1386 }
1387 }
1388
1389 #[inline]
1390 unsafe fn decode(
1391 &mut self,
1392 decoder: &mut fidl::encoding::Decoder<'_, D>,
1393 offset: usize,
1394 _depth: fidl::encoding::Depth,
1395 ) -> fidl::Result<()> {
1396 decoder.debug_check_bounds::<Self>(offset);
1397 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
1398 unsafe {
1401 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 136);
1402 }
1403 Ok(())
1404 }
1405 }
1406
1407 impl fidl::encoding::ValueTypeMarker for OperatingPointEntry {
1408 type Borrowed<'a> = &'a Self;
1409 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1410 value
1411 }
1412 }
1413
1414 unsafe impl fidl::encoding::TypeMarker for OperatingPointEntry {
1415 type Owned = Self;
1416
1417 #[inline(always)]
1418 fn inline_align(_context: fidl::encoding::Context) -> usize {
1419 4
1420 }
1421
1422 #[inline(always)]
1423 fn inline_size(_context: fidl::encoding::Context) -> usize {
1424 8
1425 }
1426 #[inline(always)]
1427 fn encode_is_copy() -> bool {
1428 true
1429 }
1430
1431 #[inline(always)]
1432 fn decode_is_copy() -> bool {
1433 true
1434 }
1435 }
1436
1437 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<OperatingPointEntry, D>
1438 for &OperatingPointEntry
1439 {
1440 #[inline]
1441 unsafe fn encode(
1442 self,
1443 encoder: &mut fidl::encoding::Encoder<'_, D>,
1444 offset: usize,
1445 _depth: fidl::encoding::Depth,
1446 ) -> fidl::Result<()> {
1447 encoder.debug_check_bounds::<OperatingPointEntry>(offset);
1448 unsafe {
1449 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
1451 (buf_ptr as *mut OperatingPointEntry)
1452 .write_unaligned((self as *const OperatingPointEntry).read());
1453 }
1456 Ok(())
1457 }
1458 }
1459 unsafe impl<
1460 D: fidl::encoding::ResourceDialect,
1461 T0: fidl::encoding::Encode<u32, D>,
1462 T1: fidl::encoding::Encode<u32, D>,
1463 > fidl::encoding::Encode<OperatingPointEntry, D> for (T0, T1)
1464 {
1465 #[inline]
1466 unsafe fn encode(
1467 self,
1468 encoder: &mut fidl::encoding::Encoder<'_, D>,
1469 offset: usize,
1470 depth: fidl::encoding::Depth,
1471 ) -> fidl::Result<()> {
1472 encoder.debug_check_bounds::<OperatingPointEntry>(offset);
1473 self.0.encode(encoder, offset + 0, depth)?;
1477 self.1.encode(encoder, offset + 4, depth)?;
1478 Ok(())
1479 }
1480 }
1481
1482 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for OperatingPointEntry {
1483 #[inline(always)]
1484 fn new_empty() -> Self {
1485 Self { freq_hz: fidl::new_empty!(u32, D), volt_uv: fidl::new_empty!(u32, D) }
1486 }
1487
1488 #[inline]
1489 unsafe fn decode(
1490 &mut self,
1491 decoder: &mut fidl::encoding::Decoder<'_, D>,
1492 offset: usize,
1493 _depth: fidl::encoding::Depth,
1494 ) -> fidl::Result<()> {
1495 decoder.debug_check_bounds::<Self>(offset);
1496 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
1497 unsafe {
1500 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
1501 }
1502 Ok(())
1503 }
1504 }
1505
1506 impl fidl::encoding::ValueTypeMarker for ThermalDeviceInfo {
1507 type Borrowed<'a> = &'a Self;
1508 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1509 value
1510 }
1511 }
1512
1513 unsafe impl fidl::encoding::TypeMarker for ThermalDeviceInfo {
1514 type Owned = Self;
1515
1516 #[inline(always)]
1517 fn inline_align(_context: fidl::encoding::Context) -> usize {
1518 4
1519 }
1520
1521 #[inline(always)]
1522 fn inline_size(_context: fidl::encoding::Context) -> usize {
1523 608
1524 }
1525 }
1526
1527 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<ThermalDeviceInfo, D>
1528 for &ThermalDeviceInfo
1529 {
1530 #[inline]
1531 unsafe fn encode(
1532 self,
1533 encoder: &mut fidl::encoding::Encoder<'_, D>,
1534 offset: usize,
1535 _depth: fidl::encoding::Depth,
1536 ) -> fidl::Result<()> {
1537 encoder.debug_check_bounds::<ThermalDeviceInfo>(offset);
1538 fidl::encoding::Encode::<ThermalDeviceInfo, D>::encode(
1540 (
1541 <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.active_cooling),
1542 <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.passive_cooling),
1543 <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.gpu_throttling),
1544 <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.num_trip_points),
1545 <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.big_little),
1546 <f32 as fidl::encoding::ValueTypeMarker>::borrow(&self.critical_temp_celsius),
1547 <fidl::encoding::Array<ThermalTemperatureInfo, 16> as fidl::encoding::ValueTypeMarker>::borrow(&self.trip_point_info),
1548 <fidl::encoding::Array<OperatingPoint, 2> as fidl::encoding::ValueTypeMarker>::borrow(&self.opps),
1549 ),
1550 encoder, offset, _depth
1551 )
1552 }
1553 }
1554 unsafe impl<
1555 D: fidl::encoding::ResourceDialect,
1556 T0: fidl::encoding::Encode<bool, D>,
1557 T1: fidl::encoding::Encode<bool, D>,
1558 T2: fidl::encoding::Encode<bool, D>,
1559 T3: fidl::encoding::Encode<u32, D>,
1560 T4: fidl::encoding::Encode<bool, D>,
1561 T5: fidl::encoding::Encode<f32, D>,
1562 T6: fidl::encoding::Encode<fidl::encoding::Array<ThermalTemperatureInfo, 16>, D>,
1563 T7: fidl::encoding::Encode<fidl::encoding::Array<OperatingPoint, 2>, D>,
1564 > fidl::encoding::Encode<ThermalDeviceInfo, D> for (T0, T1, T2, T3, T4, T5, T6, T7)
1565 {
1566 #[inline]
1567 unsafe fn encode(
1568 self,
1569 encoder: &mut fidl::encoding::Encoder<'_, D>,
1570 offset: usize,
1571 depth: fidl::encoding::Depth,
1572 ) -> fidl::Result<()> {
1573 encoder.debug_check_bounds::<ThermalDeviceInfo>(offset);
1574 unsafe {
1577 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
1578 (ptr as *mut u32).write_unaligned(0);
1579 }
1580 unsafe {
1581 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
1582 (ptr as *mut u32).write_unaligned(0);
1583 }
1584 self.0.encode(encoder, offset + 0, depth)?;
1586 self.1.encode(encoder, offset + 1, depth)?;
1587 self.2.encode(encoder, offset + 2, depth)?;
1588 self.3.encode(encoder, offset + 4, depth)?;
1589 self.4.encode(encoder, offset + 8, depth)?;
1590 self.5.encode(encoder, offset + 12, depth)?;
1591 self.6.encode(encoder, offset + 16, depth)?;
1592 self.7.encode(encoder, offset + 336, depth)?;
1593 Ok(())
1594 }
1595 }
1596
1597 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ThermalDeviceInfo {
1598 #[inline(always)]
1599 fn new_empty() -> Self {
1600 Self {
1601 active_cooling: fidl::new_empty!(bool, D),
1602 passive_cooling: fidl::new_empty!(bool, D),
1603 gpu_throttling: fidl::new_empty!(bool, D),
1604 num_trip_points: fidl::new_empty!(u32, D),
1605 big_little: fidl::new_empty!(bool, D),
1606 critical_temp_celsius: fidl::new_empty!(f32, D),
1607 trip_point_info: fidl::new_empty!(fidl::encoding::Array<ThermalTemperatureInfo, 16>, D),
1608 opps: fidl::new_empty!(fidl::encoding::Array<OperatingPoint, 2>, D),
1609 }
1610 }
1611
1612 #[inline]
1613 unsafe fn decode(
1614 &mut self,
1615 decoder: &mut fidl::encoding::Decoder<'_, D>,
1616 offset: usize,
1617 _depth: fidl::encoding::Depth,
1618 ) -> fidl::Result<()> {
1619 decoder.debug_check_bounds::<Self>(offset);
1620 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
1622 let padval = unsafe { (ptr as *const u32).read_unaligned() };
1623 let mask = 0xff000000u32;
1624 let maskedval = padval & mask;
1625 if maskedval != 0 {
1626 return Err(fidl::Error::NonZeroPadding {
1627 padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
1628 });
1629 }
1630 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(8) };
1631 let padval = unsafe { (ptr as *const u32).read_unaligned() };
1632 let mask = 0xffffff00u32;
1633 let maskedval = padval & mask;
1634 if maskedval != 0 {
1635 return Err(fidl::Error::NonZeroPadding {
1636 padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
1637 });
1638 }
1639 fidl::decode!(bool, D, &mut self.active_cooling, decoder, offset + 0, _depth)?;
1640 fidl::decode!(bool, D, &mut self.passive_cooling, decoder, offset + 1, _depth)?;
1641 fidl::decode!(bool, D, &mut self.gpu_throttling, decoder, offset + 2, _depth)?;
1642 fidl::decode!(u32, D, &mut self.num_trip_points, decoder, offset + 4, _depth)?;
1643 fidl::decode!(bool, D, &mut self.big_little, decoder, offset + 8, _depth)?;
1644 fidl::decode!(f32, D, &mut self.critical_temp_celsius, decoder, offset + 12, _depth)?;
1645 fidl::decode!(fidl::encoding::Array<ThermalTemperatureInfo, 16>, D, &mut self.trip_point_info, decoder, offset + 16, _depth)?;
1646 fidl::decode!(fidl::encoding::Array<OperatingPoint, 2>, D, &mut self.opps, decoder, offset + 336, _depth)?;
1647 Ok(())
1648 }
1649 }
1650
1651 impl fidl::encoding::ValueTypeMarker for ThermalInfo {
1652 type Borrowed<'a> = &'a Self;
1653 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1654 value
1655 }
1656 }
1657
1658 unsafe impl fidl::encoding::TypeMarker for ThermalInfo {
1659 type Owned = Self;
1660
1661 #[inline(always)]
1662 fn inline_align(_context: fidl::encoding::Context) -> usize {
1663 4
1664 }
1665
1666 #[inline(always)]
1667 fn inline_size(_context: fidl::encoding::Context) -> usize {
1668 80
1669 }
1670 }
1671
1672 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<ThermalInfo, D>
1673 for &ThermalInfo
1674 {
1675 #[inline]
1676 unsafe fn encode(
1677 self,
1678 encoder: &mut fidl::encoding::Encoder<'_, D>,
1679 offset: usize,
1680 _depth: fidl::encoding::Depth,
1681 ) -> fidl::Result<()> {
1682 encoder.debug_check_bounds::<ThermalInfo>(offset);
1683 fidl::encoding::Encode::<ThermalInfo, D>::encode(
1685 (
1686 <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.state),
1687 <f32 as fidl::encoding::ValueTypeMarker>::borrow(&self.passive_temp_celsius),
1688 <f32 as fidl::encoding::ValueTypeMarker>::borrow(&self.critical_temp_celsius),
1689 <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.max_trip_count),
1690 <fidl::encoding::Array<f32, 16> as fidl::encoding::ValueTypeMarker>::borrow(
1691 &self.active_trip,
1692 ),
1693 ),
1694 encoder,
1695 offset,
1696 _depth,
1697 )
1698 }
1699 }
1700 unsafe impl<
1701 D: fidl::encoding::ResourceDialect,
1702 T0: fidl::encoding::Encode<u32, D>,
1703 T1: fidl::encoding::Encode<f32, D>,
1704 T2: fidl::encoding::Encode<f32, D>,
1705 T3: fidl::encoding::Encode<u32, D>,
1706 T4: fidl::encoding::Encode<fidl::encoding::Array<f32, 16>, D>,
1707 > fidl::encoding::Encode<ThermalInfo, D> for (T0, T1, T2, T3, T4)
1708 {
1709 #[inline]
1710 unsafe fn encode(
1711 self,
1712 encoder: &mut fidl::encoding::Encoder<'_, D>,
1713 offset: usize,
1714 depth: fidl::encoding::Depth,
1715 ) -> fidl::Result<()> {
1716 encoder.debug_check_bounds::<ThermalInfo>(offset);
1717 self.0.encode(encoder, offset + 0, depth)?;
1721 self.1.encode(encoder, offset + 4, depth)?;
1722 self.2.encode(encoder, offset + 8, depth)?;
1723 self.3.encode(encoder, offset + 12, depth)?;
1724 self.4.encode(encoder, offset + 16, depth)?;
1725 Ok(())
1726 }
1727 }
1728
1729 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ThermalInfo {
1730 #[inline(always)]
1731 fn new_empty() -> Self {
1732 Self {
1733 state: fidl::new_empty!(u32, D),
1734 passive_temp_celsius: fidl::new_empty!(f32, D),
1735 critical_temp_celsius: fidl::new_empty!(f32, D),
1736 max_trip_count: fidl::new_empty!(u32, D),
1737 active_trip: fidl::new_empty!(fidl::encoding::Array<f32, 16>, D),
1738 }
1739 }
1740
1741 #[inline]
1742 unsafe fn decode(
1743 &mut self,
1744 decoder: &mut fidl::encoding::Decoder<'_, D>,
1745 offset: usize,
1746 _depth: fidl::encoding::Depth,
1747 ) -> fidl::Result<()> {
1748 decoder.debug_check_bounds::<Self>(offset);
1749 fidl::decode!(u32, D, &mut self.state, decoder, offset + 0, _depth)?;
1751 fidl::decode!(f32, D, &mut self.passive_temp_celsius, decoder, offset + 4, _depth)?;
1752 fidl::decode!(f32, D, &mut self.critical_temp_celsius, decoder, offset + 8, _depth)?;
1753 fidl::decode!(u32, D, &mut self.max_trip_count, decoder, offset + 12, _depth)?;
1754 fidl::decode!(fidl::encoding::Array<f32, 16>, D, &mut self.active_trip, decoder, offset + 16, _depth)?;
1755 Ok(())
1756 }
1757 }
1758
1759 impl fidl::encoding::ValueTypeMarker for ThermalTemperatureInfo {
1760 type Borrowed<'a> = &'a Self;
1761 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1762 value
1763 }
1764 }
1765
1766 unsafe impl fidl::encoding::TypeMarker for ThermalTemperatureInfo {
1767 type Owned = Self;
1768
1769 #[inline(always)]
1770 fn inline_align(_context: fidl::encoding::Context) -> usize {
1771 4
1772 }
1773
1774 #[inline(always)]
1775 fn inline_size(_context: fidl::encoding::Context) -> usize {
1776 20
1777 }
1778 }
1779
1780 unsafe impl<D: fidl::encoding::ResourceDialect>
1781 fidl::encoding::Encode<ThermalTemperatureInfo, D> for &ThermalTemperatureInfo
1782 {
1783 #[inline]
1784 unsafe fn encode(
1785 self,
1786 encoder: &mut fidl::encoding::Encoder<'_, D>,
1787 offset: usize,
1788 _depth: fidl::encoding::Depth,
1789 ) -> fidl::Result<()> {
1790 encoder.debug_check_bounds::<ThermalTemperatureInfo>(offset);
1791 fidl::encoding::Encode::<ThermalTemperatureInfo, D>::encode(
1793 (
1794 <f32 as fidl::encoding::ValueTypeMarker>::borrow(&self.up_temp_celsius),
1795 <f32 as fidl::encoding::ValueTypeMarker>::borrow(&self.down_temp_celsius),
1796 <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.fan_level),
1797 <u16 as fidl::encoding::ValueTypeMarker>::borrow(&self.big_cluster_dvfs_opp),
1798 <u16 as fidl::encoding::ValueTypeMarker>::borrow(&self.little_cluster_dvfs_opp),
1799 <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.gpu_clk_freq_source),
1800 ),
1801 encoder,
1802 offset,
1803 _depth,
1804 )
1805 }
1806 }
1807 unsafe impl<
1808 D: fidl::encoding::ResourceDialect,
1809 T0: fidl::encoding::Encode<f32, D>,
1810 T1: fidl::encoding::Encode<f32, D>,
1811 T2: fidl::encoding::Encode<u32, D>,
1812 T3: fidl::encoding::Encode<u16, D>,
1813 T4: fidl::encoding::Encode<u16, D>,
1814 T5: fidl::encoding::Encode<u32, D>,
1815 > fidl::encoding::Encode<ThermalTemperatureInfo, D> for (T0, T1, T2, T3, T4, T5)
1816 {
1817 #[inline]
1818 unsafe fn encode(
1819 self,
1820 encoder: &mut fidl::encoding::Encoder<'_, D>,
1821 offset: usize,
1822 depth: fidl::encoding::Depth,
1823 ) -> fidl::Result<()> {
1824 encoder.debug_check_bounds::<ThermalTemperatureInfo>(offset);
1825 self.0.encode(encoder, offset + 0, depth)?;
1829 self.1.encode(encoder, offset + 4, depth)?;
1830 self.2.encode(encoder, offset + 8, depth)?;
1831 self.3.encode(encoder, offset + 12, depth)?;
1832 self.4.encode(encoder, offset + 14, depth)?;
1833 self.5.encode(encoder, offset + 16, depth)?;
1834 Ok(())
1835 }
1836 }
1837
1838 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1839 for ThermalTemperatureInfo
1840 {
1841 #[inline(always)]
1842 fn new_empty() -> Self {
1843 Self {
1844 up_temp_celsius: fidl::new_empty!(f32, D),
1845 down_temp_celsius: fidl::new_empty!(f32, D),
1846 fan_level: fidl::new_empty!(u32, D),
1847 big_cluster_dvfs_opp: fidl::new_empty!(u16, D),
1848 little_cluster_dvfs_opp: fidl::new_empty!(u16, D),
1849 gpu_clk_freq_source: fidl::new_empty!(u32, D),
1850 }
1851 }
1852
1853 #[inline]
1854 unsafe fn decode(
1855 &mut self,
1856 decoder: &mut fidl::encoding::Decoder<'_, D>,
1857 offset: usize,
1858 _depth: fidl::encoding::Depth,
1859 ) -> fidl::Result<()> {
1860 decoder.debug_check_bounds::<Self>(offset);
1861 fidl::decode!(f32, D, &mut self.up_temp_celsius, decoder, offset + 0, _depth)?;
1863 fidl::decode!(f32, D, &mut self.down_temp_celsius, decoder, offset + 4, _depth)?;
1864 fidl::decode!(u32, D, &mut self.fan_level, decoder, offset + 8, _depth)?;
1865 fidl::decode!(u16, D, &mut self.big_cluster_dvfs_opp, decoder, offset + 12, _depth)?;
1866 fidl::decode!(u16, D, &mut self.little_cluster_dvfs_opp, decoder, offset + 14, _depth)?;
1867 fidl::decode!(u32, D, &mut self.gpu_clk_freq_source, decoder, offset + 16, _depth)?;
1868 Ok(())
1869 }
1870 }
1871}