]>
git.proxmox.com Git - mirror_edk2.git/blob - QuarkSocPkg/QuarkNorthCluster/MemoryInit/Pei/mrc.h
1 /************************************************************************
3 * Copyright (c) 2013-2015 Intel Corporation.
5 * This program and the accompanying materials
6 * are licensed and made available under the terms and conditions of the BSD License
7 * which accompanies this distribution. The full text of the license may be found at
8 * http://opensource.org/licenses/bsd-license.php
10 * THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
13 ************************************************************************/
17 #include "core_types.h"
19 // define the MRC Version
20 #define MRC_VERSION 0x0112
23 // architectural definitions
24 #define NUM_CHANNELS 1 // number of channels
25 #define NUM_RANKS 2 // number of ranks per channel
26 #define NUM_BYTE_LANES 4 // number of byte lanes per channel
28 // software limitations
29 #define MAX_CHANNELS 1
31 #define MAX_BYTE_LANES 4
33 // only to mock MrcWrapper
36 #define MAX_ROWS (MAX_SIDES * MAX_SOCKETS)
40 // Specify DRAM of nenory channel width
43 x16
, // DRAM width & Channel Width
59 // Delay configuration for individual signals
62 typedef struct MrcTimings_s
64 uint32_t rcvn
[NUM_CHANNELS
][NUM_RANKS
][NUM_BYTE_LANES
];
65 uint32_t rdqs
[NUM_CHANNELS
][NUM_RANKS
][NUM_BYTE_LANES
];
66 uint32_t wdqs
[NUM_CHANNELS
][NUM_RANKS
][NUM_BYTE_LANES
];
67 uint32_t wdq
[NUM_CHANNELS
][NUM_RANKS
][NUM_BYTE_LANES
];
68 uint32_t vref
[NUM_CHANNELS
][NUM_BYTE_LANES
];
69 uint32_t wctl
[NUM_CHANNELS
][NUM_RANKS
];
70 uint32_t wcmd
[NUM_CHANNELS
];
72 uint32_t scrambler_seed
;
73 uint8_t ddr_speed
; // need to save for the case of frequency change
77 // DENSITY: 0=512Mb, 1=Gb, 2=2Gb, 3=4Gb
78 // tCL is DRAM CAS Latency in clocks.
79 // All other timings are in picoseconds.
80 // Refer to JEDEC spec (or DRAM datasheet) when changing these values.
81 typedef struct DRAMParams_s
{
83 uint8_t tCL
; // CAS latency in clocks
84 uint32_t tRAS
; // ACT to PRE command period
85 uint32_t tWTR
; // Delay from start of internal write transaction to internal read command
86 uint32_t tRRD
; // ACT to ACT command period (JESD79 specific to page size 1K/2K)
87 uint32_t tFAW
; // Four activate window (JESD79 specific to page size 1K/2K)
91 // Boot mode defined as bit mask (1<<n)
92 #define bmCold 1 // full training
93 #define bmFast 2 // restore timing parameters
94 #define bmS3 4 // resume from S3
99 // MRC execution status
100 #define MRC_SUCCESS 0 // initialization ok
101 #define MRC_E_MEMTEST 1 // memtest failed
105 // Input/output/context parameters for Memory Reference Code
107 typedef struct MRCParams_s
113 uint32_t boot_mode
; // bmCold, bmFast, bmWarm, bmS3
114 uint32_t uart_mmio_base
; // pcie serial port base address (force 0 to disable debug)
116 uint8_t dram_width
; // x8, x16
117 uint8_t ddr_speed
; // DDRFREQ_800, DDRFREQ_1066
118 uint8_t ddr_type
; // DDR3, DDR3L
119 uint8_t ecc_enables
; // 0, 1 (memory size reduced to 7/8)
120 uint8_t scrambling_enables
; // 0, 1
121 uint32_t rank_enables
; // 1, 3 (1'st rank has to be populated if 2'nd rank present)
122 uint32_t channel_enables
; // 1 only
123 uint32_t channel_width
; // x16 only
124 uint32_t address_mode
; // 0, 1, 2 (mode 2 forced if ecc enabled)
127 uint8_t refresh_rate
; // REFRESH_RATE : 1=1.95us, 2=3.9us, 3=7.8us, others=RESERVED
128 uint8_t sr_temp_range
; // SR_TEMP_RANGE : 0=normal, 1=extended, others=RESERVED
129 uint8_t ron_value
; // RON_VALUE : 0=34ohm, 1=40ohm, others=RESERVED (select MRS1.DIC driver impedance control)
130 uint8_t rtt_nom_value
; // RTT_NOM_VALUE : 0=40ohm, 1=60ohm, 2=120ohm, others=RESERVED
131 uint8_t rd_odt_value
; // RD_ODT_VALUE : 0=off, 1=60ohm, 2=120ohm, 3=180ohm, others=RESERVED
140 uint32_t board_id
; // internally used for board layout (use x8 or x16 memory)
141 uint32_t hte_setup
: 1; // when set hte reconfiguration requested
142 uint32_t menu_after_mrc
: 1;
143 uint32_t power_down_disable
:1;
144 uint32_t tune_rcvn
:1;
146 uint32_t channel_size
[NUM_CHANNELS
];
147 uint32_t column_bits
[NUM_CHANNELS
];
148 uint32_t row_bits
[NUM_CHANNELS
];
150 uint32_t mrs1
; // register content saved during training
156 uint32_t status
; // initialization result (non zero specifies error code)
157 uint32_t mem_size
; // total memory size in bytes (excludes ECC banks)
159 MrcTimings_t timings
; // training results (also used on input)
163 // Alternative type name for consistent naming convention
164 #define MRC_PARAMS MRCParams_t