aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/linux/acpi.h34
-rw-r--r--include/linux/msi.h13
-rw-r--r--include/linux/pci-acpi.h67
-rw-r--r--include/linux/pci.h61
-rw-r--r--include/linux/pci_ids.h1
-rw-r--r--include/linux/pci_regs.h37
-rw-r--r--include/linux/pcieport_if.h36
7 files changed, 165 insertions, 84 deletions
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index 78199151c00b..d047f846c3ed 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -257,6 +257,40 @@ void __init acpi_no_s4_hw_signature(void);
257void __init acpi_old_suspend_ordering(void); 257void __init acpi_old_suspend_ordering(void);
258void __init acpi_s4_no_nvs(void); 258void __init acpi_s4_no_nvs(void);
259#endif /* CONFIG_PM_SLEEP */ 259#endif /* CONFIG_PM_SLEEP */
260
261#define OSC_QUERY_TYPE 0
262#define OSC_SUPPORT_TYPE 1
263#define OSC_CONTROL_TYPE 2
264#define OSC_SUPPORT_MASKS 0x1f
265
266/* _OSC DW0 Definition */
267#define OSC_QUERY_ENABLE 1
268#define OSC_REQUEST_ERROR 2
269#define OSC_INVALID_UUID_ERROR 4
270#define OSC_INVALID_REVISION_ERROR 8
271#define OSC_CAPABILITIES_MASK_ERROR 16
272
273/* _OSC DW1 Definition (OS Support Fields) */
274#define OSC_EXT_PCI_CONFIG_SUPPORT 1
275#define OSC_ACTIVE_STATE_PWR_SUPPORT 2
276#define OSC_CLOCK_PWR_CAPABILITY_SUPPORT 4
277#define OSC_PCI_SEGMENT_GROUPS_SUPPORT 8
278#define OSC_MSI_SUPPORT 16
279
280/* _OSC DW1 Definition (OS Control Fields) */
281#define OSC_PCI_EXPRESS_NATIVE_HP_CONTROL 1
282#define OSC_SHPC_NATIVE_HP_CONTROL 2
283#define OSC_PCI_EXPRESS_PME_CONTROL 4
284#define OSC_PCI_EXPRESS_AER_CONTROL 8
285#define OSC_PCI_EXPRESS_CAP_STRUCTURE_CONTROL 16
286
287#define OSC_CONTROL_MASKS (OSC_PCI_EXPRESS_NATIVE_HP_CONTROL | \
288 OSC_SHPC_NATIVE_HP_CONTROL | \
289 OSC_PCI_EXPRESS_PME_CONTROL | \
290 OSC_PCI_EXPRESS_AER_CONTROL | \
291 OSC_PCI_EXPRESS_CAP_STRUCTURE_CONTROL)
292
293extern acpi_status acpi_pci_osc_control_set(acpi_handle handle, u32 flags);
260#else /* CONFIG_ACPI */ 294#else /* CONFIG_ACPI */
261 295
262static inline int early_acpi_boot_init(void) 296static inline int early_acpi_boot_init(void)
diff --git a/include/linux/msi.h b/include/linux/msi.h
index d2b8a1e8ca11..6991ab5b24d1 100644
--- a/include/linux/msi.h
+++ b/include/linux/msi.h
@@ -20,20 +20,23 @@ extern void write_msi_msg(unsigned int irq, struct msi_msg *msg);
20 20
21struct msi_desc { 21struct msi_desc {
22 struct { 22 struct {
23 __u8 type : 5; /* {0: unused, 5h:MSI, 11h:MSI-X} */ 23 __u8 is_msix : 1;
24 __u8 multiple: 3; /* log2 number of messages */
24 __u8 maskbit : 1; /* mask-pending bit supported ? */ 25 __u8 maskbit : 1; /* mask-pending bit supported ? */
25 __u8 masked : 1;
26 __u8 is_64 : 1; /* Address size: 0=32bit 1=64bit */ 26 __u8 is_64 : 1; /* Address size: 0=32bit 1=64bit */
27 __u8 pos; /* Location of the msi capability */ 27 __u8 pos; /* Location of the msi capability */
28 __u32 maskbits_mask; /* mask bits mask */
29 __u16 entry_nr; /* specific enabled entry */ 28 __u16 entry_nr; /* specific enabled entry */
30 unsigned default_irq; /* default pre-assigned irq */ 29 unsigned default_irq; /* default pre-assigned irq */
31 }msi_attrib; 30 } msi_attrib;
32 31
32 u32 masked; /* mask bits */
33 unsigned int irq; 33 unsigned int irq;
34 struct list_head list; 34 struct list_head list;
35 35
36 void __iomem *mask_base; 36 union {
37 void __iomem *mask_base;
38 u8 mask_pos;
39 };
37 struct pci_dev *dev; 40 struct pci_dev *dev;
38 41
39 /* Last set MSI message */ 42 /* Last set MSI message */
diff --git a/include/linux/pci-acpi.h b/include/linux/pci-acpi.h
index 042c166f65d5..092e82e0048c 100644
--- a/include/linux/pci-acpi.h
+++ b/include/linux/pci-acpi.h
@@ -10,72 +10,25 @@
10 10
11#include <linux/acpi.h> 11#include <linux/acpi.h>
12 12
13#define OSC_QUERY_TYPE 0
14#define OSC_SUPPORT_TYPE 1
15#define OSC_CONTROL_TYPE 2
16#define OSC_SUPPORT_MASKS 0x1f
17
18/*
19 * _OSC DW0 Definition
20 */
21#define OSC_QUERY_ENABLE 1
22#define OSC_REQUEST_ERROR 2
23#define OSC_INVALID_UUID_ERROR 4
24#define OSC_INVALID_REVISION_ERROR 8
25#define OSC_CAPABILITIES_MASK_ERROR 16
26
27/*
28 * _OSC DW1 Definition (OS Support Fields)
29 */
30#define OSC_EXT_PCI_CONFIG_SUPPORT 1
31#define OSC_ACTIVE_STATE_PWR_SUPPORT 2
32#define OSC_CLOCK_PWR_CAPABILITY_SUPPORT 4
33#define OSC_PCI_SEGMENT_GROUPS_SUPPORT 8
34#define OSC_MSI_SUPPORT 16
35
36/*
37 * _OSC DW1 Definition (OS Control Fields)
38 */
39#define OSC_PCI_EXPRESS_NATIVE_HP_CONTROL 1
40#define OSC_SHPC_NATIVE_HP_CONTROL 2
41#define OSC_PCI_EXPRESS_PME_CONTROL 4
42#define OSC_PCI_EXPRESS_AER_CONTROL 8
43#define OSC_PCI_EXPRESS_CAP_STRUCTURE_CONTROL 16
44
45#define OSC_CONTROL_MASKS (OSC_PCI_EXPRESS_NATIVE_HP_CONTROL | \
46 OSC_SHPC_NATIVE_HP_CONTROL | \
47 OSC_PCI_EXPRESS_PME_CONTROL | \
48 OSC_PCI_EXPRESS_AER_CONTROL | \
49 OSC_PCI_EXPRESS_CAP_STRUCTURE_CONTROL)
50
51#ifdef CONFIG_ACPI 13#ifdef CONFIG_ACPI
52extern acpi_status pci_osc_control_set(acpi_handle handle, u32 flags);
53int pci_acpi_osc_support(acpi_handle handle, u32 flags);
54static inline acpi_handle acpi_find_root_bridge_handle(struct pci_dev *pdev) 14static inline acpi_handle acpi_find_root_bridge_handle(struct pci_dev *pdev)
55{ 15{
56 /* Find root host bridge */ 16 struct pci_bus *pbus = pdev->bus;
57 while (pdev->bus->self) 17 /* Find a PCI root bus */
58 pdev = pdev->bus->self; 18 while (pbus->parent)
59 19 pbus = pbus->parent;
60 return acpi_get_pci_rootbridge_handle(pci_domain_nr(pdev->bus), 20 return acpi_get_pci_rootbridge_handle(pci_domain_nr(pbus),
61 pdev->bus->number); 21 pbus->number);
62} 22}
63 23
64static inline acpi_handle acpi_pci_get_bridge_handle(struct pci_bus *pbus) 24static inline acpi_handle acpi_pci_get_bridge_handle(struct pci_bus *pbus)
65{ 25{
66 int seg = pci_domain_nr(pbus), busnr = pbus->number; 26 if (pbus->parent)
67 struct pci_dev *bridge = pbus->self; 27 return DEVICE_ACPI_HANDLE(&(pbus->self->dev));
68 if (bridge) 28 return acpi_get_pci_rootbridge_handle(pci_domain_nr(pbus),
69 return DEVICE_ACPI_HANDLE(&(bridge->dev)); 29 pbus->number);
70 return acpi_get_pci_rootbridge_handle(seg, busnr);
71} 30}
72#else 31#else
73#if !defined(AE_ERROR)
74typedef u32 acpi_status;
75#define AE_ERROR (acpi_status) (0x0001)
76#endif
77static inline acpi_status pci_osc_control_set(acpi_handle handle, u32 flags)
78{return AE_ERROR;}
79static inline acpi_handle acpi_find_root_bridge_handle(struct pci_dev *pdev) 32static inline acpi_handle acpi_find_root_bridge_handle(struct pci_dev *pdev)
80{ return NULL; } 33{ return NULL; }
81#endif 34#endif
diff --git a/include/linux/pci.h b/include/linux/pci.h
index df3644132617..a7fe4bbd7ff1 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -52,6 +52,7 @@
52#include <asm/atomic.h> 52#include <asm/atomic.h>
53#include <linux/device.h> 53#include <linux/device.h>
54#include <linux/io.h> 54#include <linux/io.h>
55#include <linux/irqreturn.h>
55 56
56/* Include the ID list */ 57/* Include the ID list */
57#include <linux/pci_ids.h> 58#include <linux/pci_ids.h>
@@ -93,6 +94,12 @@ enum {
93 /* #6: expansion ROM resource */ 94 /* #6: expansion ROM resource */
94 PCI_ROM_RESOURCE, 95 PCI_ROM_RESOURCE,
95 96
97 /* device specific resources */
98#ifdef CONFIG_PCI_IOV
99 PCI_IOV_RESOURCES,
100 PCI_IOV_RESOURCE_END = PCI_IOV_RESOURCES + PCI_SRIOV_NUM_BARS - 1,
101#endif
102
96 /* resources assigned to buses behind the bridge */ 103 /* resources assigned to buses behind the bridge */
97#define PCI_BRIDGE_RESOURCE_NUM 4 104#define PCI_BRIDGE_RESOURCE_NUM 4
98 105
@@ -180,6 +187,7 @@ struct pci_cap_saved_state {
180 187
181struct pcie_link_state; 188struct pcie_link_state;
182struct pci_vpd; 189struct pci_vpd;
190struct pci_sriov;
183 191
184/* 192/*
185 * The pci_dev structure is used to describe PCI devices. 193 * The pci_dev structure is used to describe PCI devices.
@@ -257,6 +265,8 @@ struct pci_dev {
257 unsigned int is_managed:1; 265 unsigned int is_managed:1;
258 unsigned int is_pcie:1; 266 unsigned int is_pcie:1;
259 unsigned int state_saved:1; 267 unsigned int state_saved:1;
268 unsigned int is_physfn:1;
269 unsigned int is_virtfn:1;
260 pci_dev_flags_t dev_flags; 270 pci_dev_flags_t dev_flags;
261 atomic_t enable_cnt; /* pci_enable_device has been called */ 271 atomic_t enable_cnt; /* pci_enable_device has been called */
262 272
@@ -270,6 +280,12 @@ struct pci_dev {
270 struct list_head msi_list; 280 struct list_head msi_list;
271#endif 281#endif
272 struct pci_vpd *vpd; 282 struct pci_vpd *vpd;
283#ifdef CONFIG_PCI_IOV
284 union {
285 struct pci_sriov *sriov; /* SR-IOV capability related */
286 struct pci_dev *physfn; /* the PF this VF is associated with */
287 };
288#endif
273}; 289};
274 290
275extern struct pci_dev *alloc_pci_dev(void); 291extern struct pci_dev *alloc_pci_dev(void);
@@ -341,6 +357,15 @@ struct pci_bus {
341#define pci_bus_b(n) list_entry(n, struct pci_bus, node) 357#define pci_bus_b(n) list_entry(n, struct pci_bus, node)
342#define to_pci_bus(n) container_of(n, struct pci_bus, dev) 358#define to_pci_bus(n) container_of(n, struct pci_bus, dev)
343 359
360/*
361 * Returns true if the pci bus is root (behind host-pci bridge),
362 * false otherwise
363 */
364static inline bool pci_is_root_bus(struct pci_bus *pbus)
365{
366 return !(pbus->parent);
367}
368
344#ifdef CONFIG_PCI_MSI 369#ifdef CONFIG_PCI_MSI
345static inline bool pci_dev_msi_enabled(struct pci_dev *pci_dev) 370static inline bool pci_dev_msi_enabled(struct pci_dev *pci_dev)
346{ 371{
@@ -528,7 +553,7 @@ void pcibios_update_irq(struct pci_dev *, int irq);
528/* Generic PCI functions used internally */ 553/* Generic PCI functions used internally */
529 554
530extern struct pci_bus *pci_find_bus(int domain, int busnr); 555extern struct pci_bus *pci_find_bus(int domain, int busnr);
531void pci_bus_add_devices(struct pci_bus *bus); 556void pci_bus_add_devices(const struct pci_bus *bus);
532struct pci_bus *pci_scan_bus_parented(struct device *parent, int bus, 557struct pci_bus *pci_scan_bus_parented(struct device *parent, int bus,
533 struct pci_ops *ops, void *sysdata); 558 struct pci_ops *ops, void *sysdata);
534static inline struct pci_bus * __devinit pci_scan_bus(int bus, struct pci_ops *ops, 559static inline struct pci_bus * __devinit pci_scan_bus(int bus, struct pci_ops *ops,
@@ -702,6 +727,9 @@ int pci_back_from_sleep(struct pci_dev *dev);
702 727
703/* Functions for PCI Hotplug drivers to use */ 728/* Functions for PCI Hotplug drivers to use */
704int pci_bus_find_capability(struct pci_bus *bus, unsigned int devfn, int cap); 729int pci_bus_find_capability(struct pci_bus *bus, unsigned int devfn, int cap);
730#ifdef CONFIG_HOTPLUG
731unsigned int pci_rescan_bus(struct pci_bus *bus);
732#endif
705 733
706/* Vital product data routines */ 734/* Vital product data routines */
707ssize_t pci_read_vpd(struct pci_dev *dev, loff_t pos, size_t count, void *buf); 735ssize_t pci_read_vpd(struct pci_dev *dev, loff_t pos, size_t count, void *buf);
@@ -709,7 +737,7 @@ ssize_t pci_write_vpd(struct pci_dev *dev, loff_t pos, size_t count, const void
709int pci_vpd_truncate(struct pci_dev *dev, size_t size); 737int pci_vpd_truncate(struct pci_dev *dev, size_t size);
710 738
711/* Helper functions for low-level code (drivers/pci/setup-[bus,res].c) */ 739/* Helper functions for low-level code (drivers/pci/setup-[bus,res].c) */
712void pci_bus_assign_resources(struct pci_bus *bus); 740void pci_bus_assign_resources(const struct pci_bus *bus);
713void pci_bus_size_bridges(struct pci_bus *bus); 741void pci_bus_size_bridges(struct pci_bus *bus);
714int pci_claim_resource(struct pci_dev *, int); 742int pci_claim_resource(struct pci_dev *, int);
715void pci_assign_unassigned_resources(void); 743void pci_assign_unassigned_resources(void);
@@ -790,7 +818,7 @@ struct msix_entry {
790 818
791 819
792#ifndef CONFIG_PCI_MSI 820#ifndef CONFIG_PCI_MSI
793static inline int pci_enable_msi(struct pci_dev *dev) 821static inline int pci_enable_msi_block(struct pci_dev *dev, unsigned int nvec)
794{ 822{
795 return -1; 823 return -1;
796} 824}
@@ -800,6 +828,10 @@ static inline void pci_msi_shutdown(struct pci_dev *dev)
800static inline void pci_disable_msi(struct pci_dev *dev) 828static inline void pci_disable_msi(struct pci_dev *dev)
801{ } 829{ }
802 830
831static inline int pci_msix_table_size(struct pci_dev *dev)
832{
833 return 0;
834}
803static inline int pci_enable_msix(struct pci_dev *dev, 835static inline int pci_enable_msix(struct pci_dev *dev,
804 struct msix_entry *entries, int nvec) 836 struct msix_entry *entries, int nvec)
805{ 837{
@@ -821,9 +853,10 @@ static inline int pci_msi_enabled(void)
821 return 0; 853 return 0;
822} 854}
823#else 855#else
824extern int pci_enable_msi(struct pci_dev *dev); 856extern int pci_enable_msi_block(struct pci_dev *dev, unsigned int nvec);
825extern void pci_msi_shutdown(struct pci_dev *dev); 857extern void pci_msi_shutdown(struct pci_dev *dev);
826extern void pci_disable_msi(struct pci_dev *dev); 858extern void pci_disable_msi(struct pci_dev *dev);
859extern int pci_msix_table_size(struct pci_dev *dev);
827extern int pci_enable_msix(struct pci_dev *dev, 860extern int pci_enable_msix(struct pci_dev *dev,
828 struct msix_entry *entries, int nvec); 861 struct msix_entry *entries, int nvec);
829extern void pci_msix_shutdown(struct pci_dev *dev); 862extern void pci_msix_shutdown(struct pci_dev *dev);
@@ -842,6 +875,8 @@ static inline int pcie_aspm_enabled(void)
842extern int pcie_aspm_enabled(void); 875extern int pcie_aspm_enabled(void);
843#endif 876#endif
844 877
878#define pci_enable_msi(pdev) pci_enable_msi_block(pdev, 1)
879
845#ifdef CONFIG_HT_IRQ 880#ifdef CONFIG_HT_IRQ
846/* The functions a driver should call */ 881/* The functions a driver should call */
847int ht_create_irq(struct pci_dev *dev, int idx); 882int ht_create_irq(struct pci_dev *dev, int idx);
@@ -1195,5 +1230,23 @@ int pci_ext_cfg_avail(struct pci_dev *dev);
1195 1230
1196void __iomem *pci_ioremap_bar(struct pci_dev *pdev, int bar); 1231void __iomem *pci_ioremap_bar(struct pci_dev *pdev, int bar);
1197 1232
1233#ifdef CONFIG_PCI_IOV
1234extern int pci_enable_sriov(struct pci_dev *dev, int nr_virtfn);
1235extern void pci_disable_sriov(struct pci_dev *dev);
1236extern irqreturn_t pci_sriov_migration(struct pci_dev *dev);
1237#else
1238static inline int pci_enable_sriov(struct pci_dev *dev, int nr_virtfn)
1239{
1240 return -ENODEV;
1241}
1242static inline void pci_disable_sriov(struct pci_dev *dev)
1243{
1244}
1245static inline irqreturn_t pci_sriov_migration(struct pci_dev *dev)
1246{
1247 return IRQ_NONE;
1248}
1249#endif
1250
1198#endif /* __KERNEL__ */ 1251#endif /* __KERNEL__ */
1199#endif /* LINUX_PCI_H */ 1252#endif /* LINUX_PCI_H */
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index e5816dd33371..cb14fd260837 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -2396,6 +2396,7 @@
2396#define PCI_DEVICE_ID_INTEL_82801CA_12 0x248c 2396#define PCI_DEVICE_ID_INTEL_82801CA_12 0x248c
2397#define PCI_DEVICE_ID_INTEL_82801DB_0 0x24c0 2397#define PCI_DEVICE_ID_INTEL_82801DB_0 0x24c0
2398#define PCI_DEVICE_ID_INTEL_82801DB_1 0x24c1 2398#define PCI_DEVICE_ID_INTEL_82801DB_1 0x24c1
2399#define PCI_DEVICE_ID_INTEL_82801DB_2 0x24c2
2399#define PCI_DEVICE_ID_INTEL_82801DB_3 0x24c3 2400#define PCI_DEVICE_ID_INTEL_82801DB_3 0x24c3
2400#define PCI_DEVICE_ID_INTEL_82801DB_5 0x24c5 2401#define PCI_DEVICE_ID_INTEL_82801DB_5 0x24c5
2401#define PCI_DEVICE_ID_INTEL_82801DB_6 0x24c6 2402#define PCI_DEVICE_ID_INTEL_82801DB_6 0x24c6
diff --git a/include/linux/pci_regs.h b/include/linux/pci_regs.h
index 027815b4635e..e4d08c1b2e0b 100644
--- a/include/linux/pci_regs.h
+++ b/include/linux/pci_regs.h
@@ -235,7 +235,7 @@
235#define PCI_PM_CAP_PME_SHIFT 11 /* Start of the PME Mask in PMC */ 235#define PCI_PM_CAP_PME_SHIFT 11 /* Start of the PME Mask in PMC */
236#define PCI_PM_CTRL 4 /* PM control and status register */ 236#define PCI_PM_CTRL 4 /* PM control and status register */
237#define PCI_PM_CTRL_STATE_MASK 0x0003 /* Current power state (D0 to D3) */ 237#define PCI_PM_CTRL_STATE_MASK 0x0003 /* Current power state (D0 to D3) */
238#define PCI_PM_CTRL_NO_SOFT_RESET 0x0004 /* No reset for D3hot->D0 */ 238#define PCI_PM_CTRL_NO_SOFT_RESET 0x0008 /* No reset for D3hot->D0 */
239#define PCI_PM_CTRL_PME_ENABLE 0x0100 /* PME pin enable */ 239#define PCI_PM_CTRL_PME_ENABLE 0x0100 /* PME pin enable */
240#define PCI_PM_CTRL_DATA_SEL_MASK 0x1e00 /* Data select (??) */ 240#define PCI_PM_CTRL_DATA_SEL_MASK 0x1e00 /* Data select (??) */
241#define PCI_PM_CTRL_DATA_SCALE_MASK 0x6000 /* Data scale (??) */ 241#define PCI_PM_CTRL_DATA_SCALE_MASK 0x6000 /* Data scale (??) */
@@ -375,6 +375,7 @@
375#define PCI_EXP_TYPE_UPSTREAM 0x5 /* Upstream Port */ 375#define PCI_EXP_TYPE_UPSTREAM 0x5 /* Upstream Port */
376#define PCI_EXP_TYPE_DOWNSTREAM 0x6 /* Downstream Port */ 376#define PCI_EXP_TYPE_DOWNSTREAM 0x6 /* Downstream Port */
377#define PCI_EXP_TYPE_PCI_BRIDGE 0x7 /* PCI/PCI-X Bridge */ 377#define PCI_EXP_TYPE_PCI_BRIDGE 0x7 /* PCI/PCI-X Bridge */
378#define PCI_EXP_TYPE_RC_END 0x9 /* Root Complex Integrated Endpoint */
378#define PCI_EXP_FLAGS_SLOT 0x0100 /* Slot implemented */ 379#define PCI_EXP_FLAGS_SLOT 0x0100 /* Slot implemented */
379#define PCI_EXP_FLAGS_IRQ 0x3e00 /* Interrupt message number */ 380#define PCI_EXP_FLAGS_IRQ 0x3e00 /* Interrupt message number */
380#define PCI_EXP_DEVCAP 4 /* Device capabilities */ 381#define PCI_EXP_DEVCAP 4 /* Device capabilities */
@@ -487,6 +488,8 @@
487#define PCI_EXP_DEVCAP2_ARI 0x20 /* Alternative Routing-ID */ 488#define PCI_EXP_DEVCAP2_ARI 0x20 /* Alternative Routing-ID */
488#define PCI_EXP_DEVCTL2 40 /* Device Control 2 */ 489#define PCI_EXP_DEVCTL2 40 /* Device Control 2 */
489#define PCI_EXP_DEVCTL2_ARI 0x20 /* Alternative Routing-ID */ 490#define PCI_EXP_DEVCTL2_ARI 0x20 /* Alternative Routing-ID */
491#define PCI_EXP_LNKCTL2 48 /* Link Control 2 */
492#define PCI_EXP_SLTCTL2 56 /* Slot Control 2 */
490 493
491/* Extended Capabilities (PCI-X 2.0 and Express) */ 494/* Extended Capabilities (PCI-X 2.0 and Express) */
492#define PCI_EXT_CAP_ID(header) (header & 0x0000ffff) 495#define PCI_EXT_CAP_ID(header) (header & 0x0000ffff)
@@ -498,6 +501,7 @@
498#define PCI_EXT_CAP_ID_DSN 3 501#define PCI_EXT_CAP_ID_DSN 3
499#define PCI_EXT_CAP_ID_PWR 4 502#define PCI_EXT_CAP_ID_PWR 4
500#define PCI_EXT_CAP_ID_ARI 14 503#define PCI_EXT_CAP_ID_ARI 14
504#define PCI_EXT_CAP_ID_SRIOV 16
501 505
502/* Advanced Error Reporting */ 506/* Advanced Error Reporting */
503#define PCI_ERR_UNCOR_STATUS 4 /* Uncorrectable Error Status */ 507#define PCI_ERR_UNCOR_STATUS 4 /* Uncorrectable Error Status */
@@ -615,4 +619,35 @@
615#define PCI_ARI_CTRL_ACS 0x0002 /* ACS Function Groups Enable */ 619#define PCI_ARI_CTRL_ACS 0x0002 /* ACS Function Groups Enable */
616#define PCI_ARI_CTRL_FG(x) (((x) >> 4) & 7) /* Function Group */ 620#define PCI_ARI_CTRL_FG(x) (((x) >> 4) & 7) /* Function Group */
617 621
622/* Single Root I/O Virtualization */
623#define PCI_SRIOV_CAP 0x04 /* SR-IOV Capabilities */
624#define PCI_SRIOV_CAP_VFM 0x01 /* VF Migration Capable */
625#define PCI_SRIOV_CAP_INTR(x) ((x) >> 21) /* Interrupt Message Number */
626#define PCI_SRIOV_CTRL 0x08 /* SR-IOV Control */
627#define PCI_SRIOV_CTRL_VFE 0x01 /* VF Enable */
628#define PCI_SRIOV_CTRL_VFM 0x02 /* VF Migration Enable */
629#define PCI_SRIOV_CTRL_INTR 0x04 /* VF Migration Interrupt Enable */
630#define PCI_SRIOV_CTRL_MSE 0x08 /* VF Memory Space Enable */
631#define PCI_SRIOV_CTRL_ARI 0x10 /* ARI Capable Hierarchy */
632#define PCI_SRIOV_STATUS 0x0a /* SR-IOV Status */
633#define PCI_SRIOV_STATUS_VFM 0x01 /* VF Migration Status */
634#define PCI_SRIOV_INITIAL_VF 0x0c /* Initial VFs */
635#define PCI_SRIOV_TOTAL_VF 0x0e /* Total VFs */
636#define PCI_SRIOV_NUM_VF 0x10 /* Number of VFs */
637#define PCI_SRIOV_FUNC_LINK 0x12 /* Function Dependency Link */
638#define PCI_SRIOV_VF_OFFSET 0x14 /* First VF Offset */
639#define PCI_SRIOV_VF_STRIDE 0x16 /* Following VF Stride */
640#define PCI_SRIOV_VF_DID 0x1a /* VF Device ID */
641#define PCI_SRIOV_SUP_PGSIZE 0x1c /* Supported Page Sizes */
642#define PCI_SRIOV_SYS_PGSIZE 0x20 /* System Page Size */
643#define PCI_SRIOV_BAR 0x24 /* VF BAR0 */
644#define PCI_SRIOV_NUM_BARS 6 /* Number of VF BARs */
645#define PCI_SRIOV_VFM 0x3c /* VF Migration State Array Offset*/
646#define PCI_SRIOV_VFM_BIR(x) ((x) & 7) /* State BIR */
647#define PCI_SRIOV_VFM_OFFSET(x) ((x) & ~7) /* State Offset */
648#define PCI_SRIOV_VFM_UA 0x0 /* Inactive.Unavailable */
649#define PCI_SRIOV_VFM_MI 0x1 /* Dormant.MigrateIn */
650#define PCI_SRIOV_VFM_MO 0x2 /* Active.MigrateOut */
651#define PCI_SRIOV_VFM_AV 0x3 /* Active.Available */
652
618#endif /* LINUX_PCI_REGS_H */ 653#endif /* LINUX_PCI_REGS_H */
diff --git a/include/linux/pcieport_if.h b/include/linux/pcieport_if.h
index 6cd91e3f9820..b4c79545330b 100644
--- a/include/linux/pcieport_if.h
+++ b/include/linux/pcieport_if.h
@@ -16,29 +16,30 @@
16#define PCIE_ANY_PORT 7 16#define PCIE_ANY_PORT 7
17 17
18/* Service Type */ 18/* Service Type */
19#define PCIE_PORT_SERVICE_PME 1 /* Power Management Event */ 19#define PCIE_PORT_SERVICE_PME_SHIFT 0 /* Power Management Event */
20#define PCIE_PORT_SERVICE_AER 2 /* Advanced Error Reporting */ 20#define PCIE_PORT_SERVICE_PME (1 << PCIE_PORT_SERVICE_PME_SHIFT)
21#define PCIE_PORT_SERVICE_HP 4 /* Native Hotplug */ 21#define PCIE_PORT_SERVICE_AER_SHIFT 1 /* Advanced Error Reporting */
22#define PCIE_PORT_SERVICE_VC 8 /* Virtual Channel */ 22#define PCIE_PORT_SERVICE_AER (1 << PCIE_PORT_SERVICE_AER_SHIFT)
23#define PCIE_PORT_SERVICE_HP_SHIFT 2 /* Native Hotplug */
24#define PCIE_PORT_SERVICE_HP (1 << PCIE_PORT_SERVICE_HP_SHIFT)
25#define PCIE_PORT_SERVICE_VC_SHIFT 3 /* Virtual Channel */
26#define PCIE_PORT_SERVICE_VC (1 << PCIE_PORT_SERVICE_VC_SHIFT)
23 27
24/* Root/Upstream/Downstream Port's Interrupt Mode */ 28/* Root/Upstream/Downstream Port's Interrupt Mode */
29#define PCIE_PORT_NO_IRQ (-1)
25#define PCIE_PORT_INTx_MODE 0 30#define PCIE_PORT_INTx_MODE 0
26#define PCIE_PORT_MSI_MODE 1 31#define PCIE_PORT_MSI_MODE 1
27#define PCIE_PORT_MSIX_MODE 2 32#define PCIE_PORT_MSIX_MODE 2
28 33
29struct pcie_port_service_id { 34struct pcie_port_data {
30 __u32 vendor, device; /* Vendor and device ID or PCI_ANY_ID*/ 35 int port_type; /* Type of the port */
31 __u32 subvendor, subdevice; /* Subsystem ID's or PCI_ANY_ID */ 36 int port_irq_mode; /* [0:INTx | 1:MSI | 2:MSI-X] */
32 __u32 class, class_mask; /* (class,subclass,prog-if) triplet */
33 __u32 port_type, service_type; /* Port Entity */
34 kernel_ulong_t driver_data;
35}; 37};
36 38
37struct pcie_device { 39struct pcie_device {
38 int irq; /* Service IRQ/MSI/MSI-X Vector */ 40 int irq; /* Service IRQ/MSI/MSI-X Vector */
39 int interrupt_mode; /* [0:INTx | 1:MSI | 2:MSI-X] */ 41 struct pci_dev *port; /* Root/Upstream/Downstream Port */
40 struct pcie_port_service_id id; /* Service ID */ 42 u32 service; /* Port service this device represents */
41 struct pci_dev *port; /* Root/Upstream/Downstream Port */
42 void *priv_data; /* Service Private Data */ 43 void *priv_data; /* Service Private Data */
43 struct device device; /* Generic Device Interface */ 44 struct device device; /* Generic Device Interface */
44}; 45};
@@ -56,10 +57,9 @@ static inline void* get_service_data(struct pcie_device *dev)
56 57
57struct pcie_port_service_driver { 58struct pcie_port_service_driver {
58 const char *name; 59 const char *name;
59 int (*probe) (struct pcie_device *dev, 60 int (*probe) (struct pcie_device *dev);
60 const struct pcie_port_service_id *id);
61 void (*remove) (struct pcie_device *dev); 61 void (*remove) (struct pcie_device *dev);
62 int (*suspend) (struct pcie_device *dev, pm_message_t state); 62 int (*suspend) (struct pcie_device *dev);
63 int (*resume) (struct pcie_device *dev); 63 int (*resume) (struct pcie_device *dev);
64 64
65 /* Service Error Recovery Handler */ 65 /* Service Error Recovery Handler */
@@ -68,7 +68,9 @@ struct pcie_port_service_driver {
68 /* Link Reset Capability - AER service driver specific */ 68 /* Link Reset Capability - AER service driver specific */
69 pci_ers_result_t (*reset_link) (struct pci_dev *dev); 69 pci_ers_result_t (*reset_link) (struct pci_dev *dev);
70 70
71 const struct pcie_port_service_id *id_table; 71 int port_type; /* Type of the port this driver can handle */
72 u32 service; /* Port service this device represents */
73
72 struct device_driver driver; 74 struct device_driver driver;
73}; 75};
74#define to_service_driver(d) \ 76#define to_service_driver(d) \