blob: b3bf10296a6a06df17f09d10d32c0e57774cb2ac [file] [log] [blame]
Thejaswani Puttae3443d82019-07-18 16:23:20 -07001/*
2 * This file is part of the coreboot project.
3 *
4 * Copyright 2018 Google LLC
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 2 of the License.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 */
15
16#include <arch/acpi.h>
17#include <boardid.h>
18#include <drivers/vpd/vpd.h>
19#include <smbios.h>
20#include <soc/gpio.h>
21#include <soc/ramstage.h>
22#include <variant/gpio.h>
23#include <vendorcode/google/chromeos/chromeos.h>
24
25#define VPD_KEY_SYSTEM_SERIAL "serial_number"
26#define VPD_KEY_MAINBOARD_SERIAL "mlb_serial_number"
27#define VPD_SERIAL_LEN 64
28
29const char *smbios_system_serial_number(void)
30{
31 static char serial[VPD_SERIAL_LEN];
32 if (vpd_gets(VPD_KEY_SYSTEM_SERIAL, serial, VPD_SERIAL_LEN, VPD_RO))
33 return serial;
34 return "";
35}
36
37const char *smbios_mainboard_serial_number(void)
38{
39 static char serial[VPD_SERIAL_LEN];
40 if (vpd_gets(VPD_KEY_MAINBOARD_SERIAL, serial, VPD_SERIAL_LEN, VPD_RO))
41 return serial;
42 return "";
43}
44
45/* mainboard silk screen shows DIMM-A and DIMM-B */
46void smbios_fill_dimm_locator(const struct dimm_info *dimm,
47 struct smbios_type17 *t)
48{
49 switch (dimm->channel_num) {
50 case 0:
51 t->device_locator = smbios_add_string(t->eos, "DIMM-A");
52 break;
53 case 1:
54 t->device_locator = smbios_add_string(t->eos, "DIMM-B");
55 break;
56 default:
57 t->device_locator = smbios_add_string(t->eos, "UNKNOWN");
58 break;
59 }
60}
61
62static const struct pad_config gpio_unused[] = {
63/* SUSWARN# */ PAD_NC(GPP_A13, NONE),
64/* SUSACK# */ PAD_NC(GPP_A15, NONE),
65/* M2_SKT2_CFG0 */ PAD_NC(GPP_H12, NONE),
66/* M2_SKT2_CFG1 */ PAD_NC(GPP_H13, NONE),
67};
68
69void mainboard_silicon_init_params(FSP_S_CONFIG *params)
70{
71 const struct pad_config *gpio_table;
72 size_t num_gpios;
73
74 gpio_table = variant_gpio_table(&num_gpios);
75 cnl_configure_pads(gpio_table, num_gpios);
76
77 /* Disable unused pads for devices with board ID > 2 */
78 if (board_id() > 2)
79 gpio_configure_pads(gpio_unused, ARRAY_SIZE(gpio_unused));
80}
81
82static void mainboard_enable(struct device *dev)
83{
84 dev->ops->acpi_inject_dsdt_generator = chromeos_dsdt_generator;
85}
86
87struct chip_operations mainboard_ops = {
88 .enable_dev = mainboard_enable,
89};