| 324 | } |
| 325 | |
| 326 | fn read_bar(&mut self, base: u64, offset: u64, data: &mut [u8]) { |
| 327 | debug!("read base {base:x} offset {offset}"); |
| 328 | |
| 329 | let mut bar_idx = 0; |
| 330 | for (idx, bar) in self.bar_regions.iter().enumerate() { |
| 331 | if bar.addr() == base { |
| 332 | bar_idx = idx; |
| 333 | } |
| 334 | } |
| 335 | match bar_idx { |
| 336 | // bar 0 |
| 337 | 0 => { |
| 338 | // ivshmem don't use interrupt, we return zero now. |
| 339 | LittleEndian::write_u32(data, 0); |
| 340 | } |
| 341 | // bar 2 |
| 342 | 1 => warn!("Unexpected read ivshmem memory idx: {offset}"), |
| 343 | _ => { |
| 344 | warn!("Invalid bar_idx: {bar_idx}"); |
| 345 | } |
| 346 | } |
| 347 | } |
| 348 | |
| 349 | fn write_bar(&mut self, base: u64, offset: u64, _data: &[u8]) -> Option<Arc<Barrier>> { |
| 350 | debug!("write base {base:x} offset {offset}"); |