Beispiel #1
0
/*******************************************************************************
* sdmmcWinOverlapDetect - Detect SDMMC address windows overlapping
*
* DESCRIPTION:
*       An unpredicted behaviur is expected in case SDMMC address decode
*       windows overlapps.
*       This function detects SDMMC address decode windows overlapping of a
*       specified window. The function does not check the window itself for
*       overlapping. The function also skipps disabled address decode windows.
*
* INPUT:
*       winNum      - address decode window number.
*       pAddrDecWin - An address decode window struct.
*
* OUTPUT:
*       None.
*
* RETURN:
*       MV_TRUE if the given address window overlap current address
*       decode map, MV_FALSE otherwise, MV_ERROR if reading invalid data
*       from registers.
*
*******************************************************************************/
static MV_STATUS sdmmcWinOverlapDetect(int dev, MV_U32 winNum,
				      MV_ADDR_WIN *pAddrWin)
{
    MV_U32          winNumIndex;
    MV_SDMMC_DEC_WIN  addrDecWin;

    for(winNumIndex=0; winNumIndex<MV_SDMMC_MAX_ADDR_DECODE_WIN; winNumIndex++)
    {
        /* Do not check window itself       */
        if (winNumIndex == winNum)
        {
            continue;
        }

        /* Get window parameters    */
        if (MV_OK != mvSdmmcWinGet(dev, winNumIndex, &addrDecWin))
        {
            mvOsPrintf("%s: ERR. TargetWinGet failed\n", __FUNCTION__);
            return MV_ERROR;
        }

        /* Do not check disabled windows    */
        if(addrDecWin.enable == MV_FALSE)
        {
            continue;
        }

        if (MV_TRUE == ctrlWinOverlapTest(pAddrWin, &(addrDecWin.addrWin)))
        {
            return MV_TRUE;
        }
    }
    return MV_FALSE;
}
Beispiel #2
0
/*******************************************************************************
* tsuWinOverlapDetect
*
* DESCRIPTION:
*	Detect TSU address windows overlapping
*	An unpredicted behaviur is expected in case TSU address decode
*	windows overlapps.
*	This function detects TSU address decode windows overlapping of a
*	specified window. The function does not check the window itself for
*	overlapping. The function also skipps disabled address decode windows.
*
* INPUT:
*       winNum      - address decode window number.
*       pAddrDecWin - An address decode window struct.
*
* OUTPUT:
*       None.
*
* RETURN:
*       MV_TRUE if the given address window overlap current address
*       decode map, MV_FALSE otherwise, MV_ERROR if reading invalid data
*       from registers.
*
*******************************************************************************/
static MV_STATUS tsuWinOverlapDetect(MV_U32 winNum, MV_ADDR_WIN *pAddrWin)
{
	MV_U32              ctrlReg;
	MV_U32              winNumIndex;
	MV_TSU_DEC_WIN      addrDecWin;

	for(winNumIndex = 0; winNumIndex < TSU_MAX_DECODE_WIN; winNumIndex++)
	{
		/* Do not check window itself           */
		if(winNumIndex == winNum)
		{
			continue;
		}

		/* Do not check disabled windows        */
		ctrlReg = MV_REG_READ(MV_TSU_WIN_CTRL_REG(winNumIndex));
		if((ctrlReg & TSU_WIN_CTRL_EN_MASK) == 0)
		{
			continue;
		}

		/* Get window parameters        */
		if (MV_OK != mvTsuWinGet(winNumIndex, &addrDecWin))
		{
			mvOsPrintf("tsuWinOverlapDetect: ERR. mvTsuWinGet failed\n");
			return MV_ERROR;
		}

		if (MV_TRUE == ctrlWinOverlapTest(pAddrWin, &(addrDecWin.addrWin)))
		{
			return MV_TRUE;
		}
	}
	return MV_FALSE;
}
Beispiel #3
0
static MV_STATUS tdmWinOverlapDetect(MV_U32 winNum, MV_ADDR_WIN *pAddrWin)
{
    MV_U32      	winNumIndex;
    MV_TDM_DEC_WIN  	addrDecWin;

    for (winNumIndex = 0; winNumIndex < TDM_MBUS_MAX_WIN; winNumIndex++)
    {
		/* Do not check window itself		*/
        if (winNumIndex == winNum)
		{
			continue;
		}
		/* Do not check disabled windows	*/
		if (MV_REG_READ(TDM_WIN_CTRL_REG(winNum)) & TDM_WIN_ENABLE_MASK)
		{
			/* Get window parameters 	*/
			if (MV_OK != mvTdmWinGet(winNumIndex, &addrDecWin))
			{
				DB(mvOsPrintf("dmaWinOverlapDetect: ERR. TargetWinGet failed\n"));
            		return MV_ERROR;
			}

			if (MV_TRUE == ctrlWinOverlapTest(pAddrWin, &(addrDecWin.addrWin)))
			{
				return MV_TRUE;
			}        
		}
    }
	return MV_FALSE;
}
Beispiel #4
0
/*******************************************************************************
* cpuTargetWinOverlap - Detect CPU address decode windows overlapping
*
* DESCRIPTION:
*       An unpredicted behaviur is expected in case CPU address decode
*       windows overlapps.
*       This function detects CPU address decode windows overlapping of a
*       specified target. The function does not check the target itself for
*       overlapping. The function also skipps disabled address decode windows.
*
* INPUT:
*       target      - Peripheral target enumerator.
*       pAddrDecWin - An address decode window struct.
*
* OUTPUT:
*       None.
*
* RETURN:
*       MV_TRUE if the given address window overlaps current address
*       decode map, MV_FALSE otherwise.
*
*******************************************************************************/
static MV_BOOL cpuTargetWinOverlap(MV_TARGET target, MV_ADDR_WIN *pAddrWin)
{
    MV_U32		targetNum;
    MV_CPU_DEC_WIN 	addrDecWin;
    MV_STATUS	status;


    for(targetNum = 0; targetNum < MAX_TARGETS; targetNum++)
    {
#if defined(MV_RUN_FROM_FLASH)
        if(MV_TARGET_IS_AS_BOOT(target))
        {
            if (MV_CHANGE_BOOT_CS(targetNum) == target)
                continue;
        }
#endif /* MV_RUN_FROM_FLASH */

        /* don't check our target or illegal targets */
        if (targetNum == target)
        {
            continue;
        }

        /* Get window parameters 	*/
        status = mvCpuIfTargetWinGet(targetNum, &addrDecWin);
        if(MV_NO_SUCH == status)
        {
            continue;
        }
        if(MV_OK != status)
        {
            DB(mvOsPrintf("cpuTargetWinOverlap: ERR. TargetWinGet failed\n"));
            return MV_TRUE;
        }

        /* Do not check disabled windows	*/
        if (MV_FALSE == addrDecWin.enable)
        {
            continue;
        }

        if(MV_TRUE == ctrlWinOverlapTest(pAddrWin, &addrDecWin.addrWin))
        {
            DB(mvOsPrintf(
                   "cpuTargetWinOverlap: Required target %d overlap current %d\n",
                   target, targetNum));
            return MV_TRUE;
        }
    }

    return MV_FALSE;

}
Beispiel #5
0
/*******************************************************************************
* xorWinOverlapDetect - Detect XOR address windows overlaping
*
* DESCRIPTION:
*       An unpredicted behaviour is expected in case XOR address decode 
*       windows overlaps.
*       This function detects XOR address decode windows overlaping of a 
*       specified window. The function does not check the window itself for 
*       overlaping. The function also skipps disabled address decode windows.
*
* INPUT:
*       winNum      - address decode window number.
*       pAddrDecWin - An address decode window struct.
*
* OUTPUT:
*       None.
*
* RETURN:
*       MV_TRUE if the given address window overlap current address
*       decode map, MV_FALSE otherwise, MV_ERROR if reading invalid data 
*       from registers.
*
*******************************************************************************/
static MV_STATUS xorWinOverlapDetect(MV_U32 unit,MV_U32 winNum, MV_ADDR_WIN *pAddrWin)
{
	MV_U32 	        baseAddrEnableReg;
	MV_U32          winNumIndex,chan;
	MV_XOR_DEC_WIN  addrDecWin;

	if (pAddrWin == NULL)
	{
		DB(mvOsPrintf("%s: ERR. pAddrWin is NULL pointer\n", __FUNCTION__ ));
		return MV_BAD_PTR;
	}
    
	for (chan = 0; chan < MV_XOR_MAX_CHAN; chan++)
	{
		/* Read base address enable register. Do not check disabled windows	*/
	    baseAddrEnableReg = MV_REG_READ(XOR_WINDOW_CTRL_REG(unit,chan));

		for (winNumIndex = 0; winNumIndex < XOR_MAX_ADDR_DEC_WIN; winNumIndex++)
		{
			/* Do not check window itself */
			if (winNumIndex == winNum)
			{
				continue;
			}
    
			/* Do not check disabled windows */
			if ((baseAddrEnableReg & XEXWCR_WIN_EN_MASK(winNumIndex)) == 0)
			{
				continue;
			}
    
			/* Get window parameters */
			if (MV_OK != mvXorTargetWinGet(unit,winNumIndex, &addrDecWin))
			{
				DB(mvOsPrintf("%s: ERR. TargetWinGet failed\n", __FUNCTION__ ));
				return MV_ERROR;
			}
            
			if (MV_TRUE == ctrlWinOverlapTest(pAddrWin, &(addrDecWin.addrWin)))
			{
				return MV_TRUE;
			}
		}
	}
	
	return MV_FALSE;
}
Beispiel #6
0
/*******************************************************************************
* ethWinOverlapDetect - Detect ETH address windows overlapping
*
* DESCRIPTION:
*       An unpredicted behaviur is expected in case ETH address decode
*       windows overlapps.
*       This function detects ETH address decode windows overlapping of a
*       specified window. The function does not check the window itself for
*       overlapping. The function also skipps disabled address decode windows.
*
* INPUT:
*       winNum      - address decode window number.
*       pAddrDecWin - An address decode window struct.
*
* OUTPUT:
*       None.
*
* RETURN:
*       MV_TRUE if the given address window overlap current address
*       decode map, MV_FALSE otherwise, MV_ERROR if reading invalid data
*       from registers.
*
*******************************************************************************/
static MV_STATUS ethWinOverlapDetect(int port, MV_U32 winNum, MV_ADDR_WIN *pAddrWin)
{
    MV_U32              baseAddrEnableReg;
    MV_U32              winNumIndex;
    MV_ETH_DEC_WIN      addrDecWin;
                                                                                                                             
    /* Read base address enable register. Do not check disabled windows     */
    baseAddrEnableReg = MV_REG_READ(ETH_BASE_ADDR_ENABLE_REG(port));
                                                                                                                             
    for (winNumIndex=0; winNumIndex<ETH_MAX_DECODE_WIN; winNumIndex++)
    {
        /* Do not check window itself           */
        if (winNumIndex == winNum)
        {
            continue;
        }
    
        /* Do not check disabled windows        */
        if (baseAddrEnableReg & (1 << winNumIndex))
        {
            continue;
        }
    
        /* Get window parameters        */
        if (MV_OK != mvEthWinGet(port, winNumIndex, &addrDecWin))
        {
            mvOsPrintf("ethWinOverlapDetect: ERR. TargetWinGet failed\n");
            return MV_ERROR;
        }
/*    
        mvOsPrintf("ethWinOverlapDetect:\n
            winNumIndex =%d baseHigh =0x%x baseLow=0x%x size=0x%x enable=0x%x\n",
            winNumIndex,
            addrDecWin.addrWin.baseHigh,
            addrDecWin.addrWin.baseLow,
            addrDecWin.addrWin.size,
            addrDecWin.enable);
*/
        if (MV_TRUE == ctrlWinOverlapTest(pAddrWin, &(addrDecWin.addrWin)))
        {
            return MV_TRUE;
        }
    }
    return MV_FALSE;
}
Beispiel #7
0
/*******************************************************************************
* sdramIfWinOverlap - Check if an address window overlap an SDRAM address window
*
* DESCRIPTION:
*		This function scan each SDRAM address decode window to test if it 
*		overlapps the given address windoow 
*
* INPUT:
*       target      - SDRAM target where the function skips checking.
*       pAddrDecWin - The tested address window for overlapping with 
*					  SDRAM windows.
*
* OUTPUT:
*       None.
*
* RETURN:
*       MV_TRUE if the given address window overlaps any enabled address
*       decode map, MV_FALSE otherwise.
*
*******************************************************************************/
static MV_BOOL sdramIfWinOverlap(MV_TARGET target, MV_ADDR_WIN *pAddrWin)
{
	MV_TARGET	targetNum;
	MV_DRAM_DEC_WIN 	addrDecWin;
	
	for(targetNum = SDRAM_CS0; targetNum < SDRAM_CS3+1 ; targetNum++)
	{
		/* don't check our winNum or illegal targets */
		if (targetNum == target)
		{
			continue;
		}
		
		/* Get window parameters 	*/
		if (MV_OK != mvDramIfWinGet(targetNum, &addrDecWin))
		{
			mvOsPrintf("sdramIfWinOverlap: ERR. TargetWinGet failed\n");
			return MV_ERROR;
		}
	
		/* Do not check disabled windows	*/
		if (MV_FALSE == addrDecWin.enable)
		{
			continue;
		}
	
		if(MV_TRUE == ctrlWinOverlapTest(pAddrWin, &addrDecWin.addrWin))
		{                    
			mvOsPrintf(
			"sdramIfWinOverlap: Required target %d overlap winNum %d\n", 
			target, targetNum);
			return MV_TRUE;           
		}
	}
	
	return MV_FALSE;
}