lib/sw_apps/zynqmp_fsbl/src/xfsbl_ddr_init.c
u64 XFsbl_ComputeDdr3RankSize(struct Ddr3SpdEeprom *Ddr3SpdData)
{
	u64 BSize;
	u32 NbitDdramCapBsize;
	u32 NbitPrimaryBusWidth;
	u32 NbitSdramWidth;

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

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

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

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

	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_ComputeDdr3RankSize(struct Ddr3SpdEeprom *Ddr3SpdData)
{
	u64 BSize;
	u32 NbitDdramCapBsize;
	u32 NbitPrimaryBusWidth;
	u32 NbitSdramWidth;
	if ((Ddr3SpdData->DensityBanks & 0xFU) < 7U) {
		NbitDdramCapBsize = (Ddr3SpdData->DensityBanks & 0xFU) + 28U;
	} else {
		NbitDdramCapBsize = 0U;
	}
	if ((Ddr3SpdData->BusWidth & 0x7U) < 4U) {
		NbitPrimaryBusWidth = (Ddr3SpdData->BusWidth & 0x7U) + 3U;
	} else {
		NbitPrimaryBusWidth = 0U;
	}
	if ((Ddr3SpdData->Organization & 0x7U) < 4U) {
		NbitSdramWidth = (Ddr3SpdData->Organization & 0x7U) + 2U;
	} else {
		NbitSdramWidth = 0U;
	}
	BSize = 1ULL << (NbitDdramCapBsize - 3U
			+ NbitPrimaryBusWidth - NbitSdramWidth);
	return BSize;
}
u64 XFsbl_ComputeDdr3RankSize ( struct Ddr3SpdEeprom * Ddr3SpdData ) { u64 BSize ; u32 NbitDdramCapBsize ; u32 NbitPrimaryBusWidth ; u32 NbitSdramWidth ; if ( ( Ddr3SpdData -> DensityBanks & 0xFU ) < 7U ) { NbitDdramCapBsize = ( Ddr3SpdData -> DensityBanks & 0xFU ) + 28U ; } else { NbitDdramCapBsize = 0U ; } if ( ( Ddr3SpdData -> BusWidth & 0x7U ) < 4U ) { NbitPrimaryBusWidth = ( Ddr3SpdData -> BusWidth & 0x7U ) + 3U ; } else { NbitPrimaryBusWidth = 0U ; } if ( ( Ddr3SpdData -> Organization & 0x7U ) < 4U ) { NbitSdramWidth = ( Ddr3SpdData -> Organization & 0x7U ) + 2U ; } else { NbitSdramWidth = 0U ; } BSize = 1ULL << ( NbitDdramCapBsize - 3U + NbitPrimaryBusWidth - NbitSdramWidth ) ; 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