Skip to content

Commit 14da601

Browse files
Johan Hedbergnashif
authored andcommitted
drivers: pcie: Move MAX_BUS/DEV/FUNC defines to pcie.h header file
These have been redefined in various places - better to have them in a single place that different users can use. Signed-off-by: Johan Hedberg <[email protected]>
1 parent 2262cfe commit 14da601

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

drivers/pcie/host/shell.c

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,6 @@
1111
#include <drivers/pcie/msi.h>
1212
#endif
1313

14-
#define MAX_BUS (0xFFFFFFFF & PCIE_BDF_BUS_MASK)
15-
#define MAX_DEV (0xFFFFFFFF & PCIE_BDF_DEV_MASK)
16-
#define MAX_FUNC (0xFFFFFFFF & PCIE_BDF_FUNC_MASK)
17-
1814
static void show_msi(const struct shell *shell, pcie_bdf_t bdf)
1915
{
2016
#ifdef CONFIG_PCIE_MSI
@@ -109,9 +105,9 @@ static int cmd_pcie_ls(const struct shell *shell, size_t argc, char **argv)
109105
int dev;
110106
int func;
111107

112-
for (bus = 0; bus <= MAX_BUS; ++bus) {
113-
for (dev = 0; dev <= MAX_DEV; ++dev) {
114-
for (func = 0; func <= MAX_FUNC; ++func) {
108+
for (bus = 0; bus <= PCIE_MAX_BUS; ++bus) {
109+
for (dev = 0; dev <= PCIE_MAX_DEV; ++dev) {
110+
for (func = 0; func <= PCIE_MAX_FUNC; ++func) {
115111
show(shell, PCIE_BDF(bus, dev, func));
116112
}
117113
}

include/drivers/pcie/pcie.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,10 @@ extern uint32_t pcie_get_cap(pcie_bdf_t bdf, uint32_t cap_id);
238238
#define PCIE_CONF_INTR_IRQ(w) ((w) & 0xFFU)
239239
#define PCIE_CONF_INTR_IRQ_NONE 0xFFU /* no interrupt routed */
240240

241+
#define PCIE_MAX_BUS (0xFFFFFFFF & PCIE_BDF_BUS_MASK)
242+
#define PCIE_MAX_DEV (0xFFFFFFFF & PCIE_BDF_DEV_MASK)
243+
#define PCIE_MAX_FUNC (0xFFFFFFFF & PCIE_BDF_FUNC_MASK)
244+
241245
#ifdef __cplusplus
242246
}
243247
#endif

0 commit comments

Comments
 (0)