blob: 3f01f14dcf0ff77b0be07ee22c8d63857a0d2c88 [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{
36 static const struct sa_mmio_descriptor soc_fixed_resources[] = {
37 { PCIEXBAR, CONFIG_MMCONF_BASE_ADDRESS, CONFIG_SA_PCIEX_LENGTH,
38 "PCIEXBAR" },
39 { MCHBAR, MCH_BASE_ADDRESS, MCH_BASE_SIZE, "MCHBAR" },
40 { DMIBAR, DMI_BASE_ADDRESS, DMI_BASE_SIZE, "DMIBAR" },
41 { EPBAR, EP_BASE_ADDRESS, EP_BASE_SIZE, "EPBAR" },
42 { REGBAR, REG_BASE_ADDRESS, REG_BASE_SIZE, "REGBAR" },
43 { EDRAMBAR, EDRAM_BASE_ADDRESS, EDRAM_BASE_SIZE, "EDRAMBAR" },
Subrata Banik0baad612017-11-23 13:58:34 +053044 /*
45 * PMC pci device gets hidden from PCI bus due to Silicon
46 * policy hence binding PMCBAR aka PWRMBASE (offset 0x10) with
47 * SA resources to ensure that PMCBAR falls under PCI reserved
48 * memory range.
49 *
50 * Note: Don't add any more resource with same offset 0x10
51 * under this device space.
52 */
53 { PCI_BASE_ADDRESS_0, PCH_PWRM_BASE_ADDRESS, PCH_PWRM_BASE_SIZE,
54 "PMCBAR" },
Lijian Zhaoaa3d78d2017-08-08 11:32:35 -070055 };
56
57 sa_add_fixed_mmio_resources(dev, index, soc_fixed_resources,
58 ARRAY_SIZE(soc_fixed_resources));
John Zhaodb3f0e32019-03-15 16:54:27 -070059
60 /* Add Vt-d resources if VT-d is enabled. */
61 if ((pci_read_config32(dev, CAPID0_A) & VTD_DISABLE))
62 return;
63
John Zhao1159a162019-04-22 10:45:51 -070064 sa_add_fixed_mmio_resources(dev, index, soc_vtd_resources,
John Zhaodb3f0e32019-03-15 16:54:27 -070065 ARRAY_SIZE(soc_vtd_resources));
Lijian Zhaoaa3d78d2017-08-08 11:32:35 -070066}
67
68/*
69 * SoC implementation
70 *
71 * Perform System Agent Initialization during Ramstage phase.
72 */
73void soc_systemagent_init(struct device *dev)
74{
75 /* Enable Power Aware Interrupt Routing */
76 enable_power_aware_intr();
77
78 /* Enable BIOS Reset CPL */
79 enable_bios_reset_cpl();
Sumeet Pawnikarc896e92e2019-01-08 19:52:54 +053080
81 /* Configure turbo power limits 1ms after reset complete bit */
82 mdelay(1);
83 set_power_limits(28);
Lijian Zhaoaa3d78d2017-08-08 11:32:35 -070084}