Aamir Bohra | dd7acaa | 2020-03-25 11:36:22 +0530 | [diff] [blame] | 1 | /* |
| 2 | * This file is part of the coreboot project. |
| 3 | * |
| 4 | * |
| 5 | * This program is free software; you can redistribute it and/or modify |
| 6 | * it under the terms of the GNU General Public License as published by |
| 7 | * the Free Software Foundation; version 2 of the License. |
| 8 | * |
| 9 | * This program is distributed in the hope that it will be useful, |
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | * GNU General Public License for more details. |
| 13 | */ |
| 14 | |
Aamir Bohra | dd7acaa | 2020-03-25 11:36:22 +0530 | [diff] [blame] | 15 | #include <device/device.h> |
| 16 | #include <device/pci.h> |
| 17 | #include <device/pci_ops.h> |
| 18 | #include <intelblocks/systemagent.h> |
| 19 | #include <soc/iomap.h> |
| 20 | #include <soc/systemagent.h> |
| 21 | |
| 22 | /* |
| 23 | * SoC implementation |
| 24 | * |
| 25 | * Add all known fixed memory ranges for Host Controller/Memory |
| 26 | * controller. |
| 27 | */ |
| 28 | void soc_add_fixed_mmio_resources(struct device *dev, int *index) |
| 29 | { |
| 30 | static const struct sa_mmio_descriptor soc_fixed_resources[] = { |
| 31 | { PCIEXBAR, CONFIG_MMCONF_BASE_ADDRESS, CONFIG_SA_PCIEX_LENGTH, |
| 32 | "PCIEXBAR" }, |
| 33 | { MCHBAR, MCH_BASE_ADDRESS, MCH_BASE_SIZE, "MCHBAR" }, |
| 34 | { DMIBAR, DMI_BASE_ADDRESS, DMI_BASE_SIZE, "DMIBAR" }, |
| 35 | { EPBAR, EP_BASE_ADDRESS, EP_BASE_SIZE, "EPBAR" }, |
| 36 | { REGBAR, REG_BASE_ADDRESS, REG_BASE_SIZE, "REGBAR" }, |
| 37 | { EDRAMBAR, EDRAM_BASE_ADDRESS, EDRAM_BASE_SIZE, "EDRAMBAR" }, |
| 38 | /* |
| 39 | * PMC pci device gets hidden from PCI bus due to Silicon |
| 40 | * policy hence binding PMCBAR aka PWRMBASE (offset 0x10) with |
| 41 | * SA resources to ensure that PMCBAR falls under PCI reserved |
| 42 | * memory range. |
| 43 | * |
| 44 | * Note: Don't add any more resource with same offset 0x10 |
| 45 | * under this device space. |
| 46 | */ |
| 47 | { PCI_BASE_ADDRESS_0, PCH_PWRM_BASE_ADDRESS, PCH_PWRM_BASE_SIZE, |
| 48 | "PMCBAR" }, |
| 49 | }; |
| 50 | |
| 51 | sa_add_fixed_mmio_resources(dev, index, soc_fixed_resources, |
| 52 | ARRAY_SIZE(soc_fixed_resources)); |
| 53 | |
| 54 | /* Add Vt-d resources if VT-d is enabled */ |
| 55 | if ((pci_read_config32(dev, CAPID0_A) & VTD_DISABLE)) |
| 56 | return; |
| 57 | |
| 58 | sa_add_fixed_mmio_resources(dev, index, soc_vtd_resources, |
| 59 | ARRAY_SIZE(soc_vtd_resources)); |
| 60 | } |
| 61 | |
| 62 | /* |
| 63 | * SoC implementation |
| 64 | * |
| 65 | * Perform System Agent Initialization during Ramstage phase. |
| 66 | */ |
| 67 | void soc_systemagent_init(struct device *dev) |
| 68 | { |
| 69 | /* Enable Power Aware Interrupt Routing */ |
| 70 | enable_power_aware_intr(); |
| 71 | |
| 72 | /* Enable BIOS Reset CPL */ |
| 73 | enable_bios_reset_cpl(); |
| 74 | } |