bsp: a53: xil_settlbattributes modified for addresses > 4GB
This patch modifies xil_settlbattributes API to work with addresses > 4GB by modifying the address masking value appropriate for higher addresses lies beyond 4GB Signed-off-by: Kinjal Pravinbhai Patel <patelki@xilinx.com> Reviewed-by: Anirudha Sarangi <anirudh@xilinx.com>
This commit is contained in:
parent
f85e3a62b3
commit
363baf34d9
1 changed files with 16 additions and 7 deletions
|
@ -65,10 +65,15 @@
|
|||
|
||||
/************************** Constant Definitions *****************************/
|
||||
|
||||
#define BLOCK_SIZE_2MB 0x200000U
|
||||
#define BLOCK_SIZE_1GB 0x40000000U
|
||||
#define ADDRESS_LIMIT_4GB 0x100000000UL
|
||||
|
||||
/************************** Variable Definitions *****************************/
|
||||
|
||||
extern INTPTR MMUTableL1;
|
||||
extern INTPTR MMUTableL2;
|
||||
|
||||
/************************** Function Prototypes ******************************/
|
||||
/*****************************************************************************
|
||||
*
|
||||
|
@ -88,18 +93,22 @@ void Xil_SetTlbAttributes(INTPTR Addr, u64 attrib)
|
|||
{
|
||||
INTPTR *ptr;
|
||||
INTPTR section;
|
||||
u64 block_size;
|
||||
/* if region is less than 4GB MMUTable level 2 need to be modified */
|
||||
if(Addr<0x100000000){
|
||||
section = Addr / 0x00200000U;
|
||||
ptr = &MMUTableL2 + section;
|
||||
*ptr = (Addr & (~0x001FFFFFU)) | attrib;
|
||||
if(Addr < ADDRESS_LIMIT_4GB){
|
||||
/* block size is 2MB for addressed < 4GB*/
|
||||
block_size = BLOCK_SIZE_2MB;
|
||||
section = Addr / block_size;
|
||||
ptr = &MMUTableL2 + section;
|
||||
}
|
||||
/* if region is greater than 4GB MMUTable level 1 need to be modified */
|
||||
else{
|
||||
section = Addr / 0x40000000U;
|
||||
ptr = &MMUTableL1 + section;
|
||||
*ptr = (Addr & (~0x3FFFFFFFU)) | attrib;
|
||||
/* block size is 1GB for addressed > 4GB */
|
||||
block_size = BLOCK_SIZE_1GB;
|
||||
section = Addr / block_size;
|
||||
ptr = &MMUTableL1 + section;
|
||||
}
|
||||
*ptr = (Addr & (~(block_size-1))) | attrib;
|
||||
|
||||
Xil_DCacheFlush();
|
||||
mtcptlbi(ALLE3);
|
||||
|
|
Loading…
Add table
Reference in a new issue