coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
spd_util.c
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 
3 #include <stdint.h>
4 #include <string.h>
5 #include "spd.h"
6 
7 void mainboard_fill_dq_map_data(void *dq_map_ch0, void *dq_map_ch1)
8 {
9  /* DQ byte map */
10  const u8 dq_map[2][12] = {
11  { 0x0F, 0xF0, 0x00, 0xF0, 0x0F, 0xF0,
12  0x0F, 0x00, 0xFF, 0x00, 0xFF, 0x00 },
13  { 0x33, 0xCC, 0x00, 0xCC, 0x33, 0xCC,
14  0x33, 0x00, 0xFF, 0x00, 0xFF, 0x00 } };
15  memcpy(dq_map_ch0, dq_map[0], sizeof(dq_map[0]));
16  memcpy(dq_map_ch1, dq_map[1], sizeof(dq_map[1]));
17 }
18 
19 void mainboard_fill_dqs_map_data(void *dqs_map_ch0, void *dqs_map_ch1)
20 {
21  /* DQS CPU<>DRAM map */
22  const u8 dqs_map[2][8] = {
23  { 0, 1, 3, 2, 4, 5, 6, 7 },
24  { 1, 0, 4, 5, 2, 3, 6, 7 } };
25  memcpy(dqs_map_ch0, dqs_map[0], sizeof(dqs_map[0]));
26  memcpy(dqs_map_ch1, dqs_map[1], sizeof(dqs_map[1]));
27 }
28 
29 void mainboard_fill_rcomp_res_data(void *rcomp_ptr)
30 {
31  /* Rcomp resistor */
32  const u16 RcompResistor[3] = { 121, 81, 100 };
33  memcpy(rcomp_ptr, RcompResistor, sizeof(RcompResistor));
34 }
35 
36 void mainboard_fill_rcomp_strength_data(void *rcomp_strength_ptr)
37 {
38  /* Rcomp target */
39  static const u16 RcompTarget[5] = { 100, 40, 20, 20, 26 };
40  memcpy(rcomp_strength_ptr, RcompTarget, sizeof(RcompTarget));
41 }
void * memcpy(void *dest, const void *src, size_t n)
Definition: memcpy.c:7
void mainboard_fill_dq_map_data(void *dq_map_ptr)
Definition: spd_util.c:8
void mainboard_fill_dqs_map_data(void *dqs_map_ptr)
Definition: spd_util.c:19
void mainboard_fill_rcomp_res_data(void *rcomp_ptr)
Definition: spd_util.c:28
void mainboard_fill_rcomp_strength_data(void *rcomp_strength_ptr)
Definition: spd_util.c:36
static const u8 dqs_map[][8]
Definition: memory.c:17
static const u8 dq_map[][12]
Definition: memory.c:9
uint16_t u16
Definition: stdint.h:48
uint8_t u8
Definition: stdint.h:45