MCPcopy Index your code
hub / github.com/cloud-hypervisor/cloud-hypervisor / config_space_read

Method config_space_read

pci/src/bus.rs:277–305  ·  view source on GitHub ↗
(&self)

Source from the content-addressed store, hash-verified

275 }
276
277 pub fn config_space_read(&self) -> u32 {
278 let enabled = (self.config_address & 0x8000_0000) != 0;
279 if !enabled {
280 return 0xffff_ffff;
281 }
282
283 let (bus, device, function, register) =
284 parse_io_config_address(self.config_address & !0x8000_0000);
285
286 // Only support one bus.
287 if bus != 0 {
288 return 0xffff_ffff;
289 }
290
291 // Don't support multi-function devices.
292 if function > 0 {
293 return 0xffff_ffff;
294 }
295
296 self.pci_bus
297 .as_ref()
298 .lock()
299 .unwrap()
300 .devices
301 .get(&(device as u8))
302 .map_or(0xffff_ffff, |d| {
303 d.lock().unwrap().read_config_register(register)
304 })
305 }
306
307 pub fn config_space_write(&mut self, offset: u64, data: &[u8]) -> Option<Arc<Barrier>> {
308 if offset as usize + data.len() > 4 {

Callers 1

readMethod · 0.80

Calls 4

parse_io_config_addressFunction · 0.85
getMethod · 0.45
read_config_registerMethod · 0.45

Tested by

no test coverage detected