Debian Codegraph @

src/soc/amd/common/block/root_complex/root_complex.c

raw symbols SCIP
1 /* SPDX-License-Identifier: GPL-2.0-only */
2
3 #include <amdblocks/root_complex.h>
4 #include <console/console.h>
5 #include <device/device.h>
6 #include <types.h>
7
8 static const struct domain_iohc_info *get_domain_iohc_info(struct device *domain)
9 {
10 const unsigned int domain_id = dev_get_domain_id(domain);
11 const struct domain_iohc_info *iohc;
12 size_t iohc_count;
13
14 iohc = get_iohc_info(&iohc_count);
15
16 if (domain_id < iohc_count) {
17 return &iohc[domain_id];
18 } else {
19 printk(BIOS_ERR, "Invalid domain 0x%x with no corresponding IOHC device.\n",
20 domain_id);
21 return NULL;
22 }
23 }
24
25 uint32_t get_iohc_misc_smn_base(struct device *domain)
26 {
27 const struct domain_iohc_info *iohc_info = get_domain_iohc_info(domain);
28
29 if (iohc_info)
30 return iohc_info->misc_smn_base;
31 else
32 return 0;
33 }
34
35 signed int get_iohc_fabric_id(struct device *domain)
36 {
37 const struct domain_iohc_info *iohc_info = get_domain_iohc_info(domain);
38
39 if (iohc_info)
40 return iohc_info->fabric_id;
41 else
42 return -1;
43 }