@@ -25,7 +25,6 @@ use crate::arch::{RTC_MEM_START, SERIAL_MEM_START};
25
25
#[ cfg( target_arch = "aarch64" ) ]
26
26
use crate :: devices:: legacy:: { RTCDevice , SerialDevice } ;
27
27
use crate :: devices:: pseudo:: BootTimer ;
28
- use crate :: devices:: virtio:: device:: VirtioDevice ;
29
28
use crate :: devices:: virtio:: transport:: mmio:: MmioTransport ;
30
29
use crate :: vstate:: bus:: { Bus , BusError } ;
31
30
#[ cfg( target_arch = "x86_64" ) ]
@@ -41,12 +40,6 @@ pub enum MmioError {
41
40
BusInsert ( #[ from] BusError ) ,
42
41
/// Failed to allocate requested resourc: {0}
43
42
Cmdline ( #[ from] linux_loader:: cmdline:: Error ) ,
44
- /// Failed to find the device on the bus.
45
- DeviceNotFound ,
46
- /// Invalid device type found on the MMIO bus.
47
- InvalidDeviceType ,
48
- /// {0}
49
- InternalDeviceError ( String ) ,
50
43
/// Could not create IRQ for MMIO device: {0}
51
44
CreateIrq ( #[ from] std:: io:: Error ) ,
52
45
/// Invalid MMIO IRQ configuration.
@@ -407,31 +400,6 @@ impl MMIODeviceManager {
407
400
Ok ( ( ) )
408
401
}
409
402
410
- /// Run fn `f()` for the virtio device matching `virtio_type` and `id`.
411
- pub fn with_virtio_device_with_id < T , F > (
412
- & self ,
413
- virtio_type : u32 ,
414
- id : & str ,
415
- f : F ,
416
- ) -> Result < ( ) , MmioError >
417
- where
418
- T : VirtioDevice + ' static + Debug ,
419
- F : FnOnce ( & mut T ) -> Result < ( ) , String > ,
420
- {
421
- if let Some ( device) = self . get_virtio_device ( virtio_type, id) {
422
- let virtio_device = device. inner . lock ( ) . expect ( "Poisoned lock" ) . device ( ) ;
423
- let mut dev = virtio_device. lock ( ) . expect ( "Poisoned lock" ) ;
424
- f ( dev
425
- . as_mut_any ( )
426
- . downcast_mut :: < T > ( )
427
- . ok_or ( MmioError :: InvalidDeviceType ) ?)
428
- . map_err ( MmioError :: InternalDeviceError ) ?;
429
- } else {
430
- return Err ( MmioError :: DeviceNotFound ) ;
431
- }
432
- Ok ( ( ) )
433
- }
434
-
435
403
#[ cfg( target_arch = "aarch64" ) ]
436
404
pub fn virtio_device_info ( & self ) -> Vec < & MMIODeviceInfo > {
437
405
let mut device_info = Vec :: new ( ) ;
0 commit comments