blob: 4a24d3911fcf1ef2bd064d888ba507997988c267 [file] [log] [blame]
Angel Pons32abdd62020-04-05 15:47:03 +02001/* SPDX-License-Identifier: GPL-2.0-only */
Aamir Bohra3ee54bb2018-10-17 11:55:01 +05302
Aamir Bohra3ee54bb2018-10-17 11:55:01 +05303#include <device/device.h>
4#include <device/pci.h>
5#include <intelblocks/systemagent.h>
6#include <soc/iomap.h>
7#include <soc/systemagent.h>
8
9/*
10 * SoC implementation
11 *
12 * Add all known fixed memory ranges for Host Controller/Memory
13 * controller.
14 */
15void soc_add_fixed_mmio_resources(struct device *dev, int *index)
16{
17 static const struct sa_mmio_descriptor soc_fixed_resources[] = {
Shelley Chen4e9bb332021-10-20 15:43:45 -070018 { PCIEXBAR, CONFIG_ECAM_MMCONF_BASE_ADDRESS, CONFIG_ECAM_MMCONF_LENGTH,
Aamir Bohra3ee54bb2018-10-17 11:55:01 +053019 "PCIEXBAR" },
20 { MCHBAR, MCH_BASE_ADDRESS, MCH_BASE_SIZE, "MCHBAR" },
21 { DMIBAR, DMI_BASE_ADDRESS, DMI_BASE_SIZE, "DMIBAR" },
22 { EPBAR, EP_BASE_ADDRESS, EP_BASE_SIZE, "EPBAR" },
23 { REGBAR, REG_BASE_ADDRESS, REG_BASE_SIZE, "REGBAR" },
24 { EDRAMBAR, EDRAM_BASE_ADDRESS, EDRAM_BASE_SIZE, "EDRAMBAR" },
25 /*
26 * PMC pci device gets hidden from PCI bus due to Silicon
27 * policy hence binding PMCBAR aka PWRMBASE (offset 0x10) with
28 * SA resources to ensure that PMCBAR falls under PCI reserved
29 * memory range.
30 *
31 * Note: Don't add any more resource with same offset 0x10
32 * under this device space.
33 */
34 { PCI_BASE_ADDRESS_0, PCH_PWRM_BASE_ADDRESS, PCH_PWRM_BASE_SIZE,
35 "PMCBAR" },
36 };
37
38 sa_add_fixed_mmio_resources(dev, index, soc_fixed_resources,
39 ARRAY_SIZE(soc_fixed_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{
49 /* Enable Power Aware Interrupt Routing */
50 enable_power_aware_intr();
51
52 /* Enable BIOS Reset CPL */
53 enable_bios_reset_cpl();
54}
Patrick Rudolphbf72dcb2020-05-12 16:04:47 +020055
56uint32_t soc_systemagent_max_chan_capacity_mib(u8 capid0_a_ddrsz)
57{
58 switch (capid0_a_ddrsz) {
59 case 1:
60 return 8192;
61 case 2:
62 return 4096;
63 case 3:
64 return 2048;
65 default:
66 return 65536;
67 }
68}