@@ -308,6 +308,25 @@ impl RuntimeServices {
308
308
. to_result ( )
309
309
}
310
310
}
311
+
312
+ /// Tests whether a capsule or capsules can be updated via [`RuntimeServices::update_capsule`].
313
+ ///
314
+ /// See [`CapsuleInfo`] for details of the information returned.
315
+ pub fn query_capsule_capabilities (
316
+ & self ,
317
+ capsule_header_array : & [ & CapsuleHeader ] ,
318
+ ) -> Result < CapsuleInfo > {
319
+ let mut info = CapsuleInfo :: default ( ) ;
320
+ unsafe {
321
+ ( self . 0 . query_capsule_capabilities ) (
322
+ capsule_header_array. as_ptr ( ) . cast ( ) ,
323
+ capsule_header_array. len ( ) ,
324
+ & mut info. maximum_capsule_size ,
325
+ & mut info. reset_type ,
326
+ )
327
+ . to_result_with_val ( || info)
328
+ }
329
+ }
311
330
}
312
331
313
332
impl super :: Table for RuntimeServices {
@@ -551,3 +570,16 @@ pub struct VariableStorageInfo {
551
570
/// Maximum size of an individual variable of the specified type.
552
571
pub maximum_variable_size : u64 ,
553
572
}
573
+
574
+ /// Information about UEFI variable storage space returned by
575
+ /// [`RuntimeServices::query_capsule_capabilities`].
576
+ #[ derive( Clone , Copy , Debug , Default , Eq , PartialEq ) ]
577
+ pub struct CapsuleInfo {
578
+ /// The maximum size in bytes that [`RuntimeServices::update_capsule`]
579
+ /// can support as input. Note that the size of an update capsule is composed of
580
+ /// all [`CapsuleHeader`]s and [CapsuleBlockDescriptor]s.
581
+ pub maximum_capsule_size : u64 ,
582
+
583
+ /// The type of reset required for the capsule update.
584
+ pub reset_type : ResetType ,
585
+ }
0 commit comments