Skip to content

Commit

Permalink
driver:src: Elfloader unaligned data writes handled properly
Browse files Browse the repository at this point in the history
While loading data into the data memory if the start
offset is not word aligned then those are not handled
properly because of an incorrect condition.

Signed-off-by: Sankarji Gopalakrishnan <[email protected]>

Acked-by: Gregory Williams <[email protected]>
  • Loading branch information
sankarjiamd authored and Gregory Williams committed Nov 15, 2024
1 parent bbe197d commit 3fdf8d8
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions driver/src/memory/xaie_mem.c
Original file line number Diff line number Diff line change
Expand Up @@ -196,10 +196,12 @@ static AieRC _XAie_DataMemoryBlockWrite(XAie_DevInst* DevInst, XAie_LocType Loc,
* write at unaligned offset
*/
for(u32 UnalignedByte = FirstWriteOffset;
UnalignedByte < (u8)((XAIE_MEM_WORD_ALIGN_SIZE != 0U) &&
(RemBytes != 0U)); UnalignedByte++, RemBytes--) {
TempWord |= (u32)(Src[BytePtr++] << (UnalignedByte * 8U));
Mask |= (u32)(0xFFU << (UnalignedByte * 8U));
(UnalignedByte < (u8)(XAIE_MEM_WORD_ALIGN_SIZE)) && (RemBytes != 0U);
RemBytes--) {
TempWord |= ((u32)Src[BytePtr] << (UnalignedByte * 8U));
Mask |= ((u32)0xFFU << (UnalignedByte * 8U));
UnalignedByte++;
BytePtr++;
}
RC = XAie_MaskWrite32(DevInst, DmAddrRoundDown, Mask, TempWord);
if(RC != XAIE_OK) {
Expand Down

0 comments on commit 3fdf8d8

Please sign in to comment.