commit
c7fd414dab
@ -1,3 +1,7 @@
|
||||
pub const LoadedImageProtocol = @import("protocols/loaded_image_protocol.zig").LoadedImageProtocol;
|
||||
|
||||
pub const DevicePathProtocol = @import("protocols/device_path_protocol.zig").DevicePathProtocol;
|
||||
|
||||
pub const InputKey = @import("protocols/simple_text_input_ex_protocol.zig").InputKey;
|
||||
pub const KeyData = @import("protocols/simple_text_input_ex_protocol.zig").KeyData;
|
||||
pub const KeyState = @import("protocols/simple_text_input_ex_protocol.zig").KeyState;
|
||||
@ -29,6 +33,46 @@ pub const EdidActiveProtocol = @import("protocols/edid_active_protocol.zig").Edi
|
||||
pub const EdidOverrideProtocol = @import("protocols/edid_override_protocol.zig").EdidOverrideProtocol;
|
||||
pub const EdidOverrideProtocolAttributes = @import("protocols/edid_override_protocol.zig").EdidOverrideProtocolAttributes;
|
||||
|
||||
pub const SimpleNetworkProtocol = @import("protocols/simple_network_protocol.zig").SimpleNetworkProtocol;
|
||||
pub const MacAddress = @import("protocols/simple_network_protocol.zig").MacAddress;
|
||||
pub const SimpleNetworkMode = @import("protocols/simple_network_protocol.zig").SimpleNetworkMode;
|
||||
pub const SimpleNetworkReceiveFilter = @import("protocols/simple_network_protocol.zig").SimpleNetworkReceiveFilter;
|
||||
pub const SimpleNetworkState = @import("protocols/simple_network_protocol.zig").SimpleNetworkState;
|
||||
pub const NetworkStatistics = @import("protocols/simple_network_protocol.zig").NetworkStatistics;
|
||||
pub const SimpleNetworkInterruptStatus = @import("protocols/simple_network_protocol.zig").SimpleNetworkInterruptStatus;
|
||||
|
||||
pub const ManagedNetworkServiceBindingProtocol = @import("protocols/managed_network_service_binding_protocol.zig").ManagedNetworkServiceBindingProtocol;
|
||||
pub const ManagedNetworkProtocol = @import("protocols/managed_network_protocol.zig").ManagedNetworkProtocol;
|
||||
pub const ManagedNetworkConfigData = @import("protocols/managed_network_protocol.zig").ManagedNetworkConfigData;
|
||||
pub const ManagedNetworkCompletionToken = @import("protocols/managed_network_protocol.zig").ManagedNetworkCompletionToken;
|
||||
pub const ManagedNetworkReceiveData = @import("protocols/managed_network_protocol.zig").ManagedNetworkReceiveData;
|
||||
pub const ManagedNetworkTransmitData = @import("protocols/managed_network_protocol.zig").ManagedNetworkTransmitData;
|
||||
pub const ManagedNetworkFragmentData = @import("protocols/managed_network_protocol.zig").ManagedNetworkFragmentData;
|
||||
|
||||
pub const Ip6ServiceBindingProtocol = @import("protocols/ip6_service_binding_protocol.zig").Ip6ServiceBindingProtocol;
|
||||
pub const Ip6Protocol = @import("protocols/ip6_protocol.zig").Ip6Protocol;
|
||||
pub const Ip6ModeData = @import("protocols/ip6_protocol.zig").Ip6ModeData;
|
||||
pub const Ip6ConfigData = @import("protocols/ip6_protocol.zig").Ip6ConfigData;
|
||||
pub const Ip6Address = @import("protocols/ip6_protocol.zig").Ip6Address;
|
||||
pub const Ip6AddressInfo = @import("protocols/ip6_protocol.zig").Ip6AddressInfo;
|
||||
pub const Ip6RouteTable = @import("protocols/ip6_protocol.zig").Ip6RouteTable;
|
||||
pub const Ip6NeighborState = @import("protocols/ip6_protocol.zig").Ip6NeighborState;
|
||||
pub const Ip6NeighborCache = @import("protocols/ip6_protocol.zig").Ip6NeighborCache;
|
||||
pub const Ip6IcmpType = @import("protocols/ip6_protocol.zig").Ip6IcmpType;
|
||||
pub const Ip6CompletionToken = @import("protocols/ip6_protocol.zig").Ip6CompletionToken;
|
||||
|
||||
pub const Ip6ConfigProtocol = @import("protocols/ip6_config_protocol.zig").Ip6ConfigProtocol;
|
||||
pub const Ip6ConfigDataType = @import("protocols/ip6_config_protocol.zig").Ip6ConfigDataType;
|
||||
|
||||
pub const Udp6ServiceBindingProtocol = @import("protocols/udp6_service_binding_protocol.zig").Udp6ServiceBindingProtocol;
|
||||
pub const Udp6Protocol = @import("protocols/udp6_protocol.zig").Udp6Protocol;
|
||||
pub const Udp6ConfigData = @import("protocols/udp6_protocol.zig").Udp6ConfigData;
|
||||
pub const Udp6CompletionToken = @import("protocols/udp6_protocol.zig").Udp6CompletionToken;
|
||||
pub const Udp6ReceiveData = @import("protocols/udp6_protocol.zig").Udp6ReceiveData;
|
||||
pub const Udp6TransmitData = @import("protocols/udp6_protocol.zig").Udp6TransmitData;
|
||||
pub const Udp6SessionData = @import("protocols/udp6_protocol.zig").Udp6SessionData;
|
||||
pub const Udp6FragmentData = @import("protocols/udp6_protocol.zig").Udp6FragmentData;
|
||||
|
||||
pub const hii = @import("protocols/hii.zig");
|
||||
pub const HIIDatabaseProtocol = @import("protocols/hii_database_protocol.zig").HIIDatabaseProtocol;
|
||||
pub const HIIPopupProtocol = @import("protocols/hii_popup_protocol.zig").HIIPopupProtocol;
|
||||
|
17
lib/std/os/uefi/protocols/device_path_protocol.zig
Normal file
17
lib/std/os/uefi/protocols/device_path_protocol.zig
Normal file
@ -0,0 +1,17 @@
|
||||
const uefi = @import("std").os.uefi;
|
||||
const Guid = uefi.Guid;
|
||||
|
||||
pub const DevicePathProtocol = extern struct {
|
||||
type: u8,
|
||||
subtype: u8,
|
||||
length: u16,
|
||||
|
||||
pub const guid align(8) = Guid{
|
||||
.time_low = 0x09576e91,
|
||||
.time_mid = 0x6d3f,
|
||||
.time_high_and_version = 0x11d2,
|
||||
.clock_seq_high_and_reserved = 0x8e,
|
||||
.clock_seq_low = 0x39,
|
||||
.node = [_]u8{ 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b },
|
||||
};
|
||||
};
|
45
lib/std/os/uefi/protocols/ip6_config_protocol.zig
Normal file
45
lib/std/os/uefi/protocols/ip6_config_protocol.zig
Normal file
@ -0,0 +1,45 @@
|
||||
const uefi = @import("std").os.uefi;
|
||||
const Guid = uefi.Guid;
|
||||
const Event = uefi.Event;
|
||||
|
||||
pub const Ip6ConfigProtocol = extern struct {
|
||||
_set_data: extern fn (*const Ip6ConfigProtocol, Ip6ConfigDataType, usize, *const c_void) usize,
|
||||
_get_data: extern fn (*const Ip6ConfigProtocol, Ip6ConfigDataType, *usize, ?*const c_void) usize,
|
||||
_register_data_notify: extern fn (*const Ip6ConfigProtocol, Ip6ConfigDataType, Event) usize,
|
||||
_unregister_data_notify: extern fn (*const Ip6ConfigProtocol, Ip6ConfigDataType, Event) usize,
|
||||
|
||||
pub fn setData(self: *const Ip6ConfigProtocol, data_type: Ip6ConfigDataType, data_size: usize, data: *const c_void) usize {
|
||||
return self._set_data(self, data_type, data_size, data);
|
||||
}
|
||||
|
||||
pub fn getData(self: *const Ip6ConfigProtocol, data_type: Ip6ConfigDataType, data_size: *usize, data: ?*const c_void) usize {
|
||||
return self._get_data(self, data_type, data_size, data);
|
||||
}
|
||||
|
||||
pub fn registerDataNotify(self: *const Ip6ConfigProtocol, data_type: Ip6ConfigDataType, event: Event) usize {
|
||||
return self._register_data_notify(self, data_type, event);
|
||||
}
|
||||
|
||||
pub fn unregisterDataNotify(self: *const Ip6ConfigProtocol, data_type: Ip6ConfigDataType, event: Event) usize {
|
||||
return self._unregister_data_notify(self, data_type, event);
|
||||
}
|
||||
|
||||
pub const guid align(8) = Guid{
|
||||
.time_low = 0x937fe521,
|
||||
.time_mid = 0x95ae,
|
||||
.time_high_and_version = 0x4d1a,
|
||||
.clock_seq_high_and_reserved = 0x89,
|
||||
.clock_seq_low = 0x29,
|
||||
.node = [_]u8{ 0x48, 0xbc, 0xd9, 0x0a, 0xd3, 0x1a },
|
||||
};
|
||||
};
|
||||
|
||||
pub const Ip6ConfigDataType = extern enum(u32) {
|
||||
InterfaceInfo,
|
||||
AltInterfaceId,
|
||||
Policy,
|
||||
DupAddrDetectTransmits,
|
||||
ManualAddress,
|
||||
Gateway,
|
||||
DnsServer,
|
||||
};
|
143
lib/std/os/uefi/protocols/ip6_protocol.zig
Normal file
143
lib/std/os/uefi/protocols/ip6_protocol.zig
Normal file
@ -0,0 +1,143 @@
|
||||
const uefi = @import("std").os.uefi;
|
||||
const Guid = uefi.Guid;
|
||||
const Event = uefi.Event;
|
||||
const MacAddress = uefi.protocols.MacAddress;
|
||||
const ManagedNetworkConfigData = uefi.protocols.ManagedNetworkConfigData;
|
||||
const SimpleNetworkMode = uefi.protocols.SimpleNetworkMode;
|
||||
|
||||
pub const Ip6Protocol = extern struct {
|
||||
_get_mode_data: extern fn (*const Ip6Protocol, ?*Ip6ModeData, ?*ManagedNetworkConfigData, ?*SimpleNetworkMode) usize,
|
||||
_configure: extern fn (*const Ip6Protocol, ?*const Ip6ConfigData) usize,
|
||||
_groups: extern fn (*const Ip6Protocol, bool, ?*const Ip6Address) usize,
|
||||
_routes: extern fn (*const Ip6Protocol, bool, ?*const Ip6Address, u8, ?*const Ip6Address) usize,
|
||||
_neighbors: extern fn (*const Ip6Protocol, bool, *const Ip6Address, ?*const MacAddress, u32, bool) usize,
|
||||
_transmit: extern fn (*const Ip6Protocol, *Ip6CompletionToken) usize,
|
||||
_receive: extern fn (*const Ip6Protocol, *Ip6CompletionToken) usize,
|
||||
_cancel: extern fn (*const Ip6Protocol, ?*Ip6CompletionToken) usize,
|
||||
_poll: extern fn (*const Ip6Protocol) usize,
|
||||
|
||||
/// Gets the current operational settings for this instance of the EFI IPv6 Protocol driver.
|
||||
pub fn getModeData(self: *const Ip6Protocol, ip6_mode_data: ?*Ip6ModeData, mnp_config_data: ?*ManagedNetworkConfigData, snp_mode_data: ?*SimpleNetworkMode) usize {
|
||||
return self._get_mode_data(self, ip6_mode_data, mnp_config_data, snp_mode_data);
|
||||
}
|
||||
|
||||
/// Assign IPv6 address and other configuration parameter to this EFI IPv6 Protocol driver instance.
|
||||
pub fn configure(self: *const Ip6Protocol, ip6_config_data: ?*const Ip6ConfigData) usize {
|
||||
return self._configure(self, ip6_config_data);
|
||||
}
|
||||
|
||||
/// Joins and leaves multicast groups.
|
||||
pub fn groups(self: *const Ip6Protocol, join_flag: bool, group_address: ?*const Ip6Address) usize {
|
||||
return self._groups(self, join_flag, group_address);
|
||||
}
|
||||
|
||||
/// Adds and deletes routing table entries.
|
||||
pub fn routes(self: *const Ip6Protocol, delete_route: bool, destination: ?*const Ip6Address, prefix_length: u8, gateway_address: ?*const Ip6Address) usize {
|
||||
return self._routes(self, delete_route, destination, prefix_length, gateway_address);
|
||||
}
|
||||
|
||||
/// Add or delete Neighbor cache entries.
|
||||
pub fn neighbors(self: *const Ip6Protocol, delete_flag: bool, target_ip6_address: *const Ip6Address, target_link_address: ?*const MacAddress, timeout: u32, override: bool) usize {
|
||||
return self._neighbors(self, delete_flag, target_ip6_address, target_link_address, timeout, override);
|
||||
}
|
||||
|
||||
/// Places outgoing data packets into the transmit queue.
|
||||
pub fn transmit(self: *const Ip6Protocol, token: *Ip6CompletionToken) usize {
|
||||
return self._transmit(self, token);
|
||||
}
|
||||
|
||||
/// Places a receiving request into the receiving queue.
|
||||
pub fn receive(self: *const Ip6Protocol, token: *Ip6CompletionToken) usize {
|
||||
return self._receive(self, token);
|
||||
}
|
||||
|
||||
/// Abort an asynchronous transmits or receive request.
|
||||
pub fn cancel(self: *const Ip6Protocol, token: ?*Ip6CompletionToken) usize {
|
||||
return self._cancel(self, token);
|
||||
}
|
||||
|
||||
/// Polls for incoming data packets and processes outgoing data packets.
|
||||
pub fn poll(self: *const Ip6Protocol) usize {
|
||||
return self._poll(self);
|
||||
}
|
||||
|
||||
pub const guid align(8) = Guid{
|
||||
.time_low = 0x2c8759d5,
|
||||
.time_mid = 0x5c2d,
|
||||
.time_high_and_version = 0x66ef,
|
||||
.clock_seq_high_and_reserved = 0x92,
|
||||
.clock_seq_low = 0x5f,
|
||||
.node = [_]u8{ 0xb6, 0x6c, 0x10, 0x19, 0x57, 0xe2 },
|
||||
};
|
||||
};
|
||||
|
||||
pub const Ip6ModeData = extern struct {
|
||||
is_started: bool,
|
||||
max_packet_size: u32,
|
||||
config_data: Ip6ConfigData,
|
||||
is_configured: bool,
|
||||
address_count: u32,
|
||||
address_list: [*]Ip6AddressInfo,
|
||||
group_count: u32,
|
||||
group_table: [*]Ip6Address,
|
||||
route_count: u32,
|
||||
route_table: [*]Ip6RouteTable,
|
||||
neighbor_count: u32,
|
||||
neighbor_cache: [*]Ip6NeighborCache,
|
||||
prefix_count: u32,
|
||||
prefix_table: [*]Ip6AddressInfo,
|
||||
icmp_type_count: u32,
|
||||
icmp_type_list: [*]Ip6IcmpType,
|
||||
};
|
||||
|
||||
pub const Ip6ConfigData = extern struct {
|
||||
default_protocol: u8,
|
||||
accept_any_protocol: bool,
|
||||
accept_icmp_errors: bool,
|
||||
accept_promiscuous: bool,
|
||||
destination_address: Ip6Address,
|
||||
station_address: Ip6Address,
|
||||
traffic_class: u8,
|
||||
hop_limit: u8,
|
||||
flow_label: u32,
|
||||
receive_timeout: u32,
|
||||
transmit_timeout: u32,
|
||||
};
|
||||
|
||||
pub const Ip6Address = [16]u8;
|
||||
|
||||
pub const Ip6AddressInfo = extern struct {
|
||||
address: Ip6Address,
|
||||
prefix_length: u8,
|
||||
};
|
||||
|
||||
pub const Ip6RouteTable = extern struct {
|
||||
gateway: Ip6Address,
|
||||
destination: Ip6Address,
|
||||
prefix_length: u8,
|
||||
};
|
||||
|
||||
pub const Ip6NeighborState = extern enum(u32) {
|
||||
Incomplete,
|
||||
Reachable,
|
||||
Stale,
|
||||
Delay,
|
||||
Probe,
|
||||
};
|
||||
|
||||
pub const Ip6NeighborCache = extern struct {
|
||||
neighbor: Ip6Address,
|
||||
link_address: MacAddress,
|
||||
state: Ip6NeighborState,
|
||||
};
|
||||
|
||||
pub const Ip6IcmpType = extern struct {
|
||||
type: u8,
|
||||
code: u8,
|
||||
};
|
||||
|
||||
pub const Ip6CompletionToken = extern struct {
|
||||
event: Event,
|
||||
status: usize,
|
||||
packet: *c_void, // union TODO
|
||||
};
|
25
lib/std/os/uefi/protocols/ip6_service_binding_protocol.zig
Normal file
25
lib/std/os/uefi/protocols/ip6_service_binding_protocol.zig
Normal file
@ -0,0 +1,25 @@
|
||||
const uefi = @import("std").os.uefi;
|
||||
const Handle = uefi.Handle;
|
||||
const Guid = uefi.Guid;
|
||||
|
||||
pub const Ip6ServiceBindingProtocol = extern struct {
|
||||
_create_child: extern fn (*const Ip6ServiceBindingProtocol, *?Handle) usize,
|
||||
_destroy_child: extern fn (*const Ip6ServiceBindingProtocol, Handle) usize,
|
||||
|
||||
pub fn createChild(self: *const Ip6ServiceBindingProtocol, handle: *?Handle) usize {
|
||||
return self._create_child(self, handle);
|
||||
}
|
||||
|
||||
pub fn destroyChild(self: *const Ip6ServiceBindingProtocol, handle: Handle) usize {
|
||||
return self._destroy_child(self, handle);
|
||||
}
|
||||
|
||||
pub const guid align(8) = Guid{
|
||||
.time_low = 0xec835dd3,
|
||||
.time_mid = 0xfe0f,
|
||||
.time_high_and_version = 0x617b,
|
||||
.clock_seq_high_and_reserved = 0xa6,
|
||||
.clock_seq_low = 0x21,
|
||||
.node = [_]u8{ 0xb3, 0x50, 0xc3, 0xe1, 0x33, 0x88 },
|
||||
};
|
||||
};
|
36
lib/std/os/uefi/protocols/loaded_image_protocol.zig
Normal file
36
lib/std/os/uefi/protocols/loaded_image_protocol.zig
Normal file
@ -0,0 +1,36 @@
|
||||
const uefi = @import("std").os.uefi;
|
||||
const Guid = uefi.Guid;
|
||||
const Handle = uefi.Handle;
|
||||
const SystemTable = uefi.tables.SystemTable;
|
||||
const MemoryType = uefi.tables.MemoryType;
|
||||
const DevicePathProtocol = uefi.protocols.DevicePathProtocol;
|
||||
|
||||
pub const LoadedImageProtocol = extern struct {
|
||||
revision: u32,
|
||||
parent_handle: Handle,
|
||||
system_table: *SystemTable,
|
||||
device_handle: ?Handle,
|
||||
file_path: *DevicePathProtocol,
|
||||
reserved: *c_void,
|
||||
load_options_size: u32,
|
||||
load_options: *c_void,
|
||||
image_base: [*]u8,
|
||||
image_size: u64,
|
||||
image_code_type: MemoryType,
|
||||
image_data_type: MemoryType,
|
||||
_unload: extern fn (*const LoadedImageProtocol, Handle) usize,
|
||||
|
||||
/// Unloads an image from memory.
|
||||
pub fn unload(self: *const LoadedImageProtocol, handle: Handle) usize {
|
||||
return self._unload(self, handle);
|
||||
}
|
||||
|
||||
pub const guid align(8) = Guid{
|
||||
.time_low = 0x5b1b31a1,
|
||||
.time_mid = 0x9562,
|
||||
.time_high_and_version = 0x11d2,
|
||||
.clock_seq_high_and_reserved = 0x8e,
|
||||
.clock_seq_low = 0x3f,
|
||||
.node = [_]u8{ 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b },
|
||||
};
|
||||
};
|
126
lib/std/os/uefi/protocols/managed_network_protocol.zig
Normal file
126
lib/std/os/uefi/protocols/managed_network_protocol.zig
Normal file
@ -0,0 +1,126 @@
|
||||
const uefi = @import("std").os.uefi;
|
||||
const Guid = uefi.Guid;
|
||||
const Event = uefi.Event;
|
||||
const Time = uefi.Time;
|
||||
const SimpleNetworkMode = uefi.protocols.SimpleNetworkMode;
|
||||
const MacAddress = uefi.protocols.MacAddress;
|
||||
|
||||
pub const ManagedNetworkProtocol = extern struct {
|
||||
_get_mode_data: extern fn (*const ManagedNetworkProtocol, ?*ManagedNetworkConfigData, ?*SimpleNetworkMode) usize,
|
||||
_configure: extern fn (*const ManagedNetworkProtocol, ?*const ManagedNetworkConfigData) usize,
|
||||
_mcast_ip_to_mac: extern fn (*const ManagedNetworkProtocol, bool, *const c_void, *MacAddress) usize,
|
||||
_groups: extern fn (*const ManagedNetworkProtocol, bool, ?*const MacAddress) usize,
|
||||
_transmit: extern fn (*const ManagedNetworkProtocol, *const ManagedNetworkCompletionToken) usize,
|
||||
_receive: extern fn (*const ManagedNetworkProtocol, *const ManagedNetworkCompletionToken) usize,
|
||||
_cancel: extern fn (*const ManagedNetworkProtocol, ?*const ManagedNetworkCompletionToken) usize,
|
||||
_poll: extern fn (*const ManagedNetworkProtocol) usize,
|
||||
|
||||
/// Returns the operational parameters for the current MNP child driver.
|
||||
/// May also support returning the underlying SNP driver mode data.
|
||||
pub fn getModeData(self: *const ManagedNetworkProtocol, mnp_config_data: ?*ManagedNetworkConfigData, snp_mode_data: ?*SimpleNetworkMode) usize {
|
||||
return self._get_mode_data(self, mnp_config_data, snp_mode_data);
|
||||
}
|
||||
|
||||
/// Sets or clears the operational parameters for the MNP child driver.
|
||||
pub fn configure(self: *const ManagedNetworkProtocol, mnp_config_data: ?*const ManagedNetworkConfigData) usize {
|
||||
return self._configure(self, mnp_config_data);
|
||||
}
|
||||
|
||||
/// Translates an IP multicast address to a hardware (MAC) multicast address.
|
||||
/// This function may be unsupported in some MNP implementations.
|
||||
pub fn mcastIpToMac(self: *const ManagedNetworkProtocol, ipv6flag: bool, ipaddress: *const c_void, mac_address: *MacAddress) usize {
|
||||
return self._mcast_ip_to_mac(self, ipv6flag, ipaddress);
|
||||
}
|
||||
|
||||
/// Enables and disables receive filters for multicast address.
|
||||
/// This function may be unsupported in some MNP implementations.
|
||||
pub fn groups(self: *const ManagedNetworkProtocol, join_flag: bool, mac_address: ?*const MacAddress) usiz {
|
||||
return self._groups(self, join_flag, mac_address);
|
||||
}
|
||||
|
||||
/// Places asynchronous outgoing data packets into the transmit queue.
|
||||
pub fn transmit(self: *const ManagedNetworkProtocol, token: *const ManagedNetworkCompletionToken) usize {
|
||||
return self._transmit(self, token);
|
||||
}
|
||||
|
||||
/// Places an asynchronous receiving request into the receiving queue.
|
||||
pub fn receive(self: *const ManagedNetworkProtocol, token: *const ManagedNetworkCompletionToken) usize {
|
||||
return self._receive(self, token);
|
||||
}
|
||||
|
||||
/// Aborts an asynchronous transmit or receive request.
|
||||
pub fn cancel(self: *const ManagedNetworkProtocol, token: ?*const ManagedNetworkCompletionToken) usize {
|
||||
return self._cancel(self, token);
|
||||
}
|
||||
|
||||
/// Polls for incoming data packets and processes outgoing data packets.
|
||||
pub fn poll(self: *const ManagedNetworkProtocol) usize {
|
||||
return self._poll(self);
|
||||
}
|
||||
|
||||
pub const guid align(8) = Guid{
|
||||
.time_low = 0x7ab33a91,
|
||||
.time_mid = 0xace5,
|
||||
.time_high_and_version = 0x4326,
|
||||
.clock_seq_high_and_reserved = 0xb5,
|
||||
.clock_seq_low = 0x72,
|
||||
.node = [_]u8{ 0xe7, 0xee, 0x33, 0xd3, 0x9f, 0x16 },
|
||||
};
|
||||
};
|
||||
|
||||
pub const ManagedNetworkConfigData = extern struct {
|
||||
received_queue_timeout_value: u32,
|
||||
transmit_queue_timeout_value: u32,
|
||||
protocol_type_filter: u16,
|
||||
enable_unicast_receive: bool,
|
||||
enable_multicast_receive: bool,
|
||||
enable_broadcast_receive: bool,
|
||||
enable_promiscuous_receive: bool,
|
||||
flush_queues_on_reset: bool,
|
||||
enable_receive_timestamps: bool,
|
||||
disable_background_polling: bool,
|
||||
};
|
||||
|
||||
pub const ManagedNetworkCompletionToken = extern struct {
|
||||
event: Event,
|
||||
status: usize,
|
||||
packet: extern union {
|
||||
RxData: *ManagedNetworkReceiveData,
|
||||
TxData: *ManagedNetworkTransmitData,
|
||||
},
|
||||
};
|
||||
|
||||
pub const ManagedNetworkReceiveData = extern struct {
|
||||
timestamp: Time,
|
||||
recycle_event: Event,
|
||||
packet_length: u32,
|
||||
header_length: u32,
|
||||
address_length: u32,
|
||||
data_length: u32,
|
||||
broadcast_flag: bool,
|
||||
multicast_flag: bool,
|
||||
promiscuous_flag: bool,
|
||||
protocol_type: u16,
|
||||
destination_address: [*]u8,
|
||||
source_address: [*]u8,
|
||||
media_header: [*]u8,
|
||||
packet_data: [*]u8,
|
||||
};
|
||||
|
||||
pub const ManagedNetworkTransmitData = extern struct {
|
||||
destination_address: ?*MacAddress,
|
||||
source_address: ?*MacAddress,
|
||||
protocol_type: u16,
|
||||
data_length: u32,
|
||||
header_length: u16,
|
||||
fragment_count: u16,
|
||||
|
||||
pub fn getFragments(self: *ManagedNetworkTransmitData) []ManagedNetworkFragmentData {
|
||||
return @ptrCast([*]ManagedNetworkFragmentData, @ptrCast([*]u8, self) + @sizeOf(ManagedNetworkTransmitData))[0..self.fragment_count];
|
||||
}
|
||||
};
|
||||
|
||||
pub const ManagedNetworkFragmentData = extern struct {
|
||||
fragment_length: u32,
|
||||
fragment_buffer: [*]u8,
|
||||
};
|
@ -0,0 +1,25 @@
|
||||
const uefi = @import("std").os.uefi;
|
||||
const Handle = uefi.Handle;
|
||||
const Guid = uefi.Guid;
|
||||
|
||||
pub const ManagedNetworkServiceBindingProtocol = extern struct {
|
||||
_create_child: extern fn (*const ManagedNetworkServiceBindingProtocol, *?Handle) usize,
|
||||
_destroy_child: extern fn (*const ManagedNetworkServiceBindingProtocol, Handle) usize,
|
||||
|
||||
pub fn createChild(self: *const ManagedNetworkServiceBindingProtocol, handle: *?Handle) usize {
|
||||
return self._create_child(self, handle);
|
||||
}
|
||||
|
||||
pub fn destroyChild(self: *const ManagedNetworkServiceBindingProtocol, handle: Handle) usize {
|
||||
return self._destroy_child(self, handle);
|
||||
}
|
||||
|
||||
pub const guid align(8) = Guid{
|
||||
.time_low = 0xf36ff770,
|
||||
.time_mid = 0xa7e1,
|
||||
.time_high_and_version = 0x42cf,
|
||||
.clock_seq_high_and_reserved = 0x9e,
|
||||
.clock_seq_low = 0xd2,
|
||||
.node = [_]u8{ 0x56, 0xf0, 0xf2, 0x71, 0xf4, 0x4c },
|
||||
};
|
||||
};
|
172
lib/std/os/uefi/protocols/simple_network_protocol.zig
Normal file
172
lib/std/os/uefi/protocols/simple_network_protocol.zig
Normal file
@ -0,0 +1,172 @@
|
||||
const uefi = @import("std").os.uefi;
|
||||
const Event = uefi.Event;
|
||||
const Guid = uefi.Guid;
|
||||
|
||||
pub const SimpleNetworkProtocol = extern struct {
|
||||
revision: u64,
|
||||
_start: extern fn (*const SimpleNetworkProtocol) usize,
|
||||
_stop: extern fn (*const SimpleNetworkProtocol) usize,
|
||||
_initialize: extern fn (*const SimpleNetworkProtocol, usize, usize) usize,
|
||||
_reset: extern fn (*const SimpleNetworkProtocol, bool) usize,
|
||||
_shutdown: extern fn (*const SimpleNetworkProtocol) usize,
|
||||
_receive_filters: extern fn (*const SimpleNetworkProtocol, SimpleNetworkReceiveFilter, SimpleNetworkReceiveFilter, bool, usize, ?[*]const MacAddress) usize,
|
||||
_station_address: extern fn (*const SimpleNetworkProtocol, bool, ?*const MacAddress) usize,
|
||||
_statistics: extern fn (*const SimpleNetworkProtocol, bool, ?*usize, ?*NetworkStatistics) usize,
|
||||
_mcast_ip_to_mac: extern fn (*const SimpleNetworkProtocol, bool, *const c_void, *MacAddress) usize,
|
||||
_nvdata: extern fn (*const SimpleNetworkProtocol, bool, usize, usize, [*]u8) usize,
|
||||
_get_status: extern fn (*const SimpleNetworkProtocol, *SimpleNetworkInterruptStatus, ?*?[*]u8) usize,
|
||||
_transmit: extern fn (*const SimpleNetworkProtocol, usize, usize, [*]const u8, ?*const MacAddress, ?*const MacAddress, ?*const u16) usize,
|
||||
_receive: extern fn (*const SimpleNetworkProtocol, ?*usize, *usize, [*]u8, ?*MacAddress, ?*MacAddress, ?*u16) usize,
|
||||
wait_for_packet: Event,
|
||||
mode: *SimpleNetworkMode,
|
||||
|
||||
/// Changes the state of a network interface from "stopped" to "started".
|
||||
pub fn start(self: *const SimpleNetworkProtocol) usize {
|
||||
return self._start(self);
|
||||
}
|
||||
|
||||
/// Changes the state of a network interface from "started" to "stopped".
|
||||
pub fn stop(self: *const SimpleNetworkProtocol) usize {
|
||||
return self._stop(self);
|
||||
}
|
||||
|
||||
/// Resets a network adapter and allocates the transmit and receive buffers required by the network interface.
|
||||
pub fn initialize(self: *const SimpleNetworkProtocol, extra_rx_buffer_size: usize, extra_tx_buffer_size: usize) usize {
|
||||
return self._initialize(self, extra_rx_buffer_size, extra_tx_buffer_size);
|
||||
}
|
||||
|
||||
/// Resets a network adapter and reinitializes it with the parameters that were provided in the previous call to initialize().
|
||||
pub fn reset(self: *const SimpleNetworkProtocol, extended_verification: bool) usize {
|
||||
return self._reset(self, extended_verification);
|
||||
}
|
||||
|
||||
/// Resets a network adapter and leaves it in a state that is safe for another driver to initialize.
|
||||
pub fn shutdown(self: *const SimpleNetworkProtocol) usize {
|
||||
return self._shutdown(self);
|
||||
}
|
||||
|
||||
/// Manages the multicast receive filters of a network interface.
|
||||
pub fn receiveFilters(self: *const SimpleNetworkProtocol, enable: SimpleNetworkReceiveFilter, disable: SimpleNetworkReceiveFilter, reset_mcast_filter: bool, mcast_filter_cnt: usize, mcast_filter: ?[*]const MacAddress) usize {
|
||||
return self._receive_filters(self, enable, disable, reset_mcast_filter, mcast_filter_cnt, mcast_filter);
|
||||
}
|
||||
|
||||
/// Modifies or resets the current station address, if supported.
|
||||
pub fn stationAddress(self: *const SimpleNetworkProtocol, reset: bool, new: ?*const MacAddress) usize {
|
||||
return self._station_address(self, reset, new);
|
||||
}
|
||||
|
||||
/// Resets or collects the statistics on a network interface.
|
||||
pub fn statistics(self: *const SimpleNetworkProtocol, reset_: bool, statistics_size: ?*usize, statistics_table: ?*NetworkStatistics) usize {
|
||||
return self._statistics(self, reset_, statistics_size, statistics_table);
|
||||
}
|
||||
|
||||
/// Converts a multicast IP address to a multicast HW MAC address.
|
||||
pub fn mcastIpToMac(self: *const SimpleNetworkProtocol, ipv6: bool, ip: *const c_void, mac: *MacAddress) usize {
|
||||
return self._mcast_ip_to_mac(self, ipv6, ip, mac);
|
||||
}
|
||||
|
||||
/// Performs read and write operations on the NVRAM device attached to a network interface.
|
||||
pub fn nvdata(self: *const SimpleNetworkProtocol, read_write: bool, offset: usize, buffer_size: usize, buffer: [*]u8) usize {
|
||||
return self._nvdata(self, read_write, offset, buffer_size, buffer);
|
||||
}
|
||||
|
||||
/// Reads the current interrupt status and recycled transmit buffer status from a network interface.
|
||||
pub fn getStatus(self: *const SimpleNetworkProtocol, interrupt_status: *SimpleNetworkInterruptStatus, tx_buf: ?*?[*]u8) usize {
|
||||
return self._get_status(self, interrupt_status, tx_buf);
|
||||
}
|
||||
|
||||
/// Places a packet in the transmit queue of a network interface.
|
||||
pub fn transmit(self: *const SimpleNetworkProtocol, header_size: usize, buffer_size: usize, buffer: [*]const u8, src_addr: ?*const MacAddress, dest_addr: ?*const MacAddress, protocol: ?*const u16) usize {
|
||||
return self._transmit(self, header_size, buffer_size, buffer, src_addr, dest_addr, protocol);
|
||||
}
|
||||
|
||||
/// Receives a packet from a network interface.
|
||||
pub fn receive(self: *const SimpleNetworkProtocol, header_size: ?*usize, buffer_size: *usize, buffer: [*]u8, src_addr: ?*MacAddress, dest_addr: ?*MacAddress, protocol: ?*u16) usize {
|
||||
return self._receive(self, header_size, buffer_size, buffer, src_addr, dest_addr, protocol);
|
||||
}
|
||||
|
||||
pub const guid align(8) = Guid{
|
||||
.time_low = 0xa19832b9,
|
||||
.time_mid = 0xac25,
|
||||
.time_high_and_version = 0x11d3,
|
||||
.clock_seq_high_and_reserved = 0x9a,
|
||||
.clock_seq_low = 0x2d,
|
||||
.node = [_]u8{ 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d },
|
||||
};
|
||||
};
|
||||
|
||||
pub const MacAddress = [32]u8;
|
||||
|
||||
pub const SimpleNetworkMode = extern struct {
|
||||
state: SimpleNetworkState,
|
||||
hw_address_size: u32,
|
||||
media_header_size: u32,
|
||||
max_packet_size: u32,
|
||||
nvram_size: u32,
|
||||
nvram_access_size: u32,
|
||||
receive_filter_mask: SimpleNetworkReceiveFilter,
|
||||
receive_filter_setting: SimpleNetworkReceiveFilter,
|
||||
max_mcast_filter_count: u32,
|
||||
mcast_filter_count: u32,
|
||||
mcast_filter: [16]MacAddress,
|
||||
current_address: MacAddress,
|
||||
broadcast_address: MacAddress,
|
||||
permanent_address: MacAddress,
|
||||
if_type: u8,
|
||||
mac_address_changeable: bool,
|
||||
multiple_tx_supported: bool,
|
||||
media_present_supported: bool,
|
||||
media_present: bool,
|
||||
};
|
||||
|
||||
pub const SimpleNetworkReceiveFilter = packed struct {
|
||||
receive_unicast: bool,
|
||||
receive_multicast: bool,
|
||||
receive_broadcast: bool,
|
||||
receive_promiscuous: bool,
|
||||
receive_promiscuous_multicast: bool,
|
||||
_pad: u27 = undefined,
|
||||
};
|
||||
|
||||
pub const SimpleNetworkState = extern enum(u32) {
|
||||
Stopped,
|
||||
Started,
|
||||
Initialized,
|
||||
};
|
||||
|
||||
pub const NetworkStatistics = extern struct {
|
||||
rx_total_frames: u64,
|
||||
rx_good_frames: u64,
|
||||
rx_undersize_frames: u64,
|
||||
rx_oversize_frames: u64,
|
||||
rx_dropped_frames: u64,
|
||||
rx_unicast_frames: u64,
|
||||
rx_broadcast_frames: u64,
|
||||
rx_multicast_frames: u64,
|
||||
rx_crc_error_frames: u64,
|
||||
rx_total_bytes: u64,
|
||||
tx_total_frames: u64,
|
||||
tx_good_frames: u64,
|
||||
tx_undersize_frames: u64,
|
||||
tx_oversize_frames: u64,
|
||||
tx_dropped_frames: u64,
|
||||
tx_unicast_frames: u64,
|
||||
tx_broadcast_frames: u64,
|
||||
tx_multicast_frames: u64,
|
||||
tx_crc_error_frames: u64,
|
||||
tx_total_bytes: u64,
|
||||
collisions: u64,
|
||||
unsupported_protocol: u64,
|
||||
rx_duplicated_frames: u64,
|
||||
rx_decryptError_frames: u64,
|
||||
tx_error_frames: u64,
|
||||
tx_retry_frames: u64,
|
||||
};
|
||||
|
||||
pub const SimpleNetworkInterruptStatus = packed struct {
|
||||
receive_interrupt: bool,
|
||||
transmit_interrupt: bool,
|
||||
command_interrupt: bool,
|
||||
software_interrupt: bool,
|
||||
_pad: u28,
|
||||
};
|
112
lib/std/os/uefi/protocols/udp6_protocol.zig
Normal file
112
lib/std/os/uefi/protocols/udp6_protocol.zig
Normal file
@ -0,0 +1,112 @@
|
||||
const uefi = @import("std").os.uefi;
|
||||
const Guid = uefi.Guid;
|
||||
const Event = uefi.Event;
|
||||
const Time = uefi.Time;
|
||||
const Ip6ModeData = uefi.protocols.Ip6ModeData;
|
||||
const Ip6Address = uefi.protocols.Ip6Address;
|
||||
const ManagedNetworkConfigData = uefi.protocols.ManagedNetworkConfigData;
|
||||
const SimpleNetworkMode = uefi.protocols.SimpleNetworkMode;
|
||||
|
||||
pub const Udp6Protocol = extern struct {
|
||||
_get_mode_data: extern fn (*const Udp6Protocol, ?*Udp6ConfigData, ?*Ip6ModeData, ?*ManagedNetworkConfigData, ?*SimpleNetworkMode) usize,
|
||||
_configure: extern fn (*const Udp6Protocol, ?*const Udp6ConfigData) usize,
|
||||
_groups: extern fn (*const Udp6Protocol, bool, ?*const Ip6Address) usize,
|
||||
_transmit: extern fn (*const Udp6Protocol, *Udp6CompletionToken) usize,
|
||||
_receive: extern fn (*const Udp6Protocol, *Udp6CompletionToken) usize,
|
||||
_cancel: extern fn (*const Udp6Protocol, ?*Udp6CompletionToken) usize,
|
||||
_poll: extern fn (*const Udp6Protocol) usize,
|
||||
|
||||
pub fn getModeData(self: *const Udp6Protocol, udp6_config_data: ?*Udp6ConfigData, ip6_mode_data: ?*Ip6ModeData, mnp_config_data: ?*ManagedNetworkConfigData, snp_mode_data: ?*SimpleNetworkMode) usize {
|
||||
return self._get_mode_data(self, udp6_config_data, ip6_mode_data, mnp_config_data, snp_mode_data);
|
||||
}
|
||||
|
||||
pub fn configure(self: *const Udp6Protocol, udp6_config_data: ?*const Udp6ConfigData) usize {
|
||||
return self._configure(self, udp6_config_data);
|
||||
}
|
||||
|
||||
pub fn groups(self: *const Udp6Protocol, join_flag: bool, multicast_address: ?*const Ip6Address) usize {
|
||||
return self._groups(self, join_flag, multicast_address);
|
||||
}
|
||||
|
||||
pub fn transmit(self: *const Udp6Protocol, token: *Udp6CompletionToken) usize {
|
||||
return self._transmit(self, token);
|
||||
}
|
||||
|
||||
pub fn receive(self: *const Udp6Protocol, token: *Udp6CompletionToken) usize {
|
||||
return self._receive(self, token);
|
||||
}
|
||||
|
||||
pub fn cancel(self: *const Udp6Protocol, token: ?*Udp6CompletionToken) usize {
|
||||
return self._cancel(self, token);
|
||||
}
|
||||
|
||||
pub fn poll(self: *const Udp6Protocol) usize {
|
||||
return self._poll(self);
|
||||
}
|
||||
|
||||
pub const guid align(8) = uefi.Guid{
|
||||
.time_low = 0x4f948815,
|
||||
.time_mid = 0xb4b9,
|
||||
.time_high_and_version = 0x43cb,
|
||||
.clock_seq_high_and_reserved = 0x8a,
|
||||
.clock_seq_low = 0x33,
|
||||
.node = [_]u8{ 0x90, 0xe0, 0x60, 0xb3, 0x49, 0x55 },
|
||||
};
|
||||
};
|
||||
|
||||
pub const Udp6ConfigData = extern struct {
|
||||
accept_promiscuous: bool,
|
||||
accept_any_port: bool,
|
||||
allow_duplicate_port: bool,
|
||||
traffic_class: u8,
|
||||
hop_limit: u8,
|
||||
receive_timeout: u32,
|
||||
transmit_timeout: u32,
|
||||
station_address: Ip6Address,
|
||||
station_port: u16,
|
||||
remote_address: Ip6Address,
|
||||
remote_port: u16,
|
||||
};
|
||||
|
||||
pub const Udp6CompletionToken = extern struct {
|
||||
event: Event,
|
||||
status: usize,
|
||||
packet: extern union {
|
||||
RxData: *Udp6ReceiveData,
|
||||
TxData: *Udp6TransmitData,
|
||||
},
|
||||
};
|
||||
|
||||
pub const Udp6ReceiveData = extern struct {
|
||||
timestamp: Time,
|
||||
recycle_signal: Event,
|
||||
udp6_session: Udp6SessionData,
|
||||
data_length: u32,
|
||||
fragment_count: u32,
|
||||
|
||||
pub fn getFragments(self: *Udp6ReceiveData) []Udp6FragmentData {
|
||||
return @ptrCast([*]Udp6FragmentData, @ptrCast([*]u8, self) + @sizeOf(Udp6ReceiveData))[0..self.fragment_count];
|
||||
}
|
||||
};
|
||||
|
||||
pub const Udp6TransmitData = extern struct {
|
||||
udp6_session_data: ?*Udp6SessionData,
|
||||
data_length: u32,
|
||||
fragment_count: u32,
|
||||
|
||||
pub fn getFragments(self: *Udp6TransmitData) []Udp6FragmentData {
|
||||
return @ptrCast([*]Udp6FragmentData, @ptrCast([*]u8, self) + @sizeOf(Udp6TransmitData))[0..self.fragment_count];
|
||||
}
|
||||
};
|
||||
|
||||
pub const Udp6SessionData = extern struct {
|
||||
source_address: Ip6Address,
|
||||
source_port: u16,
|
||||
destination_address: Ip6Address,
|
||||
destination_port: u16,
|
||||
};
|
||||
|
||||
pub const Udp6FragmentData = extern struct {
|
||||
fragment_length: u32,
|
||||
fragment_buffer: [*]u8,
|
||||
};
|
25
lib/std/os/uefi/protocols/udp6_service_binding_protocol.zig
Normal file
25
lib/std/os/uefi/protocols/udp6_service_binding_protocol.zig
Normal file
@ -0,0 +1,25 @@
|
||||
const uefi = @import("std").os.uefi;
|
||||
const Handle = uefi.Handle;
|
||||
const Guid = uefi.Guid;
|
||||
|
||||
pub const Udp6ServiceBindingProtocol = extern struct {
|
||||
_create_child: extern fn (*const Udp6ServiceBindingProtocol, *?Handle) usize,
|
||||
_destroy_child: extern fn (*const Udp6ServiceBindingProtocol, Handle) usize,
|
||||
|
||||
pub fn createChild(self: *const Udp6ServiceBindingProtocol, handle: *?Handle) usize {
|
||||
return self._create_child(self, handle);
|
||||
}
|
||||
|
||||
pub fn destroyChild(self: *const Udp6ServiceBindingProtocol, handle: Handle) usize {
|
||||
return self._destroy_child(self, handle);
|
||||
}
|
||||
|
||||
pub const guid align(8) = Guid{
|
||||
.time_low = 0x66ed4721,
|
||||
.time_mid = 0x3c98,
|
||||
.time_high_and_version = 0x4d3e,
|
||||
.clock_seq_high_and_reserved = 0x81,
|
||||
.clock_seq_low = 0xe3,
|
||||
.node = [_]u8{ 0xd0, 0x3d, 0xd3, 0x9a, 0x72, 0x54 },
|
||||
};
|
||||
};
|
@ -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;
|
||||
|
@ -3,6 +3,7 @@ const Event = uefi.Event;
|
||||
const Guid = uefi.Guid;
|
||||
const Handle = uefi.Handle;
|
||||
const TableHeader = uefi.tables.TableHeader;
|
||||
const DevicePathProtocol = uefi.protocols.DevicePathProtocol;
|
||||
|
||||
/// Boot services are services provided by the system's firmware until the operating system takes
|
||||
/// over control over the hardware by calling exitBootServices.
|
||||
@ -17,56 +18,96 @@ const TableHeader = uefi.tables.TableHeader;
|
||||
/// As the boot_services table may grow with new UEFI versions, it is important to check hdr.header_size.
|
||||
pub const BootServices = extern struct {
|
||||
hdr: TableHeader,
|
||||
|
||||
raiseTpl: usize, // TODO
|
||||
restoreTpl: usize, // TODO
|
||||
allocatePages: usize, // TODO
|
||||
freePages: usize, // TODO
|
||||
|
||||
/// Returns the current memory map.
|
||||
getMemoryMap: extern fn (*usize, [*]MemoryDescriptor, *usize, *usize, *u32) usize,
|
||||
|
||||
/// 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,
|
||||
|
||||
/// Stops execution until an event is signaled.
|
||||
waitForEvent: extern fn (usize, [*]const Event, *usize) usize,
|
||||
|
||||
/// Signals an event.
|
||||
signalEvent: extern fn (Event) usize,
|
||||
|
||||
/// 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
|
||||
handleProtocol: usize, // TODO
|
||||
|
||||
/// Queries a handle to determine if it supports a specified protocol.
|
||||
handleProtocol: extern fn (Handle, *align(8) const Guid, *?*c_void) usize,
|
||||
|
||||
reserved: *c_void,
|
||||
|
||||
registerProtocolNotify: usize, // TODO
|
||||
locateHandle: usize, // TODO
|
||||
locateDevicePath: usize, // TODO
|
||||
installConfigurationTable: usize, // TODO
|
||||
imageLoad: usize, // TODO
|
||||
imageStart: usize, // TODO
|
||||
|
||||
/// Loads an EFI image into memory.
|
||||
loadImage: extern fn (bool, Handle, ?*const DevicePathProtocol, ?[*]const u8, usize, *?Handle) usize,
|
||||
|
||||
/// Transfers control to a loaded image's entry point.
|
||||
startImage: extern fn (Handle, ?*usize, ?*[*]u16) usize,
|
||||
|
||||
/// Terminates a loaded EFI image and returns control to boot services.
|
||||
exit: extern fn (Handle, usize, usize, ?*const c_void) usize,
|
||||
imageUnload: usize, // TODO
|
||||
|
||||
/// Unloads an image.
|
||||
unloadImage: extern fn (Handle) usize,
|
||||
|
||||
/// Terminates all boot services.
|
||||
exitBootServices: extern fn (Handle, usize) usize,
|
||||
|
||||
getNextMonotonicCount: usize, // TODO
|
||||
|
||||
/// Induces a fine-grained stall.
|
||||
stall: extern fn (usize) usize,
|
||||
|
||||
/// Sets the system's watchdog timer.
|
||||
setWatchdogTimer: extern fn (usize, u64, usize, ?[*]const u16) usize,
|
||||
|
||||
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,
|
||||
|
||||
installMultipleProtocolInterfaces: usize, // TODO
|
||||
uninstallMultipleProtocolInterfaces: usize, // TODO
|
||||
calculateCrc32: usize, // TODO
|
||||
@ -138,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,
|
||||
};
|
||||
|
@ -14,22 +14,30 @@ const TimeCapabilities = uefi.TimeCapabilities;
|
||||
/// Some functions may not be called while other functions are running.
|
||||
pub const RuntimeServices = extern struct {
|
||||
hdr: TableHeader,
|
||||
|
||||
/// Returns the current time and date information, and the time-keeping capabilities of the hardware platform.
|
||||
getTime: extern fn (*uefi.Time, ?*TimeCapabilities) usize,
|
||||
|
||||
setTime: usize, // TODO
|
||||
getWakeupTime: usize, // TODO
|
||||
setWakeupTime: usize, // TODO
|
||||
setVirtualAddressMap: usize, // TODO
|
||||
convertPointer: usize, // TODO
|
||||
|
||||
/// Returns the value of a variable.
|
||||
getVariable: extern fn ([*]const u16, *align(8) const Guid, ?*u32, *usize, ?*c_void) usize,
|
||||
|
||||
/// Enumerates the current variable names.
|
||||
getNextVariableName: extern fn (*usize, [*]u16, *align(8) Guid) usize,
|
||||
|
||||
/// Sets the value of a variable.
|
||||
setVariable: extern fn ([*]const u16, *align(8) const Guid, u32, usize, *c_void) usize,
|
||||
|
||||
getNextHighMonotonicCount: usize, // TODO
|
||||
|
||||
/// Resets the entire platform.
|
||||
resetSystem: extern fn (ResetType, usize, usize, ?*const c_void) noreturn,
|
||||
|
||||
updateCapsule: usize, // TODO
|
||||
queryCapsuleCapabilities: usize, // TODO
|
||||
queryVariableInfo: usize, // TODO
|
||||
|
@ -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…
x
Reference in New Issue
Block a user