Example #1
0
void main(void)
{
	INT32 nRet;
	
	OEMWriteDebugLED(0, 0x0);

	// Set up the copy section data.
	if (!SetupCopySection(pTOC))
	{
		while(1);
	}

	// Clear LEDs.
	OEMWriteDebugLED(0, 0x0);

	OEMInitDebugSerial();
	OEMWriteDebugString(L" [NBL2] main() Starts !\r\n");
	OEMWriteDebugString(L" [NBL2] Serial Initialized...\r\n");

	nRet = FIL_Init();
	if (nRet != FIL_SUCCESS)
	{
		OEMWriteDebugString(L" [NBL2:ERR] FIL_Init() : Failed\r\n");
		while(1);
	}
	OEMWriteDebugString(L" [NBL2] FIL_Init() : Passed\r\n");

	ShadowEboot();

	OEMWriteDebugString(L" [NBL2] Launch Eboot...\r\n");

	OEMLaunchImage(EBOOT_VIRTUAL_BASEADDR);
}
Example #2
0
static void OEMMessageHandler(IPL_MESSAGE_CODE MessageCode, LPWSTR pMessageString)
{

    // Write a hex LED code.
    //
    OEMWriteDebugString((UINT16 *)pMessageString);

}
Example #3
0
void ShadowEboot(void)
{
	LowFuncTbl *pLowFuncTbl;

	UINT32 dwStartBlock, dwNumBlock, dwBlock;
	UINT32 dwPageOffset;
	INT32 nRet;

	UINT8 pSBuf[512];
	UINT8 *pBuffer;
	BOOL32 bIsBadBlock = FALSE32;
	
	memset(pSBuf, 0xFF, BYTES_PER_SPARE_SUPAGE);		// Initialize the spare buffer

	OEMWriteDebugString(L" [NBL2] ++ShadowEboot()\r\n");

	pLowFuncTbl = FIL_GetFuncTbl();

	pBuffer = (UINT8 *)EBOOT_VIRTUAL_BASEADDR;
	dwStartBlock = VFL_EBOOT_START_BLOCK;
	dwNumBlock = VFL_EBOOT_BLOCK_SIZE;

	dwBlock = dwStartBlock;

	while(dwNumBlock > 0)
	{
		if (dwBlock == (VFL_EBOOT_START_BLOCK+VFL_EBOOT_AREA_SIZE))
		{
			OEMWriteDebugString(L" [NBL2:ERR] ShadowEboot() Critical Error\r\n");
			OEMWriteDebugString(L" [NBL2:ERR] Too many Bad Block\r\n");
			while(1);
		}

		IS_CHECK_SPARE_ECC = FALSE32;
		pLowFuncTbl->Read(0, dwBlock*PAGES_PER_BLOCK+PAGES_PER_BLOCK-1, 0x0, enuBOTH_PLANE_BITMAP, NULL, pSBuf, TRUE32, FALSE32);
		IS_CHECK_SPARE_ECC = TRUE32;

		if (TWO_PLANE_PROGRAM == TRUE32)
		{
			if (pSBuf[0] == 0xff && pSBuf[BYTES_PER_SPARE_PAGE] == 0xff)
				bIsBadBlock = TRUE32;
		}
		else
		{
			if (pSBuf[0] == 0xff)
				bIsBadBlock = TRUE32;
		}

		if (bIsBadBlock)
		{
			for (dwPageOffset=0; dwPageOffset<PAGES_PER_BLOCK; dwPageOffset++)
			{
				nRet = pLowFuncTbl->Read(0, dwBlock*PAGES_PER_BLOCK+dwPageOffset, FULL_SECTOR_BITMAP_PAGE, enuBOTH_PLANE_BITMAP, pBuffer+BYTES_PER_MAIN_SUPAGE*dwPageOffset, NULL, FALSE32, FALSE32);
				if (nRet == FIL_U_ECC_ERROR)
				{
					OEMWriteDebugString(L" [NBL2:ERR] FIL_Read() : Uncorrectable ECC Error\r\n");
					while(1);
				}
				else if (nRet == FIL_CRITICAL_ERROR)
				{
					OEMWriteDebugString(L" [NBL2:ERR] VFL_Read() : Critical Error\r\n");
					while(1);
				}
			}

			dwBlock++;
			dwNumBlock--;
			pBuffer += BYTES_PER_MAIN_SUPAGE*PAGES_PER_BLOCK;
			continue;
		}
		else
		{
			OEMWriteDebugString(L" [NBL2:ERR] Bad Block Skipped\r\n");
			dwBlock++;
			continue;
		}
	}

	OEMWriteDebugString(L" [NBL2] --ShadowEboot()\r\n");
}
Example #4
0
BOOLEAN OEMGetUpdateMode(void)
{
    BOOL *pfUpdateMode = NULL;
    BSP_ARGS *iplpBSPArgs = ((BSP_ARGS *) IMAGE_SHARE_ARGS_UA_START);
    BOOL fUpdateMode = iplpBSPArgs->fUpdateMode;

    OALLog(L"OEMGetUpdateMode\r\n");

    if(!fUpdateMode){
        pfUpdateMode = (BOOL *) OALArgsQuery(OAL_ARGS_QUERY_UPDATEMODE);
        if (pfUpdateMode == NULL)
        {
            OEMWriteDebugString(L"Invalid BSP Args - initializing to good values\r\n");
            InitBSPArgs();
        }
        else
        {
            fUpdateMode = *pfUpdateMode;
        }
	}
    else
    {
        // create the header
    	iplpBSPArgs->header.signature       = OAL_ARGS_SIGNATURE;
    	iplpBSPArgs->header.oalVersion      = OAL_ARGS_VERSION;
    	iplpBSPArgs->header.bspVersion      = BSP_ARGS_VERSION;
    	RETAILMSG(1,(TEXT("updateTRUE but set ARG\r\n")));
    }



    if (fUpdateMode)
    {
        OEMWriteDebugString(L"Update Mode RAM flag is set\r\n");
    }
    else
    {
        // RAM flag is not set - are we recovering from power failure?
        if (!BP_GetUpdateModeFlag(&fUpdateMode))
        {
            OEMWriteDebugString(L"Error in BP_GetUpdateModeFlag\r\n");
        }
        if (fUpdateMode)
        {
            OEMWriteDebugString(L"Update Mode Persistent flag is set\r\n");
        }
    }

    if (fUpdateMode)
    {
        OEMWriteDebugString(L"----------------------------------------\r\n");
        OEMWriteDebugString(L"--------------- LOAD ULDR --------------\r\n");
        OEMWriteDebugString(L"----------------------------------------\r\n");
    }
	else
	{
        OEMWriteDebugString(L"----------------------------------------\r\n");
        OEMWriteDebugString(L"---------------  LOAD OS  --------------\r\n");
        OEMWriteDebugString(L"----------------------------------------\r\n");
    }
    
    return(fUpdateMode);
}