diff options
author | Bjorn Helgaas <bhelgaas@google.com> | 2020-12-15 15:11:10 -0600 |
---|---|---|
committer | Bjorn Helgaas <bhelgaas@google.com> | 2020-12-15 15:11:10 -0600 |
commit | 7c250f8293a362189419ae8b34da111ba02af304 (patch) | |
tree | b20af84e397b6526f4f7abfb68614ccd77d10cd6 /include | |
parent | c086b55e374b2c24c2cc506cac6499fee635da06 (diff) | |
parent | cddadae9748c3c056eb9f0d4b0edfffd0166dd68 (diff) | |
download | lwn-7c250f8293a362189419ae8b34da111ba02af304.tar.gz lwn-7c250f8293a362189419ae8b34da111ba02af304.zip |
Merge branch 'pci/ecam'
- Unify ECAM constants in native PCI Express drivers (Krzysztof Wilczyński)
- Add thunder-pem constant for custom ".bus_shift" initialiser (Krzysztof
Wilczyński)
- Convert iproc to use new ECAM constants (Krzysztof Wilczyński)
- Change vmd __iomem pointers from "char *" to "void *" (Krzysztof
Wilczyński)
- Remove unused xgene .bus_shift initialisers (Krzysztof Wilczyński)
* pci/ecam:
PCI: xgene: Removed unused ".bus_shift" initialisers from pci-xgene.c
PCI: vmd: Update type of the __iomem pointers
PCI: iproc: Convert to use the new ECAM constants
PCI: thunder-pem: Add constant for custom ".bus_shift" initialiser
PCI: Unify ECAM constants in native PCI Express drivers
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/pci-ecam.h | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/include/linux/pci-ecam.h b/include/linux/pci-ecam.h index 033ce74f02e8..65d3d83015c3 100644 --- a/include/linux/pci-ecam.h +++ b/include/linux/pci-ecam.h @@ -10,6 +10,33 @@ #include <linux/platform_device.h> /* + * Memory address shift values for the byte-level address that + * can be used when accessing the PCI Express Configuration Space. + */ + +/* + * Enhanced Configuration Access Mechanism (ECAM) + * + * See PCI Express Base Specification, Revision 5.0, Version 1.0, + * Section 7.2.2, Table 7-1, p. 677. + */ +#define PCIE_ECAM_BUS_SHIFT 20 /* Bus number */ +#define PCIE_ECAM_DEVFN_SHIFT 12 /* Device and Function number */ + +#define PCIE_ECAM_BUS_MASK 0xff +#define PCIE_ECAM_DEVFN_MASK 0xff +#define PCIE_ECAM_REG_MASK 0xfff /* Limit offset to a maximum of 4K */ + +#define PCIE_ECAM_BUS(x) (((x) & PCIE_ECAM_BUS_MASK) << PCIE_ECAM_BUS_SHIFT) +#define PCIE_ECAM_DEVFN(x) (((x) & PCIE_ECAM_DEVFN_MASK) << PCIE_ECAM_DEVFN_SHIFT) +#define PCIE_ECAM_REG(x) ((x) & PCIE_ECAM_REG_MASK) + +#define PCIE_ECAM_OFFSET(bus, devfn, where) \ + (PCIE_ECAM_BUS(bus) | \ + PCIE_ECAM_DEVFN(devfn) | \ + PCIE_ECAM_REG(where)) + +/* * struct to hold pci ops and bus shift of the config window * for a PCI controller. */ |