Ejemplo n.º 1
0
/*******************************************************************************
* mvCpuNameGet - Get CPU name
*
* DESCRIPTION:
*       This function returns a string describing the CPU model and revision.
*
* INPUT:
*       None.
*
* OUTPUT:
*       pNameBuff - Buffer to contain board name string. Minimum size 32 chars.
*
* RETURN:
*       None.
*******************************************************************************/
MV_VOID mvCpuNameGet(char *pNameBuff)
{
    MV_U32 cpuModel;
    
    cpuModel = mvOsCpuPartGet();

    /* The CPU module is indicated in the Processor Version Register (PVR) */
    switch(cpuModel)
    {
        case CPU_PART_ARM926:
            mvOsSPrintf(pNameBuff, "%s (Rev %d)", "ARM926",mvOsCpuRevGet());
            break;
	case CPU_PART_ARM946:
		mvOsSPrintf(pNameBuff, "%s (Rev %d)", "ARM946",mvOsCpuRevGet());
		break;
        default:
            mvOsSPrintf(pNameBuff,"??? (0x%04x) (Rev %d)",cpuModel,mvOsCpuRevGet());
            break;
    }  /* switch  */

    return;
}
int PTexist(void)
{
	char *env;
#ifdef MV_PT
	env = getenv("enaPT");
#ifdef CONFIG_MV_LE
	/* if LE page table disable is the default. ( MIPS - unstable, PPC need to change the page settings) */
	if( ( (strcmp(env,"yes") == 0) || (strcmp(env,"Yes") == 0) ) ){
#else
	/* if BE page table enable is the default. */
	if(!env || ( (strcmp(env,"yes") == 0) || (strcmp(env,"Yes") == 0) ) ){
#endif
		return 1;
	}
#endif
	return 0;
}
#endif
/***********************************************************************************/
/* hook function that is called after rellocating to the DRAM, Flash Init, PCI init*/
/* and malloc init are done, and before Gig port init.				   */
/***********************************************************************************/
void mon_extension_after_relloc(void)
{
#if defined(MV_INCLUDE_MONT_FFS)
	unsigned int status;
#endif

#if defined(MV_INCLUDE_MONT_MMU)
	if ((mvOsCpuPartGet() == CPU_PART_ARM926)  ||
		(mvOsCpuPartGet() == CPU_PART_MRVL131) ||
		(mvOsCpuPartGet() == CPU_PART_MRVLPJ4B_UP) ||
		(mvOsCpuPartGet() == CPU_PART_MRVLPJ4B_MP))
	{
		/* Page Table */
		if(PTexist() )
		{
			pageTableInit();

			setenv("enaPT","yes");
		}
		else
			setenv("enaPT","no");
	}
#endif /* MV_INCLUDE_MONT_MMU */

#if defined(MV_INCLUDE_MONT_MPU)
	else if (mvOsCpuPartGet() == CPU_PART_ARM946)
	{
		char *env;
		env = getenv("enaMPU");

		if ((!env)||( (strcmp(env,"yes") == 0) || (strcmp(env,"Yes") == 0) ))
		{
				setenv("enaMPU","yes");
				MPU_Init();
		}
	}
#endif /* MV_INCLUDE_MONT_MPU */


#if defined(CONFIG_CMD_BSP)
	#if defined(MV_INCLUDE_MONT_FFS)
    if (whoAmI() == MASTER_CPU)
	{
	status = mvFSInit(FS_NO_CACHE);


	if(!(status == FS_NO_VALID_FAT_STRING || status == FS_OFFSET_OUT_OF_RANGE))
	{
		printf("File system present and initialized on the main Flash Memory\n");
		}
	}
	else
	{
		printf("No File system on the main Flash Memory\n");
	}
	#endif /* MV_INCLUDE_MONT_FFS */
#endif

	return;
}