Trait acpi::handler::AcpiHandler
source · pub trait AcpiHandler: Clone {
// Required methods
unsafe fn map_physical_region<T>(
&self,
physical_address: usize,
size: usize
) -> PhysicalMapping<Self, T>;
fn unmap_physical_region<T>(region: &PhysicalMapping<Self, T>);
}
Expand description
An implementation of this trait must be provided to allow acpi
to access platform-specific
functionality, such as mapping regions of physical memory. You are free to implement these
however you please, as long as they conform to the documentation of each function. The handler is stored in
every PhysicalMapping
so it’s able to unmap itself when dropped, so this type needs to be something you can
clone/move about freely (e.g. a reference, wrapper over Rc
, marker struct, etc.).
Required Methods§
sourceunsafe fn map_physical_region<T>(
&self,
physical_address: usize,
size: usize
) -> PhysicalMapping<Self, T>
unsafe fn map_physical_region<T>( &self, physical_address: usize, size: usize ) -> PhysicalMapping<Self, T>
Given a physical address and a size, map a region of physical memory that contains T
(note: the passed
size may be larger than size_of::<T>()
). The address is not neccessarily page-aligned, so the
implementation may need to map more than size
bytes. The virtual address the region is mapped to does not
matter, as long as it is accessible to acpi
.
See the documentation on PhysicalMapping::new
for an explanation of each field on the PhysicalMapping
return type.
Safety
physical_address
must point to a validT
in physical memory.size
must be at leastsize_of::<T>()
.
sourcefn unmap_physical_region<T>(region: &PhysicalMapping<Self, T>)
fn unmap_physical_region<T>(region: &PhysicalMapping<Self, T>)
Unmap the given physical mapping. This is called when a PhysicalMapping
is dropped, you should not manually call this.
Note: A reference to the handler used to construct region
can be acquired by calling PhysicalMapping::handler
.