coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
systemagent.c
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 
3 #include <device/device.h>
4 #include <device/pci.h>
6 #include <soc/iomap.h>
7 #include <soc/systemagent.h>
8 
9 /*
10  * SoC implementation
11  *
12  * Add all known fixed memory ranges for Host Controller/Memory
13  * controller.
14  */
15 void soc_add_fixed_mmio_resources(struct device *dev, int *index)
16 {
17  static const struct sa_mmio_descriptor soc_fixed_resources[] = {
18  { PCIEXBAR, CONFIG_ECAM_MMCONF_BASE_ADDRESS, CONFIG_ECAM_MMCONF_LENGTH,
19  "PCIEXBAR" },
20  { MCHBAR, MCH_BASE_ADDRESS, MCH_BASE_SIZE, "MCHBAR" },
21  { DMIBAR, DMI_BASE_ADDRESS, DMI_BASE_SIZE, "DMIBAR" },
22  { EPBAR, EP_BASE_ADDRESS, EP_BASE_SIZE, "EPBAR" },
23  { REGBAR, REG_BASE_ADDRESS, REG_BASE_SIZE, "REGBAR" },
25  /*
26  * PMC pci device gets hidden from PCI bus due to Silicon
27  * policy hence binding PMCBAR aka PWRMBASE (offset 0x10) with
28  * SA resources to ensure that PMCBAR falls under PCI reserved
29  * memory range.
30  *
31  * Note: Don't add any more resource with same offset 0x10
32  * under this device space.
33  */
35  "PMCBAR" },
36  };
37 
38  sa_add_fixed_mmio_resources(dev, index, soc_fixed_resources,
39  ARRAY_SIZE(soc_fixed_resources));
40 }
41 
42 /*
43  * SoC implementation
44  *
45  * Perform System Agent Initialization during Ramstage phase.
46  */
47 void soc_systemagent_init(struct device *dev)
48 {
49  /* Enable Power Aware Interrupt Routing */
51 
52  /* Enable BIOS Reset CPL */
54 }
55 
57 {
58  switch (capid0_a_ddrsz) {
59  case 1:
60  return 8192;
61  case 2:
62  return 4096;
63  case 3:
64  return 2048;
65  default:
66  return 65536;
67  }
68 }
#define REGBAR
Definition: systemagent.h:25
void soc_add_fixed_mmio_resources(struct device *dev, int *index)
Definition: systemagent.c:25
void soc_systemagent_init(struct device *dev)
Definition: systemagent.c:53
uint32_t soc_systemagent_max_chan_capacity_mib(u8 capid0_a_ddrsz)
Definition: systemagent.c:96
#define ARRAY_SIZE(a)
Definition: helpers.h:12
void enable_bios_reset_cpl(void)
void enable_power_aware_intr(void)
Definition: systemagent.c:298
void sa_add_fixed_mmio_resources(struct device *dev, int *resource_cnt, const struct sa_mmio_descriptor *sa_fixed_resources, size_t count)
Definition: systemagent.c:87
#define MCHBAR
Definition: host_bridge.h:7
#define PCIEXBAR
Definition: host_bridge.h:32
#define DMIBAR
Definition: host_bridge.h:33
#define EPBAR
Definition: host_bridge.h:6
#define EDRAMBAR
Definition: mchbar.h:19
#define PCH_PWRM_BASE_ADDRESS
Definition: iomap.h:70
#define PCH_PWRM_BASE_SIZE
Definition: iomap.h:71
#define REG_BASE_ADDRESS
Definition: iomap.h:67
#define REG_BASE_SIZE
Definition: iomap.h:68
#define DMI_BASE_ADDRESS
Definition: iomap.h:37
#define EP_BASE_ADDRESS
Definition: iomap.h:40
#define MCH_BASE_ADDRESS
Definition: iomap.h:82
#define DMI_BASE_SIZE
Definition: memmap.h:8
#define EP_BASE_SIZE
Definition: memmap.h:10
#define EDRAM_BASE_ADDRESS
Definition: memmap.h:12
#define MCH_BASE_SIZE
Definition: memmap.h:6
#define EDRAM_BASE_SIZE
Definition: memmap.h:13
#define PCI_BASE_ADDRESS_0
Definition: pci_def.h:63
unsigned int uint32_t
Definition: stdint.h:14
uint8_t u8
Definition: stdint.h:45
Definition: device.h:107
unsigned int index
Definition: systemagent.h:45