aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/pci.h
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2008-07-16 20:25:46 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-07-16 20:25:46 -0400
commitdc7c65db2845a8d17432d89252c4227a9a7cb15f (patch)
tree79030b0aaaafc04bc4303c21495134e744afc058 /include/linux/pci.h
parent8a0ca91e1db5de5eb5b18cfa919d52ff8be375af (diff)
parent58b6e5538460be358fdf1286d9a2fbcfcc2cfaba (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: (72 commits) Revert "x86/PCI: ACPI based PCI gap calculation" PCI: remove unnecessary volatile in PCIe hotplug struct controller x86/PCI: ACPI based PCI gap calculation PCI: include linux/pm_wakeup.h for device_set_wakeup_capable PCI PM: Fix pci_prepare_to_sleep x86/PCI: Fix PCI config space for domains > 0 Fix acpi_pm_device_sleep_wake() by providing a stub for CONFIG_PM_SLEEP=n PCI: Simplify PCI device PM code PCI PM: Introduce pci_prepare_to_sleep and pci_back_from_sleep PCI ACPI: Rework PCI handling of wake-up ACPI: Introduce new device wakeup flag 'prepared' ACPI: Introduce acpi_device_sleep_wake function PCI: rework pci_set_power_state function to call platform first PCI: Introduce platform_pci_power_manageable function ACPI: Introduce acpi_bus_power_manageable function PCI: make pci_name use dev_name PCI: handle pci_name() being const PCI: add stub for pci_set_consistent_dma_mask() PCI: remove unused arch pcibios_update_resource() functions PCI: fix pci_setup_device()'s sprinting into a const buffer ... Fixed up conflicts in various files (arch/x86/kernel/setup_64.c, arch/x86/pci/irq.c, arch/x86/pci/pci.h, drivers/acpi/sleep/main.c, drivers/pci/pci.c, drivers/pci/pci.h, include/acpi/acpi_bus.h) from x86 and ACPI updates manually.
Diffstat (limited to 'include/linux/pci.h')
-rw-r--r--include/linux/pci.h57
1 files changed, 48 insertions, 9 deletions
diff --git a/include/linux/pci.h b/include/linux/pci.h
index d18b1dd49fab..a6a088e1a804 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -17,8 +17,7 @@
17#ifndef LINUX_PCI_H 17#ifndef LINUX_PCI_H
18#define LINUX_PCI_H 18#define LINUX_PCI_H
19 19
20/* Include the pci register defines */ 20#include <linux/pci_regs.h> /* The pci register defines */
21#include <linux/pci_regs.h>
22 21
23/* 22/*
24 * The PCI interface treats multi-function devices as independent 23 * The PCI interface treats multi-function devices as independent
@@ -49,12 +48,22 @@
49#include <linux/list.h> 48#include <linux/list.h>
50#include <linux/compiler.h> 49#include <linux/compiler.h>
51#include <linux/errno.h> 50#include <linux/errno.h>
51#include <linux/kobject.h>
52#include <asm/atomic.h> 52#include <asm/atomic.h>
53#include <linux/device.h> 53#include <linux/device.h>
54 54
55/* Include the ID list */ 55/* Include the ID list */
56#include <linux/pci_ids.h> 56#include <linux/pci_ids.h>
57 57
58/* pci_slot represents a physical slot */
59struct pci_slot {
60 struct pci_bus *bus; /* The bus this slot is on */
61 struct list_head list; /* node in list of slots on this bus */
62 struct hotplug_slot *hotplug; /* Hotplug info (migrate over time) */
63 unsigned char number; /* PCI_SLOT(pci_dev->devfn) */
64 struct kobject kobj;
65};
66
58/* File state for mmap()s on /proc/bus/pci/X/Y */ 67/* File state for mmap()s on /proc/bus/pci/X/Y */
59enum pci_mmap_state { 68enum pci_mmap_state {
60 pci_mmap_io, 69 pci_mmap_io,
@@ -142,6 +151,7 @@ struct pci_dev {
142 151
143 void *sysdata; /* hook for sys-specific extension */ 152 void *sysdata; /* hook for sys-specific extension */
144 struct proc_dir_entry *procent; /* device entry in /proc/bus/pci */ 153 struct proc_dir_entry *procent; /* device entry in /proc/bus/pci */
154 struct pci_slot *slot; /* Physical slot this device is in */
145 155
146 unsigned int devfn; /* encoded device & function index */ 156 unsigned int devfn; /* encoded device & function index */
147 unsigned short vendor; 157 unsigned short vendor;
@@ -167,6 +177,13 @@ struct pci_dev {
167 pci_power_t current_state; /* Current operating state. In ACPI-speak, 177 pci_power_t current_state; /* Current operating state. In ACPI-speak,
168 this is D0-D3, D0 being fully functional, 178 this is D0-D3, D0 being fully functional,
169 and D3 being off. */ 179 and D3 being off. */
180 int pm_cap; /* PM capability offset in the
181 configuration space */
182 unsigned int pme_support:5; /* Bitmask of states from which PME#
183 can be generated */
184 unsigned int d1_support:1; /* Low power state D1 is supported */
185 unsigned int d2_support:1; /* Low power state D2 is supported */
186 unsigned int no_d1d2:1; /* Only allow D0 and D3 */
170 187
171#ifdef CONFIG_PCIEASPM 188#ifdef CONFIG_PCIEASPM
172 struct pcie_link_state *link_state; /* ASPM link state. */ 189 struct pcie_link_state *link_state; /* ASPM link state. */
@@ -191,7 +208,6 @@ struct pci_dev {
191 unsigned int is_added:1; 208 unsigned int is_added:1;
192 unsigned int is_busmaster:1; /* device is busmaster */ 209 unsigned int is_busmaster:1; /* device is busmaster */
193 unsigned int no_msi:1; /* device may not use msi */ 210 unsigned int no_msi:1; /* device may not use msi */
194 unsigned int no_d1d2:1; /* only allow d0 or d3 */
195 unsigned int block_ucfg_access:1; /* userspace config space access is blocked */ 211 unsigned int block_ucfg_access:1; /* userspace config space access is blocked */
196 unsigned int broken_parity_status:1; /* Device generates false positive parity */ 212 unsigned int broken_parity_status:1; /* Device generates false positive parity */
197 unsigned int msi_enabled:1; 213 unsigned int msi_enabled:1;
@@ -267,6 +283,7 @@ struct pci_bus {
267 struct list_head children; /* list of child buses */ 283 struct list_head children; /* list of child buses */
268 struct list_head devices; /* list of devices on this bus */ 284 struct list_head devices; /* list of devices on this bus */
269 struct pci_dev *self; /* bridge device as seen by parent */ 285 struct pci_dev *self; /* bridge device as seen by parent */
286 struct list_head slots; /* list of slots on this bus */
270 struct resource *resource[PCI_BUS_NUM_RESOURCES]; 287 struct resource *resource[PCI_BUS_NUM_RESOURCES];
271 /* address space routed to this bus */ 288 /* address space routed to this bus */
272 289
@@ -328,7 +345,7 @@ struct pci_bus_region {
328struct pci_dynids { 345struct pci_dynids {
329 spinlock_t lock; /* protects list, index */ 346 spinlock_t lock; /* protects list, index */
330 struct list_head list; /* for IDs added at runtime */ 347 struct list_head list; /* for IDs added at runtime */
331 unsigned int use_driver_data:1; /* pci_driver->driver_data is used */ 348 unsigned int use_driver_data:1; /* pci_device_id->driver_data is used */
332}; 349};
333 350
334/* ---------------------------------------------------------------- */ 351/* ---------------------------------------------------------------- */
@@ -390,7 +407,7 @@ struct pci_driver {
390 int (*resume_early) (struct pci_dev *dev); 407 int (*resume_early) (struct pci_dev *dev);
391 int (*resume) (struct pci_dev *dev); /* Device woken up */ 408 int (*resume) (struct pci_dev *dev); /* Device woken up */
392 void (*shutdown) (struct pci_dev *dev); 409 void (*shutdown) (struct pci_dev *dev);
393 410 struct pm_ext_ops *pm;
394 struct pci_error_handlers *err_handler; 411 struct pci_error_handlers *err_handler;
395 struct device_driver driver; 412 struct device_driver driver;
396 struct pci_dynids dynids; 413 struct pci_dynids dynids;
@@ -489,6 +506,10 @@ struct pci_bus *pci_create_bus(struct device *parent, int bus,
489 struct pci_ops *ops, void *sysdata); 506 struct pci_ops *ops, void *sysdata);
490struct pci_bus *pci_add_new_bus(struct pci_bus *parent, struct pci_dev *dev, 507struct pci_bus *pci_add_new_bus(struct pci_bus *parent, struct pci_dev *dev,
491 int busnr); 508 int busnr);
509struct pci_slot *pci_create_slot(struct pci_bus *parent, int slot_nr,
510 const char *name);
511void pci_destroy_slot(struct pci_slot *slot);
512void pci_update_slot_number(struct pci_slot *slot, int slot_nr);
492int pci_scan_slot(struct pci_bus *bus, int devfn); 513int pci_scan_slot(struct pci_bus *bus, int devfn);
493struct pci_dev *pci_scan_single_device(struct pci_bus *bus, int devfn); 514struct pci_dev *pci_scan_single_device(struct pci_bus *bus, int devfn);
494void pci_device_add(struct pci_dev *dev, struct pci_bus *bus); 515void pci_device_add(struct pci_dev *dev, struct pci_bus *bus);
@@ -618,6 +639,8 @@ int pci_restore_state(struct pci_dev *dev);
618int pci_set_power_state(struct pci_dev *dev, pci_power_t state); 639int pci_set_power_state(struct pci_dev *dev, pci_power_t state);
619pci_power_t pci_choose_state(struct pci_dev *dev, pm_message_t state); 640pci_power_t pci_choose_state(struct pci_dev *dev, pm_message_t state);
620int pci_enable_wake(struct pci_dev *dev, pci_power_t state, int enable); 641int pci_enable_wake(struct pci_dev *dev, pci_power_t state, int enable);
642int pci_prepare_to_sleep(struct pci_dev *dev);
643int pci_back_from_sleep(struct pci_dev *dev);
621 644
622/* Functions for PCI Hotplug drivers to use */ 645/* Functions for PCI Hotplug drivers to use */
623int pci_bus_find_capability(struct pci_bus *bus, unsigned int devfn, int cap); 646int pci_bus_find_capability(struct pci_bus *bus, unsigned int devfn, int cap);
@@ -839,6 +862,11 @@ static inline int pci_set_dma_mask(struct pci_dev *dev, u64 mask)
839 return -EIO; 862 return -EIO;
840} 863}
841 864
865static inline int pci_set_consistent_dma_mask(struct pci_dev *dev, u64 mask)
866{
867 return -EIO;
868}
869
842static inline int pci_set_dma_max_seg_size(struct pci_dev *dev, 870static inline int pci_set_dma_max_seg_size(struct pci_dev *dev,
843 unsigned int size) 871 unsigned int size)
844{ 872{
@@ -977,9 +1005,9 @@ static inline void pci_set_drvdata(struct pci_dev *pdev, void *data)
977/* If you want to know what to call your pci_dev, ask this function. 1005/* If you want to know what to call your pci_dev, ask this function.
978 * Again, it's a wrapper around the generic device. 1006 * Again, it's a wrapper around the generic device.
979 */ 1007 */
980static inline char *pci_name(struct pci_dev *pdev) 1008static inline const char *pci_name(struct pci_dev *pdev)
981{ 1009{
982 return pdev->dev.bus_id; 1010 return dev_name(&pdev->dev);
983} 1011}
984 1012
985 1013
@@ -1014,7 +1042,9 @@ enum pci_fixup_pass {
1014 pci_fixup_header, /* After reading configuration header */ 1042 pci_fixup_header, /* After reading configuration header */
1015 pci_fixup_final, /* Final phase of device fixups */ 1043 pci_fixup_final, /* Final phase of device fixups */
1016 pci_fixup_enable, /* pci_enable_device() time */ 1044 pci_fixup_enable, /* pci_enable_device() time */
1017 pci_fixup_resume, /* pci_enable_device() time */ 1045 pci_fixup_resume, /* pci_device_resume() */
1046 pci_fixup_suspend, /* pci_device_suspend */
1047 pci_fixup_resume_early, /* pci_device_resume_early() */
1018}; 1048};
1019 1049
1020/* Anonymous variables would be nice... */ 1050/* Anonymous variables would be nice... */
@@ -1036,6 +1066,12 @@ enum pci_fixup_pass {
1036#define DECLARE_PCI_FIXUP_RESUME(vendor, device, hook) \ 1066#define DECLARE_PCI_FIXUP_RESUME(vendor, device, hook) \
1037 DECLARE_PCI_FIXUP_SECTION(.pci_fixup_resume, \ 1067 DECLARE_PCI_FIXUP_SECTION(.pci_fixup_resume, \
1038 resume##vendor##device##hook, vendor, device, hook) 1068 resume##vendor##device##hook, vendor, device, hook)
1069#define DECLARE_PCI_FIXUP_RESUME_EARLY(vendor, device, hook) \
1070 DECLARE_PCI_FIXUP_SECTION(.pci_fixup_resume_early, \
1071 resume_early##vendor##device##hook, vendor, device, hook)
1072#define DECLARE_PCI_FIXUP_SUSPEND(vendor, device, hook) \
1073 DECLARE_PCI_FIXUP_SECTION(.pci_fixup_suspend, \
1074 suspend##vendor##device##hook, vendor, device, hook)
1039 1075
1040 1076
1041void pci_fixup_device(enum pci_fixup_pass pass, struct pci_dev *dev); 1077void pci_fixup_device(enum pci_fixup_pass pass, struct pci_dev *dev);
@@ -1060,7 +1096,10 @@ extern int pci_pci_problems;
1060extern unsigned long pci_cardbus_io_size; 1096extern unsigned long pci_cardbus_io_size;
1061extern unsigned long pci_cardbus_mem_size; 1097extern unsigned long pci_cardbus_mem_size;
1062 1098
1063extern int pcibios_add_platform_entries(struct pci_dev *dev); 1099int pcibios_add_platform_entries(struct pci_dev *dev);
1100void pcibios_disable_device(struct pci_dev *dev);
1101int pcibios_set_pcie_reset_state(struct pci_dev *dev,
1102 enum pcie_reset_state state);
1064 1103
1065#ifdef CONFIG_PCI_MMCONFIG 1104#ifdef CONFIG_PCI_MMCONFIG
1066extern void __init pci_mmcfg_early_init(void); 1105extern void __init pci_mmcfg_early_init(void);