We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 78e4342 commit 44a3bdeCopy full SHA for 44a3bde
uefi-raw/CHANGELOG.md
@@ -1,5 +1,8 @@
1
# uefi-raw - [Unreleased]
2
3
+## Added
4
+- Added `AllocateType`.
5
+
6
7
# uefi-raw - 0.11.0 (2025-05-04)
8
uefi-raw/src/table/boot.rs
@@ -9,6 +9,15 @@ use bitflags::bitflags;
9
use core::ffi::c_void;
10
use core::ops::RangeInclusive;
11
12
+newtype_enum! {
13
+ pub enum AllocateType: u32 => {
14
+ ANY_PAGES = 0,
15
+ MAX_ADDRESS = 1,
16
+ ADDRESS = 2,
17
+ MAX_ALLOCATE_TYPE = 3,
18
+ }
19
+}
20
21
/// Table of pointers to all the boot services.
22
#[derive(Debug)]
23
#[repr(C)]
@@ -21,7 +30,7 @@ pub struct BootServices {
30
31
// Memory allocation functions
32
pub allocate_pages: unsafe extern "efiapi" fn(
24
- alloc_ty: u32,
33
+ alloc_ty: AllocateType,
25
34
mem_ty: MemoryType,
26
35
count: usize,
27
36
addr: *mut PhysicalAddress,
uefi/src/boot.rs
@@ -45,7 +45,7 @@ use core::ptr::{self, NonNull};
45
use core::sync::atomic::{AtomicPtr, Ordering};
46
use core::time::Duration;
47
use core::{mem, slice};
48
-use uefi_raw::table::boot::{InterfaceType, TimerDelay};
+use uefi_raw::table::boot::{AllocateType as RawAllocateType, InterfaceType, TimerDelay};
49
#[cfg(feature = "alloc")]
50
use {alloc::vec::Vec, uefi::ResultExt};
51
@@ -154,9 +154,9 @@ pub fn allocate_pages(
154
let bt = unsafe { bt.as_ref() };
155
156
let (ty, initial_addr) = match allocation_type {
157
- AllocateType::AnyPages => (0, 0),
158
- AllocateType::MaxAddress(addr) => (1, addr),
159
- AllocateType::Address(addr) => (2, addr),
+ AllocateType::AnyPages => (RawAllocateType::ANY_PAGES, 0),
+ AllocateType::MaxAddress(addr) => (RawAllocateType::MAX_ADDRESS, addr),
+ AllocateType::Address(addr) => (RawAllocateType::ADDRESS, addr),
160
};
161
162
let mut addr1 = initial_addr;
0 commit comments