diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2009-04-01 12:47:12 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-04-01 12:47:12 -0400 |
commit | e76e5b2c663ac74ae6a542ac20795c625e36a5cd (patch) | |
tree | 2e7271be1f3a26832f4b121839fc4044fbbf27a6 /include/linux | |
parent | 32527bc0e4b4fa7711ad1c923cf64ae72a7ffd9d (diff) | |
parent | eeafda70bf2807544e96fa4e52b2433cd470ff46 (diff) |
Merge branch 'linux-next' of git://git.kernel.org/pub/scm/linux/kernel/git/jbarnes/pci-2.6
* 'linux-next' of git://git.kernel.org/pub/scm/linux/kernel/git/jbarnes/pci-2.6: (88 commits)
PCI: fix HT MSI mapping fix
PCI: don't enable too much HT MSI mapping
x86/PCI: make pci=lastbus=255 work when acpi is on
PCI: save and restore PCIe 2.0 registers
PCI: update fakephp for bus_id removal
PCI: fix kernel oops on bridge removal
PCI: fix conflict between SR-IOV and config space sizing
powerpc/PCI: include pci.h in powerpc MSI implementation
PCI Hotplug: schedule fakephp for feature removal
PCI Hotplug: rename legacy_fakephp to fakephp
PCI Hotplug: restore fakephp interface with complete reimplementation
PCI: Introduce /sys/bus/pci/devices/.../rescan
PCI: Introduce /sys/bus/pci/devices/.../remove
PCI: Introduce /sys/bus/pci/rescan
PCI: Introduce pci_rescan_bus()
PCI: do not enable bridges more than once
PCI: do not initialize bridges more than once
PCI: always scan child buses
PCI: pci_scan_slot() returns newly found devices
PCI: don't scan existing devices
...
Fix trivial append-only conflict in Documentation/feature-removal-schedule.txt
Diffstat (limited to 'include/linux')
-rw-r--r-- | include/linux/acpi.h | 34 | ||||
-rw-r--r-- | include/linux/msi.h | 13 | ||||
-rw-r--r-- | include/linux/pci-acpi.h | 67 | ||||
-rw-r--r-- | include/linux/pci.h | 61 | ||||
-rw-r--r-- | include/linux/pci_ids.h | 1 | ||||
-rw-r--r-- | include/linux/pci_regs.h | 37 | ||||
-rw-r--r-- | include/linux/pcieport_if.h | 36 |
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); | |||
257 | void __init acpi_old_suspend_ordering(void); | 257 | void __init acpi_old_suspend_ordering(void); |
258 | void __init acpi_s4_no_nvs(void); | 258 | void __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 | |||
293 | extern acpi_status acpi_pci_osc_control_set(acpi_handle handle, u32 flags); | ||
260 | #else /* CONFIG_ACPI */ | 294 | #else /* CONFIG_ACPI */ |
261 | 295 | ||
262 | static inline int early_acpi_boot_init(void) | 296 | static 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 | ||
21 | struct msi_desc { | 21 | struct 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 |
52 | extern acpi_status pci_osc_control_set(acpi_handle handle, u32 flags); | ||
53 | int pci_acpi_osc_support(acpi_handle handle, u32 flags); | ||
54 | static inline acpi_handle acpi_find_root_bridge_handle(struct pci_dev *pdev) | 14 | static 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 | ||
64 | static inline acpi_handle acpi_pci_get_bridge_handle(struct pci_bus *pbus) | 24 | static 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) | ||
74 | typedef u32 acpi_status; | ||
75 | #define AE_ERROR (acpi_status) (0x0001) | ||
76 | #endif | ||
77 | static inline acpi_status pci_osc_control_set(acpi_handle handle, u32 flags) | ||
78 | {return AE_ERROR;} | ||
79 | static inline acpi_handle acpi_find_root_bridge_handle(struct pci_dev *pdev) | 32 | static 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 | ||
181 | struct pcie_link_state; | 188 | struct pcie_link_state; |
182 | struct pci_vpd; | 189 | struct pci_vpd; |
190 | struct 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 | ||
275 | extern struct pci_dev *alloc_pci_dev(void); | 291 | extern 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 | */ | ||
364 | static 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 |
345 | static inline bool pci_dev_msi_enabled(struct pci_dev *pci_dev) | 370 | static 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 | ||
530 | extern struct pci_bus *pci_find_bus(int domain, int busnr); | 555 | extern struct pci_bus *pci_find_bus(int domain, int busnr); |
531 | void pci_bus_add_devices(struct pci_bus *bus); | 556 | void pci_bus_add_devices(const struct pci_bus *bus); |
532 | struct pci_bus *pci_scan_bus_parented(struct device *parent, int bus, | 557 | struct 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); |
534 | static inline struct pci_bus * __devinit pci_scan_bus(int bus, struct pci_ops *ops, | 559 | static 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 */ |
704 | int pci_bus_find_capability(struct pci_bus *bus, unsigned int devfn, int cap); | 729 | int pci_bus_find_capability(struct pci_bus *bus, unsigned int devfn, int cap); |
730 | #ifdef CONFIG_HOTPLUG | ||
731 | unsigned int pci_rescan_bus(struct pci_bus *bus); | ||
732 | #endif | ||
705 | 733 | ||
706 | /* Vital product data routines */ | 734 | /* Vital product data routines */ |
707 | ssize_t pci_read_vpd(struct pci_dev *dev, loff_t pos, size_t count, void *buf); | 735 | ssize_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 | |||
709 | int pci_vpd_truncate(struct pci_dev *dev, size_t size); | 737 | int 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) */ |
712 | void pci_bus_assign_resources(struct pci_bus *bus); | 740 | void pci_bus_assign_resources(const struct pci_bus *bus); |
713 | void pci_bus_size_bridges(struct pci_bus *bus); | 741 | void pci_bus_size_bridges(struct pci_bus *bus); |
714 | int pci_claim_resource(struct pci_dev *, int); | 742 | int pci_claim_resource(struct pci_dev *, int); |
715 | void pci_assign_unassigned_resources(void); | 743 | void 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 |
793 | static inline int pci_enable_msi(struct pci_dev *dev) | 821 | static 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) | |||
800 | static inline void pci_disable_msi(struct pci_dev *dev) | 828 | static inline void pci_disable_msi(struct pci_dev *dev) |
801 | { } | 829 | { } |
802 | 830 | ||
831 | static inline int pci_msix_table_size(struct pci_dev *dev) | ||
832 | { | ||
833 | return 0; | ||
834 | } | ||
803 | static inline int pci_enable_msix(struct pci_dev *dev, | 835 | static 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 |
824 | extern int pci_enable_msi(struct pci_dev *dev); | 856 | extern int pci_enable_msi_block(struct pci_dev *dev, unsigned int nvec); |
825 | extern void pci_msi_shutdown(struct pci_dev *dev); | 857 | extern void pci_msi_shutdown(struct pci_dev *dev); |
826 | extern void pci_disable_msi(struct pci_dev *dev); | 858 | extern void pci_disable_msi(struct pci_dev *dev); |
859 | extern int pci_msix_table_size(struct pci_dev *dev); | ||
827 | extern int pci_enable_msix(struct pci_dev *dev, | 860 | extern int pci_enable_msix(struct pci_dev *dev, |
828 | struct msix_entry *entries, int nvec); | 861 | struct msix_entry *entries, int nvec); |
829 | extern void pci_msix_shutdown(struct pci_dev *dev); | 862 | extern void pci_msix_shutdown(struct pci_dev *dev); |
@@ -842,6 +875,8 @@ static inline int pcie_aspm_enabled(void) | |||
842 | extern int pcie_aspm_enabled(void); | 875 | extern 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 */ |
847 | int ht_create_irq(struct pci_dev *dev, int idx); | 882 | int ht_create_irq(struct pci_dev *dev, int idx); |
@@ -1195,5 +1230,23 @@ int pci_ext_cfg_avail(struct pci_dev *dev); | |||
1195 | 1230 | ||
1196 | void __iomem *pci_ioremap_bar(struct pci_dev *pdev, int bar); | 1231 | void __iomem *pci_ioremap_bar(struct pci_dev *pdev, int bar); |
1197 | 1232 | ||
1233 | #ifdef CONFIG_PCI_IOV | ||
1234 | extern int pci_enable_sriov(struct pci_dev *dev, int nr_virtfn); | ||
1235 | extern void pci_disable_sriov(struct pci_dev *dev); | ||
1236 | extern irqreturn_t pci_sriov_migration(struct pci_dev *dev); | ||
1237 | #else | ||
1238 | static inline int pci_enable_sriov(struct pci_dev *dev, int nr_virtfn) | ||
1239 | { | ||
1240 | return -ENODEV; | ||
1241 | } | ||
1242 | static inline void pci_disable_sriov(struct pci_dev *dev) | ||
1243 | { | ||
1244 | } | ||
1245 | static 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 | ||
29 | struct pcie_port_service_id { | 34 | struct 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 | ||
37 | struct pcie_device { | 39 | struct 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 | ||
57 | struct pcie_port_service_driver { | 58 | struct 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) \ |