blob: b468842e9202b7fd013efe29b5c4907199ca4896 [file] [log] [blame]
Patrick Georgiac959032020-05-05 22:49:26 +02001/* SPDX-License-Identifier: GPL-2.0-or-later */
Jonathan Zhang8f895492020-01-16 11:16:45 -08002
3#include <cbfs.h>
Marc Jones8b522db2020-10-12 11:58:46 -06004#include <console/console.h>
Jonathan Zhang8f895492020-01-16 11:16:45 -08005#include <device/pci.h>
Dinesh Gehlot6fecff22023-01-17 06:02:16 +00006#include <gpio.h>
Marc Jonese3b18bf2021-01-25 12:23:23 -07007#include <intelblocks/acpi.h>
Jonathan Zhang8f895492020-01-16 11:16:45 -08008#include <soc/acpi.h>
Marc Jones1f500842020-10-15 14:32:51 -06009#include <soc/chip_common.h>
Arthur Heymans3d802532020-11-12 21:17:56 +010010#include <soc/pch.h>
Tim Chu13c44452022-11-25 10:31:00 +000011#include <soc/soc_pch.h>
Jonathan Zhang8f895492020-01-16 11:16:45 -080012#include <soc/ramstage.h>
13#include <soc/soc_util.h>
Angel Pons91903452020-10-22 23:06:04 +020014#include <soc/util.h>
Jonathan Zhang8f895492020-01-16 11:16:45 -080015
Marc Jonese3b18bf2021-01-25 12:23:23 -070016#if CONFIG(HAVE_ACPI_TABLES)
17const char *soc_acpi_name(const struct device *dev)
18{
19 if (dev->path.type == DEVICE_PATH_DOMAIN)
20 return "PC00";
21 return NULL;
22}
23#endif
24
Jonathan Zhang8f895492020-01-16 11:16:45 -080025static struct device_operations pci_domain_ops = {
Arthur Heymans550f55e2022-08-24 14:44:26 +020026 .read_resources = iio_pci_domain_read_resources,
27 .set_resources = pci_domain_set_resources,
28 .scan_bus = iio_pci_domain_scan_bus,
Jonathan Zhang8f895492020-01-16 11:16:45 -080029#if CONFIG(HAVE_ACPI_TABLES)
30 .write_acpi_tables = &northbridge_write_acpi_tables,
Marc Jonese3b18bf2021-01-25 12:23:23 -070031 .acpi_name = soc_acpi_name
32#endif
Jonathan Zhang8f895492020-01-16 11:16:45 -080033};
34
35static struct device_operations cpu_bus_ops = {
Nico Huber2f8ba692020-04-05 14:05:24 +020036 .read_resources = noop_read_resources,
37 .set_resources = noop_set_resources,
Arthur Heymans829e8e62023-01-30 19:09:34 +010038 .init = mp_cpu_bus_init,
Jonathan Zhang8f895492020-01-16 11:16:45 -080039#if CONFIG(HAVE_ACPI_TABLES)
40 /* defined in src/soc/intel/common/block/acpi/acpi.c */
Nico Huber68680dd2020-03-31 17:34:52 +020041 .acpi_fill_ssdt = generate_cpu_entries,
Jonathan Zhang8f895492020-01-16 11:16:45 -080042#endif
43};
44
Jonathan Zhang8f895492020-01-16 11:16:45 -080045static void soc_enable_dev(struct device *dev)
46{
47 /* Set the operations if it is a special bus type */
48 if (dev->path.type == DEVICE_PATH_DOMAIN) {
49 dev->ops = &pci_domain_ops;
50 attach_iio_stacks(dev);
51 } else if (dev->path.type == DEVICE_PATH_CPU_CLUSTER) {
52 dev->ops = &cpu_bus_ops;
Michael Niewöhner8913b782020-12-11 22:13:44 +010053 } else if (dev->path.type == DEVICE_PATH_GPIO) {
54 block_gpio_enable(dev);
Jonathan Zhang8f895492020-01-16 11:16:45 -080055 }
56}
57
58static void soc_init(void *data)
59{
60 printk(BIOS_DEBUG, "coreboot: calling fsp_silicon_init\n");
Kyösti Mälkkicc93c6e2021-01-09 22:53:52 +020061 fsp_silicon_init();
Arthur Heymans3d802532020-11-12 21:17:56 +010062 override_hpet_ioapic_bdf();
Arthur Heymans83463072020-12-16 11:30:40 +010063 pch_lock_dmictl();
Jonathan Zhang8f895492020-01-16 11:16:45 -080064}
65
66static void soc_final(void *data)
67{
68 // Temp Fix - should be done by FSP, in 2S bios completion
69 // is not carried out on socket 2
70 set_bios_init_completion();
71}
72
Jonathan Zhang8f895492020-01-16 11:16:45 -080073void platform_fsp_silicon_init_params_cb(FSPS_UPD *silupd)
74{
75 const struct microcode *microcode_file;
76 size_t microcode_len;
77
Julius Werner834b3ec2020-03-04 16:52:08 -080078 microcode_file = cbfs_map("cpu_microcode_blob.bin", &microcode_len);
Jonathan Zhang8f895492020-01-16 11:16:45 -080079
Elyes Haouasf1ba7d62022-09-13 10:03:44 +020080 if ((microcode_file) && (microcode_len != 0)) {
Jonathan Zhang8f895492020-01-16 11:16:45 -080081 /* Update CPU Microcode patch base address/size */
82 silupd->FspsConfig.PcdCpuMicrocodePatchBase =
83 (uint32_t)microcode_file;
84 silupd->FspsConfig.PcdCpuMicrocodePatchSize =
85 (uint32_t)microcode_len;
86 }
87
Jonathan Zhang8f895492020-01-16 11:16:45 -080088 mainboard_silicon_init_params(silupd);
89}
90
Andrey Petrov662da6c2020-03-16 22:46:57 -070091struct chip_operations soc_intel_xeon_sp_skx_ops = {
92 CHIP_NAME("Intel Skylake-SP")
Jonathan Zhang8f895492020-01-16 11:16:45 -080093 .enable_dev = soc_enable_dev,
94 .init = soc_init,
95 .final = soc_final
96};
97
98struct pci_operations soc_pci_ops = {
99 .set_subsystem = pci_dev_set_subsystem,
100};