/* * Copyright (C) 2013, Intel Corporation * Copyright (C) 2015, Bin Meng * * Ported from Intel released Quark UEFI BIOS * QuarkSocPkg/QuarkNorthCluster/MemoryInit/Pei * * SPDX-License-Identifier: Intel */ #ifndef _MRC_H_ #define _MRC_H_ #define MRC_VERSION 0x0111 /* architectural definitions */ #define NUM_CHANNELS 1 /* number of channels */ #define NUM_RANKS 2 /* number of ranks per channel */ #define NUM_BYTE_LANES 4 /* number of byte lanes per channel */ /* software limitations */ #define MAX_CHANNELS 1 #define MAX_RANKS 2 #define MAX_BYTE_LANES 4 #define MAX_SOCKETS 1 #define MAX_SIDES 1 #define MAX_ROWS (MAX_SIDES * MAX_SOCKETS) /* Specify DRAM and channel width */ enum { X8, /* DRAM width */ X16, /* DRAM width & Channel Width */ X32 /* Channel Width */ }; /* Specify DRAM speed */ enum { DDRFREQ_800, DDRFREQ_1066 }; /* Specify DRAM type */ enum { DDR3, DDR3L }; /* * density: 0=512Mb, 1=Gb, 2=2Gb, 3=4Gb * cl: DRAM CAS Latency in clocks * ras: ACT to PRE command period * wtr: Delay from start of internal write transaction to internal read command * rrd: ACT to ACT command period (JESD79 specific to page size 1K/2K) * faw: Four activate window (JESD79 specific to page size 1K/2K) * * ras/wtr/rrd/faw timings are in picoseconds * * Refer to JEDEC spec (or DRAM datasheet) when changing these values. */ struct dram_params { uint8_t density; uint8_t cl; uint32_t ras; uint32_t wtr; uint32_t rrd; uint32_t faw; }; /* * Delay configuration for individual signals * Vref setting * Scrambler seed */ struct mrc_timings { uint32_t rcvn[NUM_CHANNELS][NUM_RANKS][NUM_BYTE_LANES]; uint32_t rdqs[NUM_CHANNELS][NUM_RANKS][NUM_BYTE_LANES]; uint32_t wdqs[NUM_CHANNELS][NUM_RANKS][NUM_BYTE_LANES]; uint32_t wdq[NUM_CHANNELS][NUM_RANKS][NUM_BYTE_LANES]; uint32_t vref[NUM_CHANNELS][NUM_BYTE_LANES]; uint32_t wctl[NUM_CHANNELS][NUM_RANKS]; uint32_t wcmd[NUM_CHANNELS]; uint32_t scrambler_seed; /* need to save for the case of frequency change */ uint8_t ddr_speed; }; /* Boot mode defined as bit mask (1<