diff --git a/uefi/src/table/boot.rs b/uefi/src/table/boot.rs index 7e4f146a4..d0b02f11a 100644 --- a/uefi/src/table/boot.rs +++ b/uefi/src/table/boot.rs @@ -1,6 +1,6 @@ //! UEFI services available during boot. -use super::{Header, Revision}; +use super::Revision; use crate::data_types::{Align, PhysicalAddress}; use crate::proto::device_path::DevicePath; use crate::proto::{Protocol, ProtocolPointer}; @@ -43,204 +43,6 @@ static IMAGE_HANDLE: GlobalImageHandle = GlobalImageHandle { /// size is always 4 KiB. pub const PAGE_SIZE: usize = 4096; -#[repr(C)] -struct BootServicesInternal { - header: Header, - - // Task Priority services - raise_tpl: unsafe extern "efiapi" fn(new_tpl: Tpl) -> Tpl, - restore_tpl: unsafe extern "efiapi" fn(old_tpl: Tpl), - - // Memory allocation functions - allocate_pages: unsafe extern "efiapi" fn( - alloc_ty: u32, - mem_ty: MemoryType, - count: usize, - addr: &mut PhysicalAddress, - ) -> Status, - free_pages: unsafe extern "efiapi" fn(addr: PhysicalAddress, pages: usize) -> Status, - get_memory_map: unsafe extern "efiapi" fn( - size: &mut usize, - map: *mut MemoryDescriptor, - key: &mut usize, - desc_size: &mut usize, - desc_version: &mut u32, - ) -> Status, - allocate_pool: unsafe extern "efiapi" fn( - pool_type: MemoryType, - size: usize, - buffer: &mut *mut u8, - ) -> Status, - free_pool: unsafe extern "efiapi" fn(buffer: *mut u8) -> Status, - - // Event & timer functions - create_event: unsafe extern "efiapi" fn( - ty: EventType, - notify_tpl: Tpl, - notify_func: Option, - notify_ctx: *mut c_void, - out_event: *mut uefi_raw::Event, - ) -> Status, - set_timer: - unsafe extern "efiapi" fn(event: uefi_raw::Event, ty: u32, trigger_time: u64) -> Status, - wait_for_event: unsafe extern "efiapi" fn( - number_of_events: usize, - events: *mut uefi_raw::Event, - out_index: *mut usize, - ) -> Status, - signal_event: unsafe extern "efiapi" fn(event: uefi_raw::Event) -> Status, - close_event: unsafe extern "efiapi" fn(event: uefi_raw::Event) -> Status, - check_event: unsafe extern "efiapi" fn(event: uefi_raw::Event) -> Status, - - // Protocol handlers - install_protocol_interface: unsafe extern "efiapi" fn( - handle: *mut uefi_raw::Handle, - guid: &Guid, - interface_type: InterfaceType, - interface: *mut c_void, - ) -> Status, - reinstall_protocol_interface: unsafe extern "efiapi" fn( - handle: uefi_raw::Handle, - protocol: &Guid, - old_interface: *mut c_void, - new_interface: *mut c_void, - ) -> Status, - uninstall_protocol_interface: unsafe extern "efiapi" fn( - handle: uefi_raw::Handle, - protocol: &Guid, - interface: *mut c_void, - ) -> Status, - #[deprecated = "open_protocol and open_protocol_exclusive are better alternatives and available since EFI 1.10 (2002)"] - handle_protocol: unsafe extern "efiapi" fn( - handle: uefi_raw::Handle, - proto: &Guid, - out_proto: &mut *mut c_void, - ) -> Status, - _reserved: usize, - register_protocol_notify: unsafe extern "efiapi" fn( - protocol: &Guid, - event: uefi_raw::Event, - registration: *mut *const c_void, - ) -> Status, - locate_handle: unsafe extern "efiapi" fn( - search_ty: i32, - proto: *const Guid, - key: *const c_void, - buf_sz: *mut usize, - buf: *mut uefi_raw::Handle, - ) -> Status, - locate_device_path: unsafe extern "efiapi" fn( - proto: &Guid, - device_path: *mut *const uefi_raw::protocol::device_path::DevicePathProtocol, - out_handle: *mut uefi_raw::Handle, - ) -> Status, - install_configuration_table: - unsafe extern "efiapi" fn(guid_entry: &Guid, table_ptr: *const c_void) -> Status, - - // Image services - load_image: unsafe extern "efiapi" fn( - boot_policy: u8, - parent_image_handle: uefi_raw::Handle, - device_path: *const uefi_raw::protocol::device_path::DevicePathProtocol, - source_buffer: *const u8, - source_size: usize, - image_handle: *mut uefi_raw::Handle, - ) -> Status, - start_image: unsafe extern "efiapi" fn( - image_handle: uefi_raw::Handle, - exit_data_size: *mut usize, - exit_data: &mut *mut u16, - ) -> Status, - exit: unsafe extern "efiapi" fn( - image_handle: uefi_raw::Handle, - exit_status: Status, - exit_data_size: usize, - exit_data: *mut u16, - ) -> !, - unload_image: unsafe extern "efiapi" fn(image_handle: uefi_raw::Handle) -> Status, - exit_boot_services: - unsafe extern "efiapi" fn(image_handle: uefi_raw::Handle, map_key: usize) -> Status, - - // Misc services - get_next_monotonic_count: usize, - stall: unsafe extern "efiapi" fn(microseconds: usize) -> Status, - set_watchdog_timer: unsafe extern "efiapi" fn( - timeout: usize, - watchdog_code: u64, - data_size: usize, - watchdog_data: *const u16, - ) -> Status, - - // Driver support services - connect_controller: unsafe extern "efiapi" fn( - controller: uefi_raw::Handle, - driver_image: uefi_raw::Handle, - remaining_device_path: *const uefi_raw::protocol::device_path::DevicePathProtocol, - recursive: bool, - ) -> Status, - disconnect_controller: unsafe extern "efiapi" fn( - controller: uefi_raw::Handle, - driver_image: uefi_raw::Handle, - child: uefi_raw::Handle, - ) -> Status, - - // Protocol open / close services - open_protocol: unsafe extern "efiapi" fn( - handle: uefi_raw::Handle, - protocol: &Guid, - interface: &mut *mut c_void, - agent_handle: uefi_raw::Handle, - controller_handle: uefi_raw::Handle, - attributes: u32, - ) -> Status, - close_protocol: unsafe extern "efiapi" fn( - handle: uefi_raw::Handle, - protocol: &Guid, - agent_handle: uefi_raw::Handle, - controller_handle: uefi_raw::Handle, - ) -> Status, - open_protocol_information: usize, - - // Library services - protocols_per_handle: unsafe extern "efiapi" fn( - handle: uefi_raw::Handle, - protocol_buffer: *mut *mut *const Guid, - protocol_buffer_count: *mut usize, - ) -> Status, - locate_handle_buffer: unsafe extern "efiapi" fn( - search_ty: i32, - proto: *const Guid, - key: *const c_void, - no_handles: *mut usize, - buf: *mut *mut uefi_raw::Handle, - ) -> Status, - #[deprecated = "open_protocol and open_protocol_exclusive are better alternatives and available since EFI 1.10 (2002)"] - locate_protocol: unsafe extern "efiapi" fn( - proto: &Guid, - registration: *mut c_void, - out_proto: &mut *mut c_void, - ) -> Status, - install_multiple_protocol_interfaces: usize, - uninstall_multiple_protocol_interfaces: usize, - - // CRC services - calculate_crc32: usize, - - // Misc services - copy_mem: unsafe extern "efiapi" fn(dest: *mut u8, src: *const u8, len: usize), - set_mem: unsafe extern "efiapi" fn(buffer: *mut u8, len: usize, value: u8), - - // New event functions (UEFI 2.0 or newer) - create_event_ex: unsafe extern "efiapi" fn( - ty: EventType, - notify_tpl: Tpl, - notify_fn: Option, - notify_ctx: *mut c_void, - event_group: *mut Guid, - out_event: *mut uefi_raw::Event, - ) -> Status, -} - /// Get the raw pointer from `opt`, defaulting to `null_mut`. fn opt_nonnull_to_ptr(opt: Option>) -> *mut T { opt.map(NonNull::as_ptr).unwrap_or(ptr::null_mut()) @@ -293,7 +95,7 @@ fn opt_nonnull_to_ptr(opt: Option>) -> *mut T { /// [`Output`]: crate::proto::console::text::Output /// [`open_protocol`]: BootServices::open_protocol #[repr(transparent)] -pub struct BootServices(BootServicesInternal); +pub struct BootServices(uefi_raw::table::boot::BootServices); impl BootServices { /// Get the [`Handle`] of the currently-executing image.