(&mut self, _base: u64, offset: u64, data: &[u8])
| 581 | } |
| 582 | |
| 583 | fn write(&mut self, _base: u64, offset: u64, data: &[u8]) -> Option<Arc<Barrier>> { |
| 584 | match offset { |
| 585 | SELECTION_OFFSET => { |
| 586 | self.selected_slot = usize::from(data[0]); |
| 587 | } |
| 588 | STATUS_OFFSET => { |
| 589 | if self.selected_slot < self.hotplug_slots.len() { |
| 590 | let state = &mut self.hotplug_slots[self.selected_slot]; |
| 591 | // The ACPI code writes back a 1 to acknowledge the insertion |
| 592 | if (data[0] & (1 << INSERTING_FLAG) == 1 << INSERTING_FLAG) && state.inserting { |
| 593 | state.inserting = false; |
| 594 | } |
| 595 | // Ditto for removal |
| 596 | if (data[0] & (1 << REMOVING_FLAG) == 1 << REMOVING_FLAG) && state.removing { |
| 597 | state.removing = false; |
| 598 | } |
| 599 | // Trigger removal of "DIMM" |
| 600 | if data[0] & (1 << EJECT_FLAG) == 1 << EJECT_FLAG { |
| 601 | warn!("Ejection of memory not currently supported"); |
| 602 | } |
| 603 | } else { |
| 604 | warn!("Out of range memory slot: {}", self.selected_slot); |
| 605 | } |
| 606 | } |
| 607 | _ => { |
| 608 | warn!("Unexpected offset for accessing memory manager device: {offset:#}"); |
| 609 | } |
| 610 | } |
| 611 | None |
| 612 | } |
| 613 | } |
| 614 | |
| 615 | impl MemoryManager { |
no test coverage detected