drivers/pcie: Change pcie_get_mbar() to return size and flags

currently pcie_get_mbar only returns the physical address.
This changes the function to return the size of the mbar and
the flags (IO Bar vs MEM BAR).

Signed-off-by: Maximilian Bachmann <m.bachmann@acontis.com>
This commit is contained in:
Maximilian Bachmann 2020-11-05 00:15:25 +01:00 committed by Johan Hedberg
commit 3c8e98cb39
7 changed files with 76 additions and 36 deletions

View file

@ -352,17 +352,17 @@ static int uart_ns16550_configure(const struct device *dev,
#ifndef UART_NS16550_ACCESS_IOPORT
#ifdef UART_NS16550_PCIE_ENABLED
if (dev_cfg->pcie) {
uintptr_t phys;
struct pcie_mbar mbar;
if (!pcie_probe(dev_cfg->pcie_bdf, dev_cfg->pcie_id)) {
ret = -EINVAL;
goto out;
}
phys = pcie_get_mbar(dev_cfg->pcie_bdf, 0);
pcie_get_mbar(dev_cfg->pcie_bdf, 0, &mbar);
pcie_set_cmd(dev_cfg->pcie_bdf, PCIE_CONF_CMDSTAT_MEM, true);
device_map(DEVICE_MMIO_RAM_PTR(dev), phys, 0x1000,
device_map(DEVICE_MMIO_RAM_PTR(dev), mbar.phys_addr, mbar.size,
K_MEM_CACHE_NONE);
} else
#endif /* UART_NS16550_PCIE_ENABLED */