MAINTAINERS: Add Yuchi and Vasiliy for Intel Atom Snow Ridge SoC
[coreboot.git] / src / soc / intel / jasperlake / systemagent.c
blobd2a64dddf70284e02ac422825508b3657b79e192
1 /* SPDX-License-Identifier: GPL-2.0-only */
3 #include <chip.h>
4 #include <console/console.h>
5 #include <device/device.h>
6 #include <delay.h>
7 #include <device/pci.h>
8 #include <device/pci_ops.h>
9 #include <intelblocks/systemagent.h>
10 #include <intelblocks/power_limit.h>
11 #include <soc/iomap.h>
12 #include <soc/soc_chip.h>
13 #include <soc/systemagent.h>
14 #include <static.h>
17 * SoC implementation
19 * Add all known fixed memory ranges for Host Controller/Memory
20 * controller.
22 void soc_add_fixed_mmio_resources(struct device *dev, int *index)
24 static const struct sa_mmio_descriptor soc_fixed_resources[] = {
25 { PCIEXBAR, CONFIG_ECAM_MMCONF_BASE_ADDRESS, CONFIG_ECAM_MMCONF_LENGTH,
26 "PCIEXBAR" },
27 { MCHBAR, MCH_BASE_ADDRESS, MCH_BASE_SIZE, "MCHBAR" },
28 { DMIBAR, DMI_BASE_ADDRESS, DMI_BASE_SIZE, "DMIBAR" },
29 { EPBAR, EP_BASE_ADDRESS, EP_BASE_SIZE, "EPBAR" },
30 { REGBAR, REG_BASE_ADDRESS, REG_BASE_SIZE, "REGBAR" },
31 { EDRAMBAR, EDRAM_BASE_ADDRESS, EDRAM_BASE_SIZE, "EDRAMBAR" },
34 sa_add_fixed_mmio_resources(dev, index, soc_fixed_resources,
35 ARRAY_SIZE(soc_fixed_resources));
37 /* Add Vt-d resources if VT-d is enabled */
38 if ((pci_read_config32(dev, CAPID0_A) & VTD_DISABLE))
39 return;
41 sa_add_fixed_mmio_resources(dev, index, soc_vtd_resources,
42 ARRAY_SIZE(soc_vtd_resources));
46 * SoC implementation
48 * Perform System Agent Initialization during Ramstage phase.
50 void soc_systemagent_init(struct device *dev)
52 struct soc_power_limits_config *soc_config;
53 config_t *config;
54 uint16_t sa_pci_id;
55 uint8_t tdp;
56 size_t i = 0;
58 /* Enable Power Aware Interrupt Routing */
59 enable_power_aware_intr();
61 /* Enable BIOS Reset CPL */
62 enable_bios_reset_cpl();
64 mdelay(1);
65 config = config_of_soc();
67 /* Get System Agent PCI ID */
68 sa_pci_id = dev ? pci_read_config16(dev, PCI_DEVICE_ID) : 0xFFFF;
70 if (sa_pci_id != 0xFFFF) {
71 tdp = get_cpu_tdp();
73 /* Choose power limits configuration based on the CPU SA PCI ID and
74 * CPU TDP value. */
75 for (i = 0; i < ARRAY_SIZE(cpuid_to_jsl); i++) {
76 if (sa_pci_id == cpuid_to_jsl[i].pci_did &&
77 tdp == cpuid_to_jsl[i].cpu_tdp) {
78 soc_config = &config->power_limits_config[cpuid_to_jsl[i].limits];
79 set_power_limits(MOBILE_SKU_PL1_TIME_SEC, soc_config);
80 break;
85 if (i == ARRAY_SIZE(cpuid_to_jsl) || sa_pci_id == 0xFFFF) {
86 printk(BIOS_ERR, "unknown SA ID: 0x%4x, can't find its TDP."
87 " Skipped power limits configuration.\n",
88 sa_pci_id);
89 return;