Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 26 additions & 1 deletion vmm/src/device_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5682,7 +5682,7 @@ impl Aml for DeviceManager {
.to_aml_bytes(sink);
}

aml::Name::new("_S5_".into(), &aml::Package::new(vec![&5u8])).to_aml_bytes(sink);
create_s5_sleep_state(sink);

aml::Device::new(
"_SB_.PWRB".into(),
Expand All @@ -5708,6 +5708,17 @@ impl Aml for DeviceManager {
}
}

fn create_s5_sleep_state(sink: &mut dyn acpi_tables::AmlSink) {
// More information about the sleep state structure can be found here:
// https://uefi.org/htmlspecs/ACPI_Spec_6_4_html/07_Power_and_Performance_Mgmt/oem-supplied-system-level-control-methods.html#sx-system-states

aml::Name::new(
"_S5_".into(),
&aml::Package::new(vec![&5u8, &5u8, &0u8, &0u8]),
Comment thread
tpressure marked this conversation as resolved.
)
.to_aml_bytes(sink);
}

impl Pausable for DeviceManager {
fn pause(&mut self) -> result::Result<(), MigratableError> {
for (_, device_node) in self.device_tree.lock().unwrap().iter() {
Expand Down Expand Up @@ -5951,6 +5962,20 @@ impl Drop for DeviceManager {
mod unit_tests {
use super::*;

#[test]
fn test_s5_sleep_state_uses_complete_package() {
let mut bytes = Vec::new();

create_s5_sleep_state(&mut bytes);

assert_eq!(
bytes,
vec![
0x08, b'_', b'S', b'5', b'_', 0x12, 0x08, 0x04, 0x0a, 0x05, 0x0a, 0x05, 0x00, 0x00,
]
);
}

#[test]
fn test_hotplugged_block_devices_use_64bit_bars() {
assert!(!use_64bit_bar_for_virtio_device(
Expand Down
Loading