diff options
author | Christian König <christian.koenig@amd.com> | 2017-10-24 22:40:20 +0300 |
---|---|---|
committer | Bjorn Helgaas <bhelgaas@google.com> | 2017-10-24 22:40:20 +0300 |
commit | 276b738deb5bf856b9f6049fcd92a967f52643d7 (patch) | |
tree | cac0ccc12391b30c519e116c696955da34fdb8cb /drivers/pci/pci.h | |
parent | cb21bc9469c4c8a4d38f52d779ccc11e4329f016 (diff) | |
download | linux-276b738deb5bf856b9f6049fcd92a967f52643d7.tar.xz |
PCI: Add resizable BAR infrastructure
Add resizable BAR infrastructure, including defines and helper functions to
read the possible sizes of a BAR and update its size. See PCIe r3.1, sec
7.22.
Link: https://pcisig.com/sites/default/files/specification_documents/ECN_Resizable-BAR_24Apr2008.pdf
Signed-off-by: Christian König <christian.koenig@amd.com>
[bhelgaas: rename to functions with "rebar" (to match #defines), drop shift
#defines, drop "_MASK" suffixes, fix typos, fix kerneldoc]
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Diffstat (limited to 'drivers/pci/pci.h')
-rw-r--r-- | drivers/pci/pci.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h index a6560c9baa52..33469a33738d 100644 --- a/drivers/pci/pci.h +++ b/drivers/pci/pci.h @@ -366,4 +366,12 @@ int acpi_get_rc_resources(struct device *dev, const char *hid, u16 segment, struct resource *res); #endif +u32 pci_rebar_get_possible_sizes(struct pci_dev *pdev, int bar); +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); +} + #endif /* DRIVERS_PCI_H */ |