diff --git a/vmm/src/device_manager.rs b/vmm/src/device_manager.rs index 83fe9e84c..19ce15be3 100644 --- a/vmm/src/device_manager.rs +++ b/vmm/src/device_manager.rs @@ -1411,6 +1411,10 @@ impl DeviceManager { #[cfg(target_arch = "x86_64")] { + let shutdown_pio_address: u16 = 0x600; + + // TODO: Remove the entry for 0x3c0 once all firmwares will have been + // updated with the new value. self.address_manager .allocator .lock() @@ -1418,16 +1422,31 @@ impl DeviceManager { .allocate_io_addresses(Some(GuestAddress(0x3c0)), 0x8, None) .ok_or(DeviceManagerError::AllocateIoPort)?; + self.address_manager + .allocator + .lock() + .unwrap() + .allocate_io_addresses(Some(GuestAddress(shutdown_pio_address.into())), 0x8, None) + .ok_or(DeviceManagerError::AllocateIoPort)?; + + // TODO: Remove the entry for 0x3c0 once all firmwares will have been + // updated with the new value. self.address_manager .io_bus - .insert(shutdown_device, 0x3c0, 0x4) + .insert(shutdown_device.clone(), 0x3c0, 0x4) .map_err(DeviceManagerError::BusError)?; + + self.address_manager + .io_bus + .insert(shutdown_device, shutdown_pio_address.into(), 0x4) + .map_err(DeviceManagerError::BusError)?; + self.acpi_platform_addresses.sleep_control_reg_address = - Some(GenericAddress::io_port_address::(0x3c0)); + Some(GenericAddress::io_port_address::(shutdown_pio_address)); self.acpi_platform_addresses.sleep_status_reg_address = - Some(GenericAddress::io_port_address::(0x3c0)); + Some(GenericAddress::io_port_address::(shutdown_pio_address)); self.acpi_platform_addresses.reset_reg_address = - Some(GenericAddress::io_port_address::(0x3c0)); + Some(GenericAddress::io_port_address::(shutdown_pio_address)); } let ged_irq = self @@ -1476,6 +1495,10 @@ impl DeviceManager { #[cfg(target_arch = "x86_64")] { + let pm_timer_pio_address: u16 = 0x608; + + // TODO: Remove the entry for 0xb008 once all firmwares will have been + // updated with the new value. self.address_manager .allocator .lock() @@ -1483,13 +1506,27 @@ impl DeviceManager { .allocate_io_addresses(Some(GuestAddress(0xb008)), 0x4, None) .ok_or(DeviceManagerError::AllocateIoPort)?; + self.address_manager + .allocator + .lock() + .unwrap() + .allocate_io_addresses(Some(GuestAddress(pm_timer_pio_address.into())), 0x4, None) + .ok_or(DeviceManagerError::AllocateIoPort)?; + + // TODO: Remove the entry for 0xb008 once all firmwares will have been + // updated with the new value. self.address_manager .io_bus - .insert(pm_timer_device, 0xb008, 0x4) + .insert(pm_timer_device.clone(), 0xb008, 0x4) + .map_err(DeviceManagerError::BusError)?; + + self.address_manager + .io_bus + .insert(pm_timer_device, pm_timer_pio_address.into(), 0x4) .map_err(DeviceManagerError::BusError)?; self.acpi_platform_addresses.pm_timer_address = - Some(GenericAddress::io_port_address::(0xb008)); + Some(GenericAddress::io_port_address::(pm_timer_pio_address)); } Ok(Some(ged_device))