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> |
Marc Jones | e3b18bf | 2021-01-25 12:23:23 -0700 | [diff] [blame] | 6 | #include <intelblocks/acpi.h> |
Michael Niewöhner | 8913b78 | 2020-12-11 22:13:44 +0100 | [diff] [blame] | 7 | #include <intelblocks/gpio.h> |
Jonathan Zhang | 8f89549 | 2020-01-16 11:16:45 -0800 | [diff] [blame] | 8 | #include <soc/acpi.h> |
Marc Jones | 1f50084 | 2020-10-15 14:32:51 -0600 | [diff] [blame] | 9 | #include <soc/chip_common.h> |
Arthur Heymans | 3d80253 | 2020-11-12 21:17:56 +0100 | [diff] [blame] | 10 | #include <soc/pch.h> |
Tim Chu | 13c4445 | 2022-11-25 10:31:00 +0000 | [diff] [blame^] | 11 | #include <soc/soc_pch.h> |
Jonathan Zhang | 8f89549 | 2020-01-16 11:16:45 -0800 | [diff] [blame] | 12 | #include <soc/ramstage.h> |
| 13 | #include <soc/soc_util.h> |
Angel Pons | 9190345 | 2020-10-22 23:06:04 +0200 | [diff] [blame] | 14 | #include <soc/util.h> |
Jonathan Zhang | 8f89549 | 2020-01-16 11:16:45 -0800 | [diff] [blame] | 15 | |
Marc Jones | e3b18bf | 2021-01-25 12:23:23 -0700 | [diff] [blame] | 16 | #if CONFIG(HAVE_ACPI_TABLES) |
| 17 | const 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 Zhang | 8f89549 | 2020-01-16 11:16:45 -0800 | [diff] [blame] | 25 | static struct device_operations pci_domain_ops = { |
| 26 | .read_resources = &pci_domain_read_resources, |
| 27 | .set_resources = &xeonsp_pci_domain_set_resources, |
| 28 | .scan_bus = &xeonsp_pci_domain_scan_bus, |
| 29 | #if CONFIG(HAVE_ACPI_TABLES) |
| 30 | .write_acpi_tables = &northbridge_write_acpi_tables, |
Marc Jones | e3b18bf | 2021-01-25 12:23:23 -0700 | [diff] [blame] | 31 | #if CONFIG(HAVE_ACPI_TABLES) |
| 32 | .acpi_name = soc_acpi_name |
| 33 | #endif |
Jonathan Zhang | 8f89549 | 2020-01-16 11:16:45 -0800 | [diff] [blame] | 34 | #endif |
| 35 | }; |
| 36 | |
| 37 | static struct device_operations cpu_bus_ops = { |
Nico Huber | 2f8ba69 | 2020-04-05 14:05:24 +0200 | [diff] [blame] | 38 | .read_resources = noop_read_resources, |
| 39 | .set_resources = noop_set_resources, |
Jonathan Zhang | 8f89549 | 2020-01-16 11:16:45 -0800 | [diff] [blame] | 40 | .init = xeon_sp_init_cpus, |
Jonathan Zhang | 8f89549 | 2020-01-16 11:16:45 -0800 | [diff] [blame] | 41 | #if CONFIG(HAVE_ACPI_TABLES) |
| 42 | /* defined in src/soc/intel/common/block/acpi/acpi.c */ |
Nico Huber | 68680dd | 2020-03-31 17:34:52 +0200 | [diff] [blame] | 43 | .acpi_fill_ssdt = generate_cpu_entries, |
Jonathan Zhang | 8f89549 | 2020-01-16 11:16:45 -0800 | [diff] [blame] | 44 | #endif |
| 45 | }; |
| 46 | |
Jonathan Zhang | 8f89549 | 2020-01-16 11:16:45 -0800 | [diff] [blame] | 47 | static void soc_enable_dev(struct device *dev) |
| 48 | { |
| 49 | /* Set the operations if it is a special bus type */ |
| 50 | if (dev->path.type == DEVICE_PATH_DOMAIN) { |
| 51 | dev->ops = &pci_domain_ops; |
| 52 | attach_iio_stacks(dev); |
| 53 | } else if (dev->path.type == DEVICE_PATH_CPU_CLUSTER) { |
| 54 | dev->ops = &cpu_bus_ops; |
Michael Niewöhner | 8913b78 | 2020-12-11 22:13:44 +0100 | [diff] [blame] | 55 | } else if (dev->path.type == DEVICE_PATH_GPIO) { |
| 56 | block_gpio_enable(dev); |
Jonathan Zhang | 8f89549 | 2020-01-16 11:16:45 -0800 | [diff] [blame] | 57 | } |
| 58 | } |
| 59 | |
| 60 | static void soc_init(void *data) |
| 61 | { |
| 62 | printk(BIOS_DEBUG, "coreboot: calling fsp_silicon_init\n"); |
Kyösti Mälkki | cc93c6e | 2021-01-09 22:53:52 +0200 | [diff] [blame] | 63 | fsp_silicon_init(); |
Arthur Heymans | 3d80253 | 2020-11-12 21:17:56 +0100 | [diff] [blame] | 64 | override_hpet_ioapic_bdf(); |
Arthur Heymans | 8346307 | 2020-12-16 11:30:40 +0100 | [diff] [blame] | 65 | pch_lock_dmictl(); |
Jonathan Zhang | 8f89549 | 2020-01-16 11:16:45 -0800 | [diff] [blame] | 66 | } |
| 67 | |
| 68 | static void soc_final(void *data) |
| 69 | { |
| 70 | // Temp Fix - should be done by FSP, in 2S bios completion |
| 71 | // is not carried out on socket 2 |
| 72 | set_bios_init_completion(); |
| 73 | } |
| 74 | |
Jonathan Zhang | 8f89549 | 2020-01-16 11:16:45 -0800 | [diff] [blame] | 75 | void platform_fsp_silicon_init_params_cb(FSPS_UPD *silupd) |
| 76 | { |
| 77 | const struct microcode *microcode_file; |
| 78 | size_t microcode_len; |
| 79 | |
Julius Werner | 834b3ec | 2020-03-04 16:52:08 -0800 | [diff] [blame] | 80 | microcode_file = cbfs_map("cpu_microcode_blob.bin", µcode_len); |
Jonathan Zhang | 8f89549 | 2020-01-16 11:16:45 -0800 | [diff] [blame] | 81 | |
Elyes Haouas | f1ba7d6 | 2022-09-13 10:03:44 +0200 | [diff] [blame] | 82 | if ((microcode_file) && (microcode_len != 0)) { |
Jonathan Zhang | 8f89549 | 2020-01-16 11:16:45 -0800 | [diff] [blame] | 83 | /* Update CPU Microcode patch base address/size */ |
| 84 | silupd->FspsConfig.PcdCpuMicrocodePatchBase = |
| 85 | (uint32_t)microcode_file; |
| 86 | silupd->FspsConfig.PcdCpuMicrocodePatchSize = |
| 87 | (uint32_t)microcode_len; |
| 88 | } |
| 89 | |
Jonathan Zhang | 8f89549 | 2020-01-16 11:16:45 -0800 | [diff] [blame] | 90 | mainboard_silicon_init_params(silupd); |
| 91 | } |
| 92 | |
Andrey Petrov | 662da6c | 2020-03-16 22:46:57 -0700 | [diff] [blame] | 93 | struct chip_operations soc_intel_xeon_sp_skx_ops = { |
| 94 | CHIP_NAME("Intel Skylake-SP") |
Jonathan Zhang | 8f89549 | 2020-01-16 11:16:45 -0800 | [diff] [blame] | 95 | .enable_dev = soc_enable_dev, |
| 96 | .init = soc_init, |
| 97 | .final = soc_final |
| 98 | }; |
| 99 | |
| 100 | struct pci_operations soc_pci_ops = { |
| 101 | .set_subsystem = pci_dev_set_subsystem, |
| 102 | }; |