Signed-off-by: Joel Fernandes <joelagn...@nvidia.com> --- drivers/gpu/nova-core/firmware/fwsec.rs | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-)
diff --git a/drivers/gpu/nova-core/firmware/fwsec.rs b/drivers/gpu/nova-core/firmware/fwsec.rs index 664319d1d31c..79c21db9d89d 100644 --- a/drivers/gpu/nova-core/firmware/fwsec.rs +++ b/drivers/gpu/nova-core/firmware/fwsec.rs @@ -29,11 +29,14 @@ #[repr(C)] #[derive(Debug)] + +/// The header of the Application Interface table, used +/// to locate the DMEMMAPPER section in the DMEM (see fwsec.rst). struct FalconAppifHdrV1 { - ver: u8, - hdr: u8, - len: u8, - cnt: u8, + version: u8, + header_size: u8, + entry_size: u8, + entry_count: u8, } // SAFETY: any byte sequence is valid for this struct. unsafe impl FromBytes for FalconAppifHdrV1 {} @@ -169,14 +172,14 @@ fn patch_command(fw: &mut DmaObject, v3_desc: &FalconUCodeDescV3, cmd: FwsecComm let hdr_offset = (v3_desc.imem_load_size + v3_desc.interface_offset) as usize; let hdr: &FalconAppifHdrV1 = unsafe { transmute(fw, hdr_offset) }?; - if hdr.ver != 1 { + if hdr.version != 1 { return Err(EINVAL); } // Find the DMEM mapper section in the firmware. - for i in 0..hdr.cnt as usize { + for i in 0..hdr.entry_count as usize { let app: &FalconAppifV1 = - unsafe { transmute(fw, hdr_offset + hdr.hdr as usize + i * hdr.len as usize) }?; + unsafe { transmute(fw, hdr_offset + hdr.header_size as usize + i * hdr.entry_size as usize) }?; if app.id != NVFW_FALCON_APPIF_ID_DMEMMAPPER { continue; -- 2.43.0