Skip to content

Commit 3941fc8

Browse files
mmahadevan108dleach02
authored andcommitted
mcux-sdk: drivers: Fix the cache invalidation functions
The CACHE64 does not work with secure alias address Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
1 parent 351f271 commit 3941fc8

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

mcux/mcux-sdk/drivers/cache/cache64/fsl_cache.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -240,10 +240,10 @@ void CACHE64_InvalidateCacheByRange(uint32_t address, uint32_t size_byte)
240240
{
241241
if (size_byte > 0UL)
242242
{
243-
uint32_t endAddr = MSDK_REG_SECURE_ADDR(address + size_byte - 0x01U);
243+
uint32_t endAddr = MSDK_REG_NONSECURE_ADDR(address + size_byte - 0x01U);
244244
uint32_t pccReg = 0;
245245
/* Align address to cache line size. */
246-
uint32_t startAddr = MSDK_REG_SECURE_ADDR(address & ~((uint32_t)CACHE64_LINESIZE_BYTE - 1U));
246+
uint32_t startAddr = MSDK_REG_NONSECURE_ADDR(address & ~((uint32_t)CACHE64_LINESIZE_BYTE - 1U));
247247
uint32_t instance = CACHE64_GetInstanceByAddr(address);
248248
uint32_t endLim;
249249
CACHE64_CTRL_Type *base;
@@ -257,7 +257,7 @@ void CACHE64_InvalidateCacheByRange(uint32_t address, uint32_t size_byte)
257257
return;
258258
}
259259
base = s_cache64ctrlBases[instance];
260-
endLim = MSDK_REG_SECURE_ADDR(phyMemBase[instance][g_cache64MemPhyAliasId] + phyMemSize[instance][g_cache64MemPhyAliasId] - 0x01U);
260+
endLim = MSDK_REG_NONSECURE_ADDR(phyMemBase[instance][g_cache64MemPhyAliasId] + phyMemSize[instance][g_cache64MemPhyAliasId] - 0x01U);
261261
endAddr = endAddr > endLim ? endLim : endAddr;
262262

263263
/* Set the invalidate by line command and use the physical address. */
@@ -310,10 +310,10 @@ void CACHE64_CleanCacheByRange(uint32_t address, uint32_t size_byte)
310310
{
311311
if (size_byte > 0UL)
312312
{
313-
uint32_t endAddr = MSDK_REG_SECURE_ADDR(address + size_byte - 0x01U);
313+
uint32_t endAddr = MSDK_REG_NONSECURE_ADDR(address + size_byte - 0x01U);
314314
uint32_t pccReg = 0;
315315
/* Align address to cache line size. */
316-
uint32_t startAddr = MSDK_REG_SECURE_ADDR(address & ~((uint32_t)CACHE64_LINESIZE_BYTE - 1U));
316+
uint32_t startAddr = MSDK_REG_NONSECURE_ADDR(address & ~((uint32_t)CACHE64_LINESIZE_BYTE - 1U));
317317
uint32_t instance = CACHE64_GetInstanceByAddr(address);
318318
uint32_t endLim;
319319
CACHE64_CTRL_Type *base;
@@ -327,7 +327,7 @@ void CACHE64_CleanCacheByRange(uint32_t address, uint32_t size_byte)
327327
return;
328328
}
329329
base = s_cache64ctrlBases[instance];
330-
endLim = MSDK_REG_SECURE_ADDR(phyMemBase[instance][g_cache64MemPhyAliasId] + phyMemSize[instance][g_cache64MemPhyAliasId] - 0x01U);
330+
endLim = MSDK_REG_NONSECURE_ADDR(phyMemBase[instance][g_cache64MemPhyAliasId] + phyMemSize[instance][g_cache64MemPhyAliasId] - 0x01U);
331331
endAddr = endAddr > endLim ? endLim : endAddr;
332332

333333
/* Set the push by line command. */
@@ -382,10 +382,10 @@ void CACHE64_CleanInvalidateCacheByRange(uint32_t address, uint32_t size_byte)
382382
{
383383
if (size_byte > 0UL)
384384
{
385-
uint32_t endAddr = MSDK_REG_SECURE_ADDR(address + size_byte - 0x01U);
385+
uint32_t endAddr = MSDK_REG_NONSECURE_ADDR(address + size_byte - 0x01U);
386386
uint32_t pccReg = 0;
387387
/* Align address to cache line size. */
388-
uint32_t startAddr = MSDK_REG_SECURE_ADDR(address & ~((uint32_t)CACHE64_LINESIZE_BYTE - 1U));
388+
uint32_t startAddr = MSDK_REG_NONSECURE_ADDR(address & ~((uint32_t)CACHE64_LINESIZE_BYTE - 1U));
389389
uint32_t instance = CACHE64_GetInstanceByAddr(address);
390390
uint32_t endLim;
391391
CACHE64_CTRL_Type *base;
@@ -399,7 +399,7 @@ void CACHE64_CleanInvalidateCacheByRange(uint32_t address, uint32_t size_byte)
399399
return;
400400
}
401401
base = s_cache64ctrlBases[instance];
402-
endLim = MSDK_REG_SECURE_ADDR(phyMemBase[instance][g_cache64MemPhyAliasId] + phyMemSize[instance][g_cache64MemPhyAliasId] - 0x01U);
402+
endLim = MSDK_REG_NONSECURE_ADDR(phyMemBase[instance][g_cache64MemPhyAliasId] + phyMemSize[instance][g_cache64MemPhyAliasId] - 0x01U);
403403
endAddr = endAddr > endLim ? endLim : endAddr;
404404

405405
/* Set the push by line command. */

0 commit comments

Comments
 (0)