Most DWC based EPC glue drivers that have BARs marked as BAR_RESERVED in
epc_features also call dw_pcie_ep_reset_bar() for these reserved BARs in
ep->ops->init(). (The only exception is pci-keystone.c.)
An EPF driver will be able to get/enable BARs that have been disabled/reset
using dw_pcie_ep_reset_bar(), except if the BAR is marked as BAR_RESERVED
(see pci_epc_get_next_free_bar()).
Thus, all EPC drivers that have BARs marked as BAR_RESERVED in epc_features
and call dw_pcie_ep_reset_bar(), should really have these BARs marked as
BAR_DISABLED. If dw_pcie_ep_reset_bar() is not called by the glue driver,
the BARs are kept as BAR_RESERVED.
No EPC drivers outside drivers/pci/controllers/dwc mark their BARs as
BAR_RESERVED, so there is nothing to do in non-DWC based EPC drivers.
Signed-off-by: Niklas Cassel <cassel@kernel.org>
Signed-off-by: Manivannan Sadhasivam <mani@kernel.org>
Tested-by: Manikanta Maddireddy <mmaddireddy@nvidia.com>
Tested-by: Koichiro Den <den@valinux.co.jp>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
Link: https://patch.msgid.link/20260312130229.2282001-18-cassel@kernel.org
static const struct pci_epc_features imx8m_pcie_epc_features = {
DWC_EPC_COMMON_FEATURES,
.msi_capable = true,
- .bar[BAR_1] = { .type = BAR_RESERVED, },
- .bar[BAR_3] = { .type = BAR_RESERVED, },
+ .bar[BAR_1] = { .type = BAR_DISABLED, },
+ .bar[BAR_3] = { .type = BAR_DISABLED, },
.bar[BAR_4] = { .type = BAR_FIXED, .fixed_size = SZ_256, },
- .bar[BAR_5] = { .type = BAR_RESERVED, },
+ .bar[BAR_5] = { .type = BAR_DISABLED, },
.align = SZ_64K,
};
static const struct pci_epc_features imx8q_pcie_epc_features = {
DWC_EPC_COMMON_FEATURES,
.msi_capable = true,
- .bar[BAR_1] = { .type = BAR_RESERVED, },
- .bar[BAR_3] = { .type = BAR_RESERVED, },
- .bar[BAR_5] = { .type = BAR_RESERVED, },
+ .bar[BAR_1] = { .type = BAR_DISABLED, },
+ .bar[BAR_3] = { .type = BAR_DISABLED, },
+ .bar[BAR_5] = { .type = BAR_DISABLED, },
.align = SZ_64K,
};
DWC_EPC_COMMON_FEATURES,
.msi_capable = true,
.msix_capable = true,
+ /*
+ * TODO: This driver is the only DWC glue driver that had BAR_RESERVED
+ * BARs, but did not call dw_pcie_ep_reset_bar() for the reserved BARs.
+ *
+ * To not change the existing behavior, these BARs were not migrated to
+ * BAR_DISABLED. If this driver wants the BAR_RESERVED BARs to be
+ * disabled, it should migrate them to BAR_DISABLED.
+ *
+ * If they actually should be enabled, then the driver must also define
+ * what is behind these reserved BARs, see the definition of struct
+ * pci_epc_bar_rsvd_region.
+ */
.bar[BAR_0] = { .type = BAR_RESERVED, },
.bar[BAR_1] = { .type = BAR_RESERVED, },
.bar[BAR_2] = { .type = BAR_RESIZABLE, },
static const struct pci_epc_features rcar_gen4_pcie_epc_features = {
DWC_EPC_COMMON_FEATURES,
.msi_capable = true,
- .bar[BAR_1] = { .type = BAR_RESERVED, },
- .bar[BAR_3] = { .type = BAR_RESERVED, },
+ .bar[BAR_1] = { .type = BAR_DISABLED, },
+ .bar[BAR_3] = { .type = BAR_DISABLED, },
.bar[BAR_4] = { .type = BAR_FIXED, .fixed_size = 256 },
- .bar[BAR_5] = { .type = BAR_RESERVED, },
+ .bar[BAR_5] = { .type = BAR_DISABLED, },
.align = SZ_1M,
};
.msi_capable = true,
.bar[BAR_0] = { .type = BAR_FIXED, .fixed_size = SZ_1M,
.only_64bit = true, },
- .bar[BAR_2] = { .type = BAR_RESERVED, },
- .bar[BAR_3] = { .type = BAR_RESERVED, },
- .bar[BAR_4] = { .type = BAR_RESERVED, },
- .bar[BAR_5] = { .type = BAR_RESERVED, },
+ .bar[BAR_2] = { .type = BAR_DISABLED, },
+ .bar[BAR_3] = { .type = BAR_DISABLED, },
+ .bar[BAR_4] = { .type = BAR_DISABLED, },
+ .bar[BAR_5] = { .type = BAR_DISABLED, },
.align = SZ_64K,
};
.align = 1 << 16,
.bar[BAR_0] = { .only_64bit = true, },
.bar[BAR_2] = { .only_64bit = true, },
- .bar[BAR_4] = { .type = BAR_RESERVED, },
- .bar[BAR_5] = { .type = BAR_RESERVED, },
+ .bar[BAR_4] = { .type = BAR_DISABLED, },
+ .bar[BAR_5] = { .type = BAR_DISABLED, },
},
};