@@ -23,28 +23,19 @@ use crate::console::IoDevice;
2323use crate :: drivers:: console:: { VirtioConsoleDriver , VirtioUART } ;
2424#[ cfg( feature = "fuse" ) ]
2525use crate :: drivers:: fs:: virtio_fs:: VirtioFsDriver ;
26- #[ cfg( all ( target_arch = "x86_64" , feature = "rtl8139" ) ) ]
26+ #[ cfg( feature = "rtl8139" ) ]
2727use crate :: drivers:: net:: rtl8139:: { self , RTL8139Driver } ;
28- #[ cfg( all(
29- not( all( target_arch = "x86_64" , feature = "rtl8139" ) ) ,
30- feature = "virtio-net" ,
31- ) ) ]
28+ #[ cfg( all( not( feature = "rtl8139" ) , feature = "virtio-net" , ) ) ]
3229use crate :: drivers:: net:: virtio:: VirtioNetDriver ;
3330#[ cfg( any(
34- all(
35- feature = "virtio-net" ,
36- not( all( target_arch = "x86_64" , feature = "rtl8139" ) ) ,
37- ) ,
31+ all( feature = "virtio-net" , not( feature = "rtl8139" ) , ) ,
3832 feature = "fuse" ,
3933 feature = "vsock" ,
4034 feature = "console" ,
4135) ) ]
4236use crate :: drivers:: virtio:: transport:: pci as pci_virtio;
4337#[ cfg( any(
44- all(
45- feature = "virtio-net" ,
46- not( all( target_arch = "x86_64" , feature = "rtl8139" ) ) ,
47- ) ,
38+ all( feature = "virtio-net" , not( feature = "rtl8139" ) , ) ,
4839 feature = "fuse" ,
4940 feature = "vsock" ,
5041 feature = "console" ,
@@ -54,10 +45,7 @@ use crate::drivers::virtio::transport::pci::VirtioDriver;
5445use crate :: drivers:: vsock:: VirtioVsockDriver ;
5546#[ allow( unused_imports) ]
5647use crate :: drivers:: { Driver , InterruptHandlerQueue } ;
57- #[ cfg( any(
58- all( target_arch = "x86_64" , feature = "rtl8139" ) ,
59- feature = "virtio-net" ,
60- ) ) ]
48+ #[ cfg( any( feature = "rtl8139" , feature = "virtio-net" , ) ) ]
6149use crate :: executor:: device:: NETWORK_DEVICE ;
6250use crate :: init_cell:: InitCell ;
6351
@@ -441,10 +429,7 @@ pub(crate) fn get_interrupt_handlers() -> HashMap<InterruptLine, InterruptHandle
441429 }
442430 }
443431
444- #[ cfg( any(
445- all( target_arch = "x86_64" , feature = "rtl8139" ) ,
446- feature = "virtio-net" ,
447- ) ) ]
432+ #[ cfg( any( feature = "rtl8139" , feature = "virtio-net" , ) ) ]
448433 if let Some ( device) = NETWORK_DEVICE . lock ( ) . as_ref ( ) {
449434 handlers
450435 . entry ( device. get_interrupt_number ( ) )
@@ -455,13 +440,10 @@ pub(crate) fn get_interrupt_handlers() -> HashMap<InterruptLine, InterruptHandle
455440 handlers
456441}
457442
458- #[ cfg( all(
459- not( all( target_arch = "x86_64" , feature = "rtl8139" ) ) ,
460- feature = "virtio-net" ,
461- ) ) ]
443+ #[ cfg( all( not( feature = "rtl8139" ) , feature = "virtio-net" ) ) ]
462444pub ( crate ) type NetworkDevice = VirtioNetDriver ;
463445
464- #[ cfg( all ( target_arch = "x86_64" , feature = "rtl8139" ) ) ]
446+ #[ cfg( feature = "rtl8139" ) ]
465447pub ( crate ) type NetworkDevice = RTL8139Driver ;
466448
467449#[ cfg( feature = "console" ) ]
@@ -501,19 +483,13 @@ pub(crate) fn init() {
501483 ) ;
502484
503485 #[ cfg( any(
504- all(
505- feature = "virtio-net" ,
506- not( all( target_arch = "x86_64" , feature = "rtl8139" ) ) ,
507- ) ,
486+ all( feature = "virtio-net" , not( feature = "rtl8139" ) , ) ,
508487 feature = "fuse" ,
509488 feature = "vsock" ,
510489 feature = "console" ,
511490 ) ) ]
512491 match pci_virtio:: init_device ( adapter) {
513- #[ cfg( all(
514- not( all( target_arch = "x86_64" , feature = "rtl8139" ) ) ,
515- feature = "virtio-net" ,
516- ) ) ]
492+ #[ cfg( all( not( feature = "rtl8139" ) , feature = "virtio-net" , ) ) ]
517493 Ok ( VirtioDriver :: Network ( drv) ) => * crate :: executor:: device:: NETWORK_DEVICE . lock ( ) = Some ( drv) ,
518494
519495 #[ cfg( feature = "console" ) ]
@@ -537,7 +513,7 @@ pub(crate) fn init() {
537513 }
538514
539515 // Searching for Realtek RTL8139, which is supported by Qemu
540- #[ cfg( all ( target_arch = "x86_64" , feature = "rtl8139" ) ) ]
516+ #[ cfg( feature = "rtl8139" ) ]
541517 for adapter in PCI_DEVICES . finalize ( ) . iter ( ) . filter ( |x| {
542518 let ( vendor_id, device_id) = x. id ( ) ;
543519 vendor_id == 0x10ec && ( 0x8138 ..=0x8139 ) . contains ( & device_id)
0 commit comments