x86: pcie: Fix calling pcie_mm_init()

Commit 5632ee26f3 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 <johan.hedberg@intel.com>
This commit is contained in:
Johan Hedberg 2020-09-22 17:04:25 +03:00 committed by Johan Hedberg
parent 594e780756
commit 6f5d8bd2c4

View file

@ -61,14 +61,6 @@ static void pcie_mm_init(void)
static inline void pcie_mm_conf(pcie_bdf_t bdf, unsigned int reg,
bool write, uint32_t *data)
{
if (bus_segs[0].mmio == NULL) {
pcie_mm_init();
}
if (do_pcie_mmio_cfg == false) {
return;
}
for (int i = 0; i < ARRAY_SIZE(bus_segs); i++) {
int off = PCIE_BDF_TO_BUS(bdf) - bus_segs[i].start_bus;
@ -133,6 +125,10 @@ static inline void pcie_conf(pcie_bdf_t bdf, unsigned int reg,
{
#ifdef CONFIG_PCIE_MMIO_CFG
if (bus_segs[0].mmio == NULL) {
pcie_mm_init();
}
if (do_pcie_mmio_cfg) {
pcie_mm_conf(bdf, reg, write, data);
} else