blob: b7752b25cd0709193d212eb06673a870eb6faf6b [file] [log] [blame]
Andrey Petrov2e410752020-03-20 12:08:32 -07001/* SPDX-License-Identifier: GPL-2.0-only */
Andrey Petrov2e410752020-03-20 12:08:32 -07002
3#include <arch/ioapic.h>
Andrey Petrov2e410752020-03-20 12:08:32 -07004#include <console/console.h>
Marc Jones8b522db2020-10-12 11:58:46 -06005#include <console/debug.h>
Andrey Petrov2e410752020-03-20 12:08:32 -07006#include <cpu/x86/lapic.h>
7#include <device/pci.h>
Subrata Banik1366e442020-09-29 13:55:50 +05308#include <intelblocks/lpc_lib.h>
Andrey Petrov4e48ac02020-04-30 14:08:19 -07009#include <intelblocks/p2sb.h>
Jonathan Zhang3172f982020-05-28 17:53:48 -070010#include <soc/acpi.h>
Marc Jones1f500842020-10-15 14:32:51 -060011#include <soc/chip_common.h>
Andrey Petrov8670e822020-03-30 12:25:06 -070012#include <soc/cpu.h>
Andrey Petrov2e410752020-03-20 12:08:32 -070013#include <soc/ramstage.h>
Arthur Heymans0f91e9c2020-10-16 13:15:50 +020014#include <soc/p2sb.h>
Jonathan Zhang7919d612020-04-02 17:27:54 -070015#include <soc/soc_util.h>
Marc Jones5851f9d2020-11-02 15:30:10 -070016#include <soc/util.h>
Arthur Heymans0f91e9c2020-10-16 13:15:50 +020017#include <soc/pci_devs.h>
Jonathan Zhang7919d612020-04-02 17:27:54 -070018
Marc Jonesb9365ef2020-10-11 15:00:36 -060019/* UPD parameters to be initialized before SiliconInit */
Andrey Petrov2e410752020-03-20 12:08:32 -070020void platform_fsp_silicon_init_params_cb(FSPS_UPD *silupd)
21{
Marc Jonesb9365ef2020-10-11 15:00:36 -060022 mainboard_silicon_init_params(silupd);
Andrey Petrov2e410752020-03-20 12:08:32 -070023}
24
Jonathan Zhang1ba42a92020-09-21 17:14:44 -070025#if CONFIG(HAVE_ACPI_TABLES)
26static const char *soc_acpi_name(const struct device *dev)
27{
28 if (dev->path.type == DEVICE_PATH_DOMAIN)
29 return "PC00";
30 return NULL;
31}
32#endif
33
Andrey Petrov2e410752020-03-20 12:08:32 -070034static struct device_operations pci_domain_ops = {
35 .read_resources = &pci_domain_read_resources,
Marc Jones1f500842020-10-15 14:32:51 -060036 .set_resources = &xeonsp_pci_domain_set_resources,
37 .scan_bus = &xeonsp_pci_domain_scan_bus,
Jonathan Zhang1ba42a92020-09-21 17:14:44 -070038#if CONFIG(HAVE_ACPI_TABLES)
Jonathan Zhang3172f982020-05-28 17:53:48 -070039 .write_acpi_tables = &northbridge_write_acpi_tables,
Jonathan Zhang1ba42a92020-09-21 17:14:44 -070040 .acpi_name = soc_acpi_name
41#endif
Andrey Petrov2e410752020-03-20 12:08:32 -070042};
43
Andrey Petrov2e410752020-03-20 12:08:32 -070044static struct device_operations cpu_bus_ops = {
Nico Huber2f8ba692020-04-05 14:05:24 +020045 .read_resources = noop_read_resources,
46 .set_resources = noop_set_resources,
Andrey Petrov8670e822020-03-30 12:25:06 -070047 .init = cpx_init_cpus,
Jonathan Zhangc1105952020-06-03 15:55:28 -070048 .acpi_fill_ssdt = generate_cpu_entries,
Andrey Petrov2e410752020-03-20 12:08:32 -070049};
50
Andrey Petrov2e410752020-03-20 12:08:32 -070051struct pci_operations soc_pci_ops = {
52 .set_subsystem = pci_dev_set_subsystem,
53};
54
Jonathan Zhang7919d612020-04-02 17:27:54 -070055static void chip_enable_dev(struct device *dev)
56{
57 /* Set the operations if it is a special bus type */
58 if (dev->path.type == DEVICE_PATH_DOMAIN) {
59 dev->ops = &pci_domain_ops;
60 attach_iio_stacks(dev);
61 } else if (dev->path.type == DEVICE_PATH_CPU_CLUSTER) {
62 dev->ops = &cpu_bus_ops;
63 }
64}
65
Andrey Petrov2e410752020-03-20 12:08:32 -070066static void chip_final(void *data)
67{
Arthur Heymans0f91e9c2020-10-16 13:15:50 +020068 /* Lock SBI */
69 pci_or_config32(PCH_DEV_P2SB, P2SBC, SBILOCK);
Andrey Petrov4e48ac02020-04-30 14:08:19 -070070 p2sb_hide();
Jonathan Zhangbea19802020-04-13 19:34:53 -070071
72 set_bios_init_completion();
Andrey Petrov2e410752020-03-20 12:08:32 -070073}
74
75static void chip_init(void *data)
76{
77 printk(BIOS_DEBUG, "coreboot: calling fsp_silicon_init\n");
78 fsp_silicon_init(false);
Subrata Banik1366e442020-09-29 13:55:50 +053079 pch_enable_ioapic();
Andrey Petrov2e410752020-03-20 12:08:32 -070080 setup_lapic();
Andrey Petrov4e48ac02020-04-30 14:08:19 -070081 p2sb_unhide();
Andrey Petrov2e410752020-03-20 12:08:32 -070082}
83
84struct chip_operations soc_intel_xeon_sp_cpx_ops = {
85 CHIP_NAME("Intel Cooperlake-SP")
86 .enable_dev = chip_enable_dev,
87 .init = chip_init,
Jonathan Zhang7919d612020-04-02 17:27:54 -070088 .final = chip_final,
Andrey Petrov2e410752020-03-20 12:08:32 -070089};