| ... | ... | @@ -18,39 +18,71 @@ pub const RuntimeServices = extern struct { |
| 18 | 18 | hdr: TableHeader, |
| 19 | 19 | |
| 20 | 20 | /// Returns the current time and date information, and the time-keeping capabilities of the hardware platform. |
| 21 | | getTime: fn (*uefi.Time, ?*TimeCapabilities) callconv(.C) Status, |
| 21 | getTime: fn (time: *uefi.Time, capabilities: ?*TimeCapabilities) callconv(.C) Status, |
| 22 | 22 | |
| 23 | | setTime: Status, // TODO |
| 24 | | getWakeupTime: Status, // TODO |
| 25 | | setWakeupTime: Status, // TODO |
| 23 | /// Sets the current local time and date information |
| 24 | setTime: fn (time: *uefi.Time) callconv(.C) Status, |
| 25 | |
| 26 | /// Returns the current wakeup alarm clock setting |
| 27 | getWakeupTime: fn (enabled: *bool, pending: *bool, time: *uefi.Time) callconv(.C) Status, |
| 28 | |
| 29 | /// Sets the system wakeup alarm clock time |
| 30 | setWakeupTime: fn (enable: *bool, time: ?*uefi.Time) callconv(.C) Status, |
| 26 | 31 | |
| 27 | 32 | /// Changes the runtime addressing mode of EFI firmware from physical to virtual. |
| 28 | | setVirtualAddressMap: fn (usize, usize, u32, [*]MemoryDescriptor) callconv(.C) Status, |
| 33 | setVirtualAddressMap: fn (mmap_size: usize, descriptor_size: usize, descriptor_version: u32, virtual_map: [*]MemoryDescriptor) callconv(.C) Status, |
| 29 | 34 | |
| 30 | 35 | /// Determines the new virtual address that is to be used on subsequent memory accesses. |
| 31 | | convertPointer: fn (usize, **anyopaque) callconv(.C) Status, |
| 36 | convertPointer: fn (debug_disposition: usize, address: **anyopaque) callconv(.C) Status, |
| 32 | 37 | |
| 33 | 38 | /// Returns the value of a variable. |
| 34 | | getVariable: fn ([*:0]const u16, *align(8) const Guid, ?*u32, *usize, ?*anyopaque) callconv(.C) Status, |
| 39 | getVariable: fn (var_name: [*:0]const u16, vendor_guid: *align(8) const Guid, attributes: ?*u32, data_size: *usize, data: ?*anyopaque) callconv(.C) Status, |
| 35 | 40 | |
| 36 | 41 | /// Enumerates the current variable names. |
| 37 | | getNextVariableName: fn (*usize, [*:0]u16, *align(8) Guid) callconv(.C) Status, |
| 42 | getNextVariableName: fn (var_name_size: *usize, var_name: [*:0]u16, vendor_guid: *align(8) Guid) callconv(.C) Status, |
| 38 | 43 | |
| 39 | 44 | /// Sets the value of a variable. |
| 40 | | setVariable: fn ([*:0]const u16, *align(8) const Guid, u32, usize, *anyopaque) callconv(.C) Status, |
| 45 | setVariable: fn (var_name: [*:0]const u16, vendor_guid: *align(8) const Guid, attributes: u32, data_size: usize, data: *anyopaque) callconv(.C) Status, |
| 41 | 46 | |
| 42 | | getNextHighMonotonicCount: Status, // TODO |
| 47 | /// Return the next high 32 bits of the platform's monotonic counter |
| 48 | getNextHighMonotonicCount: fn (high_count: *u32) callconv(.C) Status, |
| 43 | 49 | |
| 44 | 50 | /// Resets the entire platform. |
| 45 | | resetSystem: fn (ResetType, Status, usize, ?*const anyopaque) callconv(.C) noreturn, |
| 51 | resetSystem: fn (reset_type: ResetType, reset_status: Status, data_size: usize, reset_data: ?*const anyopaque) callconv(.C) noreturn, |
| 52 | |
| 53 | /// Passes capsules to the firmware with both virtual and physical mapping. |
| 54 | /// Depending on the intended consumption, the firmware may process the capsule immediately. |
| 55 | /// If the payload should persist across a system reset, the reset value returned from |
| 56 | /// `queryCapsuleCapabilities` must be passed into resetSystem and will cause the capsule |
| 57 | /// to be processed by the firmware as part of the reset process. |
| 58 | updateCapsule: fn (capsule_header_array: **CapsuleHeader, capsule_count: usize, scatter_gather_list: EfiPhysicalAddress) callconv(.C) Status, |
| 46 | 59 | |
| 47 | | updateCapsule: Status, // TODO |
| 48 | | queryCapsuleCapabilities: Status, // TODO |
| 49 | | queryVariableInfo: Status, // TODO |
| 60 | /// Returns if the capsule can be supported via `updateCapsule` |
| 61 | queryCapsuleCapabilities: fn (capsule_header_array: **CapsuleHeader, capsule_count: usize, maximum_capsule_size: *usize, resetType: ResetType) callconv(.C) Status, |
| 62 | |
| 63 | /// Returns information about the EFI variables |
| 64 | queryVariableInfo: fn (attributes: *u32, maximum_variable_storage_size: *u64, remaining_variable_storage_size: *u64, maximum_variable_size: *u64) callconv(.C) Status, |
| 50 | 65 | |
| 51 | 66 | pub const signature: u64 = 0x56524553544e5552; |
| 52 | 67 | }; |
| 53 | 68 | |
| 69 | const EfiPhysicalAddress = u64; |
| 70 | |
| 71 | pub const CapsuleHeader = extern struct { |
| 72 | capsuleGuid: Guid align(8), |
| 73 | headerSize: u32, |
| 74 | flags: u32, |
| 75 | capsuleImageSize: u32, |
| 76 | }; |
| 77 | |
| 78 | pub const UefiCapsuleBlockDescriptor = extern struct { |
| 79 | length: u64, |
| 80 | address: union { |
| 81 | dataBlock: EfiPhysicalAddress, |
| 82 | continuationPointer: EfiPhysicalAddress, |
| 83 | }, |
| 84 | }; |
| 85 | |
| 54 | 86 | pub const ResetType = enum(u32) { |
| 55 | 87 | ResetCold, |
| 56 | 88 | ResetWarm, |