33//! EDK2 IoMmu protocol.
44
55use core:: ffi:: c_void;
6- use uefi:: {
7- Handle , Result , StatusExt , data_types:: PhysicalAddress , mem:: memory_map:: MemoryType ,
8- proto:: unsafe_protocol,
9- } ;
10-
11- pub use crate :: {
12- proto:: dma:: { DmaBuffer , Mapping } ,
13- uefi_raw:: protocol:: iommu:: {
14- EdkiiIommuAccess , EdkiiIommuAttribute , EdkiiIommuOperation , EdkiiIommuProtocol ,
15- } ,
6+ use uefi:: data_types:: PhysicalAddress ;
7+ use uefi:: mem:: memory_map:: MemoryType ;
8+ use uefi:: proto:: unsafe_protocol;
9+ use uefi:: { Handle , Result , StatusExt } ;
10+ use uefi_raw:: table:: boot:: AllocateType ;
11+
12+ pub use crate :: proto:: dma:: { DmaBuffer , Mapping } ;
13+ pub use crate :: uefi_raw:: protocol:: iommu:: {
14+ EdkiiIommuAccess , EdkiiIommuAttribute , EdkiiIommuOperation , EdkiiIommuProtocol ,
1615} ;
1716
1817/// EDK2 IoMmu [`Protocol`].
@@ -39,12 +38,7 @@ impl Iommu {
3938 ) -> Result {
4039 let mapping_raw = mapping. as_ptr ( ) ;
4140 let status = unsafe {
42- ( self . 0 . set_attribute ) (
43- & self . 0 ,
44- device_handle. as_ptr ( ) ,
45- mapping_raw,
46- iommu_access. bits ( ) ,
47- )
41+ ( self . 0 . set_attribute ) ( & self . 0 , device_handle. as_ptr ( ) , mapping_raw, iommu_access)
4842 } ;
4943
5044 status. to_result ( )
@@ -97,7 +91,7 @@ impl Iommu {
9791 let mut host_address: * mut c_void = core:: ptr:: null_mut ( ) ;
9892
9993 // Must be ignored
100- let allocate_type = 0u32 ;
94+ let allocate_type = AllocateType :: ANY_PAGES ;
10195
10296 let status = unsafe {
10397 ( self . 0 . allocate_buffer ) (
@@ -106,7 +100,7 @@ impl Iommu {
106100 memory_type,
107101 pages,
108102 & mut host_address,
109- attributes. bits ( ) ,
103+ attributes,
110104 )
111105 } ;
112106
0 commit comments