@@ -146,12 +146,12 @@ impl PciHeader {
146146 PciHeader ( address)
147147 }
148148
149- pub fn id ( & self , access : & impl ConfigRegionAccess ) -> ( VendorId , DeviceId ) {
149+ pub fn id ( & self , access : impl ConfigRegionAccess ) -> ( VendorId , DeviceId ) {
150150 let id = unsafe { access. read ( self . 0 , 0x00 ) } ;
151151 ( id. get_bits ( 0 ..16 ) as VendorId , id. get_bits ( 16 ..32 ) as DeviceId )
152152 }
153153
154- pub fn header_type ( & self , access : & impl ConfigRegionAccess ) -> HeaderType {
154+ pub fn header_type ( & self , access : impl ConfigRegionAccess ) -> HeaderType {
155155 /*
156156 * Read bits 0..=6 of the Header Type. Bit 7 dictates whether the device has multiple functions and so
157157 * isn't returned here.
@@ -164,7 +164,7 @@ impl PciHeader {
164164 }
165165 }
166166
167- pub fn has_multiple_functions ( & self , access : & impl ConfigRegionAccess ) -> bool {
167+ pub fn has_multiple_functions ( & self , access : impl ConfigRegionAccess ) -> bool {
168168 /*
169169 * Reads bit 7 of the Header Type, which is 1 if the device has multiple functions.
170170 */
@@ -173,7 +173,7 @@ impl PciHeader {
173173
174174 pub fn revision_and_class (
175175 & self ,
176- access : & impl ConfigRegionAccess ,
176+ access : impl ConfigRegionAccess ,
177177 ) -> ( DeviceRevision , BaseClass , SubClass , Interface ) {
178178 let field = unsafe { access. read ( self . 0 , 0x08 ) } ;
179179 (
@@ -184,17 +184,17 @@ impl PciHeader {
184184 )
185185 }
186186
187- pub fn status ( & self , access : & impl ConfigRegionAccess ) -> StatusRegister {
187+ pub fn status ( & self , access : impl ConfigRegionAccess ) -> StatusRegister {
188188 let data = unsafe { access. read ( self . 0 , 0x4 ) . get_bits ( 16 ..32 ) } ;
189189 StatusRegister :: new ( data as u16 )
190190 }
191191
192- pub fn command ( & self , access : & impl ConfigRegionAccess ) -> CommandRegister {
192+ pub fn command ( & self , access : impl ConfigRegionAccess ) -> CommandRegister {
193193 let data = unsafe { access. read ( self . 0 , 0x4 ) . get_bits ( 0 ..16 ) } ;
194194 CommandRegister :: from_bits_retain ( data as u16 )
195195 }
196196
197- pub fn update_command < F > ( & self , access : & impl ConfigRegionAccess , f : F )
197+ pub fn update_command < F > ( & self , access : impl ConfigRegionAccess , f : F )
198198 where
199199 F : FnOnce ( CommandRegister ) -> CommandRegister ,
200200 {
@@ -256,7 +256,7 @@ impl PciHeader {
256256pub struct EndpointHeader ( PciAddress ) ;
257257
258258impl EndpointHeader {
259- pub fn from_header ( header : PciHeader , access : & impl ConfigRegionAccess ) -> Option < EndpointHeader > {
259+ pub fn from_header ( header : PciHeader , access : impl ConfigRegionAccess ) -> Option < EndpointHeader > {
260260 match header. header_type ( access) {
261261 HeaderType :: Endpoint => Some ( EndpointHeader ( header. 0 ) ) ,
262262 _ => None ,
@@ -267,23 +267,23 @@ impl EndpointHeader {
267267 PciHeader ( self . 0 )
268268 }
269269
270- pub fn status ( & self , access : & impl ConfigRegionAccess ) -> StatusRegister {
270+ pub fn status ( & self , access : impl ConfigRegionAccess ) -> StatusRegister {
271271 self . header ( ) . status ( access)
272272 }
273273
274- pub fn command ( & self , access : & impl ConfigRegionAccess ) -> CommandRegister {
274+ pub fn command ( & self , access : impl ConfigRegionAccess ) -> CommandRegister {
275275 self . header ( ) . command ( access)
276276 }
277277
278- pub fn update_command < F > ( & self , access : & impl ConfigRegionAccess , f : F )
278+ pub fn update_command < F > ( & self , access : impl ConfigRegionAccess , f : F )
279279 where
280280 F : FnOnce ( CommandRegister ) -> CommandRegister ,
281281 {
282282 self . header ( ) . update_command ( access, f) ;
283283 }
284284
285- pub fn capability_pointer ( & self , access : & impl ConfigRegionAccess ) -> u16 {
286- let status = self . status ( access) ;
285+ pub fn capability_pointer ( & self , access : impl ConfigRegionAccess ) -> u16 {
286+ let status = self . status ( & access) ;
287287 if status. has_capability_list ( ) {
288288 unsafe { access. read ( self . 0 , 0x34 ) . get_bits ( 0 ..8 ) as u16 }
289289 } else {
@@ -296,7 +296,7 @@ impl EndpointHeader {
296296 CapabilityIterator :: new ( self . 0 , pointer, access)
297297 }
298298
299- pub fn subsystem ( & self , access : & impl ConfigRegionAccess ) -> ( SubsystemId , SubsystemVendorId ) {
299+ pub fn subsystem ( & self , access : impl ConfigRegionAccess ) -> ( SubsystemId , SubsystemVendorId ) {
300300 let data = unsafe { access. read ( self . 0 , 0x2c ) } ;
301301 ( data. get_bits ( 16 ..32 ) as u16 , data. get_bits ( 0 ..16 ) as u16 )
302302 }
@@ -306,7 +306,7 @@ impl EndpointHeader {
306306 /// ### Note
307307 /// 64-bit memory BARs use two slots, so if one is decoded in e.g. slot #0, this method should not be called
308308 /// for slot #1
309- pub fn bar ( & self , slot : u8 , access : & impl ConfigRegionAccess ) -> Option < Bar > {
309+ pub fn bar ( & self , slot : u8 , access : impl ConfigRegionAccess ) -> Option < Bar > {
310310 if slot >= 6 {
311311 return None ;
312312 }
@@ -397,10 +397,10 @@ impl EndpointHeader {
397397 pub unsafe fn write_bar (
398398 & mut self ,
399399 slot : u8 ,
400- access : & impl ConfigRegionAccess ,
400+ access : impl ConfigRegionAccess ,
401401 value : usize ,
402402 ) -> Result < ( ) , BarWriteError > {
403- match self . bar ( slot, access) {
403+ match self . bar ( slot, & access) {
404404 Some ( Bar :: Memory64 { .. } ) => {
405405 let offset = 0x10 + ( slot as u16 ) * 4 ;
406406 unsafe {
@@ -424,7 +424,7 @@ impl EndpointHeader {
424424 }
425425 }
426426
427- pub fn interrupt ( & self , access : & impl ConfigRegionAccess ) -> ( InterruptPin , InterruptLine ) {
427+ pub fn interrupt ( & self , access : impl ConfigRegionAccess ) -> ( InterruptPin , InterruptLine ) {
428428 // According to the PCI Express Specification 4.0, Min_Gnt/Max_Lat registers
429429 // must be read-only and hardwired to 00h.
430430 let data = unsafe { access. read ( self . 0 , 0x3c ) } ;
@@ -494,7 +494,7 @@ impl EndpointHeader {
494494pub struct PciPciBridgeHeader ( PciAddress ) ;
495495
496496impl PciPciBridgeHeader {
497- pub fn from_header ( header : PciHeader , access : & impl ConfigRegionAccess ) -> Option < PciPciBridgeHeader > {
497+ pub fn from_header ( header : PciHeader , access : impl ConfigRegionAccess ) -> Option < PciPciBridgeHeader > {
498498 match header. header_type ( access) {
499499 HeaderType :: PciPciBridge => Some ( PciPciBridgeHeader ( header. 0 ) ) ,
500500 _ => None ,
@@ -505,32 +505,32 @@ impl PciPciBridgeHeader {
505505 PciHeader ( self . 0 )
506506 }
507507
508- pub fn status ( & self , access : & impl ConfigRegionAccess ) -> StatusRegister {
508+ pub fn status ( & self , access : impl ConfigRegionAccess ) -> StatusRegister {
509509 self . header ( ) . status ( access)
510510 }
511511
512- pub fn command ( & self , access : & impl ConfigRegionAccess ) -> CommandRegister {
512+ pub fn command ( & self , access : impl ConfigRegionAccess ) -> CommandRegister {
513513 self . header ( ) . command ( access)
514514 }
515515
516- pub fn update_command < F > ( & self , access : & impl ConfigRegionAccess , f : F )
516+ pub fn update_command < F > ( & self , access : impl ConfigRegionAccess , f : F )
517517 where
518518 F : FnOnce ( CommandRegister ) -> CommandRegister ,
519519 {
520520 self . header ( ) . update_command ( access, f) ;
521521 }
522522
523- pub fn primary_bus_number ( & self , access : & impl ConfigRegionAccess ) -> u8 {
523+ pub fn primary_bus_number ( & self , access : impl ConfigRegionAccess ) -> u8 {
524524 let data = unsafe { access. read ( self . 0 , 0x18 ) . get_bits ( 0 ..8 ) } ;
525525 data as u8
526526 }
527527
528- pub fn secondary_bus_number ( & self , access : & impl ConfigRegionAccess ) -> u8 {
528+ pub fn secondary_bus_number ( & self , access : impl ConfigRegionAccess ) -> u8 {
529529 let data = unsafe { access. read ( self . 0 , 0x18 ) . get_bits ( 8 ..16 ) } ;
530530 data as u8
531531 }
532532
533- pub fn subordinate_bus_number ( & self , access : & impl ConfigRegionAccess ) -> u8 {
533+ pub fn subordinate_bus_number ( & self , access : impl ConfigRegionAccess ) -> u8 {
534534 let data = unsafe { access. read ( self . 0 , 0x18 ) . get_bits ( 16 ..24 ) } ;
535535 data as u8
536536 }
0 commit comments