Skip to content

Commit c91a478

Browse files
authored
Merge pull request #833 from nicholasbishop/bishop-raw-event-type
Move EventType to uefi-raw
2 parents 42ce7f3 + 851568e commit c91a478

File tree

2 files changed

+35
-37
lines changed

2 files changed

+35
-37
lines changed

uefi-raw/src/table/boot.rs

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,40 @@
33
use crate::{PhysicalAddress, VirtualAddress};
44
use bitflags::bitflags;
55

6+
bitflags! {
7+
/// Flags describing the type of an UEFI event and its attributes.
8+
#[repr(transparent)]
9+
pub struct EventType: u32 {
10+
/// The event is a timer event and may be passed to `BootServices::set_timer()`
11+
/// Note that timers only function during boot services time.
12+
const TIMER = 0x8000_0000;
13+
14+
/// The event is allocated from runtime memory.
15+
/// This must be done if the event is to be signaled after ExitBootServices.
16+
const RUNTIME = 0x4000_0000;
17+
18+
/// Calling wait_for_event or check_event will enqueue the notification
19+
/// function if the event is not already in the signaled state.
20+
/// Mutually exclusive with `NOTIFY_SIGNAL`.
21+
const NOTIFY_WAIT = 0x0000_0100;
22+
23+
/// The notification function will be enqueued when the event is signaled
24+
/// Mutually exclusive with `NOTIFY_WAIT`.
25+
const NOTIFY_SIGNAL = 0x0000_0200;
26+
27+
/// The event will be signaled at ExitBootServices time.
28+
/// This event type should not be combined with any other.
29+
/// Its notification function must follow some special rules:
30+
/// - Cannot use memory allocation services, directly or indirectly
31+
/// - Cannot depend on timer events, since those will be deactivated
32+
const SIGNAL_EXIT_BOOT_SERVICES = 0x0000_0201;
33+
34+
/// The event will be notified when SetVirtualAddressMap is performed.
35+
/// This event type should not be combined with any other.
36+
const SIGNAL_VIRTUAL_ADDRESS_CHANGE = 0x6000_0202;
37+
}
38+
}
39+
640
newtype_enum! {
741
/// Interface type of a protocol interface.
842
pub enum InterfaceType: u32 => {

uefi/src/table/boot.rs

Lines changed: 1 addition & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ use crate::data_types::{Align, PhysicalAddress};
55
use crate::proto::device_path::{DevicePath, FfiDevicePath};
66
use crate::proto::{Protocol, ProtocolPointer};
77
use crate::{Char16, Event, Guid, Handle, Result, Status, StatusExt};
8-
use bitflags::bitflags;
98
use core::cell::UnsafeCell;
109
use core::ffi::c_void;
1110
use core::fmt::{Debug, Formatter};
@@ -21,7 +20,7 @@ use {
2120
};
2221

2322
pub use uefi_raw::table::boot::{
24-
InterfaceType, MemoryAttribute, MemoryDescriptor, MemoryType, Tpl,
23+
EventType, InterfaceType, MemoryAttribute, MemoryDescriptor, MemoryType, Tpl,
2524
};
2625

2726
// TODO: this similar to `SyncUnsafeCell`. Once that is stabilized we
@@ -2039,41 +2038,6 @@ impl<'guid> SearchType<'guid> {
20392038
}
20402039
}
20412040

2042-
bitflags! {
2043-
/// Flags describing the type of an UEFI event and its attributes.
2044-
#[repr(transparent)]
2045-
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, PartialOrd, Ord)]
2046-
pub struct EventType: u32 {
2047-
/// The event is a timer event and may be passed to `BootServices::set_timer()`
2048-
/// Note that timers only function during boot services time.
2049-
const TIMER = 0x8000_0000;
2050-
2051-
/// The event is allocated from runtime memory.
2052-
/// This must be done if the event is to be signaled after ExitBootServices.
2053-
const RUNTIME = 0x4000_0000;
2054-
2055-
/// Calling wait_for_event or check_event will enqueue the notification
2056-
/// function if the event is not already in the signaled state.
2057-
/// Mutually exclusive with `NOTIFY_SIGNAL`.
2058-
const NOTIFY_WAIT = 0x0000_0100;
2059-
2060-
/// The notification function will be enqueued when the event is signaled
2061-
/// Mutually exclusive with `NOTIFY_WAIT`.
2062-
const NOTIFY_SIGNAL = 0x0000_0200;
2063-
2064-
/// The event will be signaled at ExitBootServices time.
2065-
/// This event type should not be combined with any other.
2066-
/// Its notification function must follow some special rules:
2067-
/// - Cannot use memory allocation services, directly or indirectly
2068-
/// - Cannot depend on timer events, since those will be deactivated
2069-
const SIGNAL_EXIT_BOOT_SERVICES = 0x0000_0201;
2070-
2071-
/// The event will be notified when SetVirtualAddressMap is performed.
2072-
/// This event type should not be combined with any other.
2073-
const SIGNAL_VIRTUAL_ADDRESS_CHANGE = 0x6000_0202;
2074-
}
2075-
}
2076-
20772041
/// Raw event notification function
20782042
type EventNotifyFn = unsafe extern "efiapi" fn(event: Event, context: Option<NonNull<c_void>>);
20792043

0 commit comments

Comments
 (0)