coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
raminit.c File Reference
#include <device/pci_ops.h>
#include <device/smbus_host.h>
#include <cbmem.h>
#include <cf9_reset.h>
#include <console/console.h>
#include <arch/cpu.h>
#include <spd.h>
#include <string.h>
#include <device/dram/ddr2.h>
#include <device/dram/ddr3.h>
#include <mrc_cache.h>
#include <timestamp.h>
#include <types.h>
#include "raminit.h"
#include "x4x.h"
Include dependency graph for raminit.c:

Go to the source code of this file.

Data Structures

struct  abs_timings
 

Macros

#define MRC_CACHE_VERSION   0
 
#define CTRL_MIN_TCLK_DDR2   TCK_400MHZ
 

Functions

static u16 ddr2_get_crc (u8 device, u8 len)
 
static u16 ddr3_get_crc (u8 device, u8 len)
 
static enum cb_err verify_spds (const u8 *spd_map, const struct sysinfo *ctrl_cached)
 
static void select_cas_dramfreq_ddr2 (struct sysinfo *s, const struct abs_timings *saved_timings)
 
static void mchinfo_ddr2 (struct sysinfo *s)
 
static int ddr2_save_dimminfo (u8 dimm_idx, u8 *raw_spd, struct abs_timings *saved_timings, struct sysinfo *s)
 
static void normalize_tCLK (u32 *tCLK)
 
static void select_cas_dramfreq_ddr3 (struct sysinfo *s, struct abs_timings *saved_timings)
 
static void workaround_stacked_mode (struct sysinfo *s)
 
static int ddr3_save_dimminfo (u8 dimm_idx, u8 *raw_spd, struct abs_timings *saved_timings, struct sysinfo *s)
 
static void select_discrete_timings (struct sysinfo *s, const struct abs_timings *timings)
 
static void print_selected_timings (struct sysinfo *s)
 
static void find_fsb_speed (struct sysinfo *s)
 
static void decode_spd_select_timings (struct sysinfo *s)
 
static void find_dimm_config (struct sysinfo *s)
 
static void checkreset_ddr2 (int boot_path)
 
void sdram_initialize (int boot_path, const u8 *spd_map)
 

Macro Definition Documentation

◆ CTRL_MIN_TCLK_DDR2

#define CTRL_MIN_TCLK_DDR2   TCK_400MHZ

Definition at line 77 of file raminit.c.

◆ MRC_CACHE_VERSION

#define MRC_CACHE_VERSION   0

Definition at line 20 of file raminit.c.

Function Documentation

◆ checkreset_ddr2()

static void checkreset_ddr2 ( int  boot_path)
static

Definition at line 529 of file raminit.c.

References BIOS_DEBUG, full_reset(), HOST_BRIDGE, mchbar_read32(), pci_and_config8(), PCI_DEV, pci_or_config8(), pci_read_config8(), pci_write_config8(), PMSTS_MCHBAR, and printk.

Referenced by sdram_initialize().

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

◆ ddr2_get_crc()

static u16 ddr2_get_crc ( u8  device,
u8  len 
)
static

Definition at line 22 of file raminit.c.

References spd_ddr2_calc_unique_crc().

Here is the call graph for this function:

◆ ddr2_save_dimminfo()

◆ ddr3_get_crc()

static u16 ddr3_get_crc ( u8  device,
u8  len 
)
static

Definition at line 30 of file raminit.c.

References spd_ddr3_calc_unique_crc().

Here is the call graph for this function:

◆ ddr3_save_dimminfo()

◆ decode_spd_select_timings()

static void decode_spd_select_timings ( struct sysinfo s)
static

◆ find_dimm_config()

static void find_dimm_config ( struct sysinfo s)
static

Definition at line 504 of file raminit.c.

References BIOS_DEBUG, die(), DIMMS_PER_CHANNEL, FOR_EACH_POPULATED_CHANNEL, FOR_EACH_POPULATED_DIMM_IN_CHANNEL, printk, and s.

Referenced by sdram_initialize().

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

◆ find_fsb_speed()

static void find_fsb_speed ( struct sysinfo s)
static

Definition at line 413 of file raminit.c.

References BIOS_WARNING, CLKCFG_FSBCLK_MASK, CLKCFG_FSBCLK_SHIFT, CLKCFG_MCHBAR, FSB_CLOCK_1066MHz, FSB_CLOCK_1333MHz, FSB_CLOCK_800MHz, mchbar_read32(), printk, and s.

Referenced by sdram_initialize().

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

◆ mchinfo_ddr2()

static void mchinfo_ddr2 ( struct sysinfo s)
static

Definition at line 115 of file raminit.c.

References BIOS_WARNING, cpuid_ext(), cpuid_result::eax, HOST_BRIDGE, pci_read_config16(), pci_read_config32(), and printk.

Referenced by sdram_initialize().

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

◆ normalize_tCLK()

static void normalize_tCLK ( u32 tCLK)
static

Definition at line 207 of file raminit.c.

References TCK_400MHZ, TCK_533MHZ, and TCK_666MHZ.

Referenced by select_cas_dramfreq_ddr3().

Here is the caller graph for this function:

◆ print_selected_timings()

static void print_selected_timings ( struct sysinfo s)
static

Definition at line 396 of file raminit.c.

References BIOS_DEBUG, ddr_to_mhz(), fsb_to_mhz(), printk, and s.

Referenced by sdram_initialize().

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

◆ sdram_initialize()

◆ select_cas_dramfreq_ddr2()

static void select_cas_dramfreq_ddr2 ( struct sysinfo s,
const struct abs_timings saved_timings 
)
static

Definition at line 79 of file raminit.c.

References abs_timings::cas_supported, CTRL_MIN_TCLK_DDR2, die(), MEM_CLOCK_667MHz, MEM_CLOCK_800MHz, abs_timings::min_tCLK_cas, s, SPD_CAS_LATENCY_DDR2_5, SPD_CAS_LATENCY_DDR2_6, spd_get_msbs(), TCK_200MHZ, TCK_266MHZ, TCK_333MHZ, and TCK_400MHZ.

Referenced by decode_spd_select_timings().

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

◆ select_cas_dramfreq_ddr3()

static void select_cas_dramfreq_ddr3 ( struct sysinfo s,
struct abs_timings saved_timings 
)
static

◆ select_discrete_timings()

static void select_discrete_timings ( struct sysinfo s,
const struct abs_timings timings 
)
static

Definition at line 385 of file raminit.c.

References DIV_ROUND_UP, timings::min_tRAS, timings::min_tRCD, timings::min_tRFC, timings::min_tRP, timings::min_tWR, and s.

Referenced by decode_spd_select_timings().

Here is the caller graph for this function:

◆ verify_spds()

static enum cb_err verify_spds ( const u8 spd_map,
const struct sysinfo ctrl_cached 
)
static

Definition at line 30 of file raminit.c.

Referenced by sdram_initialize().

Here is the caller graph for this function:

◆ workaround_stacked_mode()

static void workaround_stacked_mode ( struct sysinfo s)
static

Definition at line 317 of file raminit.c.

References CHANNEL_IS_POPULATED, D0F0_DEVEN, DDR2, HOST_BRIDGE, IGD0EN, MEM_CLOCK_1066MHz, pci_read_config32(), and s.

Referenced by decode_spd_select_timings().

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