@@ -5,6 +5,7 @@ use crate::table::Header;
5
5
use crate :: { Char16 , Event , Guid , Handle , PhysicalAddress , Status , VirtualAddress } ;
6
6
use bitflags:: bitflags;
7
7
use core:: ffi:: c_void;
8
+ use core:: ops:: RangeInclusive ;
8
9
9
10
/// Table of pointers to all the boot services.
10
11
#[ derive( Debug ) ]
@@ -381,11 +382,11 @@ newtype_enum! {
381
382
/// The type of a memory range.
382
383
///
383
384
/// UEFI allows firmwares and operating systems to introduce new memory types
384
- /// in the 0x70000000..0xFFFFFFFF range. Therefore, we don't know the full set
385
+ /// in the `0x7000_0000..=0xFFFF_FFFF` range. Therefore, we don't know the full set
385
386
/// of memory types at compile time, and it is _not_ safe to model this C enum
386
387
/// as a Rust enum.
387
388
pub enum MemoryType : u32 => {
388
- /// This enum variant is not used .
389
+ /// Not usable .
389
390
RESERVED = 0 ,
390
391
/// The code portions of a loaded UEFI application.
391
392
LOADER_CODE = 1 ,
@@ -421,10 +422,21 @@ pub enum MemoryType: u32 => {
421
422
PAL_CODE = 13 ,
422
423
/// Memory region which is usable and is also non-volatile.
423
424
PERSISTENT_MEMORY = 14 ,
425
+ /// Memory that must be accepted by the boot target before it can be used.
426
+ UNACCEPTED = 15 ,
427
+ /// End of the defined memory types. Higher values are possible though, see
428
+ /// [`MemoryType::RESERVED_FOR_OEM`] and [`MemoryType::RESERVED_FOR_OS_LOADER`].
429
+ MAX = 16 ,
424
430
} }
425
431
426
432
impl MemoryType {
427
- /// Construct a custom `MemoryType`. Values in the range `0x80000000..=0xffffffff` are free for use if you are
433
+ /// Range reserved for OEM use.
434
+ pub const RESERVED_FOR_OEM : RangeInclusive < u32 > = 0x7000_0000 ..=0x7fff_ffff ;
435
+
436
+ /// Range reserved for OS loaders.
437
+ pub const RESERVED_FOR_OS_LOADER : RangeInclusive < u32 > = 0x8000_0000 ..=0xffff_ffff ;
438
+
439
+ /// Construct a custom `MemoryType`. Values in the range `0x8000_0000..=0xffff_ffff` are free for use if you are
428
440
/// an OS loader.
429
441
#[ must_use]
430
442
pub const fn custom ( value : u32 ) -> MemoryType {
0 commit comments