std/os/uefi: protocol handling improvements
parent
cef51eaffb
commit
78b54d9c96
|
@ -1,8 +1,11 @@
|
|||
pub const BootServices = @import("tables/boot_services.zig").BootServices;
|
||||
pub const ConfigurationTable = @import("tables/configuration_table.zig").ConfigurationTable;
|
||||
pub const global_variable align(8) = @import("tables/runtime_services.zig").global_variable;
|
||||
pub const LocateSearchType = @import("tables/boot_services.zig").LocateSearchType;
|
||||
pub const MemoryDescriptor = @import("tables/boot_services.zig").MemoryDescriptor;
|
||||
pub const MemoryType = @import("tables/boot_services.zig").MemoryType;
|
||||
pub const OpenProtocolAttributes = @import("tables/boot_services.zig").OpenProtocolAttributes;
|
||||
pub const ProtocolInformationEntry = @import("tables/boot_services.zig").ProtocolInformationEntry;
|
||||
pub const ResetType = @import("tables/runtime_services.zig").ResetType;
|
||||
pub const RuntimeServices = @import("tables/runtime_services.zig").RuntimeServices;
|
||||
pub const SystemTable = @import("tables/system_table.zig").SystemTable;
|
||||
|
|
|
@ -30,10 +30,11 @@ pub const BootServices = extern struct {
|
|||
/// Allocates pool memory.
|
||||
allocatePool: extern fn (MemoryType, usize, *align(8) [*]u8) usize,
|
||||
|
||||
freePool: usize, // TODO
|
||||
/// Returns pool memory to the system.
|
||||
freePool: extern fn ([*]align(8) u8) usize,
|
||||
|
||||
/// Creates an event.
|
||||
createEvent: extern fn (u32, usize, ?extern fn (Event, ?*const c_void) void, ?*const c_void, *Event) usize,
|
||||
createEvent: extern fn (u32, usize, ?extern fn (Event, ?*c_void) void, ?*const c_void, *Event) usize,
|
||||
|
||||
/// Sets the type of timer and the trigger time for a timer event.
|
||||
setTimer: extern fn (Event, TimerDelay, u64) usize,
|
||||
|
@ -47,7 +48,9 @@ pub const BootServices = extern struct {
|
|||
/// Closes an event.
|
||||
closeEvent: extern fn (Event) usize,
|
||||
|
||||
checkEvent: usize, // TODO
|
||||
/// Checks whether an event is in the signaled state.
|
||||
checkEvent: extern fn (Event) usize,
|
||||
|
||||
installProtocolInterface: usize, // TODO
|
||||
reinstallProtocolInterface: usize, // TODO
|
||||
uninstallProtocolInterface: usize, // TODO
|
||||
|
@ -87,11 +90,20 @@ pub const BootServices = extern struct {
|
|||
|
||||
connectController: usize, // TODO
|
||||
disconnectController: usize, // TODO
|
||||
openProtocol: usize, // TODO
|
||||
closeProtocol: usize, // TODO
|
||||
openProtocolInformation: usize, // TODO
|
||||
|
||||
/// Queries a handle to determine if it supports a specified protocol.
|
||||
openProtocol: extern fn (Handle, *align(8) const Guid, *?*c_void, ?Handle, ?Handle, OpenProtocolAttributes) usize,
|
||||
|
||||
/// Closes a protocol on a handle that was opened using openProtocol().
|
||||
closeProtocol: extern fn (Handle, *align(8) const Guid, Handle, ?Handle) usize,
|
||||
|
||||
/// Retrieves the list of agents that currently have a protocol interface opened.
|
||||
openProtocolInformation: extern fn (Handle, *align(8) const Guid, *[*]ProtocolInformationEntry, *usize) usize,
|
||||
|
||||
protocolsPerHandle: usize, // TODO
|
||||
locateHandleBuffer: usize, // TODO
|
||||
|
||||
/// Returns an array of handles that support the requested protocol in a buffer allocated from pool.
|
||||
locateHandleBuffer: extern fn (LocateSearchType, ?*align(8) const Guid, ?*const c_void, *usize, *[*]Handle) usize,
|
||||
|
||||
/// Returns the first protocol instance that matches the given protocol.
|
||||
locateProtocol: extern fn (*align(8) const Guid, ?*const c_void, *?*c_void) usize,
|
||||
|
@ -167,3 +179,26 @@ pub const MemoryDescriptor = extern struct {
|
|||
memory_runtime: bool,
|
||||
},
|
||||
};
|
||||
|
||||
pub const LocateSearchType = extern enum(u32) {
|
||||
AllHandles,
|
||||
ByRegisterNotify,
|
||||
ByProtocol,
|
||||
};
|
||||
|
||||
pub const OpenProtocolAttributes = packed struct {
|
||||
by_handle_protocol: bool,
|
||||
get_protocol: bool,
|
||||
test_protocol: bool,
|
||||
by_child_controller: bool,
|
||||
by_driver: bool,
|
||||
exclusive: bool,
|
||||
_pad: u26,
|
||||
};
|
||||
|
||||
pub const ProtocolInformationEntry = extern struct {
|
||||
agent_handle: ?Handle,
|
||||
controller_handle: ?Handle,
|
||||
attributes: OpenProtocolAttributes,
|
||||
open_count: u32,
|
||||
};
|
||||
|
|
|
@ -17,6 +17,7 @@ const TableHeader = uefi.tables.TableHeader;
|
|||
/// hdr.crc32 must be recomputed.
|
||||
pub const SystemTable = extern struct {
|
||||
hdr: TableHeader,
|
||||
|
||||
/// A null-terminated string that identifies the vendor that produces the system firmware of the platform.
|
||||
firmware_vendor: [*]u16,
|
||||
firmware_revision: u32,
|
||||
|
|
Loading…
Reference in New Issue