lib/sw_apps/zynqmp_fsbl/src/xfsbl_ddr_init.c
u64 XFsbl_ComputeLpDdrRankSize(struct LpDdrSpdEeprom *LpDdrSpdData)
{
	u64 BSize;

	u32 NbitDdramCapBsize;
	u32 NbitPrimaryBusWidth;
	u32 NbitSdramWidth;
	u32 DieCount;
	u8 Package3Ds;

	if ((LpDdrSpdData->DensityBanks & 0xFU) <= 7U) {
		NbitDdramCapBsize = (LpDdrSpdData->DensityBanks & 0xFU) + 28U;
	} else {
		NbitDdramCapBsize = 0U;
	}

	if ((LpDdrSpdData->BusWidth & 0x7U) < 4U) {
		NbitPrimaryBusWidth = (LpDdrSpdData->BusWidth & 0x7U) + 3U;
	} else {
		NbitPrimaryBusWidth = 0U;
	}

	if ((LpDdrSpdData->Organization & 0x7U) < 4U) {
		NbitSdramWidth = (LpDdrSpdData->Organization & 0x7U) + 2U;
	} else {
		NbitSdramWidth = 0U;
	}

	Package3Ds = (LpDdrSpdData->PackageType & 0x3U) == 0x2U;
	if (Package3Ds) {
		DieCount = (LpDdrSpdData->PackageType >> 4U) & 0x7U;
	} else {
		DieCount = 0U;
	}

	BSize = 1ULL << (NbitDdramCapBsize - 3U +
			NbitPrimaryBusWidth - NbitSdramWidth +
			DieCount);

	return BSize;
}
/*****************************************************************************/
/**
 * This function returns the particular DDR rank
 *
 * @param	DdrDataPtr is pointer to DDR Initialization Data Structure
 *
 * @return	returns DDR Rank Size
 *
 *****************************************************************************/
This function returns the particular DDR rank
@param       DdrDataPtr is pointer to DDR Initialization Data Structure

@return      returns DDR Rank Size
This function returns the particular DDR rank @param DdrDataPtr is pointer to DDR Initialization Data Structure @return returns DDR Rank Size
u64 XFsbl_ComputeLpDdrRankSize(struct LpDdrSpdEeprom *LpDdrSpdData)
{
	u64 BSize;
	u32 NbitDdramCapBsize;
	u32 NbitPrimaryBusWidth;
	u32 NbitSdramWidth;
	u32 DieCount;
	u8 Package3Ds;
	if ((LpDdrSpdData->DensityBanks & 0xFU) <= 7U) {
		NbitDdramCapBsize = (LpDdrSpdData->DensityBanks & 0xFU) + 28U;
	} else {
		NbitDdramCapBsize = 0U;
	}
	if ((LpDdrSpdData->BusWidth & 0x7U) < 4U) {
		NbitPrimaryBusWidth = (LpDdrSpdData->BusWidth & 0x7U) + 3U;
	} else {
		NbitPrimaryBusWidth = 0U;
	}
	if ((LpDdrSpdData->Organization & 0x7U) < 4U) {
		NbitSdramWidth = (LpDdrSpdData->Organization & 0x7U) + 2U;
	} else {
		NbitSdramWidth = 0U;
	}
	Package3Ds = (LpDdrSpdData->PackageType & 0x3U) == 0x2U;
	if (Package3Ds) {
		DieCount = (LpDdrSpdData->PackageType >> 4U) & 0x7U;
	} else {
		DieCount = 0U;
	}
	BSize = 1ULL << (NbitDdramCapBsize - 3U +
			NbitPrimaryBusWidth - NbitSdramWidth +
			DieCount);
	return BSize;
}
u64 XFsbl_ComputeLpDdrRankSize ( struct LpDdrSpdEeprom * LpDdrSpdData ) { u64 BSize ; u32 NbitDdramCapBsize ; u32 NbitPrimaryBusWidth ; u32 NbitSdramWidth ; u32 DieCount ; u8 Package3Ds ; if ( ( LpDdrSpdData -> DensityBanks & 0xFU ) <= 7U ) { NbitDdramCapBsize = ( LpDdrSpdData -> DensityBanks & 0xFU ) + 28U ; } else { NbitDdramCapBsize = 0U ; } if ( ( LpDdrSpdData -> BusWidth & 0x7U ) < 4U ) { NbitPrimaryBusWidth = ( LpDdrSpdData -> BusWidth & 0x7U ) + 3U ; } else { NbitPrimaryBusWidth = 0U ; } if ( ( LpDdrSpdData -> Organization & 0x7U ) < 4U ) { NbitSdramWidth = ( LpDdrSpdData -> Organization & 0x7U ) + 2U ; } else { NbitSdramWidth = 0U ; } Package3Ds = ( LpDdrSpdData -> PackageType & 0x3U ) == 0x2U ; if ( Package3Ds ) { DieCount = ( LpDdrSpdData -> PackageType >> 4U ) & 0x7U ; } else { DieCount = 0U ; } BSize = 1ULL << ( NbitDdramCapBsize - 3U + NbitPrimaryBusWidth - NbitSdramWidth + DieCount ) ; return BSize ; }
This function returns the particular DDR rank
 @param       DdrDataPtr is pointer to DDR Initialization Data Structure
This function returns the particular DDR rank @param DdrDataPtr is pointer to DDR Initialization Data Structure