blob: 4cdca50410e0e8d47e14a4ea440c4dfc2cf2ce5f [file] [log] [blame]
Angel Pons16f6aa82020-04-05 15:47:21 +02001/* SPDX-License-Identifier: GPL-2.0-only */
Subrata Banik91e89c52019-11-01 18:30:01 +05302
3/*
4 * This file is created based on Intel Tiger Lake Processor SA Datasheet
5 * Document number: 571131
6 * Chapter number: 3
7 */
8
9#include <device/device.h>
10#include <device/pci.h>
John Zhao49111cd2020-01-03 11:01:23 -080011#include <device/pci_ops.h>
Subrata Banik91e89c52019-11-01 18:30:01 +053012#include <intelblocks/systemagent.h>
13#include <soc/iomap.h>
14#include <soc/systemagent.h>
15
16/*
17 * SoC implementation
18 *
19 * Add all known fixed memory ranges for Host Controller/Memory
20 * controller.
21 */
22void soc_add_fixed_mmio_resources(struct device *dev, int *index)
23{
24 static const struct sa_mmio_descriptor soc_fixed_resources[] = {
25 { PCIEXBAR, CONFIG_MMCONF_BASE_ADDRESS, CONFIG_SA_PCIEX_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" },
32 /*
33 * PMC pci device gets hidden from PCI bus due to Silicon
34 * policy hence binding PMCBAR aka PWRMBASE (offset 0x10) with
35 * SA resources to ensure that PMCBAR falls under PCI reserved
36 * memory range.
37 *
38 * Note: Don't add any more resource with same offset 0x10
39 * under this device space.
40 */
41 { PCI_BASE_ADDRESS_0, PCH_PWRM_BASE_ADDRESS, PCH_PWRM_BASE_SIZE,
42 "PMCBAR" },
43 };
44
45 sa_add_fixed_mmio_resources(dev, index, soc_fixed_resources,
46 ARRAY_SIZE(soc_fixed_resources));
John Zhao49111cd2020-01-03 11:01:23 -080047
48 /* Add Vt-d resources if VT-d is enabled */
49 if ((pci_read_config32(dev, CAPID0_A) & VTD_DISABLE))
50 return;
51
52 sa_add_fixed_mmio_resources(dev, index, soc_vtd_resources,
53 ARRAY_SIZE(soc_vtd_resources));
Subrata Banik91e89c52019-11-01 18:30:01 +053054}
55
56/*
57 * SoC implementation
58 *
59 * Perform System Agent Initialization during Ramstage phase.
60 */
61void soc_systemagent_init(struct device *dev)
62{
63 /* Enable Power Aware Interrupt Routing */
64 enable_power_aware_intr();
65
66 /* Enable BIOS Reset CPL */
67 enable_bios_reset_cpl();
68}