@@ -227,6 +227,7 @@ pub struct Cli {
227227 pub flash_gpu_descriptor : Option < ( u8 , String ) > ,
228228 pub flash_gpu_descriptor_file : Option < String > ,
229229 pub dump_gpu_descriptor_file : Option < String > ,
230+ pub validate_gpu_descriptor_file : Option < String > ,
230231 pub nvidia : bool ,
231232 // UEFI only
232233 pub allupdate : bool ,
@@ -1827,6 +1828,25 @@ pub fn run_with_args(args: &Cli, _allupdate: bool) -> i32 {
18271828 println ! ( "Dumping to {}" , dump_path) ;
18281829 }
18291830 dump_dgpu_eeprom ( & ec, dump_path) ;
1831+ } else if let Some ( validate_path) = & args. validate_gpu_descriptor_file {
1832+ #[ cfg( feature = "uefi" ) ]
1833+ let data: Option < Vec < u8 > > = crate :: fw_uefi:: fs:: shell_read_file ( validate_path) ;
1834+ #[ cfg( not( feature = "uefi" ) ) ]
1835+ let data = match fs:: read ( validate_path) {
1836+ Ok ( data) => Some ( data) ,
1837+ Err ( e) => {
1838+ println ! ( "Error {:?}" , e) ;
1839+ None
1840+ }
1841+ } ;
1842+ if let Some ( data) = data {
1843+ println ! ( "Validating GPU Descriptor against {}" , validate_path) ;
1844+ match ec. validate_gpu_descriptor ( & data) {
1845+ Ok ( true ) => println ! ( " Validation passed" ) ,
1846+ Ok ( false ) => println ! ( " Validation FAILED: read-back mismatch" ) ,
1847+ Err ( err) => println ! ( " Validation error: {:?}" , err) ,
1848+ }
1849+ }
18301850 }
18311851
18321852 0
0 commit comments