Skip to main content

fidl_fuchsia_hardware_pci_common/
fidl_fuchsia_hardware_pci_common.rs

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