Skip to content

Commit b5bd0f8

Browse files
committed
updated types to match uefi-raw & fixed lints
1 parent e2fb2ca commit b5bd0f8

File tree

3 files changed

+16
-24
lines changed

3 files changed

+16
-24
lines changed

uefi/src/proto/dma/iommu.rs

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,15 @@
33
//! EDK2 IoMmu protocol.
44
55
use 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

uefi/src/proto/dma/mod.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,8 @@
22

33
//! EDK2 IoMmu protocol.
44
5-
use core::{
6-
ffi::c_void,
7-
ops::{Deref, DerefMut},
8-
};
5+
use core::ffi::c_void;
6+
use core::ops::{Deref, DerefMut};
97

108
use uefi_raw::table::boot::PAGE_SIZE;
119

@@ -94,7 +92,7 @@ impl<'a> Mapping<'a> {
9492
}
9593

9694
/// Get the raw mapping pointer
97-
#[must_use]
95+
#[must_use]
9896
pub const fn as_ptr(&self) -> *mut c_void {
9997
self.ptr
10098
}

uefi/src/proto/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@ pub mod ata;
3737
pub mod console;
3838
pub mod debug;
3939
pub mod device_path;
40+
pub mod dma;
4041
pub mod driver;
4142
pub mod hii;
42-
pub mod dma;
4343
pub mod loaded_image;
4444
pub mod media;
4545
pub mod misc;

0 commit comments

Comments
 (0)