Exemplo n.º 1
0
void MsDrv_MiuInit(void)
{
		UBOOT_TRACE("IN\n");
		if(miuInit==0)
		{
				UBOOT_DEBUG("do MDrv_MIU_Init\n");
				MDrv_MIU_Init();
				miuInit=1;
		}
		UBOOT_TRACE("OK\n");
}
Exemplo n.º 2
0
void MsApi_kernelProtect(void)

{
    MS_U32 u32LxStart=0,u32Size=0;
    char lx1[32],lx2[32],lx3[32], *start=0;
    char dram_size1[32], dram_size2[32];
    MS_U8 u8BlockMiu0Index=0;
    MS_U8 u8BlockMiu1Index=0;
//LX_MEM=0x9C00000 EMAC_MEM=0x100000 DRAM_LEN=0x20000000 LX_MEM2=0x50E00000,0xC200000 LX_MEM3=0xB0000000,0x0000000
    char * tok;
//MIU_INTERVAL
    char *s = getenv("MS_MEM");

    MDrv_MIU_Init();
    if (s != NULL)
    {
        u32Lx1Start = CONFIG_KERNEL_START_ADDRESS;
        u32LxStart = MsOS_VA2PA(CONFIG_KERNEL_START_ADDRESS);

        tok = strtok (s," ");
        while (tok != NULL)
        {
            if((start = strstr (tok, "LX_MEM=")) != NULL)
            {
                memset(lx1, 0, sizeof(lx1));
                strncpy(lx1, tok+7, strlen(lx1)-7);
            }
            else if((start = strstr (tok, "LX_MEM2=")) != NULL)
            {
                memset(lx2, 0, sizeof(lx2));
                strncpy(lx2, tok+8, strlen(lx2)-8);
            }
            else if((start = strstr (tok, "LX_MEM3=")) != NULL)
            {
                memset(lx3, 0, sizeof(lx3));
                strncpy(lx3, tok+8, strlen(lx3)-8);
            }
            else if((start = strstr (tok, "DRAM_SIZE1=")) != NULL)
            {
                memset(dram_size1, 0, sizeof(dram_size1));
                strncpy(dram_size1, tok+11, strlen(dram_size1)-8);
                u32DramSize1=(simple_strtoul(dram_size1, NULL, 16));
                MDrv_MIU_Dram_Size(E_MIU_0, dram_size_to_enum(u32DramSize1));
            }
            else if((start = strstr (tok, "DRAM_SIZE2=")) != NULL)
            {
                memset(dram_size2,0,sizeof(dram_size2));
                strncpy(dram_size2, tok+11, strlen(dram_size2)-8);
                u32DramSize2=(simple_strtoul(dram_size2, NULL, 16));
                MDrv_MIU_Dram_Size(E_MIU_1, dram_size_to_enum(u32DramSize2));
            }
            tok = strtok (NULL, " ");
        }

        // decide whether to do kernel protect or not
        s = getenv("KERNEL_PROTECT");
        if (s != NULL)
        {
            tok = strtok (s," ");
            while (tok != NULL)
            {
                if((start = strstr (tok, "DRAM_SIZE1=")) != NULL)
                {
                    memset(dram_size1, 0, sizeof(dram_size1));
                    strncpy(dram_size1, tok+11, strlen(dram_size1)-8);
                    u32DramSize1=(simple_strtoul(dram_size1, NULL, 16));
                    MDrv_MIU_Dram_Size(E_MIU_0, dram_size_to_enum(u32DramSize1));
                }
                else if((start = strstr (tok, "DRAM_SIZE2=")) != NULL)
                {
                    memset(dram_size2,0,sizeof(dram_size2));
                    strncpy(dram_size2, tok+11, strlen(dram_size2)-8);
                    u32DramSize2=(simple_strtoul(dram_size2, NULL, 16));
                    MDrv_MIU_Dram_Size(E_MIU_1, dram_size_to_enum(u32DramSize2));
                }
                tok = strtok (NULL, " ");
            }
        }


        //if(lx1!= NULL)
        {
            u32Lx1Size = u32Size = (simple_strtoul(lx1, NULL, 16));
            if(u32Size>0)
            {

                if(u32LxStart>=MIU_INTERVAL)
                {
                    MsDrv_kernelProtect(u8BlockMiu1Index,u32LxStart,(u32LxStart + u32Size));
                    u8BlockMiu1Index+=1;
                }
                else
                {
                    MsDrv_kernelProtect(u8BlockMiu0Index,u32LxStart,(u32LxStart + u32Size));
                    u8BlockMiu0Index+=1;
                }
            }
        }
        // if(lx2 != NULL)
        {
            tok=strtok(lx2,",");
            u32Lx2Start = u32LxStart = (simple_strtoul(tok, NULL, 16));
            tok = strtok (NULL, ",");
            u32Lx2Size = u32Size = (simple_strtoul(tok, NULL, 16));
            if(u32LxStart!=0 && u32Size!=0)
            {
                if(u32DramSize1==0x40000000)
                {
                    u32LxStart=(u32LxStart-0x40000000);
                }
                else
                {
                    u32LxStart=MsOS_VA2PA(u32LxStart);
                }
                if(u32LxStart>=MIU_INTERVAL)
                {
                    MsDrv_kernelProtect(u8BlockMiu1Index,u32LxStart,(u32LxStart + u32Size));
                    u8BlockMiu1Index+=1;
                }
                else
                {
                    MsDrv_kernelProtect(u8BlockMiu0Index,u32LxStart,(u32LxStart + u32Size));
                    u8BlockMiu0Index+=1;
                }
            }

        }

        //if(lx3 != NULL)
        {
            tok=strtok(lx3,",");
            u32Lx3Start = u32LxStart = (simple_strtoul(tok, NULL, 16));
            tok = strtok (NULL, ",");
            u32Lx3Size = u32Size = (simple_strtoul(tok, NULL, 16));
            if(u32LxStart!=0 && u32Size!=0)
            {
                if(u32DramSize1==0x40000000)
                {
                    u32LxStart=(u32LxStart-0x40000000);
                }
                else
                {
                    u32LxStart=MsOS_VA2PA(u32LxStart);
                }
                if(u32LxStart>=MIU_INTERVAL)
                {
                    MsDrv_kernelProtect(u8BlockMiu1Index,u32LxStart,(u32LxStart + u32Size));
                    u8BlockMiu1Index+=1;
                }
                else
                {
                    MsDrv_kernelProtect(u8BlockMiu0Index,u32LxStart,(u32LxStart + u32Size));
                    u8BlockMiu0Index+=1;
                }
            }
        }

         if(ENABLE_MSTAR_PM_SWIR==1)
        {
            MsDrv_PMProtect(3,0x0,0x10000); //64K run time PM
        }
    }



    // decide whether to do kernel protect bist or not
    s = getenv("kernelProtectBist");
    tok = strtok (s," ");
    if (tok != NULL && 0 == strcmp(tok, "block"))
        u32Block = 1;
}