This is to assist driver modules which do BAR resizing. Signed-off-by: Darren Salt <devspam@xxxxxxxxxxxxxxxxx> --- drivers/pci/pci.h | 4 ---- include/linux/pci.h | 9 +++++++++ 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h index 640ae7d74fc3..0fa31ff3d4e4 100644 --- a/drivers/pci/pci.h +++ b/drivers/pci/pci.h @@ -610,10 +610,6 @@ int acpi_get_rc_resources(struct device *dev, const char *hid, u16 segment, int pci_rebar_get_current_size(struct pci_dev *pdev, int bar); int pci_rebar_set_size(struct pci_dev *pdev, int bar, int size); -static inline u64 pci_rebar_size_to_bytes(int size) -{ - return 1ULL << (size + 20); -} struct device_node; diff --git a/include/linux/pci.h b/include/linux/pci.h index 9999040cfad9..41e93ea9756b 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h @@ -1226,6 +1226,15 @@ void pci_update_resource(struct pci_dev *dev, int resno); int __must_check pci_assign_resource(struct pci_dev *dev, int i); int __must_check pci_reassign_resource(struct pci_dev *dev, int i, resource_size_t add_size, resource_size_t align); void pci_release_resource(struct pci_dev *dev, int resno); +static __always_inline int pci_rebar_bytes_to_size(u64 bytes) +{ + bytes = roundup_pow_of_two(bytes); + return order_base_2(((bytes >> 20) | 1)) - 1; +} +static __always_inline u64 pci_rebar_size_to_bytes(int size) +{ + return 1ULL << (size + 20); +} u32 pci_rebar_get_possible_sizes(struct pci_dev *pdev, int bar); int __must_check pci_resize_resource(struct pci_dev *dev, int i, int size); int pci_select_bars(struct pci_dev *dev, unsigned long flags); -- 2.20.1 _______________________________________________ amd-gfx mailing list amd-gfx@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/amd-gfx