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    #[doc(hidden)]
1083    pub __source_breaking: fidl::marker::SourceBreaking,
1084}
1085
1086impl fidl::Persistable for BoardConfiguration {}
1087
1088pub mod bus_ordinals {
1089    pub const GET_HOST_BRIDGE_INFO: u64 = 0x39f0b21bcd8c065d;
1090    pub const GET_DEVICES: u64 = 0x2b39a32926007c92;
1091    pub const READ_BAR: u64 = 0x798f39b0dfdc4860;
1092}
1093
1094pub mod device_ordinals {
1095    pub const GET_DEVICE_INFO: u64 = 0x5599d144d4329916;
1096    pub const GET_BAR: u64 = 0x6b2683f6fbbff679;
1097    pub const SET_BUS_MASTERING: u64 = 0x3421e9e030211003;
1098    pub const RESET_DEVICE: u64 = 0x3c5b7579bb6f8b9f;
1099    pub const ACK_INTERRUPT: u64 = 0x70742f64692d5a6b;
1100    pub const MAP_INTERRUPT: u64 = 0x25eeff9d34a1fa13;
1101    pub const GET_INTERRUPT_MODES: u64 = 0x93f4cd8f79e9f4a;
1102    pub const SET_INTERRUPT_MODE: u64 = 0x85bebad3eb24866;
1103    pub const READ_CONFIG8: u64 = 0x28f9eb9e6dadda1c;
1104    pub const READ_CONFIG16: u64 = 0x3bcda6171a3270bb;
1105    pub const READ_CONFIG32: u64 = 0x55357535402f7507;
1106    pub const WRITE_CONFIG8: u64 = 0x49a0719e1433cff;
1107    pub const WRITE_CONFIG16: u64 = 0x3e30bf13f1c07eff;
1108    pub const WRITE_CONFIG32: u64 = 0x161584e5199b388;
1109    pub const GET_CAPABILITIES: u64 = 0x3a050fde46f3ba0f;
1110    pub const GET_EXTENDED_CAPABILITIES: u64 = 0xb8573efcaae0c39;
1111    pub const GET_BTI: u64 = 0x5e4fe9efb12d9ee3;
1112}
1113
1114mod internal {
1115    use super::*;
1116    unsafe impl fidl::encoding::TypeMarker for Command {
1117        type Owned = Self;
1118
1119        #[inline(always)]
1120        fn inline_align(_context: fidl::encoding::Context) -> usize {
1121            2
1122        }
1123
1124        #[inline(always)]
1125        fn inline_size(_context: fidl::encoding::Context) -> usize {
1126            2
1127        }
1128    }
1129
1130    impl fidl::encoding::ValueTypeMarker for Command {
1131        type Borrowed<'a> = Self;
1132        #[inline(always)]
1133        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1134            *value
1135        }
1136    }
1137
1138    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for Command {
1139        #[inline]
1140        unsafe fn encode(
1141            self,
1142            encoder: &mut fidl::encoding::Encoder<'_, D>,
1143            offset: usize,
1144            _depth: fidl::encoding::Depth,
1145        ) -> fidl::Result<()> {
1146            encoder.debug_check_bounds::<Self>(offset);
1147            encoder.write_num(self.bits(), offset);
1148            Ok(())
1149        }
1150    }
1151
1152    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Command {
1153        #[inline(always)]
1154        fn new_empty() -> Self {
1155            Self::empty()
1156        }
1157
1158        #[inline]
1159        unsafe fn decode(
1160            &mut self,
1161            decoder: &mut fidl::encoding::Decoder<'_, D>,
1162            offset: usize,
1163            _depth: fidl::encoding::Depth,
1164        ) -> fidl::Result<()> {
1165            decoder.debug_check_bounds::<Self>(offset);
1166            let prim = decoder.read_num::<u16>(offset);
1167            *self = Self::from_bits_allow_unknown(prim);
1168            Ok(())
1169        }
1170    }
1171    unsafe impl fidl::encoding::TypeMarker for Status {
1172        type Owned = Self;
1173
1174        #[inline(always)]
1175        fn inline_align(_context: fidl::encoding::Context) -> usize {
1176            2
1177        }
1178
1179        #[inline(always)]
1180        fn inline_size(_context: fidl::encoding::Context) -> usize {
1181            2
1182        }
1183    }
1184
1185    impl fidl::encoding::ValueTypeMarker for Status {
1186        type Borrowed<'a> = Self;
1187        #[inline(always)]
1188        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1189            *value
1190        }
1191    }
1192
1193    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for Status {
1194        #[inline]
1195        unsafe fn encode(
1196            self,
1197            encoder: &mut fidl::encoding::Encoder<'_, D>,
1198            offset: usize,
1199            _depth: fidl::encoding::Depth,
1200        ) -> fidl::Result<()> {
1201            encoder.debug_check_bounds::<Self>(offset);
1202            encoder.write_num(self.bits(), offset);
1203            Ok(())
1204        }
1205    }
1206
1207    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Status {
1208        #[inline(always)]
1209        fn new_empty() -> Self {
1210            Self::empty()
1211        }
1212
1213        #[inline]
1214        unsafe fn decode(
1215            &mut self,
1216            decoder: &mut fidl::encoding::Decoder<'_, D>,
1217            offset: usize,
1218            _depth: fidl::encoding::Depth,
1219        ) -> fidl::Result<()> {
1220            decoder.debug_check_bounds::<Self>(offset);
1221            let prim = decoder.read_num::<u16>(offset);
1222            *self = Self::from_bits_allow_unknown(prim);
1223            Ok(())
1224        }
1225    }
1226    unsafe impl fidl::encoding::TypeMarker for CapabilityId {
1227        type Owned = Self;
1228
1229        #[inline(always)]
1230        fn inline_align(_context: fidl::encoding::Context) -> usize {
1231            std::mem::align_of::<u8>()
1232        }
1233
1234        #[inline(always)]
1235        fn inline_size(_context: fidl::encoding::Context) -> usize {
1236            std::mem::size_of::<u8>()
1237        }
1238
1239        #[inline(always)]
1240        fn encode_is_copy() -> bool {
1241            false
1242        }
1243
1244        #[inline(always)]
1245        fn decode_is_copy() -> bool {
1246            false
1247        }
1248    }
1249
1250    impl fidl::encoding::ValueTypeMarker for CapabilityId {
1251        type Borrowed<'a> = Self;
1252        #[inline(always)]
1253        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1254            *value
1255        }
1256    }
1257
1258    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for CapabilityId {
1259        #[inline]
1260        unsafe fn encode(
1261            self,
1262            encoder: &mut fidl::encoding::Encoder<'_, D>,
1263            offset: usize,
1264            _depth: fidl::encoding::Depth,
1265        ) -> fidl::Result<()> {
1266            encoder.debug_check_bounds::<Self>(offset);
1267            encoder.write_num(self.into_primitive(), offset);
1268            Ok(())
1269        }
1270    }
1271
1272    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for CapabilityId {
1273        #[inline(always)]
1274        fn new_empty() -> Self {
1275            Self::unknown()
1276        }
1277
1278        #[inline]
1279        unsafe fn decode(
1280            &mut self,
1281            decoder: &mut fidl::encoding::Decoder<'_, D>,
1282            offset: usize,
1283            _depth: fidl::encoding::Depth,
1284        ) -> fidl::Result<()> {
1285            decoder.debug_check_bounds::<Self>(offset);
1286            let prim = decoder.read_num::<u8>(offset);
1287
1288            *self = Self::from_primitive_allow_unknown(prim);
1289            Ok(())
1290        }
1291    }
1292    unsafe impl fidl::encoding::TypeMarker for Config {
1293        type Owned = Self;
1294
1295        #[inline(always)]
1296        fn inline_align(_context: fidl::encoding::Context) -> usize {
1297            std::mem::align_of::<u16>()
1298        }
1299
1300        #[inline(always)]
1301        fn inline_size(_context: fidl::encoding::Context) -> usize {
1302            std::mem::size_of::<u16>()
1303        }
1304
1305        #[inline(always)]
1306        fn encode_is_copy() -> bool {
1307            false
1308        }
1309
1310        #[inline(always)]
1311        fn decode_is_copy() -> bool {
1312            false
1313        }
1314    }
1315
1316    impl fidl::encoding::ValueTypeMarker for Config {
1317        type Borrowed<'a> = Self;
1318        #[inline(always)]
1319        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1320            *value
1321        }
1322    }
1323
1324    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for Config {
1325        #[inline]
1326        unsafe fn encode(
1327            self,
1328            encoder: &mut fidl::encoding::Encoder<'_, D>,
1329            offset: usize,
1330            _depth: fidl::encoding::Depth,
1331        ) -> fidl::Result<()> {
1332            encoder.debug_check_bounds::<Self>(offset);
1333            encoder.write_num(self.into_primitive(), offset);
1334            Ok(())
1335        }
1336    }
1337
1338    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Config {
1339        #[inline(always)]
1340        fn new_empty() -> Self {
1341            Self::unknown()
1342        }
1343
1344        #[inline]
1345        unsafe fn decode(
1346            &mut self,
1347            decoder: &mut fidl::encoding::Decoder<'_, D>,
1348            offset: usize,
1349            _depth: fidl::encoding::Depth,
1350        ) -> fidl::Result<()> {
1351            decoder.debug_check_bounds::<Self>(offset);
1352            let prim = decoder.read_num::<u16>(offset);
1353
1354            *self = Self::from_primitive_allow_unknown(prim);
1355            Ok(())
1356        }
1357    }
1358    unsafe impl fidl::encoding::TypeMarker for ExtendedCapabilityId {
1359        type Owned = Self;
1360
1361        #[inline(always)]
1362        fn inline_align(_context: fidl::encoding::Context) -> usize {
1363            std::mem::align_of::<u16>()
1364        }
1365
1366        #[inline(always)]
1367        fn inline_size(_context: fidl::encoding::Context) -> usize {
1368            std::mem::size_of::<u16>()
1369        }
1370
1371        #[inline(always)]
1372        fn encode_is_copy() -> bool {
1373            false
1374        }
1375
1376        #[inline(always)]
1377        fn decode_is_copy() -> bool {
1378            false
1379        }
1380    }
1381
1382    impl fidl::encoding::ValueTypeMarker for ExtendedCapabilityId {
1383        type Borrowed<'a> = Self;
1384        #[inline(always)]
1385        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1386            *value
1387        }
1388    }
1389
1390    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
1391        for ExtendedCapabilityId
1392    {
1393        #[inline]
1394        unsafe fn encode(
1395            self,
1396            encoder: &mut fidl::encoding::Encoder<'_, D>,
1397            offset: usize,
1398            _depth: fidl::encoding::Depth,
1399        ) -> fidl::Result<()> {
1400            encoder.debug_check_bounds::<Self>(offset);
1401            encoder.write_num(self.into_primitive(), offset);
1402            Ok(())
1403        }
1404    }
1405
1406    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ExtendedCapabilityId {
1407        #[inline(always)]
1408        fn new_empty() -> Self {
1409            Self::unknown()
1410        }
1411
1412        #[inline]
1413        unsafe fn decode(
1414            &mut self,
1415            decoder: &mut fidl::encoding::Decoder<'_, D>,
1416            offset: usize,
1417            _depth: fidl::encoding::Depth,
1418        ) -> fidl::Result<()> {
1419            decoder.debug_check_bounds::<Self>(offset);
1420            let prim = decoder.read_num::<u16>(offset);
1421
1422            *self = Self::from_primitive_allow_unknown(prim);
1423            Ok(())
1424        }
1425    }
1426    unsafe impl fidl::encoding::TypeMarker for HeaderType {
1427        type Owned = Self;
1428
1429        #[inline(always)]
1430        fn inline_align(_context: fidl::encoding::Context) -> usize {
1431            std::mem::align_of::<u8>()
1432        }
1433
1434        #[inline(always)]
1435        fn inline_size(_context: fidl::encoding::Context) -> usize {
1436            std::mem::size_of::<u8>()
1437        }
1438
1439        #[inline(always)]
1440        fn encode_is_copy() -> bool {
1441            false
1442        }
1443
1444        #[inline(always)]
1445        fn decode_is_copy() -> bool {
1446            false
1447        }
1448    }
1449
1450    impl fidl::encoding::ValueTypeMarker for HeaderType {
1451        type Borrowed<'a> = Self;
1452        #[inline(always)]
1453        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1454            *value
1455        }
1456    }
1457
1458    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for HeaderType {
1459        #[inline]
1460        unsafe fn encode(
1461            self,
1462            encoder: &mut fidl::encoding::Encoder<'_, D>,
1463            offset: usize,
1464            _depth: fidl::encoding::Depth,
1465        ) -> fidl::Result<()> {
1466            encoder.debug_check_bounds::<Self>(offset);
1467            encoder.write_num(self.into_primitive(), offset);
1468            Ok(())
1469        }
1470    }
1471
1472    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for HeaderType {
1473        #[inline(always)]
1474        fn new_empty() -> Self {
1475            Self::unknown()
1476        }
1477
1478        #[inline]
1479        unsafe fn decode(
1480            &mut self,
1481            decoder: &mut fidl::encoding::Decoder<'_, D>,
1482            offset: usize,
1483            _depth: fidl::encoding::Depth,
1484        ) -> fidl::Result<()> {
1485            decoder.debug_check_bounds::<Self>(offset);
1486            let prim = decoder.read_num::<u8>(offset);
1487
1488            *self = Self::from_primitive_allow_unknown(prim);
1489            Ok(())
1490        }
1491    }
1492    unsafe impl fidl::encoding::TypeMarker for InterruptMode {
1493        type Owned = Self;
1494
1495        #[inline(always)]
1496        fn inline_align(_context: fidl::encoding::Context) -> usize {
1497            std::mem::align_of::<u8>()
1498        }
1499
1500        #[inline(always)]
1501        fn inline_size(_context: fidl::encoding::Context) -> usize {
1502            std::mem::size_of::<u8>()
1503        }
1504
1505        #[inline(always)]
1506        fn encode_is_copy() -> bool {
1507            false
1508        }
1509
1510        #[inline(always)]
1511        fn decode_is_copy() -> bool {
1512            false
1513        }
1514    }
1515
1516    impl fidl::encoding::ValueTypeMarker for InterruptMode {
1517        type Borrowed<'a> = Self;
1518        #[inline(always)]
1519        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1520            *value
1521        }
1522    }
1523
1524    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for InterruptMode {
1525        #[inline]
1526        unsafe fn encode(
1527            self,
1528            encoder: &mut fidl::encoding::Encoder<'_, D>,
1529            offset: usize,
1530            _depth: fidl::encoding::Depth,
1531        ) -> fidl::Result<()> {
1532            encoder.debug_check_bounds::<Self>(offset);
1533            encoder.write_num(self.into_primitive(), offset);
1534            Ok(())
1535        }
1536    }
1537
1538    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for InterruptMode {
1539        #[inline(always)]
1540        fn new_empty() -> Self {
1541            Self::unknown()
1542        }
1543
1544        #[inline]
1545        unsafe fn decode(
1546            &mut self,
1547            decoder: &mut fidl::encoding::Decoder<'_, D>,
1548            offset: usize,
1549            _depth: fidl::encoding::Depth,
1550        ) -> fidl::Result<()> {
1551            decoder.debug_check_bounds::<Self>(offset);
1552            let prim = decoder.read_num::<u8>(offset);
1553
1554            *self = Self::from_primitive_allow_unknown(prim);
1555            Ok(())
1556        }
1557    }
1558
1559    impl fidl::encoding::ValueTypeMarker for Address {
1560        type Borrowed<'a> = &'a Self;
1561        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1562            value
1563        }
1564    }
1565
1566    unsafe impl fidl::encoding::TypeMarker for Address {
1567        type Owned = Self;
1568
1569        #[inline(always)]
1570        fn inline_align(_context: fidl::encoding::Context) -> usize {
1571            1
1572        }
1573
1574        #[inline(always)]
1575        fn inline_size(_context: fidl::encoding::Context) -> usize {
1576            3
1577        }
1578        #[inline(always)]
1579        fn encode_is_copy() -> bool {
1580            true
1581        }
1582
1583        #[inline(always)]
1584        fn decode_is_copy() -> bool {
1585            true
1586        }
1587    }
1588
1589    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Address, D> for &Address {
1590        #[inline]
1591        unsafe fn encode(
1592            self,
1593            encoder: &mut fidl::encoding::Encoder<'_, D>,
1594            offset: usize,
1595            _depth: fidl::encoding::Depth,
1596        ) -> fidl::Result<()> {
1597            encoder.debug_check_bounds::<Address>(offset);
1598            unsafe {
1599                // Copy the object into the buffer.
1600                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
1601                (buf_ptr as *mut Address).write_unaligned((self as *const Address).read());
1602                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
1603                // done second because the memcpy will write garbage to these bytes.
1604            }
1605            Ok(())
1606        }
1607    }
1608    unsafe impl<
1609            D: fidl::encoding::ResourceDialect,
1610            T0: fidl::encoding::Encode<u8, D>,
1611            T1: fidl::encoding::Encode<u8, D>,
1612            T2: fidl::encoding::Encode<u8, D>,
1613        > fidl::encoding::Encode<Address, D> for (T0, T1, T2)
1614    {
1615        #[inline]
1616        unsafe fn encode(
1617            self,
1618            encoder: &mut fidl::encoding::Encoder<'_, D>,
1619            offset: usize,
1620            depth: fidl::encoding::Depth,
1621        ) -> fidl::Result<()> {
1622            encoder.debug_check_bounds::<Address>(offset);
1623            // Zero out padding regions. There's no need to apply masks
1624            // because the unmasked parts will be overwritten by fields.
1625            // Write the fields.
1626            self.0.encode(encoder, offset + 0, depth)?;
1627            self.1.encode(encoder, offset + 1, depth)?;
1628            self.2.encode(encoder, offset + 2, depth)?;
1629            Ok(())
1630        }
1631    }
1632
1633    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Address {
1634        #[inline(always)]
1635        fn new_empty() -> Self {
1636            Self {
1637                bus: fidl::new_empty!(u8, D),
1638                device: fidl::new_empty!(u8, D),
1639                function: fidl::new_empty!(u8, D),
1640            }
1641        }
1642
1643        #[inline]
1644        unsafe fn decode(
1645            &mut self,
1646            decoder: &mut fidl::encoding::Decoder<'_, D>,
1647            offset: usize,
1648            _depth: fidl::encoding::Depth,
1649        ) -> fidl::Result<()> {
1650            decoder.debug_check_bounds::<Self>(offset);
1651            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
1652            // Verify that padding bytes are zero.
1653            // Copy from the buffer into the object.
1654            unsafe {
1655                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 3);
1656            }
1657            Ok(())
1658        }
1659    }
1660
1661    impl fidl::encoding::ValueTypeMarker for BaseAddress {
1662        type Borrowed<'a> = &'a Self;
1663        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1664            value
1665        }
1666    }
1667
1668    unsafe impl fidl::encoding::TypeMarker for BaseAddress {
1669        type Owned = Self;
1670
1671        #[inline(always)]
1672        fn inline_align(_context: fidl::encoding::Context) -> usize {
1673            8
1674        }
1675
1676        #[inline(always)]
1677        fn inline_size(_context: fidl::encoding::Context) -> usize {
1678            24
1679        }
1680    }
1681
1682    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<BaseAddress, D>
1683        for &BaseAddress
1684    {
1685        #[inline]
1686        unsafe fn encode(
1687            self,
1688            encoder: &mut fidl::encoding::Encoder<'_, D>,
1689            offset: usize,
1690            _depth: fidl::encoding::Depth,
1691        ) -> fidl::Result<()> {
1692            encoder.debug_check_bounds::<BaseAddress>(offset);
1693            // Delegate to tuple encoding.
1694            fidl::encoding::Encode::<BaseAddress, D>::encode(
1695                (
1696                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.address),
1697                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.size),
1698                    <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.is_memory),
1699                    <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.is_prefetchable),
1700                    <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.is_64bit),
1701                    <u8 as fidl::encoding::ValueTypeMarker>::borrow(&self.id),
1702                ),
1703                encoder,
1704                offset,
1705                _depth,
1706            )
1707        }
1708    }
1709    unsafe impl<
1710            D: fidl::encoding::ResourceDialect,
1711            T0: fidl::encoding::Encode<u64, D>,
1712            T1: fidl::encoding::Encode<u64, D>,
1713            T2: fidl::encoding::Encode<bool, D>,
1714            T3: fidl::encoding::Encode<bool, D>,
1715            T4: fidl::encoding::Encode<bool, D>,
1716            T5: fidl::encoding::Encode<u8, D>,
1717        > fidl::encoding::Encode<BaseAddress, D> for (T0, T1, T2, T3, T4, T5)
1718    {
1719        #[inline]
1720        unsafe fn encode(
1721            self,
1722            encoder: &mut fidl::encoding::Encoder<'_, D>,
1723            offset: usize,
1724            depth: fidl::encoding::Depth,
1725        ) -> fidl::Result<()> {
1726            encoder.debug_check_bounds::<BaseAddress>(offset);
1727            // Zero out padding regions. There's no need to apply masks
1728            // because the unmasked parts will be overwritten by fields.
1729            unsafe {
1730                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
1731                (ptr as *mut u64).write_unaligned(0);
1732            }
1733            // Write the fields.
1734            self.0.encode(encoder, offset + 0, depth)?;
1735            self.1.encode(encoder, offset + 8, depth)?;
1736            self.2.encode(encoder, offset + 16, depth)?;
1737            self.3.encode(encoder, offset + 17, depth)?;
1738            self.4.encode(encoder, offset + 18, depth)?;
1739            self.5.encode(encoder, offset + 19, depth)?;
1740            Ok(())
1741        }
1742    }
1743
1744    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for BaseAddress {
1745        #[inline(always)]
1746        fn new_empty() -> Self {
1747            Self {
1748                address: fidl::new_empty!(u64, D),
1749                size: fidl::new_empty!(u64, D),
1750                is_memory: fidl::new_empty!(bool, D),
1751                is_prefetchable: fidl::new_empty!(bool, D),
1752                is_64bit: fidl::new_empty!(bool, D),
1753                id: fidl::new_empty!(u8, D),
1754            }
1755        }
1756
1757        #[inline]
1758        unsafe fn decode(
1759            &mut self,
1760            decoder: &mut fidl::encoding::Decoder<'_, D>,
1761            offset: usize,
1762            _depth: fidl::encoding::Depth,
1763        ) -> fidl::Result<()> {
1764            decoder.debug_check_bounds::<Self>(offset);
1765            // Verify that padding bytes are zero.
1766            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
1767            let padval = unsafe { (ptr as *const u64).read_unaligned() };
1768            let mask = 0xffffffff00000000u64;
1769            let maskedval = padval & mask;
1770            if maskedval != 0 {
1771                return Err(fidl::Error::NonZeroPadding {
1772                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
1773                });
1774            }
1775            fidl::decode!(u64, D, &mut self.address, decoder, offset + 0, _depth)?;
1776            fidl::decode!(u64, D, &mut self.size, decoder, offset + 8, _depth)?;
1777            fidl::decode!(bool, D, &mut self.is_memory, decoder, offset + 16, _depth)?;
1778            fidl::decode!(bool, D, &mut self.is_prefetchable, decoder, offset + 17, _depth)?;
1779            fidl::decode!(bool, D, &mut self.is_64bit, decoder, offset + 18, _depth)?;
1780            fidl::decode!(u8, D, &mut self.id, decoder, offset + 19, _depth)?;
1781            Ok(())
1782        }
1783    }
1784
1785    impl fidl::encoding::ValueTypeMarker for BusGetDevicesResponse {
1786        type Borrowed<'a> = &'a Self;
1787        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1788            value
1789        }
1790    }
1791
1792    unsafe impl fidl::encoding::TypeMarker for BusGetDevicesResponse {
1793        type Owned = Self;
1794
1795        #[inline(always)]
1796        fn inline_align(_context: fidl::encoding::Context) -> usize {
1797            8
1798        }
1799
1800        #[inline(always)]
1801        fn inline_size(_context: fidl::encoding::Context) -> usize {
1802            16
1803        }
1804    }
1805
1806    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<BusGetDevicesResponse, D>
1807        for &BusGetDevicesResponse
1808    {
1809        #[inline]
1810        unsafe fn encode(
1811            self,
1812            encoder: &mut fidl::encoding::Encoder<'_, D>,
1813            offset: usize,
1814            _depth: fidl::encoding::Depth,
1815        ) -> fidl::Result<()> {
1816            encoder.debug_check_bounds::<BusGetDevicesResponse>(offset);
1817            // Delegate to tuple encoding.
1818            fidl::encoding::Encode::<BusGetDevicesResponse, D>::encode(
1819                (
1820                    <fidl::encoding::Vector<PciDevice, 64> as fidl::encoding::ValueTypeMarker>::borrow(&self.devices),
1821                ),
1822                encoder, offset, _depth
1823            )
1824        }
1825    }
1826    unsafe impl<
1827            D: fidl::encoding::ResourceDialect,
1828            T0: fidl::encoding::Encode<fidl::encoding::Vector<PciDevice, 64>, D>,
1829        > fidl::encoding::Encode<BusGetDevicesResponse, D> for (T0,)
1830    {
1831        #[inline]
1832        unsafe fn encode(
1833            self,
1834            encoder: &mut fidl::encoding::Encoder<'_, D>,
1835            offset: usize,
1836            depth: fidl::encoding::Depth,
1837        ) -> fidl::Result<()> {
1838            encoder.debug_check_bounds::<BusGetDevicesResponse>(offset);
1839            // Zero out padding regions. There's no need to apply masks
1840            // because the unmasked parts will be overwritten by fields.
1841            // Write the fields.
1842            self.0.encode(encoder, offset + 0, depth)?;
1843            Ok(())
1844        }
1845    }
1846
1847    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for BusGetDevicesResponse {
1848        #[inline(always)]
1849        fn new_empty() -> Self {
1850            Self { devices: fidl::new_empty!(fidl::encoding::Vector<PciDevice, 64>, D) }
1851        }
1852
1853        #[inline]
1854        unsafe fn decode(
1855            &mut self,
1856            decoder: &mut fidl::encoding::Decoder<'_, D>,
1857            offset: usize,
1858            _depth: fidl::encoding::Depth,
1859        ) -> fidl::Result<()> {
1860            decoder.debug_check_bounds::<Self>(offset);
1861            // Verify that padding bytes are zero.
1862            fidl::decode!(fidl::encoding::Vector<PciDevice, 64>, D, &mut self.devices, decoder, offset + 0, _depth)?;
1863            Ok(())
1864        }
1865    }
1866
1867    impl fidl::encoding::ValueTypeMarker for BusGetHostBridgeInfoResponse {
1868        type Borrowed<'a> = &'a Self;
1869        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1870            value
1871        }
1872    }
1873
1874    unsafe impl fidl::encoding::TypeMarker for BusGetHostBridgeInfoResponse {
1875        type Owned = Self;
1876
1877        #[inline(always)]
1878        fn inline_align(_context: fidl::encoding::Context) -> usize {
1879            8
1880        }
1881
1882        #[inline(always)]
1883        fn inline_size(_context: fidl::encoding::Context) -> usize {
1884            24
1885        }
1886    }
1887
1888    unsafe impl<D: fidl::encoding::ResourceDialect>
1889        fidl::encoding::Encode<BusGetHostBridgeInfoResponse, D> for &BusGetHostBridgeInfoResponse
1890    {
1891        #[inline]
1892        unsafe fn encode(
1893            self,
1894            encoder: &mut fidl::encoding::Encoder<'_, D>,
1895            offset: usize,
1896            _depth: fidl::encoding::Depth,
1897        ) -> fidl::Result<()> {
1898            encoder.debug_check_bounds::<BusGetHostBridgeInfoResponse>(offset);
1899            // Delegate to tuple encoding.
1900            fidl::encoding::Encode::<BusGetHostBridgeInfoResponse, D>::encode(
1901                (<HostBridgeInfo as fidl::encoding::ValueTypeMarker>::borrow(&self.info),),
1902                encoder,
1903                offset,
1904                _depth,
1905            )
1906        }
1907    }
1908    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<HostBridgeInfo, D>>
1909        fidl::encoding::Encode<BusGetHostBridgeInfoResponse, D> for (T0,)
1910    {
1911        #[inline]
1912        unsafe fn encode(
1913            self,
1914            encoder: &mut fidl::encoding::Encoder<'_, D>,
1915            offset: usize,
1916            depth: fidl::encoding::Depth,
1917        ) -> fidl::Result<()> {
1918            encoder.debug_check_bounds::<BusGetHostBridgeInfoResponse>(offset);
1919            // Zero out padding regions. There's no need to apply masks
1920            // because the unmasked parts will be overwritten by fields.
1921            // Write the fields.
1922            self.0.encode(encoder, offset + 0, depth)?;
1923            Ok(())
1924        }
1925    }
1926
1927    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1928        for BusGetHostBridgeInfoResponse
1929    {
1930        #[inline(always)]
1931        fn new_empty() -> Self {
1932            Self { info: fidl::new_empty!(HostBridgeInfo, D) }
1933        }
1934
1935        #[inline]
1936        unsafe fn decode(
1937            &mut self,
1938            decoder: &mut fidl::encoding::Decoder<'_, D>,
1939            offset: usize,
1940            _depth: fidl::encoding::Depth,
1941        ) -> fidl::Result<()> {
1942            decoder.debug_check_bounds::<Self>(offset);
1943            // Verify that padding bytes are zero.
1944            fidl::decode!(HostBridgeInfo, D, &mut self.info, decoder, offset + 0, _depth)?;
1945            Ok(())
1946        }
1947    }
1948
1949    impl fidl::encoding::ValueTypeMarker for BusReadBarRequest {
1950        type Borrowed<'a> = &'a Self;
1951        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1952            value
1953        }
1954    }
1955
1956    unsafe impl fidl::encoding::TypeMarker for BusReadBarRequest {
1957        type Owned = Self;
1958
1959        #[inline(always)]
1960        fn inline_align(_context: fidl::encoding::Context) -> usize {
1961            8
1962        }
1963
1964        #[inline(always)]
1965        fn inline_size(_context: fidl::encoding::Context) -> usize {
1966            24
1967        }
1968    }
1969
1970    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<BusReadBarRequest, D>
1971        for &BusReadBarRequest
1972    {
1973        #[inline]
1974        unsafe fn encode(
1975            self,
1976            encoder: &mut fidl::encoding::Encoder<'_, D>,
1977            offset: usize,
1978            _depth: fidl::encoding::Depth,
1979        ) -> fidl::Result<()> {
1980            encoder.debug_check_bounds::<BusReadBarRequest>(offset);
1981            unsafe {
1982                // Copy the object into the buffer.
1983                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
1984                (buf_ptr as *mut BusReadBarRequest)
1985                    .write_unaligned((self as *const BusReadBarRequest).read());
1986                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
1987                // done second because the memcpy will write garbage to these bytes.
1988                let padding_ptr = buf_ptr.offset(0) as *mut u64;
1989                let padding_mask = 0xffffffff00000000u64;
1990                padding_ptr.write_unaligned(padding_ptr.read_unaligned() & !padding_mask);
1991            }
1992            Ok(())
1993        }
1994    }
1995    unsafe impl<
1996            D: fidl::encoding::ResourceDialect,
1997            T0: fidl::encoding::Encode<Address, D>,
1998            T1: fidl::encoding::Encode<u8, D>,
1999            T2: fidl::encoding::Encode<u64, D>,
2000            T3: fidl::encoding::Encode<u64, D>,
2001        > fidl::encoding::Encode<BusReadBarRequest, D> for (T0, T1, T2, T3)
2002    {
2003        #[inline]
2004        unsafe fn encode(
2005            self,
2006            encoder: &mut fidl::encoding::Encoder<'_, D>,
2007            offset: usize,
2008            depth: fidl::encoding::Depth,
2009        ) -> fidl::Result<()> {
2010            encoder.debug_check_bounds::<BusReadBarRequest>(offset);
2011            // Zero out padding regions. There's no need to apply masks
2012            // because the unmasked parts will be overwritten by fields.
2013            unsafe {
2014                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
2015                (ptr as *mut u64).write_unaligned(0);
2016            }
2017            // Write the fields.
2018            self.0.encode(encoder, offset + 0, depth)?;
2019            self.1.encode(encoder, offset + 3, depth)?;
2020            self.2.encode(encoder, offset + 8, depth)?;
2021            self.3.encode(encoder, offset + 16, depth)?;
2022            Ok(())
2023        }
2024    }
2025
2026    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for BusReadBarRequest {
2027        #[inline(always)]
2028        fn new_empty() -> Self {
2029            Self {
2030                device: fidl::new_empty!(Address, D),
2031                bar_id: fidl::new_empty!(u8, D),
2032                offset: fidl::new_empty!(u64, D),
2033                size: fidl::new_empty!(u64, D),
2034            }
2035        }
2036
2037        #[inline]
2038        unsafe fn decode(
2039            &mut self,
2040            decoder: &mut fidl::encoding::Decoder<'_, D>,
2041            offset: usize,
2042            _depth: fidl::encoding::Depth,
2043        ) -> fidl::Result<()> {
2044            decoder.debug_check_bounds::<Self>(offset);
2045            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
2046            // Verify that padding bytes are zero.
2047            let ptr = unsafe { buf_ptr.offset(0) };
2048            let padval = unsafe { (ptr as *const u64).read_unaligned() };
2049            let mask = 0xffffffff00000000u64;
2050            let maskedval = padval & mask;
2051            if maskedval != 0 {
2052                return Err(fidl::Error::NonZeroPadding {
2053                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
2054                });
2055            }
2056            // Copy from the buffer into the object.
2057            unsafe {
2058                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 24);
2059            }
2060            Ok(())
2061        }
2062    }
2063
2064    impl fidl::encoding::ValueTypeMarker for BusReadBarResponse {
2065        type Borrowed<'a> = &'a Self;
2066        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2067            value
2068        }
2069    }
2070
2071    unsafe impl fidl::encoding::TypeMarker for BusReadBarResponse {
2072        type Owned = Self;
2073
2074        #[inline(always)]
2075        fn inline_align(_context: fidl::encoding::Context) -> usize {
2076            8
2077        }
2078
2079        #[inline(always)]
2080        fn inline_size(_context: fidl::encoding::Context) -> usize {
2081            16
2082        }
2083    }
2084
2085    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<BusReadBarResponse, D>
2086        for &BusReadBarResponse
2087    {
2088        #[inline]
2089        unsafe fn encode(
2090            self,
2091            encoder: &mut fidl::encoding::Encoder<'_, D>,
2092            offset: usize,
2093            _depth: fidl::encoding::Depth,
2094        ) -> fidl::Result<()> {
2095            encoder.debug_check_bounds::<BusReadBarResponse>(offset);
2096            // Delegate to tuple encoding.
2097            fidl::encoding::Encode::<BusReadBarResponse, D>::encode(
2098                (<fidl::encoding::UnboundedVector<u8> as fidl::encoding::ValueTypeMarker>::borrow(
2099                    &self.buffer,
2100                ),),
2101                encoder,
2102                offset,
2103                _depth,
2104            )
2105        }
2106    }
2107    unsafe impl<
2108            D: fidl::encoding::ResourceDialect,
2109            T0: fidl::encoding::Encode<fidl::encoding::UnboundedVector<u8>, D>,
2110        > fidl::encoding::Encode<BusReadBarResponse, D> for (T0,)
2111    {
2112        #[inline]
2113        unsafe fn encode(
2114            self,
2115            encoder: &mut fidl::encoding::Encoder<'_, D>,
2116            offset: usize,
2117            depth: fidl::encoding::Depth,
2118        ) -> fidl::Result<()> {
2119            encoder.debug_check_bounds::<BusReadBarResponse>(offset);
2120            // Zero out padding regions. There's no need to apply masks
2121            // because the unmasked parts will be overwritten by fields.
2122            // Write the fields.
2123            self.0.encode(encoder, offset + 0, depth)?;
2124            Ok(())
2125        }
2126    }
2127
2128    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for BusReadBarResponse {
2129        #[inline(always)]
2130        fn new_empty() -> Self {
2131            Self { buffer: fidl::new_empty!(fidl::encoding::UnboundedVector<u8>, D) }
2132        }
2133
2134        #[inline]
2135        unsafe fn decode(
2136            &mut self,
2137            decoder: &mut fidl::encoding::Decoder<'_, D>,
2138            offset: usize,
2139            _depth: fidl::encoding::Depth,
2140        ) -> fidl::Result<()> {
2141            decoder.debug_check_bounds::<Self>(offset);
2142            // Verify that padding bytes are zero.
2143            fidl::decode!(
2144                fidl::encoding::UnboundedVector<u8>,
2145                D,
2146                &mut self.buffer,
2147                decoder,
2148                offset + 0,
2149                _depth
2150            )?;
2151            Ok(())
2152        }
2153    }
2154
2155    impl fidl::encoding::ValueTypeMarker for Capability {
2156        type Borrowed<'a> = &'a Self;
2157        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2158            value
2159        }
2160    }
2161
2162    unsafe impl fidl::encoding::TypeMarker for Capability {
2163        type Owned = Self;
2164
2165        #[inline(always)]
2166        fn inline_align(_context: fidl::encoding::Context) -> usize {
2167            1
2168        }
2169
2170        #[inline(always)]
2171        fn inline_size(_context: fidl::encoding::Context) -> usize {
2172            2
2173        }
2174        #[inline(always)]
2175        fn encode_is_copy() -> bool {
2176            true
2177        }
2178
2179        #[inline(always)]
2180        fn decode_is_copy() -> bool {
2181            true
2182        }
2183    }
2184
2185    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Capability, D>
2186        for &Capability
2187    {
2188        #[inline]
2189        unsafe fn encode(
2190            self,
2191            encoder: &mut fidl::encoding::Encoder<'_, D>,
2192            offset: usize,
2193            _depth: fidl::encoding::Depth,
2194        ) -> fidl::Result<()> {
2195            encoder.debug_check_bounds::<Capability>(offset);
2196            unsafe {
2197                // Copy the object into the buffer.
2198                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
2199                (buf_ptr as *mut Capability).write_unaligned((self as *const Capability).read());
2200                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
2201                // done second because the memcpy will write garbage to these bytes.
2202            }
2203            Ok(())
2204        }
2205    }
2206    unsafe impl<
2207            D: fidl::encoding::ResourceDialect,
2208            T0: fidl::encoding::Encode<u8, D>,
2209            T1: fidl::encoding::Encode<u8, D>,
2210        > fidl::encoding::Encode<Capability, D> for (T0, T1)
2211    {
2212        #[inline]
2213        unsafe fn encode(
2214            self,
2215            encoder: &mut fidl::encoding::Encoder<'_, D>,
2216            offset: usize,
2217            depth: fidl::encoding::Depth,
2218        ) -> fidl::Result<()> {
2219            encoder.debug_check_bounds::<Capability>(offset);
2220            // Zero out padding regions. There's no need to apply masks
2221            // because the unmasked parts will be overwritten by fields.
2222            // Write the fields.
2223            self.0.encode(encoder, offset + 0, depth)?;
2224            self.1.encode(encoder, offset + 1, depth)?;
2225            Ok(())
2226        }
2227    }
2228
2229    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Capability {
2230        #[inline(always)]
2231        fn new_empty() -> Self {
2232            Self { id: fidl::new_empty!(u8, D), offset: fidl::new_empty!(u8, D) }
2233        }
2234
2235        #[inline]
2236        unsafe fn decode(
2237            &mut self,
2238            decoder: &mut fidl::encoding::Decoder<'_, D>,
2239            offset: usize,
2240            _depth: fidl::encoding::Depth,
2241        ) -> fidl::Result<()> {
2242            decoder.debug_check_bounds::<Self>(offset);
2243            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
2244            // Verify that padding bytes are zero.
2245            // Copy from the buffer into the object.
2246            unsafe {
2247                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 2);
2248            }
2249            Ok(())
2250        }
2251    }
2252
2253    impl fidl::encoding::ValueTypeMarker for DeviceGetBarRequest {
2254        type Borrowed<'a> = &'a Self;
2255        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2256            value
2257        }
2258    }
2259
2260    unsafe impl fidl::encoding::TypeMarker for DeviceGetBarRequest {
2261        type Owned = Self;
2262
2263        #[inline(always)]
2264        fn inline_align(_context: fidl::encoding::Context) -> usize {
2265            4
2266        }
2267
2268        #[inline(always)]
2269        fn inline_size(_context: fidl::encoding::Context) -> usize {
2270            4
2271        }
2272        #[inline(always)]
2273        fn encode_is_copy() -> bool {
2274            true
2275        }
2276
2277        #[inline(always)]
2278        fn decode_is_copy() -> bool {
2279            true
2280        }
2281    }
2282
2283    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<DeviceGetBarRequest, D>
2284        for &DeviceGetBarRequest
2285    {
2286        #[inline]
2287        unsafe fn encode(
2288            self,
2289            encoder: &mut fidl::encoding::Encoder<'_, D>,
2290            offset: usize,
2291            _depth: fidl::encoding::Depth,
2292        ) -> fidl::Result<()> {
2293            encoder.debug_check_bounds::<DeviceGetBarRequest>(offset);
2294            unsafe {
2295                // Copy the object into the buffer.
2296                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
2297                (buf_ptr as *mut DeviceGetBarRequest)
2298                    .write_unaligned((self as *const DeviceGetBarRequest).read());
2299                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
2300                // done second because the memcpy will write garbage to these bytes.
2301            }
2302            Ok(())
2303        }
2304    }
2305    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u32, D>>
2306        fidl::encoding::Encode<DeviceGetBarRequest, D> for (T0,)
2307    {
2308        #[inline]
2309        unsafe fn encode(
2310            self,
2311            encoder: &mut fidl::encoding::Encoder<'_, D>,
2312            offset: usize,
2313            depth: fidl::encoding::Depth,
2314        ) -> fidl::Result<()> {
2315            encoder.debug_check_bounds::<DeviceGetBarRequest>(offset);
2316            // Zero out padding regions. There's no need to apply masks
2317            // because the unmasked parts will be overwritten by fields.
2318            // Write the fields.
2319            self.0.encode(encoder, offset + 0, depth)?;
2320            Ok(())
2321        }
2322    }
2323
2324    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for DeviceGetBarRequest {
2325        #[inline(always)]
2326        fn new_empty() -> Self {
2327            Self { bar_id: fidl::new_empty!(u32, D) }
2328        }
2329
2330        #[inline]
2331        unsafe fn decode(
2332            &mut self,
2333            decoder: &mut fidl::encoding::Decoder<'_, D>,
2334            offset: usize,
2335            _depth: fidl::encoding::Depth,
2336        ) -> fidl::Result<()> {
2337            decoder.debug_check_bounds::<Self>(offset);
2338            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
2339            // Verify that padding bytes are zero.
2340            // Copy from the buffer into the object.
2341            unsafe {
2342                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
2343            }
2344            Ok(())
2345        }
2346    }
2347
2348    impl fidl::encoding::ValueTypeMarker for DeviceGetBtiRequest {
2349        type Borrowed<'a> = &'a Self;
2350        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2351            value
2352        }
2353    }
2354
2355    unsafe impl fidl::encoding::TypeMarker for DeviceGetBtiRequest {
2356        type Owned = Self;
2357
2358        #[inline(always)]
2359        fn inline_align(_context: fidl::encoding::Context) -> usize {
2360            4
2361        }
2362
2363        #[inline(always)]
2364        fn inline_size(_context: fidl::encoding::Context) -> usize {
2365            4
2366        }
2367        #[inline(always)]
2368        fn encode_is_copy() -> bool {
2369            true
2370        }
2371
2372        #[inline(always)]
2373        fn decode_is_copy() -> bool {
2374            true
2375        }
2376    }
2377
2378    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<DeviceGetBtiRequest, D>
2379        for &DeviceGetBtiRequest
2380    {
2381        #[inline]
2382        unsafe fn encode(
2383            self,
2384            encoder: &mut fidl::encoding::Encoder<'_, D>,
2385            offset: usize,
2386            _depth: fidl::encoding::Depth,
2387        ) -> fidl::Result<()> {
2388            encoder.debug_check_bounds::<DeviceGetBtiRequest>(offset);
2389            unsafe {
2390                // Copy the object into the buffer.
2391                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
2392                (buf_ptr as *mut DeviceGetBtiRequest)
2393                    .write_unaligned((self as *const DeviceGetBtiRequest).read());
2394                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
2395                // done second because the memcpy will write garbage to these bytes.
2396            }
2397            Ok(())
2398        }
2399    }
2400    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u32, D>>
2401        fidl::encoding::Encode<DeviceGetBtiRequest, D> for (T0,)
2402    {
2403        #[inline]
2404        unsafe fn encode(
2405            self,
2406            encoder: &mut fidl::encoding::Encoder<'_, D>,
2407            offset: usize,
2408            depth: fidl::encoding::Depth,
2409        ) -> fidl::Result<()> {
2410            encoder.debug_check_bounds::<DeviceGetBtiRequest>(offset);
2411            // Zero out padding regions. There's no need to apply masks
2412            // because the unmasked parts will be overwritten by fields.
2413            // Write the fields.
2414            self.0.encode(encoder, offset + 0, depth)?;
2415            Ok(())
2416        }
2417    }
2418
2419    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for DeviceGetBtiRequest {
2420        #[inline(always)]
2421        fn new_empty() -> Self {
2422            Self { index: fidl::new_empty!(u32, D) }
2423        }
2424
2425        #[inline]
2426        unsafe fn decode(
2427            &mut self,
2428            decoder: &mut fidl::encoding::Decoder<'_, D>,
2429            offset: usize,
2430            _depth: fidl::encoding::Depth,
2431        ) -> fidl::Result<()> {
2432            decoder.debug_check_bounds::<Self>(offset);
2433            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
2434            // Verify that padding bytes are zero.
2435            // Copy from the buffer into the object.
2436            unsafe {
2437                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
2438            }
2439            Ok(())
2440        }
2441    }
2442
2443    impl fidl::encoding::ValueTypeMarker for DeviceGetCapabilitiesRequest {
2444        type Borrowed<'a> = &'a Self;
2445        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2446            value
2447        }
2448    }
2449
2450    unsafe impl fidl::encoding::TypeMarker for DeviceGetCapabilitiesRequest {
2451        type Owned = Self;
2452
2453        #[inline(always)]
2454        fn inline_align(_context: fidl::encoding::Context) -> usize {
2455            1
2456        }
2457
2458        #[inline(always)]
2459        fn inline_size(_context: fidl::encoding::Context) -> usize {
2460            1
2461        }
2462    }
2463
2464    unsafe impl<D: fidl::encoding::ResourceDialect>
2465        fidl::encoding::Encode<DeviceGetCapabilitiesRequest, D> for &DeviceGetCapabilitiesRequest
2466    {
2467        #[inline]
2468        unsafe fn encode(
2469            self,
2470            encoder: &mut fidl::encoding::Encoder<'_, D>,
2471            offset: usize,
2472            _depth: fidl::encoding::Depth,
2473        ) -> fidl::Result<()> {
2474            encoder.debug_check_bounds::<DeviceGetCapabilitiesRequest>(offset);
2475            // Delegate to tuple encoding.
2476            fidl::encoding::Encode::<DeviceGetCapabilitiesRequest, D>::encode(
2477                (<CapabilityId as fidl::encoding::ValueTypeMarker>::borrow(&self.id),),
2478                encoder,
2479                offset,
2480                _depth,
2481            )
2482        }
2483    }
2484    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<CapabilityId, D>>
2485        fidl::encoding::Encode<DeviceGetCapabilitiesRequest, D> for (T0,)
2486    {
2487        #[inline]
2488        unsafe fn encode(
2489            self,
2490            encoder: &mut fidl::encoding::Encoder<'_, D>,
2491            offset: usize,
2492            depth: fidl::encoding::Depth,
2493        ) -> fidl::Result<()> {
2494            encoder.debug_check_bounds::<DeviceGetCapabilitiesRequest>(offset);
2495            // Zero out padding regions. There's no need to apply masks
2496            // because the unmasked parts will be overwritten by fields.
2497            // Write the fields.
2498            self.0.encode(encoder, offset + 0, depth)?;
2499            Ok(())
2500        }
2501    }
2502
2503    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2504        for DeviceGetCapabilitiesRequest
2505    {
2506        #[inline(always)]
2507        fn new_empty() -> Self {
2508            Self { id: fidl::new_empty!(CapabilityId, D) }
2509        }
2510
2511        #[inline]
2512        unsafe fn decode(
2513            &mut self,
2514            decoder: &mut fidl::encoding::Decoder<'_, D>,
2515            offset: usize,
2516            _depth: fidl::encoding::Depth,
2517        ) -> fidl::Result<()> {
2518            decoder.debug_check_bounds::<Self>(offset);
2519            // Verify that padding bytes are zero.
2520            fidl::decode!(CapabilityId, D, &mut self.id, decoder, offset + 0, _depth)?;
2521            Ok(())
2522        }
2523    }
2524
2525    impl fidl::encoding::ValueTypeMarker for DeviceGetCapabilitiesResponse {
2526        type Borrowed<'a> = &'a Self;
2527        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2528            value
2529        }
2530    }
2531
2532    unsafe impl fidl::encoding::TypeMarker for DeviceGetCapabilitiesResponse {
2533        type Owned = Self;
2534
2535        #[inline(always)]
2536        fn inline_align(_context: fidl::encoding::Context) -> usize {
2537            8
2538        }
2539
2540        #[inline(always)]
2541        fn inline_size(_context: fidl::encoding::Context) -> usize {
2542            16
2543        }
2544    }
2545
2546    unsafe impl<D: fidl::encoding::ResourceDialect>
2547        fidl::encoding::Encode<DeviceGetCapabilitiesResponse, D>
2548        for &DeviceGetCapabilitiesResponse
2549    {
2550        #[inline]
2551        unsafe fn encode(
2552            self,
2553            encoder: &mut fidl::encoding::Encoder<'_, D>,
2554            offset: usize,
2555            _depth: fidl::encoding::Depth,
2556        ) -> fidl::Result<()> {
2557            encoder.debug_check_bounds::<DeviceGetCapabilitiesResponse>(offset);
2558            // Delegate to tuple encoding.
2559            fidl::encoding::Encode::<DeviceGetCapabilitiesResponse, D>::encode(
2560                (<fidl::encoding::Vector<u8, 32> as fidl::encoding::ValueTypeMarker>::borrow(
2561                    &self.offsets,
2562                ),),
2563                encoder,
2564                offset,
2565                _depth,
2566            )
2567        }
2568    }
2569    unsafe impl<
2570            D: fidl::encoding::ResourceDialect,
2571            T0: fidl::encoding::Encode<fidl::encoding::Vector<u8, 32>, D>,
2572        > fidl::encoding::Encode<DeviceGetCapabilitiesResponse, D> for (T0,)
2573    {
2574        #[inline]
2575        unsafe fn encode(
2576            self,
2577            encoder: &mut fidl::encoding::Encoder<'_, D>,
2578            offset: usize,
2579            depth: fidl::encoding::Depth,
2580        ) -> fidl::Result<()> {
2581            encoder.debug_check_bounds::<DeviceGetCapabilitiesResponse>(offset);
2582            // Zero out padding regions. There's no need to apply masks
2583            // because the unmasked parts will be overwritten by fields.
2584            // Write the fields.
2585            self.0.encode(encoder, offset + 0, depth)?;
2586            Ok(())
2587        }
2588    }
2589
2590    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2591        for DeviceGetCapabilitiesResponse
2592    {
2593        #[inline(always)]
2594        fn new_empty() -> Self {
2595            Self { offsets: fidl::new_empty!(fidl::encoding::Vector<u8, 32>, D) }
2596        }
2597
2598        #[inline]
2599        unsafe fn decode(
2600            &mut self,
2601            decoder: &mut fidl::encoding::Decoder<'_, D>,
2602            offset: usize,
2603            _depth: fidl::encoding::Depth,
2604        ) -> fidl::Result<()> {
2605            decoder.debug_check_bounds::<Self>(offset);
2606            // Verify that padding bytes are zero.
2607            fidl::decode!(fidl::encoding::Vector<u8, 32>, D, &mut self.offsets, decoder, offset + 0, _depth)?;
2608            Ok(())
2609        }
2610    }
2611
2612    impl fidl::encoding::ValueTypeMarker for DeviceGetDeviceInfoResponse {
2613        type Borrowed<'a> = &'a Self;
2614        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2615            value
2616        }
2617    }
2618
2619    unsafe impl fidl::encoding::TypeMarker for DeviceGetDeviceInfoResponse {
2620        type Owned = Self;
2621
2622        #[inline(always)]
2623        fn inline_align(_context: fidl::encoding::Context) -> usize {
2624            2
2625        }
2626
2627        #[inline(always)]
2628        fn inline_size(_context: fidl::encoding::Context) -> usize {
2629            12
2630        }
2631    }
2632
2633    unsafe impl<D: fidl::encoding::ResourceDialect>
2634        fidl::encoding::Encode<DeviceGetDeviceInfoResponse, D> for &DeviceGetDeviceInfoResponse
2635    {
2636        #[inline]
2637        unsafe fn encode(
2638            self,
2639            encoder: &mut fidl::encoding::Encoder<'_, D>,
2640            offset: usize,
2641            _depth: fidl::encoding::Depth,
2642        ) -> fidl::Result<()> {
2643            encoder.debug_check_bounds::<DeviceGetDeviceInfoResponse>(offset);
2644            // Delegate to tuple encoding.
2645            fidl::encoding::Encode::<DeviceGetDeviceInfoResponse, D>::encode(
2646                (<DeviceInfo as fidl::encoding::ValueTypeMarker>::borrow(&self.info),),
2647                encoder,
2648                offset,
2649                _depth,
2650            )
2651        }
2652    }
2653    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<DeviceInfo, D>>
2654        fidl::encoding::Encode<DeviceGetDeviceInfoResponse, D> for (T0,)
2655    {
2656        #[inline]
2657        unsafe fn encode(
2658            self,
2659            encoder: &mut fidl::encoding::Encoder<'_, D>,
2660            offset: usize,
2661            depth: fidl::encoding::Depth,
2662        ) -> fidl::Result<()> {
2663            encoder.debug_check_bounds::<DeviceGetDeviceInfoResponse>(offset);
2664            // Zero out padding regions. There's no need to apply masks
2665            // because the unmasked parts will be overwritten by fields.
2666            // Write the fields.
2667            self.0.encode(encoder, offset + 0, depth)?;
2668            Ok(())
2669        }
2670    }
2671
2672    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2673        for DeviceGetDeviceInfoResponse
2674    {
2675        #[inline(always)]
2676        fn new_empty() -> Self {
2677            Self { info: fidl::new_empty!(DeviceInfo, D) }
2678        }
2679
2680        #[inline]
2681        unsafe fn decode(
2682            &mut self,
2683            decoder: &mut fidl::encoding::Decoder<'_, D>,
2684            offset: usize,
2685            _depth: fidl::encoding::Depth,
2686        ) -> fidl::Result<()> {
2687            decoder.debug_check_bounds::<Self>(offset);
2688            // Verify that padding bytes are zero.
2689            fidl::decode!(DeviceInfo, D, &mut self.info, decoder, offset + 0, _depth)?;
2690            Ok(())
2691        }
2692    }
2693
2694    impl fidl::encoding::ValueTypeMarker for DeviceGetExtendedCapabilitiesRequest {
2695        type Borrowed<'a> = &'a Self;
2696        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2697            value
2698        }
2699    }
2700
2701    unsafe impl fidl::encoding::TypeMarker for DeviceGetExtendedCapabilitiesRequest {
2702        type Owned = Self;
2703
2704        #[inline(always)]
2705        fn inline_align(_context: fidl::encoding::Context) -> usize {
2706            2
2707        }
2708
2709        #[inline(always)]
2710        fn inline_size(_context: fidl::encoding::Context) -> usize {
2711            2
2712        }
2713    }
2714
2715    unsafe impl<D: fidl::encoding::ResourceDialect>
2716        fidl::encoding::Encode<DeviceGetExtendedCapabilitiesRequest, D>
2717        for &DeviceGetExtendedCapabilitiesRequest
2718    {
2719        #[inline]
2720        unsafe fn encode(
2721            self,
2722            encoder: &mut fidl::encoding::Encoder<'_, D>,
2723            offset: usize,
2724            _depth: fidl::encoding::Depth,
2725        ) -> fidl::Result<()> {
2726            encoder.debug_check_bounds::<DeviceGetExtendedCapabilitiesRequest>(offset);
2727            // Delegate to tuple encoding.
2728            fidl::encoding::Encode::<DeviceGetExtendedCapabilitiesRequest, D>::encode(
2729                (<ExtendedCapabilityId as fidl::encoding::ValueTypeMarker>::borrow(&self.id),),
2730                encoder,
2731                offset,
2732                _depth,
2733            )
2734        }
2735    }
2736    unsafe impl<
2737            D: fidl::encoding::ResourceDialect,
2738            T0: fidl::encoding::Encode<ExtendedCapabilityId, D>,
2739        > fidl::encoding::Encode<DeviceGetExtendedCapabilitiesRequest, D> for (T0,)
2740    {
2741        #[inline]
2742        unsafe fn encode(
2743            self,
2744            encoder: &mut fidl::encoding::Encoder<'_, D>,
2745            offset: usize,
2746            depth: fidl::encoding::Depth,
2747        ) -> fidl::Result<()> {
2748            encoder.debug_check_bounds::<DeviceGetExtendedCapabilitiesRequest>(offset);
2749            // Zero out padding regions. There's no need to apply masks
2750            // because the unmasked parts will be overwritten by fields.
2751            // Write the fields.
2752            self.0.encode(encoder, offset + 0, depth)?;
2753            Ok(())
2754        }
2755    }
2756
2757    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2758        for DeviceGetExtendedCapabilitiesRequest
2759    {
2760        #[inline(always)]
2761        fn new_empty() -> Self {
2762            Self { id: fidl::new_empty!(ExtendedCapabilityId, D) }
2763        }
2764
2765        #[inline]
2766        unsafe fn decode(
2767            &mut self,
2768            decoder: &mut fidl::encoding::Decoder<'_, D>,
2769            offset: usize,
2770            _depth: fidl::encoding::Depth,
2771        ) -> fidl::Result<()> {
2772            decoder.debug_check_bounds::<Self>(offset);
2773            // Verify that padding bytes are zero.
2774            fidl::decode!(ExtendedCapabilityId, D, &mut self.id, decoder, offset + 0, _depth)?;
2775            Ok(())
2776        }
2777    }
2778
2779    impl fidl::encoding::ValueTypeMarker for DeviceGetExtendedCapabilitiesResponse {
2780        type Borrowed<'a> = &'a Self;
2781        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2782            value
2783        }
2784    }
2785
2786    unsafe impl fidl::encoding::TypeMarker for DeviceGetExtendedCapabilitiesResponse {
2787        type Owned = Self;
2788
2789        #[inline(always)]
2790        fn inline_align(_context: fidl::encoding::Context) -> usize {
2791            8
2792        }
2793
2794        #[inline(always)]
2795        fn inline_size(_context: fidl::encoding::Context) -> usize {
2796            16
2797        }
2798    }
2799
2800    unsafe impl<D: fidl::encoding::ResourceDialect>
2801        fidl::encoding::Encode<DeviceGetExtendedCapabilitiesResponse, D>
2802        for &DeviceGetExtendedCapabilitiesResponse
2803    {
2804        #[inline]
2805        unsafe fn encode(
2806            self,
2807            encoder: &mut fidl::encoding::Encoder<'_, D>,
2808            offset: usize,
2809            _depth: fidl::encoding::Depth,
2810        ) -> fidl::Result<()> {
2811            encoder.debug_check_bounds::<DeviceGetExtendedCapabilitiesResponse>(offset);
2812            // Delegate to tuple encoding.
2813            fidl::encoding::Encode::<DeviceGetExtendedCapabilitiesResponse, D>::encode(
2814                (<fidl::encoding::Vector<u16, 32> as fidl::encoding::ValueTypeMarker>::borrow(
2815                    &self.offsets,
2816                ),),
2817                encoder,
2818                offset,
2819                _depth,
2820            )
2821        }
2822    }
2823    unsafe impl<
2824            D: fidl::encoding::ResourceDialect,
2825            T0: fidl::encoding::Encode<fidl::encoding::Vector<u16, 32>, D>,
2826        > fidl::encoding::Encode<DeviceGetExtendedCapabilitiesResponse, D> for (T0,)
2827    {
2828        #[inline]
2829        unsafe fn encode(
2830            self,
2831            encoder: &mut fidl::encoding::Encoder<'_, D>,
2832            offset: usize,
2833            depth: fidl::encoding::Depth,
2834        ) -> fidl::Result<()> {
2835            encoder.debug_check_bounds::<DeviceGetExtendedCapabilitiesResponse>(offset);
2836            // Zero out padding regions. There's no need to apply masks
2837            // because the unmasked parts will be overwritten by fields.
2838            // Write the fields.
2839            self.0.encode(encoder, offset + 0, depth)?;
2840            Ok(())
2841        }
2842    }
2843
2844    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2845        for DeviceGetExtendedCapabilitiesResponse
2846    {
2847        #[inline(always)]
2848        fn new_empty() -> Self {
2849            Self { offsets: fidl::new_empty!(fidl::encoding::Vector<u16, 32>, D) }
2850        }
2851
2852        #[inline]
2853        unsafe fn decode(
2854            &mut self,
2855            decoder: &mut fidl::encoding::Decoder<'_, D>,
2856            offset: usize,
2857            _depth: fidl::encoding::Depth,
2858        ) -> fidl::Result<()> {
2859            decoder.debug_check_bounds::<Self>(offset);
2860            // Verify that padding bytes are zero.
2861            fidl::decode!(fidl::encoding::Vector<u16, 32>, D, &mut self.offsets, decoder, offset + 0, _depth)?;
2862            Ok(())
2863        }
2864    }
2865
2866    impl fidl::encoding::ValueTypeMarker for DeviceGetInterruptModesResponse {
2867        type Borrowed<'a> = &'a Self;
2868        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2869            value
2870        }
2871    }
2872
2873    unsafe impl fidl::encoding::TypeMarker for DeviceGetInterruptModesResponse {
2874        type Owned = Self;
2875
2876        #[inline(always)]
2877        fn inline_align(_context: fidl::encoding::Context) -> usize {
2878            2
2879        }
2880
2881        #[inline(always)]
2882        fn inline_size(_context: fidl::encoding::Context) -> usize {
2883            4
2884        }
2885    }
2886
2887    unsafe impl<D: fidl::encoding::ResourceDialect>
2888        fidl::encoding::Encode<DeviceGetInterruptModesResponse, D>
2889        for &DeviceGetInterruptModesResponse
2890    {
2891        #[inline]
2892        unsafe fn encode(
2893            self,
2894            encoder: &mut fidl::encoding::Encoder<'_, D>,
2895            offset: usize,
2896            _depth: fidl::encoding::Depth,
2897        ) -> fidl::Result<()> {
2898            encoder.debug_check_bounds::<DeviceGetInterruptModesResponse>(offset);
2899            // Delegate to tuple encoding.
2900            fidl::encoding::Encode::<DeviceGetInterruptModesResponse, D>::encode(
2901                (<InterruptModes as fidl::encoding::ValueTypeMarker>::borrow(&self.modes),),
2902                encoder,
2903                offset,
2904                _depth,
2905            )
2906        }
2907    }
2908    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<InterruptModes, D>>
2909        fidl::encoding::Encode<DeviceGetInterruptModesResponse, D> for (T0,)
2910    {
2911        #[inline]
2912        unsafe fn encode(
2913            self,
2914            encoder: &mut fidl::encoding::Encoder<'_, D>,
2915            offset: usize,
2916            depth: fidl::encoding::Depth,
2917        ) -> fidl::Result<()> {
2918            encoder.debug_check_bounds::<DeviceGetInterruptModesResponse>(offset);
2919            // Zero out padding regions. There's no need to apply masks
2920            // because the unmasked parts will be overwritten by fields.
2921            // Write the fields.
2922            self.0.encode(encoder, offset + 0, depth)?;
2923            Ok(())
2924        }
2925    }
2926
2927    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2928        for DeviceGetInterruptModesResponse
2929    {
2930        #[inline(always)]
2931        fn new_empty() -> Self {
2932            Self { modes: fidl::new_empty!(InterruptModes, D) }
2933        }
2934
2935        #[inline]
2936        unsafe fn decode(
2937            &mut self,
2938            decoder: &mut fidl::encoding::Decoder<'_, D>,
2939            offset: usize,
2940            _depth: fidl::encoding::Depth,
2941        ) -> fidl::Result<()> {
2942            decoder.debug_check_bounds::<Self>(offset);
2943            // Verify that padding bytes are zero.
2944            fidl::decode!(InterruptModes, D, &mut self.modes, decoder, offset + 0, _depth)?;
2945            Ok(())
2946        }
2947    }
2948
2949    impl fidl::encoding::ValueTypeMarker for DeviceInfo {
2950        type Borrowed<'a> = &'a Self;
2951        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2952            value
2953        }
2954    }
2955
2956    unsafe impl fidl::encoding::TypeMarker for DeviceInfo {
2957        type Owned = Self;
2958
2959        #[inline(always)]
2960        fn inline_align(_context: fidl::encoding::Context) -> usize {
2961            2
2962        }
2963
2964        #[inline(always)]
2965        fn inline_size(_context: fidl::encoding::Context) -> usize {
2966            12
2967        }
2968    }
2969
2970    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<DeviceInfo, D>
2971        for &DeviceInfo
2972    {
2973        #[inline]
2974        unsafe fn encode(
2975            self,
2976            encoder: &mut fidl::encoding::Encoder<'_, D>,
2977            offset: usize,
2978            _depth: fidl::encoding::Depth,
2979        ) -> fidl::Result<()> {
2980            encoder.debug_check_bounds::<DeviceInfo>(offset);
2981            // Delegate to tuple encoding.
2982            fidl::encoding::Encode::<DeviceInfo, D>::encode(
2983                (
2984                    <u16 as fidl::encoding::ValueTypeMarker>::borrow(&self.vendor_id),
2985                    <u16 as fidl::encoding::ValueTypeMarker>::borrow(&self.device_id),
2986                    <u8 as fidl::encoding::ValueTypeMarker>::borrow(&self.base_class),
2987                    <u8 as fidl::encoding::ValueTypeMarker>::borrow(&self.sub_class),
2988                    <u8 as fidl::encoding::ValueTypeMarker>::borrow(&self.program_interface),
2989                    <u8 as fidl::encoding::ValueTypeMarker>::borrow(&self.revision_id),
2990                    <u8 as fidl::encoding::ValueTypeMarker>::borrow(&self.bus_id),
2991                    <u8 as fidl::encoding::ValueTypeMarker>::borrow(&self.dev_id),
2992                    <u8 as fidl::encoding::ValueTypeMarker>::borrow(&self.func_id),
2993                    <Padding as fidl::encoding::ValueTypeMarker>::borrow(&self.padding),
2994                ),
2995                encoder,
2996                offset,
2997                _depth,
2998            )
2999        }
3000    }
3001    unsafe impl<
3002            D: fidl::encoding::ResourceDialect,
3003            T0: fidl::encoding::Encode<u16, D>,
3004            T1: fidl::encoding::Encode<u16, D>,
3005            T2: fidl::encoding::Encode<u8, D>,
3006            T3: fidl::encoding::Encode<u8, D>,
3007            T4: fidl::encoding::Encode<u8, D>,
3008            T5: fidl::encoding::Encode<u8, D>,
3009            T6: fidl::encoding::Encode<u8, D>,
3010            T7: fidl::encoding::Encode<u8, D>,
3011            T8: fidl::encoding::Encode<u8, D>,
3012            T9: fidl::encoding::Encode<Padding, D>,
3013        > fidl::encoding::Encode<DeviceInfo, D> for (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9)
3014    {
3015        #[inline]
3016        unsafe fn encode(
3017            self,
3018            encoder: &mut fidl::encoding::Encoder<'_, D>,
3019            offset: usize,
3020            depth: fidl::encoding::Depth,
3021        ) -> fidl::Result<()> {
3022            encoder.debug_check_bounds::<DeviceInfo>(offset);
3023            // Zero out padding regions. There's no need to apply masks
3024            // because the unmasked parts will be overwritten by fields.
3025            // Write the fields.
3026            self.0.encode(encoder, offset + 0, depth)?;
3027            self.1.encode(encoder, offset + 2, depth)?;
3028            self.2.encode(encoder, offset + 4, depth)?;
3029            self.3.encode(encoder, offset + 5, depth)?;
3030            self.4.encode(encoder, offset + 6, depth)?;
3031            self.5.encode(encoder, offset + 7, depth)?;
3032            self.6.encode(encoder, offset + 8, depth)?;
3033            self.7.encode(encoder, offset + 9, depth)?;
3034            self.8.encode(encoder, offset + 10, depth)?;
3035            self.9.encode(encoder, offset + 11, depth)?;
3036            Ok(())
3037        }
3038    }
3039
3040    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for DeviceInfo {
3041        #[inline(always)]
3042        fn new_empty() -> Self {
3043            Self {
3044                vendor_id: fidl::new_empty!(u16, D),
3045                device_id: fidl::new_empty!(u16, D),
3046                base_class: fidl::new_empty!(u8, D),
3047                sub_class: fidl::new_empty!(u8, D),
3048                program_interface: fidl::new_empty!(u8, D),
3049                revision_id: fidl::new_empty!(u8, D),
3050                bus_id: fidl::new_empty!(u8, D),
3051                dev_id: fidl::new_empty!(u8, D),
3052                func_id: fidl::new_empty!(u8, D),
3053                padding: fidl::new_empty!(Padding, D),
3054            }
3055        }
3056
3057        #[inline]
3058        unsafe fn decode(
3059            &mut self,
3060            decoder: &mut fidl::encoding::Decoder<'_, D>,
3061            offset: usize,
3062            _depth: fidl::encoding::Depth,
3063        ) -> fidl::Result<()> {
3064            decoder.debug_check_bounds::<Self>(offset);
3065            // Verify that padding bytes are zero.
3066            fidl::decode!(u16, D, &mut self.vendor_id, decoder, offset + 0, _depth)?;
3067            fidl::decode!(u16, D, &mut self.device_id, decoder, offset + 2, _depth)?;
3068            fidl::decode!(u8, D, &mut self.base_class, decoder, offset + 4, _depth)?;
3069            fidl::decode!(u8, D, &mut self.sub_class, decoder, offset + 5, _depth)?;
3070            fidl::decode!(u8, D, &mut self.program_interface, decoder, offset + 6, _depth)?;
3071            fidl::decode!(u8, D, &mut self.revision_id, decoder, offset + 7, _depth)?;
3072            fidl::decode!(u8, D, &mut self.bus_id, decoder, offset + 8, _depth)?;
3073            fidl::decode!(u8, D, &mut self.dev_id, decoder, offset + 9, _depth)?;
3074            fidl::decode!(u8, D, &mut self.func_id, decoder, offset + 10, _depth)?;
3075            fidl::decode!(Padding, D, &mut self.padding, decoder, offset + 11, _depth)?;
3076            Ok(())
3077        }
3078    }
3079
3080    impl fidl::encoding::ValueTypeMarker for DeviceMapInterruptRequest {
3081        type Borrowed<'a> = &'a Self;
3082        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3083            value
3084        }
3085    }
3086
3087    unsafe impl fidl::encoding::TypeMarker for DeviceMapInterruptRequest {
3088        type Owned = Self;
3089
3090        #[inline(always)]
3091        fn inline_align(_context: fidl::encoding::Context) -> usize {
3092            4
3093        }
3094
3095        #[inline(always)]
3096        fn inline_size(_context: fidl::encoding::Context) -> usize {
3097            4
3098        }
3099        #[inline(always)]
3100        fn encode_is_copy() -> bool {
3101            true
3102        }
3103
3104        #[inline(always)]
3105        fn decode_is_copy() -> bool {
3106            true
3107        }
3108    }
3109
3110    unsafe impl<D: fidl::encoding::ResourceDialect>
3111        fidl::encoding::Encode<DeviceMapInterruptRequest, D> for &DeviceMapInterruptRequest
3112    {
3113        #[inline]
3114        unsafe fn encode(
3115            self,
3116            encoder: &mut fidl::encoding::Encoder<'_, D>,
3117            offset: usize,
3118            _depth: fidl::encoding::Depth,
3119        ) -> fidl::Result<()> {
3120            encoder.debug_check_bounds::<DeviceMapInterruptRequest>(offset);
3121            unsafe {
3122                // Copy the object into the buffer.
3123                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
3124                (buf_ptr as *mut DeviceMapInterruptRequest)
3125                    .write_unaligned((self as *const DeviceMapInterruptRequest).read());
3126                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
3127                // done second because the memcpy will write garbage to these bytes.
3128            }
3129            Ok(())
3130        }
3131    }
3132    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u32, D>>
3133        fidl::encoding::Encode<DeviceMapInterruptRequest, D> for (T0,)
3134    {
3135        #[inline]
3136        unsafe fn encode(
3137            self,
3138            encoder: &mut fidl::encoding::Encoder<'_, D>,
3139            offset: usize,
3140            depth: fidl::encoding::Depth,
3141        ) -> fidl::Result<()> {
3142            encoder.debug_check_bounds::<DeviceMapInterruptRequest>(offset);
3143            // Zero out padding regions. There's no need to apply masks
3144            // because the unmasked parts will be overwritten by fields.
3145            // Write the fields.
3146            self.0.encode(encoder, offset + 0, depth)?;
3147            Ok(())
3148        }
3149    }
3150
3151    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3152        for DeviceMapInterruptRequest
3153    {
3154        #[inline(always)]
3155        fn new_empty() -> Self {
3156            Self { which_irq: fidl::new_empty!(u32, D) }
3157        }
3158
3159        #[inline]
3160        unsafe fn decode(
3161            &mut self,
3162            decoder: &mut fidl::encoding::Decoder<'_, D>,
3163            offset: usize,
3164            _depth: fidl::encoding::Depth,
3165        ) -> fidl::Result<()> {
3166            decoder.debug_check_bounds::<Self>(offset);
3167            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
3168            // Verify that padding bytes are zero.
3169            // Copy from the buffer into the object.
3170            unsafe {
3171                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
3172            }
3173            Ok(())
3174        }
3175    }
3176
3177    impl fidl::encoding::ValueTypeMarker for DeviceReadConfig16Request {
3178        type Borrowed<'a> = &'a Self;
3179        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3180            value
3181        }
3182    }
3183
3184    unsafe impl fidl::encoding::TypeMarker for DeviceReadConfig16Request {
3185        type Owned = Self;
3186
3187        #[inline(always)]
3188        fn inline_align(_context: fidl::encoding::Context) -> usize {
3189            2
3190        }
3191
3192        #[inline(always)]
3193        fn inline_size(_context: fidl::encoding::Context) -> usize {
3194            2
3195        }
3196        #[inline(always)]
3197        fn encode_is_copy() -> bool {
3198            true
3199        }
3200
3201        #[inline(always)]
3202        fn decode_is_copy() -> bool {
3203            true
3204        }
3205    }
3206
3207    unsafe impl<D: fidl::encoding::ResourceDialect>
3208        fidl::encoding::Encode<DeviceReadConfig16Request, D> for &DeviceReadConfig16Request
3209    {
3210        #[inline]
3211        unsafe fn encode(
3212            self,
3213            encoder: &mut fidl::encoding::Encoder<'_, D>,
3214            offset: usize,
3215            _depth: fidl::encoding::Depth,
3216        ) -> fidl::Result<()> {
3217            encoder.debug_check_bounds::<DeviceReadConfig16Request>(offset);
3218            unsafe {
3219                // Copy the object into the buffer.
3220                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
3221                (buf_ptr as *mut DeviceReadConfig16Request)
3222                    .write_unaligned((self as *const DeviceReadConfig16Request).read());
3223                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
3224                // done second because the memcpy will write garbage to these bytes.
3225            }
3226            Ok(())
3227        }
3228    }
3229    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u16, D>>
3230        fidl::encoding::Encode<DeviceReadConfig16Request, D> for (T0,)
3231    {
3232        #[inline]
3233        unsafe fn encode(
3234            self,
3235            encoder: &mut fidl::encoding::Encoder<'_, D>,
3236            offset: usize,
3237            depth: fidl::encoding::Depth,
3238        ) -> fidl::Result<()> {
3239            encoder.debug_check_bounds::<DeviceReadConfig16Request>(offset);
3240            // Zero out padding regions. There's no need to apply masks
3241            // because the unmasked parts will be overwritten by fields.
3242            // Write the fields.
3243            self.0.encode(encoder, offset + 0, depth)?;
3244            Ok(())
3245        }
3246    }
3247
3248    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3249        for DeviceReadConfig16Request
3250    {
3251        #[inline(always)]
3252        fn new_empty() -> Self {
3253            Self { offset: fidl::new_empty!(u16, D) }
3254        }
3255
3256        #[inline]
3257        unsafe fn decode(
3258            &mut self,
3259            decoder: &mut fidl::encoding::Decoder<'_, D>,
3260            offset: usize,
3261            _depth: fidl::encoding::Depth,
3262        ) -> fidl::Result<()> {
3263            decoder.debug_check_bounds::<Self>(offset);
3264            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
3265            // Verify that padding bytes are zero.
3266            // Copy from the buffer into the object.
3267            unsafe {
3268                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 2);
3269            }
3270            Ok(())
3271        }
3272    }
3273
3274    impl fidl::encoding::ValueTypeMarker for DeviceReadConfig32Request {
3275        type Borrowed<'a> = &'a Self;
3276        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3277            value
3278        }
3279    }
3280
3281    unsafe impl fidl::encoding::TypeMarker for DeviceReadConfig32Request {
3282        type Owned = Self;
3283
3284        #[inline(always)]
3285        fn inline_align(_context: fidl::encoding::Context) -> usize {
3286            2
3287        }
3288
3289        #[inline(always)]
3290        fn inline_size(_context: fidl::encoding::Context) -> usize {
3291            2
3292        }
3293        #[inline(always)]
3294        fn encode_is_copy() -> bool {
3295            true
3296        }
3297
3298        #[inline(always)]
3299        fn decode_is_copy() -> bool {
3300            true
3301        }
3302    }
3303
3304    unsafe impl<D: fidl::encoding::ResourceDialect>
3305        fidl::encoding::Encode<DeviceReadConfig32Request, D> for &DeviceReadConfig32Request
3306    {
3307        #[inline]
3308        unsafe fn encode(
3309            self,
3310            encoder: &mut fidl::encoding::Encoder<'_, D>,
3311            offset: usize,
3312            _depth: fidl::encoding::Depth,
3313        ) -> fidl::Result<()> {
3314            encoder.debug_check_bounds::<DeviceReadConfig32Request>(offset);
3315            unsafe {
3316                // Copy the object into the buffer.
3317                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
3318                (buf_ptr as *mut DeviceReadConfig32Request)
3319                    .write_unaligned((self as *const DeviceReadConfig32Request).read());
3320                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
3321                // done second because the memcpy will write garbage to these bytes.
3322            }
3323            Ok(())
3324        }
3325    }
3326    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u16, D>>
3327        fidl::encoding::Encode<DeviceReadConfig32Request, D> for (T0,)
3328    {
3329        #[inline]
3330        unsafe fn encode(
3331            self,
3332            encoder: &mut fidl::encoding::Encoder<'_, D>,
3333            offset: usize,
3334            depth: fidl::encoding::Depth,
3335        ) -> fidl::Result<()> {
3336            encoder.debug_check_bounds::<DeviceReadConfig32Request>(offset);
3337            // Zero out padding regions. There's no need to apply masks
3338            // because the unmasked parts will be overwritten by fields.
3339            // Write the fields.
3340            self.0.encode(encoder, offset + 0, depth)?;
3341            Ok(())
3342        }
3343    }
3344
3345    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3346        for DeviceReadConfig32Request
3347    {
3348        #[inline(always)]
3349        fn new_empty() -> Self {
3350            Self { offset: fidl::new_empty!(u16, D) }
3351        }
3352
3353        #[inline]
3354        unsafe fn decode(
3355            &mut self,
3356            decoder: &mut fidl::encoding::Decoder<'_, D>,
3357            offset: usize,
3358            _depth: fidl::encoding::Depth,
3359        ) -> fidl::Result<()> {
3360            decoder.debug_check_bounds::<Self>(offset);
3361            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
3362            // Verify that padding bytes are zero.
3363            // Copy from the buffer into the object.
3364            unsafe {
3365                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 2);
3366            }
3367            Ok(())
3368        }
3369    }
3370
3371    impl fidl::encoding::ValueTypeMarker for DeviceReadConfig8Request {
3372        type Borrowed<'a> = &'a Self;
3373        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3374            value
3375        }
3376    }
3377
3378    unsafe impl fidl::encoding::TypeMarker for DeviceReadConfig8Request {
3379        type Owned = Self;
3380
3381        #[inline(always)]
3382        fn inline_align(_context: fidl::encoding::Context) -> usize {
3383            2
3384        }
3385
3386        #[inline(always)]
3387        fn inline_size(_context: fidl::encoding::Context) -> usize {
3388            2
3389        }
3390        #[inline(always)]
3391        fn encode_is_copy() -> bool {
3392            true
3393        }
3394
3395        #[inline(always)]
3396        fn decode_is_copy() -> bool {
3397            true
3398        }
3399    }
3400
3401    unsafe impl<D: fidl::encoding::ResourceDialect>
3402        fidl::encoding::Encode<DeviceReadConfig8Request, D> for &DeviceReadConfig8Request
3403    {
3404        #[inline]
3405        unsafe fn encode(
3406            self,
3407            encoder: &mut fidl::encoding::Encoder<'_, D>,
3408            offset: usize,
3409            _depth: fidl::encoding::Depth,
3410        ) -> fidl::Result<()> {
3411            encoder.debug_check_bounds::<DeviceReadConfig8Request>(offset);
3412            unsafe {
3413                // Copy the object into the buffer.
3414                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
3415                (buf_ptr as *mut DeviceReadConfig8Request)
3416                    .write_unaligned((self as *const DeviceReadConfig8Request).read());
3417                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
3418                // done second because the memcpy will write garbage to these bytes.
3419            }
3420            Ok(())
3421        }
3422    }
3423    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u16, D>>
3424        fidl::encoding::Encode<DeviceReadConfig8Request, D> for (T0,)
3425    {
3426        #[inline]
3427        unsafe fn encode(
3428            self,
3429            encoder: &mut fidl::encoding::Encoder<'_, D>,
3430            offset: usize,
3431            depth: fidl::encoding::Depth,
3432        ) -> fidl::Result<()> {
3433            encoder.debug_check_bounds::<DeviceReadConfig8Request>(offset);
3434            // Zero out padding regions. There's no need to apply masks
3435            // because the unmasked parts will be overwritten by fields.
3436            // Write the fields.
3437            self.0.encode(encoder, offset + 0, depth)?;
3438            Ok(())
3439        }
3440    }
3441
3442    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3443        for DeviceReadConfig8Request
3444    {
3445        #[inline(always)]
3446        fn new_empty() -> Self {
3447            Self { offset: fidl::new_empty!(u16, D) }
3448        }
3449
3450        #[inline]
3451        unsafe fn decode(
3452            &mut self,
3453            decoder: &mut fidl::encoding::Decoder<'_, D>,
3454            offset: usize,
3455            _depth: fidl::encoding::Depth,
3456        ) -> fidl::Result<()> {
3457            decoder.debug_check_bounds::<Self>(offset);
3458            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
3459            // Verify that padding bytes are zero.
3460            // Copy from the buffer into the object.
3461            unsafe {
3462                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 2);
3463            }
3464            Ok(())
3465        }
3466    }
3467
3468    impl fidl::encoding::ValueTypeMarker for DeviceSetBusMasteringRequest {
3469        type Borrowed<'a> = &'a Self;
3470        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3471            value
3472        }
3473    }
3474
3475    unsafe impl fidl::encoding::TypeMarker for DeviceSetBusMasteringRequest {
3476        type Owned = Self;
3477
3478        #[inline(always)]
3479        fn inline_align(_context: fidl::encoding::Context) -> usize {
3480            1
3481        }
3482
3483        #[inline(always)]
3484        fn inline_size(_context: fidl::encoding::Context) -> usize {
3485            1
3486        }
3487    }
3488
3489    unsafe impl<D: fidl::encoding::ResourceDialect>
3490        fidl::encoding::Encode<DeviceSetBusMasteringRequest, D> for &DeviceSetBusMasteringRequest
3491    {
3492        #[inline]
3493        unsafe fn encode(
3494            self,
3495            encoder: &mut fidl::encoding::Encoder<'_, D>,
3496            offset: usize,
3497            _depth: fidl::encoding::Depth,
3498        ) -> fidl::Result<()> {
3499            encoder.debug_check_bounds::<DeviceSetBusMasteringRequest>(offset);
3500            // Delegate to tuple encoding.
3501            fidl::encoding::Encode::<DeviceSetBusMasteringRequest, D>::encode(
3502                (<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.enabled),),
3503                encoder,
3504                offset,
3505                _depth,
3506            )
3507        }
3508    }
3509    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<bool, D>>
3510        fidl::encoding::Encode<DeviceSetBusMasteringRequest, D> for (T0,)
3511    {
3512        #[inline]
3513        unsafe fn encode(
3514            self,
3515            encoder: &mut fidl::encoding::Encoder<'_, D>,
3516            offset: usize,
3517            depth: fidl::encoding::Depth,
3518        ) -> fidl::Result<()> {
3519            encoder.debug_check_bounds::<DeviceSetBusMasteringRequest>(offset);
3520            // Zero out padding regions. There's no need to apply masks
3521            // because the unmasked parts will be overwritten by fields.
3522            // Write the fields.
3523            self.0.encode(encoder, offset + 0, depth)?;
3524            Ok(())
3525        }
3526    }
3527
3528    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3529        for DeviceSetBusMasteringRequest
3530    {
3531        #[inline(always)]
3532        fn new_empty() -> Self {
3533            Self { enabled: fidl::new_empty!(bool, D) }
3534        }
3535
3536        #[inline]
3537        unsafe fn decode(
3538            &mut self,
3539            decoder: &mut fidl::encoding::Decoder<'_, D>,
3540            offset: usize,
3541            _depth: fidl::encoding::Depth,
3542        ) -> fidl::Result<()> {
3543            decoder.debug_check_bounds::<Self>(offset);
3544            // Verify that padding bytes are zero.
3545            fidl::decode!(bool, D, &mut self.enabled, decoder, offset + 0, _depth)?;
3546            Ok(())
3547        }
3548    }
3549
3550    impl fidl::encoding::ValueTypeMarker for DeviceSetInterruptModeRequest {
3551        type Borrowed<'a> = &'a Self;
3552        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3553            value
3554        }
3555    }
3556
3557    unsafe impl fidl::encoding::TypeMarker for DeviceSetInterruptModeRequest {
3558        type Owned = Self;
3559
3560        #[inline(always)]
3561        fn inline_align(_context: fidl::encoding::Context) -> usize {
3562            4
3563        }
3564
3565        #[inline(always)]
3566        fn inline_size(_context: fidl::encoding::Context) -> usize {
3567            8
3568        }
3569    }
3570
3571    unsafe impl<D: fidl::encoding::ResourceDialect>
3572        fidl::encoding::Encode<DeviceSetInterruptModeRequest, D>
3573        for &DeviceSetInterruptModeRequest
3574    {
3575        #[inline]
3576        unsafe fn encode(
3577            self,
3578            encoder: &mut fidl::encoding::Encoder<'_, D>,
3579            offset: usize,
3580            _depth: fidl::encoding::Depth,
3581        ) -> fidl::Result<()> {
3582            encoder.debug_check_bounds::<DeviceSetInterruptModeRequest>(offset);
3583            // Delegate to tuple encoding.
3584            fidl::encoding::Encode::<DeviceSetInterruptModeRequest, D>::encode(
3585                (
3586                    <InterruptMode as fidl::encoding::ValueTypeMarker>::borrow(&self.mode),
3587                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.requested_irq_count),
3588                ),
3589                encoder,
3590                offset,
3591                _depth,
3592            )
3593        }
3594    }
3595    unsafe impl<
3596            D: fidl::encoding::ResourceDialect,
3597            T0: fidl::encoding::Encode<InterruptMode, D>,
3598            T1: fidl::encoding::Encode<u32, D>,
3599        > fidl::encoding::Encode<DeviceSetInterruptModeRequest, D> for (T0, T1)
3600    {
3601        #[inline]
3602        unsafe fn encode(
3603            self,
3604            encoder: &mut fidl::encoding::Encoder<'_, D>,
3605            offset: usize,
3606            depth: fidl::encoding::Depth,
3607        ) -> fidl::Result<()> {
3608            encoder.debug_check_bounds::<DeviceSetInterruptModeRequest>(offset);
3609            // Zero out padding regions. There's no need to apply masks
3610            // because the unmasked parts will be overwritten by fields.
3611            unsafe {
3612                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
3613                (ptr as *mut u32).write_unaligned(0);
3614            }
3615            // Write the fields.
3616            self.0.encode(encoder, offset + 0, depth)?;
3617            self.1.encode(encoder, offset + 4, depth)?;
3618            Ok(())
3619        }
3620    }
3621
3622    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3623        for DeviceSetInterruptModeRequest
3624    {
3625        #[inline(always)]
3626        fn new_empty() -> Self {
3627            Self {
3628                mode: fidl::new_empty!(InterruptMode, D),
3629                requested_irq_count: fidl::new_empty!(u32, D),
3630            }
3631        }
3632
3633        #[inline]
3634        unsafe fn decode(
3635            &mut self,
3636            decoder: &mut fidl::encoding::Decoder<'_, D>,
3637            offset: usize,
3638            _depth: fidl::encoding::Depth,
3639        ) -> fidl::Result<()> {
3640            decoder.debug_check_bounds::<Self>(offset);
3641            // Verify that padding bytes are zero.
3642            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
3643            let padval = unsafe { (ptr as *const u32).read_unaligned() };
3644            let mask = 0xffffff00u32;
3645            let maskedval = padval & mask;
3646            if maskedval != 0 {
3647                return Err(fidl::Error::NonZeroPadding {
3648                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
3649                });
3650            }
3651            fidl::decode!(InterruptMode, D, &mut self.mode, decoder, offset + 0, _depth)?;
3652            fidl::decode!(u32, D, &mut self.requested_irq_count, decoder, offset + 4, _depth)?;
3653            Ok(())
3654        }
3655    }
3656
3657    impl fidl::encoding::ValueTypeMarker for DeviceWriteConfig16Request {
3658        type Borrowed<'a> = &'a Self;
3659        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3660            value
3661        }
3662    }
3663
3664    unsafe impl fidl::encoding::TypeMarker for DeviceWriteConfig16Request {
3665        type Owned = Self;
3666
3667        #[inline(always)]
3668        fn inline_align(_context: fidl::encoding::Context) -> usize {
3669            2
3670        }
3671
3672        #[inline(always)]
3673        fn inline_size(_context: fidl::encoding::Context) -> usize {
3674            4
3675        }
3676        #[inline(always)]
3677        fn encode_is_copy() -> bool {
3678            true
3679        }
3680
3681        #[inline(always)]
3682        fn decode_is_copy() -> bool {
3683            true
3684        }
3685    }
3686
3687    unsafe impl<D: fidl::encoding::ResourceDialect>
3688        fidl::encoding::Encode<DeviceWriteConfig16Request, D> for &DeviceWriteConfig16Request
3689    {
3690        #[inline]
3691        unsafe fn encode(
3692            self,
3693            encoder: &mut fidl::encoding::Encoder<'_, D>,
3694            offset: usize,
3695            _depth: fidl::encoding::Depth,
3696        ) -> fidl::Result<()> {
3697            encoder.debug_check_bounds::<DeviceWriteConfig16Request>(offset);
3698            unsafe {
3699                // Copy the object into the buffer.
3700                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
3701                (buf_ptr as *mut DeviceWriteConfig16Request)
3702                    .write_unaligned((self as *const DeviceWriteConfig16Request).read());
3703                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
3704                // done second because the memcpy will write garbage to these bytes.
3705            }
3706            Ok(())
3707        }
3708    }
3709    unsafe impl<
3710            D: fidl::encoding::ResourceDialect,
3711            T0: fidl::encoding::Encode<u16, D>,
3712            T1: fidl::encoding::Encode<u16, D>,
3713        > fidl::encoding::Encode<DeviceWriteConfig16Request, D> for (T0, T1)
3714    {
3715        #[inline]
3716        unsafe fn encode(
3717            self,
3718            encoder: &mut fidl::encoding::Encoder<'_, D>,
3719            offset: usize,
3720            depth: fidl::encoding::Depth,
3721        ) -> fidl::Result<()> {
3722            encoder.debug_check_bounds::<DeviceWriteConfig16Request>(offset);
3723            // Zero out padding regions. There's no need to apply masks
3724            // because the unmasked parts will be overwritten by fields.
3725            // Write the fields.
3726            self.0.encode(encoder, offset + 0, depth)?;
3727            self.1.encode(encoder, offset + 2, depth)?;
3728            Ok(())
3729        }
3730    }
3731
3732    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3733        for DeviceWriteConfig16Request
3734    {
3735        #[inline(always)]
3736        fn new_empty() -> Self {
3737            Self { offset: fidl::new_empty!(u16, D), value: fidl::new_empty!(u16, D) }
3738        }
3739
3740        #[inline]
3741        unsafe fn decode(
3742            &mut self,
3743            decoder: &mut fidl::encoding::Decoder<'_, D>,
3744            offset: usize,
3745            _depth: fidl::encoding::Depth,
3746        ) -> fidl::Result<()> {
3747            decoder.debug_check_bounds::<Self>(offset);
3748            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
3749            // Verify that padding bytes are zero.
3750            // Copy from the buffer into the object.
3751            unsafe {
3752                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
3753            }
3754            Ok(())
3755        }
3756    }
3757
3758    impl fidl::encoding::ValueTypeMarker for DeviceWriteConfig32Request {
3759        type Borrowed<'a> = &'a Self;
3760        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3761            value
3762        }
3763    }
3764
3765    unsafe impl fidl::encoding::TypeMarker for DeviceWriteConfig32Request {
3766        type Owned = Self;
3767
3768        #[inline(always)]
3769        fn inline_align(_context: fidl::encoding::Context) -> usize {
3770            4
3771        }
3772
3773        #[inline(always)]
3774        fn inline_size(_context: fidl::encoding::Context) -> usize {
3775            8
3776        }
3777    }
3778
3779    unsafe impl<D: fidl::encoding::ResourceDialect>
3780        fidl::encoding::Encode<DeviceWriteConfig32Request, D> for &DeviceWriteConfig32Request
3781    {
3782        #[inline]
3783        unsafe fn encode(
3784            self,
3785            encoder: &mut fidl::encoding::Encoder<'_, D>,
3786            offset: usize,
3787            _depth: fidl::encoding::Depth,
3788        ) -> fidl::Result<()> {
3789            encoder.debug_check_bounds::<DeviceWriteConfig32Request>(offset);
3790            unsafe {
3791                // Copy the object into the buffer.
3792                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
3793                (buf_ptr as *mut DeviceWriteConfig32Request)
3794                    .write_unaligned((self as *const DeviceWriteConfig32Request).read());
3795                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
3796                // done second because the memcpy will write garbage to these bytes.
3797                let padding_ptr = buf_ptr.offset(0) as *mut u32;
3798                let padding_mask = 0xffff0000u32;
3799                padding_ptr.write_unaligned(padding_ptr.read_unaligned() & !padding_mask);
3800            }
3801            Ok(())
3802        }
3803    }
3804    unsafe impl<
3805            D: fidl::encoding::ResourceDialect,
3806            T0: fidl::encoding::Encode<u16, D>,
3807            T1: fidl::encoding::Encode<u32, D>,
3808        > fidl::encoding::Encode<DeviceWriteConfig32Request, D> for (T0, T1)
3809    {
3810        #[inline]
3811        unsafe fn encode(
3812            self,
3813            encoder: &mut fidl::encoding::Encoder<'_, D>,
3814            offset: usize,
3815            depth: fidl::encoding::Depth,
3816        ) -> fidl::Result<()> {
3817            encoder.debug_check_bounds::<DeviceWriteConfig32Request>(offset);
3818            // Zero out padding regions. There's no need to apply masks
3819            // because the unmasked parts will be overwritten by fields.
3820            unsafe {
3821                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
3822                (ptr as *mut u32).write_unaligned(0);
3823            }
3824            // Write the fields.
3825            self.0.encode(encoder, offset + 0, depth)?;
3826            self.1.encode(encoder, offset + 4, depth)?;
3827            Ok(())
3828        }
3829    }
3830
3831    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3832        for DeviceWriteConfig32Request
3833    {
3834        #[inline(always)]
3835        fn new_empty() -> Self {
3836            Self { offset: fidl::new_empty!(u16, D), value: fidl::new_empty!(u32, D) }
3837        }
3838
3839        #[inline]
3840        unsafe fn decode(
3841            &mut self,
3842            decoder: &mut fidl::encoding::Decoder<'_, D>,
3843            offset: usize,
3844            _depth: fidl::encoding::Depth,
3845        ) -> fidl::Result<()> {
3846            decoder.debug_check_bounds::<Self>(offset);
3847            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
3848            // Verify that padding bytes are zero.
3849            let ptr = unsafe { buf_ptr.offset(0) };
3850            let padval = unsafe { (ptr as *const u32).read_unaligned() };
3851            let mask = 0xffff0000u32;
3852            let maskedval = padval & mask;
3853            if maskedval != 0 {
3854                return Err(fidl::Error::NonZeroPadding {
3855                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
3856                });
3857            }
3858            // Copy from the buffer into the object.
3859            unsafe {
3860                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
3861            }
3862            Ok(())
3863        }
3864    }
3865
3866    impl fidl::encoding::ValueTypeMarker for DeviceWriteConfig8Request {
3867        type Borrowed<'a> = &'a Self;
3868        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3869            value
3870        }
3871    }
3872
3873    unsafe impl fidl::encoding::TypeMarker for DeviceWriteConfig8Request {
3874        type Owned = Self;
3875
3876        #[inline(always)]
3877        fn inline_align(_context: fidl::encoding::Context) -> usize {
3878            2
3879        }
3880
3881        #[inline(always)]
3882        fn inline_size(_context: fidl::encoding::Context) -> usize {
3883            4
3884        }
3885    }
3886
3887    unsafe impl<D: fidl::encoding::ResourceDialect>
3888        fidl::encoding::Encode<DeviceWriteConfig8Request, D> for &DeviceWriteConfig8Request
3889    {
3890        #[inline]
3891        unsafe fn encode(
3892            self,
3893            encoder: &mut fidl::encoding::Encoder<'_, D>,
3894            offset: usize,
3895            _depth: fidl::encoding::Depth,
3896        ) -> fidl::Result<()> {
3897            encoder.debug_check_bounds::<DeviceWriteConfig8Request>(offset);
3898            unsafe {
3899                // Copy the object into the buffer.
3900                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
3901                (buf_ptr as *mut DeviceWriteConfig8Request)
3902                    .write_unaligned((self as *const DeviceWriteConfig8Request).read());
3903                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
3904                // done second because the memcpy will write garbage to these bytes.
3905                let padding_ptr = buf_ptr.offset(2) as *mut u16;
3906                let padding_mask = 0xff00u16;
3907                padding_ptr.write_unaligned(padding_ptr.read_unaligned() & !padding_mask);
3908            }
3909            Ok(())
3910        }
3911    }
3912    unsafe impl<
3913            D: fidl::encoding::ResourceDialect,
3914            T0: fidl::encoding::Encode<u16, D>,
3915            T1: fidl::encoding::Encode<u8, D>,
3916        > fidl::encoding::Encode<DeviceWriteConfig8Request, D> for (T0, T1)
3917    {
3918        #[inline]
3919        unsafe fn encode(
3920            self,
3921            encoder: &mut fidl::encoding::Encoder<'_, D>,
3922            offset: usize,
3923            depth: fidl::encoding::Depth,
3924        ) -> fidl::Result<()> {
3925            encoder.debug_check_bounds::<DeviceWriteConfig8Request>(offset);
3926            // Zero out padding regions. There's no need to apply masks
3927            // because the unmasked parts will be overwritten by fields.
3928            unsafe {
3929                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(2);
3930                (ptr as *mut u16).write_unaligned(0);
3931            }
3932            // Write the fields.
3933            self.0.encode(encoder, offset + 0, depth)?;
3934            self.1.encode(encoder, offset + 2, depth)?;
3935            Ok(())
3936        }
3937    }
3938
3939    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3940        for DeviceWriteConfig8Request
3941    {
3942        #[inline(always)]
3943        fn new_empty() -> Self {
3944            Self { offset: fidl::new_empty!(u16, D), value: fidl::new_empty!(u8, D) }
3945        }
3946
3947        #[inline]
3948        unsafe fn decode(
3949            &mut self,
3950            decoder: &mut fidl::encoding::Decoder<'_, D>,
3951            offset: usize,
3952            _depth: fidl::encoding::Depth,
3953        ) -> fidl::Result<()> {
3954            decoder.debug_check_bounds::<Self>(offset);
3955            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
3956            // Verify that padding bytes are zero.
3957            let ptr = unsafe { buf_ptr.offset(2) };
3958            let padval = unsafe { (ptr as *const u16).read_unaligned() };
3959            let mask = 0xff00u16;
3960            let maskedval = padval & mask;
3961            if maskedval != 0 {
3962                return Err(fidl::Error::NonZeroPadding {
3963                    padding_start: offset + 2 + ((mask as u64).trailing_zeros() / 8) as usize,
3964                });
3965            }
3966            // Copy from the buffer into the object.
3967            unsafe {
3968                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
3969            }
3970            Ok(())
3971        }
3972    }
3973
3974    impl fidl::encoding::ValueTypeMarker for DeviceReadConfig16Response {
3975        type Borrowed<'a> = &'a Self;
3976        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3977            value
3978        }
3979    }
3980
3981    unsafe impl fidl::encoding::TypeMarker for DeviceReadConfig16Response {
3982        type Owned = Self;
3983
3984        #[inline(always)]
3985        fn inline_align(_context: fidl::encoding::Context) -> usize {
3986            2
3987        }
3988
3989        #[inline(always)]
3990        fn inline_size(_context: fidl::encoding::Context) -> usize {
3991            2
3992        }
3993        #[inline(always)]
3994        fn encode_is_copy() -> bool {
3995            true
3996        }
3997
3998        #[inline(always)]
3999        fn decode_is_copy() -> bool {
4000            true
4001        }
4002    }
4003
4004    unsafe impl<D: fidl::encoding::ResourceDialect>
4005        fidl::encoding::Encode<DeviceReadConfig16Response, D> for &DeviceReadConfig16Response
4006    {
4007        #[inline]
4008        unsafe fn encode(
4009            self,
4010            encoder: &mut fidl::encoding::Encoder<'_, D>,
4011            offset: usize,
4012            _depth: fidl::encoding::Depth,
4013        ) -> fidl::Result<()> {
4014            encoder.debug_check_bounds::<DeviceReadConfig16Response>(offset);
4015            unsafe {
4016                // Copy the object into the buffer.
4017                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
4018                (buf_ptr as *mut DeviceReadConfig16Response)
4019                    .write_unaligned((self as *const DeviceReadConfig16Response).read());
4020                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
4021                // done second because the memcpy will write garbage to these bytes.
4022            }
4023            Ok(())
4024        }
4025    }
4026    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u16, D>>
4027        fidl::encoding::Encode<DeviceReadConfig16Response, D> for (T0,)
4028    {
4029        #[inline]
4030        unsafe fn encode(
4031            self,
4032            encoder: &mut fidl::encoding::Encoder<'_, D>,
4033            offset: usize,
4034            depth: fidl::encoding::Depth,
4035        ) -> fidl::Result<()> {
4036            encoder.debug_check_bounds::<DeviceReadConfig16Response>(offset);
4037            // Zero out padding regions. There's no need to apply masks
4038            // because the unmasked parts will be overwritten by fields.
4039            // Write the fields.
4040            self.0.encode(encoder, offset + 0, depth)?;
4041            Ok(())
4042        }
4043    }
4044
4045    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
4046        for DeviceReadConfig16Response
4047    {
4048        #[inline(always)]
4049        fn new_empty() -> Self {
4050            Self { value: fidl::new_empty!(u16, D) }
4051        }
4052
4053        #[inline]
4054        unsafe fn decode(
4055            &mut self,
4056            decoder: &mut fidl::encoding::Decoder<'_, D>,
4057            offset: usize,
4058            _depth: fidl::encoding::Depth,
4059        ) -> fidl::Result<()> {
4060            decoder.debug_check_bounds::<Self>(offset);
4061            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
4062            // Verify that padding bytes are zero.
4063            // Copy from the buffer into the object.
4064            unsafe {
4065                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 2);
4066            }
4067            Ok(())
4068        }
4069    }
4070
4071    impl fidl::encoding::ValueTypeMarker for DeviceReadConfig32Response {
4072        type Borrowed<'a> = &'a Self;
4073        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4074            value
4075        }
4076    }
4077
4078    unsafe impl fidl::encoding::TypeMarker for DeviceReadConfig32Response {
4079        type Owned = Self;
4080
4081        #[inline(always)]
4082        fn inline_align(_context: fidl::encoding::Context) -> usize {
4083            4
4084        }
4085
4086        #[inline(always)]
4087        fn inline_size(_context: fidl::encoding::Context) -> usize {
4088            4
4089        }
4090        #[inline(always)]
4091        fn encode_is_copy() -> bool {
4092            true
4093        }
4094
4095        #[inline(always)]
4096        fn decode_is_copy() -> bool {
4097            true
4098        }
4099    }
4100
4101    unsafe impl<D: fidl::encoding::ResourceDialect>
4102        fidl::encoding::Encode<DeviceReadConfig32Response, D> for &DeviceReadConfig32Response
4103    {
4104        #[inline]
4105        unsafe fn encode(
4106            self,
4107            encoder: &mut fidl::encoding::Encoder<'_, D>,
4108            offset: usize,
4109            _depth: fidl::encoding::Depth,
4110        ) -> fidl::Result<()> {
4111            encoder.debug_check_bounds::<DeviceReadConfig32Response>(offset);
4112            unsafe {
4113                // Copy the object into the buffer.
4114                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
4115                (buf_ptr as *mut DeviceReadConfig32Response)
4116                    .write_unaligned((self as *const DeviceReadConfig32Response).read());
4117                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
4118                // done second because the memcpy will write garbage to these bytes.
4119            }
4120            Ok(())
4121        }
4122    }
4123    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u32, D>>
4124        fidl::encoding::Encode<DeviceReadConfig32Response, D> for (T0,)
4125    {
4126        #[inline]
4127        unsafe fn encode(
4128            self,
4129            encoder: &mut fidl::encoding::Encoder<'_, D>,
4130            offset: usize,
4131            depth: fidl::encoding::Depth,
4132        ) -> fidl::Result<()> {
4133            encoder.debug_check_bounds::<DeviceReadConfig32Response>(offset);
4134            // Zero out padding regions. There's no need to apply masks
4135            // because the unmasked parts will be overwritten by fields.
4136            // Write the fields.
4137            self.0.encode(encoder, offset + 0, depth)?;
4138            Ok(())
4139        }
4140    }
4141
4142    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
4143        for DeviceReadConfig32Response
4144    {
4145        #[inline(always)]
4146        fn new_empty() -> Self {
4147            Self { value: fidl::new_empty!(u32, D) }
4148        }
4149
4150        #[inline]
4151        unsafe fn decode(
4152            &mut self,
4153            decoder: &mut fidl::encoding::Decoder<'_, D>,
4154            offset: usize,
4155            _depth: fidl::encoding::Depth,
4156        ) -> fidl::Result<()> {
4157            decoder.debug_check_bounds::<Self>(offset);
4158            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
4159            // Verify that padding bytes are zero.
4160            // Copy from the buffer into the object.
4161            unsafe {
4162                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
4163            }
4164            Ok(())
4165        }
4166    }
4167
4168    impl fidl::encoding::ValueTypeMarker for DeviceReadConfig8Response {
4169        type Borrowed<'a> = &'a Self;
4170        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4171            value
4172        }
4173    }
4174
4175    unsafe impl fidl::encoding::TypeMarker for DeviceReadConfig8Response {
4176        type Owned = Self;
4177
4178        #[inline(always)]
4179        fn inline_align(_context: fidl::encoding::Context) -> usize {
4180            1
4181        }
4182
4183        #[inline(always)]
4184        fn inline_size(_context: fidl::encoding::Context) -> usize {
4185            1
4186        }
4187        #[inline(always)]
4188        fn encode_is_copy() -> bool {
4189            true
4190        }
4191
4192        #[inline(always)]
4193        fn decode_is_copy() -> bool {
4194            true
4195        }
4196    }
4197
4198    unsafe impl<D: fidl::encoding::ResourceDialect>
4199        fidl::encoding::Encode<DeviceReadConfig8Response, D> for &DeviceReadConfig8Response
4200    {
4201        #[inline]
4202        unsafe fn encode(
4203            self,
4204            encoder: &mut fidl::encoding::Encoder<'_, D>,
4205            offset: usize,
4206            _depth: fidl::encoding::Depth,
4207        ) -> fidl::Result<()> {
4208            encoder.debug_check_bounds::<DeviceReadConfig8Response>(offset);
4209            unsafe {
4210                // Copy the object into the buffer.
4211                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
4212                (buf_ptr as *mut DeviceReadConfig8Response)
4213                    .write_unaligned((self as *const DeviceReadConfig8Response).read());
4214                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
4215                // done second because the memcpy will write garbage to these bytes.
4216            }
4217            Ok(())
4218        }
4219    }
4220    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u8, D>>
4221        fidl::encoding::Encode<DeviceReadConfig8Response, D> for (T0,)
4222    {
4223        #[inline]
4224        unsafe fn encode(
4225            self,
4226            encoder: &mut fidl::encoding::Encoder<'_, D>,
4227            offset: usize,
4228            depth: fidl::encoding::Depth,
4229        ) -> fidl::Result<()> {
4230            encoder.debug_check_bounds::<DeviceReadConfig8Response>(offset);
4231            // Zero out padding regions. There's no need to apply masks
4232            // because the unmasked parts will be overwritten by fields.
4233            // Write the fields.
4234            self.0.encode(encoder, offset + 0, depth)?;
4235            Ok(())
4236        }
4237    }
4238
4239    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
4240        for DeviceReadConfig8Response
4241    {
4242        #[inline(always)]
4243        fn new_empty() -> Self {
4244            Self { value: fidl::new_empty!(u8, D) }
4245        }
4246
4247        #[inline]
4248        unsafe fn decode(
4249            &mut self,
4250            decoder: &mut fidl::encoding::Decoder<'_, D>,
4251            offset: usize,
4252            _depth: fidl::encoding::Depth,
4253        ) -> fidl::Result<()> {
4254            decoder.debug_check_bounds::<Self>(offset);
4255            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
4256            // Verify that padding bytes are zero.
4257            // Copy from the buffer into the object.
4258            unsafe {
4259                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 1);
4260            }
4261            Ok(())
4262        }
4263    }
4264
4265    impl fidl::encoding::ValueTypeMarker for ExtendedCapability {
4266        type Borrowed<'a> = &'a Self;
4267        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4268            value
4269        }
4270    }
4271
4272    unsafe impl fidl::encoding::TypeMarker for ExtendedCapability {
4273        type Owned = Self;
4274
4275        #[inline(always)]
4276        fn inline_align(_context: fidl::encoding::Context) -> usize {
4277            2
4278        }
4279
4280        #[inline(always)]
4281        fn inline_size(_context: fidl::encoding::Context) -> usize {
4282            4
4283        }
4284        #[inline(always)]
4285        fn encode_is_copy() -> bool {
4286            true
4287        }
4288
4289        #[inline(always)]
4290        fn decode_is_copy() -> bool {
4291            true
4292        }
4293    }
4294
4295    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<ExtendedCapability, D>
4296        for &ExtendedCapability
4297    {
4298        #[inline]
4299        unsafe fn encode(
4300            self,
4301            encoder: &mut fidl::encoding::Encoder<'_, D>,
4302            offset: usize,
4303            _depth: fidl::encoding::Depth,
4304        ) -> fidl::Result<()> {
4305            encoder.debug_check_bounds::<ExtendedCapability>(offset);
4306            unsafe {
4307                // Copy the object into the buffer.
4308                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
4309                (buf_ptr as *mut ExtendedCapability)
4310                    .write_unaligned((self as *const ExtendedCapability).read());
4311                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
4312                // done second because the memcpy will write garbage to these bytes.
4313            }
4314            Ok(())
4315        }
4316    }
4317    unsafe impl<
4318            D: fidl::encoding::ResourceDialect,
4319            T0: fidl::encoding::Encode<u16, D>,
4320            T1: fidl::encoding::Encode<u16, D>,
4321        > fidl::encoding::Encode<ExtendedCapability, D> for (T0, T1)
4322    {
4323        #[inline]
4324        unsafe fn encode(
4325            self,
4326            encoder: &mut fidl::encoding::Encoder<'_, D>,
4327            offset: usize,
4328            depth: fidl::encoding::Depth,
4329        ) -> fidl::Result<()> {
4330            encoder.debug_check_bounds::<ExtendedCapability>(offset);
4331            // Zero out padding regions. There's no need to apply masks
4332            // because the unmasked parts will be overwritten by fields.
4333            // Write the fields.
4334            self.0.encode(encoder, offset + 0, depth)?;
4335            self.1.encode(encoder, offset + 2, depth)?;
4336            Ok(())
4337        }
4338    }
4339
4340    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ExtendedCapability {
4341        #[inline(always)]
4342        fn new_empty() -> Self {
4343            Self { id: fidl::new_empty!(u16, D), offset: fidl::new_empty!(u16, D) }
4344        }
4345
4346        #[inline]
4347        unsafe fn decode(
4348            &mut self,
4349            decoder: &mut fidl::encoding::Decoder<'_, D>,
4350            offset: usize,
4351            _depth: fidl::encoding::Depth,
4352        ) -> fidl::Result<()> {
4353            decoder.debug_check_bounds::<Self>(offset);
4354            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
4355            // Verify that padding bytes are zero.
4356            // Copy from the buffer into the object.
4357            unsafe {
4358                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
4359            }
4360            Ok(())
4361        }
4362    }
4363
4364    impl fidl::encoding::ValueTypeMarker for HostBridgeInfo {
4365        type Borrowed<'a> = &'a Self;
4366        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4367            value
4368        }
4369    }
4370
4371    unsafe impl fidl::encoding::TypeMarker for HostBridgeInfo {
4372        type Owned = Self;
4373
4374        #[inline(always)]
4375        fn inline_align(_context: fidl::encoding::Context) -> usize {
4376            8
4377        }
4378
4379        #[inline(always)]
4380        fn inline_size(_context: fidl::encoding::Context) -> usize {
4381            24
4382        }
4383    }
4384
4385    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<HostBridgeInfo, D>
4386        for &HostBridgeInfo
4387    {
4388        #[inline]
4389        unsafe fn encode(
4390            self,
4391            encoder: &mut fidl::encoding::Encoder<'_, D>,
4392            offset: usize,
4393            _depth: fidl::encoding::Depth,
4394        ) -> fidl::Result<()> {
4395            encoder.debug_check_bounds::<HostBridgeInfo>(offset);
4396            // Delegate to tuple encoding.
4397            fidl::encoding::Encode::<HostBridgeInfo, D>::encode(
4398                (
4399                    <fidl::encoding::BoundedString<32> as fidl::encoding::ValueTypeMarker>::borrow(
4400                        &self.name,
4401                    ),
4402                    <u8 as fidl::encoding::ValueTypeMarker>::borrow(&self.start_bus_number),
4403                    <u8 as fidl::encoding::ValueTypeMarker>::borrow(&self.end_bus_number),
4404                    <u16 as fidl::encoding::ValueTypeMarker>::borrow(&self.segment_group),
4405                ),
4406                encoder,
4407                offset,
4408                _depth,
4409            )
4410        }
4411    }
4412    unsafe impl<
4413            D: fidl::encoding::ResourceDialect,
4414            T0: fidl::encoding::Encode<fidl::encoding::BoundedString<32>, D>,
4415            T1: fidl::encoding::Encode<u8, D>,
4416            T2: fidl::encoding::Encode<u8, D>,
4417            T3: fidl::encoding::Encode<u16, D>,
4418        > fidl::encoding::Encode<HostBridgeInfo, D> for (T0, T1, T2, T3)
4419    {
4420        #[inline]
4421        unsafe fn encode(
4422            self,
4423            encoder: &mut fidl::encoding::Encoder<'_, D>,
4424            offset: usize,
4425            depth: fidl::encoding::Depth,
4426        ) -> fidl::Result<()> {
4427            encoder.debug_check_bounds::<HostBridgeInfo>(offset);
4428            // Zero out padding regions. There's no need to apply masks
4429            // because the unmasked parts will be overwritten by fields.
4430            unsafe {
4431                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
4432                (ptr as *mut u64).write_unaligned(0);
4433            }
4434            // Write the fields.
4435            self.0.encode(encoder, offset + 0, depth)?;
4436            self.1.encode(encoder, offset + 16, depth)?;
4437            self.2.encode(encoder, offset + 17, depth)?;
4438            self.3.encode(encoder, offset + 18, depth)?;
4439            Ok(())
4440        }
4441    }
4442
4443    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for HostBridgeInfo {
4444        #[inline(always)]
4445        fn new_empty() -> Self {
4446            Self {
4447                name: fidl::new_empty!(fidl::encoding::BoundedString<32>, D),
4448                start_bus_number: fidl::new_empty!(u8, D),
4449                end_bus_number: fidl::new_empty!(u8, D),
4450                segment_group: fidl::new_empty!(u16, D),
4451            }
4452        }
4453
4454        #[inline]
4455        unsafe fn decode(
4456            &mut self,
4457            decoder: &mut fidl::encoding::Decoder<'_, D>,
4458            offset: usize,
4459            _depth: fidl::encoding::Depth,
4460        ) -> fidl::Result<()> {
4461            decoder.debug_check_bounds::<Self>(offset);
4462            // Verify that padding bytes are zero.
4463            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
4464            let padval = unsafe { (ptr as *const u64).read_unaligned() };
4465            let mask = 0xffffffff00000000u64;
4466            let maskedval = padval & mask;
4467            if maskedval != 0 {
4468                return Err(fidl::Error::NonZeroPadding {
4469                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
4470                });
4471            }
4472            fidl::decode!(
4473                fidl::encoding::BoundedString<32>,
4474                D,
4475                &mut self.name,
4476                decoder,
4477                offset + 0,
4478                _depth
4479            )?;
4480            fidl::decode!(u8, D, &mut self.start_bus_number, decoder, offset + 16, _depth)?;
4481            fidl::decode!(u8, D, &mut self.end_bus_number, decoder, offset + 17, _depth)?;
4482            fidl::decode!(u16, D, &mut self.segment_group, decoder, offset + 18, _depth)?;
4483            Ok(())
4484        }
4485    }
4486
4487    impl fidl::encoding::ValueTypeMarker for InterruptModes {
4488        type Borrowed<'a> = &'a Self;
4489        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4490            value
4491        }
4492    }
4493
4494    unsafe impl fidl::encoding::TypeMarker for InterruptModes {
4495        type Owned = Self;
4496
4497        #[inline(always)]
4498        fn inline_align(_context: fidl::encoding::Context) -> usize {
4499            2
4500        }
4501
4502        #[inline(always)]
4503        fn inline_size(_context: fidl::encoding::Context) -> usize {
4504            4
4505        }
4506    }
4507
4508    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<InterruptModes, D>
4509        for &InterruptModes
4510    {
4511        #[inline]
4512        unsafe fn encode(
4513            self,
4514            encoder: &mut fidl::encoding::Encoder<'_, D>,
4515            offset: usize,
4516            _depth: fidl::encoding::Depth,
4517        ) -> fidl::Result<()> {
4518            encoder.debug_check_bounds::<InterruptModes>(offset);
4519            // Delegate to tuple encoding.
4520            fidl::encoding::Encode::<InterruptModes, D>::encode(
4521                (
4522                    <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.has_legacy),
4523                    <u8 as fidl::encoding::ValueTypeMarker>::borrow(&self.msi_count),
4524                    <u16 as fidl::encoding::ValueTypeMarker>::borrow(&self.msix_count),
4525                ),
4526                encoder,
4527                offset,
4528                _depth,
4529            )
4530        }
4531    }
4532    unsafe impl<
4533            D: fidl::encoding::ResourceDialect,
4534            T0: fidl::encoding::Encode<bool, D>,
4535            T1: fidl::encoding::Encode<u8, D>,
4536            T2: fidl::encoding::Encode<u16, D>,
4537        > fidl::encoding::Encode<InterruptModes, D> for (T0, T1, T2)
4538    {
4539        #[inline]
4540        unsafe fn encode(
4541            self,
4542            encoder: &mut fidl::encoding::Encoder<'_, D>,
4543            offset: usize,
4544            depth: fidl::encoding::Depth,
4545        ) -> fidl::Result<()> {
4546            encoder.debug_check_bounds::<InterruptModes>(offset);
4547            // Zero out padding regions. There's no need to apply masks
4548            // because the unmasked parts will be overwritten by fields.
4549            // Write the fields.
4550            self.0.encode(encoder, offset + 0, depth)?;
4551            self.1.encode(encoder, offset + 1, depth)?;
4552            self.2.encode(encoder, offset + 2, depth)?;
4553            Ok(())
4554        }
4555    }
4556
4557    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for InterruptModes {
4558        #[inline(always)]
4559        fn new_empty() -> Self {
4560            Self {
4561                has_legacy: fidl::new_empty!(bool, D),
4562                msi_count: fidl::new_empty!(u8, D),
4563                msix_count: fidl::new_empty!(u16, D),
4564            }
4565        }
4566
4567        #[inline]
4568        unsafe fn decode(
4569            &mut self,
4570            decoder: &mut fidl::encoding::Decoder<'_, D>,
4571            offset: usize,
4572            _depth: fidl::encoding::Depth,
4573        ) -> fidl::Result<()> {
4574            decoder.debug_check_bounds::<Self>(offset);
4575            // Verify that padding bytes are zero.
4576            fidl::decode!(bool, D, &mut self.has_legacy, decoder, offset + 0, _depth)?;
4577            fidl::decode!(u8, D, &mut self.msi_count, decoder, offset + 1, _depth)?;
4578            fidl::decode!(u16, D, &mut self.msix_count, decoder, offset + 2, _depth)?;
4579            Ok(())
4580        }
4581    }
4582
4583    impl fidl::encoding::ValueTypeMarker for Padding {
4584        type Borrowed<'a> = &'a Self;
4585        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4586            value
4587        }
4588    }
4589
4590    unsafe impl fidl::encoding::TypeMarker for Padding {
4591        type Owned = Self;
4592
4593        #[inline(always)]
4594        fn inline_align(_context: fidl::encoding::Context) -> usize {
4595            1
4596        }
4597
4598        #[inline(always)]
4599        fn inline_size(_context: fidl::encoding::Context) -> usize {
4600            1
4601        }
4602    }
4603
4604    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Padding, D> for &Padding {
4605        #[inline]
4606        unsafe fn encode(
4607            self,
4608            encoder: &mut fidl::encoding::Encoder<'_, D>,
4609            offset: usize,
4610            _depth: fidl::encoding::Depth,
4611        ) -> fidl::Result<()> {
4612            encoder.debug_check_bounds::<Padding>(offset);
4613            encoder.write_num(0u8, offset);
4614            Ok(())
4615        }
4616    }
4617
4618    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Padding {
4619        #[inline(always)]
4620        fn new_empty() -> Self {
4621            Self
4622        }
4623
4624        #[inline]
4625        unsafe fn decode(
4626            &mut self,
4627            decoder: &mut fidl::encoding::Decoder<'_, D>,
4628            offset: usize,
4629            _depth: fidl::encoding::Depth,
4630        ) -> fidl::Result<()> {
4631            decoder.debug_check_bounds::<Self>(offset);
4632            match decoder.read_num::<u8>(offset) {
4633                0 => Ok(()),
4634                _ => Err(fidl::Error::Invalid),
4635            }
4636        }
4637    }
4638
4639    impl fidl::encoding::ValueTypeMarker for PciDevice {
4640        type Borrowed<'a> = &'a Self;
4641        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4642            value
4643        }
4644    }
4645
4646    unsafe impl fidl::encoding::TypeMarker for PciDevice {
4647        type Owned = Self;
4648
4649        #[inline(always)]
4650        fn inline_align(_context: fidl::encoding::Context) -> usize {
4651            8
4652        }
4653
4654        #[inline(always)]
4655        fn inline_size(_context: fidl::encoding::Context) -> usize {
4656            72
4657        }
4658    }
4659
4660    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<PciDevice, D>
4661        for &PciDevice
4662    {
4663        #[inline]
4664        unsafe fn encode(
4665            self,
4666            encoder: &mut fidl::encoding::Encoder<'_, D>,
4667            offset: usize,
4668            _depth: fidl::encoding::Depth,
4669        ) -> fidl::Result<()> {
4670            encoder.debug_check_bounds::<PciDevice>(offset);
4671            // Delegate to tuple encoding.
4672            fidl::encoding::Encode::<PciDevice, D>::encode(
4673                (
4674                    <fidl::encoding::Vector<BaseAddress, 6> as fidl::encoding::ValueTypeMarker>::borrow(&self.base_addresses),
4675                    <fidl::encoding::Vector<Capability, 32> as fidl::encoding::ValueTypeMarker>::borrow(&self.capabilities),
4676                    <fidl::encoding::Vector<ExtendedCapability, 32> as fidl::encoding::ValueTypeMarker>::borrow(&self.ext_capabilities),
4677                    <fidl::encoding::Vector<u8, 256> as fidl::encoding::ValueTypeMarker>::borrow(&self.config),
4678                    <u8 as fidl::encoding::ValueTypeMarker>::borrow(&self.bus_id),
4679                    <u8 as fidl::encoding::ValueTypeMarker>::borrow(&self.device_id),
4680                    <u8 as fidl::encoding::ValueTypeMarker>::borrow(&self.function_id),
4681                ),
4682                encoder, offset, _depth
4683            )
4684        }
4685    }
4686    unsafe impl<
4687            D: fidl::encoding::ResourceDialect,
4688            T0: fidl::encoding::Encode<fidl::encoding::Vector<BaseAddress, 6>, D>,
4689            T1: fidl::encoding::Encode<fidl::encoding::Vector<Capability, 32>, D>,
4690            T2: fidl::encoding::Encode<fidl::encoding::Vector<ExtendedCapability, 32>, D>,
4691            T3: fidl::encoding::Encode<fidl::encoding::Vector<u8, 256>, D>,
4692            T4: fidl::encoding::Encode<u8, D>,
4693            T5: fidl::encoding::Encode<u8, D>,
4694            T6: fidl::encoding::Encode<u8, D>,
4695        > fidl::encoding::Encode<PciDevice, D> for (T0, T1, T2, T3, T4, T5, T6)
4696    {
4697        #[inline]
4698        unsafe fn encode(
4699            self,
4700            encoder: &mut fidl::encoding::Encoder<'_, D>,
4701            offset: usize,
4702            depth: fidl::encoding::Depth,
4703        ) -> fidl::Result<()> {
4704            encoder.debug_check_bounds::<PciDevice>(offset);
4705            // Zero out padding regions. There's no need to apply masks
4706            // because the unmasked parts will be overwritten by fields.
4707            unsafe {
4708                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(64);
4709                (ptr as *mut u64).write_unaligned(0);
4710            }
4711            // Write the fields.
4712            self.0.encode(encoder, offset + 0, depth)?;
4713            self.1.encode(encoder, offset + 16, depth)?;
4714            self.2.encode(encoder, offset + 32, depth)?;
4715            self.3.encode(encoder, offset + 48, depth)?;
4716            self.4.encode(encoder, offset + 64, depth)?;
4717            self.5.encode(encoder, offset + 65, depth)?;
4718            self.6.encode(encoder, offset + 66, depth)?;
4719            Ok(())
4720        }
4721    }
4722
4723    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for PciDevice {
4724        #[inline(always)]
4725        fn new_empty() -> Self {
4726            Self {
4727                base_addresses: fidl::new_empty!(fidl::encoding::Vector<BaseAddress, 6>, D),
4728                capabilities: fidl::new_empty!(fidl::encoding::Vector<Capability, 32>, D),
4729                ext_capabilities: fidl::new_empty!(fidl::encoding::Vector<ExtendedCapability, 32>, D),
4730                config: fidl::new_empty!(fidl::encoding::Vector<u8, 256>, D),
4731                bus_id: fidl::new_empty!(u8, D),
4732                device_id: fidl::new_empty!(u8, D),
4733                function_id: fidl::new_empty!(u8, D),
4734            }
4735        }
4736
4737        #[inline]
4738        unsafe fn decode(
4739            &mut self,
4740            decoder: &mut fidl::encoding::Decoder<'_, D>,
4741            offset: usize,
4742            _depth: fidl::encoding::Depth,
4743        ) -> fidl::Result<()> {
4744            decoder.debug_check_bounds::<Self>(offset);
4745            // Verify that padding bytes are zero.
4746            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(64) };
4747            let padval = unsafe { (ptr as *const u64).read_unaligned() };
4748            let mask = 0xffffffffff000000u64;
4749            let maskedval = padval & mask;
4750            if maskedval != 0 {
4751                return Err(fidl::Error::NonZeroPadding {
4752                    padding_start: offset + 64 + ((mask as u64).trailing_zeros() / 8) as usize,
4753                });
4754            }
4755            fidl::decode!(fidl::encoding::Vector<BaseAddress, 6>, D, &mut self.base_addresses, decoder, offset + 0, _depth)?;
4756            fidl::decode!(fidl::encoding::Vector<Capability, 32>, D, &mut self.capabilities, decoder, offset + 16, _depth)?;
4757            fidl::decode!(fidl::encoding::Vector<ExtendedCapability, 32>, D, &mut self.ext_capabilities, decoder, offset + 32, _depth)?;
4758            fidl::decode!(fidl::encoding::Vector<u8, 256>, D, &mut self.config, decoder, offset + 48, _depth)?;
4759            fidl::decode!(u8, D, &mut self.bus_id, decoder, offset + 64, _depth)?;
4760            fidl::decode!(u8, D, &mut self.device_id, decoder, offset + 65, _depth)?;
4761            fidl::decode!(u8, D, &mut self.function_id, decoder, offset + 66, _depth)?;
4762            Ok(())
4763        }
4764    }
4765
4766    impl fidl::encoding::ValueTypeMarker for UseIntxWorkaroundType {
4767        type Borrowed<'a> = &'a Self;
4768        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4769            value
4770        }
4771    }
4772
4773    unsafe impl fidl::encoding::TypeMarker for UseIntxWorkaroundType {
4774        type Owned = Self;
4775
4776        #[inline(always)]
4777        fn inline_align(_context: fidl::encoding::Context) -> usize {
4778            1
4779        }
4780
4781        #[inline(always)]
4782        fn inline_size(_context: fidl::encoding::Context) -> usize {
4783            1
4784        }
4785    }
4786
4787    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<UseIntxWorkaroundType, D>
4788        for &UseIntxWorkaroundType
4789    {
4790        #[inline]
4791        unsafe fn encode(
4792            self,
4793            encoder: &mut fidl::encoding::Encoder<'_, D>,
4794            offset: usize,
4795            _depth: fidl::encoding::Depth,
4796        ) -> fidl::Result<()> {
4797            encoder.debug_check_bounds::<UseIntxWorkaroundType>(offset);
4798            encoder.write_num(0u8, offset);
4799            Ok(())
4800        }
4801    }
4802
4803    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for UseIntxWorkaroundType {
4804        #[inline(always)]
4805        fn new_empty() -> Self {
4806            Self
4807        }
4808
4809        #[inline]
4810        unsafe fn decode(
4811            &mut self,
4812            decoder: &mut fidl::encoding::Decoder<'_, D>,
4813            offset: usize,
4814            _depth: fidl::encoding::Depth,
4815        ) -> fidl::Result<()> {
4816            decoder.debug_check_bounds::<Self>(offset);
4817            match decoder.read_num::<u8>(offset) {
4818                0 => Ok(()),
4819                _ => Err(fidl::Error::Invalid),
4820            }
4821        }
4822    }
4823
4824    impl BoardConfiguration {
4825        #[inline(always)]
4826        fn max_ordinal_present(&self) -> u64 {
4827            if let Some(_) = self.use_intx_workaround {
4828                return 1;
4829            }
4830            0
4831        }
4832    }
4833
4834    impl fidl::encoding::ValueTypeMarker for BoardConfiguration {
4835        type Borrowed<'a> = &'a Self;
4836        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4837            value
4838        }
4839    }
4840
4841    unsafe impl fidl::encoding::TypeMarker for BoardConfiguration {
4842        type Owned = Self;
4843
4844        #[inline(always)]
4845        fn inline_align(_context: fidl::encoding::Context) -> usize {
4846            8
4847        }
4848
4849        #[inline(always)]
4850        fn inline_size(_context: fidl::encoding::Context) -> usize {
4851            16
4852        }
4853    }
4854
4855    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<BoardConfiguration, D>
4856        for &BoardConfiguration
4857    {
4858        unsafe fn encode(
4859            self,
4860            encoder: &mut fidl::encoding::Encoder<'_, D>,
4861            offset: usize,
4862            mut depth: fidl::encoding::Depth,
4863        ) -> fidl::Result<()> {
4864            encoder.debug_check_bounds::<BoardConfiguration>(offset);
4865            // Vector header
4866            let max_ordinal: u64 = self.max_ordinal_present();
4867            encoder.write_num(max_ordinal, offset);
4868            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
4869            // Calling encoder.out_of_line_offset(0) is not allowed.
4870            if max_ordinal == 0 {
4871                return Ok(());
4872            }
4873            depth.increment()?;
4874            let envelope_size = 8;
4875            let bytes_len = max_ordinal as usize * envelope_size;
4876            #[allow(unused_variables)]
4877            let offset = encoder.out_of_line_offset(bytes_len);
4878            let mut _prev_end_offset: usize = 0;
4879            if 1 > max_ordinal {
4880                return Ok(());
4881            }
4882
4883            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4884            // are envelope_size bytes.
4885            let cur_offset: usize = (1 - 1) * envelope_size;
4886
4887            // Zero reserved fields.
4888            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4889
4890            // Safety:
4891            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4892            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4893            //   envelope_size bytes, there is always sufficient room.
4894            fidl::encoding::encode_in_envelope_optional::<UseIntxWorkaroundType, D>(
4895                self.use_intx_workaround
4896                    .as_ref()
4897                    .map(<UseIntxWorkaroundType as fidl::encoding::ValueTypeMarker>::borrow),
4898                encoder,
4899                offset + cur_offset,
4900                depth,
4901            )?;
4902
4903            _prev_end_offset = cur_offset + envelope_size;
4904
4905            Ok(())
4906        }
4907    }
4908
4909    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for BoardConfiguration {
4910        #[inline(always)]
4911        fn new_empty() -> Self {
4912            Self::default()
4913        }
4914
4915        unsafe fn decode(
4916            &mut self,
4917            decoder: &mut fidl::encoding::Decoder<'_, D>,
4918            offset: usize,
4919            mut depth: fidl::encoding::Depth,
4920        ) -> fidl::Result<()> {
4921            decoder.debug_check_bounds::<Self>(offset);
4922            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
4923                None => return Err(fidl::Error::NotNullable),
4924                Some(len) => len,
4925            };
4926            // Calling decoder.out_of_line_offset(0) is not allowed.
4927            if len == 0 {
4928                return Ok(());
4929            };
4930            depth.increment()?;
4931            let envelope_size = 8;
4932            let bytes_len = len * envelope_size;
4933            let offset = decoder.out_of_line_offset(bytes_len)?;
4934            // Decode the envelope for each type.
4935            let mut _next_ordinal_to_read = 0;
4936            let mut next_offset = offset;
4937            let end_offset = offset + bytes_len;
4938            _next_ordinal_to_read += 1;
4939            if next_offset >= end_offset {
4940                return Ok(());
4941            }
4942
4943            // Decode unknown envelopes for gaps in ordinals.
4944            while _next_ordinal_to_read < 1 {
4945                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4946                _next_ordinal_to_read += 1;
4947                next_offset += envelope_size;
4948            }
4949
4950            let next_out_of_line = decoder.next_out_of_line();
4951            let handles_before = decoder.remaining_handles();
4952            if let Some((inlined, num_bytes, num_handles)) =
4953                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4954            {
4955                let member_inline_size =
4956                    <UseIntxWorkaroundType as fidl::encoding::TypeMarker>::inline_size(
4957                        decoder.context,
4958                    );
4959                if inlined != (member_inline_size <= 4) {
4960                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4961                }
4962                let inner_offset;
4963                let mut inner_depth = depth.clone();
4964                if inlined {
4965                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4966                    inner_offset = next_offset;
4967                } else {
4968                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4969                    inner_depth.increment()?;
4970                }
4971                let val_ref = self
4972                    .use_intx_workaround
4973                    .get_or_insert_with(|| fidl::new_empty!(UseIntxWorkaroundType, D));
4974                fidl::decode!(
4975                    UseIntxWorkaroundType,
4976                    D,
4977                    val_ref,
4978                    decoder,
4979                    inner_offset,
4980                    inner_depth
4981                )?;
4982                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4983                {
4984                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4985                }
4986                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4987                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4988                }
4989            }
4990
4991            next_offset += envelope_size;
4992
4993            // Decode the remaining unknown envelopes.
4994            while next_offset < end_offset {
4995                _next_ordinal_to_read += 1;
4996                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4997                next_offset += envelope_size;
4998            }
4999
5000            Ok(())
5001        }
5002    }
5003}