aboutsummaryrefslogtreecommitdiff
path: root/src/mainboard/ocp/tiogapass/ramstage.c
blob: 29148d14eca329bed6ae069b964dd54f808be2bf (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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
/* SPDX-License-Identifier: GPL-2.0-or-later */

#include <bootstate.h>
#include <drivers/ipmi/ipmi_ops.h>
#include <drivers/ocp/dmi/ocp_dmi.h>
#include <gpio.h>
#include <soc/ramstage.h>
#include <soc/lewisburg_pch_gpio_defs.h>

#include "ipmi.h"

extern struct fru_info_str fru_strings;

static const struct port_information SMBIOS_type8_info[] = {
	/*
	* Port Information fields:
	*	Internal Reference Designator,
	*	Internal Connector Type,
	*	External Reference Designator,
	*	External Connector_Type,
	*	Port Type
	*/
	{
		"J7F5 - BMC JTAG HEADER",
		CONN_OTHER,
		NULL,
		CONN_NONE,
		TYPE_OTHER_PORT
	},
	{
		"J8A1 - MINISAS1",
		CONN_SAS_SATA,
		NULL,
		CONN_NONE,
		TYPE_SAS
	},
	{
		"J8A2 - MINISAS2",
		CONN_SAS_SATA,
		NULL,
		CONN_NONE,
		TYPE_SAS
	},
	{
		"J8A3 - SATA CONBINE1",
		CONN_SAS_SATA,
		NULL,
		CONN_NONE,
		TYPE_SAS
	},
	{
		"J8B1 - ME_DBG",
		CONN_OTHER,
		NULL,
		CONN_NONE,
		TYPE_OTHER_PORT
	},
	{
		"J8D1 - VR_DBG",
		CONN_OTHER,
		NULL,
		CONN_NONE,
		TYPE_OTHER_PORT
	},
	{
		"J8E1 - TPM_MODULE",
		CONN_OTHER,
		NULL,
		CONN_NONE,
		TYPE_OTHER_PORT
	},
	{
		"J8F1 - M.2 CONNECTOR",
		CONN_OTHER,
		NULL,
		CONN_NONE,
		TYPE_OTHER_PORT
	},
	{
		"J9A1 - SATA RAID KEY",
		CONN_OTHER,
		NULL,
		CONN_NONE,
		TYPE_OTHER_PORT
	},
	{
		NULL,
		CONN_NONE,
		"J9A2 - DEBUG 80 PORT",
		CONN_OTHER,
		TYPE_OTHER_PORT
	},
	{
		"J9A3 - CPU & PCH XDP",
		CONN_OTHER,
		NULL,
		CONN_NONE,
		TYPE_OTHER_PORT
	},
	{
		NULL,
		CONN_NONE,
		"J9A5 - USB conn",
		CONN_ACCESS_BUS_USB,
		TYPE_USB
	},
	{
		"J9B1 - BMC_DBG",
		CONN_OTHER,
		NULL,
		CONN_NONE,
		TYPE_OTHER_PORT
	},
	{
		NULL,
		CONN_NONE,
		"J9D1 - USB3.0 TYPE C",
		CONN_ACCESS_BUS_USB,
		TYPE_USB
	},
	{
		NULL,
		CONN_NONE,
		"J9E1 - VGA",
		CONN_OTHER,
		TYPE_OTHER_PORT
	},
	{
		NULL,
		CONN_NONE,
		"JA9G1 - ETH0",
		CONN_RJ_45,
		TYPE_NETWORK_PORT
	},
};

void mainboard_silicon_init_params(FSPS_UPD *params)
{
}

static void pull_post_complete_pin(void *unused)
{
	/* Pull Low post complete pin */
	gpio_output(GPP_B20, 0);
}

#if CONFIG(GENERATE_SMBIOS_TABLES)
static int mainboard_smbios_data(struct device *dev, int *handle, unsigned long *current)
{
	int len = 0;

	// add port information
	len += smbios_write_type8(
		current, handle,
		SMBIOS_type8_info,
		ARRAY_SIZE(SMBIOS_type8_info)
		);

	return len;
}
#endif

static void tp_oem_smbios_strings(struct device *dev, struct smbios_type11 *t)
{
	/* OEM string 1 to 6 */
	ocp_oem_smbios_strings(dev, t);

	/* OEM string 7 */
	if (fru_strings.board_info.custom_count > 1 &&
			*(fru_strings.board_info.board_custom + 1) != NULL)
		t->count = smbios_add_oem_string(t->eos,
			*(fru_strings.board_info.board_custom + 1));
	else
		t->count = smbios_add_oem_string(t->eos, TBF);
}

static void mainboard_enable(struct device *dev)
{
	dev->ops->get_smbios_strings = tp_oem_smbios_strings,
	read_fru_areas(CONFIG_BMC_KCS_BASE, CONFIG_FRU_DEVICE_ID, 0, &fru_strings);
#if CONFIG(GENERATE_SMBIOS_TABLES)
	dev->ops->get_smbios_data = mainboard_smbios_data;
#endif
}

static void mainboard_final(void *chip_info)
{
	struct ppin_req req;

	req.cpu0_lo = xeon_sp_ppin[0].lo;
	req.cpu0_hi = xeon_sp_ppin[0].hi;
	req.cpu1_lo = xeon_sp_ppin[1].lo;
	req.cpu1_hi = xeon_sp_ppin[1].hi;
	/* Set PPIN to BMC */
	ipmi_set_ppin(&req);
}

struct chip_operations mainboard_ops = {
	.enable_dev = mainboard_enable,
	.final = mainboard_final,
};

BOOT_STATE_INIT_ENTRY(BS_PAYLOAD_BOOT, BS_ON_ENTRY, pull_post_complete_pin, NULL);