coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
raminit_ddr23.c File Reference
#include <assert.h>
#include <stdint.h>
#include <device/mmio.h>
#include <device/pci_ops.h>
#include <console/console.h>
#include <commonlib/helpers.h>
#include <delay.h>
#include <southbridge/intel/i82801jx/i82801jx.h>
#include <string.h>
#include "raminit.h"
#include "x4x.h"
Include dependency graph for raminit_ddr23.c:

Go to the source code of this file.

Macros

#define ME_UMA_SIZEMB   0
 

Functions

u32 fsb_to_mhz (u32 speed)
 
u32 ddr_to_mhz (u32 speed)
 
static void program_crossclock (struct sysinfo *s)
 
static void setioclk_dram (struct sysinfo *s)
 
static void launch_dram (struct sysinfo *s)
 
static void write_txdll_tap_pi (u8 ch, u16 reg, u8 tap, u8 pi)
 
static void clkset0 (u8 ch, const struct dll_setting *setting)
 
static void clkset1 (u8 ch, const struct dll_setting *setting)
 
static void ctrlset0 (u8 ch, const struct dll_setting *setting)
 
static void ctrlset1 (u8 ch, const struct dll_setting *setting)
 
static void ctrlset2 (u8 ch, const struct dll_setting *setting)
 
static void ctrlset3 (u8 ch, const struct dll_setting *setting)
 
static void cmdset (u8 ch, const struct dll_setting *setting)
 
void dqsset (u8 ch, u8 lane, const struct dll_setting *setting)
 All finer DQ and DQS DLL settings are set to the same value for each rank in a channel, while coarse is common. More...
 
void dqset (u8 ch, u8 lane, const struct dll_setting *setting)
 
void rt_set_dqs (u8 channel, u8 lane, u8 rank, struct rt_dqs_setting *dqs_setting)
 
static void program_timings (struct sysinfo *s)
 
static void sync_dll_load_tap (unsigned int tap)
 
static bool sync_dll_test_tap (unsigned int tap, uint32_t val)
 
static void sync_dll_search_tap (unsigned int *tap, uint32_t val)
 
static void program_dll (struct sysinfo *s)
 
static void select_default_dq_dqs_settings (struct sysinfo *s)
 
static void set_all_dq_dqs_dll_settings (struct sysinfo *s)
 
static void prog_rcomp (struct sysinfo *s)
 
static void program_odt (struct sysinfo *s)
 
static void pre_jedec_memory_map (void)
 
u32 test_address (int channel, int rank)
 
static u32 mirror_shift_bit (const u32 data, u8 bit)
 
void send_jedec_cmd (const struct sysinfo *s, u8 r, u8 ch, u8 cmd, u32 val)
 
static void jedec_ddr2 (struct sysinfo *s)
 
static void jedec_ddr3 (struct sysinfo *s)
 
static void sdram_recover_receive_enable (const struct sysinfo *s)
 
static void sdram_program_receive_enable (struct sysinfo *s, int fast_boot)
 
static void set_dradrb (struct sysinfo *s)
 
static void configure_mmap (struct sysinfo *s)
 
static void set_enhanced_mode (struct sysinfo *s)
 
static void power_settings (struct sysinfo *s)
 
static void software_ddr3_reset (struct sysinfo *s)
 
void do_raminit (struct sysinfo *s, int fast_boot)
 

Variables

const unsigned int sync_dll_max_taps = 16
 

Macro Definition Documentation

◆ ME_UMA_SIZEMB

#define ME_UMA_SIZEMB   0

Definition at line 19 of file raminit_ddr23.c.

Function Documentation

◆ clkset0()

static void clkset0 ( u8  ch,
const struct dll_setting setting 
)
static

Definition at line 255 of file raminit_ddr23.c.

References ch, dll_setting::clk_delay, dll_setting::db_en, dll_setting::db_sel, mchbar_clrsetbits16(), dll_setting::pi, dll_setting::tap, and write_txdll_tap_pi().

Referenced by program_dll().

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

◆ clkset1()

static void clkset1 ( u8  ch,
const struct dll_setting setting 
)
static

Definition at line 264 of file raminit_ddr23.c.

References ch, dll_setting::clk_delay, dll_setting::db_en, dll_setting::db_sel, mchbar_clrsetbits32(), dll_setting::pi, dll_setting::tap, and write_txdll_tap_pi().

Referenced by program_dll().

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

◆ cmdset()

static void cmdset ( u8  ch,
const struct dll_setting setting 
)
static

Definition at line 319 of file raminit_ddr23.c.

References ch, dll_setting::clk_delay, dll_setting::db_en, dll_setting::db_sel, mchbar_clrsetbits8(), dll_setting::pi, dll_setting::tap, and write_txdll_tap_pi().

Referenced by program_dll().

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

◆ configure_mmap()

static void configure_mmap ( struct sysinfo s)
static

Definition at line 1648 of file raminit_ddr23.c.

References D0F0_ESMRAMC, HOST_BRIDGE, MAX, ME_UMA_SIZEMB, MIN, pci_read_config16(), pci_update_config8(), pci_write_config16(), pci_write_config32(), and s.

Referenced by do_raminit().

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

◆ ctrlset0()

static void ctrlset0 ( u8  ch,
const struct dll_setting setting 
)
static

Definition at line 273 of file raminit_ddr23.c.

References ch, dll_setting::clk_delay, dll_setting::db_en, dll_setting::db_sel, mchbar_clrsetbits32(), dll_setting::pi, dll_setting::tap, and write_txdll_tap_pi().

Referenced by program_dll().

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

◆ ctrlset1()

static void ctrlset1 ( u8  ch,
const struct dll_setting setting 
)
static

Definition at line 282 of file raminit_ddr23.c.

References ch, dll_setting::clk_delay, dll_setting::db_en, dll_setting::db_sel, mchbar_clrsetbits32(), dll_setting::pi, dll_setting::tap, and write_txdll_tap_pi().

Referenced by program_dll().

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

◆ ctrlset2()

static void ctrlset2 ( u8  ch,
const struct dll_setting setting 
)
static

Definition at line 291 of file raminit_ddr23.c.

References ch, dll_setting::clk_delay, dll_setting::db_en, dll_setting::db_sel, mchbar_clrsetbits32(), dll_setting::pi, dll_setting::tap, and write_txdll_tap_pi().

Referenced by program_dll().

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

◆ ctrlset3()

static void ctrlset3 ( u8  ch,
const struct dll_setting setting 
)
static

Definition at line 305 of file raminit_ddr23.c.

References ch, dll_setting::clk_delay, dll_setting::db_en, dll_setting::db_sel, mchbar_clrsetbits32(), dll_setting::pi, dll_setting::tap, and write_txdll_tap_pi().

Referenced by program_dll().

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

◆ ddr_to_mhz()

u32 ddr_to_mhz ( u32  speed)

Definition at line 26 of file raminit_ddr23.c.

References ARRAY_SIZE, die(), and mhz.

Referenced by print_selected_timings(), and program_timings().

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

◆ do_raminit()

◆ dqset()

void dqset ( u8  ch,
u8  lane,
const struct dll_setting setting 
)

Definition at line 351 of file raminit_ddr23.c.

References ch, dll_setting::clk_delay, dll_setting::coarse, dll_setting::db_en, dll_setting::db_sel, mchbar_clrsetbits32(), dll_setting::pi, dll_setting::tap, and write_txdll_tap_pi().

Referenced by do_write_training(), find_dq_limit(), search_write_leveling(), and set_all_dq_dqs_dll_settings().

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

◆ dqsset()

void dqsset ( u8  ch,
u8  lane,
const struct dll_setting setting 
)

All finer DQ and DQS DLL settings are set to the same value for each rank in a channel, while coarse is common.

Definition at line 332 of file raminit_ddr23.c.

References ch, dll_setting::clk_delay, dll_setting::coarse, dll_setting::db_en, dll_setting::db_sel, mchbar_clrsetbits32(), dll_setting::pi, dll_setting::tap, and write_txdll_tap_pi().

Referenced by set_all_dq_dqs_dll_settings().

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

◆ fsb_to_mhz()

u32 fsb_to_mhz ( u32  speed)

Definition at line 21 of file raminit_ddr23.c.

Referenced by print_selected_timings(), and program_timings().

Here is the caller graph for this function:

◆ jedec_ddr2()

static void jedec_ddr2 ( struct sysinfo s)
static

Definition at line 1292 of file raminit_ddr23.c.

References BIOS_DEBUG, CBR_CMD, ch, EMRS1_CMD, EMRS2_CMD, EMRS3_CMD, FOR_EACH_POPULATED_RANK, MRS_CMD, NOP_CMD, PRECHARGE_CMD, printk, RAM_SPEW, s, send_jedec_cmd(), and udelay().

Referenced by do_raminit().

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

◆ jedec_ddr3()

static void jedec_ddr3 ( struct sysinfo s)
static

Definition at line 1359 of file raminit_ddr23.c.

References BIOS_DEBUG, ch, ddr3_emrs1_rtt_nom_config, EMRS1_CMD, EMRS2_CMD, EMRS3_CMD, FOR_EACH_POPULATED_RANK, MEM_CLOCK_800MHz, MRS_CMD, NOP_CMD, printk, s, send_jedec_cmd(), udelay(), and ZQCAL_CMD.

Referenced by do_raminit(), and software_ddr3_reset().

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

◆ launch_dram()

static void launch_dram ( struct sysinfo s)
static

Definition at line 155 of file raminit_ddr23.c.

References BOTH_DIMMS_ARE_POPULATED, DDR2, DDR3, die(), FOR_EACH_POPULATED_CHANNEL, mchbar_clrsetbits32(), mchbar_setbits32, mchbar_write32(), MEM_CLOCK_1066MHz, MEM_CLOCK_800MHz, and s.

Referenced by do_raminit().

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

◆ mirror_shift_bit()

static u32 mirror_shift_bit ( const u32  data,
u8  bit 
)
static

Definition at line 1254 of file raminit_ddr23.c.

Referenced by send_jedec_cmd().

Here is the caller graph for this function:

◆ power_settings()

◆ pre_jedec_memory_map()

static void pre_jedec_memory_map ( void  )
static

◆ prog_rcomp()

static void prog_rcomp ( struct sysinfo s)
static

Definition at line 1018 of file raminit_ddr23.c.

References addr, ARRAY_SIZE, BOTH_DIMMS_ARE_POPULATED, CHANNEL_IS_POPULATED, DDR2, DDR3, FOR_EACH_POPULATED_CHANNEL, mchbar_clrbits32, mchbar_clrsetbits16(), mchbar_clrsetbits32(), mchbar_clrsetbits8(), mchbar_setbits8, mchbar_write16(), and s.

Referenced by do_raminit().

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

◆ program_crossclock()

static void program_crossclock ( struct sysinfo s)
static

Definition at line 36 of file raminit_ddr23.c.

References DDR3, FSB_CLOCK_1333MHz, mchbar_setbits16, mchbar_setbits8, mchbar_write32(), MEM_CLOCK_800MHz, and s.

Referenced by do_raminit().

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

◆ program_dll()

◆ program_odt()

static void program_odt ( struct sysinfo s)
static

Definition at line 1126 of file raminit_ddr23.c.

References DDR2, FOR_EACH_POPULATED_CHANNEL, mchbar_clrsetbits32(), mchbar_read16(), mchbar_write16(), and s.

Referenced by do_raminit().

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

◆ program_timings()

◆ rt_set_dqs()

void rt_set_dqs ( u8  channel,
u8  lane,
u8  rank,
struct rt_dqs_setting dqs_setting 
)

Definition at line 369 of file raminit_ddr23.c.

References mchbar_read16(), mchbar_write16(), rt_dqs_setting::pi, printk, RAM_SPEW, and rt_dqs_setting::tap.

Referenced by do_read_training(), rt_find_dqs_limit(), and set_all_dq_dqs_dll_settings().

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

◆ sdram_program_receive_enable()

static void sdram_program_receive_enable ( struct sysinfo s,
int  fast_boot 
)
static

Definition at line 1439 of file raminit_ddr23.c.

References rcven(), s, and sdram_recover_receive_enable().

Referenced by do_raminit().

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

◆ sdram_recover_receive_enable()

static void sdram_recover_receive_enable ( const struct sysinfo s)
static

Definition at line 1408 of file raminit_ddr23.c.

References FOR_EACH_BYTELANE, FOR_EACH_POPULATED_CHANNEL, mchbar_read32(), mchbar_read8(), mchbar_write16(), mchbar_write32(), mchbar_write8(), and s.

Referenced by sdram_program_receive_enable().

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

◆ select_default_dq_dqs_settings()

static void select_default_dq_dqs_settings ( struct sysinfo s)
static

◆ send_jedec_cmd()

void send_jedec_cmd ( const struct sysinfo s,
u8  r,
u8  ch,
u8  cmd,
u32  val 
)

Definition at line 1264 of file raminit_ddr23.c.

References addr, ch, DDR3, mchbar_clrsetbits8(), mirror_shift_bit(), NORMALOP_CMD, read32p(), s, test_address(), udelay(), and val.

Referenced by jedec_ddr2(), jedec_ddr3(), search_write_leveling(), and set_rank_write_level().

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

◆ set_all_dq_dqs_dll_settings()

static void set_all_dq_dqs_dll_settings ( struct sysinfo s)
static

Definition at line 1002 of file raminit_ddr23.c.

References ch, dqset(), dqsset(), FOR_EACH_BYTELANE, FOR_EACH_POPULATED_CHANNEL, FOR_EACH_RANK_IN_CHANNEL, rt_set_dqs(), and s.

Referenced by do_raminit().

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

◆ set_dradrb()

◆ set_enhanced_mode()

static void set_enhanced_mode ( struct sysinfo s)
static

◆ setioclk_dram()

static void setioclk_dram ( struct sysinfo s)
static

Definition at line 127 of file raminit_ddr23.c.

References mchbar_clrbits16, mchbar_clrbits8, mchbar_clrsetbits8(), mchbar_setbits16, mchbar_setbits32, mchbar_setbits8, mchbar_write32(), MEM_CLOCK_1066MHz, MEM_CLOCK_1333MHz, MEM_CLOCK_667MHz, MEM_CLOCK_800MHz, and s.

Referenced by do_raminit().

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

◆ software_ddr3_reset()

static void software_ddr3_reset ( struct sysinfo s)
static

Definition at line 1914 of file raminit_ddr23.c.

References BIOS_DEBUG, jedec_ddr3(), mchbar_clrbits8, mchbar_clrsetbits8(), mchbar_setbits8, printk, s, and udelay().

Referenced by do_raminit().

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

◆ sync_dll_load_tap()

static void sync_dll_load_tap ( unsigned int  tap)
static

Definition at line 668 of file raminit_ddr23.c.

References mchbar_clrsetbits8(), mchbar_read8(), and mchbar_setbits8.

Referenced by program_dll(), and sync_dll_test_tap().

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

◆ sync_dll_search_tap()

static void sync_dll_search_tap ( unsigned int *  tap,
uint32_t  val 
)
static

Definition at line 683 of file raminit_ddr23.c.

References sync_dll_max_taps, sync_dll_test_tap(), and val.

Referenced by program_dll().

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

◆ sync_dll_test_tap()

static bool sync_dll_test_tap ( unsigned int  tap,
uint32_t  val 
)
static

Definition at line 675 of file raminit_ddr23.c.

References mchbar_read32(), sync_dll_load_tap(), sync_dll_max_taps, and val.

Referenced by program_dll(), and sync_dll_search_tap().

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

◆ test_address()

u32 test_address ( int  channel,
int  rank 
)

Definition at line 1245 of file raminit_ddr23.c.

References ASSERT, and MiB.

Referenced by do_raminit(), do_read_training(), increment_to_dqs_edge(), rcven(), send_jedec_cmd(), test_dq_aligned(), and test_dqs_aligned().

Here is the caller graph for this function:

◆ write_txdll_tap_pi()

static void write_txdll_tap_pi ( u8  ch,
u16  reg,
u8  tap,
u8  pi 
)
static

Definition at line 250 of file raminit_ddr23.c.

References ch, and mchbar_clrsetbits8().

Referenced by clkset0(), clkset1(), cmdset(), ctrlset0(), ctrlset1(), ctrlset2(), ctrlset3(), dqset(), and dqsset().

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

Variable Documentation

◆ sync_dll_max_taps

const unsigned int sync_dll_max_taps = 16

Definition at line 666 of file raminit_ddr23.c.

Referenced by program_dll(), sync_dll_search_tap(), and sync_dll_test_tap().