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 <
console/console.h
>
4
#include <gpio.h>
5
#include <soc/gpio.h>
6
#include <
mainboard/google/cyan/spd/spd_util.h
>
7
8
/*
9
* Usage of RAMID straps
10
*
11
* RAMID1 - Single/Dual channel configuration
12
* 0 - Dual channel, 1 - Single channel
13
*
14
* Combination of RAMID3, RAMID2, RAMID0 - Index of SPD table
15
* Index 0 - Samsung K4E8E304EE-EGCE 1600MHz 23nm
16
* Index 1 - Samsung K4E8E324EB-EGCF 1866MHz 20nm
17
*/
18
19
uint8_t
get_ramid
(
void
)
20
{
21
gpio_t
spd_gpios[] = {
22
GP_SW_80
,
/* SATA_GP3,RAMID0 */
23
GP_SE_02
,
/* MF_PLT_CLK1, RAMID2 */
24
GP_SW_64
,
/* I2C3_SDA RAMID3 */
25
GP_SW_67
,
/* I2C3_SCL,RAMID1 */
26
};
27
28
return
gpio_base2_value
(spd_gpios,
ARRAY_SIZE
(spd_gpios));
29
}
30
31
int
get_variant_spd_index
(
int
ram_id,
int
*dual)
32
{
33
int
spd_index
= ram_id & 0x7;
34
35
/* Determine if single or dual channel memory system */
36
/* RAMID3 is deterministic for celes */
37
*dual = ((ram_id >> 3) & 0x1) ? 0 : 1;
38
39
/* Display the RAM type */
40
printk
(
BIOS_DEBUG
, *dual ?
"4GiB "
:
"2GiB "
);
41
switch
(
spd_index
) {
42
case
0:
43
printk
(
BIOS_DEBUG
,
"Samsung K4E8E304EE-EGCE\n"
);
44
break
;
45
case
1:
46
printk
(
BIOS_DEBUG
,
"Samsung K4E8E324EB-EGCF\n"
);
47
break
;
48
}
49
50
return
spd_index
;
51
}
ARRAY_SIZE
#define ARRAY_SIZE(a)
Definition:
helpers.h:12
printk
#define printk(level,...)
Definition:
stdlib.h:16
console.h
spd_util.h
get_variant_spd_index
int get_variant_spd_index(int ram_id, int *dual)
Definition:
spd_util.c:21
get_ramid
uint8_t get_ramid(void)
Definition:
spd_util.c:19
gpio_base2_value
uint32_t gpio_base2_value(const gpio_t gpio[], int num_gpio)
Definition:
gpio.c:30
BIOS_DEBUG
#define BIOS_DEBUG
BIOS_DEBUG - Verbose output.
Definition:
loglevel.h:128
spd_index
static const int spd_index[32]
Definition:
memory.c:10
GP_SW_64
#define GP_SW_64
Definition:
gpio_defs.h:43
GP_SE_02
#define GP_SE_02
Definition:
gpio_defs.h:151
GP_SW_80
#define GP_SW_80
Definition:
gpio_defs.h:52
GP_SW_67
#define GP_SW_67
Definition:
gpio_defs.h:46
uint8_t
unsigned char uint8_t
Definition:
stdint.h:8
gpio_t
Definition:
gpio_base.h:7
src
mainboard
google
cyan
variants
celes
spd_util.c
Generated by
1.9.1