Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/aienux/blob/main/vendor/uefi-raw/src/capsule.rs # aienux Aienux, the AienOS kernel: boot, scheduling, IPC and capability boundaries. Pre-alpha; host, emulator and physical evidence are labelled separately. Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `aienux / vendor / uefi-raw / src / capsule.rs` 127 lines ยท 4645 bytes Raw Blame History 1 // SPDX-License-Identifier: MIT OR Apache-2.0 2 3 //! UEFI update capsules. 4 //! 5 //! Capsules are used to pass information to the firmware, for example to 6 //! trigger a firmware update. 7 8 use crate::{Guid, PhysicalAddress}; 9 use bitflags::bitflags; 10 11 /// Descriptor that defines a scatter-gather list for passing a set of capsules 12 /// to the firmware. 13 #[derive(Clone, Copy, Debug, Default, PartialEq, Eq, PartialOrd, Ord, Hash)] 14 #[repr(C)] 15 pub struct CapsuleBlockDescriptor { 16 /// Size in bytes of the data block. If zero, the block is treated as a 17 /// continuation pointer. 18 pub length: u64, 19 20 /// Either a data block pointer or a continuation pointer. 21 /// 22 /// * If `length` is non-zero, this is the physical address of the data 23 /// block. 24 /// * If `length` is zero: 25 /// * If `addr` is non-zero, this is the physical address of another block 26 /// of `CapsuleBlockDescriptor`. 27 /// * If `addr` is zero, this entry represents the end of the list. 28 pub address: PhysicalAddress, 29 } 30 31 bitflags! { 32 /// Capsule update flags. 33 /// 34 /// The meaning of bits `0..=15` are defined by the capsule GUID. 35 #[derive(Clone, Copy, Debug, Default, PartialEq, Eq, PartialOrd, Ord, Hash)] 36 #[repr(transparent)] 37 pub struct CapsuleFlags: u32 { 38 /// The meaning of this bit depends on the capsule GUID. 39 const TYPE_SPECIFIC_BIT_0 = 1 << 0; 40 41 /// The meaning of this bit depends on the capsule GUID. 42 const TYPE_SPECIFIC_BIT_1 = 1 << 1; 43 44 /// The meaning of this bit depends on the capsule GUID. 45 const TYPE_SPECIFIC_BIT_2 = 1 << 2; 46 47 /// The meaning of this bit depends on the capsule GUID. 48 const TYPE_SPECIFIC_BIT_3 = 1 << 3; 49 50 /// The meaning of this bit depends on the capsule GUID. 51 const TYPE_SPECIFIC_BIT_4 = 1 << 4; 52 53 /// The meaning of this bit depends on the capsule GUID. 54 const TYPE_SPECIFIC_BIT_5 = 1 << 5; 55 56 /// The meaning of this bit depends on the capsule GUID. 57 const TYPE_SPECIFIC_BIT_6 = 1 << 6; 58 59 /// The meaning of this bit depends on the capsule GUID. 60 const TYPE_SPECIFIC_BIT_7 = 1 << 7; 61 62 /// The meaning of this bit depends on the capsule GUID. 63 const TYPE_SPECIFIC_BIT_8 = 1 << 8; 64 65 /// The meaning of this bit depends on the capsule GUID. 66 const TYPE_SPECIFIC_BIT_9 = 1 << 9; 67 68 /// The meaning of this bit depends on the capsule GUID. 69 const TYPE_SPECIFIC_BIT_10 = 1 << 10; 70 71 /// The meaning of this bit depends on the capsule GUID. 72 const TYPE_SPECIFIC_BIT_11 = 1 << 11; 73 74 /// The meaning of this bit depends on the capsule GUID. 75 const TYPE_SPECIFIC_BIT_12 = 1 << 12; 76 77 /// The meaning of this bit depends on the capsule GUID. 78 const TYPE_SPECIFIC_BIT_13 = 1 << 13; 79 80 /// The meaning of this bit depends on the capsule GUID. 81 const TYPE_SPECIFIC_BIT_14 = 1 << 14; 82 83 /// The meaning of this bit depends on the capsule GUID. 84 const TYPE_SPECIFIC_BIT_15 = 1 << 15; 85 86 /// Indicates the firmware should process the capsule after system reset. 87 const PERSIST_ACROSS_RESET = 1 << 16; 88 89 /// Causes the contents of the capsule to be coalesced from the 90 /// scatter-gather list into a contiguous buffer, and then a pointer to 91 /// that buffer will be placed in the configuration table after system 92 /// reset. 93 /// 94 /// If this flag is set, [`PERSIST_ACROSS_RESET`] must be set as well. 95 /// 96 /// [`PERSIST_ACROSS_RESET`]: Self::PERSIST_ACROSS_RESET 97 const POPULATE_SYSTEM_TABLE = 1 << 17; 98 99 /// Trigger a system reset after passing the capsule to the firmware. 100 /// 101 /// If this flag is set, [`PERSIST_ACROSS_RESET`] must be set as well. 102 /// 103 /// [`PERSIST_ACROSS_RESET`]: Self::PERSIST_ACROSS_RESET 104 const INITIATE_RESET = 1 << 18; 105 } 106 } 107 108 /// Common header at the start of a capsule. 109 #[derive(Clone, Copy, Debug, Default, PartialEq, Eq, PartialOrd, Ord, Hash)] 110 #[repr(C)] 111 pub struct CapsuleHeader { 112 /// GUID that defines the type of data in the capsule. 113 pub capsule_guid: Guid, 114 115 /// Size in bytes of the capsule header. This may be larger than the size of 116 /// `CapsuleHeader` since the specific capsule type defined by 117 /// [`capsule_guid`] may add additional header fields. 118 /// 119 /// [`capsule_guid`]: Self::capsule_guid 120 pub header_size: u32, 121 122 /// Capsule update flags. 123 pub flags: CapsuleFlags, 124 125 /// Size in bytes of the entire capsule, including the header. 126 pub capsule_image_size: u32, 127 }