drivers/pcie: Improve and fix MBAR retrieval depending on use cases
So far pcie_get_mbar() has been the only way to retrieve a MBAR. But it's logic does not fit all uses cases as we will see further. The meaning of its parameter "index" is not about BAR index but about a valid Base Address count instead. It's an arbitrary way to index MBARs unrelated to the actual BAR index. While this has proven to be just the function we needed so far, this has not been the case for MSI-X, which one (through BIR info) needs to access the BAR by their actual index. Same as ivshmem in fact, though that one did not generate any bug since it never has IO BARs nor 64bits BARs (so far?). So: - renaming existing pcie_get_mbar() to pcie_probe_mbar(), which is a more relevant name as it indeed probes the BARs to find the nth valid one. - Introducing a new pcie_get_mbar() which this time really asks for the BAR index. - Applying the change where relevant. So all use pcie_probe_mbar() now but MSI-X and ivshmem. Fixes #37444 Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
This commit is contained in:
parent
6b6aa2714f
commit
f70ecc1099
5 changed files with 45 additions and 19 deletions
|
@ -360,7 +360,7 @@ static int uart_ns16550_configure(const struct device *dev,
|
|||
goto out;
|
||||
}
|
||||
|
||||
pcie_get_mbar(dev_cfg->pcie_bdf, 0, &mbar);
|
||||
pcie_probe_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), mbar.phys_addr, mbar.size,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue