@@ -5,6 +5,7 @@ use crate::table::Header;
55use crate :: { Char16 , Event , Guid , Handle , PhysicalAddress , Status , VirtualAddress } ;
66use bitflags:: bitflags;
77use core:: ffi:: c_void;
8+ use core:: ops:: RangeInclusive ;
89
910/// Table of pointers to all the boot services.
1011#[ derive( Debug ) ]
@@ -381,11 +382,11 @@ newtype_enum! {
381382/// The type of a memory range.
382383///
383384/// 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
385386/// of memory types at compile time, and it is _not_ safe to model this C enum
386387/// as a Rust enum.
387388pub enum MemoryType : u32 => {
388- /// This enum variant is not used .
389+ /// Not usable .
389390 RESERVED = 0 ,
390391 /// The code portions of a loaded UEFI application.
391392 LOADER_CODE = 1 ,
@@ -421,10 +422,21 @@ pub enum MemoryType: u32 => {
421422 PAL_CODE = 13 ,
422423 /// Memory region which is usable and is also non-volatile.
423424 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 ,
424430} }
425431
426432impl 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
428440 /// an OS loader.
429441 #[ must_use]
430442 pub const fn custom ( value : u32 ) -> MemoryType {
0 commit comments