@@ -407,31 +407,40 @@ int efx_reflash_flash_firmware(struct efx_nic *efx, const struct firmware *fw,
407
407
return - EOPNOTSUPP ;
408
408
}
409
409
410
- devlink_flash_update_status_notify ( devlink , "Checking update" , NULL , 0 , 0 );
410
+ mutex_lock ( & efx -> reflash_mutex );
411
411
412
- rc = efx_reflash_parse_firmware_data (fw , & type , & data_subtype , & data ,
413
- & data_size );
414
- if (rc ) {
415
- NL_SET_ERR_MSG_MOD (extack ,
416
- "Firmware image validation check failed" );
417
- goto out ;
418
- }
412
+ devlink_flash_update_status_notify (devlink , "Checking update" , NULL , 0 , 0 );
419
413
420
- mutex_lock (& efx -> reflash_mutex );
414
+ if (efx -> type -> flash_auto_partition ) {
415
+ /* NIC wants entire FW file including headers;
416
+ * FW will validate 'subtype' if there is one
417
+ */
418
+ type = NVRAM_PARTITION_TYPE_AUTO ;
419
+ data = fw -> data ;
420
+ data_size = fw -> size ;
421
+ } else {
422
+ rc = efx_reflash_parse_firmware_data (fw , & type , & data_subtype , & data ,
423
+ & data_size );
424
+ if (rc ) {
425
+ NL_SET_ERR_MSG_MOD (extack ,
426
+ "Firmware image validation check failed" );
427
+ goto out_unlock ;
428
+ }
421
429
422
- rc = efx_mcdi_nvram_metadata (efx , type , & subtype , NULL , NULL , 0 );
423
- if (rc ) {
424
- NL_SET_ERR_MSG_FMT_MOD (extack ,
425
- "Metadata query for NVRAM partition %#x failed" ,
426
- type );
427
- goto out_unlock ;
428
- }
430
+ rc = efx_mcdi_nvram_metadata (efx , type , & subtype , NULL , NULL , 0 );
431
+ if (rc ) {
432
+ NL_SET_ERR_MSG_FMT_MOD (extack ,
433
+ "Metadata query for NVRAM partition %#x failed" ,
434
+ type );
435
+ goto out_unlock ;
436
+ }
429
437
430
- if (subtype != data_subtype ) {
431
- NL_SET_ERR_MSG_MOD (extack ,
432
- "Firmware image is not appropriate for this adapter" );
433
- rc = - EINVAL ;
434
- goto out_unlock ;
438
+ if (subtype != data_subtype ) {
439
+ NL_SET_ERR_MSG_MOD (extack ,
440
+ "Firmware image is not appropriate for this adapter" );
441
+ rc = - EINVAL ;
442
+ goto out_unlock ;
443
+ }
435
444
}
436
445
437
446
rc = efx_mcdi_nvram_info (efx , type , & size , & erase_align , & write_align ,
@@ -506,7 +515,6 @@ int efx_reflash_flash_firmware(struct efx_nic *efx, const struct firmware *fw,
506
515
rc = efx_mcdi_nvram_update_finish_polled (efx , type );
507
516
out_unlock :
508
517
mutex_unlock (& efx -> reflash_mutex );
509
- out :
510
518
devlink_flash_update_status_notify (devlink , rc ? "Update failed" :
511
519
"Update complete" ,
512
520
NULL , 0 , 0 );
0 commit comments