coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
memory.c File Reference
#include <assert.h>
#include <cbfs.h>
#include <cbmem.h>
#include <commonlib/bsd/mem_chip_info.h>
#include <console/console.h>
#include <soc/dramc_common.h>
#include <ip_checksum.h>
#include <mrc_cache.h>
#include <soc/dramc_param.h>
#include <soc/emi.h>
#include <soc/mmu_operations.h>
#include <symbols.h>
#include <timer.h>
Include dependency graph for memory.c:

Go to the source code of this file.

Macros

#define CALIBRATION_REGION   "RW_MRC_CACHE"
 
#define CALIBRATION_REGION_SIZE   0x2000
 

Functions

 _Static_assert (sizeof(struct dramc_param)<=CALIBRATION_REGION_SIZE, "sizeof(struct dramc_param) exceeds " CALIBRATION_REGION)
 
const char * get_dram_geometry_str (u32 ddr_geometry)
 
const char * get_dram_type_str (u32 ddr_type)
 
static int mt_mem_test (const struct dramc_data *dparam)
 
size_t mtk_dram_size (void)
 
static void fill_dram_info (struct mem_chip_info *mc, const struct ddr_base_info *ddr)
 
static void add_mem_chip_info (int unused)
 
 ROMSTAGE_CBMEM_INIT_HOOK (add_mem_chip_info)
 
static int run_dram_blob (struct dramc_param *dparam)
 
static int dram_run_fast_calibration (struct dramc_param *dparam)
 
static int dram_run_full_calibration (struct dramc_param *dparam)
 
static void mem_init_set_default_config (struct dramc_param *dparam, const struct sdram_info *dram_info)
 
static void mt_mem_init_run (struct dramc_param *dparam, const struct sdram_info *dram_info)
 
void mt_mem_init (struct dramc_param *dparam)
 
void mtk_dram_init (void)
 

Variables

static const struct ddr_base_infocurr_ddr_info
 

Macro Definition Documentation

◆ CALIBRATION_REGION

#define CALIBRATION_REGION   "RW_MRC_CACHE"

Definition at line 18 of file memory.c.

◆ CALIBRATION_REGION_SIZE

#define CALIBRATION_REGION_SIZE   0x2000

Definition at line 19 of file memory.c.

Function Documentation

◆ _Static_assert()

_Static_assert ( sizeof(struct dramc_param)<=  CALIBRATION_REGION_SIZE,
"sizeof(struct dramc_param) exceeds "  CALIBRATION_REGION 
)

◆ add_mem_chip_info()

static void add_mem_chip_info ( int  unused)
static

Definition at line 132 of file memory.c.

References assert, BIOS_DEBUG, cbmem_add(), CBMEM_ID_MEM_CHIP_INFO, CHANNEL_MAX, CONFIG, curr_ddr_info, fill_dram_info(), and printk.

Here is the call graph for this function:

◆ dram_run_fast_calibration()

static int dram_run_fast_calibration ( struct dramc_param dparam)
static

◆ dram_run_full_calibration()

static int dram_run_full_calibration ( struct dramc_param dparam)
static

Definition at line 220 of file memory.c.

References initialize_dramc_param(), and run_dram_blob().

Referenced by mt_mem_init_run().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fill_dram_info()

static void fill_dram_info ( struct mem_chip_info mc,
const struct ddr_base_info ddr 
)
static

◆ get_dram_geometry_str()

const char * get_dram_geometry_str ( u32  ddr_geometry)

◆ get_dram_type_str()

const char * get_dram_type_str ( u32  ddr_type)

Definition at line 83 of file memory.c.

References DDR_TYPE_DISCRETE, DDR_TYPE_EMCP, and s.

Referenced by mem_init_set_default_config().

Here is the caller graph for this function:

◆ mem_init_set_default_config()

static void mem_init_set_default_config ( struct dramc_param dparam,
const struct sdram_info dram_info 
)
static

Definition at line 227 of file memory.c.

References BIOS_INFO, CONFIG, ddr_base_info::config_dvfs, sdram_info::ddr_geometry, dramc_data::ddr_info, sdram_info::ddr_type, dramc_param::dramc_datas, DRAMC_ENABLE_DVFS, get_dram_geometry_str(), get_dram_type_str(), memset(), printk, ddr_base_info::sdram, and type.

Referenced by mt_mem_init_run().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mt_mem_init()

void mt_mem_init ( struct dramc_param dparam)

Definition at line 304 of file memory.c.

References get_sdram_config(), and mt_mem_init_run().

Referenced by mtk_dram_init(), and platform_romstage_main().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mt_mem_init_run()

static void mt_mem_init_run ( struct dramc_param dparam,
const struct sdram_info dram_info 
)
static

◆ mt_mem_test()

static int mt_mem_test ( const struct dramc_data dparam)
static

Definition at line 29 of file memory.c.

References _dram, addr, BIOS_DEBUG, BIOS_ERR, complex_mem_test(), CONFIG, dramc_data::ddr_info, printk, RANK_0, ddr_base_info::rank_size, and ddr_base_info::support_ranks.

Referenced by dram_run_fast_calibration().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mtk_dram_init()

void mtk_dram_init ( void  )

Definition at line 311 of file memory.c.

References curr_ddr_info, dramc_data::ddr_info, dramc_param::dramc_datas, dramc_parameter, mt_mem_init(), and mtk_mmu_after_dram().

Referenced by platform_romstage_main().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mtk_dram_size()

size_t mtk_dram_size ( void  )

Definition at line 102 of file memory.c.

References curr_ddr_info, ddr_mrr_info::mr8_density, ddr_base_info::mrr_info, and RANK_MAX.

Referenced by fill_dram_info(), and sdram_size().

Here is the caller graph for this function:

◆ ROMSTAGE_CBMEM_INIT_HOOK()

ROMSTAGE_CBMEM_INIT_HOOK ( add_mem_chip_info  )

◆ run_dram_blob()

Variable Documentation

◆ curr_ddr_info

const struct ddr_base_info* curr_ddr_info
static

Definition at line 27 of file memory.c.

Referenced by add_mem_chip_info(), mtk_dram_init(), and mtk_dram_size().