コード例 #1
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(MV_U32 winNum, MV_ADDR_WIN *pAddrWin)
{
	MV_U32 baseAddrEnableReg;
	MV_U32 winNumIndex;
	MV_UNIT_WIN_INFO addrDecWin;

	/* Read base address enable register. Do not check disabled windows     */
	baseAddrEnableReg = MV_REG_READ(ETH_BASE_ADDR_ENABLE_REG);

	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 != mvPp2WinRead(0, winNumIndex, &addrDecWin)) {
			mvOsPrintf("ethWinOverlapDetect: ERR. TargetWinGet failed\n");
			return MV_ERROR;
		}

		if (MV_TRUE == mvWinOverlapTest(pAddrWin, &(addrDecWin.addrWin)))
			return MV_TRUE;
	}
	return MV_FALSE;
}
コード例 #2
0
/*******************************************************************************
* sataWinOverlapDetect - Detect SATA address windows overlapping
*
* DESCRIPTION:
*       An unpredicted behaviur is expected in case SATA address decode 
*       windows overlapps.
*       This function detects SATA 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 sataWinOverlapDetect(int dev, MV_U32 winNum, 
				      MV_ADDR_WIN *pAddrWin)
{
    MV_U32		winNumIndex;
    MV_UNIT_WIN_INFO	addrDecWin;

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

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

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

        if (MV_TRUE == mvWinOverlapTest(pAddrWin, &(addrDecWin.addrWin)))
        {
            return MV_TRUE;
        }        
    }
    return MV_FALSE;
}
コード例 #3
0
/*******************************************************************************
* tsuWinOverlapDetect - Detect TS address windows overlaping
*
* DESCRIPTION:
*       An unpredicted behaviour is expected in case TS address decode 
*       windows overlaps.
*       This function detects TS 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 tsuWinOverlapDetect(MV_U32 winNum, MV_ADDR_WIN *pAddrWin)
{
    MV_U32		baseAddrEnableReg;
    MV_U32		winNumIndex;
    MV_UNIT_WIN_INFO	addrDecWin;

    if (pAddrWin == NULL) {
	DB(mvOsPrintf("%s: ERR. pAddrWin is NULL pointer\n", __FUNCTION__ ));
	return MV_BAD_PTR;
    }

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

	/* Read base address enable register. Do not check disabled windows	*/
	baseAddrEnableReg = MV_REG_READ(MV_TSU_WIN_CTRL_REG(winNumIndex));

	/* Do not check disabled windows */
	if ((baseAddrEnableReg & TSU_WIN_CTRL_EN_MASK) == 0)
	    continue;

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

	if (MV_TRUE == mvWinOverlapTest(pAddrWin, &(addrDecWin.addrWin)))
	    return MV_TRUE;
    }

    return MV_FALSE;
}
コード例 #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++) {
		/* 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 == mvWinOverlapTest(pAddrWin, &addrDecWin.addrWin)) {
			DB(mvOsPrintf("cpuTargetWinOverlap: Required target %d overlap current %d\n",
				      target, targetNum));
			return MV_TRUE;
		}
	}

	return MV_FALSE;
}
コード例 #5
0
/*******************************************************************************
* usbWinOverlapDetect - Detect USB address windows overlapping
*
* DESCRIPTION:
*       An unpredicted behaviur is expected in case USB address decode
*       windows overlapps.
*       This function detects USB 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 usbWinOverlapDetect(MV_U32 dev, MV_U32 winNum, MV_ADDR_WIN *pAddrWin)
{
	MV_U32 winNumIndex;
	MV_UNIT_WIN_INFO addrDecWin;

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

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

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

		if (MV_TRUE == mvWinOverlapTest(pAddrWin, &(addrDecWin.addrWin)))
			return MV_TRUE;
	}
	return MV_FALSE;
}
コード例 #6
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_UNIT_WIN_INFO addrDecWin;

	if (pAddrWin == NULL) {
		DB(mvOsPrintf("%s: ERR. pAddrWin is NULL pointer\n",  __func__));
		return MV_BAD_PTR;
	}

	for (chan = 0; chan < MV_XOR_MAX_CHAN_PER_UNIT; 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 != mvXorTargetWinRead(unit, winNumIndex, &addrDecWin)) {
				DB(mvOsPrintf("%s: ERR. TargetWinGet failed\n",  __func__));
				return MV_ERROR;
			}

			if (MV_TRUE == mvWinOverlapTest(pAddrWin, &(addrDecWin.addrWin)))
				return MV_TRUE;
		}
	}

	return MV_FALSE;
}