@@ -60,6 +60,18 @@ pub struct RuntimeServices {
60
60
data_size : usize ,
61
61
data : * const u8 ,
62
62
) -> !,
63
+
64
+ // UEFI 2.0 Capsule Services.
65
+ update_capsule : usize ,
66
+ query_capsule_capabilities : usize ,
67
+
68
+ // Miscellaneous UEFI 2.0 Service.
69
+ query_variable_info : unsafe extern "efiapi" fn (
70
+ attributes : VariableAttributes ,
71
+ maximum_variable_storage_size : * mut u64 ,
72
+ remaining_variable_storage_size : * mut u64 ,
73
+ maximum_variable_size : * mut u64 ,
74
+ ) -> Status ,
63
75
}
64
76
65
77
impl RuntimeServices {
@@ -227,6 +239,26 @@ impl RuntimeServices {
227
239
}
228
240
}
229
241
242
+ /// Get information about UEFI variable storage space for the type
243
+ /// of variable specified in `attributes`.
244
+ ///
245
+ /// See [`VariableStorageInfo`] for details of the information returned.
246
+ pub fn query_variable_info (
247
+ & self ,
248
+ attributes : VariableAttributes ,
249
+ ) -> Result < VariableStorageInfo > {
250
+ let mut info = VariableStorageInfo :: default ( ) ;
251
+ unsafe {
252
+ ( self . query_variable_info ) (
253
+ attributes,
254
+ & mut info. maximum_variable_storage_size ,
255
+ & mut info. remaining_variable_storage_size ,
256
+ & mut info. maximum_variable_size ,
257
+ )
258
+ . into_with_val ( || info)
259
+ }
260
+ }
261
+
230
262
/// Resets the computer.
231
263
pub fn reset ( & self , rt : ResetType , status : Status , data : Option < & [ u8 ] > ) -> ! {
232
264
let ( size, data) = match data {
@@ -619,6 +651,24 @@ impl fmt::Display for VariableKey {
619
651
}
620
652
}
621
653
654
+ /// Information about UEFI variable storage space returned by
655
+ /// [`RuntimeServices::query_variable_info`]. Note that the data here is
656
+ /// limited to a specific type of variable (as specified by the
657
+ /// `attributes` argument to `query_variable_info`).
658
+ #[ derive( Clone , Copy , Debug , Default , Eq , PartialEq ) ]
659
+ pub struct VariableStorageInfo {
660
+ /// Maximum size in bytes of the storage space available for
661
+ /// variables of the specified type.
662
+ pub maximum_variable_storage_size : u64 ,
663
+
664
+ /// Remaining size in bytes of the storage space available for
665
+ /// variables of the specified type.
666
+ pub remaining_variable_storage_size : u64 ,
667
+
668
+ /// Maximum size of an individual variable of the specified type.
669
+ pub maximum_variable_size : u64 ,
670
+ }
671
+
622
672
/// The type of system reset.
623
673
#[ derive( Debug , Copy , Clone , Eq , PartialEq ) ]
624
674
#[ repr( u32 ) ]
0 commit comments