soc/intel/pantherlake: Remove soc_info.[hc] interface
[coreboot2.git] / src / soc / intel / common / block / pcie / pcie_helpers.c
blob00bef42a79901ee6b0b055001ff8c513a803d2f8
1 /* SPDX-License-Identifier: GPL-2.0-only */
3 #include <console/console.h>
4 #include <device/device.h>
5 #include <intelblocks/pcie_rp.h>
6 #include <stdint.h>
8 static uint32_t pcie_slot_enable_mask(const struct pcie_rp_group *group)
10 uint32_t mask = 0;
11 unsigned int fn;
12 unsigned int i;
13 const struct device *dev;
15 for (i = 0, fn = rp_start_fn(group); i < group->count; i++, fn++) {
16 dev = pcidev_on_root(group->slot, fn);
17 if (is_dev_enabled(dev))
18 mask |= BIT(i);
21 return mask;
24 uint32_t pcie_rp_enable_mask(const struct pcie_rp_group *const groups)
26 uint32_t mask = 0;
27 uint32_t offset = 0;
28 const struct pcie_rp_group *group;
30 for (group = groups; group->count; ++group) {
31 if (group->count + offset >= sizeof(mask) * 8) {
32 printk(BIOS_ERR, "%s: Root port count greater than mask size!\n",
33 __func__);
34 break;
36 mask |= pcie_slot_enable_mask(group) << offset;
37 offset += group->count;
40 return mask;