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