@@ -23,28 +23,19 @@ use crate::console::IoDevice;
23
23
use crate :: drivers:: console:: { VirtioConsoleDriver , VirtioUART } ;
24
24
#[ cfg( feature = "fuse" ) ]
25
25
use crate :: drivers:: fs:: virtio_fs:: VirtioFsDriver ;
26
- #[ cfg( all ( target_arch = "x86_64" , feature = "rtl8139" ) ) ]
26
+ #[ cfg( feature = "rtl8139" ) ]
27
27
use 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" , ) ) ]
32
29
use crate :: drivers:: net:: virtio:: VirtioNetDriver ;
33
30
#[ 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" ) , ) ,
38
32
feature = "fuse" ,
39
33
feature = "vsock" ,
40
34
feature = "console" ,
41
35
) ) ]
42
36
use crate :: drivers:: virtio:: transport:: pci as pci_virtio;
43
37
#[ 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" ) , ) ,
48
39
feature = "fuse" ,
49
40
feature = "vsock" ,
50
41
feature = "console" ,
@@ -54,10 +45,7 @@ use crate::drivers::virtio::transport::pci::VirtioDriver;
54
45
use crate :: drivers:: vsock:: VirtioVsockDriver ;
55
46
#[ allow( unused_imports) ]
56
47
use 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" , ) ) ]
61
49
use crate :: executor:: device:: NETWORK_DEVICE ;
62
50
use crate :: init_cell:: InitCell ;
63
51
@@ -441,10 +429,7 @@ pub(crate) fn get_interrupt_handlers() -> HashMap<InterruptLine, InterruptHandle
441
429
}
442
430
}
443
431
444
- #[ cfg( any(
445
- all( target_arch = "x86_64" , feature = "rtl8139" ) ,
446
- feature = "virtio-net" ,
447
- ) ) ]
432
+ #[ cfg( any( feature = "rtl8139" , feature = "virtio-net" , ) ) ]
448
433
if let Some ( device) = NETWORK_DEVICE . lock ( ) . as_ref ( ) {
449
434
handlers
450
435
. entry ( device. get_interrupt_number ( ) )
@@ -455,13 +440,10 @@ pub(crate) fn get_interrupt_handlers() -> HashMap<InterruptLine, InterruptHandle
455
440
handlers
456
441
}
457
442
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" ) ) ]
462
444
pub ( crate ) type NetworkDevice = VirtioNetDriver ;
463
445
464
- #[ cfg( all ( target_arch = "x86_64" , feature = "rtl8139" ) ) ]
446
+ #[ cfg( feature = "rtl8139" ) ]
465
447
pub ( crate ) type NetworkDevice = RTL8139Driver ;
466
448
467
449
#[ cfg( feature = "console" ) ]
@@ -501,19 +483,13 @@ pub(crate) fn init() {
501
483
) ;
502
484
503
485
#[ 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" ) , ) ,
508
487
feature = "fuse" ,
509
488
feature = "vsock" ,
510
489
feature = "console" ,
511
490
) ) ]
512
491
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" , ) ) ]
517
493
Ok ( VirtioDriver :: Network ( drv) ) => * crate :: executor:: device:: NETWORK_DEVICE . lock ( ) = Some ( drv) ,
518
494
519
495
#[ cfg( feature = "console" ) ]
@@ -537,7 +513,7 @@ pub(crate) fn init() {
537
513
}
538
514
539
515
// Searching for Realtek RTL8139, which is supported by Qemu
540
- #[ cfg( all ( target_arch = "x86_64" , feature = "rtl8139" ) ) ]
516
+ #[ cfg( feature = "rtl8139" ) ]
541
517
for adapter in PCI_DEVICES . finalize ( ) . iter ( ) . filter ( |x| {
542
518
let ( vendor_id, device_id) = x. id ( ) ;
543
519
vendor_id == 0x10ec && ( 0x8138 ..=0x8139 ) . contains ( & device_id)
0 commit comments