Skip to content

Commit 6f5d8bd

Browse files
Johan Hedbergjhedberg
authored andcommitted
x86: pcie: Fix calling pcie_mm_init()
Commit 5632ee2 introduced an issue where in order to use MMIO configuration: - do_pcie_mmio_cfg is required to be true - Only set to true in pcie_mm_init() - Which is only called from pcie_mm_conf() - Which is only called from pcie_conf() if do_pcie_mmio_cfg is already true! The end result is that MMIO configuration will never be used. Fix the situation by moving the initialization check to pcie_conf(). Signed-off-by: Johan Hedberg <[email protected]>
1 parent 594e780 commit 6f5d8bd

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

arch/x86/core/pcie.c

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -61,14 +61,6 @@ static void pcie_mm_init(void)
6161
static inline void pcie_mm_conf(pcie_bdf_t bdf, unsigned int reg,
6262
bool write, uint32_t *data)
6363
{
64-
if (bus_segs[0].mmio == NULL) {
65-
pcie_mm_init();
66-
}
67-
68-
if (do_pcie_mmio_cfg == false) {
69-
return;
70-
}
71-
7264
for (int i = 0; i < ARRAY_SIZE(bus_segs); i++) {
7365
int off = PCIE_BDF_TO_BUS(bdf) - bus_segs[i].start_bus;
7466

@@ -133,6 +125,10 @@ static inline void pcie_conf(pcie_bdf_t bdf, unsigned int reg,
133125

134126
{
135127
#ifdef CONFIG_PCIE_MMIO_CFG
128+
if (bus_segs[0].mmio == NULL) {
129+
pcie_mm_init();
130+
}
131+
136132
if (do_pcie_mmio_cfg) {
137133
pcie_mm_conf(bdf, reg, write, data);
138134
} else

0 commit comments

Comments
 (0)