1 /* SPDX-License-Identifier: GPL-2.0-only */
4 * This file is created based on Intel Tiger Lake Processor SA Datasheet
5 * Document number: 571131
9 #include <console/console.h>
10 #include <device/device.h>
12 #include <device/pci.h>
13 #include <device/pci_ids.h>
14 #include <device/pci_ops.h>
15 #include <intelblocks/power_limit.h>
16 #include <intelblocks/systemagent.h>
17 #include <soc/iomap.h>
18 #include <soc/soc_chip.h>
19 #include <soc/systemagent.h>
24 * Add all known fixed memory ranges for Host Controller/Memory
27 void soc_add_fixed_mmio_resources(struct device
*dev
, int *index
)
29 static const struct sa_mmio_descriptor soc_fixed_resources
[] = {
30 { PCIEXBAR
, CONFIG_ECAM_MMCONF_BASE_ADDRESS
, CONFIG_ECAM_MMCONF_LENGTH
,
32 { MCHBAR
, MCH_BASE_ADDRESS
, MCH_BASE_SIZE
, "MCHBAR" },
33 { DMIBAR
, DMI_BASE_ADDRESS
, DMI_BASE_SIZE
, "DMIBAR" },
34 { EPBAR
, EP_BASE_ADDRESS
, EP_BASE_SIZE
, "EPBAR" },
35 { REGBAR
, REG_BASE_ADDRESS
, REG_BASE_SIZE
, "REGBAR" },
36 { EDRAMBAR
, EDRAM_BASE_ADDRESS
, EDRAM_BASE_SIZE
, "EDRAMBAR" },
39 sa_add_fixed_mmio_resources(dev
, index
, soc_fixed_resources
,
40 ARRAY_SIZE(soc_fixed_resources
));
42 /* Add Vt-d resources if VT-d is enabled */
43 if ((pci_read_config32(dev
, CAPID0_A
) & VTD_DISABLE
))
46 sa_add_fixed_mmio_resources(dev
, index
, soc_vtd_resources
,
47 ARRAY_SIZE(soc_vtd_resources
));
53 * Perform System Agent Initialization during Ramstage phase.
55 void soc_systemagent_init(struct device
*dev
)
57 struct soc_power_limits_config
*soc_config
;
62 /* Get System Agent PCI ID */
63 sa
= pcidev_path_on_root(SA_DEVFN_ROOT
);
64 sa_pci_id
= sa
? pci_read_config16(sa
, PCI_DEVICE_ID
) : 0xFFFF;
66 /* Enable Power Aware Interrupt Routing */
67 enable_power_aware_intr();
69 /* Enable BIOS Reset CPL */
70 enable_bios_reset_cpl();
72 /* Configure turbo power limits 1ms after reset complete bit */
74 config
= config_of_soc();
77 * Choose a power limits configuration based on the SoC SKU,
78 * differentiated here based on SA PCI ID.
81 case PCI_DID_INTEL_TGL_ID_U_2_2
:
82 soc_config
= &config
->power_limits_config
[POWER_LIMITS_U_2_CORE
];
84 case PCI_DID_INTEL_TGL_ID_U_4_2
:
85 soc_config
= &config
->power_limits_config
[POWER_LIMITS_U_4_CORE
];
87 case PCI_DID_INTEL_TGL_ID_Y_2_2
:
88 soc_config
= &config
->power_limits_config
[POWER_LIMITS_Y_2_CORE
];
90 case PCI_DID_INTEL_TGL_ID_Y_4_2
:
91 soc_config
= &config
->power_limits_config
[POWER_LIMITS_Y_4_CORE
];
93 case PCI_DID_INTEL_TGL_ID_H_6_1
:
94 soc_config
= &config
->power_limits_config
[POWER_LIMITS_H_6_CORE
];
96 case PCI_DID_INTEL_TGL_ID_H_8_1
:
97 soc_config
= &config
->power_limits_config
[POWER_LIMITS_H_8_CORE
];
100 printk(BIOS_ERR
, "TGL: unknown SA ID: 0x%4x, skipping power limits "
101 "configuration\n", sa_pci_id
);
105 set_power_limits(MOBILE_SKU_PL1_TIME_SEC
, soc_config
);
108 uint32_t soc_systemagent_max_chan_capacity_mib(u8 capid0_a_ddrsz
)
110 switch (capid0_a_ddrsz
) {