coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
raminit.c File Reference
#include <spd.h>
#include <delay.h>
#include <stdint.h>
#include <device/mmio.h>
#include <device/pci_ops.h>
#include <device/pci_def.h>
#include <device/smbus_host.h>
#include <console/console.h>
#include <timestamp.h>
#include "i440bx.h"
#include "raminit.h"
Include dependency graph for raminit.c:

Go to the source code of this file.

Data Structures

struct  dimm_size
 

Macros

#define PRINT_DEBUG(x...)
 
#define DUMPNORTH()
 
#define RAM_COMMAND_NORMAL   0x0
 
#define RAM_COMMAND_NOP   0x1
 
#define RAM_COMMAND_PRECHARGE   0x2
 
#define RAM_COMMAND_MRS   0x3
 
#define RAM_COMMAND_CBR   0x4
 

Functions

static void do_ram_command (u32 command)
 Send the specified RAM command to all DIMMs. More...
 
static void set_dram_buffer_strength (void)
 
static void spd_enable_refresh (void)
 
static void sdram_set_registers (void)
 
static struct dimm_size spd_get_dimm_size (unsigned int device)
 
static void set_dram_row_attributes (void)
 
static void sdram_set_spd_registers (void)
 
static void sdram_enable (void)
 
void __weak enable_spd (void)
 
void __weak disable_spd (void)
 
void sdram_initialize (int s3resume)
 

Variables

static const uint32_t refresh_rate_map []
 
static const u8 register_values []
 

Macro Definition Documentation

◆ DUMPNORTH

#define DUMPNORTH ( )

Definition at line 25 of file raminit.c.

◆ PRINT_DEBUG

#define PRINT_DEBUG (   x...)

Definition at line 24 of file raminit.c.

◆ RAM_COMMAND_CBR

#define RAM_COMMAND_CBR   0x4

Definition at line 33 of file raminit.c.

◆ RAM_COMMAND_MRS

#define RAM_COMMAND_MRS   0x3

Definition at line 32 of file raminit.c.

◆ RAM_COMMAND_NOP

#define RAM_COMMAND_NOP   0x1

Definition at line 30 of file raminit.c.

◆ RAM_COMMAND_NORMAL

#define RAM_COMMAND_NORMAL   0x0

Definition at line 29 of file raminit.c.

◆ RAM_COMMAND_PRECHARGE

#define RAM_COMMAND_PRECHARGE   0x2

Definition at line 31 of file raminit.c.

Function Documentation

◆ disable_spd()

void __weak disable_spd ( void  )

Definition at line 1003 of file raminit.c.

Referenced by sdram_initialize().

Here is the caller graph for this function:

◆ do_ram_command()

static void do_ram_command ( u32  command)
static

Send the specified RAM command to all DIMMs.

Parameters
commandThe RAM command to send to the DIMM(s).

Definition at line 350 of file raminit.c.

References addr, DIMM_SOCKETS, DRB, NB, pci_read_config16(), pci_read_config8(), pci_write_config16(), RAM_COMMAND_MRS, RAM_COMMAND_NORMAL, read32(), and SDRAMC.

Referenced by sdram_enable().

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

◆ enable_spd()

void __weak enable_spd ( void  )

Definition at line 1002 of file raminit.c.

Referenced by sdram_initialize().

Here is the caller graph for this function:

◆ sdram_enable()

static void sdram_enable ( void  )
static

Definition at line 957 of file raminit.c.

References do_ram_command(), DUMPNORTH, NB, pci_write_config8(), PMCR, PRINT_DEBUG, RAM_COMMAND_CBR, RAM_COMMAND_MRS, RAM_COMMAND_NOP, RAM_COMMAND_NORMAL, RAM_COMMAND_PRECHARGE, spd_enable_refresh(), and udelay().

Referenced by sdram_initialize().

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

◆ sdram_initialize()

void sdram_initialize ( int  s3resume)

◆ sdram_set_registers()

static void sdram_set_registers ( void  )
static

Definition at line 643 of file raminit.c.

References ARRAY_SIZE, DUMPNORTH, NB, pci_write_config8(), PRINT_DEBUG, and register_values.

Referenced by sdram_initialize().

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

◆ sdram_set_spd_registers()

static void sdram_set_spd_registers ( void  )
static

Definition at line 948 of file raminit.c.

References set_dram_buffer_strength(), and set_dram_row_attributes().

Referenced by sdram_initialize().

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

◆ set_dram_buffer_strength()

static void set_dram_buffer_strength ( void  )
static

Definition at line 403 of file raminit.c.

References CONFIG, DRB0, DRB3, DRB7, MBFS, MBSC, NB, NBXCFG, pci_read_config8(), pci_write_config16(), and pci_write_config8().

Referenced by sdram_set_spd_registers().

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

◆ set_dram_row_attributes()

◆ spd_enable_refresh()

static void spd_enable_refresh ( void  )
static

Definition at line 620 of file raminit.c.

References DIMM0, DIMM_SOCKETS, DRAMC, NB, pci_read_config8(), pci_write_config8(), PRINT_DEBUG, refresh_rate_map, smbus_read_byte(), SPD_REFRESH, and value.

Referenced by sdram_enable().

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

◆ spd_get_dimm_size()

static struct dimm_size spd_get_dimm_size ( unsigned int  device)
static

Definition at line 643 of file raminit.c.

Referenced by set_dram_row_attributes().

Here is the caller graph for this function:

Variable Documentation

◆ refresh_rate_map

const uint32_t refresh_rate_map[]
static
Initial value:
= {
1, 5, 5, 2, 3, 4
}

Definition at line 45 of file raminit.c.

Referenced by spd_enable_refresh().

◆ register_values

const u8 register_values[]
static

Definition at line 50 of file raminit.c.

Referenced by sdram_set_registers().