File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -134,7 +134,6 @@ enum AdminIoCqeGenericCommandStatus {
134134 InternalError = 0x06 ,
135135 InvalidNamespaceOrFormat = 0x0b ,
136136}
137- unsafe impl Discriminant < u8 > for AdminIoCqeGenericCommandStatus { }
138137
139138impl From < DekuError > for AdminIoCqeGenericCommandStatus {
140139 fn from ( err : DekuError ) -> Self {
Original file line number Diff line number Diff line change @@ -104,8 +104,7 @@ impl PciDeviceFunctionConfigurationSpace {
104104 d2 : false ,
105105 pme : 0 ,
106106 }
107- }
108- . into ( ) ,
107+ } ,
109108 pmcsr : 0 ,
110109 data : 0 ,
111110 } ) ,
@@ -175,36 +174,32 @@ impl PciDeviceFunctionConfigurationSpaceBuilder {
175174 }
176175}
177176
178- #[ derive( Debug ) ]
177+ #[ derive( Debug , DekuRead , DekuWrite ) ]
178+ #[ deku( bit_order = "lsb" , ctx = "endian: Endian" , endian = "endian" ) ]
179179pub struct PowerManagementCapabilities {
180+ #[ deku( bits = "3" ) ]
180181 version : u8 ,
182+ #[ deku( bits = "1" ) ]
181183 pme_clock : bool ,
184+ #[ deku( bits = "1" ) ]
182185 ready_d0 : bool ,
186+ #[ deku( bits = "1" ) ]
183187 dsi : bool ,
188+ #[ deku( bits = "3" ) ]
184189 aux_current : u8 ,
190+ #[ deku( bits = "1" ) ]
185191 d1 : bool ,
192+ #[ deku( bits = "1" ) ]
186193 d2 : bool ,
194+ #[ deku( bits = "5" ) ]
187195 pme : u8 ,
188196}
189197
190- impl From < PowerManagementCapabilities > for u16 {
191- fn from ( value : PowerManagementCapabilities ) -> Self {
192- ( ( value. pme as u16 & 0xf ) << 11 )
193- | ( ( value. d2 as u16 ) << 10 )
194- | ( ( value. d1 as u16 ) << 9 )
195- | ( ( value. aux_current as u16 & 0x7 ) << 6 )
196- | ( ( value. dsi as u16 ) << 5 )
197- | ( ( value. ready_d0 as u16 ) << 4 )
198- | ( ( value. pme_clock as u16 ) << 3 )
199- | ( value. version as u16 & 0x7 )
200- }
201- }
202-
203198#[ derive( Debug , DekuRead , DekuWrite ) ]
204199#[ deku( ctx = "endian: Endian" , endian = "endian" ) ]
205200pub struct PciPowerManagementCapability {
206201 next : u8 ,
207- pmc : u16 ,
202+ pmc : PowerManagementCapabilities ,
208203 pmcsr : u16 ,
209204 #[ deku( seek_from_current = "1" ) ]
210205 data : u8 ,
You can’t perform that action at this time.
0 commit comments