-
-
Notifications
You must be signed in to change notification settings - Fork 84
Expand file tree
/
Copy pathnull_handler.rs
More file actions
93 lines (66 loc) · 2.39 KB
/
Copy pathnull_handler.rs
File metadata and controls
93 lines (66 loc) · 2.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
//! A [`Handler`] that does nothing useful.
//!
//! This is pretty much a duplicate of [`aml_test_utils::NullHandler`]. We don't use that version
//! because `aml_test_tools` is not a `no_std` crate, which we need for this executable.
use acpi::{Handler, PhysicalMapping};
use pci_types::PciAddress;
#[derive(Clone)]
pub struct NullHandler;
/// A [`Handler`] that does nothing. If required, it will generally return zero.
///
/// This is useful as a placeholder if you really don't care what values the core [`acpi`] parser
/// receives.
///
/// The handler is not ever called in this crate, but it must be present for compilation purposes.
impl Handler for NullHandler {
unsafe fn map_physical_region<T>(&self, _physical_address: usize, _size: usize) -> PhysicalMapping<Self, T> {
// This isn't implemented in `aml_tester` either
todo!()
}
fn unmap_physical_region<T>(_region: &PhysicalMapping<Self, T>) {}
fn read_u8(&self, _address: usize) -> u8 {
0
}
fn read_u16(&self, _address: usize) -> u16 {
0
}
fn read_u32(&self, _address: usize) -> u32 {
0
}
fn read_u64(&self, _address: usize) -> u64 {
0
}
fn write_u8(&self, _address: usize, _value: u8) {}
fn write_u16(&self, _address: usize, _value: u16) {}
fn write_u32(&self, _address: usize, _value: u32) {}
fn write_u64(&self, _address: usize, _value: u64) {}
fn read_io_u8(&self, _port: u16) -> u8 {
0
}
fn read_io_u16(&self, _port: u16) -> u16 {
0
}
fn read_io_u32(&self, _port: u16) -> u32 {
0
}
fn write_io_u8(&self, _port: u16, _value: u8) {}
fn write_io_u16(&self, _port: u16, _value: u16) {}
fn write_io_u32(&self, _port: u16, _value: u32) {}
fn read_pci_u8(&self, _address: PciAddress, _offset: u16) -> u8 {
0
}
fn read_pci_u16(&self, _address: PciAddress, _offset: u16) -> u16 {
0
}
fn read_pci_u32(&self, _address: PciAddress, _offset: u16) -> u32 {
0
}
fn write_pci_u8(&self, _address: PciAddress, _offset: u16, _value: u8) {}
fn write_pci_u16(&self, _address: PciAddress, _offset: u16, _value: u16) {}
fn write_pci_u32(&self, _address: PciAddress, _offset: u16, _value: u32) {}
fn nanos_since_boot(&self) -> u64 {
1000
}
fn stall(&self, _microseconds: u64) {}
fn sleep(&self, _milliseconds: u64) {}
}