diff options
author | Bjorn Helgaas <bhelgaas@google.com> | 2012-08-23 18:31:58 -0600 |
---|---|---|
committer | Bjorn Helgaas <bhelgaas@google.com> | 2012-08-23 18:31:58 -0600 |
commit | e1c171b86baaccab983ded5dfa1663c0981d2520 (patch) | |
tree | 648ad71d7bd2838678f66d055fcaae654b5e4ddc /include/linux/pci.h | |
parent | 0d7614f09c1ebdbaa1599a5aba7593f147bf96ee (diff) | |
parent | 479e0d485eaab452cf248cd1a9520015023b35b2 (diff) | |
download | op-kernel-dev-e1c171b86baaccab983ded5dfa1663c0981d2520.zip op-kernel-dev-e1c171b86baaccab983ded5dfa1663c0981d2520.tar.gz |
Merge branch 'pci/jiang-pcie-cap' into next
* pci/jiang-pcie-cap: (40 commits)
rtl8192e: Use PCI Express Capability accessors
et131x: Use PCI Express Capability accessors
rapdio/tsi721: Use PCI Express Capability accessors
drm/radeon: Use PCI Express Capability accessors
[SCSI] qla4xxx: Use PCI Express Capability accessors
[SCSI] qla4xxx: Use PCI Express Capability accessors
IB/qib: Use PCI Express Capability accessors
IB/mthca: Use PCI Express Capability accessors
rtlwifi: Use PCI Express Capability accessors
iwlwifi: Use PCI Express Capability accessors
iwlegacy: Use PCI Express Capability accessors
ath9k: Use PCI Express Capability accessors
atl1c: Use PCI Express Capability accessors
cxgb4: Use PCI Express Capability accessors
cxgb3: Use PCI Express Capability accessors
myri10ge: Use PCI Express Capability accessors
niu: Use PCI Express Capability accessors
mlx4: Use PCI Express Capability accessors
vxge: Use PCI Express Capability accessors
igb: Use PCI Express Capability accessors
...
Diffstat (limited to 'include/linux/pci.h')
-rw-r--r-- | include/linux/pci.h | 44 |
1 files changed, 43 insertions, 1 deletions
diff --git a/include/linux/pci.h b/include/linux/pci.h index 5faa831..b8667e0 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h @@ -254,10 +254,10 @@ struct pci_dev { u8 revision; /* PCI revision, low byte of class word */ u8 hdr_type; /* PCI header type (`multi' flag masked out) */ u8 pcie_cap; /* PCI-E capability offset */ - u8 pcie_type:4; /* PCI-E device/port type */ u8 pcie_mpss:3; /* PCI-E Max Payload Size Supported */ u8 rom_base_reg; /* which config register controls the ROM */ u8 pin; /* which interrupt pin this device uses */ + u16 pcie_flags_reg; /* cached PCI-E Capabilities Register */ struct pci_driver *driver; /* which driver has allocated this device */ u64 dma_mask; /* Mask of the bits of bus address this @@ -816,6 +816,39 @@ static inline int pci_write_config_dword(const struct pci_dev *dev, int where, return pci_bus_write_config_dword(dev->bus, dev->devfn, where, val); } +int pcie_capability_read_word(struct pci_dev *dev, int pos, u16 *val); +int pcie_capability_read_dword(struct pci_dev *dev, int pos, u32 *val); +int pcie_capability_write_word(struct pci_dev *dev, int pos, u16 val); +int pcie_capability_write_dword(struct pci_dev *dev, int pos, u32 val); +int pcie_capability_clear_and_set_word(struct pci_dev *dev, int pos, + u16 clear, u16 set); +int pcie_capability_clear_and_set_dword(struct pci_dev *dev, int pos, + u32 clear, u32 set); + +static inline int pcie_capability_set_word(struct pci_dev *dev, int pos, + u16 set) +{ + return pcie_capability_clear_and_set_word(dev, pos, 0, set); +} + +static inline int pcie_capability_set_dword(struct pci_dev *dev, int pos, + u32 set) +{ + return pcie_capability_clear_and_set_dword(dev, pos, 0, set); +} + +static inline int pcie_capability_clear_word(struct pci_dev *dev, int pos, + u16 clear) +{ + return pcie_capability_clear_and_set_word(dev, pos, clear, 0); +} + +static inline int pcie_capability_clear_dword(struct pci_dev *dev, int pos, + u32 clear) +{ + return pcie_capability_clear_and_set_dword(dev, pos, clear, 0); +} + /* user-space driven config access */ int pci_user_read_config_byte(struct pci_dev *dev, int where, u8 *val); int pci_user_read_config_word(struct pci_dev *dev, int where, u16 *val); @@ -1650,6 +1683,15 @@ static inline bool pci_is_pcie(struct pci_dev *dev) return !!pci_pcie_cap(dev); } +/** + * pci_pcie_type - get the PCIe device/port type + * @dev: PCI device + */ +static inline int pci_pcie_type(const struct pci_dev *dev) +{ + return (dev->pcie_flags_reg & PCI_EXP_FLAGS_TYPE) >> 4; +} + void pci_request_acs(void); bool pci_acs_enabled(struct pci_dev *pdev, u16 acs_flags); bool pci_acs_path_enabled(struct pci_dev *start, |