blob: fd04be589ff6547c9e21f4f55db8203eb98fff3e [file] [log] [blame]
Angel Ponsfabfe9d2020-04-05 15:47:07 +02001/* SPDX-License-Identifier: GPL-2.0-only */
Aamir Bohradd7acaa2020-03-25 11:36:22 +05302
Aamir Bohradd7acaa2020-03-25 11:36:22 +05303#include <device/device.h>
Sumeet R Pawnikard8b4ea92020-05-26 19:59:45 +05304#include <delay.h>
Aamir Bohradd7acaa2020-03-25 11:36:22 +05305#include <device/pci.h>
6#include <device/pci_ops.h>
7#include <intelblocks/systemagent.h>
Sumeet R Pawnikard8b4ea92020-05-26 19:59:45 +05308#include <intelblocks/power_limit.h>
Aamir Bohradd7acaa2020-03-25 11:36:22 +05309#include <soc/iomap.h>
Sumeet R Pawnikard8b4ea92020-05-26 19:59:45 +053010#include <soc/soc_chip.h>
Aamir Bohradd7acaa2020-03-25 11:36:22 +053011#include <soc/systemagent.h>
12
13/*
14 * SoC implementation
15 *
16 * Add all known fixed memory ranges for Host Controller/Memory
17 * controller.
18 */
19void soc_add_fixed_mmio_resources(struct device *dev, int *index)
20{
21 static const struct sa_mmio_descriptor soc_fixed_resources[] = {
Shelley Chen4e9bb332021-10-20 15:43:45 -070022 { PCIEXBAR, CONFIG_ECAM_MMCONF_BASE_ADDRESS, CONFIG_ECAM_MMCONF_LENGTH,
Aamir Bohradd7acaa2020-03-25 11:36:22 +053023 "PCIEXBAR" },
24 { MCHBAR, MCH_BASE_ADDRESS, MCH_BASE_SIZE, "MCHBAR" },
25 { DMIBAR, DMI_BASE_ADDRESS, DMI_BASE_SIZE, "DMIBAR" },
26 { EPBAR, EP_BASE_ADDRESS, EP_BASE_SIZE, "EPBAR" },
27 { REGBAR, REG_BASE_ADDRESS, REG_BASE_SIZE, "REGBAR" },
28 { EDRAMBAR, EDRAM_BASE_ADDRESS, EDRAM_BASE_SIZE, "EDRAMBAR" },
Aamir Bohradd7acaa2020-03-25 11:36:22 +053029 };
30
31 sa_add_fixed_mmio_resources(dev, index, soc_fixed_resources,
32 ARRAY_SIZE(soc_fixed_resources));
33
34 /* Add Vt-d resources if VT-d is enabled */
35 if ((pci_read_config32(dev, CAPID0_A) & VTD_DISABLE))
36 return;
37
38 sa_add_fixed_mmio_resources(dev, index, soc_vtd_resources,
39 ARRAY_SIZE(soc_vtd_resources));
40}
41
42/*
43 * SoC implementation
44 *
45 * Perform System Agent Initialization during Ramstage phase.
46 */
47void soc_systemagent_init(struct device *dev)
48{
Sumeet R Pawnikard8b4ea92020-05-26 19:59:45 +053049 struct soc_power_limits_config *soc_config;
50 config_t *config;
51
Aamir Bohradd7acaa2020-03-25 11:36:22 +053052 /* Enable Power Aware Interrupt Routing */
53 enable_power_aware_intr();
54
55 /* Enable BIOS Reset CPL */
56 enable_bios_reset_cpl();
Sumeet R Pawnikard8b4ea92020-05-26 19:59:45 +053057
58 mdelay(1);
59 config = config_of_soc();
60 soc_config = &config->power_limits_config;
61 set_power_limits(MOBILE_SKU_PL1_TIME_SEC, soc_config);
Aamir Bohradd7acaa2020-03-25 11:36:22 +053062}