| ... | @@ -30,10 +30,11 @@ pub const BootServices = extern struct { | ... | @@ -30,10 +30,11 @@ pub const BootServices = extern struct { |
| 30 | /// Allocates pool memory. | 30 | /// Allocates pool memory. |
| 31 | allocatePool: extern fn (MemoryType, usize, *align(8) [*]u8) usize, | 31 | allocatePool: extern fn (MemoryType, usize, *align(8) [*]u8) usize, |
| 32 | | 32 | |
| 33 | freePool: usize, // TODO | 33 | /// Returns pool memory to the system. |
| | 34 | freePool: extern fn ([*]align(8) u8) usize, |
| 34 | | 35 | |
| 35 | /// Creates an event. | 36 | /// Creates an event. |
| 36 | createEvent: extern fn (u32, usize, ?extern fn (Event, ?*const c_void) void, ?*const c_void, *Event) usize, | 37 | createEvent: extern fn (u32, usize, ?extern fn (Event, ?*c_void) void, ?*const c_void, *Event) usize, |
| 37 | | 38 | |
| 38 | /// Sets the type of timer and the trigger time for a timer event. | 39 | /// Sets the type of timer and the trigger time for a timer event. |
| 39 | setTimer: extern fn (Event, TimerDelay, u64) usize, | 40 | setTimer: extern fn (Event, TimerDelay, u64) usize, |
| ... | @@ -47,7 +48,9 @@ pub const BootServices = extern struct { | ... | @@ -47,7 +48,9 @@ pub const BootServices = extern struct { |
| 47 | /// Closes an event. | 48 | /// Closes an event. |
| 48 | closeEvent: extern fn (Event) usize, | 49 | closeEvent: extern fn (Event) usize, |
| 49 | | 50 | |
| 50 | checkEvent: usize, // TODO | 51 | /// Checks whether an event is in the signaled state. |
| | 52 | checkEvent: extern fn (Event) usize, |
| | 53 | |
| 51 | installProtocolInterface: usize, // TODO | 54 | installProtocolInterface: usize, // TODO |
| 52 | reinstallProtocolInterface: usize, // TODO | 55 | reinstallProtocolInterface: usize, // TODO |
| 53 | uninstallProtocolInterface: usize, // TODO | 56 | uninstallProtocolInterface: usize, // TODO |
| ... | @@ -87,11 +90,20 @@ pub const BootServices = extern struct { | ... | @@ -87,11 +90,20 @@ pub const BootServices = extern struct { |
| 87 | | 90 | |
| 88 | connectController: usize, // TODO | 91 | connectController: usize, // TODO |
| 89 | disconnectController: usize, // TODO | 92 | disconnectController: usize, // TODO |
| 90 | openProtocol: usize, // TODO | 93 | |
| 91 | closeProtocol: usize, // TODO | 94 | /// Queries a handle to determine if it supports a specified protocol. |
| 92 | openProtocolInformation: usize, // TODO | 95 | openProtocol: extern fn (Handle, *align(8) const Guid, *?*c_void, ?Handle, ?Handle, OpenProtocolAttributes) usize, |
| | 96 | |
| | 97 | /// Closes a protocol on a handle that was opened using openProtocol(). |
| | 98 | closeProtocol: extern fn (Handle, *align(8) const Guid, Handle, ?Handle) usize, |
| | 99 | |
| | 100 | /// Retrieves the list of agents that currently have a protocol interface opened. |
| | 101 | openProtocolInformation: extern fn (Handle, *align(8) const Guid, *[*]ProtocolInformationEntry, *usize) usize, |
| | 102 | |
| 93 | protocolsPerHandle: usize, // TODO | 103 | protocolsPerHandle: usize, // TODO |
| 94 | locateHandleBuffer: usize, // TODO | 104 | |
| | 105 | /// Returns an array of handles that support the requested protocol in a buffer allocated from pool. |
| | 106 | locateHandleBuffer: extern fn (LocateSearchType, ?*align(8) const Guid, ?*const c_void, *usize, *[*]Handle) usize, |
| 95 | | 107 | |
| 96 | /// Returns the first protocol instance that matches the given protocol. | 108 | /// Returns the first protocol instance that matches the given protocol. |
| 97 | locateProtocol: extern fn (*align(8) const Guid, ?*const c_void, *?*c_void) usize, | 109 | locateProtocol: extern fn (*align(8) const Guid, ?*const c_void, *?*c_void) usize, |
| ... | @@ -167,3 +179,26 @@ pub const MemoryDescriptor = extern struct { | ... | @@ -167,3 +179,26 @@ pub const MemoryDescriptor = extern struct { |
| 167 | memory_runtime: bool, | 179 | memory_runtime: bool, |
| 168 | }, | 180 | }, |
| 169 | }; | 181 | }; |
| | 182 | |
| | 183 | pub const LocateSearchType = extern enum(u32) { |
| | 184 | AllHandles, |
| | 185 | ByRegisterNotify, |
| | 186 | ByProtocol, |
| | 187 | }; |
| | 188 | |
| | 189 | pub const OpenProtocolAttributes = packed struct { |
| | 190 | by_handle_protocol: bool, |
| | 191 | get_protocol: bool, |
| | 192 | test_protocol: bool, |
| | 193 | by_child_controller: bool, |
| | 194 | by_driver: bool, |
| | 195 | exclusive: bool, |
| | 196 | _pad: u26, |
| | 197 | }; |
| | 198 | |
| | 199 | pub const ProtocolInformationEntry = extern struct { |
| | 200 | agent_handle: ?Handle, |
| | 201 | controller_handle: ?Handle, |
| | 202 | attributes: OpenProtocolAttributes, |
| | 203 | open_count: u32, |
| | 204 | }; |