@@ -176,17 +176,6 @@ impl PciSubclass for PciNetworkControllerSubclass {
176
176
}
177
177
}
178
178
179
- /// Trait to define a PCI class programming interface
180
- ///
181
- /// Each combination of `PciClassCode` and `PciSubclass` can specify a
182
- /// set of register-level programming interfaces.
183
- /// This trait is implemented by each programming interface.
184
- /// It allows use of a trait object to generate configurations.
185
- pub trait PciProgrammingInterface {
186
- /// Convert this programming interface to the value used in the PCI specification.
187
- fn get_register_value ( & self ) -> u8 ;
188
- }
189
-
190
179
/// Types of PCI capabilities.
191
180
#[ derive( Debug , PartialEq , Eq , Copy , Clone ) ]
192
181
#[ allow( dead_code) ]
@@ -451,7 +440,6 @@ impl PciConfiguration {
451
440
revision_id : u8 ,
452
441
class_code : PciClassCode ,
453
442
subclass : & dyn PciSubclass ,
454
- programming_interface : Option < & dyn PciProgrammingInterface > ,
455
443
header_type : PciHeaderType ,
456
444
subsystem_vendor_id : u16 ,
457
445
subsystem_id : u16 ,
@@ -473,14 +461,8 @@ impl PciConfiguration {
473
461
registers[ 0 ] = ( u32:: from ( device_id) << 16 ) | u32:: from ( vendor_id) ;
474
462
// TODO(dverkamp): Status should be write-1-to-clear
475
463
writable_bits[ 1 ] = 0x0000_ffff ; // Status (r/o), command (r/w)
476
- let pi = if let Some ( pi) = programming_interface {
477
- pi. get_register_value ( )
478
- } else {
479
- 0
480
- } ;
481
464
registers[ 2 ] = ( u32:: from ( class_code. get_register_value ( ) ) << 24 )
482
465
| ( u32:: from ( subclass. get_register_value ( ) ) << 16 )
483
- | ( u32:: from ( pi) << 8 )
484
466
| u32:: from ( revision_id) ;
485
467
writable_bits[ 3 ] = 0x0000_00ff ; // Cacheline size (r/w)
486
468
@@ -1016,17 +998,6 @@ mod tests {
1016
998
assert_eq ! ( cfg. read_reg( cap_reg + 2 ) , pba_offset) ;
1017
999
}
1018
1000
1019
- #[ derive( Copy , Clone ) ]
1020
- enum TestPi {
1021
- Test = 0x5a ,
1022
- }
1023
-
1024
- impl PciProgrammingInterface for TestPi {
1025
- fn get_register_value ( & self ) -> u8 {
1026
- * self as u8
1027
- }
1028
- }
1029
-
1030
1001
#[ test]
1031
1002
fn class_code ( ) {
1032
1003
let cfg = PciConfiguration :: new (
@@ -1035,7 +1006,6 @@ mod tests {
1035
1006
0x1 ,
1036
1007
PciClassCode :: MultimediaController ,
1037
1008
& PciMultimediaSubclass :: AudioController ,
1038
- Some ( & TestPi :: Test ) ,
1039
1009
PciHeaderType :: Device ,
1040
1010
0xABCD ,
1041
1011
0x2468 ,
@@ -1049,7 +1019,7 @@ mod tests {
1049
1019
let prog_if = ( class_reg >> 8 ) & 0xFF ;
1050
1020
assert_eq ! ( class_code, 0x04 ) ;
1051
1021
assert_eq ! ( subclass, 0x01 ) ;
1052
- assert_eq ! ( prog_if, 0x5a ) ;
1022
+ assert_eq ! ( prog_if, 0x0 ) ;
1053
1023
}
1054
1024
1055
1025
#[ test]
@@ -1092,7 +1062,6 @@ mod tests {
1092
1062
0x0 ,
1093
1063
PciClassCode :: MassStorage ,
1094
1064
& PciMassStorageSubclass :: SerialScsiController ,
1095
- None ,
1096
1065
PciHeaderType :: Device ,
1097
1066
0x13 ,
1098
1067
0x12 ,
@@ -1174,7 +1143,6 @@ mod tests {
1174
1143
0x0 ,
1175
1144
PciClassCode :: MassStorage ,
1176
1145
& PciMassStorageSubclass :: SerialScsiController ,
1177
- None ,
1178
1146
PciHeaderType :: Device ,
1179
1147
0x13 ,
1180
1148
0x12 ,
@@ -1220,7 +1188,6 @@ mod tests {
1220
1188
0x0 ,
1221
1189
PciClassCode :: MassStorage ,
1222
1190
& PciMassStorageSubclass :: SerialScsiController ,
1223
- None ,
1224
1191
PciHeaderType :: Device ,
1225
1192
0x13 ,
1226
1193
0x12 ,
0 commit comments