Patrick Georgi | ac95903 | 2020-05-05 22:49:26 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-or-later */ |
Jonathan Zhang | 8f89549 | 2020-01-16 11:16:45 -0800 | [diff] [blame] | 2 | |
| 3 | #include <cbfs.h> |
Marc Jones | 8b522db | 2020-10-12 11:58:46 -0600 | [diff] [blame] | 4 | #include <console/console.h> |
Jonathan Zhang | 8f89549 | 2020-01-16 11:16:45 -0800 | [diff] [blame] | 5 | #include <device/pci.h> |
| 6 | #include <soc/acpi.h> |
Marc Jones | 1f50084 | 2020-10-15 14:32:51 -0600 | [diff] [blame] | 7 | #include <soc/chip_common.h> |
Arthur Heymans | 3d80253 | 2020-11-12 21:17:56 +0100 | [diff] [blame] | 8 | #include <soc/pch.h> |
Jonathan Zhang | 8f89549 | 2020-01-16 11:16:45 -0800 | [diff] [blame] | 9 | #include <soc/ramstage.h> |
| 10 | #include <soc/soc_util.h> |
Angel Pons | 9190345 | 2020-10-22 23:06:04 +0200 | [diff] [blame] | 11 | #include <soc/util.h> |
Jonathan Zhang | 8f89549 | 2020-01-16 11:16:45 -0800 | [diff] [blame] | 12 | |
Jonathan Zhang | 8f89549 | 2020-01-16 11:16:45 -0800 | [diff] [blame] | 13 | static 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 | |
| 22 | static struct device_operations cpu_bus_ops = { |
Nico Huber | 2f8ba69 | 2020-04-05 14:05:24 +0200 | [diff] [blame] | 23 | .read_resources = noop_read_resources, |
| 24 | .set_resources = noop_set_resources, |
Jonathan Zhang | 8f89549 | 2020-01-16 11:16:45 -0800 | [diff] [blame] | 25 | .init = xeon_sp_init_cpus, |
Jonathan Zhang | 8f89549 | 2020-01-16 11:16:45 -0800 | [diff] [blame] | 26 | #if CONFIG(HAVE_ACPI_TABLES) |
| 27 | /* defined in src/soc/intel/common/block/acpi/acpi.c */ |
Nico Huber | 68680dd | 2020-03-31 17:34:52 +0200 | [diff] [blame] | 28 | .acpi_fill_ssdt = generate_cpu_entries, |
Jonathan Zhang | 8f89549 | 2020-01-16 11:16:45 -0800 | [diff] [blame] | 29 | #endif |
| 30 | }; |
| 31 | |
Jonathan Zhang | 8f89549 | 2020-01-16 11:16:45 -0800 | [diff] [blame] | 32 | static 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 | |
| 43 | static void soc_init(void *data) |
| 44 | { |
| 45 | printk(BIOS_DEBUG, "coreboot: calling fsp_silicon_init\n"); |
| 46 | fsp_silicon_init(false); |
Arthur Heymans | 3d80253 | 2020-11-12 21:17:56 +0100 | [diff] [blame] | 47 | override_hpet_ioapic_bdf(); |
Jonathan Zhang | 8f89549 | 2020-01-16 11:16:45 -0800 | [diff] [blame] | 48 | } |
| 49 | |
| 50 | static 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 Zhang | 8f89549 | 2020-01-16 11:16:45 -0800 | [diff] [blame] | 57 | void platform_fsp_silicon_init_params_cb(FSPS_UPD *silupd) |
| 58 | { |
| 59 | const struct microcode *microcode_file; |
| 60 | size_t microcode_len; |
| 61 | |
Julius Werner | 834b3ec | 2020-03-04 16:52:08 -0800 | [diff] [blame^] | 62 | microcode_file = cbfs_map("cpu_microcode_blob.bin", µcode_len); |
Jonathan Zhang | 8f89549 | 2020-01-16 11:16:45 -0800 | [diff] [blame] | 63 | |
| 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 Zhang | 8f89549 | 2020-01-16 11:16:45 -0800 | [diff] [blame] | 72 | mainboard_silicon_init_params(silupd); |
| 73 | } |
| 74 | |
Andrey Petrov | 662da6c | 2020-03-16 22:46:57 -0700 | [diff] [blame] | 75 | struct chip_operations soc_intel_xeon_sp_skx_ops = { |
| 76 | CHIP_NAME("Intel Skylake-SP") |
Jonathan Zhang | 8f89549 | 2020-01-16 11:16:45 -0800 | [diff] [blame] | 77 | .enable_dev = soc_enable_dev, |
| 78 | .init = soc_init, |
| 79 | .final = soc_final |
| 80 | }; |
| 81 | |
| 82 | struct pci_operations soc_pci_ops = { |
| 83 | .set_subsystem = pci_dev_set_subsystem, |
| 84 | }; |