blob: d850b15b3454beb1d1d3cdd2ce11a222213c0c6d [file] [log] [blame]
Lijian Zhaoaa3d78d2017-08-08 11:32:35 -07001/*
2 * This file is part of the coreboot project.
3 *
4 * Copyright (C) 2007-2009 coresystems GmbH
5 * Copyright (C) 2014 Google Inc.
6 * Copyright (C) 2015-2017 Intel Corporation.
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; version 2 of the License.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 */
17
Lijian Zhaoaa3d78d2017-08-08 11:32:35 -070018#include <device/device.h>
Sumeet Pawnikarc896e92e2019-01-08 19:52:54 +053019#include <delay.h>
Subrata Banik0baad612017-11-23 13:58:34 +053020#include <device/pci.h>
John Zhaodb3f0e32019-03-15 16:54:27 -070021#include <device/pci_ops.h>
Lijian Zhaoaa3d78d2017-08-08 11:32:35 -070022#include <intelblocks/systemagent.h>
Sumeet Pawnikarc896e92e2019-01-08 19:52:54 +053023#include <soc/cpu.h>
Lijian Zhaoaa3d78d2017-08-08 11:32:35 -070024#include <soc/iomap.h>
25#include <soc/systemagent.h>
John Zhaodb3f0e32019-03-15 16:54:27 -070026#include "chip.h"
Lijian Zhaoaa3d78d2017-08-08 11:32:35 -070027
28/*
29 * SoC implementation
30 *
Jonathan Neuschäfer5268b762018-02-12 12:24:25 +010031 * Add all known fixed memory ranges for Host Controller/Memory
Lijian Zhaoaa3d78d2017-08-08 11:32:35 -070032 * controller.
33 */
34void soc_add_fixed_mmio_resources(struct device *dev, int *index)
35{
John Zhaodb3f0e32019-03-15 16:54:27 -070036 const struct soc_intel_cannonlake_config *const config = dev->chip_info;
37
Lijian Zhaoaa3d78d2017-08-08 11:32:35 -070038 static const struct sa_mmio_descriptor soc_fixed_resources[] = {
39 { PCIEXBAR, CONFIG_MMCONF_BASE_ADDRESS, CONFIG_SA_PCIEX_LENGTH,
40 "PCIEXBAR" },
41 { MCHBAR, MCH_BASE_ADDRESS, MCH_BASE_SIZE, "MCHBAR" },
42 { DMIBAR, DMI_BASE_ADDRESS, DMI_BASE_SIZE, "DMIBAR" },
43 { EPBAR, EP_BASE_ADDRESS, EP_BASE_SIZE, "EPBAR" },
44 { REGBAR, REG_BASE_ADDRESS, REG_BASE_SIZE, "REGBAR" },
45 { EDRAMBAR, EDRAM_BASE_ADDRESS, EDRAM_BASE_SIZE, "EDRAMBAR" },
Subrata Banik0baad612017-11-23 13:58:34 +053046 /*
47 * PMC pci device gets hidden from PCI bus due to Silicon
48 * policy hence binding PMCBAR aka PWRMBASE (offset 0x10) with
49 * SA resources to ensure that PMCBAR falls under PCI reserved
50 * memory range.
51 *
52 * Note: Don't add any more resource with same offset 0x10
53 * under this device space.
54 */
55 { PCI_BASE_ADDRESS_0, PCH_PWRM_BASE_ADDRESS, PCH_PWRM_BASE_SIZE,
56 "PMCBAR" },
Lijian Zhaoaa3d78d2017-08-08 11:32:35 -070057 };
58
59 sa_add_fixed_mmio_resources(dev, index, soc_fixed_resources,
60 ARRAY_SIZE(soc_fixed_resources));
John Zhaodb3f0e32019-03-15 16:54:27 -070061
62 /* Add Vt-d resources if VT-d is enabled. */
63 if ((pci_read_config32(dev, CAPID0_A) & VTD_DISABLE))
64 return;
65
66 if (!(config && config->VtdDisable)) {
67 sa_add_fixed_mmio_resources(dev, index, soc_vtd_resources,
68 ARRAY_SIZE(soc_vtd_resources));
69 }
Lijian Zhaoaa3d78d2017-08-08 11:32:35 -070070}
71
72/*
73 * SoC implementation
74 *
75 * Perform System Agent Initialization during Ramstage phase.
76 */
77void soc_systemagent_init(struct device *dev)
78{
79 /* Enable Power Aware Interrupt Routing */
80 enable_power_aware_intr();
81
82 /* Enable BIOS Reset CPL */
83 enable_bios_reset_cpl();
Sumeet Pawnikarc896e92e2019-01-08 19:52:54 +053084
85 /* Configure turbo power limits 1ms after reset complete bit */
86 mdelay(1);
87 set_power_limits(28);
Lijian Zhaoaa3d78d2017-08-08 11:32:35 -070088}