Debian Codegraph @

src/soc/intel/common/block/include/intelblocks/systemagent_server.h

raw symbols SCIP
1 /* SPDX-License-Identifier: GPL-2.0-only */
2
3 #ifndef SOC_INTEL_COMMON_BLOCK_SA_SERVER_H
4 #define SOC_INTEL_COMMON_BLOCK_SA_SERVER_H
5
6 #include <device/device.h>
7 #include <device/pci_type.h>
8 #include <stdbool.h>
9 #include <stdint.h>
10
11 enum sa_server_reg {
12 MMCFG_BASE_REG,
13 MMCFG_LIMIT_REG,
14 TSEG_BASE_REG,
15 TSEG_LIMIT_REG,
16 TOCM_REG,
17 TOUUD_REG,
18 TOLUD_REG,
19 MMIO_L_REG,
20 VT_BAR_REG,
21 DPR_REG,
22 NUM_MAP_ENTRIES, /* Must be last. */
23 };
24
25 /**
26 * SoC implementation to convert register index to SoC-specific register PCIe configuration
27 * space offset.
28 */
29 uint32_t sa_server_soc_reg_to_pci_offset(enum sa_server_reg reg);
30
31 struct sa_server_mem_map_descriptor {
32 uint32_t reg_offset; /* PCI configuration space offset. */
33 bool is_64_bit; /* If register is 64 bit. */
34 bool is_limit; /* If lower bits should be treated as 1s or 0s but always read as 0s. */
35 uint32_t alignment; /* Alignment of the address in register. Probing as PCI BAR if 0. */
36 };
37
38 uint64_t sa_server_read_map_entry(pci_devfn_t dev,
39 const struct sa_server_mem_map_descriptor *entry);
40
41 struct sa_server_mmio_descriptor {
42 uint64_t base;
43 uint64_t size;
44 bool (*get_resource)(struct device *dev, uint64_t *base, uint64_t *size);
45 const char *description; /* Name of the register. */
46 };
47
48 uintptr_t sa_server_get_tseg_base(void);
49
50 size_t sa_server_get_tseg_size(void);
51
52 uint64_t sa_server_get_touud(void);
53
54 uintptr_t sa_server_get_tolud(void);
55
56 /*
57 * API to determine whether system agent is on PCH domain or accelerators domains.
58 */
59 bool sa_server_is_on_pch_domain(const struct device *dev);
60
61 /*
62 * API to add MMIO resources based on `struct sa_mmio_descriptor` provided by SoC.
63 */
64 void sa_server_add_mmio_resources(
65 struct device *dev, int *resource_cnt,
66 const struct sa_server_mmio_descriptor *sa_server_fixed_resources, size_t count);
67
68 /**
69 * SoC call to provide all known fixed memory ranges for system agent.
70 *
71 * SoC function should provide fixed resource ranges in form of
72 * `struct sa_server_mmio_descriptor` along with resource count.
73 */
74 void sa_server_soc_add_fixed_mmio_resources(struct device *dev, int *resource_cnt);
75
76 #endif // SOC_INTEL_COMMON_BLOCK_SA_SERVER_H