aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2009-09-16 10:49:54 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2009-09-16 10:49:54 -0400
commit4406c56d0a4da7a37b9180abeaece6cd00bcc874 (patch)
tree65a85fa73a25d24cbed6d163fdcf8df1b934a0be /include
parent6b7b352f2102e21f9d8f38e932f01d9c5705c073 (diff)
parent5e3573db2bd5db6925159279d99576a4635bdb66 (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: (75 commits) PCI hotplug: clean up acpi_run_hpp() PCI hotplug: acpiphp: use generic pci_configure_slot() PCI hotplug: shpchp: use generic pci_configure_slot() PCI hotplug: pciehp: use generic pci_configure_slot() PCI hotplug: add pci_configure_slot() PCI hotplug: clean up acpi_get_hp_params_from_firmware() interface PCI hotplug: acpiphp: don't cache hotplug_params in acpiphp_bridge PCI hotplug: acpiphp: remove superfluous _HPP/_HPX evaluation PCI: Clear saved_state after the state has been restored PCI PM: Return error codes from pci_pm_resume() PCI: use dev_printk in quirk messages PCI / PCIe portdrv: Fix pcie_portdrv_slot_reset() PCI Hotplug: convert acpi_pci_detect_ejectable() to take an acpi_handle PCI Hotplug: acpiphp: find bridges the easy way PCI: pcie portdrv: remove unused variable PCI / ACPI PM: Propagate wake-up enable for devices w/o ACPI support ACPI PM: Replace wakeup.prepared with reference counter PCI PM: Introduce device flag wakeup_prepared PCI / ACPI PM: Rework some debug messages PCI PM: Simplify PCI wake-up code ... Fixed up conflict in arch/powerpc/kernel/pci_64.c due to OF device tree scanning having been moved and merged for the 32- and 64-bit cases. The 'needs_freset' initialization added in 6e19314cc ("PCI/powerpc: support PCIe fundamental reset") is now in arch/powerpc/kernel/pci_of_scan.c.
Diffstat (limited to 'include')
-rw-r--r--include/acpi/acpi_bus.h18
-rw-r--r--include/asm-generic/pci.h13
-rw-r--r--include/linux/pci.h14
-rw-r--r--include/linux/pci_hotplug.h16
-rw-r--r--include/linux/pci_ids.h3
-rw-r--r--include/linux/vgaarb.h200
6 files changed, 258 insertions, 6 deletions
diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h
index c65e4ce6c3af..1fa3ffb7c93b 100644
--- a/include/acpi/acpi_bus.h
+++ b/include/acpi/acpi_bus.h
@@ -248,7 +248,6 @@ struct acpi_device_perf {
248/* Wakeup Management */ 248/* Wakeup Management */
249struct acpi_device_wakeup_flags { 249struct acpi_device_wakeup_flags {
250 u8 valid:1; /* Can successfully enable wakeup? */ 250 u8 valid:1; /* Can successfully enable wakeup? */
251 u8 prepared:1; /* Has the wake-up capability been enabled? */
252 u8 run_wake:1; /* Run-Wake GPE devices */ 251 u8 run_wake:1; /* Run-Wake GPE devices */
253}; 252};
254 253
@@ -263,6 +262,7 @@ struct acpi_device_wakeup {
263 struct acpi_handle_list resources; 262 struct acpi_handle_list resources;
264 struct acpi_device_wakeup_state state; 263 struct acpi_device_wakeup_state state;
265 struct acpi_device_wakeup_flags flags; 264 struct acpi_device_wakeup_flags flags;
265 int prepare_count;
266}; 266};
267 267
268/* Device */ 268/* Device */
@@ -369,10 +369,26 @@ int register_acpi_bus_type(struct acpi_bus_type *);
369int unregister_acpi_bus_type(struct acpi_bus_type *); 369int unregister_acpi_bus_type(struct acpi_bus_type *);
370struct device *acpi_get_physical_device(acpi_handle); 370struct device *acpi_get_physical_device(acpi_handle);
371 371
372struct acpi_pci_root {
373 struct list_head node;
374 struct acpi_device * device;
375 struct acpi_pci_id id;
376 struct pci_bus *bus;
377 u16 segment;
378 u8 bus_nr;
379
380 u32 osc_support_set; /* _OSC state of support bits */
381 u32 osc_control_set; /* _OSC state of control bits */
382 u32 osc_control_qry; /* the latest _OSC query result */
383
384 u32 osc_queried:1; /* has _OSC control been queried? */
385};
386
372/* helper */ 387/* helper */
373acpi_handle acpi_get_child(acpi_handle, acpi_integer); 388acpi_handle acpi_get_child(acpi_handle, acpi_integer);
374int acpi_is_root_bridge(acpi_handle); 389int acpi_is_root_bridge(acpi_handle);
375acpi_handle acpi_get_pci_rootbridge_handle(unsigned int, unsigned int); 390acpi_handle acpi_get_pci_rootbridge_handle(unsigned int, unsigned int);
391struct acpi_pci_root *acpi_pci_find_root(acpi_handle handle);
376#define DEVICE_ACPI_HANDLE(dev) ((acpi_handle)((dev)->archdata.acpi_handle)) 392#define DEVICE_ACPI_HANDLE(dev) ((acpi_handle)((dev)->archdata.acpi_handle))
377 393
378#ifdef CONFIG_PM_SLEEP 394#ifdef CONFIG_PM_SLEEP
diff --git a/include/asm-generic/pci.h b/include/asm-generic/pci.h
index b4326b5466eb..26373cff4546 100644
--- a/include/asm-generic/pci.h
+++ b/include/asm-generic/pci.h
@@ -30,7 +30,18 @@ pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res,
30 res->end = region->end; 30 res->end = region->end;
31} 31}
32 32
33#define pcibios_scan_all_fns(a, b) 0 33static inline struct resource *
34pcibios_select_root(struct pci_dev *pdev, struct resource *res)
35{
36 struct resource *root = NULL;
37
38 if (res->flags & IORESOURCE_IO)
39 root = &ioport_resource;
40 if (res->flags & IORESOURCE_MEM)
41 root = &iomem_resource;
42
43 return root;
44}
34 45
35#ifndef HAVE_ARCH_PCI_GET_LEGACY_IDE_IRQ 46#ifndef HAVE_ARCH_PCI_GET_LEGACY_IDE_IRQ
36static inline int pci_get_legacy_ide_irq(struct pci_dev *dev, int channel) 47static inline int pci_get_legacy_ide_irq(struct pci_dev *dev, int channel)
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 115fb7ba5089..f5c7cd343e56 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -241,6 +241,7 @@ struct pci_dev {
241 unsigned int d1_support:1; /* Low power state D1 is supported */ 241 unsigned int d1_support:1; /* Low power state D1 is supported */
242 unsigned int d2_support:1; /* Low power state D2 is supported */ 242 unsigned int d2_support:1; /* Low power state D2 is supported */
243 unsigned int no_d1d2:1; /* Only allow D0 and D3 */ 243 unsigned int no_d1d2:1; /* Only allow D0 and D3 */
244 unsigned int wakeup_prepared:1;
244 245
245#ifdef CONFIG_PCIEASPM 246#ifdef CONFIG_PCIEASPM
246 struct pcie_link_state *link_state; /* ASPM link state. */ 247 struct pcie_link_state *link_state; /* ASPM link state. */
@@ -273,9 +274,12 @@ struct pci_dev {
273 unsigned int ari_enabled:1; /* ARI forwarding */ 274 unsigned int ari_enabled:1; /* ARI forwarding */
274 unsigned int is_managed:1; 275 unsigned int is_managed:1;
275 unsigned int is_pcie:1; 276 unsigned int is_pcie:1;
277 unsigned int needs_freset:1; /* Dev requires fundamental reset */
276 unsigned int state_saved:1; 278 unsigned int state_saved:1;
277 unsigned int is_physfn:1; 279 unsigned int is_physfn:1;
278 unsigned int is_virtfn:1; 280 unsigned int is_virtfn:1;
281 unsigned int reset_fn:1;
282 unsigned int is_hotplug_bridge:1;
279 pci_dev_flags_t dev_flags; 283 pci_dev_flags_t dev_flags;
280 atomic_t enable_cnt; /* pci_enable_device has been called */ 284 atomic_t enable_cnt; /* pci_enable_device has been called */
281 285
@@ -794,6 +798,11 @@ int __must_check __pci_register_driver(struct pci_driver *, struct module *,
794void pci_unregister_driver(struct pci_driver *dev); 798void pci_unregister_driver(struct pci_driver *dev);
795void pci_remove_behind_bridge(struct pci_dev *dev); 799void pci_remove_behind_bridge(struct pci_dev *dev);
796struct pci_driver *pci_dev_driver(const struct pci_dev *dev); 800struct pci_driver *pci_dev_driver(const struct pci_dev *dev);
801int pci_add_dynid(struct pci_driver *drv,
802 unsigned int vendor, unsigned int device,
803 unsigned int subvendor, unsigned int subdevice,
804 unsigned int class, unsigned int class_mask,
805 unsigned long driver_data);
797const struct pci_device_id *pci_match_id(const struct pci_device_id *ids, 806const struct pci_device_id *pci_match_id(const struct pci_device_id *ids,
798 struct pci_dev *dev); 807 struct pci_dev *dev);
799int pci_scan_bridge(struct pci_bus *bus, struct pci_dev *dev, int max, 808int pci_scan_bridge(struct pci_bus *bus, struct pci_dev *dev, int max,
@@ -805,6 +814,8 @@ int pci_cfg_space_size_ext(struct pci_dev *dev);
805int pci_cfg_space_size(struct pci_dev *dev); 814int pci_cfg_space_size(struct pci_dev *dev);
806unsigned char pci_bus_max_busnr(struct pci_bus *bus); 815unsigned char pci_bus_max_busnr(struct pci_bus *bus);
807 816
817int pci_set_vga_state(struct pci_dev *pdev, bool decode,
818 unsigned int command_bits, bool change_bridge);
808/* kmem_cache style wrapper around pci_alloc_consistent() */ 819/* kmem_cache style wrapper around pci_alloc_consistent() */
809 820
810#include <linux/dmapool.h> 821#include <linux/dmapool.h>
@@ -1236,6 +1247,9 @@ extern int pci_pci_problems;
1236extern unsigned long pci_cardbus_io_size; 1247extern unsigned long pci_cardbus_io_size;
1237extern unsigned long pci_cardbus_mem_size; 1248extern unsigned long pci_cardbus_mem_size;
1238 1249
1250extern unsigned long pci_hotplug_io_size;
1251extern unsigned long pci_hotplug_mem_size;
1252
1239int pcibios_add_platform_entries(struct pci_dev *dev); 1253int pcibios_add_platform_entries(struct pci_dev *dev);
1240void pcibios_disable_device(struct pci_dev *dev); 1254void pcibios_disable_device(struct pci_dev *dev);
1241int pcibios_set_pcie_reset_state(struct pci_dev *dev, 1255int pcibios_set_pcie_reset_state(struct pci_dev *dev,
diff --git a/include/linux/pci_hotplug.h b/include/linux/pci_hotplug.h
index 4391741b99dc..652ba797696d 100644
--- a/include/linux/pci_hotplug.h
+++ b/include/linux/pci_hotplug.h
@@ -62,7 +62,8 @@ enum pcie_link_width {
62}; 62};
63 63
64enum pcie_link_speed { 64enum pcie_link_speed {
65 PCIE_2PT5GB = 0x14, 65 PCIE_2_5GB = 0x14,
66 PCIE_5_0GB = 0x15,
66 PCIE_LNK_SPEED_UNKNOWN = 0xFF, 67 PCIE_LNK_SPEED_UNKNOWN = 0xFF,
67}; 68};
68 69
@@ -226,11 +227,18 @@ struct hotplug_params {
226#ifdef CONFIG_ACPI 227#ifdef CONFIG_ACPI
227#include <acpi/acpi.h> 228#include <acpi/acpi.h>
228#include <acpi/acpi_bus.h> 229#include <acpi/acpi_bus.h>
229extern acpi_status acpi_get_hp_params_from_firmware(struct pci_bus *bus, 230int pci_get_hp_params(struct pci_dev *dev, struct hotplug_params *hpp);
230 struct hotplug_params *hpp);
231int acpi_get_hp_hw_control_from_firmware(struct pci_dev *dev, u32 flags); 231int acpi_get_hp_hw_control_from_firmware(struct pci_dev *dev, u32 flags);
232int acpi_pci_check_ejectable(struct pci_bus *pbus, acpi_handle handle); 232int acpi_pci_check_ejectable(struct pci_bus *pbus, acpi_handle handle);
233int acpi_pci_detect_ejectable(struct pci_bus *pbus); 233int acpi_pci_detect_ejectable(acpi_handle handle);
234#else
235static inline int pci_get_hp_params(struct pci_dev *dev,
236 struct hotplug_params *hpp)
237{
238 return -ENODEV;
239}
234#endif 240#endif
241
242void pci_configure_slot(struct pci_dev *dev);
235#endif 243#endif
236 244
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index 0d96be93b926..8975add8668f 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -2,6 +2,9 @@
2 * PCI Class, Vendor and Device IDs 2 * PCI Class, Vendor and Device IDs
3 * 3 *
4 * Please keep sorted. 4 * Please keep sorted.
5 *
6 * Do not add new entries to this file unless the definitions
7 * are shared between multiple drivers.
5 */ 8 */
6 9
7/* Device classes and subclasses */ 10/* Device classes and subclasses */
diff --git a/include/linux/vgaarb.h b/include/linux/vgaarb.h
new file mode 100644
index 000000000000..e81c64af80c1
--- /dev/null
+++ b/include/linux/vgaarb.h
@@ -0,0 +1,200 @@
1/*
2 * vgaarb.c
3 *
4 * (C) Copyright 2005 Benjamin Herrenschmidt <benh@kernel.crashing.org>
5 * (C) Copyright 2007 Paulo R. Zanoni <przanoni@gmail.com>
6 * (C) Copyright 2007, 2009 Tiago Vignatti <vignatti@freedesktop.org>
7 */
8
9#ifndef LINUX_VGA_H
10
11#include <asm/vga.h>
12
13/* Legacy VGA regions */
14#define VGA_RSRC_NONE 0x00
15#define VGA_RSRC_LEGACY_IO 0x01
16#define VGA_RSRC_LEGACY_MEM 0x02
17#define VGA_RSRC_LEGACY_MASK (VGA_RSRC_LEGACY_IO | VGA_RSRC_LEGACY_MEM)
18/* Non-legacy access */
19#define VGA_RSRC_NORMAL_IO 0x04
20#define VGA_RSRC_NORMAL_MEM 0x08
21
22/* Passing that instead of a pci_dev to use the system "default"
23 * device, that is the one used by vgacon. Archs will probably
24 * have to provide their own vga_default_device();
25 */
26#define VGA_DEFAULT_DEVICE (NULL)
27
28/* For use by clients */
29
30/**
31 * vga_set_legacy_decoding
32 *
33 * @pdev: pci device of the VGA card
34 * @decodes: bit mask of what legacy regions the card decodes
35 *
36 * Indicates to the arbiter if the card decodes legacy VGA IOs,
37 * legacy VGA Memory, both, or none. All cards default to both,
38 * the card driver (fbdev for example) should tell the arbiter
39 * if it has disabled legacy decoding, so the card can be left
40 * out of the arbitration process (and can be safe to take
41 * interrupts at any time.
42 */
43extern void vga_set_legacy_decoding(struct pci_dev *pdev,
44 unsigned int decodes);
45
46/**
47 * vga_get - acquire & locks VGA resources
48 *
49 * @pdev: pci device of the VGA card or NULL for the system default
50 * @rsrc: bit mask of resources to acquire and lock
51 * @interruptible: blocking should be interruptible by signals ?
52 *
53 * This function acquires VGA resources for the given
54 * card and mark those resources locked. If the resource requested
55 * are "normal" (and not legacy) resources, the arbiter will first check
56 * wether the card is doing legacy decoding for that type of resource. If
57 * yes, the lock is "converted" into a legacy resource lock.
58 * The arbiter will first look for all VGA cards that might conflict
59 * and disable their IOs and/or Memory access, inlcuding VGA forwarding
60 * on P2P bridges if necessary, so that the requested resources can
61 * be used. Then, the card is marked as locking these resources and
62 * the IO and/or Memory accesse are enabled on the card (including
63 * VGA forwarding on parent P2P bridges if any).
64 * This function will block if some conflicting card is already locking
65 * one of the required resources (or any resource on a different bus
66 * segment, since P2P bridges don't differenciate VGA memory and IO
67 * afaik). You can indicate wether this blocking should be interruptible
68 * by a signal (for userland interface) or not.
69 * Must not be called at interrupt time or in atomic context.
70 * If the card already owns the resources, the function succeeds.
71 * Nested calls are supported (a per-resource counter is maintained)
72 */
73
74extern int vga_get(struct pci_dev *pdev, unsigned int rsrc,
75 int interruptible);
76
77/**
78 * vga_get_interruptible
79 *
80 * Shortcut to vga_get
81 */
82
83static inline int vga_get_interruptible(struct pci_dev *pdev,
84 unsigned int rsrc)
85{
86 return vga_get(pdev, rsrc, 1);
87}
88
89/**
90 * vga_get_uninterruptible
91 *
92 * Shortcut to vga_get
93 */
94
95static inline int vga_get_uninterruptible(struct pci_dev *pdev,
96 unsigned int rsrc)
97{
98 return vga_get(pdev, rsrc, 0);
99}
100
101/**
102 * vga_tryget - try to acquire & lock legacy VGA resources
103 *
104 * @pdev: pci devivce of VGA card or NULL for system default
105 * @rsrc: bit mask of resources to acquire and lock
106 *
107 * This function performs the same operation as vga_get(), but
108 * will return an error (-EBUSY) instead of blocking if the resources
109 * are already locked by another card. It can be called in any context
110 */
111
112extern int vga_tryget(struct pci_dev *pdev, unsigned int rsrc);
113
114/**
115 * vga_put - release lock on legacy VGA resources
116 *
117 * @pdev: pci device of VGA card or NULL for system default
118 * @rsrc: but mask of resource to release
119 *
120 * This function releases resources previously locked by vga_get()
121 * or vga_tryget(). The resources aren't disabled right away, so
122 * that a subsequence vga_get() on the same card will succeed
123 * immediately. Resources have a counter, so locks are only
124 * released if the counter reaches 0.
125 */
126
127extern void vga_put(struct pci_dev *pdev, unsigned int rsrc);
128
129
130/**
131 * vga_default_device
132 *
133 * This can be defined by the platform. The default implementation
134 * is rather dumb and will probably only work properly on single
135 * vga card setups and/or x86 platforms.
136 *
137 * If your VGA default device is not PCI, you'll have to return
138 * NULL here. In this case, I assume it will not conflict with
139 * any PCI card. If this is not true, I'll have to define two archs
140 * hooks for enabling/disabling the VGA default device if that is
141 * possible. This may be a problem with real _ISA_ VGA cards, in
142 * addition to a PCI one. I don't know at this point how to deal
143 * with that card. Can theirs IOs be disabled at all ? If not, then
144 * I suppose it's a matter of having the proper arch hook telling
145 * us about it, so we basically never allow anybody to succeed a
146 * vga_get()...
147 */
148
149#ifndef __ARCH_HAS_VGA_DEFAULT_DEVICE
150extern struct pci_dev *vga_default_device(void);
151#endif
152
153/**
154 * vga_conflicts
155 *
156 * Architectures should define this if they have several
157 * independant PCI domains that can afford concurrent VGA
158 * decoding
159 */
160
161#ifndef __ARCH_HAS_VGA_CONFLICT
162static inline int vga_conflicts(struct pci_dev *p1, struct pci_dev *p2)
163{
164 return 1;
165}
166#endif
167
168/**
169 * vga_client_register
170 *
171 * @pdev: pci device of the VGA client
172 * @cookie: client cookie to be used in callbacks
173 * @irq_set_state: irq state change callback
174 * @set_vga_decode: vga decode change callback
175 *
176 * return value: 0 on success, -1 on failure
177 * Register a client with the VGA arbitration logic
178 *
179 * Clients have two callback mechanisms they can use.
180 * irq enable/disable callback -
181 * If a client can't disable its GPUs VGA resources, then we
182 * need to be able to ask it to turn off its irqs when we
183 * turn off its mem and io decoding.
184 * set_vga_decode
185 * If a client can disable its GPU VGA resource, it will
186 * get a callback from this to set the encode/decode state
187 *
188 * Rationale: we cannot disable VGA decode resources unconditionally
189 * some single GPU laptops seem to require ACPI or BIOS access to the
190 * VGA registers to control things like backlights etc.
191 * Hopefully newer multi-GPU laptops do something saner, and desktops
192 * won't have any special ACPI for this.
193 * They driver will get a callback when VGA arbitration is first used
194 * by userspace since we some older X servers have issues.
195 */
196int vga_client_register(struct pci_dev *pdev, void *cookie,
197 void (*irq_set_state)(void *cookie, bool state),
198 unsigned int (*set_vga_decode)(void *cookie, bool state));
199
200#endif /* LINUX_VGA_H */