summaryrefslogtreecommitdiffstats
path: root/src/mainboard/scaleway/tagada/ramstage.c
blob: d0250e9fe7d1ab085b37dea0b3633320b88313c0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
/* SPDX-License-Identifier: GPL-2.0-only */
/* This file is part of the coreboot project. */

#include <string.h>
#include <fsp/api.h>
#include <soc/ramstage.h>
#include <smbios.h>
#include <spd.h>

#include "bmcinfo.h"

void mainboard_silicon_init_params(FSPS_UPD *params)
{
	/* Disable eMMC */
	params->FspsConfig.PcdEnableEmmc = 0;

	if (bmcinfo_disable_nic1())
		params->FspsConfig.PcdEnableGbE = 2; // disable lan 1 only
}

/* Override smbios_mainboard_serial_number to retrieve it from BMC */
const char *smbios_mainboard_serial_number(void)
{
	const char *bmc_serial = bmcinfo_serial();
	if (bmc_serial)
		return bmc_serial;
	return CONFIG_MAINBOARD_SERIAL_NUMBER;
}

/* Override smbios_system_set_uuid */
void smbios_system_set_uuid(u8 *uuid)
{
	const u8 *bmc_uuid = bmcinfo_uuid();
	if (bmc_uuid)
		memcpy(uuid, bmc_uuid, 16);
	/* leave all zero */
}

/* Override smbios_mainboard_version */
const char *smbios_mainboard_version(void)
{
	const int hwRev = bmcinfo_hwrev();
	switch (hwRev) {
	case 0:
		return "Z0";
	case 1:
		return "A0";
	case 2:
		return "A1";
	}
	return "";
}

/* Override smbios_mainboard_features_flags */
u8 smbios_mainboard_feature_flags(void)
{
	return 0xc;
}

/* Override smbios_mainboard_location_in_chassis */
const char *smbios_mainboard_location_in_chassis(void)
{
	static char location[4] = "n/a";
	int slot = bmcinfo_slot();
	if (slot >= 0)
		snprintf(location, 4, "N%d", slot);
	return location;
}

/* Override smbios_mainboard_board_type */
smbios_board_type smbios_mainboard_board_type(void)
{
	return SMBIOS_BOARD_TYPE_SERVER_BLADE;
}

/* Add any mainboard specific information for dimm */
void mainboard_add_dimm_info(
	struct memory_info *mem_info,
	int channel, int dimm, int index)
{
	/* Mainboard only has DDR4 DIMM slots */
	mem_info->dimm[index].mod_type = SPD_UDIMM;
}