| author | |
| committer | |
| log | c7fd414dab3c69819c6528e8dcbb9de8ab17cdf9 |
| tree | 941a72a599ee3048dd29d5a61b21c855199a2dc7 |
| parent | 6ee3cabe5cc0b2c9af30b1fa0233381faa18e700 |
| parent | 78b54d9c96c84e286b20a2a144eca0b9ddc3fba5 |
| signature |
UEFI improvements15 files changed, 857 insertions(+), 11 deletions(-)
lib/std/os/uefi/protocols.zig+44| ... | ... | @@ -1,3 +1,7 @@ |
| 1 | pub const LoadedImageProtocol = @import("protocols/loaded_image_protocol.zig").LoadedImageProtocol; | |
| 2 | ||
| 3 | pub const DevicePathProtocol = @import("protocols/device_path_protocol.zig").DevicePathProtocol; | |
| 4 | ||
| 1 | 5 | pub const InputKey = @import("protocols/simple_text_input_ex_protocol.zig").InputKey; |
| 2 | 6 | pub const KeyData = @import("protocols/simple_text_input_ex_protocol.zig").KeyData; |
| 3 | 7 | 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 |
| 29 | 33 | pub const EdidOverrideProtocol = @import("protocols/edid_override_protocol.zig").EdidOverrideProtocol; |
| 30 | 34 | pub const EdidOverrideProtocolAttributes = @import("protocols/edid_override_protocol.zig").EdidOverrideProtocolAttributes; |
| 31 | 35 | |
| 36 | pub const SimpleNetworkProtocol = @import("protocols/simple_network_protocol.zig").SimpleNetworkProtocol; | |
| 37 | pub const MacAddress = @import("protocols/simple_network_protocol.zig").MacAddress; | |
| 38 | pub const SimpleNetworkMode = @import("protocols/simple_network_protocol.zig").SimpleNetworkMode; | |
| 39 | pub const SimpleNetworkReceiveFilter = @import("protocols/simple_network_protocol.zig").SimpleNetworkReceiveFilter; | |
| 40 | pub const SimpleNetworkState = @import("protocols/simple_network_protocol.zig").SimpleNetworkState; | |
| 41 | pub const NetworkStatistics = @import("protocols/simple_network_protocol.zig").NetworkStatistics; | |
| 42 | pub const SimpleNetworkInterruptStatus = @import("protocols/simple_network_protocol.zig").SimpleNetworkInterruptStatus; | |
| 43 | ||
| 44 | pub const ManagedNetworkServiceBindingProtocol = @import("protocols/managed_network_service_binding_protocol.zig").ManagedNetworkServiceBindingProtocol; | |
| 45 | pub const ManagedNetworkProtocol = @import("protocols/managed_network_protocol.zig").ManagedNetworkProtocol; | |
| 46 | pub const ManagedNetworkConfigData = @import("protocols/managed_network_protocol.zig").ManagedNetworkConfigData; | |
| 47 | pub const ManagedNetworkCompletionToken = @import("protocols/managed_network_protocol.zig").ManagedNetworkCompletionToken; | |
| 48 | pub const ManagedNetworkReceiveData = @import("protocols/managed_network_protocol.zig").ManagedNetworkReceiveData; | |
| 49 | pub const ManagedNetworkTransmitData = @import("protocols/managed_network_protocol.zig").ManagedNetworkTransmitData; | |
| 50 | pub const ManagedNetworkFragmentData = @import("protocols/managed_network_protocol.zig").ManagedNetworkFragmentData; | |
| 51 | ||
| 52 | pub const Ip6ServiceBindingProtocol = @import("protocols/ip6_service_binding_protocol.zig").Ip6ServiceBindingProtocol; | |
| 53 | pub const Ip6Protocol = @import("protocols/ip6_protocol.zig").Ip6Protocol; | |
| 54 | pub const Ip6ModeData = @import("protocols/ip6_protocol.zig").Ip6ModeData; | |
| 55 | pub const Ip6ConfigData = @import("protocols/ip6_protocol.zig").Ip6ConfigData; | |
| 56 | pub const Ip6Address = @import("protocols/ip6_protocol.zig").Ip6Address; | |
| 57 | pub const Ip6AddressInfo = @import("protocols/ip6_protocol.zig").Ip6AddressInfo; | |
| 58 | pub const Ip6RouteTable = @import("protocols/ip6_protocol.zig").Ip6RouteTable; | |
| 59 | pub const Ip6NeighborState = @import("protocols/ip6_protocol.zig").Ip6NeighborState; | |
| 60 | pub const Ip6NeighborCache = @import("protocols/ip6_protocol.zig").Ip6NeighborCache; | |
| 61 | pub const Ip6IcmpType = @import("protocols/ip6_protocol.zig").Ip6IcmpType; | |
| 62 | pub const Ip6CompletionToken = @import("protocols/ip6_protocol.zig").Ip6CompletionToken; | |
| 63 | ||
| 64 | pub const Ip6ConfigProtocol = @import("protocols/ip6_config_protocol.zig").Ip6ConfigProtocol; | |
| 65 | pub const Ip6ConfigDataType = @import("protocols/ip6_config_protocol.zig").Ip6ConfigDataType; | |
| 66 | ||
| 67 | pub const Udp6ServiceBindingProtocol = @import("protocols/udp6_service_binding_protocol.zig").Udp6ServiceBindingProtocol; | |
| 68 | pub const Udp6Protocol = @import("protocols/udp6_protocol.zig").Udp6Protocol; | |
| 69 | pub const Udp6ConfigData = @import("protocols/udp6_protocol.zig").Udp6ConfigData; | |
| 70 | pub const Udp6CompletionToken = @import("protocols/udp6_protocol.zig").Udp6CompletionToken; | |
| 71 | pub const Udp6ReceiveData = @import("protocols/udp6_protocol.zig").Udp6ReceiveData; | |
| 72 | pub const Udp6TransmitData = @import("protocols/udp6_protocol.zig").Udp6TransmitData; | |
| 73 | pub const Udp6SessionData = @import("protocols/udp6_protocol.zig").Udp6SessionData; | |
| 74 | pub const Udp6FragmentData = @import("protocols/udp6_protocol.zig").Udp6FragmentData; | |
| 75 | ||
| 32 | 76 | pub const hii = @import("protocols/hii.zig"); |
| 33 | 77 | pub const HIIDatabaseProtocol = @import("protocols/hii_database_protocol.zig").HIIDatabaseProtocol; |
| 34 | 78 | pub const HIIPopupProtocol = @import("protocols/hii_popup_protocol.zig").HIIPopupProtocol; |
lib/std/os/uefi/protocols/device_path_protocol.zig created+17| ... | ... | @@ -0,0 +1,17 @@ |
| 1 | const uefi = @import("std").os.uefi; | |
| 2 | const Guid = uefi.Guid; | |
| 3 | ||
| 4 | pub const DevicePathProtocol = extern struct { | |
| 5 | type: u8, | |
| 6 | subtype: u8, | |
| 7 | length: u16, | |
| 8 | ||
| 9 | pub const guid align(8) = Guid{ | |
| 10 | .time_low = 0x09576e91, | |
| 11 | .time_mid = 0x6d3f, | |
| 12 | .time_high_and_version = 0x11d2, | |
| 13 | .clock_seq_high_and_reserved = 0x8e, | |
| 14 | .clock_seq_low = 0x39, | |
| 15 | .node = [_]u8{ 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b }, | |
| 16 | }; | |
| 17 | }; |
lib/std/os/uefi/protocols/ip6_config_protocol.zig created+45| ... | ... | @@ -0,0 +1,45 @@ |
| 1 | const uefi = @import("std").os.uefi; | |
| 2 | const Guid = uefi.Guid; | |
| 3 | const Event = uefi.Event; | |
| 4 | ||
| 5 | pub const Ip6ConfigProtocol = extern struct { | |
| 6 | _set_data: extern fn (*const Ip6ConfigProtocol, Ip6ConfigDataType, usize, *const c_void) usize, | |
| 7 | _get_data: extern fn (*const Ip6ConfigProtocol, Ip6ConfigDataType, *usize, ?*const c_void) usize, | |
| 8 | _register_data_notify: extern fn (*const Ip6ConfigProtocol, Ip6ConfigDataType, Event) usize, | |
| 9 | _unregister_data_notify: extern fn (*const Ip6ConfigProtocol, Ip6ConfigDataType, Event) usize, | |
| 10 | ||
| 11 | pub fn setData(self: *const Ip6ConfigProtocol, data_type: Ip6ConfigDataType, data_size: usize, data: *const c_void) usize { | |
| 12 | return self._set_data(self, data_type, data_size, data); | |
| 13 | } | |
| 14 | ||
| 15 | pub fn getData(self: *const Ip6ConfigProtocol, data_type: Ip6ConfigDataType, data_size: *usize, data: ?*const c_void) usize { | |
| 16 | return self._get_data(self, data_type, data_size, data); | |
| 17 | } | |
| 18 | ||
| 19 | pub fn registerDataNotify(self: *const Ip6ConfigProtocol, data_type: Ip6ConfigDataType, event: Event) usize { | |
| 20 | return self._register_data_notify(self, data_type, event); | |
| 21 | } | |
| 22 | ||
| 23 | pub fn unregisterDataNotify(self: *const Ip6ConfigProtocol, data_type: Ip6ConfigDataType, event: Event) usize { | |
| 24 | return self._unregister_data_notify(self, data_type, event); | |
| 25 | } | |
| 26 | ||
| 27 | pub const guid align(8) = Guid{ | |
| 28 | .time_low = 0x937fe521, | |
| 29 | .time_mid = 0x95ae, | |
| 30 | .time_high_and_version = 0x4d1a, | |
| 31 | .clock_seq_high_and_reserved = 0x89, | |
| 32 | .clock_seq_low = 0x29, | |
| 33 | .node = [_]u8{ 0x48, 0xbc, 0xd9, 0x0a, 0xd3, 0x1a }, | |
| 34 | }; | |
| 35 | }; | |
| 36 | ||
| 37 | pub const Ip6ConfigDataType = extern enum(u32) { | |
| 38 | InterfaceInfo, | |
| 39 | AltInterfaceId, | |
| 40 | Policy, | |
| 41 | DupAddrDetectTransmits, | |
| 42 | ManualAddress, | |
| 43 | Gateway, | |
| 44 | DnsServer, | |
| 45 | }; |
lib/std/os/uefi/protocols/ip6_protocol.zig created+143| ... | ... | @@ -0,0 +1,143 @@ |
| 1 | const uefi = @import("std").os.uefi; | |
| 2 | const Guid = uefi.Guid; | |
| 3 | const Event = uefi.Event; | |
| 4 | const MacAddress = uefi.protocols.MacAddress; | |
| 5 | const ManagedNetworkConfigData = uefi.protocols.ManagedNetworkConfigData; | |
| 6 | const SimpleNetworkMode = uefi.protocols.SimpleNetworkMode; | |
| 7 | ||
| 8 | pub const Ip6Protocol = extern struct { | |
| 9 | _get_mode_data: extern fn (*const Ip6Protocol, ?*Ip6ModeData, ?*ManagedNetworkConfigData, ?*SimpleNetworkMode) usize, | |
| 10 | _configure: extern fn (*const Ip6Protocol, ?*const Ip6ConfigData) usize, | |
| 11 | _groups: extern fn (*const Ip6Protocol, bool, ?*const Ip6Address) usize, | |
| 12 | _routes: extern fn (*const Ip6Protocol, bool, ?*const Ip6Address, u8, ?*const Ip6Address) usize, | |
| 13 | _neighbors: extern fn (*const Ip6Protocol, bool, *const Ip6Address, ?*const MacAddress, u32, bool) usize, | |
| 14 | _transmit: extern fn (*const Ip6Protocol, *Ip6CompletionToken) usize, | |
| 15 | _receive: extern fn (*const Ip6Protocol, *Ip6CompletionToken) usize, | |
| 16 | _cancel: extern fn (*const Ip6Protocol, ?*Ip6CompletionToken) usize, | |
| 17 | _poll: extern fn (*const Ip6Protocol) usize, | |
| 18 | ||
| 19 | /// Gets the current operational settings for this instance of the EFI IPv6 Protocol driver. | |
| 20 | pub fn getModeData(self: *const Ip6Protocol, ip6_mode_data: ?*Ip6ModeData, mnp_config_data: ?*ManagedNetworkConfigData, snp_mode_data: ?*SimpleNetworkMode) usize { | |
| 21 | return self._get_mode_data(self, ip6_mode_data, mnp_config_data, snp_mode_data); | |
| 22 | } | |
| 23 | ||
| 24 | /// Assign IPv6 address and other configuration parameter to this EFI IPv6 Protocol driver instance. | |
| 25 | pub fn configure(self: *const Ip6Protocol, ip6_config_data: ?*const Ip6ConfigData) usize { | |
| 26 | return self._configure(self, ip6_config_data); | |
| 27 | } | |
| 28 | ||
| 29 | /// Joins and leaves multicast groups. | |
| 30 | pub fn groups(self: *const Ip6Protocol, join_flag: bool, group_address: ?*const Ip6Address) usize { | |
| 31 | return self._groups(self, join_flag, group_address); | |
| 32 | } | |
| 33 | ||
| 34 | /// Adds and deletes routing table entries. | |
| 35 | pub fn routes(self: *const Ip6Protocol, delete_route: bool, destination: ?*const Ip6Address, prefix_length: u8, gateway_address: ?*const Ip6Address) usize { | |
| 36 | return self._routes(self, delete_route, destination, prefix_length, gateway_address); | |
| 37 | } | |
| 38 | ||
| 39 | /// Add or delete Neighbor cache entries. | |
| 40 | pub fn neighbors(self: *const Ip6Protocol, delete_flag: bool, target_ip6_address: *const Ip6Address, target_link_address: ?*const MacAddress, timeout: u32, override: bool) usize { | |
| 41 | return self._neighbors(self, delete_flag, target_ip6_address, target_link_address, timeout, override); | |
| 42 | } | |
| 43 | ||
| 44 | /// Places outgoing data packets into the transmit queue. | |
| 45 | pub fn transmit(self: *const Ip6Protocol, token: *Ip6CompletionToken) usize { | |
| 46 | return self._transmit(self, token); | |
| 47 | } | |
| 48 | ||
| 49 | /// Places a receiving request into the receiving queue. | |
| 50 | pub fn receive(self: *const Ip6Protocol, token: *Ip6CompletionToken) usize { | |
| 51 | return self._receive(self, token); | |
| 52 | } | |
| 53 | ||
| 54 | /// Abort an asynchronous transmits or receive request. | |
| 55 | pub fn cancel(self: *const Ip6Protocol, token: ?*Ip6CompletionToken) usize { | |
| 56 | return self._cancel(self, token); | |
| 57 | } | |
| 58 | ||
| 59 | /// Polls for incoming data packets and processes outgoing data packets. | |
| 60 | pub fn poll(self: *const Ip6Protocol) usize { | |
| 61 | return self._poll(self); | |
| 62 | } | |
| 63 | ||
| 64 | pub const guid align(8) = Guid{ | |
| 65 | .time_low = 0x2c8759d5, | |
| 66 | .time_mid = 0x5c2d, | |
| 67 | .time_high_and_version = 0x66ef, | |
| 68 | .clock_seq_high_and_reserved = 0x92, | |
| 69 | .clock_seq_low = 0x5f, | |
| 70 | .node = [_]u8{ 0xb6, 0x6c, 0x10, 0x19, 0x57, 0xe2 }, | |
| 71 | }; | |
| 72 | }; | |
| 73 | ||
| 74 | pub const Ip6ModeData = extern struct { | |
| 75 | is_started: bool, | |
| 76 | max_packet_size: u32, | |
| 77 | config_data: Ip6ConfigData, | |
| 78 | is_configured: bool, | |
| 79 | address_count: u32, | |
| 80 | address_list: [*]Ip6AddressInfo, | |
| 81 | group_count: u32, | |
| 82 | group_table: [*]Ip6Address, | |
| 83 | route_count: u32, | |
| 84 | route_table: [*]Ip6RouteTable, | |
| 85 | neighbor_count: u32, | |
| 86 | neighbor_cache: [*]Ip6NeighborCache, | |
| 87 | prefix_count: u32, | |
| 88 | prefix_table: [*]Ip6AddressInfo, | |
| 89 | icmp_type_count: u32, | |
| 90 | icmp_type_list: [*]Ip6IcmpType, | |
| 91 | }; | |
| 92 | ||
| 93 | pub const Ip6ConfigData = extern struct { | |
| 94 | default_protocol: u8, | |
| 95 | accept_any_protocol: bool, | |
| 96 | accept_icmp_errors: bool, | |
| 97 | accept_promiscuous: bool, | |
| 98 | destination_address: Ip6Address, | |
| 99 | station_address: Ip6Address, | |
| 100 | traffic_class: u8, | |
| 101 | hop_limit: u8, | |
| 102 | flow_label: u32, | |
| 103 | receive_timeout: u32, | |
| 104 | transmit_timeout: u32, | |
| 105 | }; | |
| 106 | ||
| 107 | pub const Ip6Address = [16]u8; | |
| 108 | ||
| 109 | pub const Ip6AddressInfo = extern struct { | |
| 110 | address: Ip6Address, | |
| 111 | prefix_length: u8, | |
| 112 | }; | |
| 113 | ||
| 114 | pub const Ip6RouteTable = extern struct { | |
| 115 | gateway: Ip6Address, | |
| 116 | destination: Ip6Address, | |
| 117 | prefix_length: u8, | |
| 118 | }; | |
| 119 | ||
| 120 | pub const Ip6NeighborState = extern enum(u32) { | |
| 121 | Incomplete, | |
| 122 | Reachable, | |
| 123 | Stale, | |
| 124 | Delay, | |
| 125 | Probe, | |
| 126 | }; | |
| 127 | ||
| 128 | pub const Ip6NeighborCache = extern struct { | |
| 129 | neighbor: Ip6Address, | |
| 130 | link_address: MacAddress, | |
| 131 | state: Ip6NeighborState, | |
| 132 | }; | |
| 133 | ||
| 134 | pub const Ip6IcmpType = extern struct { | |
| 135 | type: u8, | |
| 136 | code: u8, | |
| 137 | }; | |
| 138 | ||
| 139 | pub const Ip6CompletionToken = extern struct { | |
| 140 | event: Event, | |
| 141 | status: usize, | |
| 142 | packet: *c_void, // union TODO | |
| 143 | }; |
lib/std/os/uefi/protocols/ip6_service_binding_protocol.zig created+25| ... | ... | @@ -0,0 +1,25 @@ |
| 1 | const uefi = @import("std").os.uefi; | |
| 2 | const Handle = uefi.Handle; | |
| 3 | const Guid = uefi.Guid; | |
| 4 | ||
| 5 | pub const Ip6ServiceBindingProtocol = extern struct { | |
| 6 | _create_child: extern fn (*const Ip6ServiceBindingProtocol, *?Handle) usize, | |
| 7 | _destroy_child: extern fn (*const Ip6ServiceBindingProtocol, Handle) usize, | |
| 8 | ||
| 9 | pub fn createChild(self: *const Ip6ServiceBindingProtocol, handle: *?Handle) usize { | |
| 10 | return self._create_child(self, handle); | |
| 11 | } | |
| 12 | ||
| 13 | pub fn destroyChild(self: *const Ip6ServiceBindingProtocol, handle: Handle) usize { | |
| 14 | return self._destroy_child(self, handle); | |
| 15 | } | |
| 16 | ||
| 17 | pub const guid align(8) = Guid{ | |
| 18 | .time_low = 0xec835dd3, | |
| 19 | .time_mid = 0xfe0f, | |
| 20 | .time_high_and_version = 0x617b, | |
| 21 | .clock_seq_high_and_reserved = 0xa6, | |
| 22 | .clock_seq_low = 0x21, | |
| 23 | .node = [_]u8{ 0xb3, 0x50, 0xc3, 0xe1, 0x33, 0x88 }, | |
| 24 | }; | |
| 25 | }; |
lib/std/os/uefi/protocols/loaded_image_protocol.zig created+36| ... | ... | @@ -0,0 +1,36 @@ |
| 1 | const uefi = @import("std").os.uefi; | |
| 2 | const Guid = uefi.Guid; | |
| 3 | const Handle = uefi.Handle; | |
| 4 | const SystemTable = uefi.tables.SystemTable; | |
| 5 | const MemoryType = uefi.tables.MemoryType; | |
| 6 | const DevicePathProtocol = uefi.protocols.DevicePathProtocol; | |
| 7 | ||
| 8 | pub const LoadedImageProtocol = extern struct { | |
| 9 | revision: u32, | |
| 10 | parent_handle: Handle, | |
| 11 | system_table: *SystemTable, | |
| 12 | device_handle: ?Handle, | |
| 13 | file_path: *DevicePathProtocol, | |
| 14 | reserved: *c_void, | |
| 15 | load_options_size: u32, | |
| 16 | load_options: *c_void, | |
| 17 | image_base: [*]u8, | |
| 18 | image_size: u64, | |
| 19 | image_code_type: MemoryType, | |
| 20 | image_data_type: MemoryType, | |
| 21 | _unload: extern fn (*const LoadedImageProtocol, Handle) usize, | |
| 22 | ||
| 23 | /// Unloads an image from memory. | |
| 24 | pub fn unload(self: *const LoadedImageProtocol, handle: Handle) usize { | |
| 25 | return self._unload(self, handle); | |
| 26 | } | |
| 27 | ||
| 28 | pub const guid align(8) = Guid{ | |
| 29 | .time_low = 0x5b1b31a1, | |
| 30 | .time_mid = 0x9562, | |
| 31 | .time_high_and_version = 0x11d2, | |
| 32 | .clock_seq_high_and_reserved = 0x8e, | |
| 33 | .clock_seq_low = 0x3f, | |
| 34 | .node = [_]u8{ 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b }, | |
| 35 | }; | |
| 36 | }; |
lib/std/os/uefi/protocols/managed_network_protocol.zig created+126| ... | ... | @@ -0,0 +1,126 @@ |
| 1 | const uefi = @import("std").os.uefi; | |
| 2 | const Guid = uefi.Guid; | |
| 3 | const Event = uefi.Event; | |
| 4 | const Time = uefi.Time; | |
| 5 | const SimpleNetworkMode = uefi.protocols.SimpleNetworkMode; | |
| 6 | const MacAddress = uefi.protocols.MacAddress; | |
| 7 | ||
| 8 | pub const ManagedNetworkProtocol = extern struct { | |
| 9 | _get_mode_data: extern fn (*const ManagedNetworkProtocol, ?*ManagedNetworkConfigData, ?*SimpleNetworkMode) usize, | |
| 10 | _configure: extern fn (*const ManagedNetworkProtocol, ?*const ManagedNetworkConfigData) usize, | |
| 11 | _mcast_ip_to_mac: extern fn (*const ManagedNetworkProtocol, bool, *const c_void, *MacAddress) usize, | |
| 12 | _groups: extern fn (*const ManagedNetworkProtocol, bool, ?*const MacAddress) usize, | |
| 13 | _transmit: extern fn (*const ManagedNetworkProtocol, *const ManagedNetworkCompletionToken) usize, | |
| 14 | _receive: extern fn (*const ManagedNetworkProtocol, *const ManagedNetworkCompletionToken) usize, | |
| 15 | _cancel: extern fn (*const ManagedNetworkProtocol, ?*const ManagedNetworkCompletionToken) usize, | |
| 16 | _poll: extern fn (*const ManagedNetworkProtocol) usize, | |
| 17 | ||
| 18 | /// Returns the operational parameters for the current MNP child driver. | |
| 19 | /// May also support returning the underlying SNP driver mode data. | |
| 20 | pub fn getModeData(self: *const ManagedNetworkProtocol, mnp_config_data: ?*ManagedNetworkConfigData, snp_mode_data: ?*SimpleNetworkMode) usize { | |
| 21 | return self._get_mode_data(self, mnp_config_data, snp_mode_data); | |
| 22 | } | |
| 23 | ||
| 24 | /// Sets or clears the operational parameters for the MNP child driver. | |
| 25 | pub fn configure(self: *const ManagedNetworkProtocol, mnp_config_data: ?*const ManagedNetworkConfigData) usize { | |
| 26 | return self._configure(self, mnp_config_data); | |
| 27 | } | |
| 28 | ||
| 29 | /// Translates an IP multicast address to a hardware (MAC) multicast address. | |
| 30 | /// This function may be unsupported in some MNP implementations. | |
| 31 | pub fn mcastIpToMac(self: *const ManagedNetworkProtocol, ipv6flag: bool, ipaddress: *const c_void, mac_address: *MacAddress) usize { | |
| 32 | return self._mcast_ip_to_mac(self, ipv6flag, ipaddress); | |
| 33 | } | |
| 34 | ||
| 35 | /// Enables and disables receive filters for multicast address. | |
| 36 | /// This function may be unsupported in some MNP implementations. | |
| 37 | pub fn groups(self: *const ManagedNetworkProtocol, join_flag: bool, mac_address: ?*const MacAddress) usiz { | |
| 38 | return self._groups(self, join_flag, mac_address); | |
| 39 | } | |
| 40 | ||
| 41 | /// Places asynchronous outgoing data packets into the transmit queue. | |
| 42 | pub fn transmit(self: *const ManagedNetworkProtocol, token: *const ManagedNetworkCompletionToken) usize { | |
| 43 | return self._transmit(self, token); | |
| 44 | } | |
| 45 | ||
| 46 | /// Places an asynchronous receiving request into the receiving queue. | |
| 47 | pub fn receive(self: *const ManagedNetworkProtocol, token: *const ManagedNetworkCompletionToken) usize { | |
| 48 | return self._receive(self, token); | |
| 49 | } | |
| 50 | ||
| 51 | /// Aborts an asynchronous transmit or receive request. | |
| 52 | pub fn cancel(self: *const ManagedNetworkProtocol, token: ?*const ManagedNetworkCompletionToken) usize { | |
| 53 | return self._cancel(self, token); | |
| 54 | } | |
| 55 | ||
| 56 | /// Polls for incoming data packets and processes outgoing data packets. | |
| 57 | pub fn poll(self: *const ManagedNetworkProtocol) usize { | |
| 58 | return self._poll(self); | |
| 59 | } | |
| 60 | ||
| 61 | pub const guid align(8) = Guid{ | |
| 62 | .time_low = 0x7ab33a91, | |
| 63 | .time_mid = 0xace5, | |
| 64 | .time_high_and_version = 0x4326, | |
| 65 | .clock_seq_high_and_reserved = 0xb5, | |
| 66 | .clock_seq_low = 0x72, | |
| 67 | .node = [_]u8{ 0xe7, 0xee, 0x33, 0xd3, 0x9f, 0x16 }, | |
| 68 | }; | |
| 69 | }; | |
| 70 | ||
| 71 | pub const ManagedNetworkConfigData = extern struct { | |
| 72 | received_queue_timeout_value: u32, | |
| 73 | transmit_queue_timeout_value: u32, | |
| 74 | protocol_type_filter: u16, | |
| 75 | enable_unicast_receive: bool, | |
| 76 | enable_multicast_receive: bool, | |
| 77 | enable_broadcast_receive: bool, | |
| 78 | enable_promiscuous_receive: bool, | |
| 79 | flush_queues_on_reset: bool, | |
| 80 | enable_receive_timestamps: bool, | |
| 81 | disable_background_polling: bool, | |
| 82 | }; | |
| 83 | ||
| 84 | pub const ManagedNetworkCompletionToken = extern struct { | |
| 85 | event: Event, | |
| 86 | status: usize, | |
| 87 | packet: extern union { | |
| 88 | RxData: *ManagedNetworkReceiveData, | |
| 89 | TxData: *ManagedNetworkTransmitData, | |
| 90 | }, | |
| 91 | }; | |
| 92 | ||
| 93 | pub const ManagedNetworkReceiveData = extern struct { | |
| 94 | timestamp: Time, | |
| 95 | recycle_event: Event, | |
| 96 | packet_length: u32, | |
| 97 | header_length: u32, | |
| 98 | address_length: u32, | |
| 99 | data_length: u32, | |
| 100 | broadcast_flag: bool, | |
| 101 | multicast_flag: bool, | |
| 102 | promiscuous_flag: bool, | |
| 103 | protocol_type: u16, | |
| 104 | destination_address: [*]u8, | |
| 105 | source_address: [*]u8, | |
| 106 | media_header: [*]u8, | |
| 107 | packet_data: [*]u8, | |
| 108 | }; | |
| 109 | ||
| 110 | pub const ManagedNetworkTransmitData = extern struct { | |
| 111 | destination_address: ?*MacAddress, | |
| 112 | source_address: ?*MacAddress, | |
| 113 | protocol_type: u16, | |
| 114 | data_length: u32, | |
| 115 | header_length: u16, | |
| 116 | fragment_count: u16, | |
| 117 | ||
| 118 | pub fn getFragments(self: *ManagedNetworkTransmitData) []ManagedNetworkFragmentData { | |
| 119 | return @ptrCast([*]ManagedNetworkFragmentData, @ptrCast([*]u8, self) + @sizeOf(ManagedNetworkTransmitData))[0..self.fragment_count]; | |
| 120 | } | |
| 121 | }; | |
| 122 | ||
| 123 | pub const ManagedNetworkFragmentData = extern struct { | |
| 124 | fragment_length: u32, | |
| 125 | fragment_buffer: [*]u8, | |
| 126 | }; |
lib/std/os/uefi/protocols/managed_network_service_binding_protocol.zig created+25| ... | ... | @@ -0,0 +1,25 @@ |
| 1 | const uefi = @import("std").os.uefi; | |
| 2 | const Handle = uefi.Handle; | |
| 3 | const Guid = uefi.Guid; | |
| 4 | ||
| 5 | pub const ManagedNetworkServiceBindingProtocol = extern struct { | |
| 6 | _create_child: extern fn (*const ManagedNetworkServiceBindingProtocol, *?Handle) usize, | |
| 7 | _destroy_child: extern fn (*const ManagedNetworkServiceBindingProtocol, Handle) usize, | |
| 8 | ||
| 9 | pub fn createChild(self: *const ManagedNetworkServiceBindingProtocol, handle: *?Handle) usize { | |
| 10 | return self._create_child(self, handle); | |
| 11 | } | |
| 12 | ||
| 13 | pub fn destroyChild(self: *const ManagedNetworkServiceBindingProtocol, handle: Handle) usize { | |
| 14 | return self._destroy_child(self, handle); | |
| 15 | } | |
| 16 | ||
| 17 | pub const guid align(8) = Guid{ | |
| 18 | .time_low = 0xf36ff770, | |
| 19 | .time_mid = 0xa7e1, | |
| 20 | .time_high_and_version = 0x42cf, | |
| 21 | .clock_seq_high_and_reserved = 0x9e, | |
| 22 | .clock_seq_low = 0xd2, | |
| 23 | .node = [_]u8{ 0x56, 0xf0, 0xf2, 0x71, 0xf4, 0x4c }, | |
| 24 | }; | |
| 25 | }; |
lib/std/os/uefi/protocols/simple_network_protocol.zig created+172| ... | ... | @@ -0,0 +1,172 @@ |
| 1 | const uefi = @import("std").os.uefi; | |
| 2 | const Event = uefi.Event; | |
| 3 | const Guid = uefi.Guid; | |
| 4 | ||
| 5 | pub const SimpleNetworkProtocol = extern struct { | |
| 6 | revision: u64, | |
| 7 | _start: extern fn (*const SimpleNetworkProtocol) usize, | |
| 8 | _stop: extern fn (*const SimpleNetworkProtocol) usize, | |
| 9 | _initialize: extern fn (*const SimpleNetworkProtocol, usize, usize) usize, | |
| 10 | _reset: extern fn (*const SimpleNetworkProtocol, bool) usize, | |
| 11 | _shutdown: extern fn (*const SimpleNetworkProtocol) usize, | |
| 12 | _receive_filters: extern fn (*const SimpleNetworkProtocol, SimpleNetworkReceiveFilter, SimpleNetworkReceiveFilter, bool, usize, ?[*]const MacAddress) usize, | |
| 13 | _station_address: extern fn (*const SimpleNetworkProtocol, bool, ?*const MacAddress) usize, | |
| 14 | _statistics: extern fn (*const SimpleNetworkProtocol, bool, ?*usize, ?*NetworkStatistics) usize, | |
| 15 | _mcast_ip_to_mac: extern fn (*const SimpleNetworkProtocol, bool, *const c_void, *MacAddress) usize, | |
| 16 | _nvdata: extern fn (*const SimpleNetworkProtocol, bool, usize, usize, [*]u8) usize, | |
| 17 | _get_status: extern fn (*const SimpleNetworkProtocol, *SimpleNetworkInterruptStatus, ?*?[*]u8) usize, | |
| 18 | _transmit: extern fn (*const SimpleNetworkProtocol, usize, usize, [*]const u8, ?*const MacAddress, ?*const MacAddress, ?*const u16) usize, | |
| 19 | _receive: extern fn (*const SimpleNetworkProtocol, ?*usize, *usize, [*]u8, ?*MacAddress, ?*MacAddress, ?*u16) usize, | |
| 20 | wait_for_packet: Event, | |
| 21 | mode: *SimpleNetworkMode, | |
| 22 | ||
| 23 | /// Changes the state of a network interface from "stopped" to "started". | |
| 24 | pub fn start(self: *const SimpleNetworkProtocol) usize { | |
| 25 | return self._start(self); | |
| 26 | } | |
| 27 | ||
| 28 | /// Changes the state of a network interface from "started" to "stopped". | |
| 29 | pub fn stop(self: *const SimpleNetworkProtocol) usize { | |
| 30 | return self._stop(self); | |
| 31 | } | |
| 32 | ||
| 33 | /// Resets a network adapter and allocates the transmit and receive buffers required by the network interface. | |
| 34 | pub fn initialize(self: *const SimpleNetworkProtocol, extra_rx_buffer_size: usize, extra_tx_buffer_size: usize) usize { | |
| 35 | return self._initialize(self, extra_rx_buffer_size, extra_tx_buffer_size); | |
| 36 | } | |
| 37 | ||
| 38 | /// Resets a network adapter and reinitializes it with the parameters that were provided in the previous call to initialize(). | |
| 39 | pub fn reset(self: *const SimpleNetworkProtocol, extended_verification: bool) usize { | |
| 40 | return self._reset(self, extended_verification); | |
| 41 | } | |
| 42 | ||
| 43 | /// Resets a network adapter and leaves it in a state that is safe for another driver to initialize. | |
| 44 | pub fn shutdown(self: *const SimpleNetworkProtocol) usize { | |
| 45 | return self._shutdown(self); | |
| 46 | } | |
| 47 | ||
| 48 | /// Manages the multicast receive filters of a network interface. | |
| 49 | pub fn receiveFilters(self: *const SimpleNetworkProtocol, enable: SimpleNetworkReceiveFilter, disable: SimpleNetworkReceiveFilter, reset_mcast_filter: bool, mcast_filter_cnt: usize, mcast_filter: ?[*]const MacAddress) usize { | |
| 50 | return self._receive_filters(self, enable, disable, reset_mcast_filter, mcast_filter_cnt, mcast_filter); | |
| 51 | } | |
| 52 | ||
| 53 | /// Modifies or resets the current station address, if supported. | |
| 54 | pub fn stationAddress(self: *const SimpleNetworkProtocol, reset: bool, new: ?*const MacAddress) usize { | |
| 55 | return self._station_address(self, reset, new); | |
| 56 | } | |
| 57 | ||
| 58 | /// Resets or collects the statistics on a network interface. | |
| 59 | pub fn statistics(self: *const SimpleNetworkProtocol, reset_: bool, statistics_size: ?*usize, statistics_table: ?*NetworkStatistics) usize { | |
| 60 | return self._statistics(self, reset_, statistics_size, statistics_table); | |
| 61 | } | |
| 62 | ||
| 63 | /// Converts a multicast IP address to a multicast HW MAC address. | |
| 64 | pub fn mcastIpToMac(self: *const SimpleNetworkProtocol, ipv6: bool, ip: *const c_void, mac: *MacAddress) usize { | |
| 65 | return self._mcast_ip_to_mac(self, ipv6, ip, mac); | |
| 66 | } | |
| 67 | ||
| 68 | /// Performs read and write operations on the NVRAM device attached to a network interface. | |
| 69 | pub fn nvdata(self: *const SimpleNetworkProtocol, read_write: bool, offset: usize, buffer_size: usize, buffer: [*]u8) usize { | |
| 70 | return self._nvdata(self, read_write, offset, buffer_size, buffer); | |
| 71 | } | |
| 72 | ||
| 73 | /// Reads the current interrupt status and recycled transmit buffer status from a network interface. | |
| 74 | pub fn getStatus(self: *const SimpleNetworkProtocol, interrupt_status: *SimpleNetworkInterruptStatus, tx_buf: ?*?[*]u8) usize { | |
| 75 | return self._get_status(self, interrupt_status, tx_buf); | |
| 76 | } | |
| 77 | ||
| 78 | /// Places a packet in the transmit queue of a network interface. | |
| 79 | 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 { | |
| 80 | return self._transmit(self, header_size, buffer_size, buffer, src_addr, dest_addr, protocol); | |
| 81 | } | |
| 82 | ||
| 83 | /// Receives a packet from a network interface. | |
| 84 | pub fn receive(self: *const SimpleNetworkProtocol, header_size: ?*usize, buffer_size: *usize, buffer: [*]u8, src_addr: ?*MacAddress, dest_addr: ?*MacAddress, protocol: ?*u16) usize { | |
| 85 | return self._receive(self, header_size, buffer_size, buffer, src_addr, dest_addr, protocol); | |
| 86 | } | |
| 87 | ||
| 88 | pub const guid align(8) = Guid{ | |
| 89 | .time_low = 0xa19832b9, | |
| 90 | .time_mid = 0xac25, | |
| 91 | .time_high_and_version = 0x11d3, | |
| 92 | .clock_seq_high_and_reserved = 0x9a, | |
| 93 | .clock_seq_low = 0x2d, | |
| 94 | .node = [_]u8{ 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d }, | |
| 95 | }; | |
| 96 | }; | |
| 97 | ||
| 98 | pub const MacAddress = [32]u8; | |
| 99 | ||
| 100 | pub const SimpleNetworkMode = extern struct { | |
| 101 | state: SimpleNetworkState, | |
| 102 | hw_address_size: u32, | |
| 103 | media_header_size: u32, | |
| 104 | max_packet_size: u32, | |
| 105 | nvram_size: u32, | |
| 106 | nvram_access_size: u32, | |
| 107 | receive_filter_mask: SimpleNetworkReceiveFilter, | |
| 108 | receive_filter_setting: SimpleNetworkReceiveFilter, | |
| 109 | max_mcast_filter_count: u32, | |
| 110 | mcast_filter_count: u32, | |
| 111 | mcast_filter: [16]MacAddress, | |
| 112 | current_address: MacAddress, | |
| 113 | broadcast_address: MacAddress, | |
| 114 | permanent_address: MacAddress, | |
| 115 | if_type: u8, | |
| 116 | mac_address_changeable: bool, | |
| 117 | multiple_tx_supported: bool, | |
| 118 | media_present_supported: bool, | |
| 119 | media_present: bool, | |
| 120 | }; | |
| 121 | ||
| 122 | pub const SimpleNetworkReceiveFilter = packed struct { | |
| 123 | receive_unicast: bool, | |
| 124 | receive_multicast: bool, | |
| 125 | receive_broadcast: bool, | |
| 126 | receive_promiscuous: bool, | |
| 127 | receive_promiscuous_multicast: bool, | |
| 128 | _pad: u27 = undefined, | |
| 129 | }; | |
| 130 | ||
| 131 | pub const SimpleNetworkState = extern enum(u32) { | |
| 132 | Stopped, | |
| 133 | Started, | |
| 134 | Initialized, | |
| 135 | }; | |
| 136 | ||
| 137 | pub const NetworkStatistics = extern struct { | |
| 138 | rx_total_frames: u64, | |
| 139 | rx_good_frames: u64, | |
| 140 | rx_undersize_frames: u64, | |
| 141 | rx_oversize_frames: u64, | |
| 142 | rx_dropped_frames: u64, | |
| 143 | rx_unicast_frames: u64, | |
| 144 | rx_broadcast_frames: u64, | |
| 145 | rx_multicast_frames: u64, | |
| 146 | rx_crc_error_frames: u64, | |
| 147 | rx_total_bytes: u64, | |
| 148 | tx_total_frames: u64, | |
| 149 | tx_good_frames: u64, | |
| 150 | tx_undersize_frames: u64, | |
| 151 | tx_oversize_frames: u64, | |
| 152 | tx_dropped_frames: u64, | |
| 153 | tx_unicast_frames: u64, | |
| 154 | tx_broadcast_frames: u64, | |
| 155 | tx_multicast_frames: u64, | |
| 156 | tx_crc_error_frames: u64, | |
| 157 | tx_total_bytes: u64, | |
| 158 | collisions: u64, | |
| 159 | unsupported_protocol: u64, | |
| 160 | rx_duplicated_frames: u64, | |
| 161 | rx_decryptError_frames: u64, | |
| 162 | tx_error_frames: u64, | |
| 163 | tx_retry_frames: u64, | |
| 164 | }; | |
| 165 | ||
| 166 | pub const SimpleNetworkInterruptStatus = packed struct { | |
| 167 | receive_interrupt: bool, | |
| 168 | transmit_interrupt: bool, | |
| 169 | command_interrupt: bool, | |
| 170 | software_interrupt: bool, | |
| 171 | _pad: u28, | |
| 172 | }; |
lib/std/os/uefi/protocols/udp6_protocol.zig created+112| ... | ... | @@ -0,0 +1,112 @@ |
| 1 | const uefi = @import("std").os.uefi; | |
| 2 | const Guid = uefi.Guid; | |
| 3 | const Event = uefi.Event; | |
| 4 | const Time = uefi.Time; | |
| 5 | const Ip6ModeData = uefi.protocols.Ip6ModeData; | |
| 6 | const Ip6Address = uefi.protocols.Ip6Address; | |
| 7 | const ManagedNetworkConfigData = uefi.protocols.ManagedNetworkConfigData; | |
| 8 | const SimpleNetworkMode = uefi.protocols.SimpleNetworkMode; | |
| 9 | ||
| 10 | pub const Udp6Protocol = extern struct { | |
| 11 | _get_mode_data: extern fn (*const Udp6Protocol, ?*Udp6ConfigData, ?*Ip6ModeData, ?*ManagedNetworkConfigData, ?*SimpleNetworkMode) usize, | |
| 12 | _configure: extern fn (*const Udp6Protocol, ?*const Udp6ConfigData) usize, | |
| 13 | _groups: extern fn (*const Udp6Protocol, bool, ?*const Ip6Address) usize, | |
| 14 | _transmit: extern fn (*const Udp6Protocol, *Udp6CompletionToken) usize, | |
| 15 | _receive: extern fn (*const Udp6Protocol, *Udp6CompletionToken) usize, | |
| 16 | _cancel: extern fn (*const Udp6Protocol, ?*Udp6CompletionToken) usize, | |
| 17 | _poll: extern fn (*const Udp6Protocol) usize, | |
| 18 | ||
| 19 | pub fn getModeData(self: *const Udp6Protocol, udp6_config_data: ?*Udp6ConfigData, ip6_mode_data: ?*Ip6ModeData, mnp_config_data: ?*ManagedNetworkConfigData, snp_mode_data: ?*SimpleNetworkMode) usize { | |
| 20 | return self._get_mode_data(self, udp6_config_data, ip6_mode_data, mnp_config_data, snp_mode_data); | |
| 21 | } | |
| 22 | ||
| 23 | pub fn configure(self: *const Udp6Protocol, udp6_config_data: ?*const Udp6ConfigData) usize { | |
| 24 | return self._configure(self, udp6_config_data); | |
| 25 | } | |
| 26 | ||
| 27 | pub fn groups(self: *const Udp6Protocol, join_flag: bool, multicast_address: ?*const Ip6Address) usize { | |
| 28 | return self._groups(self, join_flag, multicast_address); | |
| 29 | } | |
| 30 | ||
| 31 | pub fn transmit(self: *const Udp6Protocol, token: *Udp6CompletionToken) usize { | |
| 32 | return self._transmit(self, token); | |
| 33 | } | |
| 34 | ||
| 35 | pub fn receive(self: *const Udp6Protocol, token: *Udp6CompletionToken) usize { | |
| 36 | return self._receive(self, token); | |
| 37 | } | |
| 38 | ||
| 39 | pub fn cancel(self: *const Udp6Protocol, token: ?*Udp6CompletionToken) usize { | |
| 40 | return self._cancel(self, token); | |
| 41 | } | |
| 42 | ||
| 43 | pub fn poll(self: *const Udp6Protocol) usize { | |
| 44 | return self._poll(self); | |
| 45 | } | |
| 46 | ||
| 47 | pub const guid align(8) = uefi.Guid{ | |
| 48 | .time_low = 0x4f948815, | |
| 49 | .time_mid = 0xb4b9, | |
| 50 | .time_high_and_version = 0x43cb, | |
| 51 | .clock_seq_high_and_reserved = 0x8a, | |
| 52 | .clock_seq_low = 0x33, | |
| 53 | .node = [_]u8{ 0x90, 0xe0, 0x60, 0xb3, 0x49, 0x55 }, | |
| 54 | }; | |
| 55 | }; | |
| 56 | ||
| 57 | pub const Udp6ConfigData = extern struct { | |
| 58 | accept_promiscuous: bool, | |
| 59 | accept_any_port: bool, | |
| 60 | allow_duplicate_port: bool, | |
| 61 | traffic_class: u8, | |
| 62 | hop_limit: u8, | |
| 63 | receive_timeout: u32, | |
| 64 | transmit_timeout: u32, | |
| 65 | station_address: Ip6Address, | |
| 66 | station_port: u16, | |
| 67 | remote_address: Ip6Address, | |
| 68 | remote_port: u16, | |
| 69 | }; | |
| 70 | ||
| 71 | pub const Udp6CompletionToken = extern struct { | |
| 72 | event: Event, | |
| 73 | status: usize, | |
| 74 | packet: extern union { | |
| 75 | RxData: *Udp6ReceiveData, | |
| 76 | TxData: *Udp6TransmitData, | |
| 77 | }, | |
| 78 | }; | |
| 79 | ||
| 80 | pub const Udp6ReceiveData = extern struct { | |
| 81 | timestamp: Time, | |
| 82 | recycle_signal: Event, | |
| 83 | udp6_session: Udp6SessionData, | |
| 84 | data_length: u32, | |
| 85 | fragment_count: u32, | |
| 86 | ||
| 87 | pub fn getFragments(self: *Udp6ReceiveData) []Udp6FragmentData { | |
| 88 | return @ptrCast([*]Udp6FragmentData, @ptrCast([*]u8, self) + @sizeOf(Udp6ReceiveData))[0..self.fragment_count]; | |
| 89 | } | |
| 90 | }; | |
| 91 | ||
| 92 | pub const Udp6TransmitData = extern struct { | |
| 93 | udp6_session_data: ?*Udp6SessionData, | |
| 94 | data_length: u32, | |
| 95 | fragment_count: u32, | |
| 96 | ||
| 97 | pub fn getFragments(self: *Udp6TransmitData) []Udp6FragmentData { | |
| 98 | return @ptrCast([*]Udp6FragmentData, @ptrCast([*]u8, self) + @sizeOf(Udp6TransmitData))[0..self.fragment_count]; | |
| 99 | } | |
| 100 | }; | |
| 101 | ||
| 102 | pub const Udp6SessionData = extern struct { | |
| 103 | source_address: Ip6Address, | |
| 104 | source_port: u16, | |
| 105 | destination_address: Ip6Address, | |
| 106 | destination_port: u16, | |
| 107 | }; | |
| 108 | ||
| 109 | pub const Udp6FragmentData = extern struct { | |
| 110 | fragment_length: u32, | |
| 111 | fragment_buffer: [*]u8, | |
| 112 | }; |
lib/std/os/uefi/protocols/udp6_service_binding_protocol.zig created+25| ... | ... | @@ -0,0 +1,25 @@ |
| 1 | const uefi = @import("std").os.uefi; | |
| 2 | const Handle = uefi.Handle; | |
| 3 | const Guid = uefi.Guid; | |
| 4 | ||
| 5 | pub const Udp6ServiceBindingProtocol = extern struct { | |
| 6 | _create_child: extern fn (*const Udp6ServiceBindingProtocol, *?Handle) usize, | |
| 7 | _destroy_child: extern fn (*const Udp6ServiceBindingProtocol, Handle) usize, | |
| 8 | ||
| 9 | pub fn createChild(self: *const Udp6ServiceBindingProtocol, handle: *?Handle) usize { | |
| 10 | return self._create_child(self, handle); | |
| 11 | } | |
| 12 | ||
| 13 | pub fn destroyChild(self: *const Udp6ServiceBindingProtocol, handle: Handle) usize { | |
| 14 | return self._destroy_child(self, handle); | |
| 15 | } | |
| 16 | ||
| 17 | pub const guid align(8) = Guid{ | |
| 18 | .time_low = 0x66ed4721, | |
| 19 | .time_mid = 0x3c98, | |
| 20 | .time_high_and_version = 0x4d3e, | |
| 21 | .clock_seq_high_and_reserved = 0x81, | |
| 22 | .clock_seq_low = 0xe3, | |
| 23 | .node = [_]u8{ 0xd0, 0x3d, 0xd3, 0x9a, 0x72, 0x54 }, | |
| 24 | }; | |
| 25 | }; |
lib/std/os/uefi/tables.zig+3| ... | ... | @@ -1,8 +1,11 @@ |
| 1 | 1 | pub const BootServices = @import("tables/boot_services.zig").BootServices; |
| 2 | 2 | pub const ConfigurationTable = @import("tables/configuration_table.zig").ConfigurationTable; |
| 3 | 3 | pub const global_variable align(8) = @import("tables/runtime_services.zig").global_variable; |
| 4 | pub const LocateSearchType = @import("tables/boot_services.zig").LocateSearchType; | |
| 4 | 5 | pub const MemoryDescriptor = @import("tables/boot_services.zig").MemoryDescriptor; |
| 5 | 6 | pub const MemoryType = @import("tables/boot_services.zig").MemoryType; |
| 7 | pub const OpenProtocolAttributes = @import("tables/boot_services.zig").OpenProtocolAttributes; | |
| 8 | pub const ProtocolInformationEntry = @import("tables/boot_services.zig").ProtocolInformationEntry; | |
| 6 | 9 | pub const ResetType = @import("tables/runtime_services.zig").ResetType; |
| 7 | 10 | pub const RuntimeServices = @import("tables/runtime_services.zig").RuntimeServices; |
| 8 | 11 | pub const SystemTable = @import("tables/system_table.zig").SystemTable; |
lib/std/os/uefi/tables/boot_services.zig+75-11| ... | ... | @@ -3,6 +3,7 @@ const Event = uefi.Event; |
| 3 | 3 | const Guid = uefi.Guid; |
| 4 | 4 | const Handle = uefi.Handle; |
| 5 | 5 | const TableHeader = uefi.tables.TableHeader; |
| 6 | const DevicePathProtocol = uefi.protocols.DevicePathProtocol; | |
| 6 | 7 | |
| 7 | 8 | /// Boot services are services provided by the system's firmware until the operating system takes |
| 8 | 9 | /// over control over the hardware by calling exitBootServices. |
| ... | ... | @@ -17,56 +18,96 @@ const TableHeader = uefi.tables.TableHeader; |
| 17 | 18 | /// As the boot_services table may grow with new UEFI versions, it is important to check hdr.header_size. |
| 18 | 19 | pub const BootServices = extern struct { |
| 19 | 20 | hdr: TableHeader, |
| 21 | ||
| 20 | 22 | raiseTpl: usize, // TODO |
| 21 | 23 | restoreTpl: usize, // TODO |
| 22 | 24 | allocatePages: usize, // TODO |
| 23 | 25 | freePages: usize, // TODO |
| 26 | ||
| 24 | 27 | /// Returns the current memory map. |
| 25 | 28 | getMemoryMap: extern fn (*usize, [*]MemoryDescriptor, *usize, *usize, *u32) usize, |
| 29 | ||
| 26 | 30 | /// Allocates pool memory. |
| 27 | 31 | allocatePool: extern fn (MemoryType, usize, *align(8) [*]u8) usize, |
| 28 | freePool: usize, // TODO | |
| 32 | ||
| 33 | /// Returns pool memory to the system. | |
| 34 | freePool: extern fn ([*]align(8) u8) usize, | |
| 35 | ||
| 29 | 36 | /// Creates an event. |
| 30 | 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, | |
| 38 | ||
| 31 | 39 | /// Sets the type of timer and the trigger time for a timer event. |
| 32 | 40 | setTimer: extern fn (Event, TimerDelay, u64) usize, |
| 41 | ||
| 33 | 42 | /// Stops execution until an event is signaled. |
| 34 | 43 | waitForEvent: extern fn (usize, [*]const Event, *usize) usize, |
| 44 | ||
| 35 | 45 | /// Signals an event. |
| 36 | 46 | signalEvent: extern fn (Event) usize, |
| 47 | ||
| 37 | 48 | /// Closes an event. |
| 38 | 49 | closeEvent: extern fn (Event) usize, |
| 39 | checkEvent: usize, // TODO | |
| 50 | ||
| 51 | /// Checks whether an event is in the signaled state. | |
| 52 | checkEvent: extern fn (Event) usize, | |
| 53 | ||
| 40 | 54 | installProtocolInterface: usize, // TODO |
| 41 | 55 | reinstallProtocolInterface: usize, // TODO |
| 42 | 56 | uninstallProtocolInterface: usize, // TODO |
| 43 | handleProtocol: usize, // TODO | |
| 57 | ||
| 58 | /// Queries a handle to determine if it supports a specified protocol. | |
| 59 | handleProtocol: extern fn (Handle, *align(8) const Guid, *?*c_void) usize, | |
| 60 | ||
| 44 | 61 | reserved: *c_void, |
| 62 | ||
| 45 | 63 | registerProtocolNotify: usize, // TODO |
| 46 | 64 | locateHandle: usize, // TODO |
| 47 | 65 | locateDevicePath: usize, // TODO |
| 48 | 66 | installConfigurationTable: usize, // TODO |
| 49 | imageLoad: usize, // TODO | |
| 50 | imageStart: usize, // TODO | |
| 67 | ||
| 68 | /// Loads an EFI image into memory. | |
| 69 | loadImage: extern fn (bool, Handle, ?*const DevicePathProtocol, ?[*]const u8, usize, *?Handle) usize, | |
| 70 | ||
| 71 | /// Transfers control to a loaded image's entry point. | |
| 72 | startImage: extern fn (Handle, ?*usize, ?*[*]u16) usize, | |
| 73 | ||
| 51 | 74 | /// Terminates a loaded EFI image and returns control to boot services. |
| 52 | 75 | exit: extern fn (Handle, usize, usize, ?*const c_void) usize, |
| 53 | imageUnload: usize, // TODO | |
| 76 | ||
| 77 | /// Unloads an image. | |
| 78 | unloadImage: extern fn (Handle) usize, | |
| 79 | ||
| 54 | 80 | /// Terminates all boot services. |
| 55 | 81 | exitBootServices: extern fn (Handle, usize) usize, |
| 82 | ||
| 56 | 83 | getNextMonotonicCount: usize, // TODO |
| 84 | ||
| 57 | 85 | /// Induces a fine-grained stall. |
| 58 | 86 | stall: extern fn (usize) usize, |
| 87 | ||
| 59 | 88 | /// Sets the system's watchdog timer. |
| 60 | 89 | setWatchdogTimer: extern fn (usize, u64, usize, ?[*]const u16) usize, |
| 90 | ||
| 61 | 91 | connectController: usize, // TODO |
| 62 | 92 | disconnectController: usize, // TODO |
| 63 | openProtocol: usize, // TODO | |
| 64 | closeProtocol: usize, // TODO | |
| 65 | openProtocolInformation: usize, // TODO | |
| 93 | ||
| 94 | /// Queries a handle to determine if it supports a specified protocol. | |
| 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 | ||
| 66 | 103 | protocolsPerHandle: usize, // TODO |
| 67 | 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, | |
| 107 | ||
| 68 | 108 | /// Returns the first protocol instance that matches the given protocol. |
| 69 | 109 | locateProtocol: extern fn (*align(8) const Guid, ?*const c_void, *?*c_void) usize, |
| 110 | ||
| 70 | 111 | installMultipleProtocolInterfaces: usize, // TODO |
| 71 | 112 | uninstallMultipleProtocolInterfaces: usize, // TODO |
| 72 | 113 | calculateCrc32: usize, // TODO |
| ... | ... | @@ -138,3 +179,26 @@ pub const MemoryDescriptor = extern struct { |
| 138 | 179 | memory_runtime: bool, |
| 139 | 180 | }, |
| 140 | 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 | }; |
lib/std/os/uefi/tables/runtime_services.zig+8| ... | ... | @@ -14,22 +14,30 @@ const TimeCapabilities = uefi.TimeCapabilities; |
| 14 | 14 | /// Some functions may not be called while other functions are running. |
| 15 | 15 | pub const RuntimeServices = extern struct { |
| 16 | 16 | hdr: TableHeader, |
| 17 | ||
| 17 | 18 | /// Returns the current time and date information, and the time-keeping capabilities of the hardware platform. |
| 18 | 19 | getTime: extern fn (*uefi.Time, ?*TimeCapabilities) usize, |
| 20 | ||
| 19 | 21 | setTime: usize, // TODO |
| 20 | 22 | getWakeupTime: usize, // TODO |
| 21 | 23 | setWakeupTime: usize, // TODO |
| 22 | 24 | setVirtualAddressMap: usize, // TODO |
| 23 | 25 | convertPointer: usize, // TODO |
| 26 | ||
| 24 | 27 | /// Returns the value of a variable. |
| 25 | 28 | getVariable: extern fn ([*]const u16, *align(8) const Guid, ?*u32, *usize, ?*c_void) usize, |
| 29 | ||
| 26 | 30 | /// Enumerates the current variable names. |
| 27 | 31 | getNextVariableName: extern fn (*usize, [*]u16, *align(8) Guid) usize, |
| 32 | ||
| 28 | 33 | /// Sets the value of a variable. |
| 29 | 34 | setVariable: extern fn ([*]const u16, *align(8) const Guid, u32, usize, *c_void) usize, |
| 35 | ||
| 30 | 36 | getNextHighMonotonicCount: usize, // TODO |
| 37 | ||
| 31 | 38 | /// Resets the entire platform. |
| 32 | 39 | resetSystem: extern fn (ResetType, usize, usize, ?*const c_void) noreturn, |
| 40 | ||
| 33 | 41 | updateCapsule: usize, // TODO |
| 34 | 42 | queryCapsuleCapabilities: usize, // TODO |
| 35 | 43 | queryVariableInfo: usize, // TODO |
lib/std/os/uefi/tables/system_table.zig+1| ... | ... | @@ -17,6 +17,7 @@ const TableHeader = uefi.tables.TableHeader; |
| 17 | 17 | /// hdr.crc32 must be recomputed. |
| 18 | 18 | pub const SystemTable = extern struct { |
| 19 | 19 | hdr: TableHeader, |
| 20 | ||
| 20 | 21 | /// A null-terminated string that identifies the vendor that produces the system firmware of the platform. |
| 21 | 22 | firmware_vendor: [*]u16, |
| 22 | 23 | firmware_revision: u32, |