blob: 9c8d7616483969a24c1ef2a2fb8f366d03fca27b [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>
Lijian Zhaoaa3d78d2017-08-08 11:32:35 -070021#include <intelblocks/systemagent.h>
Sumeet Pawnikarc896e92e2019-01-08 19:52:54 +053022#include <soc/cpu.h>
Lijian Zhaoaa3d78d2017-08-08 11:32:35 -070023#include <soc/iomap.h>
24#include <soc/systemagent.h>
25
26/*
27 * SoC implementation
28 *
Jonathan Neuschäfer5268b762018-02-12 12:24:25 +010029 * Add all known fixed memory ranges for Host Controller/Memory
Lijian Zhaoaa3d78d2017-08-08 11:32:35 -070030 * controller.
31 */
32void soc_add_fixed_mmio_resources(struct device *dev, int *index)
33{
34 static const struct sa_mmio_descriptor soc_fixed_resources[] = {
35 { PCIEXBAR, CONFIG_MMCONF_BASE_ADDRESS, CONFIG_SA_PCIEX_LENGTH,
36 "PCIEXBAR" },
37 { MCHBAR, MCH_BASE_ADDRESS, MCH_BASE_SIZE, "MCHBAR" },
38 { DMIBAR, DMI_BASE_ADDRESS, DMI_BASE_SIZE, "DMIBAR" },
39 { EPBAR, EP_BASE_ADDRESS, EP_BASE_SIZE, "EPBAR" },
40 { REGBAR, REG_BASE_ADDRESS, REG_BASE_SIZE, "REGBAR" },
41 { EDRAMBAR, EDRAM_BASE_ADDRESS, EDRAM_BASE_SIZE, "EDRAMBAR" },
Subrata Banik0baad612017-11-23 13:58:34 +053042 /*
43 * PMC pci device gets hidden from PCI bus due to Silicon
44 * policy hence binding PMCBAR aka PWRMBASE (offset 0x10) with
45 * SA resources to ensure that PMCBAR falls under PCI reserved
46 * memory range.
47 *
48 * Note: Don't add any more resource with same offset 0x10
49 * under this device space.
50 */
51 { PCI_BASE_ADDRESS_0, PCH_PWRM_BASE_ADDRESS, PCH_PWRM_BASE_SIZE,
52 "PMCBAR" },
Lijian Zhaoaa3d78d2017-08-08 11:32:35 -070053 };
54
55 sa_add_fixed_mmio_resources(dev, index, soc_fixed_resources,
56 ARRAY_SIZE(soc_fixed_resources));
57}
58
59/*
60 * SoC implementation
61 *
62 * Perform System Agent Initialization during Ramstage phase.
63 */
64void soc_systemagent_init(struct device *dev)
65{
66 /* Enable Power Aware Interrupt Routing */
67 enable_power_aware_intr();
68
69 /* Enable BIOS Reset CPL */
70 enable_bios_reset_cpl();
Sumeet Pawnikarc896e92e2019-01-08 19:52:54 +053071
72 /* Configure turbo power limits 1ms after reset complete bit */
73 mdelay(1);
74 set_power_limits(28);
Lijian Zhaoaa3d78d2017-08-08 11:32:35 -070075}