Skip to main content

fidl_fuchsia_hardware_pci/
fidl_fuchsia_hardware_pci.rs

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