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 type ConfigOffset = u8;
13
14pub type ExtendedConfigOffset = u16;
16
17pub const BASE_ADDRESS_COUNT: u32 = 6;
18
19pub const BASE_CONFIG_SIZE: u32 = 256;
20
21pub const EXTENDED_CONFIG_SIZE: u32 = 4096;
22
23pub const MAX_BAR_COUNT: u8 = 6;
24
25pub const MAX_CAPABILITIES: u32 = 32;
26
27pub const MAX_DEVICES: u32 = 64;
28
29pub const MAX_EXT_CAPABILITIES: u32 = 32;
30
31pub const MAX_NAME_LEN: u32 = 32;
32
33pub const READBAR_MAX_SIZE: u32 = 1024;
34
35pub const STATUS_DEVSEL_MASK: Status = Status::from_bits_truncate(1536);
36
37bitflags! {
38 #[derive(Clone, Copy, Debug, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
39 pub struct Command: u16 {
40 const IO_EN = 1;
41 const MEM_EN = 2;
42 const BUS_MASTER_EN = 4;
43 const SPECIAL_EN = 8;
44 const MEM_WR_INV_EN = 16;
45 const PAL_SNOOP_EN = 32;
46 const PERR_RESP_EN = 64;
47 const AD_STEP_EN = 128;
48 const SERR_EN = 256;
49 const FAST_B2_B_EN = 512;
50 }
51}
52
53impl Command {
54 #[inline(always)]
55 pub fn from_bits_allow_unknown(bits: u16) -> Self {
56 Self::from_bits_retain(bits)
57 }
58
59 #[inline(always)]
60 pub fn has_unknown_bits(&self) -> bool {
61 self.get_unknown_bits() != 0
62 }
63
64 #[inline(always)]
65 pub fn get_unknown_bits(&self) -> u16 {
66 self.bits() & !Self::all().bits()
67 }
68}
69
70bitflags! {
71 #[derive(Clone, Copy, Debug, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
72 pub struct Status: u16 {
73 const INTERRUPT = 8;
74 const NEW_CAPS = 16;
75 const SIXTYSIX_MHZ = 32;
76 const FAST_B2_B = 128;
77 const MSTR_PERR = 256;
78 const DEVSEL_LOW = 512;
79 const DEVSEL_HIGH = 1024;
80 const TARG_ABORT_SIG = 2048;
81 const TARG_ABORT_RCV = 4096;
82 const MSTR_ABORT_RCV = 8192;
83 const SERR_SIG = 16384;
84 const PERR = 32768;
85 }
86}
87
88impl Status {
89 #[inline(always)]
90 pub fn from_bits_allow_unknown(bits: u16) -> Self {
91 Self::from_bits_retain(bits)
92 }
93
94 #[inline(always)]
95 pub fn has_unknown_bits(&self) -> bool {
96 self.get_unknown_bits() != 0
97 }
98
99 #[inline(always)]
100 pub fn get_unknown_bits(&self) -> u16 {
101 self.bits() & !Self::all().bits()
102 }
103}
104
105#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
108pub enum CapabilityId {
109 Null,
110 PciPwrMgmt,
111 Agp,
112 VitalProductData,
113 SlotIdentification,
114 Msi,
115 CompactPciHotswap,
116 Pcix,
117 Hypertransport,
118 Vendor,
119 DebugPort,
120 CompactPciCrc,
121 PciHotPlug,
122 PciBridgeSubsystemVid,
123 Agp8X,
124 SecureDevice,
125 PciExpress,
126 Msix,
127 SataDataNdxCfg,
128 AdvancedFeatures,
129 EnhancedAllocation,
130 FlatteningPortalBridge,
131 #[doc(hidden)]
132 __SourceBreaking {
133 unknown_ordinal: u8,
134 },
135}
136
137#[macro_export]
139macro_rules! CapabilityIdUnknown {
140 () => {
141 _
142 };
143}
144
145impl CapabilityId {
146 #[inline]
147 pub fn from_primitive(prim: u8) -> Option<Self> {
148 match prim {
149 0 => Some(Self::Null),
150 1 => Some(Self::PciPwrMgmt),
151 2 => Some(Self::Agp),
152 3 => Some(Self::VitalProductData),
153 4 => Some(Self::SlotIdentification),
154 5 => Some(Self::Msi),
155 6 => Some(Self::CompactPciHotswap),
156 7 => Some(Self::Pcix),
157 8 => Some(Self::Hypertransport),
158 9 => Some(Self::Vendor),
159 10 => Some(Self::DebugPort),
160 11 => Some(Self::CompactPciCrc),
161 12 => Some(Self::PciHotPlug),
162 13 => Some(Self::PciBridgeSubsystemVid),
163 14 => Some(Self::Agp8X),
164 15 => Some(Self::SecureDevice),
165 16 => Some(Self::PciExpress),
166 17 => Some(Self::Msix),
167 18 => Some(Self::SataDataNdxCfg),
168 19 => Some(Self::AdvancedFeatures),
169 20 => Some(Self::EnhancedAllocation),
170 21 => Some(Self::FlatteningPortalBridge),
171 _ => None,
172 }
173 }
174
175 #[inline]
176 pub fn from_primitive_allow_unknown(prim: u8) -> Self {
177 match prim {
178 0 => Self::Null,
179 1 => Self::PciPwrMgmt,
180 2 => Self::Agp,
181 3 => Self::VitalProductData,
182 4 => Self::SlotIdentification,
183 5 => Self::Msi,
184 6 => Self::CompactPciHotswap,
185 7 => Self::Pcix,
186 8 => Self::Hypertransport,
187 9 => Self::Vendor,
188 10 => Self::DebugPort,
189 11 => Self::CompactPciCrc,
190 12 => Self::PciHotPlug,
191 13 => Self::PciBridgeSubsystemVid,
192 14 => Self::Agp8X,
193 15 => Self::SecureDevice,
194 16 => Self::PciExpress,
195 17 => Self::Msix,
196 18 => Self::SataDataNdxCfg,
197 19 => Self::AdvancedFeatures,
198 20 => Self::EnhancedAllocation,
199 21 => Self::FlatteningPortalBridge,
200 unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
201 }
202 }
203
204 #[inline]
205 pub fn unknown() -> Self {
206 Self::__SourceBreaking { unknown_ordinal: 0xff }
207 }
208
209 #[inline]
210 pub const fn into_primitive(self) -> u8 {
211 match self {
212 Self::Null => 0,
213 Self::PciPwrMgmt => 1,
214 Self::Agp => 2,
215 Self::VitalProductData => 3,
216 Self::SlotIdentification => 4,
217 Self::Msi => 5,
218 Self::CompactPciHotswap => 6,
219 Self::Pcix => 7,
220 Self::Hypertransport => 8,
221 Self::Vendor => 9,
222 Self::DebugPort => 10,
223 Self::CompactPciCrc => 11,
224 Self::PciHotPlug => 12,
225 Self::PciBridgeSubsystemVid => 13,
226 Self::Agp8X => 14,
227 Self::SecureDevice => 15,
228 Self::PciExpress => 16,
229 Self::Msix => 17,
230 Self::SataDataNdxCfg => 18,
231 Self::AdvancedFeatures => 19,
232 Self::EnhancedAllocation => 20,
233 Self::FlatteningPortalBridge => 21,
234 Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
235 }
236 }
237
238 #[inline]
239 pub fn is_unknown(&self) -> bool {
240 match self {
241 Self::__SourceBreaking { unknown_ordinal: _ } => true,
242 _ => false,
243 }
244 }
245}
246
247#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
250pub enum Config {
251 VendorId,
252 DeviceId,
253 Command,
254 Status,
255 RevisionId,
256 ClassCodeIntr,
257 ClassCodeSub,
258 ClassCodeBase,
259 CacheLineSize,
260 LatencyTimer,
261 HeaderType,
262 Bist,
263 BaseAddresses,
264 CardbusCisPtr,
265 SubsystemVendorId,
266 SubsystemId,
267 ExpRomAddress,
268 CapabilitiesPtr,
269 InterruptLine,
270 InterruptPin,
271 MinGrant,
272 MaxLatency,
273 #[doc(hidden)]
274 __SourceBreaking {
275 unknown_ordinal: u16,
276 },
277}
278
279#[macro_export]
281macro_rules! ConfigUnknown {
282 () => {
283 _
284 };
285}
286
287impl Config {
288 #[inline]
289 pub fn from_primitive(prim: u16) -> Option<Self> {
290 match prim {
291 0 => Some(Self::VendorId),
292 2 => Some(Self::DeviceId),
293 4 => Some(Self::Command),
294 6 => Some(Self::Status),
295 8 => Some(Self::RevisionId),
296 9 => Some(Self::ClassCodeIntr),
297 10 => Some(Self::ClassCodeSub),
298 11 => Some(Self::ClassCodeBase),
299 12 => Some(Self::CacheLineSize),
300 13 => Some(Self::LatencyTimer),
301 14 => Some(Self::HeaderType),
302 15 => Some(Self::Bist),
303 16 => Some(Self::BaseAddresses),
304 40 => Some(Self::CardbusCisPtr),
305 44 => Some(Self::SubsystemVendorId),
306 46 => Some(Self::SubsystemId),
307 48 => Some(Self::ExpRomAddress),
308 52 => Some(Self::CapabilitiesPtr),
309 60 => Some(Self::InterruptLine),
310 61 => Some(Self::InterruptPin),
311 62 => Some(Self::MinGrant),
312 63 => Some(Self::MaxLatency),
313 _ => None,
314 }
315 }
316
317 #[inline]
318 pub fn from_primitive_allow_unknown(prim: u16) -> Self {
319 match prim {
320 0 => Self::VendorId,
321 2 => Self::DeviceId,
322 4 => Self::Command,
323 6 => Self::Status,
324 8 => Self::RevisionId,
325 9 => Self::ClassCodeIntr,
326 10 => Self::ClassCodeSub,
327 11 => Self::ClassCodeBase,
328 12 => Self::CacheLineSize,
329 13 => Self::LatencyTimer,
330 14 => Self::HeaderType,
331 15 => Self::Bist,
332 16 => Self::BaseAddresses,
333 40 => Self::CardbusCisPtr,
334 44 => Self::SubsystemVendorId,
335 46 => Self::SubsystemId,
336 48 => Self::ExpRomAddress,
337 52 => Self::CapabilitiesPtr,
338 60 => Self::InterruptLine,
339 61 => Self::InterruptPin,
340 62 => Self::MinGrant,
341 63 => Self::MaxLatency,
342 unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
343 }
344 }
345
346 #[inline]
347 pub fn unknown() -> Self {
348 Self::__SourceBreaking { unknown_ordinal: 0xffff }
349 }
350
351 #[inline]
352 pub const fn into_primitive(self) -> u16 {
353 match self {
354 Self::VendorId => 0,
355 Self::DeviceId => 2,
356 Self::Command => 4,
357 Self::Status => 6,
358 Self::RevisionId => 8,
359 Self::ClassCodeIntr => 9,
360 Self::ClassCodeSub => 10,
361 Self::ClassCodeBase => 11,
362 Self::CacheLineSize => 12,
363 Self::LatencyTimer => 13,
364 Self::HeaderType => 14,
365 Self::Bist => 15,
366 Self::BaseAddresses => 16,
367 Self::CardbusCisPtr => 40,
368 Self::SubsystemVendorId => 44,
369 Self::SubsystemId => 46,
370 Self::ExpRomAddress => 48,
371 Self::CapabilitiesPtr => 52,
372 Self::InterruptLine => 60,
373 Self::InterruptPin => 61,
374 Self::MinGrant => 62,
375 Self::MaxLatency => 63,
376 Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
377 }
378 }
379
380 #[inline]
381 pub fn is_unknown(&self) -> bool {
382 match self {
383 Self::__SourceBreaking { unknown_ordinal: _ } => true,
384 _ => false,
385 }
386 }
387}
388
389#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
392pub enum ExtendedCapabilityId {
393 Null,
394 AdvancedErrorReporting,
395 VirtualChannelNoMfvc,
396 DeviceSerialNumber,
397 PowerBudgeting,
398 RootComplexLinkDeclaration,
399 RootComplexInternalLinkControl,
400 RootComplexEventCollectorEndpointAssociation,
401 MultiFunctionVirtualChannel,
402 VirtualChannel,
403 Rcrb,
404 Vendor,
405 Cac,
406 Acs,
407 Ari,
408 Ats,
409 SrIov,
410 MrIov,
411 Multicast,
412 Pri,
413 EnhancedAllocation,
414 ResizableBar,
415 DynamicPowerAllocation,
416 Tph,
417 LatencyToleranceReporting,
418 SecondaryPciExpress,
419 Pmux,
420 Pasid,
421 Lnr,
422 Dpc,
423 L1PmSubstates,
424 PrecisionTimeMeasurement,
425 Mpcie,
426 FrsQueueing,
427 ReadinessTimeReporting,
428 DesignatedVendor,
429 VfResizableBar,
430 DataLinkFeature,
431 PhysicalLayer16,
432 LaneMarginingAtReceiver,
433 HierarchyId,
434 NativePcieEnclosure,
435 PhysicalLayer32,
436 AlternateProtocol,
437 SystemFirmwareIntermediary,
438 #[doc(hidden)]
439 __SourceBreaking {
440 unknown_ordinal: u16,
441 },
442}
443
444#[macro_export]
446macro_rules! ExtendedCapabilityIdUnknown {
447 () => {
448 _
449 };
450}
451
452impl ExtendedCapabilityId {
453 #[inline]
454 pub fn from_primitive(prim: u16) -> Option<Self> {
455 match prim {
456 0 => Some(Self::Null),
457 1 => Some(Self::AdvancedErrorReporting),
458 2 => Some(Self::VirtualChannelNoMfvc),
459 3 => Some(Self::DeviceSerialNumber),
460 4 => Some(Self::PowerBudgeting),
461 5 => Some(Self::RootComplexLinkDeclaration),
462 6 => Some(Self::RootComplexInternalLinkControl),
463 7 => Some(Self::RootComplexEventCollectorEndpointAssociation),
464 8 => Some(Self::MultiFunctionVirtualChannel),
465 9 => Some(Self::VirtualChannel),
466 10 => Some(Self::Rcrb),
467 11 => Some(Self::Vendor),
468 12 => Some(Self::Cac),
469 13 => Some(Self::Acs),
470 14 => Some(Self::Ari),
471 15 => Some(Self::Ats),
472 16 => Some(Self::SrIov),
473 17 => Some(Self::MrIov),
474 18 => Some(Self::Multicast),
475 19 => Some(Self::Pri),
476 20 => Some(Self::EnhancedAllocation),
477 21 => Some(Self::ResizableBar),
478 22 => Some(Self::DynamicPowerAllocation),
479 23 => Some(Self::Tph),
480 24 => Some(Self::LatencyToleranceReporting),
481 25 => Some(Self::SecondaryPciExpress),
482 26 => Some(Self::Pmux),
483 27 => Some(Self::Pasid),
484 28 => Some(Self::Lnr),
485 29 => Some(Self::Dpc),
486 30 => Some(Self::L1PmSubstates),
487 31 => Some(Self::PrecisionTimeMeasurement),
488 32 => Some(Self::Mpcie),
489 33 => Some(Self::FrsQueueing),
490 34 => Some(Self::ReadinessTimeReporting),
491 35 => Some(Self::DesignatedVendor),
492 36 => Some(Self::VfResizableBar),
493 37 => Some(Self::DataLinkFeature),
494 38 => Some(Self::PhysicalLayer16),
495 39 => Some(Self::LaneMarginingAtReceiver),
496 40 => Some(Self::HierarchyId),
497 41 => Some(Self::NativePcieEnclosure),
498 42 => Some(Self::PhysicalLayer32),
499 43 => Some(Self::AlternateProtocol),
500 44 => Some(Self::SystemFirmwareIntermediary),
501 _ => None,
502 }
503 }
504
505 #[inline]
506 pub fn from_primitive_allow_unknown(prim: u16) -> Self {
507 match prim {
508 0 => Self::Null,
509 1 => Self::AdvancedErrorReporting,
510 2 => Self::VirtualChannelNoMfvc,
511 3 => Self::DeviceSerialNumber,
512 4 => Self::PowerBudgeting,
513 5 => Self::RootComplexLinkDeclaration,
514 6 => Self::RootComplexInternalLinkControl,
515 7 => Self::RootComplexEventCollectorEndpointAssociation,
516 8 => Self::MultiFunctionVirtualChannel,
517 9 => Self::VirtualChannel,
518 10 => Self::Rcrb,
519 11 => Self::Vendor,
520 12 => Self::Cac,
521 13 => Self::Acs,
522 14 => Self::Ari,
523 15 => Self::Ats,
524 16 => Self::SrIov,
525 17 => Self::MrIov,
526 18 => Self::Multicast,
527 19 => Self::Pri,
528 20 => Self::EnhancedAllocation,
529 21 => Self::ResizableBar,
530 22 => Self::DynamicPowerAllocation,
531 23 => Self::Tph,
532 24 => Self::LatencyToleranceReporting,
533 25 => Self::SecondaryPciExpress,
534 26 => Self::Pmux,
535 27 => Self::Pasid,
536 28 => Self::Lnr,
537 29 => Self::Dpc,
538 30 => Self::L1PmSubstates,
539 31 => Self::PrecisionTimeMeasurement,
540 32 => Self::Mpcie,
541 33 => Self::FrsQueueing,
542 34 => Self::ReadinessTimeReporting,
543 35 => Self::DesignatedVendor,
544 36 => Self::VfResizableBar,
545 37 => Self::DataLinkFeature,
546 38 => Self::PhysicalLayer16,
547 39 => Self::LaneMarginingAtReceiver,
548 40 => Self::HierarchyId,
549 41 => Self::NativePcieEnclosure,
550 42 => Self::PhysicalLayer32,
551 43 => Self::AlternateProtocol,
552 44 => Self::SystemFirmwareIntermediary,
553 unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
554 }
555 }
556
557 #[inline]
558 pub fn unknown() -> Self {
559 Self::__SourceBreaking { unknown_ordinal: 0xffff }
560 }
561
562 #[inline]
563 pub const fn into_primitive(self) -> u16 {
564 match self {
565 Self::Null => 0,
566 Self::AdvancedErrorReporting => 1,
567 Self::VirtualChannelNoMfvc => 2,
568 Self::DeviceSerialNumber => 3,
569 Self::PowerBudgeting => 4,
570 Self::RootComplexLinkDeclaration => 5,
571 Self::RootComplexInternalLinkControl => 6,
572 Self::RootComplexEventCollectorEndpointAssociation => 7,
573 Self::MultiFunctionVirtualChannel => 8,
574 Self::VirtualChannel => 9,
575 Self::Rcrb => 10,
576 Self::Vendor => 11,
577 Self::Cac => 12,
578 Self::Acs => 13,
579 Self::Ari => 14,
580 Self::Ats => 15,
581 Self::SrIov => 16,
582 Self::MrIov => 17,
583 Self::Multicast => 18,
584 Self::Pri => 19,
585 Self::EnhancedAllocation => 20,
586 Self::ResizableBar => 21,
587 Self::DynamicPowerAllocation => 22,
588 Self::Tph => 23,
589 Self::LatencyToleranceReporting => 24,
590 Self::SecondaryPciExpress => 25,
591 Self::Pmux => 26,
592 Self::Pasid => 27,
593 Self::Lnr => 28,
594 Self::Dpc => 29,
595 Self::L1PmSubstates => 30,
596 Self::PrecisionTimeMeasurement => 31,
597 Self::Mpcie => 32,
598 Self::FrsQueueing => 33,
599 Self::ReadinessTimeReporting => 34,
600 Self::DesignatedVendor => 35,
601 Self::VfResizableBar => 36,
602 Self::DataLinkFeature => 37,
603 Self::PhysicalLayer16 => 38,
604 Self::LaneMarginingAtReceiver => 39,
605 Self::HierarchyId => 40,
606 Self::NativePcieEnclosure => 41,
607 Self::PhysicalLayer32 => 42,
608 Self::AlternateProtocol => 43,
609 Self::SystemFirmwareIntermediary => 44,
610 Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
611 }
612 }
613
614 #[inline]
615 pub fn is_unknown(&self) -> bool {
616 match self {
617 Self::__SourceBreaking { unknown_ordinal: _ } => true,
618 _ => false,
619 }
620 }
621}
622
623#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
624pub enum HeaderType {
625 Standard,
626 Bridge,
627 CardBus,
628 Mask,
629 MultiFn,
630 #[doc(hidden)]
631 __SourceBreaking {
632 unknown_ordinal: u8,
633 },
634}
635
636#[macro_export]
638macro_rules! HeaderTypeUnknown {
639 () => {
640 _
641 };
642}
643
644impl HeaderType {
645 #[inline]
646 pub fn from_primitive(prim: u8) -> Option<Self> {
647 match prim {
648 0 => Some(Self::Standard),
649 1 => Some(Self::Bridge),
650 2 => Some(Self::CardBus),
651 127 => Some(Self::Mask),
652 128 => Some(Self::MultiFn),
653 _ => None,
654 }
655 }
656
657 #[inline]
658 pub fn from_primitive_allow_unknown(prim: u8) -> Self {
659 match prim {
660 0 => Self::Standard,
661 1 => Self::Bridge,
662 2 => Self::CardBus,
663 127 => Self::Mask,
664 128 => Self::MultiFn,
665 unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
666 }
667 }
668
669 #[inline]
670 pub fn unknown() -> Self {
671 Self::__SourceBreaking { unknown_ordinal: 0xff }
672 }
673
674 #[inline]
675 pub const fn into_primitive(self) -> u8 {
676 match self {
677 Self::Standard => 0,
678 Self::Bridge => 1,
679 Self::CardBus => 2,
680 Self::Mask => 127,
681 Self::MultiFn => 128,
682 Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
683 }
684 }
685
686 #[inline]
687 pub fn is_unknown(&self) -> bool {
688 match self {
689 Self::__SourceBreaking { unknown_ordinal: _ } => true,
690 _ => false,
691 }
692 }
693}
694
695#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
701pub enum InterruptMode {
702 Disabled,
703 Legacy,
705 LegacyNoack,
707 Msi,
709 MsiX,
711 #[doc(hidden)]
712 __SourceBreaking {
713 unknown_ordinal: u8,
714 },
715}
716
717#[macro_export]
719macro_rules! InterruptModeUnknown {
720 () => {
721 _
722 };
723}
724
725impl InterruptMode {
726 #[inline]
727 pub fn from_primitive(prim: u8) -> Option<Self> {
728 match prim {
729 0 => Some(Self::Disabled),
730 1 => Some(Self::Legacy),
731 2 => Some(Self::LegacyNoack),
732 3 => Some(Self::Msi),
733 4 => Some(Self::MsiX),
734 _ => None,
735 }
736 }
737
738 #[inline]
739 pub fn from_primitive_allow_unknown(prim: u8) -> Self {
740 match prim {
741 0 => Self::Disabled,
742 1 => Self::Legacy,
743 2 => Self::LegacyNoack,
744 3 => Self::Msi,
745 4 => Self::MsiX,
746 unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
747 }
748 }
749
750 #[inline]
751 pub fn unknown() -> Self {
752 Self::__SourceBreaking { unknown_ordinal: 0xff }
753 }
754
755 #[inline]
756 pub const fn into_primitive(self) -> u8 {
757 match self {
758 Self::Disabled => 0,
759 Self::Legacy => 1,
760 Self::LegacyNoack => 2,
761 Self::Msi => 3,
762 Self::MsiX => 4,
763 Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
764 }
765 }
766
767 #[inline]
768 pub fn is_unknown(&self) -> bool {
769 match self {
770 Self::__SourceBreaking { unknown_ordinal: _ } => true,
771 _ => false,
772 }
773 }
774}
775
776#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
778#[repr(C)]
779pub struct Address {
780 pub bus: u8,
781 pub device: u8,
782 pub function: u8,
783}
784
785impl fidl::Persistable for Address {}
786
787#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
788pub struct BaseAddress {
789 pub address: u64,
790 pub size: u64,
791 pub is_memory: bool,
792 pub is_prefetchable: bool,
793 pub is_64bit: bool,
794 pub id: u8,
795}
796
797impl fidl::Persistable for BaseAddress {}
798
799#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
800pub struct BusGetDevicesResponse {
801 pub devices: Vec<PciDevice>,
802}
803
804impl fidl::Persistable for BusGetDevicesResponse {}
805
806#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
807pub struct BusGetHostBridgeInfoResponse {
808 pub info: HostBridgeInfo,
809}
810
811impl fidl::Persistable for BusGetHostBridgeInfoResponse {}
812
813#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
814#[repr(C)]
815pub struct BusReadBarRequest {
816 pub device: Address,
817 pub bar_id: u8,
818 pub offset: u64,
819 pub size: u64,
820}
821
822impl fidl::Persistable for BusReadBarRequest {}
823
824#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
825pub struct BusReadBarResponse {
826 pub buffer: Vec<u8>,
827}
828
829impl fidl::Persistable for BusReadBarResponse {}
830
831#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
832#[repr(C)]
833pub struct Capability {
834 pub id: u8,
835 pub offset: u8,
836}
837
838impl fidl::Persistable for Capability {}
839
840#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
841#[repr(C)]
842pub struct DeviceGetBarRequest {
843 pub bar_id: u32,
844}
845
846impl fidl::Persistable for DeviceGetBarRequest {}
847
848#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
849#[repr(C)]
850pub struct DeviceGetBtiRequest {
851 pub index: u32,
852}
853
854impl fidl::Persistable for DeviceGetBtiRequest {}
855
856#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
857pub struct DeviceGetCapabilitiesRequest {
858 pub id: CapabilityId,
859}
860
861impl fidl::Persistable for DeviceGetCapabilitiesRequest {}
862
863#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
864pub struct DeviceGetCapabilitiesResponse {
865 pub offsets: Vec<u8>,
866}
867
868impl fidl::Persistable for DeviceGetCapabilitiesResponse {}
869
870#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
871pub struct DeviceGetDeviceInfoResponse {
872 pub info: DeviceInfo,
873}
874
875impl fidl::Persistable for DeviceGetDeviceInfoResponse {}
876
877#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
878pub struct DeviceGetExtendedCapabilitiesRequest {
879 pub id: ExtendedCapabilityId,
880}
881
882impl fidl::Persistable for DeviceGetExtendedCapabilitiesRequest {}
883
884#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
885pub struct DeviceGetExtendedCapabilitiesResponse {
886 pub offsets: Vec<u16>,
887}
888
889impl fidl::Persistable for DeviceGetExtendedCapabilitiesResponse {}
890
891#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
892pub struct DeviceGetInterruptModesResponse {
893 pub modes: InterruptModes,
894}
895
896impl fidl::Persistable for DeviceGetInterruptModesResponse {}
897
898#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
901pub struct DeviceInfo {
902 pub vendor_id: u16,
904 pub device_id: u16,
905 pub base_class: u8,
906 pub sub_class: u8,
907 pub program_interface: u8,
908 pub revision_id: u8,
909 pub bus_id: u8,
911 pub dev_id: u8,
912 pub func_id: u8,
913 pub padding: Padding,
914}
915
916impl fidl::Persistable for DeviceInfo {}
917
918#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
919#[repr(C)]
920pub struct DeviceMapInterruptRequest {
921 pub which_irq: u32,
922}
923
924impl fidl::Persistable for DeviceMapInterruptRequest {}
925
926#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
927#[repr(C)]
928pub struct DeviceReadConfig16Request {
929 pub offset: u16,
930}
931
932impl fidl::Persistable for DeviceReadConfig16Request {}
933
934#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
935#[repr(C)]
936pub struct DeviceReadConfig32Request {
937 pub offset: u16,
938}
939
940impl fidl::Persistable for DeviceReadConfig32Request {}
941
942#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
943#[repr(C)]
944pub struct DeviceReadConfig8Request {
945 pub offset: u16,
946}
947
948impl fidl::Persistable for DeviceReadConfig8Request {}
949
950#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
951pub struct DeviceSetBusMasteringRequest {
952 pub enabled: bool,
953}
954
955impl fidl::Persistable for DeviceSetBusMasteringRequest {}
956
957#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
958pub struct DeviceSetInterruptModeRequest {
959 pub mode: InterruptMode,
960 pub requested_irq_count: u32,
961}
962
963impl fidl::Persistable for DeviceSetInterruptModeRequest {}
964
965#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
966#[repr(C)]
967pub struct DeviceWriteConfig16Request {
968 pub offset: u16,
969 pub value: u16,
970}
971
972impl fidl::Persistable for DeviceWriteConfig16Request {}
973
974#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
975#[repr(C)]
976pub struct DeviceWriteConfig32Request {
977 pub offset: u16,
978 pub value: u32,
979}
980
981impl fidl::Persistable for DeviceWriteConfig32Request {}
982
983#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
984#[repr(C)]
985pub struct DeviceWriteConfig8Request {
986 pub offset: u16,
987 pub value: u8,
988}
989
990impl fidl::Persistable for DeviceWriteConfig8Request {}
991
992#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
993#[repr(C)]
994pub struct DeviceReadConfig16Response {
995 pub value: u16,
996}
997
998impl fidl::Persistable for DeviceReadConfig16Response {}
999
1000#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1001#[repr(C)]
1002pub struct DeviceReadConfig32Response {
1003 pub value: u32,
1004}
1005
1006impl fidl::Persistable for DeviceReadConfig32Response {}
1007
1008#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1009#[repr(C)]
1010pub struct DeviceReadConfig8Response {
1011 pub value: u8,
1012}
1013
1014impl fidl::Persistable for DeviceReadConfig8Response {}
1015
1016#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1017#[repr(C)]
1018pub struct ExtendedCapability {
1019 pub id: u16,
1020 pub offset: u16,
1021}
1022
1023impl fidl::Persistable for ExtendedCapability {}
1024
1025#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1026pub struct HostBridgeInfo {
1027 pub name: String,
1028 pub start_bus_number: u8,
1029 pub end_bus_number: u8,
1030 pub segment_group: u16,
1031}
1032
1033impl fidl::Persistable for HostBridgeInfo {}
1034
1035#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1039pub struct InterruptModes {
1040 pub has_legacy: bool,
1042 pub msi_count: u8,
1045 pub msix_count: u16,
1048}
1049
1050impl fidl::Persistable for InterruptModes {}
1051
1052#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1053pub struct Padding;
1054
1055impl fidl::Persistable for Padding {}
1056
1057#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1058pub struct PciDevice {
1059 pub base_addresses: Vec<BaseAddress>,
1060 pub capabilities: Vec<Capability>,
1061 pub ext_capabilities: Vec<ExtendedCapability>,
1062 pub config: Vec<u8>,
1063 pub bus_id: u8,
1064 pub device_id: u8,
1065 pub function_id: u8,
1066}
1067
1068impl fidl::Persistable for PciDevice {}
1069
1070#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1071pub struct UseIntxWorkaroundType;
1072
1073impl fidl::Persistable for UseIntxWorkaroundType {}
1074
1075#[derive(Clone, Debug, Default, PartialEq)]
1076pub struct BoardConfiguration {
1077 pub use_intx_workaround: Option<UseIntxWorkaroundType>,
1082 #[doc(hidden)]
1083 pub __source_breaking: fidl::marker::SourceBreaking,
1084}
1085
1086impl fidl::Persistable for BoardConfiguration {}
1087
1088mod internal {
1089 use super::*;
1090 unsafe impl fidl::encoding::TypeMarker for Command {
1091 type Owned = Self;
1092
1093 #[inline(always)]
1094 fn inline_align(_context: fidl::encoding::Context) -> usize {
1095 2
1096 }
1097
1098 #[inline(always)]
1099 fn inline_size(_context: fidl::encoding::Context) -> usize {
1100 2
1101 }
1102 }
1103
1104 impl fidl::encoding::ValueTypeMarker for Command {
1105 type Borrowed<'a> = Self;
1106 #[inline(always)]
1107 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1108 *value
1109 }
1110 }
1111
1112 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for Command {
1113 #[inline]
1114 unsafe fn encode(
1115 self,
1116 encoder: &mut fidl::encoding::Encoder<'_, D>,
1117 offset: usize,
1118 _depth: fidl::encoding::Depth,
1119 ) -> fidl::Result<()> {
1120 encoder.debug_check_bounds::<Self>(offset);
1121 encoder.write_num(self.bits(), offset);
1122 Ok(())
1123 }
1124 }
1125
1126 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Command {
1127 #[inline(always)]
1128 fn new_empty() -> Self {
1129 Self::empty()
1130 }
1131
1132 #[inline]
1133 unsafe fn decode(
1134 &mut self,
1135 decoder: &mut fidl::encoding::Decoder<'_, D>,
1136 offset: usize,
1137 _depth: fidl::encoding::Depth,
1138 ) -> fidl::Result<()> {
1139 decoder.debug_check_bounds::<Self>(offset);
1140 let prim = decoder.read_num::<u16>(offset);
1141 *self = Self::from_bits_allow_unknown(prim);
1142 Ok(())
1143 }
1144 }
1145 unsafe impl fidl::encoding::TypeMarker for Status {
1146 type Owned = Self;
1147
1148 #[inline(always)]
1149 fn inline_align(_context: fidl::encoding::Context) -> usize {
1150 2
1151 }
1152
1153 #[inline(always)]
1154 fn inline_size(_context: fidl::encoding::Context) -> usize {
1155 2
1156 }
1157 }
1158
1159 impl fidl::encoding::ValueTypeMarker for Status {
1160 type Borrowed<'a> = Self;
1161 #[inline(always)]
1162 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1163 *value
1164 }
1165 }
1166
1167 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for Status {
1168 #[inline]
1169 unsafe fn encode(
1170 self,
1171 encoder: &mut fidl::encoding::Encoder<'_, D>,
1172 offset: usize,
1173 _depth: fidl::encoding::Depth,
1174 ) -> fidl::Result<()> {
1175 encoder.debug_check_bounds::<Self>(offset);
1176 encoder.write_num(self.bits(), offset);
1177 Ok(())
1178 }
1179 }
1180
1181 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Status {
1182 #[inline(always)]
1183 fn new_empty() -> Self {
1184 Self::empty()
1185 }
1186
1187 #[inline]
1188 unsafe fn decode(
1189 &mut self,
1190 decoder: &mut fidl::encoding::Decoder<'_, D>,
1191 offset: usize,
1192 _depth: fidl::encoding::Depth,
1193 ) -> fidl::Result<()> {
1194 decoder.debug_check_bounds::<Self>(offset);
1195 let prim = decoder.read_num::<u16>(offset);
1196 *self = Self::from_bits_allow_unknown(prim);
1197 Ok(())
1198 }
1199 }
1200 unsafe impl fidl::encoding::TypeMarker for CapabilityId {
1201 type Owned = Self;
1202
1203 #[inline(always)]
1204 fn inline_align(_context: fidl::encoding::Context) -> usize {
1205 std::mem::align_of::<u8>()
1206 }
1207
1208 #[inline(always)]
1209 fn inline_size(_context: fidl::encoding::Context) -> usize {
1210 std::mem::size_of::<u8>()
1211 }
1212
1213 #[inline(always)]
1214 fn encode_is_copy() -> bool {
1215 false
1216 }
1217
1218 #[inline(always)]
1219 fn decode_is_copy() -> bool {
1220 false
1221 }
1222 }
1223
1224 impl fidl::encoding::ValueTypeMarker for CapabilityId {
1225 type Borrowed<'a> = Self;
1226 #[inline(always)]
1227 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1228 *value
1229 }
1230 }
1231
1232 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for CapabilityId {
1233 #[inline]
1234 unsafe fn encode(
1235 self,
1236 encoder: &mut fidl::encoding::Encoder<'_, D>,
1237 offset: usize,
1238 _depth: fidl::encoding::Depth,
1239 ) -> fidl::Result<()> {
1240 encoder.debug_check_bounds::<Self>(offset);
1241 encoder.write_num(self.into_primitive(), offset);
1242 Ok(())
1243 }
1244 }
1245
1246 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for CapabilityId {
1247 #[inline(always)]
1248 fn new_empty() -> Self {
1249 Self::unknown()
1250 }
1251
1252 #[inline]
1253 unsafe fn decode(
1254 &mut self,
1255 decoder: &mut fidl::encoding::Decoder<'_, D>,
1256 offset: usize,
1257 _depth: fidl::encoding::Depth,
1258 ) -> fidl::Result<()> {
1259 decoder.debug_check_bounds::<Self>(offset);
1260 let prim = decoder.read_num::<u8>(offset);
1261
1262 *self = Self::from_primitive_allow_unknown(prim);
1263 Ok(())
1264 }
1265 }
1266 unsafe impl fidl::encoding::TypeMarker for Config {
1267 type Owned = Self;
1268
1269 #[inline(always)]
1270 fn inline_align(_context: fidl::encoding::Context) -> usize {
1271 std::mem::align_of::<u16>()
1272 }
1273
1274 #[inline(always)]
1275 fn inline_size(_context: fidl::encoding::Context) -> usize {
1276 std::mem::size_of::<u16>()
1277 }
1278
1279 #[inline(always)]
1280 fn encode_is_copy() -> bool {
1281 false
1282 }
1283
1284 #[inline(always)]
1285 fn decode_is_copy() -> bool {
1286 false
1287 }
1288 }
1289
1290 impl fidl::encoding::ValueTypeMarker for Config {
1291 type Borrowed<'a> = Self;
1292 #[inline(always)]
1293 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1294 *value
1295 }
1296 }
1297
1298 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for Config {
1299 #[inline]
1300 unsafe fn encode(
1301 self,
1302 encoder: &mut fidl::encoding::Encoder<'_, D>,
1303 offset: usize,
1304 _depth: fidl::encoding::Depth,
1305 ) -> fidl::Result<()> {
1306 encoder.debug_check_bounds::<Self>(offset);
1307 encoder.write_num(self.into_primitive(), offset);
1308 Ok(())
1309 }
1310 }
1311
1312 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Config {
1313 #[inline(always)]
1314 fn new_empty() -> Self {
1315 Self::unknown()
1316 }
1317
1318 #[inline]
1319 unsafe fn decode(
1320 &mut self,
1321 decoder: &mut fidl::encoding::Decoder<'_, D>,
1322 offset: usize,
1323 _depth: fidl::encoding::Depth,
1324 ) -> fidl::Result<()> {
1325 decoder.debug_check_bounds::<Self>(offset);
1326 let prim = decoder.read_num::<u16>(offset);
1327
1328 *self = Self::from_primitive_allow_unknown(prim);
1329 Ok(())
1330 }
1331 }
1332 unsafe impl fidl::encoding::TypeMarker for ExtendedCapabilityId {
1333 type Owned = Self;
1334
1335 #[inline(always)]
1336 fn inline_align(_context: fidl::encoding::Context) -> usize {
1337 std::mem::align_of::<u16>()
1338 }
1339
1340 #[inline(always)]
1341 fn inline_size(_context: fidl::encoding::Context) -> usize {
1342 std::mem::size_of::<u16>()
1343 }
1344
1345 #[inline(always)]
1346 fn encode_is_copy() -> bool {
1347 false
1348 }
1349
1350 #[inline(always)]
1351 fn decode_is_copy() -> bool {
1352 false
1353 }
1354 }
1355
1356 impl fidl::encoding::ValueTypeMarker for ExtendedCapabilityId {
1357 type Borrowed<'a> = Self;
1358 #[inline(always)]
1359 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1360 *value
1361 }
1362 }
1363
1364 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
1365 for ExtendedCapabilityId
1366 {
1367 #[inline]
1368 unsafe fn encode(
1369 self,
1370 encoder: &mut fidl::encoding::Encoder<'_, D>,
1371 offset: usize,
1372 _depth: fidl::encoding::Depth,
1373 ) -> fidl::Result<()> {
1374 encoder.debug_check_bounds::<Self>(offset);
1375 encoder.write_num(self.into_primitive(), offset);
1376 Ok(())
1377 }
1378 }
1379
1380 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ExtendedCapabilityId {
1381 #[inline(always)]
1382 fn new_empty() -> Self {
1383 Self::unknown()
1384 }
1385
1386 #[inline]
1387 unsafe fn decode(
1388 &mut self,
1389 decoder: &mut fidl::encoding::Decoder<'_, D>,
1390 offset: usize,
1391 _depth: fidl::encoding::Depth,
1392 ) -> fidl::Result<()> {
1393 decoder.debug_check_bounds::<Self>(offset);
1394 let prim = decoder.read_num::<u16>(offset);
1395
1396 *self = Self::from_primitive_allow_unknown(prim);
1397 Ok(())
1398 }
1399 }
1400 unsafe impl fidl::encoding::TypeMarker for HeaderType {
1401 type Owned = Self;
1402
1403 #[inline(always)]
1404 fn inline_align(_context: fidl::encoding::Context) -> usize {
1405 std::mem::align_of::<u8>()
1406 }
1407
1408 #[inline(always)]
1409 fn inline_size(_context: fidl::encoding::Context) -> usize {
1410 std::mem::size_of::<u8>()
1411 }
1412
1413 #[inline(always)]
1414 fn encode_is_copy() -> bool {
1415 false
1416 }
1417
1418 #[inline(always)]
1419 fn decode_is_copy() -> bool {
1420 false
1421 }
1422 }
1423
1424 impl fidl::encoding::ValueTypeMarker for HeaderType {
1425 type Borrowed<'a> = Self;
1426 #[inline(always)]
1427 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1428 *value
1429 }
1430 }
1431
1432 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for HeaderType {
1433 #[inline]
1434 unsafe fn encode(
1435 self,
1436 encoder: &mut fidl::encoding::Encoder<'_, D>,
1437 offset: usize,
1438 _depth: fidl::encoding::Depth,
1439 ) -> fidl::Result<()> {
1440 encoder.debug_check_bounds::<Self>(offset);
1441 encoder.write_num(self.into_primitive(), offset);
1442 Ok(())
1443 }
1444 }
1445
1446 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for HeaderType {
1447 #[inline(always)]
1448 fn new_empty() -> Self {
1449 Self::unknown()
1450 }
1451
1452 #[inline]
1453 unsafe fn decode(
1454 &mut self,
1455 decoder: &mut fidl::encoding::Decoder<'_, D>,
1456 offset: usize,
1457 _depth: fidl::encoding::Depth,
1458 ) -> fidl::Result<()> {
1459 decoder.debug_check_bounds::<Self>(offset);
1460 let prim = decoder.read_num::<u8>(offset);
1461
1462 *self = Self::from_primitive_allow_unknown(prim);
1463 Ok(())
1464 }
1465 }
1466 unsafe impl fidl::encoding::TypeMarker for InterruptMode {
1467 type Owned = Self;
1468
1469 #[inline(always)]
1470 fn inline_align(_context: fidl::encoding::Context) -> usize {
1471 std::mem::align_of::<u8>()
1472 }
1473
1474 #[inline(always)]
1475 fn inline_size(_context: fidl::encoding::Context) -> usize {
1476 std::mem::size_of::<u8>()
1477 }
1478
1479 #[inline(always)]
1480 fn encode_is_copy() -> bool {
1481 false
1482 }
1483
1484 #[inline(always)]
1485 fn decode_is_copy() -> bool {
1486 false
1487 }
1488 }
1489
1490 impl fidl::encoding::ValueTypeMarker for InterruptMode {
1491 type Borrowed<'a> = Self;
1492 #[inline(always)]
1493 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1494 *value
1495 }
1496 }
1497
1498 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for InterruptMode {
1499 #[inline]
1500 unsafe fn encode(
1501 self,
1502 encoder: &mut fidl::encoding::Encoder<'_, D>,
1503 offset: usize,
1504 _depth: fidl::encoding::Depth,
1505 ) -> fidl::Result<()> {
1506 encoder.debug_check_bounds::<Self>(offset);
1507 encoder.write_num(self.into_primitive(), offset);
1508 Ok(())
1509 }
1510 }
1511
1512 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for InterruptMode {
1513 #[inline(always)]
1514 fn new_empty() -> Self {
1515 Self::unknown()
1516 }
1517
1518 #[inline]
1519 unsafe fn decode(
1520 &mut self,
1521 decoder: &mut fidl::encoding::Decoder<'_, D>,
1522 offset: usize,
1523 _depth: fidl::encoding::Depth,
1524 ) -> fidl::Result<()> {
1525 decoder.debug_check_bounds::<Self>(offset);
1526 let prim = decoder.read_num::<u8>(offset);
1527
1528 *self = Self::from_primitive_allow_unknown(prim);
1529 Ok(())
1530 }
1531 }
1532
1533 impl fidl::encoding::ValueTypeMarker for Address {
1534 type Borrowed<'a> = &'a Self;
1535 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1536 value
1537 }
1538 }
1539
1540 unsafe impl fidl::encoding::TypeMarker for Address {
1541 type Owned = Self;
1542
1543 #[inline(always)]
1544 fn inline_align(_context: fidl::encoding::Context) -> usize {
1545 1
1546 }
1547
1548 #[inline(always)]
1549 fn inline_size(_context: fidl::encoding::Context) -> usize {
1550 3
1551 }
1552 #[inline(always)]
1553 fn encode_is_copy() -> bool {
1554 true
1555 }
1556
1557 #[inline(always)]
1558 fn decode_is_copy() -> bool {
1559 true
1560 }
1561 }
1562
1563 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Address, D> for &Address {
1564 #[inline]
1565 unsafe fn encode(
1566 self,
1567 encoder: &mut fidl::encoding::Encoder<'_, D>,
1568 offset: usize,
1569 _depth: fidl::encoding::Depth,
1570 ) -> fidl::Result<()> {
1571 encoder.debug_check_bounds::<Address>(offset);
1572 unsafe {
1573 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
1575 (buf_ptr as *mut Address).write_unaligned((self as *const Address).read());
1576 }
1579 Ok(())
1580 }
1581 }
1582 unsafe impl<
1583 D: fidl::encoding::ResourceDialect,
1584 T0: fidl::encoding::Encode<u8, D>,
1585 T1: fidl::encoding::Encode<u8, D>,
1586 T2: fidl::encoding::Encode<u8, D>,
1587 > fidl::encoding::Encode<Address, D> for (T0, T1, T2)
1588 {
1589 #[inline]
1590 unsafe fn encode(
1591 self,
1592 encoder: &mut fidl::encoding::Encoder<'_, D>,
1593 offset: usize,
1594 depth: fidl::encoding::Depth,
1595 ) -> fidl::Result<()> {
1596 encoder.debug_check_bounds::<Address>(offset);
1597 self.0.encode(encoder, offset + 0, depth)?;
1601 self.1.encode(encoder, offset + 1, depth)?;
1602 self.2.encode(encoder, offset + 2, depth)?;
1603 Ok(())
1604 }
1605 }
1606
1607 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Address {
1608 #[inline(always)]
1609 fn new_empty() -> Self {
1610 Self {
1611 bus: fidl::new_empty!(u8, D),
1612 device: fidl::new_empty!(u8, D),
1613 function: fidl::new_empty!(u8, D),
1614 }
1615 }
1616
1617 #[inline]
1618 unsafe fn decode(
1619 &mut self,
1620 decoder: &mut fidl::encoding::Decoder<'_, D>,
1621 offset: usize,
1622 _depth: fidl::encoding::Depth,
1623 ) -> fidl::Result<()> {
1624 decoder.debug_check_bounds::<Self>(offset);
1625 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
1626 unsafe {
1629 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 3);
1630 }
1631 Ok(())
1632 }
1633 }
1634
1635 impl fidl::encoding::ValueTypeMarker for BaseAddress {
1636 type Borrowed<'a> = &'a Self;
1637 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1638 value
1639 }
1640 }
1641
1642 unsafe impl fidl::encoding::TypeMarker for BaseAddress {
1643 type Owned = Self;
1644
1645 #[inline(always)]
1646 fn inline_align(_context: fidl::encoding::Context) -> usize {
1647 8
1648 }
1649
1650 #[inline(always)]
1651 fn inline_size(_context: fidl::encoding::Context) -> usize {
1652 24
1653 }
1654 }
1655
1656 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<BaseAddress, D>
1657 for &BaseAddress
1658 {
1659 #[inline]
1660 unsafe fn encode(
1661 self,
1662 encoder: &mut fidl::encoding::Encoder<'_, D>,
1663 offset: usize,
1664 _depth: fidl::encoding::Depth,
1665 ) -> fidl::Result<()> {
1666 encoder.debug_check_bounds::<BaseAddress>(offset);
1667 fidl::encoding::Encode::<BaseAddress, D>::encode(
1669 (
1670 <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.address),
1671 <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.size),
1672 <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.is_memory),
1673 <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.is_prefetchable),
1674 <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.is_64bit),
1675 <u8 as fidl::encoding::ValueTypeMarker>::borrow(&self.id),
1676 ),
1677 encoder,
1678 offset,
1679 _depth,
1680 )
1681 }
1682 }
1683 unsafe impl<
1684 D: fidl::encoding::ResourceDialect,
1685 T0: fidl::encoding::Encode<u64, D>,
1686 T1: fidl::encoding::Encode<u64, D>,
1687 T2: fidl::encoding::Encode<bool, D>,
1688 T3: fidl::encoding::Encode<bool, D>,
1689 T4: fidl::encoding::Encode<bool, D>,
1690 T5: fidl::encoding::Encode<u8, D>,
1691 > fidl::encoding::Encode<BaseAddress, D> for (T0, T1, T2, T3, T4, T5)
1692 {
1693 #[inline]
1694 unsafe fn encode(
1695 self,
1696 encoder: &mut fidl::encoding::Encoder<'_, D>,
1697 offset: usize,
1698 depth: fidl::encoding::Depth,
1699 ) -> fidl::Result<()> {
1700 encoder.debug_check_bounds::<BaseAddress>(offset);
1701 unsafe {
1704 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
1705 (ptr as *mut u64).write_unaligned(0);
1706 }
1707 self.0.encode(encoder, offset + 0, depth)?;
1709 self.1.encode(encoder, offset + 8, depth)?;
1710 self.2.encode(encoder, offset + 16, depth)?;
1711 self.3.encode(encoder, offset + 17, depth)?;
1712 self.4.encode(encoder, offset + 18, depth)?;
1713 self.5.encode(encoder, offset + 19, depth)?;
1714 Ok(())
1715 }
1716 }
1717
1718 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for BaseAddress {
1719 #[inline(always)]
1720 fn new_empty() -> Self {
1721 Self {
1722 address: fidl::new_empty!(u64, D),
1723 size: fidl::new_empty!(u64, D),
1724 is_memory: fidl::new_empty!(bool, D),
1725 is_prefetchable: fidl::new_empty!(bool, D),
1726 is_64bit: fidl::new_empty!(bool, D),
1727 id: fidl::new_empty!(u8, D),
1728 }
1729 }
1730
1731 #[inline]
1732 unsafe fn decode(
1733 &mut self,
1734 decoder: &mut fidl::encoding::Decoder<'_, D>,
1735 offset: usize,
1736 _depth: fidl::encoding::Depth,
1737 ) -> fidl::Result<()> {
1738 decoder.debug_check_bounds::<Self>(offset);
1739 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
1741 let padval = unsafe { (ptr as *const u64).read_unaligned() };
1742 let mask = 0xffffffff00000000u64;
1743 let maskedval = padval & mask;
1744 if maskedval != 0 {
1745 return Err(fidl::Error::NonZeroPadding {
1746 padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
1747 });
1748 }
1749 fidl::decode!(u64, D, &mut self.address, decoder, offset + 0, _depth)?;
1750 fidl::decode!(u64, D, &mut self.size, decoder, offset + 8, _depth)?;
1751 fidl::decode!(bool, D, &mut self.is_memory, decoder, offset + 16, _depth)?;
1752 fidl::decode!(bool, D, &mut self.is_prefetchable, decoder, offset + 17, _depth)?;
1753 fidl::decode!(bool, D, &mut self.is_64bit, decoder, offset + 18, _depth)?;
1754 fidl::decode!(u8, D, &mut self.id, decoder, offset + 19, _depth)?;
1755 Ok(())
1756 }
1757 }
1758
1759 impl fidl::encoding::ValueTypeMarker for BusGetDevicesResponse {
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 BusGetDevicesResponse {
1767 type Owned = Self;
1768
1769 #[inline(always)]
1770 fn inline_align(_context: fidl::encoding::Context) -> usize {
1771 8
1772 }
1773
1774 #[inline(always)]
1775 fn inline_size(_context: fidl::encoding::Context) -> usize {
1776 16
1777 }
1778 }
1779
1780 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<BusGetDevicesResponse, D>
1781 for &BusGetDevicesResponse
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::<BusGetDevicesResponse>(offset);
1791 fidl::encoding::Encode::<BusGetDevicesResponse, D>::encode(
1793 (
1794 <fidl::encoding::Vector<PciDevice, 64> as fidl::encoding::ValueTypeMarker>::borrow(&self.devices),
1795 ),
1796 encoder, offset, _depth
1797 )
1798 }
1799 }
1800 unsafe impl<
1801 D: fidl::encoding::ResourceDialect,
1802 T0: fidl::encoding::Encode<fidl::encoding::Vector<PciDevice, 64>, D>,
1803 > fidl::encoding::Encode<BusGetDevicesResponse, D> for (T0,)
1804 {
1805 #[inline]
1806 unsafe fn encode(
1807 self,
1808 encoder: &mut fidl::encoding::Encoder<'_, D>,
1809 offset: usize,
1810 depth: fidl::encoding::Depth,
1811 ) -> fidl::Result<()> {
1812 encoder.debug_check_bounds::<BusGetDevicesResponse>(offset);
1813 self.0.encode(encoder, offset + 0, depth)?;
1817 Ok(())
1818 }
1819 }
1820
1821 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for BusGetDevicesResponse {
1822 #[inline(always)]
1823 fn new_empty() -> Self {
1824 Self { devices: fidl::new_empty!(fidl::encoding::Vector<PciDevice, 64>, D) }
1825 }
1826
1827 #[inline]
1828 unsafe fn decode(
1829 &mut self,
1830 decoder: &mut fidl::encoding::Decoder<'_, D>,
1831 offset: usize,
1832 _depth: fidl::encoding::Depth,
1833 ) -> fidl::Result<()> {
1834 decoder.debug_check_bounds::<Self>(offset);
1835 fidl::decode!(fidl::encoding::Vector<PciDevice, 64>, D, &mut self.devices, decoder, offset + 0, _depth)?;
1837 Ok(())
1838 }
1839 }
1840
1841 impl fidl::encoding::ValueTypeMarker for BusGetHostBridgeInfoResponse {
1842 type Borrowed<'a> = &'a Self;
1843 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1844 value
1845 }
1846 }
1847
1848 unsafe impl fidl::encoding::TypeMarker for BusGetHostBridgeInfoResponse {
1849 type Owned = Self;
1850
1851 #[inline(always)]
1852 fn inline_align(_context: fidl::encoding::Context) -> usize {
1853 8
1854 }
1855
1856 #[inline(always)]
1857 fn inline_size(_context: fidl::encoding::Context) -> usize {
1858 24
1859 }
1860 }
1861
1862 unsafe impl<D: fidl::encoding::ResourceDialect>
1863 fidl::encoding::Encode<BusGetHostBridgeInfoResponse, D> for &BusGetHostBridgeInfoResponse
1864 {
1865 #[inline]
1866 unsafe fn encode(
1867 self,
1868 encoder: &mut fidl::encoding::Encoder<'_, D>,
1869 offset: usize,
1870 _depth: fidl::encoding::Depth,
1871 ) -> fidl::Result<()> {
1872 encoder.debug_check_bounds::<BusGetHostBridgeInfoResponse>(offset);
1873 fidl::encoding::Encode::<BusGetHostBridgeInfoResponse, D>::encode(
1875 (<HostBridgeInfo as fidl::encoding::ValueTypeMarker>::borrow(&self.info),),
1876 encoder,
1877 offset,
1878 _depth,
1879 )
1880 }
1881 }
1882 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<HostBridgeInfo, D>>
1883 fidl::encoding::Encode<BusGetHostBridgeInfoResponse, D> for (T0,)
1884 {
1885 #[inline]
1886 unsafe fn encode(
1887 self,
1888 encoder: &mut fidl::encoding::Encoder<'_, D>,
1889 offset: usize,
1890 depth: fidl::encoding::Depth,
1891 ) -> fidl::Result<()> {
1892 encoder.debug_check_bounds::<BusGetHostBridgeInfoResponse>(offset);
1893 self.0.encode(encoder, offset + 0, depth)?;
1897 Ok(())
1898 }
1899 }
1900
1901 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1902 for BusGetHostBridgeInfoResponse
1903 {
1904 #[inline(always)]
1905 fn new_empty() -> Self {
1906 Self { info: fidl::new_empty!(HostBridgeInfo, D) }
1907 }
1908
1909 #[inline]
1910 unsafe fn decode(
1911 &mut self,
1912 decoder: &mut fidl::encoding::Decoder<'_, D>,
1913 offset: usize,
1914 _depth: fidl::encoding::Depth,
1915 ) -> fidl::Result<()> {
1916 decoder.debug_check_bounds::<Self>(offset);
1917 fidl::decode!(HostBridgeInfo, D, &mut self.info, decoder, offset + 0, _depth)?;
1919 Ok(())
1920 }
1921 }
1922
1923 impl fidl::encoding::ValueTypeMarker for BusReadBarRequest {
1924 type Borrowed<'a> = &'a Self;
1925 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1926 value
1927 }
1928 }
1929
1930 unsafe impl fidl::encoding::TypeMarker for BusReadBarRequest {
1931 type Owned = Self;
1932
1933 #[inline(always)]
1934 fn inline_align(_context: fidl::encoding::Context) -> usize {
1935 8
1936 }
1937
1938 #[inline(always)]
1939 fn inline_size(_context: fidl::encoding::Context) -> usize {
1940 24
1941 }
1942 }
1943
1944 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<BusReadBarRequest, D>
1945 for &BusReadBarRequest
1946 {
1947 #[inline]
1948 unsafe fn encode(
1949 self,
1950 encoder: &mut fidl::encoding::Encoder<'_, D>,
1951 offset: usize,
1952 _depth: fidl::encoding::Depth,
1953 ) -> fidl::Result<()> {
1954 encoder.debug_check_bounds::<BusReadBarRequest>(offset);
1955 unsafe {
1956 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
1958 (buf_ptr as *mut BusReadBarRequest)
1959 .write_unaligned((self as *const BusReadBarRequest).read());
1960 let padding_ptr = buf_ptr.offset(0) as *mut u64;
1963 let padding_mask = 0xffffffff00000000u64;
1964 padding_ptr.write_unaligned(padding_ptr.read_unaligned() & !padding_mask);
1965 }
1966 Ok(())
1967 }
1968 }
1969 unsafe impl<
1970 D: fidl::encoding::ResourceDialect,
1971 T0: fidl::encoding::Encode<Address, D>,
1972 T1: fidl::encoding::Encode<u8, D>,
1973 T2: fidl::encoding::Encode<u64, D>,
1974 T3: fidl::encoding::Encode<u64, D>,
1975 > fidl::encoding::Encode<BusReadBarRequest, D> for (T0, T1, T2, T3)
1976 {
1977 #[inline]
1978 unsafe fn encode(
1979 self,
1980 encoder: &mut fidl::encoding::Encoder<'_, D>,
1981 offset: usize,
1982 depth: fidl::encoding::Depth,
1983 ) -> fidl::Result<()> {
1984 encoder.debug_check_bounds::<BusReadBarRequest>(offset);
1985 unsafe {
1988 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
1989 (ptr as *mut u64).write_unaligned(0);
1990 }
1991 self.0.encode(encoder, offset + 0, depth)?;
1993 self.1.encode(encoder, offset + 3, depth)?;
1994 self.2.encode(encoder, offset + 8, depth)?;
1995 self.3.encode(encoder, offset + 16, depth)?;
1996 Ok(())
1997 }
1998 }
1999
2000 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for BusReadBarRequest {
2001 #[inline(always)]
2002 fn new_empty() -> Self {
2003 Self {
2004 device: fidl::new_empty!(Address, D),
2005 bar_id: fidl::new_empty!(u8, D),
2006 offset: fidl::new_empty!(u64, D),
2007 size: fidl::new_empty!(u64, D),
2008 }
2009 }
2010
2011 #[inline]
2012 unsafe fn decode(
2013 &mut self,
2014 decoder: &mut fidl::encoding::Decoder<'_, D>,
2015 offset: usize,
2016 _depth: fidl::encoding::Depth,
2017 ) -> fidl::Result<()> {
2018 decoder.debug_check_bounds::<Self>(offset);
2019 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
2020 let ptr = unsafe { buf_ptr.offset(0) };
2022 let padval = unsafe { (ptr as *const u64).read_unaligned() };
2023 let mask = 0xffffffff00000000u64;
2024 let maskedval = padval & mask;
2025 if maskedval != 0 {
2026 return Err(fidl::Error::NonZeroPadding {
2027 padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
2028 });
2029 }
2030 unsafe {
2032 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 24);
2033 }
2034 Ok(())
2035 }
2036 }
2037
2038 impl fidl::encoding::ValueTypeMarker for BusReadBarResponse {
2039 type Borrowed<'a> = &'a Self;
2040 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2041 value
2042 }
2043 }
2044
2045 unsafe impl fidl::encoding::TypeMarker for BusReadBarResponse {
2046 type Owned = Self;
2047
2048 #[inline(always)]
2049 fn inline_align(_context: fidl::encoding::Context) -> usize {
2050 8
2051 }
2052
2053 #[inline(always)]
2054 fn inline_size(_context: fidl::encoding::Context) -> usize {
2055 16
2056 }
2057 }
2058
2059 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<BusReadBarResponse, D>
2060 for &BusReadBarResponse
2061 {
2062 #[inline]
2063 unsafe fn encode(
2064 self,
2065 encoder: &mut fidl::encoding::Encoder<'_, D>,
2066 offset: usize,
2067 _depth: fidl::encoding::Depth,
2068 ) -> fidl::Result<()> {
2069 encoder.debug_check_bounds::<BusReadBarResponse>(offset);
2070 fidl::encoding::Encode::<BusReadBarResponse, D>::encode(
2072 (<fidl::encoding::UnboundedVector<u8> as fidl::encoding::ValueTypeMarker>::borrow(
2073 &self.buffer,
2074 ),),
2075 encoder,
2076 offset,
2077 _depth,
2078 )
2079 }
2080 }
2081 unsafe impl<
2082 D: fidl::encoding::ResourceDialect,
2083 T0: fidl::encoding::Encode<fidl::encoding::UnboundedVector<u8>, D>,
2084 > fidl::encoding::Encode<BusReadBarResponse, D> for (T0,)
2085 {
2086 #[inline]
2087 unsafe fn encode(
2088 self,
2089 encoder: &mut fidl::encoding::Encoder<'_, D>,
2090 offset: usize,
2091 depth: fidl::encoding::Depth,
2092 ) -> fidl::Result<()> {
2093 encoder.debug_check_bounds::<BusReadBarResponse>(offset);
2094 self.0.encode(encoder, offset + 0, depth)?;
2098 Ok(())
2099 }
2100 }
2101
2102 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for BusReadBarResponse {
2103 #[inline(always)]
2104 fn new_empty() -> Self {
2105 Self { buffer: fidl::new_empty!(fidl::encoding::UnboundedVector<u8>, D) }
2106 }
2107
2108 #[inline]
2109 unsafe fn decode(
2110 &mut self,
2111 decoder: &mut fidl::encoding::Decoder<'_, D>,
2112 offset: usize,
2113 _depth: fidl::encoding::Depth,
2114 ) -> fidl::Result<()> {
2115 decoder.debug_check_bounds::<Self>(offset);
2116 fidl::decode!(
2118 fidl::encoding::UnboundedVector<u8>,
2119 D,
2120 &mut self.buffer,
2121 decoder,
2122 offset + 0,
2123 _depth
2124 )?;
2125 Ok(())
2126 }
2127 }
2128
2129 impl fidl::encoding::ValueTypeMarker for Capability {
2130 type Borrowed<'a> = &'a Self;
2131 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2132 value
2133 }
2134 }
2135
2136 unsafe impl fidl::encoding::TypeMarker for Capability {
2137 type Owned = Self;
2138
2139 #[inline(always)]
2140 fn inline_align(_context: fidl::encoding::Context) -> usize {
2141 1
2142 }
2143
2144 #[inline(always)]
2145 fn inline_size(_context: fidl::encoding::Context) -> usize {
2146 2
2147 }
2148 #[inline(always)]
2149 fn encode_is_copy() -> bool {
2150 true
2151 }
2152
2153 #[inline(always)]
2154 fn decode_is_copy() -> bool {
2155 true
2156 }
2157 }
2158
2159 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Capability, D>
2160 for &Capability
2161 {
2162 #[inline]
2163 unsafe fn encode(
2164 self,
2165 encoder: &mut fidl::encoding::Encoder<'_, D>,
2166 offset: usize,
2167 _depth: fidl::encoding::Depth,
2168 ) -> fidl::Result<()> {
2169 encoder.debug_check_bounds::<Capability>(offset);
2170 unsafe {
2171 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
2173 (buf_ptr as *mut Capability).write_unaligned((self as *const Capability).read());
2174 }
2177 Ok(())
2178 }
2179 }
2180 unsafe impl<
2181 D: fidl::encoding::ResourceDialect,
2182 T0: fidl::encoding::Encode<u8, D>,
2183 T1: fidl::encoding::Encode<u8, D>,
2184 > fidl::encoding::Encode<Capability, D> for (T0, T1)
2185 {
2186 #[inline]
2187 unsafe fn encode(
2188 self,
2189 encoder: &mut fidl::encoding::Encoder<'_, D>,
2190 offset: usize,
2191 depth: fidl::encoding::Depth,
2192 ) -> fidl::Result<()> {
2193 encoder.debug_check_bounds::<Capability>(offset);
2194 self.0.encode(encoder, offset + 0, depth)?;
2198 self.1.encode(encoder, offset + 1, depth)?;
2199 Ok(())
2200 }
2201 }
2202
2203 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Capability {
2204 #[inline(always)]
2205 fn new_empty() -> Self {
2206 Self { id: fidl::new_empty!(u8, D), offset: fidl::new_empty!(u8, D) }
2207 }
2208
2209 #[inline]
2210 unsafe fn decode(
2211 &mut self,
2212 decoder: &mut fidl::encoding::Decoder<'_, D>,
2213 offset: usize,
2214 _depth: fidl::encoding::Depth,
2215 ) -> fidl::Result<()> {
2216 decoder.debug_check_bounds::<Self>(offset);
2217 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
2218 unsafe {
2221 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 2);
2222 }
2223 Ok(())
2224 }
2225 }
2226
2227 impl fidl::encoding::ValueTypeMarker for DeviceGetBarRequest {
2228 type Borrowed<'a> = &'a Self;
2229 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2230 value
2231 }
2232 }
2233
2234 unsafe impl fidl::encoding::TypeMarker for DeviceGetBarRequest {
2235 type Owned = Self;
2236
2237 #[inline(always)]
2238 fn inline_align(_context: fidl::encoding::Context) -> usize {
2239 4
2240 }
2241
2242 #[inline(always)]
2243 fn inline_size(_context: fidl::encoding::Context) -> usize {
2244 4
2245 }
2246 #[inline(always)]
2247 fn encode_is_copy() -> bool {
2248 true
2249 }
2250
2251 #[inline(always)]
2252 fn decode_is_copy() -> bool {
2253 true
2254 }
2255 }
2256
2257 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<DeviceGetBarRequest, D>
2258 for &DeviceGetBarRequest
2259 {
2260 #[inline]
2261 unsafe fn encode(
2262 self,
2263 encoder: &mut fidl::encoding::Encoder<'_, D>,
2264 offset: usize,
2265 _depth: fidl::encoding::Depth,
2266 ) -> fidl::Result<()> {
2267 encoder.debug_check_bounds::<DeviceGetBarRequest>(offset);
2268 unsafe {
2269 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
2271 (buf_ptr as *mut DeviceGetBarRequest)
2272 .write_unaligned((self as *const DeviceGetBarRequest).read());
2273 }
2276 Ok(())
2277 }
2278 }
2279 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u32, D>>
2280 fidl::encoding::Encode<DeviceGetBarRequest, D> for (T0,)
2281 {
2282 #[inline]
2283 unsafe fn encode(
2284 self,
2285 encoder: &mut fidl::encoding::Encoder<'_, D>,
2286 offset: usize,
2287 depth: fidl::encoding::Depth,
2288 ) -> fidl::Result<()> {
2289 encoder.debug_check_bounds::<DeviceGetBarRequest>(offset);
2290 self.0.encode(encoder, offset + 0, depth)?;
2294 Ok(())
2295 }
2296 }
2297
2298 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for DeviceGetBarRequest {
2299 #[inline(always)]
2300 fn new_empty() -> Self {
2301 Self { bar_id: fidl::new_empty!(u32, D) }
2302 }
2303
2304 #[inline]
2305 unsafe fn decode(
2306 &mut self,
2307 decoder: &mut fidl::encoding::Decoder<'_, D>,
2308 offset: usize,
2309 _depth: fidl::encoding::Depth,
2310 ) -> fidl::Result<()> {
2311 decoder.debug_check_bounds::<Self>(offset);
2312 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
2313 unsafe {
2316 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
2317 }
2318 Ok(())
2319 }
2320 }
2321
2322 impl fidl::encoding::ValueTypeMarker for DeviceGetBtiRequest {
2323 type Borrowed<'a> = &'a Self;
2324 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2325 value
2326 }
2327 }
2328
2329 unsafe impl fidl::encoding::TypeMarker for DeviceGetBtiRequest {
2330 type Owned = Self;
2331
2332 #[inline(always)]
2333 fn inline_align(_context: fidl::encoding::Context) -> usize {
2334 4
2335 }
2336
2337 #[inline(always)]
2338 fn inline_size(_context: fidl::encoding::Context) -> usize {
2339 4
2340 }
2341 #[inline(always)]
2342 fn encode_is_copy() -> bool {
2343 true
2344 }
2345
2346 #[inline(always)]
2347 fn decode_is_copy() -> bool {
2348 true
2349 }
2350 }
2351
2352 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<DeviceGetBtiRequest, D>
2353 for &DeviceGetBtiRequest
2354 {
2355 #[inline]
2356 unsafe fn encode(
2357 self,
2358 encoder: &mut fidl::encoding::Encoder<'_, D>,
2359 offset: usize,
2360 _depth: fidl::encoding::Depth,
2361 ) -> fidl::Result<()> {
2362 encoder.debug_check_bounds::<DeviceGetBtiRequest>(offset);
2363 unsafe {
2364 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
2366 (buf_ptr as *mut DeviceGetBtiRequest)
2367 .write_unaligned((self as *const DeviceGetBtiRequest).read());
2368 }
2371 Ok(())
2372 }
2373 }
2374 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u32, D>>
2375 fidl::encoding::Encode<DeviceGetBtiRequest, D> for (T0,)
2376 {
2377 #[inline]
2378 unsafe fn encode(
2379 self,
2380 encoder: &mut fidl::encoding::Encoder<'_, D>,
2381 offset: usize,
2382 depth: fidl::encoding::Depth,
2383 ) -> fidl::Result<()> {
2384 encoder.debug_check_bounds::<DeviceGetBtiRequest>(offset);
2385 self.0.encode(encoder, offset + 0, depth)?;
2389 Ok(())
2390 }
2391 }
2392
2393 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for DeviceGetBtiRequest {
2394 #[inline(always)]
2395 fn new_empty() -> Self {
2396 Self { index: fidl::new_empty!(u32, D) }
2397 }
2398
2399 #[inline]
2400 unsafe fn decode(
2401 &mut self,
2402 decoder: &mut fidl::encoding::Decoder<'_, D>,
2403 offset: usize,
2404 _depth: fidl::encoding::Depth,
2405 ) -> fidl::Result<()> {
2406 decoder.debug_check_bounds::<Self>(offset);
2407 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
2408 unsafe {
2411 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
2412 }
2413 Ok(())
2414 }
2415 }
2416
2417 impl fidl::encoding::ValueTypeMarker for DeviceGetCapabilitiesRequest {
2418 type Borrowed<'a> = &'a Self;
2419 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2420 value
2421 }
2422 }
2423
2424 unsafe impl fidl::encoding::TypeMarker for DeviceGetCapabilitiesRequest {
2425 type Owned = Self;
2426
2427 #[inline(always)]
2428 fn inline_align(_context: fidl::encoding::Context) -> usize {
2429 1
2430 }
2431
2432 #[inline(always)]
2433 fn inline_size(_context: fidl::encoding::Context) -> usize {
2434 1
2435 }
2436 }
2437
2438 unsafe impl<D: fidl::encoding::ResourceDialect>
2439 fidl::encoding::Encode<DeviceGetCapabilitiesRequest, D> for &DeviceGetCapabilitiesRequest
2440 {
2441 #[inline]
2442 unsafe fn encode(
2443 self,
2444 encoder: &mut fidl::encoding::Encoder<'_, D>,
2445 offset: usize,
2446 _depth: fidl::encoding::Depth,
2447 ) -> fidl::Result<()> {
2448 encoder.debug_check_bounds::<DeviceGetCapabilitiesRequest>(offset);
2449 fidl::encoding::Encode::<DeviceGetCapabilitiesRequest, D>::encode(
2451 (<CapabilityId as fidl::encoding::ValueTypeMarker>::borrow(&self.id),),
2452 encoder,
2453 offset,
2454 _depth,
2455 )
2456 }
2457 }
2458 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<CapabilityId, D>>
2459 fidl::encoding::Encode<DeviceGetCapabilitiesRequest, D> for (T0,)
2460 {
2461 #[inline]
2462 unsafe fn encode(
2463 self,
2464 encoder: &mut fidl::encoding::Encoder<'_, D>,
2465 offset: usize,
2466 depth: fidl::encoding::Depth,
2467 ) -> fidl::Result<()> {
2468 encoder.debug_check_bounds::<DeviceGetCapabilitiesRequest>(offset);
2469 self.0.encode(encoder, offset + 0, depth)?;
2473 Ok(())
2474 }
2475 }
2476
2477 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2478 for DeviceGetCapabilitiesRequest
2479 {
2480 #[inline(always)]
2481 fn new_empty() -> Self {
2482 Self { id: fidl::new_empty!(CapabilityId, D) }
2483 }
2484
2485 #[inline]
2486 unsafe fn decode(
2487 &mut self,
2488 decoder: &mut fidl::encoding::Decoder<'_, D>,
2489 offset: usize,
2490 _depth: fidl::encoding::Depth,
2491 ) -> fidl::Result<()> {
2492 decoder.debug_check_bounds::<Self>(offset);
2493 fidl::decode!(CapabilityId, D, &mut self.id, decoder, offset + 0, _depth)?;
2495 Ok(())
2496 }
2497 }
2498
2499 impl fidl::encoding::ValueTypeMarker for DeviceGetCapabilitiesResponse {
2500 type Borrowed<'a> = &'a Self;
2501 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2502 value
2503 }
2504 }
2505
2506 unsafe impl fidl::encoding::TypeMarker for DeviceGetCapabilitiesResponse {
2507 type Owned = Self;
2508
2509 #[inline(always)]
2510 fn inline_align(_context: fidl::encoding::Context) -> usize {
2511 8
2512 }
2513
2514 #[inline(always)]
2515 fn inline_size(_context: fidl::encoding::Context) -> usize {
2516 16
2517 }
2518 }
2519
2520 unsafe impl<D: fidl::encoding::ResourceDialect>
2521 fidl::encoding::Encode<DeviceGetCapabilitiesResponse, D>
2522 for &DeviceGetCapabilitiesResponse
2523 {
2524 #[inline]
2525 unsafe fn encode(
2526 self,
2527 encoder: &mut fidl::encoding::Encoder<'_, D>,
2528 offset: usize,
2529 _depth: fidl::encoding::Depth,
2530 ) -> fidl::Result<()> {
2531 encoder.debug_check_bounds::<DeviceGetCapabilitiesResponse>(offset);
2532 fidl::encoding::Encode::<DeviceGetCapabilitiesResponse, D>::encode(
2534 (<fidl::encoding::Vector<u8, 32> as fidl::encoding::ValueTypeMarker>::borrow(
2535 &self.offsets,
2536 ),),
2537 encoder,
2538 offset,
2539 _depth,
2540 )
2541 }
2542 }
2543 unsafe impl<
2544 D: fidl::encoding::ResourceDialect,
2545 T0: fidl::encoding::Encode<fidl::encoding::Vector<u8, 32>, D>,
2546 > fidl::encoding::Encode<DeviceGetCapabilitiesResponse, D> for (T0,)
2547 {
2548 #[inline]
2549 unsafe fn encode(
2550 self,
2551 encoder: &mut fidl::encoding::Encoder<'_, D>,
2552 offset: usize,
2553 depth: fidl::encoding::Depth,
2554 ) -> fidl::Result<()> {
2555 encoder.debug_check_bounds::<DeviceGetCapabilitiesResponse>(offset);
2556 self.0.encode(encoder, offset + 0, depth)?;
2560 Ok(())
2561 }
2562 }
2563
2564 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2565 for DeviceGetCapabilitiesResponse
2566 {
2567 #[inline(always)]
2568 fn new_empty() -> Self {
2569 Self { offsets: fidl::new_empty!(fidl::encoding::Vector<u8, 32>, D) }
2570 }
2571
2572 #[inline]
2573 unsafe fn decode(
2574 &mut self,
2575 decoder: &mut fidl::encoding::Decoder<'_, D>,
2576 offset: usize,
2577 _depth: fidl::encoding::Depth,
2578 ) -> fidl::Result<()> {
2579 decoder.debug_check_bounds::<Self>(offset);
2580 fidl::decode!(fidl::encoding::Vector<u8, 32>, D, &mut self.offsets, decoder, offset + 0, _depth)?;
2582 Ok(())
2583 }
2584 }
2585
2586 impl fidl::encoding::ValueTypeMarker for DeviceGetDeviceInfoResponse {
2587 type Borrowed<'a> = &'a Self;
2588 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2589 value
2590 }
2591 }
2592
2593 unsafe impl fidl::encoding::TypeMarker for DeviceGetDeviceInfoResponse {
2594 type Owned = Self;
2595
2596 #[inline(always)]
2597 fn inline_align(_context: fidl::encoding::Context) -> usize {
2598 2
2599 }
2600
2601 #[inline(always)]
2602 fn inline_size(_context: fidl::encoding::Context) -> usize {
2603 12
2604 }
2605 }
2606
2607 unsafe impl<D: fidl::encoding::ResourceDialect>
2608 fidl::encoding::Encode<DeviceGetDeviceInfoResponse, D> for &DeviceGetDeviceInfoResponse
2609 {
2610 #[inline]
2611 unsafe fn encode(
2612 self,
2613 encoder: &mut fidl::encoding::Encoder<'_, D>,
2614 offset: usize,
2615 _depth: fidl::encoding::Depth,
2616 ) -> fidl::Result<()> {
2617 encoder.debug_check_bounds::<DeviceGetDeviceInfoResponse>(offset);
2618 fidl::encoding::Encode::<DeviceGetDeviceInfoResponse, D>::encode(
2620 (<DeviceInfo as fidl::encoding::ValueTypeMarker>::borrow(&self.info),),
2621 encoder,
2622 offset,
2623 _depth,
2624 )
2625 }
2626 }
2627 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<DeviceInfo, D>>
2628 fidl::encoding::Encode<DeviceGetDeviceInfoResponse, D> for (T0,)
2629 {
2630 #[inline]
2631 unsafe fn encode(
2632 self,
2633 encoder: &mut fidl::encoding::Encoder<'_, D>,
2634 offset: usize,
2635 depth: fidl::encoding::Depth,
2636 ) -> fidl::Result<()> {
2637 encoder.debug_check_bounds::<DeviceGetDeviceInfoResponse>(offset);
2638 self.0.encode(encoder, offset + 0, depth)?;
2642 Ok(())
2643 }
2644 }
2645
2646 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2647 for DeviceGetDeviceInfoResponse
2648 {
2649 #[inline(always)]
2650 fn new_empty() -> Self {
2651 Self { info: fidl::new_empty!(DeviceInfo, D) }
2652 }
2653
2654 #[inline]
2655 unsafe fn decode(
2656 &mut self,
2657 decoder: &mut fidl::encoding::Decoder<'_, D>,
2658 offset: usize,
2659 _depth: fidl::encoding::Depth,
2660 ) -> fidl::Result<()> {
2661 decoder.debug_check_bounds::<Self>(offset);
2662 fidl::decode!(DeviceInfo, D, &mut self.info, decoder, offset + 0, _depth)?;
2664 Ok(())
2665 }
2666 }
2667
2668 impl fidl::encoding::ValueTypeMarker for DeviceGetExtendedCapabilitiesRequest {
2669 type Borrowed<'a> = &'a Self;
2670 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2671 value
2672 }
2673 }
2674
2675 unsafe impl fidl::encoding::TypeMarker for DeviceGetExtendedCapabilitiesRequest {
2676 type Owned = Self;
2677
2678 #[inline(always)]
2679 fn inline_align(_context: fidl::encoding::Context) -> usize {
2680 2
2681 }
2682
2683 #[inline(always)]
2684 fn inline_size(_context: fidl::encoding::Context) -> usize {
2685 2
2686 }
2687 }
2688
2689 unsafe impl<D: fidl::encoding::ResourceDialect>
2690 fidl::encoding::Encode<DeviceGetExtendedCapabilitiesRequest, D>
2691 for &DeviceGetExtendedCapabilitiesRequest
2692 {
2693 #[inline]
2694 unsafe fn encode(
2695 self,
2696 encoder: &mut fidl::encoding::Encoder<'_, D>,
2697 offset: usize,
2698 _depth: fidl::encoding::Depth,
2699 ) -> fidl::Result<()> {
2700 encoder.debug_check_bounds::<DeviceGetExtendedCapabilitiesRequest>(offset);
2701 fidl::encoding::Encode::<DeviceGetExtendedCapabilitiesRequest, D>::encode(
2703 (<ExtendedCapabilityId as fidl::encoding::ValueTypeMarker>::borrow(&self.id),),
2704 encoder,
2705 offset,
2706 _depth,
2707 )
2708 }
2709 }
2710 unsafe impl<
2711 D: fidl::encoding::ResourceDialect,
2712 T0: fidl::encoding::Encode<ExtendedCapabilityId, D>,
2713 > fidl::encoding::Encode<DeviceGetExtendedCapabilitiesRequest, D> for (T0,)
2714 {
2715 #[inline]
2716 unsafe fn encode(
2717 self,
2718 encoder: &mut fidl::encoding::Encoder<'_, D>,
2719 offset: usize,
2720 depth: fidl::encoding::Depth,
2721 ) -> fidl::Result<()> {
2722 encoder.debug_check_bounds::<DeviceGetExtendedCapabilitiesRequest>(offset);
2723 self.0.encode(encoder, offset + 0, depth)?;
2727 Ok(())
2728 }
2729 }
2730
2731 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2732 for DeviceGetExtendedCapabilitiesRequest
2733 {
2734 #[inline(always)]
2735 fn new_empty() -> Self {
2736 Self { id: fidl::new_empty!(ExtendedCapabilityId, D) }
2737 }
2738
2739 #[inline]
2740 unsafe fn decode(
2741 &mut self,
2742 decoder: &mut fidl::encoding::Decoder<'_, D>,
2743 offset: usize,
2744 _depth: fidl::encoding::Depth,
2745 ) -> fidl::Result<()> {
2746 decoder.debug_check_bounds::<Self>(offset);
2747 fidl::decode!(ExtendedCapabilityId, D, &mut self.id, decoder, offset + 0, _depth)?;
2749 Ok(())
2750 }
2751 }
2752
2753 impl fidl::encoding::ValueTypeMarker for DeviceGetExtendedCapabilitiesResponse {
2754 type Borrowed<'a> = &'a Self;
2755 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2756 value
2757 }
2758 }
2759
2760 unsafe impl fidl::encoding::TypeMarker for DeviceGetExtendedCapabilitiesResponse {
2761 type Owned = Self;
2762
2763 #[inline(always)]
2764 fn inline_align(_context: fidl::encoding::Context) -> usize {
2765 8
2766 }
2767
2768 #[inline(always)]
2769 fn inline_size(_context: fidl::encoding::Context) -> usize {
2770 16
2771 }
2772 }
2773
2774 unsafe impl<D: fidl::encoding::ResourceDialect>
2775 fidl::encoding::Encode<DeviceGetExtendedCapabilitiesResponse, D>
2776 for &DeviceGetExtendedCapabilitiesResponse
2777 {
2778 #[inline]
2779 unsafe fn encode(
2780 self,
2781 encoder: &mut fidl::encoding::Encoder<'_, D>,
2782 offset: usize,
2783 _depth: fidl::encoding::Depth,
2784 ) -> fidl::Result<()> {
2785 encoder.debug_check_bounds::<DeviceGetExtendedCapabilitiesResponse>(offset);
2786 fidl::encoding::Encode::<DeviceGetExtendedCapabilitiesResponse, D>::encode(
2788 (<fidl::encoding::Vector<u16, 32> as fidl::encoding::ValueTypeMarker>::borrow(
2789 &self.offsets,
2790 ),),
2791 encoder,
2792 offset,
2793 _depth,
2794 )
2795 }
2796 }
2797 unsafe impl<
2798 D: fidl::encoding::ResourceDialect,
2799 T0: fidl::encoding::Encode<fidl::encoding::Vector<u16, 32>, D>,
2800 > fidl::encoding::Encode<DeviceGetExtendedCapabilitiesResponse, D> for (T0,)
2801 {
2802 #[inline]
2803 unsafe fn encode(
2804 self,
2805 encoder: &mut fidl::encoding::Encoder<'_, D>,
2806 offset: usize,
2807 depth: fidl::encoding::Depth,
2808 ) -> fidl::Result<()> {
2809 encoder.debug_check_bounds::<DeviceGetExtendedCapabilitiesResponse>(offset);
2810 self.0.encode(encoder, offset + 0, depth)?;
2814 Ok(())
2815 }
2816 }
2817
2818 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2819 for DeviceGetExtendedCapabilitiesResponse
2820 {
2821 #[inline(always)]
2822 fn new_empty() -> Self {
2823 Self { offsets: fidl::new_empty!(fidl::encoding::Vector<u16, 32>, D) }
2824 }
2825
2826 #[inline]
2827 unsafe fn decode(
2828 &mut self,
2829 decoder: &mut fidl::encoding::Decoder<'_, D>,
2830 offset: usize,
2831 _depth: fidl::encoding::Depth,
2832 ) -> fidl::Result<()> {
2833 decoder.debug_check_bounds::<Self>(offset);
2834 fidl::decode!(fidl::encoding::Vector<u16, 32>, D, &mut self.offsets, decoder, offset + 0, _depth)?;
2836 Ok(())
2837 }
2838 }
2839
2840 impl fidl::encoding::ValueTypeMarker for DeviceGetInterruptModesResponse {
2841 type Borrowed<'a> = &'a Self;
2842 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2843 value
2844 }
2845 }
2846
2847 unsafe impl fidl::encoding::TypeMarker for DeviceGetInterruptModesResponse {
2848 type Owned = Self;
2849
2850 #[inline(always)]
2851 fn inline_align(_context: fidl::encoding::Context) -> usize {
2852 2
2853 }
2854
2855 #[inline(always)]
2856 fn inline_size(_context: fidl::encoding::Context) -> usize {
2857 4
2858 }
2859 }
2860
2861 unsafe impl<D: fidl::encoding::ResourceDialect>
2862 fidl::encoding::Encode<DeviceGetInterruptModesResponse, D>
2863 for &DeviceGetInterruptModesResponse
2864 {
2865 #[inline]
2866 unsafe fn encode(
2867 self,
2868 encoder: &mut fidl::encoding::Encoder<'_, D>,
2869 offset: usize,
2870 _depth: fidl::encoding::Depth,
2871 ) -> fidl::Result<()> {
2872 encoder.debug_check_bounds::<DeviceGetInterruptModesResponse>(offset);
2873 fidl::encoding::Encode::<DeviceGetInterruptModesResponse, D>::encode(
2875 (<InterruptModes as fidl::encoding::ValueTypeMarker>::borrow(&self.modes),),
2876 encoder,
2877 offset,
2878 _depth,
2879 )
2880 }
2881 }
2882 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<InterruptModes, D>>
2883 fidl::encoding::Encode<DeviceGetInterruptModesResponse, D> for (T0,)
2884 {
2885 #[inline]
2886 unsafe fn encode(
2887 self,
2888 encoder: &mut fidl::encoding::Encoder<'_, D>,
2889 offset: usize,
2890 depth: fidl::encoding::Depth,
2891 ) -> fidl::Result<()> {
2892 encoder.debug_check_bounds::<DeviceGetInterruptModesResponse>(offset);
2893 self.0.encode(encoder, offset + 0, depth)?;
2897 Ok(())
2898 }
2899 }
2900
2901 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2902 for DeviceGetInterruptModesResponse
2903 {
2904 #[inline(always)]
2905 fn new_empty() -> Self {
2906 Self { modes: fidl::new_empty!(InterruptModes, D) }
2907 }
2908
2909 #[inline]
2910 unsafe fn decode(
2911 &mut self,
2912 decoder: &mut fidl::encoding::Decoder<'_, D>,
2913 offset: usize,
2914 _depth: fidl::encoding::Depth,
2915 ) -> fidl::Result<()> {
2916 decoder.debug_check_bounds::<Self>(offset);
2917 fidl::decode!(InterruptModes, D, &mut self.modes, decoder, offset + 0, _depth)?;
2919 Ok(())
2920 }
2921 }
2922
2923 impl fidl::encoding::ValueTypeMarker for DeviceInfo {
2924 type Borrowed<'a> = &'a Self;
2925 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2926 value
2927 }
2928 }
2929
2930 unsafe impl fidl::encoding::TypeMarker for DeviceInfo {
2931 type Owned = Self;
2932
2933 #[inline(always)]
2934 fn inline_align(_context: fidl::encoding::Context) -> usize {
2935 2
2936 }
2937
2938 #[inline(always)]
2939 fn inline_size(_context: fidl::encoding::Context) -> usize {
2940 12
2941 }
2942 }
2943
2944 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<DeviceInfo, D>
2945 for &DeviceInfo
2946 {
2947 #[inline]
2948 unsafe fn encode(
2949 self,
2950 encoder: &mut fidl::encoding::Encoder<'_, D>,
2951 offset: usize,
2952 _depth: fidl::encoding::Depth,
2953 ) -> fidl::Result<()> {
2954 encoder.debug_check_bounds::<DeviceInfo>(offset);
2955 fidl::encoding::Encode::<DeviceInfo, D>::encode(
2957 (
2958 <u16 as fidl::encoding::ValueTypeMarker>::borrow(&self.vendor_id),
2959 <u16 as fidl::encoding::ValueTypeMarker>::borrow(&self.device_id),
2960 <u8 as fidl::encoding::ValueTypeMarker>::borrow(&self.base_class),
2961 <u8 as fidl::encoding::ValueTypeMarker>::borrow(&self.sub_class),
2962 <u8 as fidl::encoding::ValueTypeMarker>::borrow(&self.program_interface),
2963 <u8 as fidl::encoding::ValueTypeMarker>::borrow(&self.revision_id),
2964 <u8 as fidl::encoding::ValueTypeMarker>::borrow(&self.bus_id),
2965 <u8 as fidl::encoding::ValueTypeMarker>::borrow(&self.dev_id),
2966 <u8 as fidl::encoding::ValueTypeMarker>::borrow(&self.func_id),
2967 <Padding as fidl::encoding::ValueTypeMarker>::borrow(&self.padding),
2968 ),
2969 encoder,
2970 offset,
2971 _depth,
2972 )
2973 }
2974 }
2975 unsafe impl<
2976 D: fidl::encoding::ResourceDialect,
2977 T0: fidl::encoding::Encode<u16, D>,
2978 T1: fidl::encoding::Encode<u16, D>,
2979 T2: fidl::encoding::Encode<u8, D>,
2980 T3: fidl::encoding::Encode<u8, D>,
2981 T4: fidl::encoding::Encode<u8, D>,
2982 T5: fidl::encoding::Encode<u8, D>,
2983 T6: fidl::encoding::Encode<u8, D>,
2984 T7: fidl::encoding::Encode<u8, D>,
2985 T8: fidl::encoding::Encode<u8, D>,
2986 T9: fidl::encoding::Encode<Padding, D>,
2987 > fidl::encoding::Encode<DeviceInfo, D> for (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9)
2988 {
2989 #[inline]
2990 unsafe fn encode(
2991 self,
2992 encoder: &mut fidl::encoding::Encoder<'_, D>,
2993 offset: usize,
2994 depth: fidl::encoding::Depth,
2995 ) -> fidl::Result<()> {
2996 encoder.debug_check_bounds::<DeviceInfo>(offset);
2997 self.0.encode(encoder, offset + 0, depth)?;
3001 self.1.encode(encoder, offset + 2, depth)?;
3002 self.2.encode(encoder, offset + 4, depth)?;
3003 self.3.encode(encoder, offset + 5, depth)?;
3004 self.4.encode(encoder, offset + 6, depth)?;
3005 self.5.encode(encoder, offset + 7, depth)?;
3006 self.6.encode(encoder, offset + 8, depth)?;
3007 self.7.encode(encoder, offset + 9, depth)?;
3008 self.8.encode(encoder, offset + 10, depth)?;
3009 self.9.encode(encoder, offset + 11, depth)?;
3010 Ok(())
3011 }
3012 }
3013
3014 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for DeviceInfo {
3015 #[inline(always)]
3016 fn new_empty() -> Self {
3017 Self {
3018 vendor_id: fidl::new_empty!(u16, D),
3019 device_id: fidl::new_empty!(u16, D),
3020 base_class: fidl::new_empty!(u8, D),
3021 sub_class: fidl::new_empty!(u8, D),
3022 program_interface: fidl::new_empty!(u8, D),
3023 revision_id: fidl::new_empty!(u8, D),
3024 bus_id: fidl::new_empty!(u8, D),
3025 dev_id: fidl::new_empty!(u8, D),
3026 func_id: fidl::new_empty!(u8, D),
3027 padding: fidl::new_empty!(Padding, D),
3028 }
3029 }
3030
3031 #[inline]
3032 unsafe fn decode(
3033 &mut self,
3034 decoder: &mut fidl::encoding::Decoder<'_, D>,
3035 offset: usize,
3036 _depth: fidl::encoding::Depth,
3037 ) -> fidl::Result<()> {
3038 decoder.debug_check_bounds::<Self>(offset);
3039 fidl::decode!(u16, D, &mut self.vendor_id, decoder, offset + 0, _depth)?;
3041 fidl::decode!(u16, D, &mut self.device_id, decoder, offset + 2, _depth)?;
3042 fidl::decode!(u8, D, &mut self.base_class, decoder, offset + 4, _depth)?;
3043 fidl::decode!(u8, D, &mut self.sub_class, decoder, offset + 5, _depth)?;
3044 fidl::decode!(u8, D, &mut self.program_interface, decoder, offset + 6, _depth)?;
3045 fidl::decode!(u8, D, &mut self.revision_id, decoder, offset + 7, _depth)?;
3046 fidl::decode!(u8, D, &mut self.bus_id, decoder, offset + 8, _depth)?;
3047 fidl::decode!(u8, D, &mut self.dev_id, decoder, offset + 9, _depth)?;
3048 fidl::decode!(u8, D, &mut self.func_id, decoder, offset + 10, _depth)?;
3049 fidl::decode!(Padding, D, &mut self.padding, decoder, offset + 11, _depth)?;
3050 Ok(())
3051 }
3052 }
3053
3054 impl fidl::encoding::ValueTypeMarker for DeviceMapInterruptRequest {
3055 type Borrowed<'a> = &'a Self;
3056 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3057 value
3058 }
3059 }
3060
3061 unsafe impl fidl::encoding::TypeMarker for DeviceMapInterruptRequest {
3062 type Owned = Self;
3063
3064 #[inline(always)]
3065 fn inline_align(_context: fidl::encoding::Context) -> usize {
3066 4
3067 }
3068
3069 #[inline(always)]
3070 fn inline_size(_context: fidl::encoding::Context) -> usize {
3071 4
3072 }
3073 #[inline(always)]
3074 fn encode_is_copy() -> bool {
3075 true
3076 }
3077
3078 #[inline(always)]
3079 fn decode_is_copy() -> bool {
3080 true
3081 }
3082 }
3083
3084 unsafe impl<D: fidl::encoding::ResourceDialect>
3085 fidl::encoding::Encode<DeviceMapInterruptRequest, D> for &DeviceMapInterruptRequest
3086 {
3087 #[inline]
3088 unsafe fn encode(
3089 self,
3090 encoder: &mut fidl::encoding::Encoder<'_, D>,
3091 offset: usize,
3092 _depth: fidl::encoding::Depth,
3093 ) -> fidl::Result<()> {
3094 encoder.debug_check_bounds::<DeviceMapInterruptRequest>(offset);
3095 unsafe {
3096 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
3098 (buf_ptr as *mut DeviceMapInterruptRequest)
3099 .write_unaligned((self as *const DeviceMapInterruptRequest).read());
3100 }
3103 Ok(())
3104 }
3105 }
3106 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u32, D>>
3107 fidl::encoding::Encode<DeviceMapInterruptRequest, D> for (T0,)
3108 {
3109 #[inline]
3110 unsafe fn encode(
3111 self,
3112 encoder: &mut fidl::encoding::Encoder<'_, D>,
3113 offset: usize,
3114 depth: fidl::encoding::Depth,
3115 ) -> fidl::Result<()> {
3116 encoder.debug_check_bounds::<DeviceMapInterruptRequest>(offset);
3117 self.0.encode(encoder, offset + 0, depth)?;
3121 Ok(())
3122 }
3123 }
3124
3125 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3126 for DeviceMapInterruptRequest
3127 {
3128 #[inline(always)]
3129 fn new_empty() -> Self {
3130 Self { which_irq: fidl::new_empty!(u32, D) }
3131 }
3132
3133 #[inline]
3134 unsafe fn decode(
3135 &mut self,
3136 decoder: &mut fidl::encoding::Decoder<'_, D>,
3137 offset: usize,
3138 _depth: fidl::encoding::Depth,
3139 ) -> fidl::Result<()> {
3140 decoder.debug_check_bounds::<Self>(offset);
3141 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
3142 unsafe {
3145 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
3146 }
3147 Ok(())
3148 }
3149 }
3150
3151 impl fidl::encoding::ValueTypeMarker for DeviceReadConfig16Request {
3152 type Borrowed<'a> = &'a Self;
3153 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3154 value
3155 }
3156 }
3157
3158 unsafe impl fidl::encoding::TypeMarker for DeviceReadConfig16Request {
3159 type Owned = Self;
3160
3161 #[inline(always)]
3162 fn inline_align(_context: fidl::encoding::Context) -> usize {
3163 2
3164 }
3165
3166 #[inline(always)]
3167 fn inline_size(_context: fidl::encoding::Context) -> usize {
3168 2
3169 }
3170 #[inline(always)]
3171 fn encode_is_copy() -> bool {
3172 true
3173 }
3174
3175 #[inline(always)]
3176 fn decode_is_copy() -> bool {
3177 true
3178 }
3179 }
3180
3181 unsafe impl<D: fidl::encoding::ResourceDialect>
3182 fidl::encoding::Encode<DeviceReadConfig16Request, D> for &DeviceReadConfig16Request
3183 {
3184 #[inline]
3185 unsafe fn encode(
3186 self,
3187 encoder: &mut fidl::encoding::Encoder<'_, D>,
3188 offset: usize,
3189 _depth: fidl::encoding::Depth,
3190 ) -> fidl::Result<()> {
3191 encoder.debug_check_bounds::<DeviceReadConfig16Request>(offset);
3192 unsafe {
3193 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
3195 (buf_ptr as *mut DeviceReadConfig16Request)
3196 .write_unaligned((self as *const DeviceReadConfig16Request).read());
3197 }
3200 Ok(())
3201 }
3202 }
3203 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u16, D>>
3204 fidl::encoding::Encode<DeviceReadConfig16Request, D> for (T0,)
3205 {
3206 #[inline]
3207 unsafe fn encode(
3208 self,
3209 encoder: &mut fidl::encoding::Encoder<'_, D>,
3210 offset: usize,
3211 depth: fidl::encoding::Depth,
3212 ) -> fidl::Result<()> {
3213 encoder.debug_check_bounds::<DeviceReadConfig16Request>(offset);
3214 self.0.encode(encoder, offset + 0, depth)?;
3218 Ok(())
3219 }
3220 }
3221
3222 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3223 for DeviceReadConfig16Request
3224 {
3225 #[inline(always)]
3226 fn new_empty() -> Self {
3227 Self { offset: fidl::new_empty!(u16, D) }
3228 }
3229
3230 #[inline]
3231 unsafe fn decode(
3232 &mut self,
3233 decoder: &mut fidl::encoding::Decoder<'_, D>,
3234 offset: usize,
3235 _depth: fidl::encoding::Depth,
3236 ) -> fidl::Result<()> {
3237 decoder.debug_check_bounds::<Self>(offset);
3238 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
3239 unsafe {
3242 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 2);
3243 }
3244 Ok(())
3245 }
3246 }
3247
3248 impl fidl::encoding::ValueTypeMarker for DeviceReadConfig32Request {
3249 type Borrowed<'a> = &'a Self;
3250 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3251 value
3252 }
3253 }
3254
3255 unsafe impl fidl::encoding::TypeMarker for DeviceReadConfig32Request {
3256 type Owned = Self;
3257
3258 #[inline(always)]
3259 fn inline_align(_context: fidl::encoding::Context) -> usize {
3260 2
3261 }
3262
3263 #[inline(always)]
3264 fn inline_size(_context: fidl::encoding::Context) -> usize {
3265 2
3266 }
3267 #[inline(always)]
3268 fn encode_is_copy() -> bool {
3269 true
3270 }
3271
3272 #[inline(always)]
3273 fn decode_is_copy() -> bool {
3274 true
3275 }
3276 }
3277
3278 unsafe impl<D: fidl::encoding::ResourceDialect>
3279 fidl::encoding::Encode<DeviceReadConfig32Request, D> for &DeviceReadConfig32Request
3280 {
3281 #[inline]
3282 unsafe fn encode(
3283 self,
3284 encoder: &mut fidl::encoding::Encoder<'_, D>,
3285 offset: usize,
3286 _depth: fidl::encoding::Depth,
3287 ) -> fidl::Result<()> {
3288 encoder.debug_check_bounds::<DeviceReadConfig32Request>(offset);
3289 unsafe {
3290 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
3292 (buf_ptr as *mut DeviceReadConfig32Request)
3293 .write_unaligned((self as *const DeviceReadConfig32Request).read());
3294 }
3297 Ok(())
3298 }
3299 }
3300 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u16, D>>
3301 fidl::encoding::Encode<DeviceReadConfig32Request, D> for (T0,)
3302 {
3303 #[inline]
3304 unsafe fn encode(
3305 self,
3306 encoder: &mut fidl::encoding::Encoder<'_, D>,
3307 offset: usize,
3308 depth: fidl::encoding::Depth,
3309 ) -> fidl::Result<()> {
3310 encoder.debug_check_bounds::<DeviceReadConfig32Request>(offset);
3311 self.0.encode(encoder, offset + 0, depth)?;
3315 Ok(())
3316 }
3317 }
3318
3319 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3320 for DeviceReadConfig32Request
3321 {
3322 #[inline(always)]
3323 fn new_empty() -> Self {
3324 Self { offset: fidl::new_empty!(u16, D) }
3325 }
3326
3327 #[inline]
3328 unsafe fn decode(
3329 &mut self,
3330 decoder: &mut fidl::encoding::Decoder<'_, D>,
3331 offset: usize,
3332 _depth: fidl::encoding::Depth,
3333 ) -> fidl::Result<()> {
3334 decoder.debug_check_bounds::<Self>(offset);
3335 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
3336 unsafe {
3339 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 2);
3340 }
3341 Ok(())
3342 }
3343 }
3344
3345 impl fidl::encoding::ValueTypeMarker for DeviceReadConfig8Request {
3346 type Borrowed<'a> = &'a Self;
3347 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3348 value
3349 }
3350 }
3351
3352 unsafe impl fidl::encoding::TypeMarker for DeviceReadConfig8Request {
3353 type Owned = Self;
3354
3355 #[inline(always)]
3356 fn inline_align(_context: fidl::encoding::Context) -> usize {
3357 2
3358 }
3359
3360 #[inline(always)]
3361 fn inline_size(_context: fidl::encoding::Context) -> usize {
3362 2
3363 }
3364 #[inline(always)]
3365 fn encode_is_copy() -> bool {
3366 true
3367 }
3368
3369 #[inline(always)]
3370 fn decode_is_copy() -> bool {
3371 true
3372 }
3373 }
3374
3375 unsafe impl<D: fidl::encoding::ResourceDialect>
3376 fidl::encoding::Encode<DeviceReadConfig8Request, D> for &DeviceReadConfig8Request
3377 {
3378 #[inline]
3379 unsafe fn encode(
3380 self,
3381 encoder: &mut fidl::encoding::Encoder<'_, D>,
3382 offset: usize,
3383 _depth: fidl::encoding::Depth,
3384 ) -> fidl::Result<()> {
3385 encoder.debug_check_bounds::<DeviceReadConfig8Request>(offset);
3386 unsafe {
3387 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
3389 (buf_ptr as *mut DeviceReadConfig8Request)
3390 .write_unaligned((self as *const DeviceReadConfig8Request).read());
3391 }
3394 Ok(())
3395 }
3396 }
3397 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u16, D>>
3398 fidl::encoding::Encode<DeviceReadConfig8Request, D> for (T0,)
3399 {
3400 #[inline]
3401 unsafe fn encode(
3402 self,
3403 encoder: &mut fidl::encoding::Encoder<'_, D>,
3404 offset: usize,
3405 depth: fidl::encoding::Depth,
3406 ) -> fidl::Result<()> {
3407 encoder.debug_check_bounds::<DeviceReadConfig8Request>(offset);
3408 self.0.encode(encoder, offset + 0, depth)?;
3412 Ok(())
3413 }
3414 }
3415
3416 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3417 for DeviceReadConfig8Request
3418 {
3419 #[inline(always)]
3420 fn new_empty() -> Self {
3421 Self { offset: fidl::new_empty!(u16, D) }
3422 }
3423
3424 #[inline]
3425 unsafe fn decode(
3426 &mut self,
3427 decoder: &mut fidl::encoding::Decoder<'_, D>,
3428 offset: usize,
3429 _depth: fidl::encoding::Depth,
3430 ) -> fidl::Result<()> {
3431 decoder.debug_check_bounds::<Self>(offset);
3432 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
3433 unsafe {
3436 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 2);
3437 }
3438 Ok(())
3439 }
3440 }
3441
3442 impl fidl::encoding::ValueTypeMarker for DeviceSetBusMasteringRequest {
3443 type Borrowed<'a> = &'a Self;
3444 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3445 value
3446 }
3447 }
3448
3449 unsafe impl fidl::encoding::TypeMarker for DeviceSetBusMasteringRequest {
3450 type Owned = Self;
3451
3452 #[inline(always)]
3453 fn inline_align(_context: fidl::encoding::Context) -> usize {
3454 1
3455 }
3456
3457 #[inline(always)]
3458 fn inline_size(_context: fidl::encoding::Context) -> usize {
3459 1
3460 }
3461 }
3462
3463 unsafe impl<D: fidl::encoding::ResourceDialect>
3464 fidl::encoding::Encode<DeviceSetBusMasteringRequest, D> for &DeviceSetBusMasteringRequest
3465 {
3466 #[inline]
3467 unsafe fn encode(
3468 self,
3469 encoder: &mut fidl::encoding::Encoder<'_, D>,
3470 offset: usize,
3471 _depth: fidl::encoding::Depth,
3472 ) -> fidl::Result<()> {
3473 encoder.debug_check_bounds::<DeviceSetBusMasteringRequest>(offset);
3474 fidl::encoding::Encode::<DeviceSetBusMasteringRequest, D>::encode(
3476 (<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.enabled),),
3477 encoder,
3478 offset,
3479 _depth,
3480 )
3481 }
3482 }
3483 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<bool, D>>
3484 fidl::encoding::Encode<DeviceSetBusMasteringRequest, D> for (T0,)
3485 {
3486 #[inline]
3487 unsafe fn encode(
3488 self,
3489 encoder: &mut fidl::encoding::Encoder<'_, D>,
3490 offset: usize,
3491 depth: fidl::encoding::Depth,
3492 ) -> fidl::Result<()> {
3493 encoder.debug_check_bounds::<DeviceSetBusMasteringRequest>(offset);
3494 self.0.encode(encoder, offset + 0, depth)?;
3498 Ok(())
3499 }
3500 }
3501
3502 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3503 for DeviceSetBusMasteringRequest
3504 {
3505 #[inline(always)]
3506 fn new_empty() -> Self {
3507 Self { enabled: fidl::new_empty!(bool, D) }
3508 }
3509
3510 #[inline]
3511 unsafe fn decode(
3512 &mut self,
3513 decoder: &mut fidl::encoding::Decoder<'_, D>,
3514 offset: usize,
3515 _depth: fidl::encoding::Depth,
3516 ) -> fidl::Result<()> {
3517 decoder.debug_check_bounds::<Self>(offset);
3518 fidl::decode!(bool, D, &mut self.enabled, decoder, offset + 0, _depth)?;
3520 Ok(())
3521 }
3522 }
3523
3524 impl fidl::encoding::ValueTypeMarker for DeviceSetInterruptModeRequest {
3525 type Borrowed<'a> = &'a Self;
3526 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3527 value
3528 }
3529 }
3530
3531 unsafe impl fidl::encoding::TypeMarker for DeviceSetInterruptModeRequest {
3532 type Owned = Self;
3533
3534 #[inline(always)]
3535 fn inline_align(_context: fidl::encoding::Context) -> usize {
3536 4
3537 }
3538
3539 #[inline(always)]
3540 fn inline_size(_context: fidl::encoding::Context) -> usize {
3541 8
3542 }
3543 }
3544
3545 unsafe impl<D: fidl::encoding::ResourceDialect>
3546 fidl::encoding::Encode<DeviceSetInterruptModeRequest, D>
3547 for &DeviceSetInterruptModeRequest
3548 {
3549 #[inline]
3550 unsafe fn encode(
3551 self,
3552 encoder: &mut fidl::encoding::Encoder<'_, D>,
3553 offset: usize,
3554 _depth: fidl::encoding::Depth,
3555 ) -> fidl::Result<()> {
3556 encoder.debug_check_bounds::<DeviceSetInterruptModeRequest>(offset);
3557 fidl::encoding::Encode::<DeviceSetInterruptModeRequest, D>::encode(
3559 (
3560 <InterruptMode as fidl::encoding::ValueTypeMarker>::borrow(&self.mode),
3561 <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.requested_irq_count),
3562 ),
3563 encoder,
3564 offset,
3565 _depth,
3566 )
3567 }
3568 }
3569 unsafe impl<
3570 D: fidl::encoding::ResourceDialect,
3571 T0: fidl::encoding::Encode<InterruptMode, D>,
3572 T1: fidl::encoding::Encode<u32, D>,
3573 > fidl::encoding::Encode<DeviceSetInterruptModeRequest, D> for (T0, T1)
3574 {
3575 #[inline]
3576 unsafe fn encode(
3577 self,
3578 encoder: &mut fidl::encoding::Encoder<'_, D>,
3579 offset: usize,
3580 depth: fidl::encoding::Depth,
3581 ) -> fidl::Result<()> {
3582 encoder.debug_check_bounds::<DeviceSetInterruptModeRequest>(offset);
3583 unsafe {
3586 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
3587 (ptr as *mut u32).write_unaligned(0);
3588 }
3589 self.0.encode(encoder, offset + 0, depth)?;
3591 self.1.encode(encoder, offset + 4, depth)?;
3592 Ok(())
3593 }
3594 }
3595
3596 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3597 for DeviceSetInterruptModeRequest
3598 {
3599 #[inline(always)]
3600 fn new_empty() -> Self {
3601 Self {
3602 mode: fidl::new_empty!(InterruptMode, D),
3603 requested_irq_count: fidl::new_empty!(u32, D),
3604 }
3605 }
3606
3607 #[inline]
3608 unsafe fn decode(
3609 &mut self,
3610 decoder: &mut fidl::encoding::Decoder<'_, D>,
3611 offset: usize,
3612 _depth: fidl::encoding::Depth,
3613 ) -> fidl::Result<()> {
3614 decoder.debug_check_bounds::<Self>(offset);
3615 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
3617 let padval = unsafe { (ptr as *const u32).read_unaligned() };
3618 let mask = 0xffffff00u32;
3619 let maskedval = padval & mask;
3620 if maskedval != 0 {
3621 return Err(fidl::Error::NonZeroPadding {
3622 padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
3623 });
3624 }
3625 fidl::decode!(InterruptMode, D, &mut self.mode, decoder, offset + 0, _depth)?;
3626 fidl::decode!(u32, D, &mut self.requested_irq_count, decoder, offset + 4, _depth)?;
3627 Ok(())
3628 }
3629 }
3630
3631 impl fidl::encoding::ValueTypeMarker for DeviceWriteConfig16Request {
3632 type Borrowed<'a> = &'a Self;
3633 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3634 value
3635 }
3636 }
3637
3638 unsafe impl fidl::encoding::TypeMarker for DeviceWriteConfig16Request {
3639 type Owned = Self;
3640
3641 #[inline(always)]
3642 fn inline_align(_context: fidl::encoding::Context) -> usize {
3643 2
3644 }
3645
3646 #[inline(always)]
3647 fn inline_size(_context: fidl::encoding::Context) -> usize {
3648 4
3649 }
3650 #[inline(always)]
3651 fn encode_is_copy() -> bool {
3652 true
3653 }
3654
3655 #[inline(always)]
3656 fn decode_is_copy() -> bool {
3657 true
3658 }
3659 }
3660
3661 unsafe impl<D: fidl::encoding::ResourceDialect>
3662 fidl::encoding::Encode<DeviceWriteConfig16Request, D> for &DeviceWriteConfig16Request
3663 {
3664 #[inline]
3665 unsafe fn encode(
3666 self,
3667 encoder: &mut fidl::encoding::Encoder<'_, D>,
3668 offset: usize,
3669 _depth: fidl::encoding::Depth,
3670 ) -> fidl::Result<()> {
3671 encoder.debug_check_bounds::<DeviceWriteConfig16Request>(offset);
3672 unsafe {
3673 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
3675 (buf_ptr as *mut DeviceWriteConfig16Request)
3676 .write_unaligned((self as *const DeviceWriteConfig16Request).read());
3677 }
3680 Ok(())
3681 }
3682 }
3683 unsafe impl<
3684 D: fidl::encoding::ResourceDialect,
3685 T0: fidl::encoding::Encode<u16, D>,
3686 T1: fidl::encoding::Encode<u16, D>,
3687 > fidl::encoding::Encode<DeviceWriteConfig16Request, D> for (T0, T1)
3688 {
3689 #[inline]
3690 unsafe fn encode(
3691 self,
3692 encoder: &mut fidl::encoding::Encoder<'_, D>,
3693 offset: usize,
3694 depth: fidl::encoding::Depth,
3695 ) -> fidl::Result<()> {
3696 encoder.debug_check_bounds::<DeviceWriteConfig16Request>(offset);
3697 self.0.encode(encoder, offset + 0, depth)?;
3701 self.1.encode(encoder, offset + 2, depth)?;
3702 Ok(())
3703 }
3704 }
3705
3706 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3707 for DeviceWriteConfig16Request
3708 {
3709 #[inline(always)]
3710 fn new_empty() -> Self {
3711 Self { offset: fidl::new_empty!(u16, D), value: fidl::new_empty!(u16, D) }
3712 }
3713
3714 #[inline]
3715 unsafe fn decode(
3716 &mut self,
3717 decoder: &mut fidl::encoding::Decoder<'_, D>,
3718 offset: usize,
3719 _depth: fidl::encoding::Depth,
3720 ) -> fidl::Result<()> {
3721 decoder.debug_check_bounds::<Self>(offset);
3722 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
3723 unsafe {
3726 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
3727 }
3728 Ok(())
3729 }
3730 }
3731
3732 impl fidl::encoding::ValueTypeMarker for DeviceWriteConfig32Request {
3733 type Borrowed<'a> = &'a Self;
3734 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3735 value
3736 }
3737 }
3738
3739 unsafe impl fidl::encoding::TypeMarker for DeviceWriteConfig32Request {
3740 type Owned = Self;
3741
3742 #[inline(always)]
3743 fn inline_align(_context: fidl::encoding::Context) -> usize {
3744 4
3745 }
3746
3747 #[inline(always)]
3748 fn inline_size(_context: fidl::encoding::Context) -> usize {
3749 8
3750 }
3751 }
3752
3753 unsafe impl<D: fidl::encoding::ResourceDialect>
3754 fidl::encoding::Encode<DeviceWriteConfig32Request, D> for &DeviceWriteConfig32Request
3755 {
3756 #[inline]
3757 unsafe fn encode(
3758 self,
3759 encoder: &mut fidl::encoding::Encoder<'_, D>,
3760 offset: usize,
3761 _depth: fidl::encoding::Depth,
3762 ) -> fidl::Result<()> {
3763 encoder.debug_check_bounds::<DeviceWriteConfig32Request>(offset);
3764 unsafe {
3765 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
3767 (buf_ptr as *mut DeviceWriteConfig32Request)
3768 .write_unaligned((self as *const DeviceWriteConfig32Request).read());
3769 let padding_ptr = buf_ptr.offset(0) as *mut u32;
3772 let padding_mask = 0xffff0000u32;
3773 padding_ptr.write_unaligned(padding_ptr.read_unaligned() & !padding_mask);
3774 }
3775 Ok(())
3776 }
3777 }
3778 unsafe impl<
3779 D: fidl::encoding::ResourceDialect,
3780 T0: fidl::encoding::Encode<u16, D>,
3781 T1: fidl::encoding::Encode<u32, D>,
3782 > fidl::encoding::Encode<DeviceWriteConfig32Request, D> for (T0, T1)
3783 {
3784 #[inline]
3785 unsafe fn encode(
3786 self,
3787 encoder: &mut fidl::encoding::Encoder<'_, D>,
3788 offset: usize,
3789 depth: fidl::encoding::Depth,
3790 ) -> fidl::Result<()> {
3791 encoder.debug_check_bounds::<DeviceWriteConfig32Request>(offset);
3792 unsafe {
3795 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
3796 (ptr as *mut u32).write_unaligned(0);
3797 }
3798 self.0.encode(encoder, offset + 0, depth)?;
3800 self.1.encode(encoder, offset + 4, depth)?;
3801 Ok(())
3802 }
3803 }
3804
3805 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3806 for DeviceWriteConfig32Request
3807 {
3808 #[inline(always)]
3809 fn new_empty() -> Self {
3810 Self { offset: fidl::new_empty!(u16, D), value: fidl::new_empty!(u32, D) }
3811 }
3812
3813 #[inline]
3814 unsafe fn decode(
3815 &mut self,
3816 decoder: &mut fidl::encoding::Decoder<'_, D>,
3817 offset: usize,
3818 _depth: fidl::encoding::Depth,
3819 ) -> fidl::Result<()> {
3820 decoder.debug_check_bounds::<Self>(offset);
3821 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
3822 let ptr = unsafe { buf_ptr.offset(0) };
3824 let padval = unsafe { (ptr as *const u32).read_unaligned() };
3825 let mask = 0xffff0000u32;
3826 let maskedval = padval & mask;
3827 if maskedval != 0 {
3828 return Err(fidl::Error::NonZeroPadding {
3829 padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
3830 });
3831 }
3832 unsafe {
3834 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
3835 }
3836 Ok(())
3837 }
3838 }
3839
3840 impl fidl::encoding::ValueTypeMarker for DeviceWriteConfig8Request {
3841 type Borrowed<'a> = &'a Self;
3842 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3843 value
3844 }
3845 }
3846
3847 unsafe impl fidl::encoding::TypeMarker for DeviceWriteConfig8Request {
3848 type Owned = Self;
3849
3850 #[inline(always)]
3851 fn inline_align(_context: fidl::encoding::Context) -> usize {
3852 2
3853 }
3854
3855 #[inline(always)]
3856 fn inline_size(_context: fidl::encoding::Context) -> usize {
3857 4
3858 }
3859 }
3860
3861 unsafe impl<D: fidl::encoding::ResourceDialect>
3862 fidl::encoding::Encode<DeviceWriteConfig8Request, D> for &DeviceWriteConfig8Request
3863 {
3864 #[inline]
3865 unsafe fn encode(
3866 self,
3867 encoder: &mut fidl::encoding::Encoder<'_, D>,
3868 offset: usize,
3869 _depth: fidl::encoding::Depth,
3870 ) -> fidl::Result<()> {
3871 encoder.debug_check_bounds::<DeviceWriteConfig8Request>(offset);
3872 unsafe {
3873 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
3875 (buf_ptr as *mut DeviceWriteConfig8Request)
3876 .write_unaligned((self as *const DeviceWriteConfig8Request).read());
3877 let padding_ptr = buf_ptr.offset(2) as *mut u16;
3880 let padding_mask = 0xff00u16;
3881 padding_ptr.write_unaligned(padding_ptr.read_unaligned() & !padding_mask);
3882 }
3883 Ok(())
3884 }
3885 }
3886 unsafe impl<
3887 D: fidl::encoding::ResourceDialect,
3888 T0: fidl::encoding::Encode<u16, D>,
3889 T1: fidl::encoding::Encode<u8, D>,
3890 > fidl::encoding::Encode<DeviceWriteConfig8Request, D> for (T0, T1)
3891 {
3892 #[inline]
3893 unsafe fn encode(
3894 self,
3895 encoder: &mut fidl::encoding::Encoder<'_, D>,
3896 offset: usize,
3897 depth: fidl::encoding::Depth,
3898 ) -> fidl::Result<()> {
3899 encoder.debug_check_bounds::<DeviceWriteConfig8Request>(offset);
3900 unsafe {
3903 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(2);
3904 (ptr as *mut u16).write_unaligned(0);
3905 }
3906 self.0.encode(encoder, offset + 0, depth)?;
3908 self.1.encode(encoder, offset + 2, depth)?;
3909 Ok(())
3910 }
3911 }
3912
3913 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3914 for DeviceWriteConfig8Request
3915 {
3916 #[inline(always)]
3917 fn new_empty() -> Self {
3918 Self { offset: fidl::new_empty!(u16, D), value: fidl::new_empty!(u8, D) }
3919 }
3920
3921 #[inline]
3922 unsafe fn decode(
3923 &mut self,
3924 decoder: &mut fidl::encoding::Decoder<'_, D>,
3925 offset: usize,
3926 _depth: fidl::encoding::Depth,
3927 ) -> fidl::Result<()> {
3928 decoder.debug_check_bounds::<Self>(offset);
3929 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
3930 let ptr = unsafe { buf_ptr.offset(2) };
3932 let padval = unsafe { (ptr as *const u16).read_unaligned() };
3933 let mask = 0xff00u16;
3934 let maskedval = padval & mask;
3935 if maskedval != 0 {
3936 return Err(fidl::Error::NonZeroPadding {
3937 padding_start: offset + 2 + ((mask as u64).trailing_zeros() / 8) as usize,
3938 });
3939 }
3940 unsafe {
3942 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
3943 }
3944 Ok(())
3945 }
3946 }
3947
3948 impl fidl::encoding::ValueTypeMarker for DeviceReadConfig16Response {
3949 type Borrowed<'a> = &'a Self;
3950 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3951 value
3952 }
3953 }
3954
3955 unsafe impl fidl::encoding::TypeMarker for DeviceReadConfig16Response {
3956 type Owned = Self;
3957
3958 #[inline(always)]
3959 fn inline_align(_context: fidl::encoding::Context) -> usize {
3960 2
3961 }
3962
3963 #[inline(always)]
3964 fn inline_size(_context: fidl::encoding::Context) -> usize {
3965 2
3966 }
3967 #[inline(always)]
3968 fn encode_is_copy() -> bool {
3969 true
3970 }
3971
3972 #[inline(always)]
3973 fn decode_is_copy() -> bool {
3974 true
3975 }
3976 }
3977
3978 unsafe impl<D: fidl::encoding::ResourceDialect>
3979 fidl::encoding::Encode<DeviceReadConfig16Response, D> for &DeviceReadConfig16Response
3980 {
3981 #[inline]
3982 unsafe fn encode(
3983 self,
3984 encoder: &mut fidl::encoding::Encoder<'_, D>,
3985 offset: usize,
3986 _depth: fidl::encoding::Depth,
3987 ) -> fidl::Result<()> {
3988 encoder.debug_check_bounds::<DeviceReadConfig16Response>(offset);
3989 unsafe {
3990 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
3992 (buf_ptr as *mut DeviceReadConfig16Response)
3993 .write_unaligned((self as *const DeviceReadConfig16Response).read());
3994 }
3997 Ok(())
3998 }
3999 }
4000 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u16, D>>
4001 fidl::encoding::Encode<DeviceReadConfig16Response, D> for (T0,)
4002 {
4003 #[inline]
4004 unsafe fn encode(
4005 self,
4006 encoder: &mut fidl::encoding::Encoder<'_, D>,
4007 offset: usize,
4008 depth: fidl::encoding::Depth,
4009 ) -> fidl::Result<()> {
4010 encoder.debug_check_bounds::<DeviceReadConfig16Response>(offset);
4011 self.0.encode(encoder, offset + 0, depth)?;
4015 Ok(())
4016 }
4017 }
4018
4019 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
4020 for DeviceReadConfig16Response
4021 {
4022 #[inline(always)]
4023 fn new_empty() -> Self {
4024 Self { value: fidl::new_empty!(u16, D) }
4025 }
4026
4027 #[inline]
4028 unsafe fn decode(
4029 &mut self,
4030 decoder: &mut fidl::encoding::Decoder<'_, D>,
4031 offset: usize,
4032 _depth: fidl::encoding::Depth,
4033 ) -> fidl::Result<()> {
4034 decoder.debug_check_bounds::<Self>(offset);
4035 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
4036 unsafe {
4039 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 2);
4040 }
4041 Ok(())
4042 }
4043 }
4044
4045 impl fidl::encoding::ValueTypeMarker for DeviceReadConfig32Response {
4046 type Borrowed<'a> = &'a Self;
4047 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4048 value
4049 }
4050 }
4051
4052 unsafe impl fidl::encoding::TypeMarker for DeviceReadConfig32Response {
4053 type Owned = Self;
4054
4055 #[inline(always)]
4056 fn inline_align(_context: fidl::encoding::Context) -> usize {
4057 4
4058 }
4059
4060 #[inline(always)]
4061 fn inline_size(_context: fidl::encoding::Context) -> usize {
4062 4
4063 }
4064 #[inline(always)]
4065 fn encode_is_copy() -> bool {
4066 true
4067 }
4068
4069 #[inline(always)]
4070 fn decode_is_copy() -> bool {
4071 true
4072 }
4073 }
4074
4075 unsafe impl<D: fidl::encoding::ResourceDialect>
4076 fidl::encoding::Encode<DeviceReadConfig32Response, D> for &DeviceReadConfig32Response
4077 {
4078 #[inline]
4079 unsafe fn encode(
4080 self,
4081 encoder: &mut fidl::encoding::Encoder<'_, D>,
4082 offset: usize,
4083 _depth: fidl::encoding::Depth,
4084 ) -> fidl::Result<()> {
4085 encoder.debug_check_bounds::<DeviceReadConfig32Response>(offset);
4086 unsafe {
4087 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
4089 (buf_ptr as *mut DeviceReadConfig32Response)
4090 .write_unaligned((self as *const DeviceReadConfig32Response).read());
4091 }
4094 Ok(())
4095 }
4096 }
4097 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u32, D>>
4098 fidl::encoding::Encode<DeviceReadConfig32Response, D> for (T0,)
4099 {
4100 #[inline]
4101 unsafe fn encode(
4102 self,
4103 encoder: &mut fidl::encoding::Encoder<'_, D>,
4104 offset: usize,
4105 depth: fidl::encoding::Depth,
4106 ) -> fidl::Result<()> {
4107 encoder.debug_check_bounds::<DeviceReadConfig32Response>(offset);
4108 self.0.encode(encoder, offset + 0, depth)?;
4112 Ok(())
4113 }
4114 }
4115
4116 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
4117 for DeviceReadConfig32Response
4118 {
4119 #[inline(always)]
4120 fn new_empty() -> Self {
4121 Self { value: fidl::new_empty!(u32, D) }
4122 }
4123
4124 #[inline]
4125 unsafe fn decode(
4126 &mut self,
4127 decoder: &mut fidl::encoding::Decoder<'_, D>,
4128 offset: usize,
4129 _depth: fidl::encoding::Depth,
4130 ) -> fidl::Result<()> {
4131 decoder.debug_check_bounds::<Self>(offset);
4132 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
4133 unsafe {
4136 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
4137 }
4138 Ok(())
4139 }
4140 }
4141
4142 impl fidl::encoding::ValueTypeMarker for DeviceReadConfig8Response {
4143 type Borrowed<'a> = &'a Self;
4144 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4145 value
4146 }
4147 }
4148
4149 unsafe impl fidl::encoding::TypeMarker for DeviceReadConfig8Response {
4150 type Owned = Self;
4151
4152 #[inline(always)]
4153 fn inline_align(_context: fidl::encoding::Context) -> usize {
4154 1
4155 }
4156
4157 #[inline(always)]
4158 fn inline_size(_context: fidl::encoding::Context) -> usize {
4159 1
4160 }
4161 #[inline(always)]
4162 fn encode_is_copy() -> bool {
4163 true
4164 }
4165
4166 #[inline(always)]
4167 fn decode_is_copy() -> bool {
4168 true
4169 }
4170 }
4171
4172 unsafe impl<D: fidl::encoding::ResourceDialect>
4173 fidl::encoding::Encode<DeviceReadConfig8Response, D> for &DeviceReadConfig8Response
4174 {
4175 #[inline]
4176 unsafe fn encode(
4177 self,
4178 encoder: &mut fidl::encoding::Encoder<'_, D>,
4179 offset: usize,
4180 _depth: fidl::encoding::Depth,
4181 ) -> fidl::Result<()> {
4182 encoder.debug_check_bounds::<DeviceReadConfig8Response>(offset);
4183 unsafe {
4184 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
4186 (buf_ptr as *mut DeviceReadConfig8Response)
4187 .write_unaligned((self as *const DeviceReadConfig8Response).read());
4188 }
4191 Ok(())
4192 }
4193 }
4194 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u8, D>>
4195 fidl::encoding::Encode<DeviceReadConfig8Response, D> for (T0,)
4196 {
4197 #[inline]
4198 unsafe fn encode(
4199 self,
4200 encoder: &mut fidl::encoding::Encoder<'_, D>,
4201 offset: usize,
4202 depth: fidl::encoding::Depth,
4203 ) -> fidl::Result<()> {
4204 encoder.debug_check_bounds::<DeviceReadConfig8Response>(offset);
4205 self.0.encode(encoder, offset + 0, depth)?;
4209 Ok(())
4210 }
4211 }
4212
4213 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
4214 for DeviceReadConfig8Response
4215 {
4216 #[inline(always)]
4217 fn new_empty() -> Self {
4218 Self { value: fidl::new_empty!(u8, D) }
4219 }
4220
4221 #[inline]
4222 unsafe fn decode(
4223 &mut self,
4224 decoder: &mut fidl::encoding::Decoder<'_, D>,
4225 offset: usize,
4226 _depth: fidl::encoding::Depth,
4227 ) -> fidl::Result<()> {
4228 decoder.debug_check_bounds::<Self>(offset);
4229 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
4230 unsafe {
4233 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 1);
4234 }
4235 Ok(())
4236 }
4237 }
4238
4239 impl fidl::encoding::ValueTypeMarker for ExtendedCapability {
4240 type Borrowed<'a> = &'a Self;
4241 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4242 value
4243 }
4244 }
4245
4246 unsafe impl fidl::encoding::TypeMarker for ExtendedCapability {
4247 type Owned = Self;
4248
4249 #[inline(always)]
4250 fn inline_align(_context: fidl::encoding::Context) -> usize {
4251 2
4252 }
4253
4254 #[inline(always)]
4255 fn inline_size(_context: fidl::encoding::Context) -> usize {
4256 4
4257 }
4258 #[inline(always)]
4259 fn encode_is_copy() -> bool {
4260 true
4261 }
4262
4263 #[inline(always)]
4264 fn decode_is_copy() -> bool {
4265 true
4266 }
4267 }
4268
4269 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<ExtendedCapability, D>
4270 for &ExtendedCapability
4271 {
4272 #[inline]
4273 unsafe fn encode(
4274 self,
4275 encoder: &mut fidl::encoding::Encoder<'_, D>,
4276 offset: usize,
4277 _depth: fidl::encoding::Depth,
4278 ) -> fidl::Result<()> {
4279 encoder.debug_check_bounds::<ExtendedCapability>(offset);
4280 unsafe {
4281 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
4283 (buf_ptr as *mut ExtendedCapability)
4284 .write_unaligned((self as *const ExtendedCapability).read());
4285 }
4288 Ok(())
4289 }
4290 }
4291 unsafe impl<
4292 D: fidl::encoding::ResourceDialect,
4293 T0: fidl::encoding::Encode<u16, D>,
4294 T1: fidl::encoding::Encode<u16, D>,
4295 > fidl::encoding::Encode<ExtendedCapability, D> for (T0, T1)
4296 {
4297 #[inline]
4298 unsafe fn encode(
4299 self,
4300 encoder: &mut fidl::encoding::Encoder<'_, D>,
4301 offset: usize,
4302 depth: fidl::encoding::Depth,
4303 ) -> fidl::Result<()> {
4304 encoder.debug_check_bounds::<ExtendedCapability>(offset);
4305 self.0.encode(encoder, offset + 0, depth)?;
4309 self.1.encode(encoder, offset + 2, depth)?;
4310 Ok(())
4311 }
4312 }
4313
4314 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ExtendedCapability {
4315 #[inline(always)]
4316 fn new_empty() -> Self {
4317 Self { id: fidl::new_empty!(u16, D), offset: fidl::new_empty!(u16, D) }
4318 }
4319
4320 #[inline]
4321 unsafe fn decode(
4322 &mut self,
4323 decoder: &mut fidl::encoding::Decoder<'_, D>,
4324 offset: usize,
4325 _depth: fidl::encoding::Depth,
4326 ) -> fidl::Result<()> {
4327 decoder.debug_check_bounds::<Self>(offset);
4328 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
4329 unsafe {
4332 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
4333 }
4334 Ok(())
4335 }
4336 }
4337
4338 impl fidl::encoding::ValueTypeMarker for HostBridgeInfo {
4339 type Borrowed<'a> = &'a Self;
4340 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4341 value
4342 }
4343 }
4344
4345 unsafe impl fidl::encoding::TypeMarker for HostBridgeInfo {
4346 type Owned = Self;
4347
4348 #[inline(always)]
4349 fn inline_align(_context: fidl::encoding::Context) -> usize {
4350 8
4351 }
4352
4353 #[inline(always)]
4354 fn inline_size(_context: fidl::encoding::Context) -> usize {
4355 24
4356 }
4357 }
4358
4359 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<HostBridgeInfo, D>
4360 for &HostBridgeInfo
4361 {
4362 #[inline]
4363 unsafe fn encode(
4364 self,
4365 encoder: &mut fidl::encoding::Encoder<'_, D>,
4366 offset: usize,
4367 _depth: fidl::encoding::Depth,
4368 ) -> fidl::Result<()> {
4369 encoder.debug_check_bounds::<HostBridgeInfo>(offset);
4370 fidl::encoding::Encode::<HostBridgeInfo, D>::encode(
4372 (
4373 <fidl::encoding::BoundedString<32> as fidl::encoding::ValueTypeMarker>::borrow(
4374 &self.name,
4375 ),
4376 <u8 as fidl::encoding::ValueTypeMarker>::borrow(&self.start_bus_number),
4377 <u8 as fidl::encoding::ValueTypeMarker>::borrow(&self.end_bus_number),
4378 <u16 as fidl::encoding::ValueTypeMarker>::borrow(&self.segment_group),
4379 ),
4380 encoder,
4381 offset,
4382 _depth,
4383 )
4384 }
4385 }
4386 unsafe impl<
4387 D: fidl::encoding::ResourceDialect,
4388 T0: fidl::encoding::Encode<fidl::encoding::BoundedString<32>, D>,
4389 T1: fidl::encoding::Encode<u8, D>,
4390 T2: fidl::encoding::Encode<u8, D>,
4391 T3: fidl::encoding::Encode<u16, D>,
4392 > fidl::encoding::Encode<HostBridgeInfo, D> for (T0, T1, T2, T3)
4393 {
4394 #[inline]
4395 unsafe fn encode(
4396 self,
4397 encoder: &mut fidl::encoding::Encoder<'_, D>,
4398 offset: usize,
4399 depth: fidl::encoding::Depth,
4400 ) -> fidl::Result<()> {
4401 encoder.debug_check_bounds::<HostBridgeInfo>(offset);
4402 unsafe {
4405 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
4406 (ptr as *mut u64).write_unaligned(0);
4407 }
4408 self.0.encode(encoder, offset + 0, depth)?;
4410 self.1.encode(encoder, offset + 16, depth)?;
4411 self.2.encode(encoder, offset + 17, depth)?;
4412 self.3.encode(encoder, offset + 18, depth)?;
4413 Ok(())
4414 }
4415 }
4416
4417 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for HostBridgeInfo {
4418 #[inline(always)]
4419 fn new_empty() -> Self {
4420 Self {
4421 name: fidl::new_empty!(fidl::encoding::BoundedString<32>, D),
4422 start_bus_number: fidl::new_empty!(u8, D),
4423 end_bus_number: fidl::new_empty!(u8, D),
4424 segment_group: fidl::new_empty!(u16, D),
4425 }
4426 }
4427
4428 #[inline]
4429 unsafe fn decode(
4430 &mut self,
4431 decoder: &mut fidl::encoding::Decoder<'_, D>,
4432 offset: usize,
4433 _depth: fidl::encoding::Depth,
4434 ) -> fidl::Result<()> {
4435 decoder.debug_check_bounds::<Self>(offset);
4436 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
4438 let padval = unsafe { (ptr as *const u64).read_unaligned() };
4439 let mask = 0xffffffff00000000u64;
4440 let maskedval = padval & mask;
4441 if maskedval != 0 {
4442 return Err(fidl::Error::NonZeroPadding {
4443 padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
4444 });
4445 }
4446 fidl::decode!(
4447 fidl::encoding::BoundedString<32>,
4448 D,
4449 &mut self.name,
4450 decoder,
4451 offset + 0,
4452 _depth
4453 )?;
4454 fidl::decode!(u8, D, &mut self.start_bus_number, decoder, offset + 16, _depth)?;
4455 fidl::decode!(u8, D, &mut self.end_bus_number, decoder, offset + 17, _depth)?;
4456 fidl::decode!(u16, D, &mut self.segment_group, decoder, offset + 18, _depth)?;
4457 Ok(())
4458 }
4459 }
4460
4461 impl fidl::encoding::ValueTypeMarker for InterruptModes {
4462 type Borrowed<'a> = &'a Self;
4463 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4464 value
4465 }
4466 }
4467
4468 unsafe impl fidl::encoding::TypeMarker for InterruptModes {
4469 type Owned = Self;
4470
4471 #[inline(always)]
4472 fn inline_align(_context: fidl::encoding::Context) -> usize {
4473 2
4474 }
4475
4476 #[inline(always)]
4477 fn inline_size(_context: fidl::encoding::Context) -> usize {
4478 4
4479 }
4480 }
4481
4482 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<InterruptModes, D>
4483 for &InterruptModes
4484 {
4485 #[inline]
4486 unsafe fn encode(
4487 self,
4488 encoder: &mut fidl::encoding::Encoder<'_, D>,
4489 offset: usize,
4490 _depth: fidl::encoding::Depth,
4491 ) -> fidl::Result<()> {
4492 encoder.debug_check_bounds::<InterruptModes>(offset);
4493 fidl::encoding::Encode::<InterruptModes, D>::encode(
4495 (
4496 <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.has_legacy),
4497 <u8 as fidl::encoding::ValueTypeMarker>::borrow(&self.msi_count),
4498 <u16 as fidl::encoding::ValueTypeMarker>::borrow(&self.msix_count),
4499 ),
4500 encoder,
4501 offset,
4502 _depth,
4503 )
4504 }
4505 }
4506 unsafe impl<
4507 D: fidl::encoding::ResourceDialect,
4508 T0: fidl::encoding::Encode<bool, D>,
4509 T1: fidl::encoding::Encode<u8, D>,
4510 T2: fidl::encoding::Encode<u16, D>,
4511 > fidl::encoding::Encode<InterruptModes, D> for (T0, T1, T2)
4512 {
4513 #[inline]
4514 unsafe fn encode(
4515 self,
4516 encoder: &mut fidl::encoding::Encoder<'_, D>,
4517 offset: usize,
4518 depth: fidl::encoding::Depth,
4519 ) -> fidl::Result<()> {
4520 encoder.debug_check_bounds::<InterruptModes>(offset);
4521 self.0.encode(encoder, offset + 0, depth)?;
4525 self.1.encode(encoder, offset + 1, depth)?;
4526 self.2.encode(encoder, offset + 2, depth)?;
4527 Ok(())
4528 }
4529 }
4530
4531 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for InterruptModes {
4532 #[inline(always)]
4533 fn new_empty() -> Self {
4534 Self {
4535 has_legacy: fidl::new_empty!(bool, D),
4536 msi_count: fidl::new_empty!(u8, D),
4537 msix_count: fidl::new_empty!(u16, D),
4538 }
4539 }
4540
4541 #[inline]
4542 unsafe fn decode(
4543 &mut self,
4544 decoder: &mut fidl::encoding::Decoder<'_, D>,
4545 offset: usize,
4546 _depth: fidl::encoding::Depth,
4547 ) -> fidl::Result<()> {
4548 decoder.debug_check_bounds::<Self>(offset);
4549 fidl::decode!(bool, D, &mut self.has_legacy, decoder, offset + 0, _depth)?;
4551 fidl::decode!(u8, D, &mut self.msi_count, decoder, offset + 1, _depth)?;
4552 fidl::decode!(u16, D, &mut self.msix_count, decoder, offset + 2, _depth)?;
4553 Ok(())
4554 }
4555 }
4556
4557 impl fidl::encoding::ValueTypeMarker for Padding {
4558 type Borrowed<'a> = &'a Self;
4559 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4560 value
4561 }
4562 }
4563
4564 unsafe impl fidl::encoding::TypeMarker for Padding {
4565 type Owned = Self;
4566
4567 #[inline(always)]
4568 fn inline_align(_context: fidl::encoding::Context) -> usize {
4569 1
4570 }
4571
4572 #[inline(always)]
4573 fn inline_size(_context: fidl::encoding::Context) -> usize {
4574 1
4575 }
4576 }
4577
4578 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Padding, D> for &Padding {
4579 #[inline]
4580 unsafe fn encode(
4581 self,
4582 encoder: &mut fidl::encoding::Encoder<'_, D>,
4583 offset: usize,
4584 _depth: fidl::encoding::Depth,
4585 ) -> fidl::Result<()> {
4586 encoder.debug_check_bounds::<Padding>(offset);
4587 encoder.write_num(0u8, offset);
4588 Ok(())
4589 }
4590 }
4591
4592 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Padding {
4593 #[inline(always)]
4594 fn new_empty() -> Self {
4595 Self
4596 }
4597
4598 #[inline]
4599 unsafe fn decode(
4600 &mut self,
4601 decoder: &mut fidl::encoding::Decoder<'_, D>,
4602 offset: usize,
4603 _depth: fidl::encoding::Depth,
4604 ) -> fidl::Result<()> {
4605 decoder.debug_check_bounds::<Self>(offset);
4606 match decoder.read_num::<u8>(offset) {
4607 0 => Ok(()),
4608 _ => Err(fidl::Error::Invalid),
4609 }
4610 }
4611 }
4612
4613 impl fidl::encoding::ValueTypeMarker for PciDevice {
4614 type Borrowed<'a> = &'a Self;
4615 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4616 value
4617 }
4618 }
4619
4620 unsafe impl fidl::encoding::TypeMarker for PciDevice {
4621 type Owned = Self;
4622
4623 #[inline(always)]
4624 fn inline_align(_context: fidl::encoding::Context) -> usize {
4625 8
4626 }
4627
4628 #[inline(always)]
4629 fn inline_size(_context: fidl::encoding::Context) -> usize {
4630 72
4631 }
4632 }
4633
4634 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<PciDevice, D>
4635 for &PciDevice
4636 {
4637 #[inline]
4638 unsafe fn encode(
4639 self,
4640 encoder: &mut fidl::encoding::Encoder<'_, D>,
4641 offset: usize,
4642 _depth: fidl::encoding::Depth,
4643 ) -> fidl::Result<()> {
4644 encoder.debug_check_bounds::<PciDevice>(offset);
4645 fidl::encoding::Encode::<PciDevice, D>::encode(
4647 (
4648 <fidl::encoding::Vector<BaseAddress, 6> as fidl::encoding::ValueTypeMarker>::borrow(&self.base_addresses),
4649 <fidl::encoding::Vector<Capability, 32> as fidl::encoding::ValueTypeMarker>::borrow(&self.capabilities),
4650 <fidl::encoding::Vector<ExtendedCapability, 32> as fidl::encoding::ValueTypeMarker>::borrow(&self.ext_capabilities),
4651 <fidl::encoding::Vector<u8, 256> as fidl::encoding::ValueTypeMarker>::borrow(&self.config),
4652 <u8 as fidl::encoding::ValueTypeMarker>::borrow(&self.bus_id),
4653 <u8 as fidl::encoding::ValueTypeMarker>::borrow(&self.device_id),
4654 <u8 as fidl::encoding::ValueTypeMarker>::borrow(&self.function_id),
4655 ),
4656 encoder, offset, _depth
4657 )
4658 }
4659 }
4660 unsafe impl<
4661 D: fidl::encoding::ResourceDialect,
4662 T0: fidl::encoding::Encode<fidl::encoding::Vector<BaseAddress, 6>, D>,
4663 T1: fidl::encoding::Encode<fidl::encoding::Vector<Capability, 32>, D>,
4664 T2: fidl::encoding::Encode<fidl::encoding::Vector<ExtendedCapability, 32>, D>,
4665 T3: fidl::encoding::Encode<fidl::encoding::Vector<u8, 256>, D>,
4666 T4: fidl::encoding::Encode<u8, D>,
4667 T5: fidl::encoding::Encode<u8, D>,
4668 T6: fidl::encoding::Encode<u8, D>,
4669 > fidl::encoding::Encode<PciDevice, D> for (T0, T1, T2, T3, T4, T5, T6)
4670 {
4671 #[inline]
4672 unsafe fn encode(
4673 self,
4674 encoder: &mut fidl::encoding::Encoder<'_, D>,
4675 offset: usize,
4676 depth: fidl::encoding::Depth,
4677 ) -> fidl::Result<()> {
4678 encoder.debug_check_bounds::<PciDevice>(offset);
4679 unsafe {
4682 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(64);
4683 (ptr as *mut u64).write_unaligned(0);
4684 }
4685 self.0.encode(encoder, offset + 0, depth)?;
4687 self.1.encode(encoder, offset + 16, depth)?;
4688 self.2.encode(encoder, offset + 32, depth)?;
4689 self.3.encode(encoder, offset + 48, depth)?;
4690 self.4.encode(encoder, offset + 64, depth)?;
4691 self.5.encode(encoder, offset + 65, depth)?;
4692 self.6.encode(encoder, offset + 66, depth)?;
4693 Ok(())
4694 }
4695 }
4696
4697 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for PciDevice {
4698 #[inline(always)]
4699 fn new_empty() -> Self {
4700 Self {
4701 base_addresses: fidl::new_empty!(fidl::encoding::Vector<BaseAddress, 6>, D),
4702 capabilities: fidl::new_empty!(fidl::encoding::Vector<Capability, 32>, D),
4703 ext_capabilities: fidl::new_empty!(fidl::encoding::Vector<ExtendedCapability, 32>, D),
4704 config: fidl::new_empty!(fidl::encoding::Vector<u8, 256>, D),
4705 bus_id: fidl::new_empty!(u8, D),
4706 device_id: fidl::new_empty!(u8, D),
4707 function_id: fidl::new_empty!(u8, D),
4708 }
4709 }
4710
4711 #[inline]
4712 unsafe fn decode(
4713 &mut self,
4714 decoder: &mut fidl::encoding::Decoder<'_, D>,
4715 offset: usize,
4716 _depth: fidl::encoding::Depth,
4717 ) -> fidl::Result<()> {
4718 decoder.debug_check_bounds::<Self>(offset);
4719 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(64) };
4721 let padval = unsafe { (ptr as *const u64).read_unaligned() };
4722 let mask = 0xffffffffff000000u64;
4723 let maskedval = padval & mask;
4724 if maskedval != 0 {
4725 return Err(fidl::Error::NonZeroPadding {
4726 padding_start: offset + 64 + ((mask as u64).trailing_zeros() / 8) as usize,
4727 });
4728 }
4729 fidl::decode!(fidl::encoding::Vector<BaseAddress, 6>, D, &mut self.base_addresses, decoder, offset + 0, _depth)?;
4730 fidl::decode!(fidl::encoding::Vector<Capability, 32>, D, &mut self.capabilities, decoder, offset + 16, _depth)?;
4731 fidl::decode!(fidl::encoding::Vector<ExtendedCapability, 32>, D, &mut self.ext_capabilities, decoder, offset + 32, _depth)?;
4732 fidl::decode!(fidl::encoding::Vector<u8, 256>, D, &mut self.config, decoder, offset + 48, _depth)?;
4733 fidl::decode!(u8, D, &mut self.bus_id, decoder, offset + 64, _depth)?;
4734 fidl::decode!(u8, D, &mut self.device_id, decoder, offset + 65, _depth)?;
4735 fidl::decode!(u8, D, &mut self.function_id, decoder, offset + 66, _depth)?;
4736 Ok(())
4737 }
4738 }
4739
4740 impl fidl::encoding::ValueTypeMarker for UseIntxWorkaroundType {
4741 type Borrowed<'a> = &'a Self;
4742 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4743 value
4744 }
4745 }
4746
4747 unsafe impl fidl::encoding::TypeMarker for UseIntxWorkaroundType {
4748 type Owned = Self;
4749
4750 #[inline(always)]
4751 fn inline_align(_context: fidl::encoding::Context) -> usize {
4752 1
4753 }
4754
4755 #[inline(always)]
4756 fn inline_size(_context: fidl::encoding::Context) -> usize {
4757 1
4758 }
4759 }
4760
4761 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<UseIntxWorkaroundType, D>
4762 for &UseIntxWorkaroundType
4763 {
4764 #[inline]
4765 unsafe fn encode(
4766 self,
4767 encoder: &mut fidl::encoding::Encoder<'_, D>,
4768 offset: usize,
4769 _depth: fidl::encoding::Depth,
4770 ) -> fidl::Result<()> {
4771 encoder.debug_check_bounds::<UseIntxWorkaroundType>(offset);
4772 encoder.write_num(0u8, offset);
4773 Ok(())
4774 }
4775 }
4776
4777 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for UseIntxWorkaroundType {
4778 #[inline(always)]
4779 fn new_empty() -> Self {
4780 Self
4781 }
4782
4783 #[inline]
4784 unsafe fn decode(
4785 &mut self,
4786 decoder: &mut fidl::encoding::Decoder<'_, D>,
4787 offset: usize,
4788 _depth: fidl::encoding::Depth,
4789 ) -> fidl::Result<()> {
4790 decoder.debug_check_bounds::<Self>(offset);
4791 match decoder.read_num::<u8>(offset) {
4792 0 => Ok(()),
4793 _ => Err(fidl::Error::Invalid),
4794 }
4795 }
4796 }
4797
4798 impl BoardConfiguration {
4799 #[inline(always)]
4800 fn max_ordinal_present(&self) -> u64 {
4801 if let Some(_) = self.use_intx_workaround {
4802 return 1;
4803 }
4804 0
4805 }
4806 }
4807
4808 impl fidl::encoding::ValueTypeMarker for BoardConfiguration {
4809 type Borrowed<'a> = &'a Self;
4810 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4811 value
4812 }
4813 }
4814
4815 unsafe impl fidl::encoding::TypeMarker for BoardConfiguration {
4816 type Owned = Self;
4817
4818 #[inline(always)]
4819 fn inline_align(_context: fidl::encoding::Context) -> usize {
4820 8
4821 }
4822
4823 #[inline(always)]
4824 fn inline_size(_context: fidl::encoding::Context) -> usize {
4825 16
4826 }
4827 }
4828
4829 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<BoardConfiguration, D>
4830 for &BoardConfiguration
4831 {
4832 unsafe fn encode(
4833 self,
4834 encoder: &mut fidl::encoding::Encoder<'_, D>,
4835 offset: usize,
4836 mut depth: fidl::encoding::Depth,
4837 ) -> fidl::Result<()> {
4838 encoder.debug_check_bounds::<BoardConfiguration>(offset);
4839 let max_ordinal: u64 = self.max_ordinal_present();
4841 encoder.write_num(max_ordinal, offset);
4842 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
4843 if max_ordinal == 0 {
4845 return Ok(());
4846 }
4847 depth.increment()?;
4848 let envelope_size = 8;
4849 let bytes_len = max_ordinal as usize * envelope_size;
4850 #[allow(unused_variables)]
4851 let offset = encoder.out_of_line_offset(bytes_len);
4852 let mut _prev_end_offset: usize = 0;
4853 if 1 > max_ordinal {
4854 return Ok(());
4855 }
4856
4857 let cur_offset: usize = (1 - 1) * envelope_size;
4860
4861 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4863
4864 fidl::encoding::encode_in_envelope_optional::<UseIntxWorkaroundType, D>(
4869 self.use_intx_workaround
4870 .as_ref()
4871 .map(<UseIntxWorkaroundType as fidl::encoding::ValueTypeMarker>::borrow),
4872 encoder,
4873 offset + cur_offset,
4874 depth,
4875 )?;
4876
4877 _prev_end_offset = cur_offset + envelope_size;
4878
4879 Ok(())
4880 }
4881 }
4882
4883 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for BoardConfiguration {
4884 #[inline(always)]
4885 fn new_empty() -> Self {
4886 Self::default()
4887 }
4888
4889 unsafe fn decode(
4890 &mut self,
4891 decoder: &mut fidl::encoding::Decoder<'_, D>,
4892 offset: usize,
4893 mut depth: fidl::encoding::Depth,
4894 ) -> fidl::Result<()> {
4895 decoder.debug_check_bounds::<Self>(offset);
4896 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
4897 None => return Err(fidl::Error::NotNullable),
4898 Some(len) => len,
4899 };
4900 if len == 0 {
4902 return Ok(());
4903 };
4904 depth.increment()?;
4905 let envelope_size = 8;
4906 let bytes_len = len * envelope_size;
4907 let offset = decoder.out_of_line_offset(bytes_len)?;
4908 let mut _next_ordinal_to_read = 0;
4910 let mut next_offset = offset;
4911 let end_offset = offset + bytes_len;
4912 _next_ordinal_to_read += 1;
4913 if next_offset >= end_offset {
4914 return Ok(());
4915 }
4916
4917 while _next_ordinal_to_read < 1 {
4919 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4920 _next_ordinal_to_read += 1;
4921 next_offset += envelope_size;
4922 }
4923
4924 let next_out_of_line = decoder.next_out_of_line();
4925 let handles_before = decoder.remaining_handles();
4926 if let Some((inlined, num_bytes, num_handles)) =
4927 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4928 {
4929 let member_inline_size =
4930 <UseIntxWorkaroundType as fidl::encoding::TypeMarker>::inline_size(
4931 decoder.context,
4932 );
4933 if inlined != (member_inline_size <= 4) {
4934 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4935 }
4936 let inner_offset;
4937 let mut inner_depth = depth.clone();
4938 if inlined {
4939 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4940 inner_offset = next_offset;
4941 } else {
4942 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4943 inner_depth.increment()?;
4944 }
4945 let val_ref = self
4946 .use_intx_workaround
4947 .get_or_insert_with(|| fidl::new_empty!(UseIntxWorkaroundType, D));
4948 fidl::decode!(
4949 UseIntxWorkaroundType,
4950 D,
4951 val_ref,
4952 decoder,
4953 inner_offset,
4954 inner_depth
4955 )?;
4956 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4957 {
4958 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4959 }
4960 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4961 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4962 }
4963 }
4964
4965 next_offset += envelope_size;
4966
4967 while next_offset < end_offset {
4969 _next_ordinal_to_read += 1;
4970 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4971 next_offset += envelope_size;
4972 }
4973
4974 Ok(())
4975 }
4976 }
4977}