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