coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
dq_dqs.c File Reference
#include <device/mmio.h>
#include <console/console.h>
#include <delay.h>
#include <string.h>
#include <types.h>
#include "raminit.h"
#include "x4x.h"
Include dependency graph for dq_dqs.c:

Go to the source code of this file.

Data Structures

struct  db_limit
 

Macros

#define WT_PATTERN_SIZE   80
 
#define CONSISTENCY   10
 
#define RT_PATTERN_SIZE   40
 
#define RT_LOOPS   3
 
#define N_SAMPLES   5
 

Enumerations

enum  training_modes { SUCCEEDING = 0 , FAILING = 1 }
 

Functions

static void print_dll_setting (const struct dll_setting *dll_setting, u8 default_verbose)
 
static void set_db (const struct sysinfo *s, struct dll_setting *dq_dqs_setting)
 
static int increment_dq_dqs (const struct sysinfo *s, struct dll_setting *dq_dqs_setting)
 
static int decrement_dq_dqs (const struct sysinfo *s, struct dll_setting *dq_dqs_setting)
 
static u8 test_dq_aligned (const struct sysinfo *s, const u8 channel)
 
static int find_dq_limit (const struct sysinfo *s, const u8 channel, struct dll_setting dq_setting[TOTAL_BYTELANES], u8 dq_lim[TOTAL_BYTELANES], const enum training_modes expected_result)
 
int do_write_training (struct sysinfo *s)
 
static int rt_increment_dqs (struct rt_dqs_setting *setting)
 
static u8 test_dqs_aligned (const struct sysinfo *s, const u8 channel)
 
static int rt_find_dqs_limit (struct sysinfo *s, u8 channel, struct rt_dqs_setting dqs_setting[TOTAL_BYTELANES], u8 dqs_lim[TOTAL_BYTELANES], const enum training_modes expected_result)
 
int do_read_training (struct sysinfo *s)
 
static void set_rank_write_level (struct sysinfo *s, u8 channel, u8 config, u8 config_rank, u8 target_rank, int wl_enable)
 
static void sample_dq (const struct sysinfo *s, u8 channel, u8 rank, u8 high_found[8])
 
static enum cb_err increment_to_dqs_edge (struct sysinfo *s, u8 channel, u8 rank)
 
void search_write_leveling (struct sysinfo *s)
 

Variables

static const u8 max_tap [3] = {12, 10, 13}
 
static const u32 write_training_schedule [WT_PATTERN_SIZE]
 
static const u32 read_training_schedule [RT_PATTERN_SIZE]
 

Macro Definition Documentation

◆ CONSISTENCY

#define CONSISTENCY   10

Definition at line 189 of file dq_dqs.c.

◆ N_SAMPLES

#define N_SAMPLES   5

Definition at line 610 of file dq_dqs.c.

◆ RT_LOOPS

#define RT_LOOPS   3

Definition at line 401 of file dq_dqs.c.

◆ RT_PATTERN_SIZE

#define RT_PATTERN_SIZE   40

Definition at line 316 of file dq_dqs.c.

◆ WT_PATTERN_SIZE

#define WT_PATTERN_SIZE   80

Definition at line 127 of file dq_dqs.c.

Enumeration Type Documentation

◆ training_modes

Enumerator
SUCCEEDING 
FAILING 

Definition at line 152 of file dq_dqs.c.

Function Documentation

◆ decrement_dq_dqs()

static int decrement_dq_dqs ( const struct sysinfo s,
struct dll_setting dq_dqs_setting 
)
static

Definition at line 102 of file dq_dqs.c.

References CB_ERR, CB_SUCCESS, dll_setting::clk_delay, dll_setting::coarse, max_tap, MEM_CLOCK_800MHz, dll_setting::pi, s, set_db(), and dll_setting::tap.

Here is the call graph for this function:

◆ do_read_training()

◆ do_write_training()

int do_write_training ( struct sysinfo s)

Definition at line 253 of file dq_dqs.c.

References BIOS_CRIT, BIOS_DEBUG, BIOS_ERR, BIOS_WARNING, CB_ERR, CB_SUCCESS, CONSISTENCY, dqset(), FAILING, find_dq_limit(), FOR_EACH_BYTELANE, FOR_EACH_POPULATED_CHANNEL, increment_dq_dqs(), memcpy(), memset(), print_dll_setting(), printk, RAM_DEBUG, s, SUCCEEDING, and TOTAL_BYTELANES.

Referenced by do_raminit().

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

◆ find_dq_limit()

static int find_dq_limit ( const struct sysinfo s,
const u8  channel,
struct dll_setting  dq_setting[TOTAL_BYTELANES],
u8  dq_lim[TOTAL_BYTELANES],
const enum training_modes  expected_result 
)
static

Definition at line 198 of file dq_dqs.c.

References BIOS_CRIT, CB_ERR, CB_SUCCESS, CONSISTENCY, dqset(), FAILING, FOR_EACH_BYTELANE, increment_dq_dqs(), memset(), printk, RAM_DEBUG, s, test_dq_aligned(), and TOTAL_BYTELANES.

Referenced by do_write_training().

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

◆ increment_dq_dqs()

static int increment_dq_dqs ( const struct sysinfo s,
struct dll_setting dq_dqs_setting 
)
static

Definition at line 77 of file dq_dqs.c.

References CB_ERR, CB_SUCCESS, dll_setting::clk_delay, dll_setting::coarse, max_tap, MEM_CLOCK_800MHz, dll_setting::pi, s, set_db(), and dll_setting::tap.

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

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

◆ increment_to_dqs_edge()

static enum cb_err increment_to_dqs_edge ( struct sysinfo s,
u8  channel,
u8  rank 
)
static

Definition at line 612 of file dq_dqs.c.

References address, FOR_EACH_BYTELANE, mchbar_read8(), memset(), N_SAMPLES, test_address(), TOTAL_BYTELANES, udelay(), and write32p().

Referenced by search_write_leveling().

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

◆ print_dll_setting()

static void print_dll_setting ( const struct dll_setting dll_setting,
u8  default_verbose 
)
static

Definition at line 11 of file dq_dqs.c.

References BIOS_DEBUG, dll_setting::clk_delay, dll_setting::coarse, dll_setting::db_en, dll_setting::db_sel, dll_setting::pi, printk, RAM_DEBUG, and dll_setting::tap.

Referenced by do_write_training().

Here is the caller graph for this function:

◆ rt_find_dqs_limit()

static int rt_find_dqs_limit ( struct sysinfo s,
u8  channel,
struct rt_dqs_setting  dqs_setting[TOTAL_BYTELANES],
u8  dqs_lim[TOTAL_BYTELANES],
const enum training_modes  expected_result 
)
static

Definition at line 367 of file dq_dqs.c.

References BIOS_CRIT, CB_ERR, CB_SUCCESS, FOR_EACH_BYTELANE, printk, RAM_DEBUG, rt_increment_dqs(), rt_set_dqs(), s, SUCCEEDING, and test_dqs_aligned().

Referenced by do_read_training().

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

◆ rt_increment_dqs()

static int rt_increment_dqs ( struct rt_dqs_setting setting)
static

Definition at line 331 of file dq_dqs.c.

References CB_ERR, CB_SUCCESS, rt_dqs_setting::pi, and rt_dqs_setting::tap.

Referenced by do_read_training(), and rt_find_dqs_limit().

Here is the caller graph for this function:

◆ sample_dq()

static void sample_dq ( const struct sysinfo s,
u8  channel,
u8  rank,
u8  high_found[8] 
)
static

Definition at line 612 of file dq_dqs.c.

◆ search_write_leveling()

◆ set_db()

static void set_db ( const struct sysinfo s,
struct dll_setting dq_dqs_setting 
)
static

◆ set_rank_write_level()

static void set_rank_write_level ( struct sysinfo s,
u8  channel,
u8  config,
u8  config_rank,
u8  target_rank,
int  wl_enable 
)
static

Definition at line 505 of file dq_dqs.c.

References BIOS_WARNING, config, config_rank(), ddr3_emrs1_rtt_nom_config, EMRS1_CMD, printk, RAM_DEBUG, s, and send_jedec_cmd().

Referenced by search_write_leveling().

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

◆ test_dq_aligned()

static u8 test_dq_aligned ( const struct sysinfo s,
const u8  channel 
)
static

Definition at line 157 of file dq_dqs.c.

References address, count, FOR_EACH_BYTELANE, FOR_EACH_POPULATED_RANK_IN_CHANNEL, mchbar_write32(), pattern, read32p(), s, test_address(), write32(), write32p(), write_training_schedule, and WT_PATTERN_SIZE.

Referenced by find_dq_limit().

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

◆ test_dqs_aligned()

static u8 test_dqs_aligned ( const struct sysinfo s,
const u8  channel 
)
static

Definition at line 344 of file dq_dqs.c.

References address, FOR_EACH_BYTELANE, FOR_EACH_POPULATED_RANK_IN_CHANNEL, read32p(), read_training_schedule, RT_PATTERN_SIZE, s, test_address(), and write32().

Referenced by rt_find_dqs_limit().

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

Variable Documentation

◆ max_tap

const u8 max_tap[3] = {12, 10, 13}
static

Definition at line 75 of file dq_dqs.c.

Referenced by decrement_dq_dqs(), and increment_dq_dqs().

◆ read_training_schedule

const u32 read_training_schedule[RT_PATTERN_SIZE]
static
Initial value:
= {
0xffffffff, 0x00000000, 0xffffffff, 0x00000000,
0xffffffff, 0x00000000, 0xffffffff, 0x00000000,
0xefefefef, 0x10101010, 0xefefefef, 0x10101010,
0xefefefef, 0x10101010, 0xefefefef, 0x10101010,
0xefefefef, 0xeeeeeeee, 0x11111111, 0x10101010,
0xefefefef, 0xeeeeeeee, 0x11111111, 0x10101010,
0x03030303, 0x04040404, 0x09090909, 0x10101010,
0x21212121, 0x40404040, 0x81818181, 0x00000000,
0xfdfdfdfd, 0xfafafafa, 0xf7f7f7f7, 0xeeeeeeee,
0xdfdfdfdf, 0xbebebebe, 0x7f7f7f7f, 0xfefefefe
}

Definition at line 318 of file dq_dqs.c.

Referenced by do_read_training(), and test_dqs_aligned().

◆ write_training_schedule

const u32 write_training_schedule[WT_PATTERN_SIZE]
static
Initial value:
= {
0xffffffff, 0x00000000, 0xffffffff, 0x00000000,
0xffffffff, 0x00000000, 0xffffffff, 0x00000000,
0xffffffff, 0x00000000, 0xffffffff, 0x00000000,
0xffffffff, 0x00000000, 0xffffffff, 0x00000000,
0xefefefef, 0x10101010, 0xefefefef, 0x10101010,
0xefefefef, 0x10101010, 0xefefefef, 0x10101010,
0xefefefef, 0x10101010, 0xefefefef, 0x10101010,
0xefefefef, 0x10101010, 0xefefefef, 0x10101010,
0xefefefef, 0xeeeeeeee, 0x11111111, 0x10101010,
0xefefefef, 0xeeeeeeee, 0x11111111, 0x10101010,
0xefefefef, 0xeeeeeeee, 0x11111111, 0x10101010,
0xefefefef, 0xeeeeeeee, 0x11111111, 0x10101010,
0x03030303, 0x04040404, 0x09090909, 0x10101010,
0x21212121, 0x40404040, 0x81818181, 0x00000000,
0x03030303, 0x04040404, 0x09090909, 0x10101010,
0x21212121, 0x40404040, 0x81818181, 0x00000000,
0xfdfdfdfd, 0xfafafafa, 0xf7f7f7f7, 0xeeeeeeee,
0xdfdfdfdf, 0xbebebebe, 0x7f7f7f7f, 0xfefefefe,
0xfdfdfdfd, 0xfafafafa, 0xf7f7f7f7, 0xeeeeeeee,
0xdfdfdfdf, 0xbebebebe, 0x7f7f7f7f, 0xfefefefe,
}

Definition at line 129 of file dq_dqs.c.

Referenced by test_dq_aligned().