blob: 5f2152b668d008a365c01230e10be4158545b038 [file] [log] [blame]
Felix Heldea831392023-08-08 02:55:09 +02001/* SPDX-License-Identifier: GPL-2.0-only */
2
3#include <amdblocks/data_fabric.h>
4#include <device/device.h>
5#include <types.h>
6
7enum cb_err data_fabric_get_pci_bus_numbers(struct device *domain, uint8_t *first_bus,
8 uint8_t *last_bus)
9{
10 union df_pci_cfg_map pci_bus_map;
11
12 for (unsigned int i = 0; i < DF_PCI_CFG_MAP_COUNT; i++) {
13 pci_bus_map.raw = data_fabric_broadcast_read32(DF_PCI_CFG_MAP(i));
14
15 /* TODO: Systems with more than one PCI root need to check to which PCI root
16 the PCI bus number range gets decoded to. */
17 if (pci_bus_map.we && pci_bus_map.re) {
18 *first_bus = pci_bus_map.bus_num_base;
19 *last_bus = pci_bus_map.bus_num_limit;
20 return CB_SUCCESS;
21 }
22 }
23
24 return CB_ERR;
25}