@@ -230,6 +230,7 @@ pub struct Cli {
230230 pub flash_gpu_descriptor : Option < ( u8 , String ) > ,
231231 pub flash_gpu_descriptor_file : Option < String > ,
232232 pub dump_gpu_descriptor_file : Option < String > ,
233+ pub validate_gpu_descriptor_file : Option < String > ,
233234 pub nvidia : bool ,
234235 // UEFI only
235236 pub allupdate : bool ,
@@ -1841,6 +1842,25 @@ pub fn run_with_args(args: &Cli, _allupdate: bool) -> i32 {
18411842 println ! ( "Dumping to {}" , dump_path) ;
18421843 }
18431844 dump_dgpu_eeprom ( & ec, dump_path) ;
1845+ } else if let Some ( validate_path) = & args. validate_gpu_descriptor_file {
1846+ #[ cfg( feature = "uefi" ) ]
1847+ let data: Option < Vec < u8 > > = crate :: fw_uefi:: fs:: shell_read_file ( validate_path) ;
1848+ #[ cfg( not( feature = "uefi" ) ) ]
1849+ let data = match fs:: read ( validate_path) {
1850+ Ok ( data) => Some ( data) ,
1851+ Err ( e) => {
1852+ println ! ( "Error {:?}" , e) ;
1853+ None
1854+ }
1855+ } ;
1856+ if let Some ( data) = data {
1857+ println ! ( "Validating GPU Descriptor against {}" , validate_path) ;
1858+ match ec. validate_gpu_descriptor ( & data) {
1859+ Ok ( true ) => println ! ( " Validation passed" ) ,
1860+ Ok ( false ) => println ! ( " Validation FAILED: read-back mismatch" ) ,
1861+ Err ( err) => println ! ( " Validation error: {:?}" , err) ,
1862+ }
1863+ }
18441864 }
18451865
18461866 0
0 commit comments