coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
meminit.c File Reference
#include <console/console.h>
#include <fsp/util.h>
#include <memory_info.h>
#include <soc/meminit.h>
#include <stddef.h>
#include <fsp/soc_binding.h>
#include <string.h>
Include dependency graph for meminit.c:

Go to the source code of this file.

Data Structures

struct  speed_mapping
 
struct  fsp_speed_profiles
 

Functions

size_t memory_in_system_in_mib (void)
 
static void accumulate_channel_memory (int density, int dual_rank)
 
size_t iohole_in_mib (void)
 
static void set_lpddr4_defaults (FSP_M_CONFIG *cfg)
 
static const struct fsp_speed_profilesget_fsp_profile (void)
 
static int validate_speed (int speed)
 
static int fsp_memory_profile (int speed)
 
void meminit_lpddr4 (FSP_M_CONFIG *cfg, int speed)
 
static void enable_logical_chan0 (FSP_M_CONFIG *cfg, int rank_density, int dual_rank, const struct lpddr4_swizzle_cfg *scfg)
 
static void enable_logical_chan1 (FSP_M_CONFIG *cfg, int rank_density, int dual_rank, const struct lpddr4_swizzle_cfg *scfg)
 
void meminit_lpddr4_enable_channel (FSP_M_CONFIG *cfg, int logical_chan, int rank_density_gb, int dual_rank, const struct lpddr4_swizzle_cfg *scfg)
 
void meminit_lpddr4_by_sku (FSP_M_CONFIG *cfg, const struct lpddr4_cfg *lpcfg, size_t sku_id)
 
uint8_t fsp_memory_soc_version (void)
 

Variables

static size_t memory_size_mib
 
static const struct speed_mapping apl_mappings []
 
static const struct fsp_speed_profiles apl_profile
 
static const struct speed_mapping glk_mappings []
 
static const struct fsp_speed_profiles glk_profile
 

Function Documentation

◆ accumulate_channel_memory()

static void accumulate_channel_memory ( int  density,
int  dual_rank 
)
static

Definition at line 17 of file meminit.c.

References GiB, memory_size_mib, and MiB.

Referenced by meminit_lpddr4_enable_channel().

Here is the caller graph for this function:

◆ enable_logical_chan0()

static void enable_logical_chan0 ( FSP_M_CONFIG cfg,
int  rank_density,
int  dual_rank,
const struct lpddr4_swizzle_cfg scfg 
)
static

Definition at line 184 of file meminit.c.

References DQ_BITS_PER_DQS, lpddr4_chan_swizzle_cfg::dqs, LP4_DQS0, LP4_DQS1, LP4_DQS2, LP4_DQS3, LP4_PHYS_CH0A, LP4_PHYS_CH0B, memcpy(), and lpddr4_swizzle_cfg::phys.

Referenced by meminit_lpddr4_enable_channel().

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

◆ enable_logical_chan1()

static void enable_logical_chan1 ( FSP_M_CONFIG cfg,
int  rank_density,
int  dual_rank,
const struct lpddr4_swizzle_cfg scfg 
)
static

Definition at line 229 of file meminit.c.

References DQ_BITS_PER_DQS, lpddr4_chan_swizzle_cfg::dqs, LP4_DQS0, LP4_DQS1, LP4_DQS2, LP4_DQS3, LP4_PHYS_CH1A, LP4_PHYS_CH1B, memcpy(), and lpddr4_swizzle_cfg::phys.

Referenced by meminit_lpddr4_enable_channel().

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

◆ fsp_memory_profile()

static int fsp_memory_profile ( int  speed)
static

Definition at line 160 of file meminit.c.

References speed_mapping::fsp_value, get_fsp_profile(), speed_mapping::logical, fsp_speed_profiles::mappings, and fsp_speed_profiles::num_mappings.

Referenced by meminit_lpddr4().

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

◆ fsp_memory_soc_version()

uint8_t fsp_memory_soc_version ( void  )

Definition at line 353 of file meminit.c.

◆ get_fsp_profile()

static const struct fsp_speed_profiles* get_fsp_profile ( void  )
static

Definition at line 136 of file meminit.c.

References apl_profile, CONFIG, and glk_profile.

Referenced by fsp_memory_profile(), and validate_speed().

Here is the caller graph for this function:

◆ iohole_in_mib()

size_t iohole_in_mib ( void  )

Definition at line 36 of file meminit.c.

References GiB, and MiB.

◆ meminit_lpddr4()

void meminit_lpddr4 ( FSP_M_CONFIG cfg,
int  speed 
)

Definition at line 174 of file meminit.c.

References BIOS_INFO, fsp_memory_profile(), printk, set_lpddr4_defaults(), and validate_speed().

Referenced by meminit_lpddr4_by_sku().

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

◆ meminit_lpddr4_by_sku()

void meminit_lpddr4_by_sku ( FSP_M_CONFIG cfg,
const struct lpddr4_cfg lpcfg,
size_t  sku_id 
)

Definition at line 315 of file meminit.c.

References BIOS_ERR, BIOS_INFO, LP4_LCH0, LP4_LCH1, meminit_lpddr4(), meminit_lpddr4_enable_channel(), lpddr4_cfg::num_skus, printk, sku, sku_id(), lpddr4_cfg::skus, and lpddr4_cfg::swizzle_config.

Referenced by mainboard_memory_init_params().

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

◆ meminit_lpddr4_enable_channel()

void meminit_lpddr4_enable_channel ( FSP_M_CONFIG cfg,
int  logical_chan,
int  rank_density_gb,
int  dual_rank,
const struct lpddr4_swizzle_cfg scfg 
)

Definition at line 274 of file meminit.c.

References accumulate_channel_memory(), BIOS_ERR, enable_logical_chan0(), enable_logical_chan1(), LP4_12Gb_DENSITY, LP4_16Gb_DENSITY, LP4_4Gb_DENSITY, LP4_6Gb_DENSITY, LP4_8Gb_DENSITY, LP4_LCH0, LP4_LCH1, and printk.

Referenced by meminit_lpddr4_by_sku().

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

◆ memory_in_system_in_mib()

size_t memory_in_system_in_mib ( void  )

Definition at line 12 of file meminit.c.

References memory_size_mib.

◆ set_lpddr4_defaults()

static void set_lpddr4_defaults ( FSP_M_CONFIG cfg)
static

Definition at line 41 of file meminit.c.

Referenced by meminit_lpddr4().

Here is the caller graph for this function:

◆ validate_speed()

static int validate_speed ( int  speed)
static

Definition at line 144 of file meminit.c.

References BIOS_WARNING, get_fsp_profile(), speed_mapping::logical, LP4_SPEED_1600, fsp_speed_profiles::mappings, fsp_speed_profiles::num_mappings, and printk.

Referenced by meminit_lpddr4().

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

Variable Documentation

◆ apl_mappings

const struct speed_mapping apl_mappings[]
static
Initial value:
= {
{ .logical = LP4_SPEED_1600, .fsp_value = 0x9 },
{ .logical = LP4_SPEED_2133, .fsp_value = 0xa },
{ .logical = LP4_SPEED_2400, .fsp_value = 0xb },
}
@ LP4_SPEED_1600
Definition: meminit.h:47
@ LP4_SPEED_2133
Definition: meminit.h:48
@ LP4_SPEED_2400
Definition: meminit.h:49

Definition at line 41 of file meminit.c.

◆ apl_profile

const struct fsp_speed_profiles apl_profile
static
Initial value:
= {
.mappings = apl_mappings,
.num_mappings = ARRAY_SIZE(apl_mappings),
}
static const struct speed_mapping apl_mappings[]
Definition: meminit.c:114
#define ARRAY_SIZE(a)
Definition: helpers.h:12

Definition at line 41 of file meminit.c.

Referenced by get_fsp_profile().

◆ glk_mappings

const struct speed_mapping glk_mappings[]
static
Initial value:
= {
{ .logical = LP4_SPEED_1600, .fsp_value = 0x4 },
{ .logical = LP4_SPEED_2133, .fsp_value = 0x6 },
{ .logical = LP4_SPEED_2400, .fsp_value = 0x7 },
}

Definition at line 41 of file meminit.c.

◆ glk_profile

const struct fsp_speed_profiles glk_profile
static
Initial value:
= {
.mappings = glk_mappings,
.num_mappings = ARRAY_SIZE(glk_mappings),
}
static const struct speed_mapping glk_mappings[]
Definition: meminit.c:125

Definition at line 41 of file meminit.c.

Referenced by get_fsp_profile().

◆ memory_size_mib

size_t memory_size_mib
static

Definition at line 10 of file meminit.c.

Referenced by accumulate_channel_memory(), and memory_in_system_in_mib().