mirror of
https://github.com/tbsdtv/linux_media.git
synced 2025-07-23 12:43:29 +02:00
PCI: Add pci_rebar_bytes_to_size()
Users of pci_resize_resource() need a way to calculate BAR size from desired bytes. Add a helper function and export it so that modular drivers can use it. Signed-off-by: Darren Salt <devspam@moreofthesa.me.uk> Signed-off-by: Christian König <christian.koenig@amd.com> Signed-off-by: Nirmoy Das <nirmoy.das@amd.com> Acked-by: Bjorn Helgaas <bhelgaas@google.com> Link: https://patchwork.kernel.org/project/dri-devel/patch/20210107175017.15893-3-nirmoy.das@amd.com
This commit is contained in:
committed by
Christian König
parent
8fbdbb66f8
commit
192f1bf755
@@ -1232,6 +1232,14 @@ 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 inline int pci_rebar_bytes_to_size(u64 bytes)
|
||||
{
|
||||
bytes = roundup_pow_of_two(bytes);
|
||||
|
||||
/* Return BAR size as defined in the resizable BAR specification */
|
||||
return max(ilog2(bytes), 20) - 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);
|
||||
|
Reference in New Issue
Block a user