![]() |
coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
|
Utilities for decoding DDR2 SPDs. More...
#include <console/console.h>
#include <device/device.h>
#include <device/dram/ddr2.h>
#include <lib.h>
#include <string.h>
#include <types.h>
Go to the source code of this file.
Functions | |
int | spd_dimm_is_registered_ddr2 (enum spd_dimm_type_ddr2 type) |
Checks if the DIMM is Registered based on byte[20] of the SPD. More... | |
u8 | spd_ddr2_calc_checksum (u8 *spd, int len) |
Calculate the checksum of a DDR2 SPD unique identifier. More... | |
u16 | spd_ddr2_calc_unique_crc (const u8 *spd, int len) |
Calculate the CRC of a DDR2 SPD unique identifier. More... | |
u32 | spd_decode_spd_size_ddr2 (u8 byte0) |
Return size of SPD. More... | |
u32 | spd_decode_eeprom_size_ddr2 (u8 byte1) |
Return size of eeprom. More... | |
u8 | spd_get_msbs (u8 c) |
Return index of MSB set. More... | |
static int | spd_decode_tck_time (u32 *tck, u8 c) |
Decode SPD tck cycle time. More... | |
static int | spd_decode_bcd_time (u32 *bcd, u8 c) |
Decode SPD bcd style timings. More... | |
static u32 | spd_decode_quarter_time (u8 c) |
Decode SPD tRP, tRRP cycle time. More... | |
static int | spd_decode_tRR_time (u32 *tRR, u8 c) |
Decode SPD tRR time. More... | |
static void | spd_decode_tRCtRFC_time (u8 *spd_40_41_42, u32 *tRC, u32 *tRFC) |
Decode SPD tRC,tRFC time. More... | |
int | spd_decode_ddr2 (struct dimm_attr_ddr2_st *dimm, u8 spd[SPD_SIZE_MAX_DDR2]) |
Decode the raw SPD data. More... | |
static void | print_ns (const char *msg, u32 val) |
static void | print_us (const char *msg, u32 val) |
void | dram_print_spd_ddr2 (const struct dimm_attr_ddr2_st *dimm) |
Print the info in DIMM. More... | |
void | normalize_tck (u32 *tclk) |
Utilities for decoding DDR2 SPDs.
Definition in file ddr2.c.
void dram_print_spd_ddr2 | ( | const struct dimm_attr_ddr2_st * | dimm | ) |
Print the info in DIMM.
Print info about the DIMM. Useful to use when CONFIG(DEBUG_RAM_SETUP) is selected, or for a purely informative output.
dimm | pointer to already decoded dimm_attr structure |
Definition at line 660 of file ddr2.c.
References dimm_attr_ddr2_st::access_time, dimm_attr_ddr2_st::banks, BIOS_INFO, buf, dimm_attr_ddr2_st::cas_supported, dimm_attr_ddr2_st::col_bits, dimm_attr_ddr2_st::cycle_time, print_ns(), print_us(), printk, dimm_attr_ddr2_st::ranks, dimm_attr_ddr2_st::row_bits, dimm_attr_ddr2_st::size_mb, strcpy(), dimm_attr_ddr2_st::tCK, dimm_attr_ddr2_st::tDH, dimm_attr_ddr2_st::tDQSQ, dimm_attr_ddr2_st::tDS, dimm_attr_ddr2_st::tPLL, dimm_attr_ddr2_st::tQHS, dimm_attr_ddr2_st::tRAS, dimm_attr_ddr2_st::tRC, dimm_attr_ddr2_st::tRCD, dimm_attr_ddr2_st::tRFC, dimm_attr_ddr2_st::tRP, dimm_attr_ddr2_st::tRR, dimm_attr_ddr2_st::tRRD, dimm_attr_ddr2_st::tRTP, dimm_attr_ddr2_st::tWR, dimm_attr_ddr2_st::tWTR, and dimm_attr_ddr2_st::width.
Referenced by ddr2_save_dimminfo(), and gather_common_timing().
Definition at line 712 of file ddr2.c.
References BIOS_ERR, printk, TCK_200MHZ, TCK_266MHZ, TCK_333MHZ, TCK_400MHZ, TCK_533MHZ, TCK_666MHZ, and TCK_800MHZ.
Referenced by choose_tclk().
Calculate the checksum of a DDR2 SPD unique identifier.
spd | pointer to raw SPD data |
len | length of data in SPD |
Definition at line 45 of file ddr2.c.
References c.
Referenced by spd_decode_ddr2().
Calculate the CRC of a DDR2 SPD unique identifier.
spd | pointer to raw SPD data |
len | length of data in SPD |
Definition at line 69 of file ddr2.c.
References ddr_crc16().
Referenced by ddr2_get_crc(), and ddr2_save_dimminfo().
Decode SPD bcd style timings.
Decodes a raw SPD data from a DDR2 DIMM. Returns cycle time in 1/256th ns.
Definition at line 164 of file ddr2.c.
References c, CB_ERR, and CB_SUCCESS.
Referenced by spd_decode_ddr2().
int spd_decode_ddr2 | ( | struct dimm_attr_ddr2_st * | dimm, |
u8 | spd[SPD_SIZE_MAX_DDR2] | ||
) |
Decode the raw SPD data.
Decodes a raw SPD data from a DDR2 DIMM, and organizes it into a dimm_attr structure. The SPD data must first be read in a contiguous array, and passed to this function.
dimm | pointer to dimm_attr structure where the decoded data is to be stored |
spd | array of raw data previously read from the SPD. |
Definition at line 310 of file ddr2.c.
References dimm_attr_ddr2_st::access_time, dimm_attr_ddr2_st::banks, BIOS_ERR, BIOS_WARNING, dimm_flags_ddr2_st::bl4, dimm_flags_ddr2_st::bl8, dimm_attr_ddr2_st::cas_supported, CB_SUCCESS, dimm_attr_ddr2_st::checksum, dimm_attr_ddr2_st::col_bits, dimm_attr_ddr2_st::cycle_time, dimm_attr_ddr2_st::dimm_type, dimm_attr_ddr2_st::dram_type, dimm_attr_ddr2_st::flags, dimm_flags_ddr2_st::is_ecc, dimm_attr_ddr2_st::manufacturer_id, memcpy(), memset(), dimm_attr_ddr2_st::mod_width, dimm_flags_ddr2_st::operable_1_50V, dimm_flags_ddr2_st::operable_1_80V, dimm_flags_ddr2_st::operable_2_50V, dimm_flags_ddr2_st::operable_3_33V, dimm_flags_ddr2_st::operable_5_00V, dimm_attr_ddr2_st::part_number, dimm_flags_ddr2_st::pasr, dimm_attr_ddr2_st::plls, printk, printram, dimm_attr_ddr2_st::ranks, dimm_attr_ddr2_st::ranksize_mb, dimm_attr_ddr2_st::rev, dimm_attr_ddr2_st::row_bits, dimm_flags_ddr2_st::self_refresh, dimm_attr_ddr2_st::serial, dimm_attr_ddr2_st::size_mb, spd_ddr2_calc_checksum(), SPD_DDR2_DIMM_TYPE_MASK, spd_decode_bcd_time(), spd_decode_eeprom_size_ddr2(), spd_decode_quarter_time(), spd_decode_spd_size_ddr2(), spd_decode_tck_time(), spd_decode_tRCtRFC_time(), spd_decode_tRR_time(), spd_get_msbs(), SPD_MEMORY_TYPE_SDRAM_DDR2, SPD_MEMORY_TYPE_UNDEFINED, SPD_STATUS_CRC_ERROR, SPD_STATUS_INVALID, SPD_STATUS_INVALID_FIELD, SPD_STATUS_OK, dimm_flags_ddr2_st::stacked, dimm_attr_ddr2_st::tCK, dimm_attr_ddr2_st::tDH, dimm_attr_ddr2_st::tDQSQ, dimm_attr_ddr2_st::tDS, dimm_flags_ddr2_st::terminate_50ohms, dimm_attr_ddr2_st::tPLL, dimm_attr_ddr2_st::tQHS, dimm_attr_ddr2_st::tRAS, dimm_attr_ddr2_st::tRC, dimm_attr_ddr2_st::tRCD, dimm_attr_ddr2_st::tRFC, dimm_attr_ddr2_st::tRP, dimm_attr_ddr2_st::tRR, dimm_attr_ddr2_st::tRRD, dimm_attr_ddr2_st::tRTP, dimm_attr_ddr2_st::tWR, dimm_attr_ddr2_st::tWTR, dimm_flags_ddr2_st::weak_driver, dimm_attr_ddr2_st::weeks, dimm_attr_ddr2_st::width, and dimm_attr_ddr2_st::year.
Referenced by ddr2_save_dimminfo(), and gather_common_timing().
Return size of eeprom.
Returns size of eeprom. Usually 256 Byte.
Definition at line 99 of file ddr2.c.
Referenced by spd_decode_ddr2().
Decode SPD tRP, tRRP cycle time.
Decodes a raw SPD data from a DDR2 DIMM. Returns cycle time in 1/256th ns.
Definition at line 183 of file ddr2.c.
References c.
Referenced by spd_decode_ddr2().
Return size of SPD.
Returns size of SPD. Usually 128 Byte.
Definition at line 89 of file ddr2.c.
References MIN, and SPD_SIZE_MAX_DDR2.
Referenced by ddr2_save_dimminfo(), and spd_decode_ddr2().
Decode SPD tck cycle time.
Decodes a raw SPD data from a DDR2 DIMM. Returns cycle time in 1/256th ns.
Definition at line 126 of file ddr2.c.
References BIOS_WARNING, c, CB_ERR, CB_SUCCESS, and printk.
Referenced by spd_decode_ddr2().
Decode SPD tRC,tRFC time.
Decodes a raw SPD data from a DDR2 DIMM. Returns cycle time in 1/256th us.
Definition at line 233 of file ddr2.c.
Referenced by spd_decode_ddr2().
Decode SPD tRR time.
Decodes a raw SPD data from a DDR2 DIMM. Returns cycle time in 1/256th us.
Definition at line 199 of file ddr2.c.
References BIOS_WARNING, c, CB_ERR, CB_SUCCESS, and printk.
Referenced by spd_decode_ddr2().
int spd_dimm_is_registered_ddr2 | ( | enum spd_dimm_type_ddr2 | type | ) |
Checks if the DIMM is Registered based on byte[20] of the SPD.
Tells if the DIMM type is registered or not.
type | DIMM type. This is byte[20] of the SPD. |
Definition at line 27 of file ddr2.c.
References SPD_DDR2_DIMM_TYPE_72B_SO_RDIMM, SPD_DDR2_DIMM_TYPE_MINI_RDIMM, SPD_DDR2_DIMM_TYPE_RDIMM, and type.
Referenced by gather_common_timing().
Return index of MSB set.
Returns the index of MSB set.
Definition at line 115 of file ddr2.c.
Referenced by choose_tclk(), select_cas_dramfreq_ddr2(), and spd_decode_ddr2().