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 
6 #include "../board_id.h"
7 #include "spd.h"
8 
9 void mainboard_fill_dq_map_data(void *dq_map_ch0, void *dq_map_ch1)
10 {
11  /* DQ byte map */
12  const u8 dq_map[2][12] = {
13  { 0x0F, 0xF0, 0x00, 0xF0, 0x0F, 0xF0,
14  0x0F, 0x00, 0xFF, 0x00, 0xFF, 0x00 },
15  { 0x33, 0xCC, 0x00, 0xCC, 0x33, 0xCC,
16  0x33, 0x00, 0xFF, 0x00, 0xFF, 0x00 } };
17  memcpy(dq_map_ch0, dq_map[0], sizeof(dq_map[0]));
18  memcpy(dq_map_ch1, dq_map[1], sizeof(dq_map[1]));
19 }
20 
21 void mainboard_fill_dqs_map_data(void *dqs_map_ch0, void *dqs_map_ch1)
22 {
23  /* DQS CPU<>DRAM map */
24  const u8 dqs_map[2][8] = {
25  { 0, 1, 3, 2, 4, 5, 6, 7 },
26  { 1, 0, 4, 5, 2, 3, 6, 7 } };
27  memcpy(dqs_map_ch0, dqs_map[0], sizeof(dqs_map[0]));
28  memcpy(dqs_map_ch1, dqs_map[1], sizeof(dqs_map[1]));
29 }
30 
31 void mainboard_fill_rcomp_res_data(void *rcomp_ptr)
32 {
33  /* Rcomp resistor */
34  const u16 RcompResistor[3] = { 200, 81, 162 };
35  memcpy(rcomp_ptr, RcompResistor,
36  sizeof(RcompResistor));
37 }
38 
39 void mainboard_fill_rcomp_strength_data(void *rcomp_strength_ptr)
40 {
41  /* Rcomp target */
42  static const u16 RcompTarget[5] = { 100, 40, 40, 23, 40 };
43 
44  memcpy(rcomp_strength_ptr, RcompTarget, sizeof(RcompTarget));
45 }
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