1 /* SPDX-License-Identifier: GPL-2.0-only */
3 #include <console/console.h>
4 #include <device/device.h>
5 #include <intelblocks/pcie_rp.h>
8 static uint32_t pcie_slot_enable_mask(const struct pcie_rp_group
*group
)
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
))
24 uint32_t pcie_rp_enable_mask(const struct pcie_rp_group
*const groups
)
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",
36 mask
|= pcie_slot_enable_mask(group
) << offset
;
37 offset
+= group
->count
;