blob: 0505ea7eff2012a4a8d6a4b44737df99989740e9 [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>
6#include <soc/acpi.h>
Marc Jones1f500842020-10-15 14:32:51 -06007#include <soc/chip_common.h>
Arthur Heymans3d802532020-11-12 21:17:56 +01008#include <soc/pch.h>
Jonathan Zhang8f895492020-01-16 11:16:45 -08009#include <soc/ramstage.h>
10#include <soc/soc_util.h>
Angel Pons91903452020-10-22 23:06:04 +020011#include <soc/util.h>
Jonathan Zhang8f895492020-01-16 11:16:45 -080012
Jonathan Zhang8f895492020-01-16 11:16:45 -080013static struct device_operations pci_domain_ops = {
14 .read_resources = &pci_domain_read_resources,
15 .set_resources = &xeonsp_pci_domain_set_resources,
16 .scan_bus = &xeonsp_pci_domain_scan_bus,
17#if CONFIG(HAVE_ACPI_TABLES)
18 .write_acpi_tables = &northbridge_write_acpi_tables,
19#endif
20};
21
22static struct device_operations cpu_bus_ops = {
Nico Huber2f8ba692020-04-05 14:05:24 +020023 .read_resources = noop_read_resources,
24 .set_resources = noop_set_resources,
Jonathan Zhang8f895492020-01-16 11:16:45 -080025 .init = xeon_sp_init_cpus,
Jonathan Zhang8f895492020-01-16 11:16:45 -080026#if CONFIG(HAVE_ACPI_TABLES)
27 /* defined in src/soc/intel/common/block/acpi/acpi.c */
Nico Huber68680dd2020-03-31 17:34:52 +020028 .acpi_fill_ssdt = generate_cpu_entries,
Jonathan Zhang8f895492020-01-16 11:16:45 -080029#endif
30};
31
Jonathan Zhang8f895492020-01-16 11:16:45 -080032static void soc_enable_dev(struct device *dev)
33{
34 /* Set the operations if it is a special bus type */
35 if (dev->path.type == DEVICE_PATH_DOMAIN) {
36 dev->ops = &pci_domain_ops;
37 attach_iio_stacks(dev);
38 } else if (dev->path.type == DEVICE_PATH_CPU_CLUSTER) {
39 dev->ops = &cpu_bus_ops;
40 }
41}
42
43static void soc_init(void *data)
44{
45 printk(BIOS_DEBUG, "coreboot: calling fsp_silicon_init\n");
46 fsp_silicon_init(false);
Arthur Heymans3d802532020-11-12 21:17:56 +010047 override_hpet_ioapic_bdf();
Jonathan Zhang8f895492020-01-16 11:16:45 -080048}
49
50static void soc_final(void *data)
51{
52 // Temp Fix - should be done by FSP, in 2S bios completion
53 // is not carried out on socket 2
54 set_bios_init_completion();
55}
56
Jonathan Zhang8f895492020-01-16 11:16:45 -080057void platform_fsp_silicon_init_params_cb(FSPS_UPD *silupd)
58{
59 const struct microcode *microcode_file;
60 size_t microcode_len;
61
Julius Werner834b3ec2020-03-04 16:52:08 -080062 microcode_file = cbfs_map("cpu_microcode_blob.bin", &microcode_len);
Jonathan Zhang8f895492020-01-16 11:16:45 -080063
64 if ((microcode_file != NULL) && (microcode_len != 0)) {
65 /* Update CPU Microcode patch base address/size */
66 silupd->FspsConfig.PcdCpuMicrocodePatchBase =
67 (uint32_t)microcode_file;
68 silupd->FspsConfig.PcdCpuMicrocodePatchSize =
69 (uint32_t)microcode_len;
70 }
71
Jonathan Zhang8f895492020-01-16 11:16:45 -080072 mainboard_silicon_init_params(silupd);
73}
74
Andrey Petrov662da6c2020-03-16 22:46:57 -070075struct chip_operations soc_intel_xeon_sp_skx_ops = {
76 CHIP_NAME("Intel Skylake-SP")
Jonathan Zhang8f895492020-01-16 11:16:45 -080077 .enable_dev = soc_enable_dev,
78 .init = soc_init,
79 .final = soc_final
80};
81
82struct pci_operations soc_pci_ops = {
83 .set_subsystem = pci_dev_set_subsystem,
84};