Lijian Zhao | aa3d78d | 2017-08-08 11:32:35 -0700 | [diff] [blame] | 1 | /* |
| 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 Zhao | aa3d78d | 2017-08-08 11:32:35 -0700 | [diff] [blame] | 18 | #include <device/device.h> |
Sumeet Pawnikar | c896e92e | 2019-01-08 19:52:54 +0530 | [diff] [blame] | 19 | #include <delay.h> |
Subrata Banik | 0baad61 | 2017-11-23 13:58:34 +0530 | [diff] [blame] | 20 | #include <device/pci.h> |
Lijian Zhao | aa3d78d | 2017-08-08 11:32:35 -0700 | [diff] [blame] | 21 | #include <intelblocks/systemagent.h> |
Sumeet Pawnikar | c896e92e | 2019-01-08 19:52:54 +0530 | [diff] [blame] | 22 | #include <soc/cpu.h> |
Lijian Zhao | aa3d78d | 2017-08-08 11:32:35 -0700 | [diff] [blame] | 23 | #include <soc/iomap.h> |
| 24 | #include <soc/systemagent.h> |
| 25 | |
| 26 | /* |
| 27 | * SoC implementation |
| 28 | * |
Jonathan Neuschäfer | 5268b76 | 2018-02-12 12:24:25 +0100 | [diff] [blame] | 29 | * Add all known fixed memory ranges for Host Controller/Memory |
Lijian Zhao | aa3d78d | 2017-08-08 11:32:35 -0700 | [diff] [blame] | 30 | * controller. |
| 31 | */ |
| 32 | void 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 Banik | 0baad61 | 2017-11-23 13:58:34 +0530 | [diff] [blame] | 42 | /* |
| 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 Zhao | aa3d78d | 2017-08-08 11:32:35 -0700 | [diff] [blame] | 53 | }; |
| 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 | */ |
| 64 | void 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 Pawnikar | c896e92e | 2019-01-08 19:52:54 +0530 | [diff] [blame] | 71 | |
| 72 | /* Configure turbo power limits 1ms after reset complete bit */ |
| 73 | mdelay(1); |
| 74 | set_power_limits(28); |
Lijian Zhao | aa3d78d | 2017-08-08 11:32:35 -0700 | [diff] [blame] | 75 | } |