payloads/edk2: Disable the CPU Timer Lib unless supported
[coreboot.git] / src / mainboard / lenovo / x1_carbon_gen1 / early_init.c
blob6f18feee9182d7be5ac0bb669a6a359036aeac6b
1 /* SPDX-License-Identifier: GPL-2.0-only */
3 #include <stdint.h>
4 #include <string.h>
5 #include <console/console.h>
6 #include <northbridge/intel/sandybridge/raminit_native.h>
7 #include <southbridge/intel/bd82x6x/pch.h>
8 #include <southbridge/intel/common/gpio.h>
9 #include <cbfs.h>
11 const struct southbridge_usb_port mainboard_usb_ports[] = {
12 /* enabled, current, OC pin */
13 { 0, 3, 0 }, /* P00 disconnected */
14 { 1, 1, 1 }, /* P01 left or right */
15 { 0, 1, 3 }, /* P02 disconnected */
16 { 1, 3, -1 },/* P03 WWAN */
17 { 0, 1, 2 }, /* P04 disconnected */
18 { 0, 1, -1 },/* P05 disconnected */
19 { 0, 1, -1 },/* P06 disconnected */
20 { 0, 2, -1 },/* P07 disconnected */
21 { 0, 1, -1 },/* P08 disconnected */
22 { 1, 2, 5 }, /* P09 left or right */
23 { 1, 3, -1 },/* P10 FPR */
24 { 1, 3, -1 },/* P11 Bluetooth */
25 { 1, 1, -1 },/* P12 WLAN */
26 { 1, 1, -1 },/* P13 Camera */
29 static uint8_t *get_spd_data(int spd_index)
31 uint8_t *spd_file;
32 size_t spd_file_len;
34 printk(BIOS_DEBUG, "spd index %d\n", spd_index);
35 spd_file = cbfs_map("spd.bin", &spd_file_len);
36 if (!spd_file)
37 die("SPD data not found.");
39 if (spd_file_len < spd_index * 256)
40 die("Missing SPD data.");
42 return spd_file + spd_index * 256;
45 void mainboard_get_spd(spd_raw_data *spd, bool id_only)
47 uint8_t *memory;
48 const int spd_gpio_vector[] = {25, 45, -1};
49 int spd_index = get_gpios(spd_gpio_vector);
51 /* 4gb model = 0, 8gb model = 1 */
52 /* int extended_memory_version = get_gpio(44); */
55 * So far there is no need to parse gpio 44, as the 4GiB use
56 * the hynix or elpida memory and 8 GiB versions use samsung.
57 * All version use both channels.
58 * But we might miss some versions.
62 * GPIO45 GPIO25
63 * 0 0 elpida
64 * 0 1 hynix
65 * 1 0 samsung
66 * 1 1 reserved
69 if (spd_index == 3)
70 die("Unsupported Memory. (detected 'reserved' memory configuration).");
72 memory = get_spd_data(spd_index);
73 memcpy(&spd[0], memory, 256);
74 memcpy(&spd[2], memory, 256);