Skip to content

Commit 926dce7

Browse files
uefi: BootServices: Finish conversion to wrapping uefi_raw BootServices
1 parent d6867f4 commit 926dce7

File tree

1 file changed

+2
-200
lines changed

1 file changed

+2
-200
lines changed

uefi/src/table/boot.rs

Lines changed: 2 additions & 200 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//! UEFI services available during boot.
22
3-
use super::{Header, Revision};
3+
use super::Revision;
44
use crate::data_types::{Align, PhysicalAddress};
55
use crate::proto::device_path::DevicePath;
66
use crate::proto::{Protocol, ProtocolPointer};
@@ -43,204 +43,6 @@ static IMAGE_HANDLE: GlobalImageHandle = GlobalImageHandle {
4343
/// size is always 4 KiB.
4444
pub const PAGE_SIZE: usize = 4096;
4545

46-
#[repr(C)]
47-
struct BootServicesInternal {
48-
header: Header,
49-
50-
// Task Priority services
51-
raise_tpl: unsafe extern "efiapi" fn(new_tpl: Tpl) -> Tpl,
52-
restore_tpl: unsafe extern "efiapi" fn(old_tpl: Tpl),
53-
54-
// Memory allocation functions
55-
allocate_pages: unsafe extern "efiapi" fn(
56-
alloc_ty: u32,
57-
mem_ty: MemoryType,
58-
count: usize,
59-
addr: &mut PhysicalAddress,
60-
) -> Status,
61-
free_pages: unsafe extern "efiapi" fn(addr: PhysicalAddress, pages: usize) -> Status,
62-
get_memory_map: unsafe extern "efiapi" fn(
63-
size: &mut usize,
64-
map: *mut MemoryDescriptor,
65-
key: &mut usize,
66-
desc_size: &mut usize,
67-
desc_version: &mut u32,
68-
) -> Status,
69-
allocate_pool: unsafe extern "efiapi" fn(
70-
pool_type: MemoryType,
71-
size: usize,
72-
buffer: &mut *mut u8,
73-
) -> Status,
74-
free_pool: unsafe extern "efiapi" fn(buffer: *mut u8) -> Status,
75-
76-
// Event & timer functions
77-
create_event: unsafe extern "efiapi" fn(
78-
ty: EventType,
79-
notify_tpl: Tpl,
80-
notify_func: Option<uefi_raw::table::boot::EventNotifyFn>,
81-
notify_ctx: *mut c_void,
82-
out_event: *mut uefi_raw::Event,
83-
) -> Status,
84-
set_timer:
85-
unsafe extern "efiapi" fn(event: uefi_raw::Event, ty: u32, trigger_time: u64) -> Status,
86-
wait_for_event: unsafe extern "efiapi" fn(
87-
number_of_events: usize,
88-
events: *mut uefi_raw::Event,
89-
out_index: *mut usize,
90-
) -> Status,
91-
signal_event: unsafe extern "efiapi" fn(event: uefi_raw::Event) -> Status,
92-
close_event: unsafe extern "efiapi" fn(event: uefi_raw::Event) -> Status,
93-
check_event: unsafe extern "efiapi" fn(event: uefi_raw::Event) -> Status,
94-
95-
// Protocol handlers
96-
install_protocol_interface: unsafe extern "efiapi" fn(
97-
handle: *mut uefi_raw::Handle,
98-
guid: &Guid,
99-
interface_type: InterfaceType,
100-
interface: *mut c_void,
101-
) -> Status,
102-
reinstall_protocol_interface: unsafe extern "efiapi" fn(
103-
handle: uefi_raw::Handle,
104-
protocol: &Guid,
105-
old_interface: *mut c_void,
106-
new_interface: *mut c_void,
107-
) -> Status,
108-
uninstall_protocol_interface: unsafe extern "efiapi" fn(
109-
handle: uefi_raw::Handle,
110-
protocol: &Guid,
111-
interface: *mut c_void,
112-
) -> Status,
113-
#[deprecated = "open_protocol and open_protocol_exclusive are better alternatives and available since EFI 1.10 (2002)"]
114-
handle_protocol: unsafe extern "efiapi" fn(
115-
handle: uefi_raw::Handle,
116-
proto: &Guid,
117-
out_proto: &mut *mut c_void,
118-
) -> Status,
119-
_reserved: usize,
120-
register_protocol_notify: unsafe extern "efiapi" fn(
121-
protocol: &Guid,
122-
event: uefi_raw::Event,
123-
registration: *mut *const c_void,
124-
) -> Status,
125-
locate_handle: unsafe extern "efiapi" fn(
126-
search_ty: i32,
127-
proto: *const Guid,
128-
key: *const c_void,
129-
buf_sz: *mut usize,
130-
buf: *mut uefi_raw::Handle,
131-
) -> Status,
132-
locate_device_path: unsafe extern "efiapi" fn(
133-
proto: &Guid,
134-
device_path: *mut *const uefi_raw::protocol::device_path::DevicePathProtocol,
135-
out_handle: *mut uefi_raw::Handle,
136-
) -> Status,
137-
install_configuration_table:
138-
unsafe extern "efiapi" fn(guid_entry: &Guid, table_ptr: *const c_void) -> Status,
139-
140-
// Image services
141-
load_image: unsafe extern "efiapi" fn(
142-
boot_policy: u8,
143-
parent_image_handle: uefi_raw::Handle,
144-
device_path: *const uefi_raw::protocol::device_path::DevicePathProtocol,
145-
source_buffer: *const u8,
146-
source_size: usize,
147-
image_handle: *mut uefi_raw::Handle,
148-
) -> Status,
149-
start_image: unsafe extern "efiapi" fn(
150-
image_handle: uefi_raw::Handle,
151-
exit_data_size: *mut usize,
152-
exit_data: &mut *mut u16,
153-
) -> Status,
154-
exit: unsafe extern "efiapi" fn(
155-
image_handle: uefi_raw::Handle,
156-
exit_status: Status,
157-
exit_data_size: usize,
158-
exit_data: *mut u16,
159-
) -> !,
160-
unload_image: unsafe extern "efiapi" fn(image_handle: uefi_raw::Handle) -> Status,
161-
exit_boot_services:
162-
unsafe extern "efiapi" fn(image_handle: uefi_raw::Handle, map_key: usize) -> Status,
163-
164-
// Misc services
165-
get_next_monotonic_count: usize,
166-
stall: unsafe extern "efiapi" fn(microseconds: usize) -> Status,
167-
set_watchdog_timer: unsafe extern "efiapi" fn(
168-
timeout: usize,
169-
watchdog_code: u64,
170-
data_size: usize,
171-
watchdog_data: *const u16,
172-
) -> Status,
173-
174-
// Driver support services
175-
connect_controller: unsafe extern "efiapi" fn(
176-
controller: uefi_raw::Handle,
177-
driver_image: uefi_raw::Handle,
178-
remaining_device_path: *const uefi_raw::protocol::device_path::DevicePathProtocol,
179-
recursive: bool,
180-
) -> Status,
181-
disconnect_controller: unsafe extern "efiapi" fn(
182-
controller: uefi_raw::Handle,
183-
driver_image: uefi_raw::Handle,
184-
child: uefi_raw::Handle,
185-
) -> Status,
186-
187-
// Protocol open / close services
188-
open_protocol: unsafe extern "efiapi" fn(
189-
handle: uefi_raw::Handle,
190-
protocol: &Guid,
191-
interface: &mut *mut c_void,
192-
agent_handle: uefi_raw::Handle,
193-
controller_handle: uefi_raw::Handle,
194-
attributes: u32,
195-
) -> Status,
196-
close_protocol: unsafe extern "efiapi" fn(
197-
handle: uefi_raw::Handle,
198-
protocol: &Guid,
199-
agent_handle: uefi_raw::Handle,
200-
controller_handle: uefi_raw::Handle,
201-
) -> Status,
202-
open_protocol_information: usize,
203-
204-
// Library services
205-
protocols_per_handle: unsafe extern "efiapi" fn(
206-
handle: uefi_raw::Handle,
207-
protocol_buffer: *mut *mut *const Guid,
208-
protocol_buffer_count: *mut usize,
209-
) -> Status,
210-
locate_handle_buffer: unsafe extern "efiapi" fn(
211-
search_ty: i32,
212-
proto: *const Guid,
213-
key: *const c_void,
214-
no_handles: *mut usize,
215-
buf: *mut *mut uefi_raw::Handle,
216-
) -> Status,
217-
#[deprecated = "open_protocol and open_protocol_exclusive are better alternatives and available since EFI 1.10 (2002)"]
218-
locate_protocol: unsafe extern "efiapi" fn(
219-
proto: &Guid,
220-
registration: *mut c_void,
221-
out_proto: &mut *mut c_void,
222-
) -> Status,
223-
install_multiple_protocol_interfaces: usize,
224-
uninstall_multiple_protocol_interfaces: usize,
225-
226-
// CRC services
227-
calculate_crc32: usize,
228-
229-
// Misc services
230-
copy_mem: unsafe extern "efiapi" fn(dest: *mut u8, src: *const u8, len: usize),
231-
set_mem: unsafe extern "efiapi" fn(buffer: *mut u8, len: usize, value: u8),
232-
233-
// New event functions (UEFI 2.0 or newer)
234-
create_event_ex: unsafe extern "efiapi" fn(
235-
ty: EventType,
236-
notify_tpl: Tpl,
237-
notify_fn: Option<uefi_raw::table::boot::EventNotifyFn>,
238-
notify_ctx: *mut c_void,
239-
event_group: *mut Guid,
240-
out_event: *mut uefi_raw::Event,
241-
) -> Status,
242-
}
243-
24446
/// Get the raw pointer from `opt`, defaulting to `null_mut`.
24547
fn opt_nonnull_to_ptr<T>(opt: Option<NonNull<T>>) -> *mut T {
24648
opt.map(NonNull::as_ptr).unwrap_or(ptr::null_mut())
@@ -293,7 +95,7 @@ fn opt_nonnull_to_ptr<T>(opt: Option<NonNull<T>>) -> *mut T {
29395
/// [`Output`]: crate::proto::console::text::Output
29496
/// [`open_protocol`]: BootServices::open_protocol
29597
#[repr(transparent)]
296-
pub struct BootServices(BootServicesInternal);
98+
pub struct BootServices(uefi_raw::table::boot::BootServices);
29799

298100
impl BootServices {
299101
/// Get the [`Handle`] of the currently-executing image.

0 commit comments

Comments
 (0)