coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
raminit.c File Reference
#include <console/console.h>
#include <commonlib/helpers.h>
#include <string.h>
#include <arch/io.h>
#include <device/mmio.h>
#include <device/pci_ops.h>
#include <device/smbus_host.h>
#include <cpu/x86/msr.h>
#include <cpu/x86/cache.h>
#include <cbmem.h>
#include <cf9_reset.h>
#include <ip_checksum.h>
#include <option.h>
#include <device/pci_def.h>
#include <device/device.h>
#include <halt.h>
#include <spd.h>
#include <timestamp.h>
#include <cpu/x86/mtrr.h>
#include <cpu/intel/speedstep.h>
#include <cpu/intel/turbo.h>
#include <mrc_cache.h>
#include <southbridge/intel/ibexpeak/me.h>
#include <southbridge/intel/common/pmbase.h>
#include <delay.h>
#include <types.h>
#include "chip.h"
#include "ironlake.h"
#include "raminit.h"
#include "raminit_tables.h"
#include <lib.h>
Include dependency graph for raminit.c:

Go to the source code of this file.

Data Structures

struct  _u128
 

Macros

#define NORTHBRIDGE   PCI_DEV(0, 0, 0)
 
#define SOUTHBRIDGE   PCI_DEV(0, 0x1f, 0)
 
#define GMA   PCI_DEV (0, 0x2, 0x0)
 
#define FOR_ALL_RANKS
 
#define FOR_POPULATED_RANKS
 
#define FOR_POPULATED_RANKS_BACKWARDS
 
#define gav(x)   gav_real (__LINE__, (x))
 
#define RANK_SHIFT   28
 
#define CHANNEL_SHIFT   10
 
#define DEFAULT_PCI_MMIO_SIZE   2048
 
#define STANDARD_MIN_MARGIN   5
 

Typedefs

typedef struct _u128 u128
 

Enumerations

enum  {
  DEVICE_TYPE = 2 , MODULE_TYPE = 3 , DENSITY = 4 , RANKS_AND_DQ = 7 ,
  MEMORY_BUS_WIDTH = 8 , TIMEBASE_DIVIDEND = 10 , TIMEBASE_DIVISOR = 11 , CYCLETIME = 12 ,
  CAS_LATENCIES_LSB = 14 , CAS_LATENCIES_MSB = 15 , CAS_LATENCY_TIME = 16 , THERMAL_AND_REFRESH = 31 ,
  REFERENCE_RAW_CARD_USED = 62 , RANK1_ADDRESS_MAPPING = 63
}
 
enum  { MR1_RZQ12 = 512 , MR1_RZQ2 = 64 , MR1_RZQ4 = 4 , MR1_ODS34OHM = 2 }
 
enum  { MR0_BT_INTERLEAVED = 8 , MR0_DLL_RESET_ON = 256 }
 
enum  { MR2_RTT_WR_DISABLED = 0 , MR2_RZQ2 = 1 << 10 }
 
enum  state { BEFORE_USABLE = 0 , AT_USABLE = 1 , AT_MARGIN = 2 , COMPLETE = 3 }
 

Functions

static void read128 (u32 addr, u64 *out)
 
static void write_1d0 (u32 val, u16 addr, int bits, int flag)
 
static u16 read_1d0 (u16 addr, int split)
 
static void sfence (void)
 
static u16 get_lane_offset (int slot, int rank, int lane)
 
static u16 get_timing_register_addr (int lane, int tm, int slot, int rank)
 
static u32 gav_real (int line, u32 in)
 
static u16 read_500 (struct raminfo *info, int channel, u16 addr, int split)
 
static void write_500 (struct raminfo *info, int channel, u32 val, u16 addr, int bits, int flag)
 
static void rmw_500 (struct raminfo *info, int channel, u16 addr, int bits, u32 and, u32 or)
 
static int rw_test (int rank)
 
static void program_timings (struct raminfo *info, u16 base, int channel, int slot, int rank)
 
static void write_26c (int channel, u16 si)
 
static void toggle_1d0_142_5ff (void)
 
static u32 get_580 (int channel, u8 addr)
 
static void seq9 (struct raminfo *info, int channel, int slot, int rank)
 
static int count_ranks_in_channel (struct raminfo *info, int channel)
 
static void config_rank (struct raminfo *info, int s3resume, int channel, int slot, int rank)
 
static void set_4cf (struct raminfo *info, int channel, u8 bit, u8 val)
 
static void set_334 (int zero)
 
static void rmw_1d0 (u16 addr, u32 and, u32 or, int split)
 
static int find_highest_bit_set (u16 val)
 
static int find_lowest_bit_set32 (u32 val)
 
static void calculate_timings (struct raminfo *info)
 
static void program_base_timings (struct raminfo *info)
 
static unsigned int cycle_ps (struct raminfo *info)
 
static unsigned int frequency_01 (struct raminfo *info)
 
static unsigned int ps_to_halfcycles (struct raminfo *info, unsigned int ps)
 
static unsigned int ns_to_cycles (struct raminfo *info, unsigned int ns)
 
static void compute_derived_timings (struct raminfo *info)
 
static void jedec_read (struct raminfo *info, int channel, int slot, int rank, int total_rank, u8 addr3, unsigned int value)
 
static void jedec_init (struct raminfo *info)
 
static void program_modules_memory_map (struct raminfo *info, int pre_jedec)
 
static void program_board_delay (struct raminfo *info)
 
static void program_total_memory_map (struct raminfo *info)
 
static void collect_system_info (struct raminfo *info)
 
static void write_training_data (struct raminfo *info)
 
static void dump_timings (struct raminfo *info)
 
static void save_timings (struct raminfo *info)
 
static const struct ram_trainingget_cached_training (void)
 
static int have_match_ranks (struct raminfo *info, int channel, int ranks)
 
static void read_4090 (struct raminfo *info)
 
static u32 get_etalon2 (int flip, u32 addr)
 
static void disable_cache_region (void)
 
static void enable_cache_region (unsigned int base, unsigned int size)
 
static void flush_cache (u32 start, u32 size)
 
static void clear_errors (void)
 
static void write_testing (struct raminfo *info, int totalrank, int flip)
 
static u8 check_testing (struct raminfo *info, u8 total_rank, int flip)
 
static u32 get_seed2 (int a, int b)
 
static int make_shift (int comp2, int comp5, int x)
 
static u32 get_etalon (int flip, u32 addr)
 
static void write_testing_type2 (struct raminfo *info, u8 totalrank, u8 region, u8 block, char flip)
 
static u8 check_testing_type2 (struct raminfo *info, u8 totalrank, u8 region, u8 block, char flip)
 
static int check_bounded (unsigned short *vals, u16 bound)
 
static int validate_state (enum state *in)
 
static void do_fsm (enum state *state, u16 *counter, u8 fail_mask, int margin, int uplimit, u8 *res_low, u8 *res_high, u8 val)
 
static void train_ram_at_178 (struct raminfo *info, u8 channel, int slot, int rank, u8 total_rank, u8 reg_178, int first_run, int niter, timing_bounds_t *timings)
 
static void set_10b (struct raminfo *info, u8 val)
 
static void set_ecc (int onoff)
 
static void set_178 (u8 val)
 
static void write_500_timings_type (struct raminfo *info, int channel, int slot, int rank, int type)
 
static void try_timing_offsets (struct raminfo *info, int channel, int slot, int rank, int totalrank)
 
static u8 choose_training (struct raminfo *info, int channel, int slot, int rank, int lane, timing_bounds_t *timings, u8 center_178)
 
static u8 choose_reg178 (struct raminfo *info, timing_bounds_t *timings)
 
static int check_cached_sanity (struct raminfo *info)
 
static int try_cached_training (struct raminfo *info)
 
static void do_ram_training (struct raminfo *info)
 
static void ram_training (struct raminfo *info)
 
u16 get_max_timing (struct raminfo *info, int channel)
 
static void dmi_setup (void)
 
void chipset_init (const int s3resume)
 
static u8 get_bits_420 (const u32 reg32)
 
void raminit (const int s3resume, const u8 *spd_addrmap)
 

Variables

timing_bounds_t timings_car [64]
 
const u32 seed1 [0x18]
 

Macro Definition Documentation

◆ CHANNEL_SHIFT

#define CHANNEL_SHIFT   10

Definition at line 274 of file raminit.c.

◆ DEFAULT_PCI_MMIO_SIZE

#define DEFAULT_PCI_MMIO_SIZE   2048

Definition at line 1248 of file raminit.c.

◆ FOR_ALL_RANKS

#define FOR_ALL_RANKS
Value:
for (channel = 0; channel < NUM_CHANNELS; channel++) \
for (slot = 0; slot < NUM_SLOTS; slot++) \
for (rank = 0; rank < NUM_RANKS; rank++)
#define NUM_SLOTS
Definition: mchbar.h:8
#define NUM_CHANNELS
Definition: mchbar.h:7
#define NUM_RANKS
Definition: raminit.h:10

Definition at line 39 of file raminit.c.

◆ FOR_POPULATED_RANKS

#define FOR_POPULATED_RANKS
Value:
for (channel = 0; channel < NUM_CHANNELS; channel++) \
for (slot = 0; slot < NUM_SLOTS; slot++) \
for (rank = 0; rank < NUM_RANKS; rank++) \
if (info->populated_ranks[channel][slot][rank])
static struct smmstore_params_info info
Definition: ramstage.c:12

Definition at line 44 of file raminit.c.

◆ FOR_POPULATED_RANKS_BACKWARDS

#define FOR_POPULATED_RANKS_BACKWARDS
Value:
for (channel = NUM_CHANNELS - 1; channel >= 0; channel--) \
for (slot = 0; slot < NUM_SLOTS; slot++) \
for (rank = 0; rank < NUM_RANKS; rank++) \
if (info->populated_ranks[channel][slot][rank])

Definition at line 50 of file raminit.c.

◆ gav

#define gav (   x)    gav_real (__LINE__, (x))

Definition at line 137 of file raminit.c.

◆ GMA

#define GMA   PCI_DEV (0, 0x2, 0x0)

Definition at line 37 of file raminit.c.

◆ NORTHBRIDGE

#define NORTHBRIDGE   PCI_DEV(0, 0, 0)

Definition at line 35 of file raminit.c.

◆ RANK_SHIFT

#define RANK_SHIFT   28

Definition at line 273 of file raminit.c.

◆ SOUTHBRIDGE

#define SOUTHBRIDGE   PCI_DEV(0, 0x1f, 0)

Definition at line 36 of file raminit.c.

◆ STANDARD_MIN_MARGIN

#define STANDARD_MIN_MARGIN   5

Definition at line 2366 of file raminit.c.

Typedef Documentation

◆ u128

typedef struct _u128 u128

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
DEVICE_TYPE 
MODULE_TYPE 
DENSITY 
RANKS_AND_DQ 
MEMORY_BUS_WIDTH 
TIMEBASE_DIVIDEND 
TIMEBASE_DIVISOR 
CYCLETIME 
CAS_LATENCIES_LSB 
CAS_LATENCIES_MSB 
CAS_LATENCY_TIME 
THERMAL_AND_REFRESH 
REFERENCE_RAW_CARD_USED 
RANK1_ADDRESS_MAPPING 

Definition at line 442 of file raminit.c.

◆ anonymous enum

anonymous enum
Enumerator
MR1_RZQ12 
MR1_RZQ2 
MR1_RZQ4 
MR1_ODS34OHM 

Definition at line 934 of file raminit.c.

◆ anonymous enum

anonymous enum
Enumerator
MR0_BT_INTERLEAVED 
MR0_DLL_RESET_ON 

Definition at line 941 of file raminit.c.

◆ anonymous enum

anonymous enum
Enumerator
MR2_RTT_WR_DISABLED 
MR2_RZQ2 

Definition at line 946 of file raminit.c.

◆ state

enum state
Enumerator
BEFORE_USABLE 
AT_USABLE 
AT_MARGIN 
COMPLETE 

Definition at line 1787 of file raminit.c.

Function Documentation

◆ calculate_timings()

static void calculate_timings ( struct raminfo info)
static

Definition at line 460 of file raminit.c.

References CAS_LATENCIES_LSB, CAS_LATENCIES_MSB, CAS_LATENCY_TIME, CYCLETIME, die(), DIV_ROUND_UP, find_highest_bit_set(), info, MAX, MIN, min_cas_latency_time, min_cycletime, NUM_CHANNELS, NUM_SLOTS, TIMEBASE_DIVIDEND, and TIMEBASE_DIVISOR.

Referenced by raminit().

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

◆ check_bounded()

static int check_bounded ( unsigned short *  vals,
u16  bound 
)
static

Definition at line 1777 of file raminit.c.

Referenced by train_ram_at_178().

Here is the caller graph for this function:

◆ check_cached_sanity()

static int check_cached_sanity ( struct raminfo info)
static

Definition at line 2428 of file raminit.c.

References info, ram_training::lane_timings, NUM_CHANNELS, NUM_RANKS, and NUM_SLOTS.

Referenced by try_cached_training().

Here is the caller graph for this function:

◆ check_testing()

static u8 check_testing ( struct raminfo info,
u8  total_rank,
int  flip 
)
static

Definition at line 1636 of file raminit.c.

References disable_cache_region(), enable_cache_region(), flush_cache(), get_etalon2(), and read128().

Referenced by train_ram_at_178(), try_cached_training(), and try_timing_offsets().

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

◆ check_testing_type2()

static u8 check_testing_type2 ( struct raminfo info,
u8  totalrank,
u8  region,
u8  block,
char  flip 
)
static

Definition at line 1745 of file raminit.c.

References addr, disable_cache_region(), enable_cache_region(), flush_cache(), get_etalon(), and read32p().

Referenced by train_ram_at_178().

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

◆ chipset_init()

void chipset_init ( const int  s3resume)

◆ choose_reg178()

static u8 choose_reg178 ( struct raminfo info,
timing_bounds_t timings 
)
static

Definition at line 2368 of file raminit.c.

References count, die(), dump_timings(), FOR_POPULATED_RANKS_BACKWARDS, info, reg178_max, reg178_min, reg178_step, and STANDARD_MIN_MARGIN.

Referenced by do_ram_training().

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

◆ choose_training()

static u8 choose_training ( struct raminfo info,
int  channel,
int  slot,
int  rank,
int  lane,
timing_bounds_t timings,
u8  center_178 
)
static

Definition at line 2285 of file raminit.c.

References count, die(), dump_timings(), info, MIN, and ram_training::reg_178.

Referenced by do_ram_training().

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

◆ clear_errors()

static void clear_errors ( void  )
static

Definition at line 1610 of file raminit.c.

References NORTHBRIDGE, and pci_write_config8().

Referenced by write_testing().

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

◆ collect_system_info()

static void collect_system_info ( struct raminfo info)
static

Definition at line 1347 of file raminit.c.

References BIOS_DEBUG, CAPID0, DEVEN, gav, info, MODULE_TYPE, NORTHBRIDGE, NUM_CHANNELS, PCI_DEVICE_ID, pci_read_config16(), pci_read_config32(), pci_read_config8(), PCI_REVISION_ID, and printk.

Referenced by raminit().

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

◆ compute_derived_timings()

static void compute_derived_timings ( struct raminfo info)
static

Definition at line 707 of file raminit.c.

References count, count_ranks_in_channel(), cycle_ps(), die(), halfcycle_ps(), info, MAX, mchbar_write32(), MIN, MODULE_TYPE, NUM_CHANNELS, NUM_RANKS, NUM_SLOTS, REFERENCE_RAW_CARD_USED, u16_fe0eb8, u16_ffd1178, u8_FFFD0EF8, u8_FFFD17E0, and u8_FFFD1891.

Referenced by raminit().

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

◆ config_rank()

static void config_rank ( struct raminfo info,
int  s3resume,
int  channel,
int  slot,
int  rank 
)
static

Definition at line 337 of file raminit.c.

References count_ranks_in_channel(), gav, get_580(), info, mchbar_write8(), program_timings(), read_1d0(), rw_test(), seq9(), and write_1d0().

Referenced by raminit(), and set_rank_write_level().

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

◆ count_ranks_in_channel()

static int count_ranks_in_channel ( struct raminfo info,
int  channel 
)
static

Definition at line 326 of file raminit.c.

References info, and NUM_SLOTS.

Referenced by compute_derived_timings(), and config_rank().

Here is the caller graph for this function:

◆ cycle_ps()

static unsigned int cycle_ps ( struct raminfo info)
static

Definition at line 686 of file raminit.c.

References halfcycle_ps(), and info.

Referenced by compute_derived_timings().

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

◆ disable_cache_region()

static void disable_cache_region ( void  )
static

Definition at line 1580 of file raminit.c.

References msr_struct::lo, MTRR_PHYS_BASE, MTRR_PHYS_MASK, and wrmsr().

Referenced by check_testing(), and check_testing_type2().

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

◆ dmi_setup()

static void dmi_setup ( void  )
static

Definition at line 2846 of file raminit.c.

References DEFAULT_GPIOBASE, dmibar_read8(), dmibar_setbits32, dmibar_write16(), dmibar_write8(), gav, inb(), inl(), mchbar_clrsetbits16(), and outl().

Referenced by chipset_init().

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

◆ do_fsm()

static void do_fsm ( enum state state,
u16 counter,
u8  fail_mask,
int  margin,
int  uplimit,
u8 res_low,
u8 res_high,
u8  val 
)
static

Definition at line 1801 of file raminit.c.

References AT_MARGIN, AT_USABLE, BEFORE_USABLE, COMPLETE, and val.

Referenced by train_ram_at_178(), and try_timing_offsets().

Here is the caller graph for this function:

◆ do_ram_training()

◆ dump_timings()

static void dump_timings ( struct raminfo info)
static

Definition at line 1429 of file raminit.c.

References FOR_POPULATED_RANKS, get_timing_register_addr(), info, printk, RAM_SPEW, read_1d0(), and read_500().

Referenced by choose_reg178(), choose_training(), raminit(), and try_timing_offsets().

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

◆ enable_cache_region()

static void enable_cache_region ( unsigned int  base,
unsigned int  size 
)
static

Definition at line 1588 of file raminit.c.

References ALIGN_DOWN, base, msr_struct::hi, msr_struct::lo, MTRR_DEF_TYPE_EN, MTRR_PHYS_BASE, MTRR_PHYS_MASK, MTRR_TYPE_WRPROT, and wrmsr().

Referenced by check_testing(), and check_testing_type2().

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

◆ find_highest_bit_set()

static int find_highest_bit_set ( u16  val)
static

Definition at line 424 of file raminit.c.

References val.

Referenced by calculate_timings().

Here is the caller graph for this function:

◆ find_lowest_bit_set32()

static int find_lowest_bit_set32 ( u32  val)
static

Definition at line 433 of file raminit.c.

References val.

Referenced by program_total_memory_map().

Here is the caller graph for this function:

◆ flush_cache()

static void flush_cache ( u32  start,
u32  size 
)
static

Definition at line 1600 of file raminit.c.

References addr, ALIGN_DOWN, and clflush().

Referenced by check_testing(), and check_testing_type2().

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

◆ frequency_01()

static unsigned int frequency_01 ( struct raminfo info)
static

Definition at line 692 of file raminit.c.

References frequency_11(), and info.

Referenced by program_board_delay().

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

◆ gav_real()

static u32 gav_real ( int  line,
u32  in 
)
static

Definition at line 131 of file raminit.c.

◆ get_580()

static u32 get_580 ( int  channel,
u8  addr 
)
static

Definition at line 261 of file raminit.c.

References addr, mchbar_clrbits8, mchbar_read32(), mchbar_setbits8, mchbar_write32(), and toggle_1d0_142_5ff().

Referenced by config_rank(), and seq9().

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

◆ get_bits_420()

static u8 get_bits_420 ( const u32  reg32)
static

Definition at line 2910 of file raminit.c.

References val.

Referenced by raminit().

Here is the caller graph for this function:

◆ get_cached_training()

static const struct ram_training* get_cached_training ( void  )
static

Definition at line 1494 of file raminit.c.

References mrc_cache_current_mmap_leak(), MRC_CACHE_VERSION, MRC_TRAINING_DATA, and NULL.

Referenced by raminit().

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

◆ get_etalon()

static u32 get_etalon ( int  flip,
u32  addr 
)
static

Definition at line 1703 of file raminit.c.

References addr, get_seed2(), make_shift(), and seed1.

Referenced by check_testing_type2(), and write_testing_type2().

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

◆ get_etalon2()

static u32 get_etalon2 ( int  flip,
u32  addr 
)
static

Definition at line 1557 of file raminit.c.

References addr.

Referenced by check_testing(), and write_testing().

Here is the caller graph for this function:

◆ get_lane_offset()

static u16 get_lane_offset ( int  slot,
int  rank,
int  lane 
)
inlinestatic

Definition at line 119 of file raminit.c.

Referenced by get_timing_register_addr(), and raminit().

Here is the caller graph for this function:

◆ get_max_timing()

u16 get_max_timing ( struct raminfo info,
int  channel 
)

Definition at line 2824 of file raminit.c.

References get_timing_register_addr(), info, MAX, mchbar_read8(), NUM_RANKS, NUM_SLOTS, and read_500().

Referenced by compute_274265().

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

◆ get_seed2()

static u32 get_seed2 ( int  a,
int  b 
)
static

Definition at line 1680 of file raminit.c.

Referenced by get_etalon().

Here is the caller graph for this function:

◆ get_timing_register_addr()

static u16 get_timing_register_addr ( int  lane,
int  tm,
int  slot,
int  rank 
)
inlinestatic

◆ have_match_ranks()

static int have_match_ranks ( struct raminfo info,
int  channel,
int  ranks 
)
static

Definition at line 1501 of file raminit.c.

References info.

Referenced by raminit().

Here is the caller graph for this function:

◆ jedec_init()

static void jedec_init ( struct raminfo info)
static

Definition at line 951 of file raminit.c.

References FOR_POPULATED_RANKS, info, jedec_read(), mchbar_write16(), MR0_BT_INTERLEAVED, MR0_DLL_RESET_ON, MR1_ODS34OHM, MR1_RZQ12, MR1_RZQ2, MR1_RZQ4, MR2_RTT_WR_DISABLED, MR2_RZQ2, NUM_CHANNELS, NUM_RANKS, NUM_SLOTS, and THERMAL_AND_REFRESH.

Referenced by raminit().

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

◆ jedec_read()

static void jedec_read ( struct raminfo info,
int  channel,
int  slot,
int  rank,
int  total_rank,
u8  addr3,
unsigned int  value 
)
static

Definition at line 913 of file raminit.c.

References info, mchbar_clrsetbits8(), RANK1_ADDRESS_MAPPING, read32p(), and value.

Referenced by jedec_init(), and raminit().

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

◆ make_shift()

static int make_shift ( int  comp2,
int  comp5,
int  x 
)
static

Definition at line 1691 of file raminit.c.

References x.

Referenced by get_etalon().

Here is the caller graph for this function:

◆ ns_to_cycles()

static unsigned int ns_to_cycles ( struct raminfo info,
unsigned int  ns 
)
static

Definition at line 702 of file raminit.c.

References frequency_11(), and info.

Referenced by program_board_delay().

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

◆ program_base_timings()

static void program_base_timings ( struct raminfo info)
static

Definition at line 538 of file raminit.c.

References get_timing_register_addr(), info, MODULE_TYPE, NUM_CHANNELS, NUM_SLOTS, REFERENCE_RAW_CARD_USED, u16_ffd1188, u16_fffd0c50, u16_fffd0c68, u16_fffd0c70, u16_FFFE0EB8, u8_FFFD0C78, u8_FFFD0EF8, u8_FFFD1218, u8_FFFD1240, u8_FFFD17E0, and write_500().

Referenced by raminit().

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

◆ program_board_delay()

◆ program_modules_memory_map()

static void program_modules_memory_map ( struct raminfo info,
int  pre_jedec 
)
static

Definition at line 1044 of file raminit.c.

References FOR_ALL_RANKS, info, mchbar_write16(), mchbar_write32(), mchbar_write8(), and MIN.

Referenced by program_board_delay(), and raminit().

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

◆ program_timings()

static void program_timings ( struct raminfo info,
u16  base,
int  channel,
int  slot,
int  rank 
)
static

Definition at line 225 of file raminit.c.

References base, get_timing_register_addr(), info, and write_500().

Referenced by config_rank(), and dram_ioregs().

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

◆ program_total_memory_map()

static void program_total_memory_map ( struct raminfo info)
static

◆ ps_to_halfcycles()

static unsigned int ps_to_halfcycles ( struct raminfo info,
unsigned int  ps 
)
static

Definition at line 697 of file raminit.c.

References frequency_11(), and info.

Referenced by program_board_delay().

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

◆ ram_training()

static void ram_training ( struct raminfo info)
static

Definition at line 2806 of file raminit.c.

References do_ram_training(), info, mchbar_read16(), mchbar_write16(), read_4090(), set_10b(), and try_cached_training().

Referenced by raminit().

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

◆ raminit()

void raminit ( const int  s3resume,
const u8 spd_addrmap 
)

Definition at line 2919 of file raminit.c.

References addr, ARRAY_SIZE, BIOS_DEBUG, BIOS_ERR, BIOS_INFO, calculate_timings(), CAPID0, CAS_LATENCIES_LSB, CAS_LATENCIES_MSB, CAS_LATENCY_TIME, cbmem_recovery(), collect_system_info(), compute_derived_timings(), config_rank(), CYCLETIME, DEFAULT_PMBASE, DENSITY, DEVICE_TYPE, die(), dump_timings(), early_quickpath_init(), epbar_read32(), epbar_write32(), EPVC1RCAP, full_reset(), gav, GEN_PMCON_2, get_bits_420(), get_cached_training(), get_lane_offset(), get_timing_register_addr(), halt(), have_match_ranks(), info, inl(), intel_early_me_init(), intel_early_me_uma_size(), IOMMU_BASE1, IOMMU_BASE2, IOMMU_BASE4, jedec_init(), jedec_read(), late_quickpath_init(), MAX_RTIDS, mchbar_clrbits16, mchbar_clrbits32, mchbar_clrbits8, mchbar_clrsetbits32(), mchbar_clrsetbits8(), mchbar_read16(), mchbar_read32(), mchbar_read8(), mchbar_setbits16, mchbar_setbits32, mchbar_setbits8, mchbar_write16(), mchbar_write32(), mchbar_write8(), MEMORY_BUS_WIDTH, memset(), MiB, MODULE_TYPE, NORTHBRIDGE, NULL, NUM_CHANNELS, NUM_RANKS, NUM_SLOTS, outl(), pci_read_config16(), pci_read_config32(), pci_read_config8(), pci_write_config16(), pci_write_config32(), pci_write_config8(), PM1_CNT, raminfo::populated_ranks, printk, program_base_timings(), program_board_delay(), program_modules_memory_map(), program_total_memory_map(), QPI_NON_CORE, ram_check_nodie(), RAM_DEBUG, ram_training(), RANK1_ADDRESS_MAPPING, RANKS_AND_DQ, rdmsr(), read8(), read_1d0(), read_pmbase32(), REFERENCE_RAW_CARD_USED, rmw_1d0(), rmw_500(), save_timings(), set_334(), set_4cf(), setup_heci_uma(), SLP_TYP_S3, smbus_read_byte(), SOUTHBRIDGE, raminfo::spd, system_reset(), THERMAL_AND_REFRESH, TIMEBASE_DIVIDEND, TIMEBASE_DIVISOR, timestamp_add_now(), TOM, udelay(), value, write32p(), write_1d0(), write_26c(), write_500(), and write_pmbase32().

Here is the call graph for this function:

◆ read128()

static void read128 ( u32  addr,
u64 out 
)
static

Definition at line 63 of file raminit.c.

References addr, _u128::hi, and _u128::lo.

Referenced by check_testing().

Here is the caller graph for this function:

◆ read_1d0()

static u16 read_1d0 ( u16  addr,
int  split 
)
static

Definition at line 97 of file raminit.c.

References addr, mchbar_read32(), mchbar_read8(), mchbar_write32(), val, and write_1d0().

Referenced by config_rank(), dump_timings(), raminit(), rmw_1d0(), save_timings(), set_10b(), toggle_1d0_142_5ff(), and try_cached_training().

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

◆ read_4090()

static void read_4090 ( struct raminfo info)
static

Definition at line 1529 of file raminit.c.

References get_timing_register_addr(), info, ram_training::lane_timings, NUM_CHANNELS, NUM_RANKS, NUM_SLOTS, and read_500().

Referenced by ram_training().

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

◆ read_500()

static u16 read_500 ( struct raminfo info,
int  channel,
u16  addr,
int  split 
)
static

Definition at line 144 of file raminit.c.

References addr, info, mchbar_read32(), mchbar_read8(), mchbar_write32(), and val.

Referenced by dump_timings(), get_max_timing(), read_4090(), rmw_500(), save_timings(), seq9(), and set_10b().

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

◆ rmw_1d0()

static void rmw_1d0 ( u16  addr,
u32  and,
u32  or,
int  split 
)
static

Definition at line 417 of file raminit.c.

References addr, read_1d0(), and write_1d0().

Referenced by program_board_delay(), and raminit().

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

◆ rmw_500()

static void rmw_500 ( struct raminfo info,
int  channel,
u16  addr,
int  bits,
u32  and,
u32  or 
)
static

Definition at line 178 of file raminit.c.

References addr, info, read_500(), val, and write_500().

Referenced by raminit(), and set_4cf().

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

◆ rw_test()

static int rw_test ( int  rank)
static

Definition at line 184 of file raminit.c.

References gav, mask, read32p(), sfence(), val, and write32p().

Referenced by config_rank().

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

◆ save_timings()

◆ seq9()

static void seq9 ( struct raminfo info,
int  channel,
int  slot,
int  rank 
)
static

Definition at line 276 of file raminit.c.

References gav, get_580(), get_timing_register_addr(), info, read_500(), toggle_1d0_142_5ff(), write_1d0(), and write_500().

Referenced by config_rank().

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

◆ set_10b()

static void set_10b ( struct raminfo info,
u8  val 
)
static

Definition at line 2147 of file raminit.c.

References FOR_POPULATED_RANKS_BACKWARDS, get_timing_register_addr(), info, lut16, read_1d0(), read_500(), val, write_1d0(), and write_500().

Referenced by ram_training(), and try_cached_training().

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

◆ set_178()

static void set_178 ( u8  val)
static

Definition at line 2190 of file raminit.c.

References val, and write_1d0().

Referenced by do_ram_training(), and try_cached_training().

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

◆ set_334()

static void set_334 ( int  zero)
static

Definition at line 375 of file raminit.c.

References c, gav, mchbar_read32(), mchbar_read8(), mchbar_setbits32, mchbar_write16(), mchbar_write32(), and NUM_CHANNELS.

Referenced by raminit().

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

◆ set_4cf()

static void set_4cf ( struct raminfo info,
int  channel,
u8  bit,
u8  val 
)
static

Definition at line 366 of file raminit.c.

References ARRAY_SIZE, info, rmw_500(), and val.

Referenced by raminit().

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

◆ set_ecc()

static void set_ecc ( int  onoff)
static

Definition at line 2176 of file raminit.c.

References mchbar_read8(), mchbar_write8(), and NUM_CHANNELS.

Referenced by do_ram_training(), and try_cached_training().

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

◆ sfence()

static void sfence ( void  )
static

Definition at line 114 of file raminit.c.

Referenced by rw_test().

Here is the caller graph for this function:

◆ toggle_1d0_142_5ff()

static void toggle_1d0_142_5ff ( void  )
static

Definition at line 249 of file raminit.c.

References gav, mchbar_write8(), read_1d0(), and write_1d0().

Referenced by get_580(), and seq9().

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

◆ train_ram_at_178()

static void train_ram_at_178 ( struct raminfo info,
u8  channel,
int  slot,
int  rank,
u8  total_rank,
u8  reg_178,
int  first_run,
int  niter,
timing_bounds_t timings 
)
static

Definition at line 1853 of file raminit.c.

References BEFORE_USABLE, check_bounded(), check_testing(), check_testing_type2(), COMPLETE, count, do_fsm(), get_timing_register_addr(), info, ram_training::lane_timings, mchbar_setbits32, ram_training::reg_178, validate_state(), write_1d0(), and write_500().

Referenced by do_ram_training().

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

◆ try_cached_training()

◆ try_timing_offsets()

static void try_timing_offsets ( struct raminfo info,
int  channel,
int  slot,
int  rank,
int  totalrank 
)
static

Definition at line 2215 of file raminit.c.

References BEFORE_USABLE, check_testing(), count, die(), do_fsm(), dump_timings(), get_timing_register_addr(), info, ram_training::lane_timings, memset(), ram_training::timing_offset, validate_state(), write_1d0(), write_500(), and write_testing().

Referenced by do_ram_training().

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

◆ validate_state()

static int validate_state ( enum state in)
static

Definition at line 1791 of file raminit.c.

References COMPLETE.

Referenced by train_ram_at_178(), and try_timing_offsets().

Here is the caller graph for this function:

◆ write_1d0()

static void write_1d0 ( u32  val,
u16  addr,
int  bits,
int  flag 
)
static

Definition at line 85 of file raminit.c.

References addr, mchbar_read32(), mchbar_write32(), and val.

Referenced by config_rank(), do_ram_training(), raminit(), read_1d0(), rmw_1d0(), seq9(), set_10b(), set_178(), toggle_1d0_142_5ff(), train_ram_at_178(), try_cached_training(), try_timing_offsets(), and write_training_data().

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

◆ write_26c()

static void write_26c ( int  channel,
u16  si 
)
static

Definition at line 242 of file raminit.c.

References mchbar_write16(), and mchbar_write32().

Referenced by raminit().

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

◆ write_500()

static void write_500 ( struct raminfo info,
int  channel,
u32  val,
u16  addr,
int  bits,
int  flag 
)
static

Definition at line 161 of file raminit.c.

References addr, info, mchbar_read32(), mchbar_write32(), and val.

Referenced by do_ram_training(), program_base_timings(), program_board_delay(), program_timings(), raminit(), rmw_500(), seq9(), set_10b(), train_ram_at_178(), try_cached_training(), try_timing_offsets(), write_500_timings_type(), and write_training_data().

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

◆ write_500_timings_type()

static void write_500_timings_type ( struct raminfo info,
int  channel,
int  slot,
int  rank,
int  type 
)
static

Definition at line 2201 of file raminit.c.

References get_timing_register_addr(), info, ram_training::lane_timings, type, and write_500().

Referenced by do_ram_training(), and try_cached_training().

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

◆ write_testing()

static void write_testing ( struct raminfo info,
int  totalrank,
int  flip 
)
static

Definition at line 1615 of file raminit.c.

References base, clear_errors(), get_etalon2(), offset, and write32().

Referenced by do_ram_training(), try_cached_training(), and try_timing_offsets().

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

◆ write_testing_type2()

static void write_testing_type2 ( struct raminfo info,
u8  totalrank,
u8  region,
u8  block,
char  flip 
)
static

Definition at line 1735 of file raminit.c.

References get_etalon(), and write32p().

Referenced by do_ram_training().

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

◆ write_training_data()

static void write_training_data ( struct raminfo info)
static

Definition at line 1405 of file raminit.c.

References get_timing_register_addr(), info, NUM_CHANNELS, NUM_RANKS, NUM_SLOTS, write_1d0(), and write_500().

Referenced by try_cached_training().

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

Variable Documentation

◆ seed1

const u32 seed1[0x18]
Initial value:
= {
0x3a9d5ab5, 0x576cb65b, 0x555773b6, 0x2ab772ee,
0x555556ee, 0x3a9d5ab5, 0x576cb65b, 0x555773b6,
0x2ab772ee, 0x555556ee, 0x5155a555, 0x5155a555,
0x5155a555, 0x5155a555, 0x3a9d5ab5, 0x576cb65b,
0x555773b6, 0x2ab772ee, 0x555556ee, 0x55d6b4a5,
0x366d6b3a, 0x2ae5ddbb, 0x3b9ddbb7, 0x55d6b4a5,
}

Definition at line 1671 of file raminit.c.

Referenced by get_etalon().

◆ timings_car

timing_bounds_t timings_car[64]

Definition at line 140 of file raminit.c.

Referenced by do_ram_training().