@@ -250,6 +250,7 @@ pub struct Cli {
250250 pub flash_gpu_descriptor : Option < ( u8 , String ) > ,
251251 pub flash_gpu_descriptor_file : Option < String > ,
252252 pub dump_gpu_descriptor_file : Option < String > ,
253+ pub validate_gpu_descriptor_file : Option < String > ,
253254 pub nvidia : bool ,
254255 // UEFI only
255256 pub allupdate : bool ,
@@ -1878,6 +1879,25 @@ pub fn run_with_args(args: &Cli, _allupdate: bool) -> i32 {
18781879 println ! ( "Dumping to {}" , dump_path) ;
18791880 }
18801881 dump_dgpu_eeprom ( & ec, dump_path) ;
1882+ } else if let Some ( validate_path) = & args. validate_gpu_descriptor_file {
1883+ #[ cfg( feature = "uefi" ) ]
1884+ let data: Option < Vec < u8 > > = crate :: fw_uefi:: fs:: shell_read_file ( validate_path) ;
1885+ #[ cfg( not( feature = "uefi" ) ) ]
1886+ let data = match fs:: read ( validate_path) {
1887+ Ok ( data) => Some ( data) ,
1888+ Err ( e) => {
1889+ println ! ( "Error {:?}" , e) ;
1890+ None
1891+ }
1892+ } ;
1893+ if let Some ( data) = data {
1894+ println ! ( "Validating GPU Descriptor against {}" , validate_path) ;
1895+ match ec. validate_gpu_descriptor ( & data) {
1896+ Ok ( true ) => println ! ( " Validation passed" ) ,
1897+ Ok ( false ) => println ! ( " Validation FAILED: read-back mismatch" ) ,
1898+ Err ( err) => println ! ( " Validation error: {:?}" , err) ,
1899+ }
1900+ }
18811901 }
18821902
18831903 0
0 commit comments