chipset_legacy/
piix4_uhci.rs1use chipset_device::ChipsetDevice;
7use chipset_device::io::IoResult;
8use chipset_device::pci::PciConfigSpace;
9use inspect::InspectMut;
10use vmcore::device_state::ChangeDeviceState;
11
12#[derive(Debug, InspectMut)]
22#[non_exhaustive] pub struct Piix4UsbUhciStub {}
24
25impl Piix4UsbUhciStub {
26 pub fn new() -> Self {
27 Self {}
28 }
29}
30
31impl ChangeDeviceState for Piix4UsbUhciStub {
32 fn start(&mut self) {}
33
34 async fn stop(&mut self) {}
35
36 async fn reset(&mut self) {}
37}
38
39impl ChipsetDevice for Piix4UsbUhciStub {
40 fn supports_pci(&mut self) -> Option<&mut dyn PciConfigSpace> {
41 Some(self)
42 }
43}
44
45impl PciConfigSpace for Piix4UsbUhciStub {
47 fn pci_cfg_read(&mut self, offset: u16, value: &mut u32) -> IoResult {
48 use pci_core::spec::cfg_space::HeaderType00;
49 *value = match HeaderType00(offset) {
50 HeaderType00::BIST_HEADER => 0,
51 HeaderType00::BAR4 => 0,
52 HeaderType00::STATUS_COMMAND => 0x02800000,
53 HeaderType00::LATENCY_INTERRUPT => 0x000000FF | (4 << 8),
56 HeaderType00::DEVICE_VENDOR => 0xFFFFFFFF,
59 HeaderType00::CLASS_REVISION => 0x00000000,
62 _ if offset < 0x40 => 0, _ => {
64 tracing::debug!(?offset, "unimplemented config space read");
65 0
67 }
68 };
69
70 IoResult::Ok
71 }
72
73 fn pci_cfg_write(&mut self, offset: u16, value: u32) -> IoResult {
74 use pci_core::spec::cfg_space::HeaderType00;
75 match HeaderType00(offset) {
76 HeaderType00::BIST_HEADER => {}
77 HeaderType00::BAR4 => {}
78 HeaderType00::STATUS_COMMAND => {}
79 HeaderType00::LATENCY_INTERRUPT => {}
80 HeaderType00::DEVICE_VENDOR => {}
81 _ => {
82 tracing::debug!(?offset, ?value, "unimplemented config space write");
83 }
85 }
86
87 IoResult::Ok
88 }
89
90 fn suggested_bdf(&mut self) -> Option<(u8, u8, u8)> {
91 Some((0, 7, 2)) }
93}
94
95mod save_restore {
96 use super::*;
97 use vmcore::save_restore::NoSavedState;
98 use vmcore::save_restore::RestoreError;
99 use vmcore::save_restore::SaveError;
100 use vmcore::save_restore::SaveRestore;
101
102 impl SaveRestore for Piix4UsbUhciStub {
104 type SavedState = NoSavedState;
105
106 fn save(&mut self) -> Result<Self::SavedState, SaveError> {
107 Ok(NoSavedState)
108 }
109
110 fn restore(&mut self, NoSavedState: Self::SavedState) -> Result<(), RestoreError> {
111 Ok(())
112 }
113 }
114}