uefi/
boot.rs

1use crate::memory::{MemoryDescriptor, MemoryType};
2use crate::prelude::*;
3use crate::TableHeader;
4
5#[repr(C)]
6pub enum InterfaceType {
7    Native,
8}
9
10#[repr(C)]
11pub enum LocateSearchType {
12    /// Retrieve all the handles in the handle database.
13    AllHandles,
14    /// Retrieve the next handle fron a RegisterProtocolNotify() event.
15    ByRegisterNotify,
16    /// Retrieve the set of handles from the handle database that support a specified protocol.
17    ByProtocol,
18}
19
20#[repr(C)]
21pub struct BootServices {
22    pub Hdr: TableHeader,
23    RaiseTpl: extern "efiapi" fn(NewTpl: Tpl) -> usize,
24    RestoreTpl: extern "efiapi" fn(OldTpl: Tpl),
25    pub AllocatePages: extern "efiapi" fn(
26        AllocType: usize,
27        MemoryType: MemoryType,
28        Pages: usize,
29        Memory: &mut usize,
30    ) -> Status,
31    pub FreePages: extern "efiapi" fn(Memory: usize, Pages: usize) -> Status,
32    pub GetMemoryMap: extern "efiapi" fn(
33        MemoryMapSize: &mut usize,
34        MemoryMap: *mut MemoryDescriptor,
35        MapKey: &mut usize,
36        DescriptorSize: &mut usize,
37        DescriptorVersion: &mut u32,
38    ) -> Status,
39    pub AllocatePool:
40        extern "efiapi" fn(PoolType: MemoryType, Size: usize, Buffer: &mut usize) -> Status,
41    pub FreePool: extern "efiapi" fn(Buffer: usize) -> Status,
42    pub CreateEvent: extern "efiapi" fn(
43        Kind: u32,
44        NotifyTpl: Tpl,
45        NotifyFunction: extern "efiapi" fn(Event: Event, Context: usize /* *mut c_void */),
46        NotifyContext: usize, /* *mut c_void */
47        Event: &mut Event,
48    ) -> Status,
49    SetTimer: extern "efiapi" fn(),
50    pub WaitForEvent:
51        extern "efiapi" fn(NumberOfEvents: usize, Event: *const Event, Index: &mut usize) -> Status,
52    SignalEvent: extern "efiapi" fn(),
53    CloseEvent: extern "efiapi" fn(),
54    CheckEvent: extern "efiapi" fn(),
55    pub InstallProtocolInterface: extern "efiapi" fn(
56        Handle: &mut Handle,
57        Protocol: &Guid,
58        InterfaceType: InterfaceType,
59        Interface: usize,
60    ) -> Status,
61    ReinstallProtocolInterface: extern "efiapi" fn(),
62    pub UninstallProtocolInterface:
63        extern "efiapi" fn(Handle: Handle, Protocol: &Guid, Interface: usize) -> Status,
64    pub HandleProtocol:
65        extern "efiapi" fn(Handle: Handle, Protocol: &Guid, Interface: &mut usize) -> Status,
66    _rsvd: usize,
67    RegisterProtocolNotify: extern "efiapi" fn(),
68    pub LocateHandle: extern "efiapi" fn(
69        SearchType: LocateSearchType,
70        Protocol: *const Guid,
71        SearchKey: *const usize,
72        BufferSize: &mut usize,
73        Buffer: *mut Handle,
74    ) -> Status,
75    LocateDevicePath: extern "efiapi" fn(),
76    InstallConfigurationTable: extern "efiapi" fn(),
77    pub LoadImage: extern "efiapi" fn(
78        BootPolicy: bool,
79        ParentImageHandle: Handle,
80        DevicePath: usize, /*TODO*/
81        SourceBuffer: *const u8,
82        SourceSize: usize,
83        ImageHandle: &mut Handle,
84    ) -> Status,
85    pub StartImage: extern "efiapi" fn(
86        ImageHandle: Handle,
87        ExitDataSize: &mut usize,
88        ExitData: &mut *mut u16,
89    ) -> Status,
90    pub Exit: extern "efiapi" fn(
91        ImageHandle: Handle,
92        ExitStatus: isize,
93        ExitDataSize: usize,
94        ExitData: *const u16,
95    ) -> Status,
96    UnloadImage: extern "efiapi" fn(),
97    pub ExitBootServices: extern "efiapi" fn(ImageHandle: Handle, MapKey: usize) -> Status,
98    GetNextMonotonicCount: extern "efiapi" fn(),
99    pub Stall: extern "efiapi" fn(Microseconds: usize) -> Status,
100    pub SetWatchdogTimer: extern "efiapi" fn(
101        Timeout: usize,
102        WatchdogCode: u64,
103        DataSize: usize,
104        WatchdogData: *const u16,
105    ) -> Status,
106    ConnectController: extern "efiapi" fn(),
107    DisconnectController: extern "efiapi" fn(),
108    OpenProtocol: extern "efiapi" fn(),
109    CloseProtocol: extern "efiapi" fn(),
110    OpenProtocolInformation: extern "efiapi" fn(),
111    pub ProtocolsPerHandle: extern "efiapi" fn(
112        Handle: Handle,
113        ProtocolBuffer: *mut Guid,
114        ProtocolBufferCount: usize,
115    ) -> Status,
116    pub LocateHandleBuffer: extern "efiapi" fn(
117        SearchType: LocateSearchType,
118        Protocol: *const Guid,
119        SearchKey: *const usize,
120        NoHandles: &mut usize,
121        Buffer: &mut *mut Handle,
122    ) -> Status,
123    pub LocateProtocol:
124        extern "efiapi" fn(Protocol: &Guid, Registration: usize, Interface: &mut usize) -> Status,
125    InstallMultipleProtocolInterfaces: extern "efiapi" fn(),
126    UninstallMultipleProtocolInterfaces: extern "efiapi" fn(),
127    CalculateCrc32: extern "efiapi" fn(),
128    CopyMem: extern "efiapi" fn(),
129    SetMem: extern "efiapi" fn(),
130    pub CreateEventEx: extern "efiapi" fn(
131        Kind: u32,
132        NotifyTpl: Tpl,
133        NotifyFunction: extern "efiapi" fn(Event: Event, Context: usize /* *mut c_void */),
134        NotifyContext: usize, /* *mut c_void */
135        EventGroup: *const Guid,
136        Event: &mut Event,
137    ) -> Status,
138}