diff options
Diffstat (limited to 'include/linux/pci.h')
| -rw-r--r-- | include/linux/pci.h | 133 | 
1 files changed, 49 insertions, 84 deletions
diff --git a/include/linux/pci.h b/include/linux/pci.h index 82e4cd1b7ac3..f9088c89a534 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h @@ -6,12 +6,18 @@   *	Copyright 1994, Drew Eckhardt   *	Copyright 1997--1999 Martin Mares <[email protected]>   * + *	PCI Express ASPM defines and function prototypes + *	Copyright (c) 2007 Intel Corp. + *		Zhang Yanmin ([email protected]) + *		Shaohua Li ([email protected]) + *   *	For more information, please consult the following manuals (look at   *	http://www.pcisig.com/ for how to get them):   *   *	PCI BIOS Specification   *	PCI Local Bus Specification   *	PCI to PCI Bridge Specification + *	PCI Express Specification   *	PCI System Design Guide   */  #ifndef LINUX_PCI_H @@ -145,11 +151,6 @@ static inline const char *pci_power_name(pci_power_t state)  	return pci_power_names[1 + (__force int) state];  } -#define PCI_PM_D2_DELAY		200 -#define PCI_PM_D3_WAIT		10 -#define PCI_PM_D3COLD_WAIT	100 -#define PCI_PM_BUS_WAIT		50 -  /**   * typedef pci_channel_state_t   * @@ -418,7 +419,6 @@ struct pci_dev {  	unsigned int	broken_intx_masking:1;	/* INTx masking can't be used */  	unsigned int	io_window_1k:1;		/* Intel bridge 1K I/O windows */  	unsigned int	irq_managed:1; -	unsigned int	has_secondary_link:1;  	unsigned int	non_compliant_bars:1;	/* Broken BARs; ignore them */  	unsigned int	is_probed:1;		/* Device probing in progress */  	unsigned int	link_active_reporting:1;/* Device capable of reporting link active */ @@ -649,9 +649,6 @@ static inline struct pci_dev *pci_upstream_bridge(struct pci_dev *dev)  	return dev->bus->self;  } -struct device *pci_get_host_bridge_device(struct pci_dev *dev); -void pci_put_host_bridge_device(struct device *dev); -  #ifdef CONFIG_PCI_MSI  static inline bool pci_dev_msi_enabled(struct pci_dev *pci_dev)  { @@ -925,6 +922,11 @@ enum {  	PCI_SCAN_ALL_PCIE_DEVS	= 0x00000040,	/* Scan all, not just dev 0 */  }; +#define PCI_IRQ_LEGACY		(1 << 0) /* Allow legacy interrupts */ +#define PCI_IRQ_MSI		(1 << 1) /* Allow MSI interrupts */ +#define PCI_IRQ_MSIX		(1 << 2) /* Allow MSI-X interrupts */ +#define PCI_IRQ_AFFINITY	(1 << 3) /* Auto-assign affinity */ +  /* These external functions are only available when PCI support is enabled */  #ifdef CONFIG_PCI @@ -969,7 +971,7 @@ resource_size_t pcibios_align_resource(void *, const struct resource *,  				resource_size_t,  				resource_size_t); -/* Weak but can be overriden by arch */ +/* Weak but can be overridden by arch */  void pci_fixup_cardbus(struct pci_bus *);  /* Generic PCI functions used internally */ @@ -995,7 +997,6 @@ struct pci_bus *pci_scan_root_bus(struct device *parent, int bus,  int pci_scan_root_bus_bridge(struct pci_host_bridge *bridge);  struct pci_bus *pci_add_new_bus(struct pci_bus *parent, struct pci_dev *dev,  				int busnr); -void pcie_update_link_speed(struct pci_bus *bus, u16 link_status);  struct pci_slot *pci_create_slot(struct pci_bus *parent, int slot_nr,  				 const char *name,  				 struct hotplug_slot *hotplug); @@ -1241,19 +1242,12 @@ int pci_wake_from_d3(struct pci_dev *dev, bool enable);  int pci_prepare_to_sleep(struct pci_dev *dev);  int pci_back_from_sleep(struct pci_dev *dev);  bool pci_dev_run_wake(struct pci_dev *dev); -bool pci_check_pme_status(struct pci_dev *dev); -void pci_pme_wakeup_bus(struct pci_bus *bus);  void pci_d3cold_enable(struct pci_dev *dev);  void pci_d3cold_disable(struct pci_dev *dev);  bool pcie_relaxed_ordering_enabled(struct pci_dev *dev);  void pci_wakeup_bus(struct pci_bus *bus);  void pci_bus_set_current_state(struct pci_bus *bus, pci_power_t state); -/* PCI Virtual Channel */ -int pci_save_vc_state(struct pci_dev *dev); -void pci_restore_vc_state(struct pci_dev *dev); -void pci_allocate_vc_save_buffers(struct pci_dev *dev); -  /* For use by arch with custom probe code */  void set_pcie_port_type(struct pci_dev *pdev);  void set_pcie_hotplug_bridge(struct pci_dev *pdev); @@ -1297,8 +1291,6 @@ int pci_request_selected_regions_exclusive(struct pci_dev *, int, const char *);  void pci_release_selected_regions(struct pci_dev *, int);  /* drivers/pci/bus.c */ -struct pci_bus *pci_bus_get(struct pci_bus *bus); -void pci_bus_put(struct pci_bus *bus);  void pci_add_resource(struct list_head *resources, struct resource *res);  void pci_add_resource_offset(struct list_head *resources, struct resource *res,  			     resource_size_t offset); @@ -1408,11 +1400,6 @@ resource_size_t pcibios_window_alignment(struct pci_bus *bus,  int pci_set_vga_state(struct pci_dev *pdev, bool decode,  		      unsigned int command_bits, u32 flags); -#define PCI_IRQ_LEGACY		(1 << 0) /* Allow legacy interrupts */ -#define PCI_IRQ_MSI		(1 << 1) /* Allow MSI interrupts */ -#define PCI_IRQ_MSIX		(1 << 2) /* Allow MSI-X interrupts */ -#define PCI_IRQ_AFFINITY	(1 << 3) /* Auto-assign affinity */ -  /*   * Virtual interrupts allow for more interrupts to be allocated   * than the device has interrupts for. These are not programmed @@ -1517,14 +1504,6 @@ static inline int pci_irq_get_node(struct pci_dev *pdev, int vec)  }  #endif -static inline int -pci_alloc_irq_vectors(struct pci_dev *dev, unsigned int min_vecs, -		      unsigned int max_vecs, unsigned int flags) -{ -	return pci_alloc_irq_vectors_affinity(dev, min_vecs, max_vecs, flags, -					      NULL); -} -  /**   * pci_irqd_intx_xlate() - Translate PCI INTx value to an IRQ domain hwirq   * @d: the INTx IRQ domain @@ -1565,10 +1544,22 @@ extern bool pcie_ports_native;  #define pcie_ports_native	false  #endif +#define PCIE_LINK_STATE_L0S	1 +#define PCIE_LINK_STATE_L1	2 +#define PCIE_LINK_STATE_CLKPM	4 +  #ifdef CONFIG_PCIEASPM +int pci_disable_link_state(struct pci_dev *pdev, int state); +int pci_disable_link_state_locked(struct pci_dev *pdev, int state); +void pcie_no_aspm(void);  bool pcie_aspm_support_enabled(void);  bool pcie_aspm_enabled(struct pci_dev *pdev);  #else +static inline int pci_disable_link_state(struct pci_dev *pdev, int state) +{ return 0; } +static inline int pci_disable_link_state_locked(struct pci_dev *pdev, int state) +{ return 0; } +static inline void pcie_no_aspm(void) { }  static inline bool pcie_aspm_support_enabled(void) { return false; }  static inline bool pcie_aspm_enabled(struct pci_dev *pdev) { return false; }  #endif @@ -1579,23 +1570,8 @@ bool pci_aer_available(void);  static inline bool pci_aer_available(void) { return false; }  #endif -#ifdef CONFIG_PCIE_ECRC -void pcie_set_ecrc_checking(struct pci_dev *dev); -void pcie_ecrc_get_policy(char *str); -#else -static inline void pcie_set_ecrc_checking(struct pci_dev *dev) { } -static inline void pcie_ecrc_get_policy(char *str) { } -#endif -  bool pci_ats_disabled(void); -#ifdef CONFIG_PCIE_PTM -int pci_enable_ptm(struct pci_dev *dev, u8 *granularity); -#else -static inline int pci_enable_ptm(struct pci_dev *dev, u8 *granularity) -{ return -EINVAL; } -#endif -  void pci_cfg_access_lock(struct pci_dev *dev);  bool pci_cfg_access_trylock(struct pci_dev *dev);  void pci_cfg_access_unlock(struct pci_dev *dev); @@ -1749,11 +1725,6 @@ static inline void pci_release_regions(struct pci_dev *dev) { }  static inline unsigned long pci_address_to_pio(phys_addr_t addr) { return -1; } -static inline void pci_block_cfg_access(struct pci_dev *dev) { } -static inline int pci_block_cfg_access_in_atomic(struct pci_dev *dev) -{ return 0; } -static inline void pci_unblock_cfg_access(struct pci_dev *dev) { } -  static inline struct pci_bus *pci_find_next_bus(const struct pci_bus *from)  { return NULL; }  static inline struct pci_dev *pci_get_slot(struct pci_bus *bus, @@ -1782,17 +1753,36 @@ static inline const struct pci_device_id *pci_match_id(const struct pci_device_i  							 struct pci_dev *dev)  { return NULL; }  static inline bool pci_ats_disabled(void) { return true; } + +static inline int pci_irq_vector(struct pci_dev *dev, unsigned int nr) +{ +	return -EINVAL; +} + +static inline int +pci_alloc_irq_vectors_affinity(struct pci_dev *dev, unsigned int min_vecs, +			       unsigned int max_vecs, unsigned int flags, +			       struct irq_affinity *aff_desc) +{ +	return -ENOSPC; +}  #endif /* CONFIG_PCI */ +static inline int +pci_alloc_irq_vectors(struct pci_dev *dev, unsigned int min_vecs, +		      unsigned int max_vecs, unsigned int flags) +{ +	return pci_alloc_irq_vectors_affinity(dev, min_vecs, max_vecs, flags, +					      NULL); +} +  #ifdef CONFIG_PCI_ATS  /* Address Translation Service */ -void pci_ats_init(struct pci_dev *dev);  int pci_enable_ats(struct pci_dev *dev, int ps);  void pci_disable_ats(struct pci_dev *dev);  int pci_ats_queue_depth(struct pci_dev *dev);  int pci_ats_page_aligned(struct pci_dev *dev);  #else -static inline void pci_ats_init(struct pci_dev *d) { }  static inline int pci_enable_ats(struct pci_dev *d, int ps) { return -ENODEV; }  static inline void pci_disable_ats(struct pci_dev *d) { }  static inline int pci_ats_queue_depth(struct pci_dev *d) { return -ENODEV; } @@ -1803,7 +1793,7 @@ static inline int pci_ats_page_aligned(struct pci_dev *dev) { return 0; }  #include <asm/pci.h> -/* These two functions provide almost identical functionality. Depennding +/* These two functions provide almost identical functionality. Depending   * on the architecture, one will be implemented as a wrapper around the   * other (in drivers/pci/mmap.c).   * @@ -1872,25 +1862,9 @@ static inline const char *pci_name(const struct pci_dev *pdev)  	return dev_name(&pdev->dev);  } - -/* - * Some archs don't want to expose struct resource to userland as-is - * in sysfs and /proc - */ -#ifdef HAVE_ARCH_PCI_RESOURCE_TO_USER  void pci_resource_to_user(const struct pci_dev *dev, int bar,  			  const struct resource *rsrc,  			  resource_size_t *start, resource_size_t *end); -#else -static inline void pci_resource_to_user(const struct pci_dev *dev, int bar, -		const struct resource *rsrc, resource_size_t *start, -		resource_size_t *end) -{ -	*start = rsrc->start; -	*end = rsrc->end; -} -#endif /* HAVE_ARCH_PCI_RESOURCE_TO_USER */ -  /*   * The world is not perfect and supplies us with broken PCI devices. @@ -2032,10 +2006,6 @@ extern unsigned long pci_cardbus_mem_size;  extern u8 pci_dfl_cache_line_size;  extern u8 pci_cache_line_size; -extern unsigned long pci_hotplug_io_size; -extern unsigned long pci_hotplug_mem_size; -extern unsigned long pci_hotplug_bus_size; -  /* Architecture-specific versions may override these (weak) */  void pcibios_disable_device(struct pci_dev *dev);  void pcibios_set_master(struct pci_dev *dev); @@ -2305,10 +2275,6 @@ int pci_vpd_find_info_keyword(const u8 *buf, unsigned int off,  #ifdef CONFIG_OF  struct device_node;  struct irq_domain; -void pci_set_of_node(struct pci_dev *dev); -void pci_release_of_node(struct pci_dev *dev); -void pci_set_bus_of_node(struct pci_bus *bus); -void pci_release_bus_of_node(struct pci_bus *bus);  struct irq_domain *pci_host_bridge_of_msi_domain(struct pci_bus *bus);  int pci_parse_request_of_pci_ranges(struct device *dev,  				    struct list_head *resources, @@ -2318,10 +2284,6 @@ int pci_parse_request_of_pci_ranges(struct device *dev,  struct device_node *pcibios_get_phb_of_node(struct pci_bus *bus);  #else	/* CONFIG_OF */ -static inline void pci_set_of_node(struct pci_dev *dev) { } -static inline void pci_release_of_node(struct pci_dev *dev) { } -static inline void pci_set_bus_of_node(struct pci_bus *bus) { } -static inline void pci_release_bus_of_node(struct pci_bus *bus) { }  static inline struct irq_domain *  pci_host_bridge_of_msi_domain(struct pci_bus *bus) { return NULL; }  static inline int pci_parse_request_of_pci_ranges(struct device *dev, @@ -2435,4 +2397,7 @@ void pci_uevent_ers(struct pci_dev *pdev, enum  pci_ers_result err_type);  #define pci_notice_ratelimited(pdev, fmt, arg...) \  	dev_notice_ratelimited(&(pdev)->dev, fmt, ##arg) +#define pci_info_ratelimited(pdev, fmt, arg...) \ +	dev_info_ratelimited(&(pdev)->dev, fmt, ##arg) +  #endif /* LINUX_PCI_H */  |