85xx: Use print_size to report amount of memory not mapped by TLBs
PATCH 1/2 85xx: Use print_size to report amount of memory not mapped by TLBs
Signed-off-by Kumar Gala <[email protected]>
--- cpu/mpc85xx/tlb.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
cpu/mpc85xx/tlb.c +1 -1
@@ -165,7 +165,7 @@ unsigned int setup_ddr_tlbs(unsigned int memsize_in_meg) }if (memsize) -printf ("%lldM left unmapped\n" , memsize >>20 ); +print_size (memsize," left unmapped\n" );/* * Confirm that the requested amount of memory was mapped.
Signature · 1 line
1.6.0.6
PATCH 2/2 fsl-ddr: Fix handling of >4G of memory when !CONFIG_PHYS_64BIT
The ddr code computes most things as 64-bit quantities and had some places in the middle that it was using phy_addr_t and phys_size_t.
Instead we use unsigned long long through out and only at the last stage of setting the LAWs and reporting the amount of memory to the board code do we truncate down to what we can cover via phys_size_t.
This has the added benefit that the DDR controller itself is always setup the same way regardless of how much memory we have. Its only the LAW setup that limits what is visible to the system.
Signed-off-by Kumar Gala <[email protected]>
--- cpu/mpc8xxx/ddr/ctrl_regs.c | 3 +- cpu/mpc8xxx/ddr/ddr.h | 2 +- cpu/mpc8xxx/ddr/ddr1_dimm_params.c | 4 +- cpu/mpc8xxx/ddr/ddr2_dimm_params.c | 4 +- cpu/mpc8xxx/ddr/ddr3_dimm_params.c | 4 +- cpu/mpc8xxx/ddr/main.c | 45 ++++++++++++++++------------------- cpu/mpc8xxx/ddr/util.c | 18 +++++++++---- 7 files changed, 41 insertions(+), 39 deletions(-)
cpu/mpc8xxx/ddr/ctrl_regs.c +1 -2
@@ -1199,8 +1199,7 @@ compute_fsl_memctl_config_regs(const memctl_options_t *popts,/* Chip Select Memory Bounds (CSn_BNDS) */ for (i =0 ; i <CONFIG_CHIP_SELECTS_PER_CTRL ; i++) { -phys_size_t sa =0 ; -phys_size_t ea =0 ; +unsigned long long ea =0 , sa =0 ;if (popts->ba_intlv_ctl && (i >0 ) && ((popts->ba_intlv_ctl &0x60 ) !=FSL_DDR_CS2_CS3 )) {
cpu/mpc8xxx/ddr/ddr.h +1 -1
@@ -54,7 +54,7 @@ typedef struct {#define STEP_PROGRAM_REGS (1 << 6)#define STEP_ALL 0xFFF -extern phys_size_t +extern unsigned long long fsl_ddr_compute (fsl_ddr_info_t *pinfo,unsigned int start_step);extern const char *step_to_string (unsigned int step);
cpu/mpc8xxx/ddr/ddr1_dimm_params.c +2 -2
@@ -33,10 +33,10 @@* 2 or 5 bits off and shifting them up to the top. */ -static phys_size_t +static unsigned long long compute_ranksize (unsigned int mem_type,unsigned char row_dens) { -phys_size_t bsize; +unsigned long long bsize;/* Bottom 2 bits up to the top. */ bsize = ((row_dens >>2 ) | ((row_dens &3 ) <<6 ));
cpu/mpc8xxx/ddr/ddr2_dimm_params.c +2 -2
@@ -32,10 +32,10 @@* 2 or 5 bits off and shifting them up to the top. * */ -static phys_size_t +static unsigned long long compute_ranksize (unsigned int mem_type,unsigned char row_dens) { -phys_size_t bsize; +unsigned long long bsize;/* Bottom 5 bits up to the top. */ bsize = ((row_dens >>5 ) | ((row_dens &31 ) <<3 ));
cpu/mpc8xxx/ddr/ddr3_dimm_params.c +2 -2
@@ -52,10 +52,10 @@* 011 32bits * */ -static phys_size_t +static unsigned long long compute_ranksize (const ddr3_spd_eeprom_t *spd) { -phys_size_t bsize; +unsigned long long bsize;int nbit_sdram_cap_bsize =0 ;int nbit_primary_bus_width =0 ;
cpu/mpc8xxx/ddr/main.c +21 -24
104 lines not on this page · raw message
cpu/mpc8xxx/ddr/util.c +12 -6
@@ -64,6 +64,9 @@ __fsl_ddr_set_lawbar(const common_timing_params_t *memctl_common_params, unsigned int memctl_interleaved, unsigned int ctrl_num) { +unsigned long long base = memctl_common_params->base_address; +unsigned long long size = memctl_common_params->total_mem; +/* * If no DIMMs on this controller, do not proceed any further. */
@@ -71,6 +74,13 @@ __fsl_ddr_set_lawbar(const common_timing_params_t *memctl_common_params,return ; } +#if !defined(CONFIG_PHYS_64BIT ) +if (base >=CONFIG_MAX_MEM_MAPPED ) +return ; +if ((base + size) >=CONFIG_MAX_MEM_MAPPED ) + size =CONFIG_MAX_MEM_MAPPED - base; +#endif +if (ctrl_num ==0 ) {/* * Set up LAW for DDR controller 1 space.
@@ -78,16 +88,12 @@ __fsl_ddr_set_lawbar(const common_timing_params_t *memctl_common_params,unsigned int lawbar1_target_id = memctl_interleaved ?LAW_TRGT_IF_DDR_INTRLV :LAW_TRGT_IF_DDR_1 ; -if (set_ddr_laws (memctl_common_params->base_address, - memctl_common_params->total_mem, - lawbar1_target_id) <0 ) { +if (set_ddr_laws (base, size, lawbar1_target_id) <0 ) {printf ("ERROR\n" );return ; } }else if (ctrl_num ==1 ) { -if (set_ddr_laws (memctl_common_params->base_address, - memctl_common_params->total_mem, -LAW_TRGT_IF_DDR_2 ) <0 ) { +if (set_ddr_laws (base, size,LAW_TRGT_IF_DDR_2 ) <0 ) {printf ("ERROR\n" );return ; }
Signature · 1 line
1.6.0.6