vmm: device_manager: Make legacy device addition a method

Remove some in/out parameters and instead rely on them as members of the
&mut self parameter.

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
This commit is contained in:
Rob Bradford 2020-01-29 15:53:12 +00:00
parent 599275b610
commit 77ae3de4f3

View File

@ -466,12 +466,6 @@ impl DeviceManager {
Some(ioapic.clone()),
));
DeviceManager::add_legacy_devices(
vm_info,
&address_manager,
reset_evt.try_clone().map_err(DeviceManagerError::EventFd)?,
)?;
#[cfg(feature = "acpi")]
let config = vm_info.vm_cfg.clone();
@ -503,6 +497,11 @@ impl DeviceManager {
_memory_manager,
};
device_manager.add_legacy_devices(
vm_info,
reset_evt.try_clone().map_err(DeviceManagerError::EventFd)?,
)?;
#[cfg(feature = "acpi")]
{
device_manager.ged_notification_device = device_manager.add_acpi_devices(
@ -720,14 +719,14 @@ impl DeviceManager {
}
fn add_legacy_devices(
&mut self,
_vm_info: &VmInfo,
address_manager: &Arc<AddressManager>,
reset_evt: EventFd,
) -> DeviceManagerResult<()> {
// Add a shutdown device (i8042)
let i8042 = Arc::new(Mutex::new(devices::legacy::I8042Device::new(reset_evt)));
address_manager
self.address_manager
.io_bus
.insert(i8042, 0x61, 0x4)
.map_err(DeviceManagerError::BusError)?;
@ -744,7 +743,7 @@ impl DeviceManager {
mem_above_4g,
)));
address_manager
self.address_manager
.io_bus
.insert(cmos, 0x70, 0x2)
.map_err(DeviceManagerError::BusError)?;