diff options
author | Linus Torvalds <torvalds@woody.osdl.org> | 2006-12-01 19:41:27 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.osdl.org> | 2006-12-01 19:41:27 -0500 |
commit | 72a73a69f6a79266b8b4b18f796907b73a5c01e3 (patch) | |
tree | 7684193f3c7f21b0ca14c430b8ead75b2c2025eb /drivers | |
parent | 4549df891a31b9a05b7d183106c09049b79327be (diff) | |
parent | 2b290da053608692ea206507d993b70c39d2cdea (diff) |
Merge master.kernel.org:/pub/scm/linux/kernel/git/gregkh/pci-2.6
* master.kernel.org:/pub/scm/linux/kernel/git/gregkh/pci-2.6: (28 commits)
PCI: make arch/i386/pci/common.c:pci_bf_sort static
PCI: ibmphp_pci.c: fix NULL dereference
pciehp: remove unnecessary pci_disable_msi
pciehp: remove unnecessary free_irq
PCI: rpaphp: change device tree examination
PCI: Change memory allocation for acpiphp slots
i2c-i801: SMBus patch for Intel ICH9
PCI: irq: irq and pci_ids patch for Intel ICH9
PCI: pci_{enable,disable}_device() nestable ports
PCI: switch pci_{enable,disable}_device() to be nestable
PCI: arch/i386/kernel/pci-dma.c: ioremap balanced with iounmap
pci/i386: style cleanups
PCI: Block on access to temporarily unavailable pci device
pci: fix __pci_register_driver error handling
pci: clear osc support flags if no _OSC method
acpiphp: fix missing acpiphp_glue_exit()
acpiphp: fix use of list_for_each macro
Altix: Initial ACPI support - ROM shadowing.
Altix: SN ACPI hotplug support.
Altix: Add initial ACPI IO support
...
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/i2c/busses/Kconfig | 1 | ||||
-rw-r--r-- | drivers/i2c/busses/i2c-i801.c | 2 | ||||
-rw-r--r-- | drivers/message/i2o/pci.c | 15 | ||||
-rw-r--r-- | drivers/pci/Kconfig | 2 | ||||
-rw-r--r-- | drivers/pci/access.c | 75 | ||||
-rw-r--r-- | drivers/pci/hotplug/acpiphp.h | 4 | ||||
-rw-r--r-- | drivers/pci/hotplug/acpiphp_core.c | 39 | ||||
-rw-r--r-- | drivers/pci/hotplug/acpiphp_glue.c | 8 | ||||
-rw-r--r-- | drivers/pci/hotplug/ibmphp_pci.c | 4 | ||||
-rw-r--r-- | drivers/pci/hotplug/pciehp_core.c | 7 | ||||
-rw-r--r-- | drivers/pci/hotplug/pciehp_hpc.c | 2 | ||||
-rw-r--r-- | drivers/pci/hotplug/rpadlpar_core.c | 2 | ||||
-rw-r--r-- | drivers/pci/hotplug/rpaphp_core.c | 2 | ||||
-rw-r--r-- | drivers/pci/hotplug/sgi_hotplug.c | 35 | ||||
-rw-r--r-- | drivers/pci/msi.h | 8 | ||||
-rw-r--r-- | drivers/pci/pci-acpi.c | 10 | ||||
-rw-r--r-- | drivers/pci/pci-driver.c | 11 | ||||
-rw-r--r-- | drivers/pci/pci-sysfs.c | 33 | ||||
-rw-r--r-- | drivers/pci/pci.c | 123 | ||||
-rw-r--r-- | drivers/pci/pci.h | 1 | ||||
-rw-r--r-- | drivers/pci/probe.c | 27 | ||||
-rw-r--r-- | drivers/pci/quirks.c | 59 | ||||
-rw-r--r-- | drivers/pci/rom.c | 9 |
23 files changed, 263 insertions, 216 deletions
diff --git a/drivers/i2c/busses/Kconfig b/drivers/i2c/busses/Kconfig index 510816c16da3..04bee524e31a 100644 --- a/drivers/i2c/busses/Kconfig +++ b/drivers/i2c/busses/Kconfig | |||
@@ -125,6 +125,7 @@ config I2C_I801 | |||
125 | ICH7 | 125 | ICH7 |
126 | ESB2 | 126 | ESB2 |
127 | ICH8 | 127 | ICH8 |
128 | ICH9 | ||
128 | 129 | ||
129 | This driver can also be built as a module. If so, the module | 130 | This driver can also be built as a module. If so, the module |
130 | will be called i2c-i801. | 131 | will be called i2c-i801. |
diff --git a/drivers/i2c/busses/i2c-i801.c b/drivers/i2c/busses/i2c-i801.c index bbb2fbee836f..c7be2fdbd86b 100644 --- a/drivers/i2c/busses/i2c-i801.c +++ b/drivers/i2c/busses/i2c-i801.c | |||
@@ -33,6 +33,7 @@ | |||
33 | ICH7 27DA | 33 | ICH7 27DA |
34 | ESB2 269B | 34 | ESB2 269B |
35 | ICH8 283E | 35 | ICH8 283E |
36 | ICH9 2930 | ||
36 | This driver supports several versions of Intel's I/O Controller Hubs (ICH). | 37 | This driver supports several versions of Intel's I/O Controller Hubs (ICH). |
37 | For SMBus support, they are similar to the PIIX4 and are part | 38 | For SMBus support, they are similar to the PIIX4 and are part |
38 | of Intel's '810' and other chipsets. | 39 | of Intel's '810' and other chipsets. |
@@ -457,6 +458,7 @@ static struct pci_device_id i801_ids[] = { | |||
457 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH7_17) }, | 458 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH7_17) }, |
458 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ESB2_17) }, | 459 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ESB2_17) }, |
459 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH8_5) }, | 460 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH8_5) }, |
461 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH9_6) }, | ||
460 | { 0, } | 462 | { 0, } |
461 | }; | 463 | }; |
462 | 464 | ||
diff --git a/drivers/message/i2o/pci.c b/drivers/message/i2o/pci.c index 62f1ac08332c..8287f95c8c42 100644 --- a/drivers/message/i2o/pci.c +++ b/drivers/message/i2o/pci.c | |||
@@ -320,7 +320,6 @@ static int __devinit i2o_pci_probe(struct pci_dev *pdev, | |||
320 | struct i2o_controller *c; | 320 | struct i2o_controller *c; |
321 | int rc; | 321 | int rc; |
322 | struct pci_dev *i960 = NULL; | 322 | struct pci_dev *i960 = NULL; |
323 | int enabled = pdev->is_enabled; | ||
324 | 323 | ||
325 | printk(KERN_INFO "i2o: Checking for PCI I2O controllers...\n"); | 324 | printk(KERN_INFO "i2o: Checking for PCI I2O controllers...\n"); |
326 | 325 | ||
@@ -330,12 +329,11 @@ static int __devinit i2o_pci_probe(struct pci_dev *pdev, | |||
330 | return -ENODEV; | 329 | return -ENODEV; |
331 | } | 330 | } |
332 | 331 | ||
333 | if (!enabled) | 332 | if ((rc = pci_enable_device(pdev))) { |
334 | if ((rc = pci_enable_device(pdev))) { | 333 | printk(KERN_WARNING "i2o: couldn't enable device %s\n", |
335 | printk(KERN_WARNING "i2o: couldn't enable device %s\n", | 334 | pci_name(pdev)); |
336 | pci_name(pdev)); | 335 | return rc; |
337 | return rc; | 336 | } |
338 | } | ||
339 | 337 | ||
340 | if (pci_set_dma_mask(pdev, DMA_32BIT_MASK)) { | 338 | if (pci_set_dma_mask(pdev, DMA_32BIT_MASK)) { |
341 | printk(KERN_WARNING "i2o: no suitable DMA found for %s\n", | 339 | printk(KERN_WARNING "i2o: no suitable DMA found for %s\n", |
@@ -442,8 +440,7 @@ static int __devinit i2o_pci_probe(struct pci_dev *pdev, | |||
442 | i2o_iop_free(c); | 440 | i2o_iop_free(c); |
443 | 441 | ||
444 | disable: | 442 | disable: |
445 | if (!enabled) | 443 | pci_disable_device(pdev); |
446 | pci_disable_device(pdev); | ||
447 | 444 | ||
448 | return rc; | 445 | return rc; |
449 | } | 446 | } |
diff --git a/drivers/pci/Kconfig b/drivers/pci/Kconfig index 3cfb0a3575e6..f1dd81a1d592 100644 --- a/drivers/pci/Kconfig +++ b/drivers/pci/Kconfig | |||
@@ -19,7 +19,7 @@ config PCI_MSI | |||
19 | 19 | ||
20 | config PCI_MULTITHREAD_PROBE | 20 | config PCI_MULTITHREAD_PROBE |
21 | bool "PCI Multi-threaded probe (EXPERIMENTAL)" | 21 | bool "PCI Multi-threaded probe (EXPERIMENTAL)" |
22 | depends on PCI && EXPERIMENTAL && BROKEN | 22 | depends on PCI && EXPERIMENTAL |
23 | help | 23 | help |
24 | Say Y here if you want the PCI core to spawn a new thread for | 24 | Say Y here if you want the PCI core to spawn a new thread for |
25 | every PCI device that is probed. This can cause a huge | 25 | every PCI device that is probed. This can cause a huge |
diff --git a/drivers/pci/access.c b/drivers/pci/access.c index ea16805a153c..73a58c73d526 100644 --- a/drivers/pci/access.c +++ b/drivers/pci/access.c | |||
@@ -1,6 +1,7 @@ | |||
1 | #include <linux/pci.h> | 1 | #include <linux/pci.h> |
2 | #include <linux/module.h> | 2 | #include <linux/module.h> |
3 | #include <linux/ioport.h> | 3 | #include <linux/ioport.h> |
4 | #include <linux/wait.h> | ||
4 | 5 | ||
5 | #include "pci.h" | 6 | #include "pci.h" |
6 | 7 | ||
@@ -63,30 +64,42 @@ EXPORT_SYMBOL(pci_bus_write_config_byte); | |||
63 | EXPORT_SYMBOL(pci_bus_write_config_word); | 64 | EXPORT_SYMBOL(pci_bus_write_config_word); |
64 | EXPORT_SYMBOL(pci_bus_write_config_dword); | 65 | EXPORT_SYMBOL(pci_bus_write_config_dword); |
65 | 66 | ||
66 | static u32 pci_user_cached_config(struct pci_dev *dev, int pos) | 67 | /* |
67 | { | 68 | * The following routines are to prevent the user from accessing PCI config |
68 | u32 data; | 69 | * space when it's unsafe to do so. Some devices require this during BIST and |
70 | * we're required to prevent it during D-state transitions. | ||
71 | * | ||
72 | * We have a bit per device to indicate it's blocked and a global wait queue | ||
73 | * for callers to sleep on until devices are unblocked. | ||
74 | */ | ||
75 | static DECLARE_WAIT_QUEUE_HEAD(pci_ucfg_wait); | ||
69 | 76 | ||
70 | data = dev->saved_config_space[pos/sizeof(dev->saved_config_space[0])]; | 77 | static noinline void pci_wait_ucfg(struct pci_dev *dev) |
71 | data >>= (pos % sizeof(dev->saved_config_space[0])) * 8; | 78 | { |
72 | return data; | 79 | DECLARE_WAITQUEUE(wait, current); |
80 | |||
81 | __add_wait_queue(&pci_ucfg_wait, &wait); | ||
82 | do { | ||
83 | set_current_state(TASK_UNINTERRUPTIBLE); | ||
84 | spin_unlock_irq(&pci_lock); | ||
85 | schedule(); | ||
86 | spin_lock_irq(&pci_lock); | ||
87 | } while (dev->block_ucfg_access); | ||
88 | __remove_wait_queue(&pci_ucfg_wait, &wait); | ||
73 | } | 89 | } |
74 | 90 | ||
75 | #define PCI_USER_READ_CONFIG(size,type) \ | 91 | #define PCI_USER_READ_CONFIG(size,type) \ |
76 | int pci_user_read_config_##size \ | 92 | int pci_user_read_config_##size \ |
77 | (struct pci_dev *dev, int pos, type *val) \ | 93 | (struct pci_dev *dev, int pos, type *val) \ |
78 | { \ | 94 | { \ |
79 | unsigned long flags; \ | ||
80 | int ret = 0; \ | 95 | int ret = 0; \ |
81 | u32 data = -1; \ | 96 | u32 data = -1; \ |
82 | if (PCI_##size##_BAD) return PCIBIOS_BAD_REGISTER_NUMBER; \ | 97 | if (PCI_##size##_BAD) return PCIBIOS_BAD_REGISTER_NUMBER; \ |
83 | spin_lock_irqsave(&pci_lock, flags); \ | 98 | spin_lock_irq(&pci_lock); \ |
84 | if (likely(!dev->block_ucfg_access)) \ | 99 | if (unlikely(dev->block_ucfg_access)) pci_wait_ucfg(dev); \ |
85 | ret = dev->bus->ops->read(dev->bus, dev->devfn, \ | 100 | ret = dev->bus->ops->read(dev->bus, dev->devfn, \ |
86 | pos, sizeof(type), &data); \ | 101 | pos, sizeof(type), &data); \ |
87 | else if (pos < sizeof(dev->saved_config_space)) \ | 102 | spin_unlock_irq(&pci_lock); \ |
88 | data = pci_user_cached_config(dev, pos); \ | ||
89 | spin_unlock_irqrestore(&pci_lock, flags); \ | ||
90 | *val = (type)data; \ | 103 | *val = (type)data; \ |
91 | return ret; \ | 104 | return ret; \ |
92 | } | 105 | } |
@@ -95,14 +108,13 @@ int pci_user_read_config_##size \ | |||
95 | int pci_user_write_config_##size \ | 108 | int pci_user_write_config_##size \ |
96 | (struct pci_dev *dev, int pos, type val) \ | 109 | (struct pci_dev *dev, int pos, type val) \ |
97 | { \ | 110 | { \ |
98 | unsigned long flags; \ | ||
99 | int ret = -EIO; \ | 111 | int ret = -EIO; \ |
100 | if (PCI_##size##_BAD) return PCIBIOS_BAD_REGISTER_NUMBER; \ | 112 | if (PCI_##size##_BAD) return PCIBIOS_BAD_REGISTER_NUMBER; \ |
101 | spin_lock_irqsave(&pci_lock, flags); \ | 113 | spin_lock_irq(&pci_lock); \ |
102 | if (likely(!dev->block_ucfg_access)) \ | 114 | if (unlikely(dev->block_ucfg_access)) pci_wait_ucfg(dev); \ |
103 | ret = dev->bus->ops->write(dev->bus, dev->devfn, \ | 115 | ret = dev->bus->ops->write(dev->bus, dev->devfn, \ |
104 | pos, sizeof(type), val); \ | 116 | pos, sizeof(type), val); \ |
105 | spin_unlock_irqrestore(&pci_lock, flags); \ | 117 | spin_unlock_irq(&pci_lock); \ |
106 | return ret; \ | 118 | return ret; \ |
107 | } | 119 | } |
108 | 120 | ||
@@ -117,21 +129,23 @@ PCI_USER_WRITE_CONFIG(dword, u32) | |||
117 | * pci_block_user_cfg_access - Block userspace PCI config reads/writes | 129 | * pci_block_user_cfg_access - Block userspace PCI config reads/writes |
118 | * @dev: pci device struct | 130 | * @dev: pci device struct |
119 | * | 131 | * |
120 | * This function blocks any userspace PCI config accesses from occurring. | 132 | * When user access is blocked, any reads or writes to config space will |
121 | * When blocked, any writes will be bit bucketed and reads will return the | 133 | * sleep until access is unblocked again. We don't allow nesting of |
122 | * data saved using pci_save_state for the first 64 bytes of config | 134 | * block/unblock calls. |
123 | * space and return 0xff for all other config reads. | 135 | */ |
124 | **/ | ||
125 | void pci_block_user_cfg_access(struct pci_dev *dev) | 136 | void pci_block_user_cfg_access(struct pci_dev *dev) |
126 | { | 137 | { |
127 | unsigned long flags; | 138 | unsigned long flags; |
139 | int was_blocked; | ||
128 | 140 | ||
129 | pci_save_state(dev); | ||
130 | |||
131 | /* spinlock to synchronize with anyone reading config space now */ | ||
132 | spin_lock_irqsave(&pci_lock, flags); | 141 | spin_lock_irqsave(&pci_lock, flags); |
142 | was_blocked = dev->block_ucfg_access; | ||
133 | dev->block_ucfg_access = 1; | 143 | dev->block_ucfg_access = 1; |
134 | spin_unlock_irqrestore(&pci_lock, flags); | 144 | spin_unlock_irqrestore(&pci_lock, flags); |
145 | |||
146 | /* If we BUG() inside the pci_lock, we're guaranteed to hose | ||
147 | * the machine */ | ||
148 | BUG_ON(was_blocked); | ||
135 | } | 149 | } |
136 | EXPORT_SYMBOL_GPL(pci_block_user_cfg_access); | 150 | EXPORT_SYMBOL_GPL(pci_block_user_cfg_access); |
137 | 151 | ||
@@ -140,14 +154,19 @@ EXPORT_SYMBOL_GPL(pci_block_user_cfg_access); | |||
140 | * @dev: pci device struct | 154 | * @dev: pci device struct |
141 | * | 155 | * |
142 | * This function allows userspace PCI config accesses to resume. | 156 | * This function allows userspace PCI config accesses to resume. |
143 | **/ | 157 | */ |
144 | void pci_unblock_user_cfg_access(struct pci_dev *dev) | 158 | void pci_unblock_user_cfg_access(struct pci_dev *dev) |
145 | { | 159 | { |
146 | unsigned long flags; | 160 | unsigned long flags; |
147 | 161 | ||
148 | /* spinlock to synchronize with anyone reading saved config space */ | ||
149 | spin_lock_irqsave(&pci_lock, flags); | 162 | spin_lock_irqsave(&pci_lock, flags); |
163 | |||
164 | /* This indicates a problem in the caller, but we don't need | ||
165 | * to kill them, unlike a double-block above. */ | ||
166 | WARN_ON(!dev->block_ucfg_access); | ||
167 | |||
150 | dev->block_ucfg_access = 0; | 168 | dev->block_ucfg_access = 0; |
169 | wake_up_all(&pci_ucfg_wait); | ||
151 | spin_unlock_irqrestore(&pci_lock, flags); | 170 | spin_unlock_irqrestore(&pci_lock, flags); |
152 | } | 171 | } |
153 | EXPORT_SYMBOL_GPL(pci_unblock_user_cfg_access); | 172 | EXPORT_SYMBOL_GPL(pci_unblock_user_cfg_access); |
diff --git a/drivers/pci/hotplug/acpiphp.h b/drivers/pci/hotplug/acpiphp.h index 59c5b242d86d..ddbadd95387e 100644 --- a/drivers/pci/hotplug/acpiphp.h +++ b/drivers/pci/hotplug/acpiphp.h | |||
@@ -62,10 +62,10 @@ struct acpiphp_slot; | |||
62 | struct slot { | 62 | struct slot { |
63 | struct hotplug_slot *hotplug_slot; | 63 | struct hotplug_slot *hotplug_slot; |
64 | struct acpiphp_slot *acpi_slot; | 64 | struct acpiphp_slot *acpi_slot; |
65 | struct hotplug_slot_info info; | ||
66 | char name[SLOT_NAME_SIZE]; | ||
65 | }; | 67 | }; |
66 | 68 | ||
67 | |||
68 | |||
69 | /** | 69 | /** |
70 | * struct acpiphp_bridge - PCI bridge information | 70 | * struct acpiphp_bridge - PCI bridge information |
71 | * | 71 | * |
diff --git a/drivers/pci/hotplug/acpiphp_core.c b/drivers/pci/hotplug/acpiphp_core.c index c57d9d5ce84e..40c79b03c7ef 100644 --- a/drivers/pci/hotplug/acpiphp_core.c +++ b/drivers/pci/hotplug/acpiphp_core.c | |||
@@ -303,25 +303,15 @@ static int __init init_acpi(void) | |||
303 | /* read initial number of slots */ | 303 | /* read initial number of slots */ |
304 | if (!retval) { | 304 | if (!retval) { |
305 | num_slots = acpiphp_get_num_slots(); | 305 | num_slots = acpiphp_get_num_slots(); |
306 | if (num_slots == 0) | 306 | if (num_slots == 0) { |
307 | acpiphp_glue_exit(); | ||
307 | retval = -ENODEV; | 308 | retval = -ENODEV; |
309 | } | ||
308 | } | 310 | } |
309 | 311 | ||
310 | return retval; | 312 | return retval; |
311 | } | 313 | } |
312 | 314 | ||
313 | |||
314 | /** | ||
315 | * make_slot_name - make a slot name that appears in pcihpfs | ||
316 | * @slot: slot to name | ||
317 | * | ||
318 | */ | ||
319 | static void make_slot_name(struct slot *slot) | ||
320 | { | ||
321 | snprintf(slot->hotplug_slot->name, SLOT_NAME_SIZE, "%u", | ||
322 | slot->acpi_slot->sun); | ||
323 | } | ||
324 | |||
325 | /** | 315 | /** |
326 | * release_slot - free up the memory used by a slot | 316 | * release_slot - free up the memory used by a slot |
327 | * @hotplug_slot: slot to free | 317 | * @hotplug_slot: slot to free |
@@ -332,8 +322,6 @@ static void release_slot(struct hotplug_slot *hotplug_slot) | |||
332 | 322 | ||
333 | dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name); | 323 | dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name); |
334 | 324 | ||
335 | kfree(slot->hotplug_slot->info); | ||
336 | kfree(slot->hotplug_slot->name); | ||
337 | kfree(slot->hotplug_slot); | 325 | kfree(slot->hotplug_slot); |
338 | kfree(slot); | 326 | kfree(slot); |
339 | } | 327 | } |
@@ -342,26 +330,19 @@ static void release_slot(struct hotplug_slot *hotplug_slot) | |||
342 | int acpiphp_register_hotplug_slot(struct acpiphp_slot *acpiphp_slot) | 330 | int acpiphp_register_hotplug_slot(struct acpiphp_slot *acpiphp_slot) |
343 | { | 331 | { |
344 | struct slot *slot; | 332 | struct slot *slot; |
345 | struct hotplug_slot *hotplug_slot; | ||
346 | struct hotplug_slot_info *hotplug_slot_info; | ||
347 | int retval = -ENOMEM; | 333 | int retval = -ENOMEM; |
348 | 334 | ||
349 | slot = kzalloc(sizeof(*slot), GFP_KERNEL); | 335 | slot = kzalloc(sizeof(*slot), GFP_KERNEL); |
350 | if (!slot) | 336 | if (!slot) |
351 | goto error; | 337 | goto error; |
352 | 338 | ||
353 | slot->hotplug_slot = kzalloc(sizeof(*hotplug_slot), GFP_KERNEL); | 339 | slot->hotplug_slot = kzalloc(sizeof(*slot->hotplug_slot), GFP_KERNEL); |
354 | if (!slot->hotplug_slot) | 340 | if (!slot->hotplug_slot) |
355 | goto error_slot; | 341 | goto error_slot; |
356 | 342 | ||
357 | slot->hotplug_slot->info = kzalloc(sizeof(*hotplug_slot_info), | 343 | slot->hotplug_slot->info = &slot->info; |
358 | GFP_KERNEL); | ||
359 | if (!slot->hotplug_slot->info) | ||
360 | goto error_hpslot; | ||
361 | 344 | ||
362 | slot->hotplug_slot->name = kzalloc(SLOT_NAME_SIZE, GFP_KERNEL); | 345 | slot->hotplug_slot->name = slot->name; |
363 | if (!slot->hotplug_slot->name) | ||
364 | goto error_info; | ||
365 | 346 | ||
366 | slot->hotplug_slot->private = slot; | 347 | slot->hotplug_slot->private = slot; |
367 | slot->hotplug_slot->release = &release_slot; | 348 | slot->hotplug_slot->release = &release_slot; |
@@ -376,21 +357,17 @@ int acpiphp_register_hotplug_slot(struct acpiphp_slot *acpiphp_slot) | |||
376 | slot->hotplug_slot->info->cur_bus_speed = PCI_SPEED_UNKNOWN; | 357 | slot->hotplug_slot->info->cur_bus_speed = PCI_SPEED_UNKNOWN; |
377 | 358 | ||
378 | acpiphp_slot->slot = slot; | 359 | acpiphp_slot->slot = slot; |
379 | make_slot_name(slot); | 360 | snprintf(slot->name, sizeof(slot->name), "%u", slot->acpi_slot->sun); |
380 | 361 | ||
381 | retval = pci_hp_register(slot->hotplug_slot); | 362 | retval = pci_hp_register(slot->hotplug_slot); |
382 | if (retval) { | 363 | if (retval) { |
383 | err("pci_hp_register failed with error %d\n", retval); | 364 | err("pci_hp_register failed with error %d\n", retval); |
384 | goto error_name; | 365 | goto error_hpslot; |
385 | } | 366 | } |
386 | 367 | ||
387 | info("Slot [%s] registered\n", slot->hotplug_slot->name); | 368 | info("Slot [%s] registered\n", slot->hotplug_slot->name); |
388 | 369 | ||
389 | return 0; | 370 | return 0; |
390 | error_name: | ||
391 | kfree(slot->hotplug_slot->name); | ||
392 | error_info: | ||
393 | kfree(slot->hotplug_slot->info); | ||
394 | error_hpslot: | 371 | error_hpslot: |
395 | kfree(slot->hotplug_slot); | 372 | kfree(slot->hotplug_slot); |
396 | error_slot: | 373 | error_slot: |
diff --git a/drivers/pci/hotplug/acpiphp_glue.c b/drivers/pci/hotplug/acpiphp_glue.c index 16167b016266..0b9d0db1590a 100644 --- a/drivers/pci/hotplug/acpiphp_glue.c +++ b/drivers/pci/hotplug/acpiphp_glue.c | |||
@@ -1693,14 +1693,10 @@ void __exit acpiphp_glue_exit(void) | |||
1693 | */ | 1693 | */ |
1694 | int __init acpiphp_get_num_slots(void) | 1694 | int __init acpiphp_get_num_slots(void) |
1695 | { | 1695 | { |
1696 | struct list_head *node; | ||
1697 | struct acpiphp_bridge *bridge; | 1696 | struct acpiphp_bridge *bridge; |
1698 | int num_slots; | 1697 | int num_slots = 0; |
1699 | |||
1700 | num_slots = 0; | ||
1701 | 1698 | ||
1702 | list_for_each (node, &bridge_list) { | 1699 | list_for_each_entry (bridge, &bridge_list, list) { |
1703 | bridge = (struct acpiphp_bridge *)node; | ||
1704 | dbg("Bus %04x:%02x has %d slot%s\n", | 1700 | dbg("Bus %04x:%02x has %d slot%s\n", |
1705 | pci_domain_nr(bridge->pci_bus), | 1701 | pci_domain_nr(bridge->pci_bus), |
1706 | bridge->pci_bus->number, bridge->nr_slots, | 1702 | bridge->pci_bus->number, bridge->nr_slots, |
diff --git a/drivers/pci/hotplug/ibmphp_pci.c b/drivers/pci/hotplug/ibmphp_pci.c index d87a9e3eaeeb..d8f05d7a3c72 100644 --- a/drivers/pci/hotplug/ibmphp_pci.c +++ b/drivers/pci/hotplug/ibmphp_pci.c | |||
@@ -1371,12 +1371,12 @@ static int unconfigure_boot_bridge (u8 busno, u8 device, u8 function) | |||
1371 | } | 1371 | } |
1372 | 1372 | ||
1373 | bus = ibmphp_find_res_bus (sec_number); | 1373 | bus = ibmphp_find_res_bus (sec_number); |
1374 | debug ("bus->busno is %x\n", bus->busno); | ||
1375 | debug ("sec_number is %x\n", sec_number); | ||
1376 | if (!bus) { | 1374 | if (!bus) { |
1377 | err ("cannot find Bus structure for the bridged device\n"); | 1375 | err ("cannot find Bus structure for the bridged device\n"); |
1378 | return -EINVAL; | 1376 | return -EINVAL; |
1379 | } | 1377 | } |
1378 | debug("bus->busno is %x\n", bus->busno); | ||
1379 | debug("sec_number is %x\n", sec_number); | ||
1380 | 1380 | ||
1381 | ibmphp_remove_bus (bus, busno); | 1381 | ibmphp_remove_bus (bus, busno); |
1382 | 1382 | ||
diff --git a/drivers/pci/hotplug/pciehp_core.c b/drivers/pci/hotplug/pciehp_core.c index f93e81e2d2c7..f13f31323e85 100644 --- a/drivers/pci/hotplug/pciehp_core.c +++ b/drivers/pci/hotplug/pciehp_core.c | |||
@@ -521,14 +521,9 @@ static void __exit unload_pciehpd(void) | |||
521 | 521 | ||
522 | } | 522 | } |
523 | 523 | ||
524 | static int hpdriver_context = 0; | ||
525 | |||
526 | static void pciehp_remove (struct pcie_device *device) | 524 | static void pciehp_remove (struct pcie_device *device) |
527 | { | 525 | { |
528 | printk("%s ENTRY\n", __FUNCTION__); | 526 | /* XXX - Needs to be adapted to device driver model */ |
529 | printk("%s -> Call free_irq for irq = %d\n", | ||
530 | __FUNCTION__, device->irq); | ||
531 | free_irq(device->irq, &hpdriver_context); | ||
532 | } | 527 | } |
533 | 528 | ||
534 | #ifdef CONFIG_PM | 529 | #ifdef CONFIG_PM |
diff --git a/drivers/pci/hotplug/pciehp_hpc.c b/drivers/pci/hotplug/pciehp_hpc.c index 1c551c697c35..6d3f580f2666 100644 --- a/drivers/pci/hotplug/pciehp_hpc.c +++ b/drivers/pci/hotplug/pciehp_hpc.c | |||
@@ -718,8 +718,6 @@ static void hpc_release_ctlr(struct controller *ctrl) | |||
718 | if (php_ctlr->irq) { | 718 | if (php_ctlr->irq) { |
719 | free_irq(php_ctlr->irq, ctrl); | 719 | free_irq(php_ctlr->irq, ctrl); |
720 | php_ctlr->irq = 0; | 720 | php_ctlr->irq = 0; |
721 | if (!pcie_mch_quirk) | ||
722 | pci_disable_msi(php_ctlr->pci_dev); | ||
723 | } | 721 | } |
724 | } | 722 | } |
725 | if (php_ctlr->pci_dev) | 723 | if (php_ctlr->pci_dev) |
diff --git a/drivers/pci/hotplug/rpadlpar_core.c b/drivers/pci/hotplug/rpadlpar_core.c index 46825fee3ae4..72383467a0d5 100644 --- a/drivers/pci/hotplug/rpadlpar_core.c +++ b/drivers/pci/hotplug/rpadlpar_core.c | |||
@@ -63,7 +63,7 @@ static struct device_node *find_php_slot_pci_node(char *drc_name, | |||
63 | char *type; | 63 | char *type; |
64 | int rc; | 64 | int rc; |
65 | 65 | ||
66 | while ((np = of_find_node_by_type(np, "pci"))) { | 66 | while ((np = of_find_node_by_name(np, "pci"))) { |
67 | rc = rpaphp_get_drc_props(np, NULL, &name, &type, NULL); | 67 | rc = rpaphp_get_drc_props(np, NULL, &name, &type, NULL); |
68 | if (rc == 0) | 68 | if (rc == 0) |
69 | if (!strcmp(drc_name, name) && !strcmp(drc_type, type)) | 69 | if (!strcmp(drc_name, name) && !strcmp(drc_type, type)) |
diff --git a/drivers/pci/hotplug/rpaphp_core.c b/drivers/pci/hotplug/rpaphp_core.c index 141486df235b..71a2cb8baa4a 100644 --- a/drivers/pci/hotplug/rpaphp_core.c +++ b/drivers/pci/hotplug/rpaphp_core.c | |||
@@ -356,7 +356,7 @@ static int __init rpaphp_init(void) | |||
356 | info(DRIVER_DESC " version: " DRIVER_VERSION "\n"); | 356 | info(DRIVER_DESC " version: " DRIVER_VERSION "\n"); |
357 | init_MUTEX(&rpaphp_sem); | 357 | init_MUTEX(&rpaphp_sem); |
358 | 358 | ||
359 | while ((dn = of_find_node_by_type(dn, "pci"))) | 359 | while ((dn = of_find_node_by_name(dn, "pci"))) |
360 | rpaphp_add_slot(dn); | 360 | rpaphp_add_slot(dn); |
361 | 361 | ||
362 | return 0; | 362 | return 0; |
diff --git a/drivers/pci/hotplug/sgi_hotplug.c b/drivers/pci/hotplug/sgi_hotplug.c index b62ad31a9739..5d188c558386 100644 --- a/drivers/pci/hotplug/sgi_hotplug.c +++ b/drivers/pci/hotplug/sgi_hotplug.c | |||
@@ -205,21 +205,6 @@ static struct hotplug_slot * sn_hp_destroy(void) | |||
205 | return bss_hotplug_slot; | 205 | return bss_hotplug_slot; |
206 | } | 206 | } |
207 | 207 | ||
208 | static void sn_bus_alloc_data(struct pci_dev *dev) | ||
209 | { | ||
210 | struct pci_bus *subordinate_bus; | ||
211 | struct pci_dev *child; | ||
212 | |||
213 | sn_pci_fixup_slot(dev); | ||
214 | |||
215 | /* Recursively sets up the sn_irq_info structs */ | ||
216 | if (dev->subordinate) { | ||
217 | subordinate_bus = dev->subordinate; | ||
218 | list_for_each_entry(child, &subordinate_bus->devices, bus_list) | ||
219 | sn_bus_alloc_data(child); | ||
220 | } | ||
221 | } | ||
222 | |||
223 | static void sn_bus_free_data(struct pci_dev *dev) | 208 | static void sn_bus_free_data(struct pci_dev *dev) |
224 | { | 209 | { |
225 | struct pci_bus *subordinate_bus; | 210 | struct pci_bus *subordinate_bus; |
@@ -337,6 +322,11 @@ static int sn_slot_disable(struct hotplug_slot *bss_hotplug_slot, | |||
337 | return rc; | 322 | return rc; |
338 | } | 323 | } |
339 | 324 | ||
325 | /* | ||
326 | * Power up and configure the slot via a SAL call to PROM. | ||
327 | * Scan slot (and any children), do any platform specific fixup, | ||
328 | * and find device driver. | ||
329 | */ | ||
340 | static int enable_slot(struct hotplug_slot *bss_hotplug_slot) | 330 | static int enable_slot(struct hotplug_slot *bss_hotplug_slot) |
341 | { | 331 | { |
342 | struct slot *slot = bss_hotplug_slot->private; | 332 | struct slot *slot = bss_hotplug_slot->private; |
@@ -345,6 +335,7 @@ static int enable_slot(struct hotplug_slot *bss_hotplug_slot) | |||
345 | int func, num_funcs; | 335 | int func, num_funcs; |
346 | int new_ppb = 0; | 336 | int new_ppb = 0; |
347 | int rc; | 337 | int rc; |
338 | void pcibios_fixup_device_resources(struct pci_dev *); | ||
348 | 339 | ||
349 | /* Serialize the Linux PCI infrastructure */ | 340 | /* Serialize the Linux PCI infrastructure */ |
350 | mutex_lock(&sn_hotplug_mutex); | 341 | mutex_lock(&sn_hotplug_mutex); |
@@ -367,9 +358,6 @@ static int enable_slot(struct hotplug_slot *bss_hotplug_slot) | |||
367 | return -ENODEV; | 358 | return -ENODEV; |
368 | } | 359 | } |
369 | 360 | ||
370 | sn_pci_controller_fixup(pci_domain_nr(slot->pci_bus), | ||
371 | slot->pci_bus->number, | ||
372 | slot->pci_bus); | ||
373 | /* | 361 | /* |
374 | * Map SN resources for all functions on the card | 362 | * Map SN resources for all functions on the card |
375 | * to the Linux PCI interface and tell the drivers | 363 | * to the Linux PCI interface and tell the drivers |
@@ -380,6 +368,13 @@ static int enable_slot(struct hotplug_slot *bss_hotplug_slot) | |||
380 | PCI_DEVFN(slot->device_num + 1, | 368 | PCI_DEVFN(slot->device_num + 1, |
381 | PCI_FUNC(func))); | 369 | PCI_FUNC(func))); |
382 | if (dev) { | 370 | if (dev) { |
371 | /* Need to do slot fixup on PPB before fixup of children | ||
372 | * (PPB's pcidev_info needs to be in pcidev_info list | ||
373 | * before child's SN_PCIDEV_INFO() call to setup | ||
374 | * pdi_host_pcidev_info). | ||
375 | */ | ||
376 | pcibios_fixup_device_resources(dev); | ||
377 | sn_pci_fixup_slot(dev); | ||
383 | if (dev->hdr_type == PCI_HEADER_TYPE_BRIDGE) { | 378 | if (dev->hdr_type == PCI_HEADER_TYPE_BRIDGE) { |
384 | unsigned char sec_bus; | 379 | unsigned char sec_bus; |
385 | pci_read_config_byte(dev, PCI_SECONDARY_BUS, | 380 | pci_read_config_byte(dev, PCI_SECONDARY_BUS, |
@@ -387,12 +382,8 @@ static int enable_slot(struct hotplug_slot *bss_hotplug_slot) | |||
387 | new_bus = pci_add_new_bus(dev->bus, dev, | 382 | new_bus = pci_add_new_bus(dev->bus, dev, |
388 | sec_bus); | 383 | sec_bus); |
389 | pci_scan_child_bus(new_bus); | 384 | pci_scan_child_bus(new_bus); |
390 | sn_pci_controller_fixup(pci_domain_nr(new_bus), | ||
391 | new_bus->number, | ||
392 | new_bus); | ||
393 | new_ppb = 1; | 385 | new_ppb = 1; |
394 | } | 386 | } |
395 | sn_bus_alloc_data(dev); | ||
396 | pci_dev_put(dev); | 387 | pci_dev_put(dev); |
397 | } | 388 | } |
398 | } | 389 | } |
diff --git a/drivers/pci/msi.h b/drivers/pci/msi.h index f0cca1772f9c..3898f5237144 100644 --- a/drivers/pci/msi.h +++ b/drivers/pci/msi.h | |||
@@ -6,14 +6,6 @@ | |||
6 | #ifndef MSI_H | 6 | #ifndef MSI_H |
7 | #define MSI_H | 7 | #define MSI_H |
8 | 8 | ||
9 | /* | ||
10 | * MSI-X Address Register | ||
11 | */ | ||
12 | #define PCI_MSIX_FLAGS_QSIZE 0x7FF | ||
13 | #define PCI_MSIX_FLAGS_ENABLE (1 << 15) | ||
14 | #define PCI_MSIX_FLAGS_BIRMASK (7 << 0) | ||
15 | #define PCI_MSIX_FLAGS_BITMASK (1 << 0) | ||
16 | |||
17 | #define PCI_MSIX_ENTRY_SIZE 16 | 9 | #define PCI_MSIX_ENTRY_SIZE 16 |
18 | #define PCI_MSIX_ENTRY_LOWER_ADDR_OFFSET 0 | 10 | #define PCI_MSIX_ENTRY_LOWER_ADDR_OFFSET 0 |
19 | #define PCI_MSIX_ENTRY_UPPER_ADDR_OFFSET 4 | 11 | #define PCI_MSIX_ENTRY_UPPER_ADDR_OFFSET 4 |
diff --git a/drivers/pci/pci-acpi.c b/drivers/pci/pci-acpi.c index bb7456c1dbac..a064f36a0805 100644 --- a/drivers/pci/pci-acpi.c +++ b/drivers/pci/pci-acpi.c | |||
@@ -36,6 +36,7 @@ acpi_query_osc ( | |||
36 | struct acpi_buffer output = {ACPI_ALLOCATE_BUFFER, NULL}; | 36 | struct acpi_buffer output = {ACPI_ALLOCATE_BUFFER, NULL}; |
37 | union acpi_object *out_obj; | 37 | union acpi_object *out_obj; |
38 | u32 osc_dw0; | 38 | u32 osc_dw0; |
39 | acpi_status *ret_status = (acpi_status *)retval; | ||
39 | 40 | ||
40 | 41 | ||
41 | /* Setting up input parameters */ | 42 | /* Setting up input parameters */ |
@@ -56,6 +57,7 @@ acpi_query_osc ( | |||
56 | if (ACPI_FAILURE (status)) { | 57 | if (ACPI_FAILURE (status)) { |
57 | printk(KERN_DEBUG | 58 | printk(KERN_DEBUG |
58 | "Evaluate _OSC Set fails. Status = 0x%04x\n", status); | 59 | "Evaluate _OSC Set fails. Status = 0x%04x\n", status); |
60 | *ret_status = status; | ||
59 | return status; | 61 | return status; |
60 | } | 62 | } |
61 | out_obj = output.pointer; | 63 | out_obj = output.pointer; |
@@ -90,6 +92,7 @@ acpi_query_osc ( | |||
90 | 92 | ||
91 | query_osc_out: | 93 | query_osc_out: |
92 | kfree(output.pointer); | 94 | kfree(output.pointer); |
95 | *ret_status = status; | ||
93 | return status; | 96 | return status; |
94 | } | 97 | } |
95 | 98 | ||
@@ -166,6 +169,7 @@ run_osc_out: | |||
166 | acpi_status pci_osc_support_set(u32 flags) | 169 | acpi_status pci_osc_support_set(u32 flags) |
167 | { | 170 | { |
168 | u32 temp; | 171 | u32 temp; |
172 | acpi_status retval; | ||
169 | 173 | ||
170 | if (!(flags & OSC_SUPPORT_MASKS)) { | 174 | if (!(flags & OSC_SUPPORT_MASKS)) { |
171 | return AE_TYPE; | 175 | return AE_TYPE; |
@@ -179,9 +183,13 @@ acpi_status pci_osc_support_set(u32 flags) | |||
179 | acpi_get_devices ( PCI_ROOT_HID_STRING, | 183 | acpi_get_devices ( PCI_ROOT_HID_STRING, |
180 | acpi_query_osc, | 184 | acpi_query_osc, |
181 | ctrlset_buf, | 185 | ctrlset_buf, |
182 | NULL ); | 186 | (void **) &retval ); |
183 | ctrlset_buf[OSC_QUERY_TYPE] = !OSC_QUERY_ENABLE; | 187 | ctrlset_buf[OSC_QUERY_TYPE] = !OSC_QUERY_ENABLE; |
184 | ctrlset_buf[OSC_CONTROL_TYPE] = temp; | 188 | ctrlset_buf[OSC_CONTROL_TYPE] = temp; |
189 | if (ACPI_FAILURE(retval)) { | ||
190 | /* no osc support at all */ | ||
191 | ctrlset_buf[OSC_SUPPORT_TYPE] = 0; | ||
192 | } | ||
185 | return AE_OK; | 193 | return AE_OK; |
186 | } | 194 | } |
187 | EXPORT_SYMBOL(pci_osc_support_set); | 195 | EXPORT_SYMBOL(pci_osc_support_set); |
diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c index 194f1d21d3d7..e5ae3a0c13bb 100644 --- a/drivers/pci/pci-driver.c +++ b/drivers/pci/pci-driver.c | |||
@@ -329,8 +329,8 @@ static int pci_default_resume(struct pci_dev *pci_dev) | |||
329 | /* restore the PCI config space */ | 329 | /* restore the PCI config space */ |
330 | pci_restore_state(pci_dev); | 330 | pci_restore_state(pci_dev); |
331 | /* if the device was enabled before suspend, reenable */ | 331 | /* if the device was enabled before suspend, reenable */ |
332 | if (pci_dev->is_enabled) | 332 | if (atomic_read(&pci_dev->enable_cnt)) |
333 | retval = pci_enable_device(pci_dev); | 333 | retval = __pci_enable_device(pci_dev); |
334 | /* if the device was busmaster before the suspend, make it busmaster again */ | 334 | /* if the device was busmaster before the suspend, make it busmaster again */ |
335 | if (pci_dev->is_busmaster) | 335 | if (pci_dev->is_busmaster) |
336 | pci_set_master(pci_dev); | 336 | pci_set_master(pci_dev); |
@@ -445,9 +445,12 @@ int __pci_register_driver(struct pci_driver *drv, struct module *owner) | |||
445 | 445 | ||
446 | /* register with core */ | 446 | /* register with core */ |
447 | error = driver_register(&drv->driver); | 447 | error = driver_register(&drv->driver); |
448 | if (error) | ||
449 | return error; | ||
448 | 450 | ||
449 | if (!error) | 451 | error = pci_create_newid_file(drv); |
450 | error = pci_create_newid_file(drv); | 452 | if (error) |
453 | driver_unregister(&drv->driver); | ||
451 | 454 | ||
452 | return error; | 455 | return error; |
453 | } | 456 | } |
diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c index f952bfea48a6..7a94076752d0 100644 --- a/drivers/pci/pci-sysfs.c +++ b/drivers/pci/pci-sysfs.c | |||
@@ -42,7 +42,6 @@ pci_config_attr(subsystem_vendor, "0x%04x\n"); | |||
42 | pci_config_attr(subsystem_device, "0x%04x\n"); | 42 | pci_config_attr(subsystem_device, "0x%04x\n"); |
43 | pci_config_attr(class, "0x%06x\n"); | 43 | pci_config_attr(class, "0x%06x\n"); |
44 | pci_config_attr(irq, "%u\n"); | 44 | pci_config_attr(irq, "%u\n"); |
45 | pci_config_attr(is_enabled, "%u\n"); | ||
46 | 45 | ||
47 | static ssize_t broken_parity_status_show(struct device *dev, | 46 | static ssize_t broken_parity_status_show(struct device *dev, |
48 | struct device_attribute *attr, | 47 | struct device_attribute *attr, |
@@ -112,26 +111,36 @@ static ssize_t modalias_show(struct device *dev, struct device_attribute *attr, | |||
112 | (u8)(pci_dev->class >> 16), (u8)(pci_dev->class >> 8), | 111 | (u8)(pci_dev->class >> 16), (u8)(pci_dev->class >> 8), |
113 | (u8)(pci_dev->class)); | 112 | (u8)(pci_dev->class)); |
114 | } | 113 | } |
115 | static ssize_t | 114 | |
116 | is_enabled_store(struct device *dev, struct device_attribute *attr, | 115 | static ssize_t is_enabled_store(struct device *dev, |
117 | const char *buf, size_t count) | 116 | struct device_attribute *attr, const char *buf, |
117 | size_t count) | ||
118 | { | 118 | { |
119 | ssize_t result = -EINVAL; | ||
119 | struct pci_dev *pdev = to_pci_dev(dev); | 120 | struct pci_dev *pdev = to_pci_dev(dev); |
120 | int retval = 0; | ||
121 | 121 | ||
122 | /* this can crash the machine when done on the "wrong" device */ | 122 | /* this can crash the machine when done on the "wrong" device */ |
123 | if (!capable(CAP_SYS_ADMIN)) | 123 | if (!capable(CAP_SYS_ADMIN)) |
124 | return count; | 124 | return count; |
125 | 125 | ||
126 | if (*buf == '0') | 126 | if (*buf == '0') { |
127 | pci_disable_device(pdev); | 127 | if (atomic_read(&pdev->enable_cnt) != 0) |
128 | pci_disable_device(pdev); | ||
129 | else | ||
130 | result = -EIO; | ||
131 | } else if (*buf == '1') | ||
132 | result = pci_enable_device(pdev); | ||
133 | |||
134 | return result < 0 ? result : count; | ||
135 | } | ||
128 | 136 | ||
129 | if (*buf == '1') | 137 | static ssize_t is_enabled_show(struct device *dev, |
130 | retval = pci_enable_device(pdev); | 138 | struct device_attribute *attr, char *buf) |
139 | { | ||
140 | struct pci_dev *pdev; | ||
131 | 141 | ||
132 | if (retval) | 142 | pdev = to_pci_dev (dev); |
133 | return retval; | 143 | return sprintf (buf, "%u\n", atomic_read(&pdev->enable_cnt)); |
134 | return count; | ||
135 | } | 144 | } |
136 | 145 | ||
137 | static ssize_t | 146 | static ssize_t |
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index a544997399b3..5a14b73cf3a1 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c | |||
@@ -490,6 +490,47 @@ static void pci_restore_pcie_state(struct pci_dev *dev) | |||
490 | kfree(save_state); | 490 | kfree(save_state); |
491 | } | 491 | } |
492 | 492 | ||
493 | |||
494 | static int pci_save_pcix_state(struct pci_dev *dev) | ||
495 | { | ||
496 | int pos, i = 0; | ||
497 | struct pci_cap_saved_state *save_state; | ||
498 | u16 *cap; | ||
499 | |||
500 | pos = pci_find_capability(dev, PCI_CAP_ID_PCIX); | ||
501 | if (pos <= 0) | ||
502 | return 0; | ||
503 | |||
504 | save_state = kzalloc(sizeof(*save_state) + sizeof(u16), GFP_KERNEL); | ||
505 | if (!save_state) { | ||
506 | dev_err(&dev->dev, "Out of memory in pci_save_pcie_state\n"); | ||
507 | return -ENOMEM; | ||
508 | } | ||
509 | cap = (u16 *)&save_state->data[0]; | ||
510 | |||
511 | pci_read_config_word(dev, pos + PCI_X_CMD, &cap[i++]); | ||
512 | pci_add_saved_cap(dev, save_state); | ||
513 | return 0; | ||
514 | } | ||
515 | |||
516 | static void pci_restore_pcix_state(struct pci_dev *dev) | ||
517 | { | ||
518 | int i = 0, pos; | ||
519 | struct pci_cap_saved_state *save_state; | ||
520 | u16 *cap; | ||
521 | |||
522 | save_state = pci_find_saved_cap(dev, PCI_CAP_ID_PCIX); | ||
523 | pos = pci_find_capability(dev, PCI_CAP_ID_PCIX); | ||
524 | if (!save_state || pos <= 0) | ||
525 | return; | ||
526 | cap = (u16 *)&save_state->data[0]; | ||
527 | |||
528 | pci_write_config_word(dev, pos + PCI_X_CMD, cap[i++]); | ||
529 | pci_remove_saved_cap(save_state); | ||
530 | kfree(save_state); | ||
531 | } | ||
532 | |||
533 | |||
493 | /** | 534 | /** |
494 | * pci_save_state - save the PCI configuration space of a device before suspending | 535 | * pci_save_state - save the PCI configuration space of a device before suspending |
495 | * @dev: - PCI device that we're dealing with | 536 | * @dev: - PCI device that we're dealing with |
@@ -507,6 +548,8 @@ pci_save_state(struct pci_dev *dev) | |||
507 | return i; | 548 | return i; |
508 | if ((i = pci_save_pcie_state(dev)) != 0) | 549 | if ((i = pci_save_pcie_state(dev)) != 0) |
509 | return i; | 550 | return i; |
551 | if ((i = pci_save_pcix_state(dev)) != 0) | ||
552 | return i; | ||
510 | return 0; | 553 | return 0; |
511 | } | 554 | } |
512 | 555 | ||
@@ -538,6 +581,7 @@ pci_restore_state(struct pci_dev *dev) | |||
538 | dev->saved_config_space[i]); | 581 | dev->saved_config_space[i]); |
539 | } | 582 | } |
540 | } | 583 | } |
584 | pci_restore_pcix_state(dev); | ||
541 | pci_restore_msi_state(dev); | 585 | pci_restore_msi_state(dev); |
542 | pci_restore_msix_state(dev); | 586 | pci_restore_msix_state(dev); |
543 | return 0; | 587 | return 0; |
@@ -568,30 +612,51 @@ pci_enable_device_bars(struct pci_dev *dev, int bars) | |||
568 | } | 612 | } |
569 | 613 | ||
570 | /** | 614 | /** |
571 | * pci_enable_device - Initialize device before it's used by a driver. | 615 | * __pci_enable_device - Initialize device before it's used by a driver. |
572 | * @dev: PCI device to be initialized | 616 | * @dev: PCI device to be initialized |
573 | * | 617 | * |
574 | * Initialize device before it's used by a driver. Ask low-level code | 618 | * Initialize device before it's used by a driver. Ask low-level code |
575 | * to enable I/O and memory. Wake up the device if it was suspended. | 619 | * to enable I/O and memory. Wake up the device if it was suspended. |
576 | * Beware, this function can fail. | 620 | * Beware, this function can fail. |
621 | * | ||
622 | * Note this function is a backend and is not supposed to be called by | ||
623 | * normal code, use pci_enable_device() instead. | ||
577 | */ | 624 | */ |
578 | int | 625 | int |
579 | pci_enable_device(struct pci_dev *dev) | 626 | __pci_enable_device(struct pci_dev *dev) |
580 | { | 627 | { |
581 | int err; | 628 | int err; |
582 | 629 | ||
583 | if (dev->is_enabled) | ||
584 | return 0; | ||
585 | |||
586 | err = pci_enable_device_bars(dev, (1 << PCI_NUM_RESOURCES) - 1); | 630 | err = pci_enable_device_bars(dev, (1 << PCI_NUM_RESOURCES) - 1); |
587 | if (err) | 631 | if (err) |
588 | return err; | 632 | return err; |
589 | pci_fixup_device(pci_fixup_enable, dev); | 633 | pci_fixup_device(pci_fixup_enable, dev); |
590 | dev->is_enabled = 1; | ||
591 | return 0; | 634 | return 0; |
592 | } | 635 | } |
593 | 636 | ||
594 | /** | 637 | /** |
638 | * pci_enable_device - Initialize device before it's used by a driver. | ||
639 | * @dev: PCI device to be initialized | ||
640 | * | ||
641 | * Initialize device before it's used by a driver. Ask low-level code | ||
642 | * to enable I/O and memory. Wake up the device if it was suspended. | ||
643 | * Beware, this function can fail. | ||
644 | * | ||
645 | * Note we don't actually enable the device many times if we call | ||
646 | * this function repeatedly (we just increment the count). | ||
647 | */ | ||
648 | int pci_enable_device(struct pci_dev *dev) | ||
649 | { | ||
650 | int result; | ||
651 | if (atomic_add_return(1, &dev->enable_cnt) > 1) | ||
652 | return 0; /* already enabled */ | ||
653 | result = __pci_enable_device(dev); | ||
654 | if (result < 0) | ||
655 | atomic_dec(&dev->enable_cnt); | ||
656 | return result; | ||
657 | } | ||
658 | |||
659 | /** | ||
595 | * pcibios_disable_device - disable arch specific PCI resources for device dev | 660 | * pcibios_disable_device - disable arch specific PCI resources for device dev |
596 | * @dev: the PCI device to disable | 661 | * @dev: the PCI device to disable |
597 | * | 662 | * |
@@ -607,12 +672,18 @@ void __attribute__ ((weak)) pcibios_disable_device (struct pci_dev *dev) {} | |||
607 | * | 672 | * |
608 | * Signal to the system that the PCI device is not in use by the system | 673 | * Signal to the system that the PCI device is not in use by the system |
609 | * anymore. This only involves disabling PCI bus-mastering, if active. | 674 | * anymore. This only involves disabling PCI bus-mastering, if active. |
675 | * | ||
676 | * Note we don't actually disable the device until all callers of | ||
677 | * pci_device_enable() have called pci_device_disable(). | ||
610 | */ | 678 | */ |
611 | void | 679 | void |
612 | pci_disable_device(struct pci_dev *dev) | 680 | pci_disable_device(struct pci_dev *dev) |
613 | { | 681 | { |
614 | u16 pci_command; | 682 | u16 pci_command; |
615 | 683 | ||
684 | if (atomic_sub_return(1, &dev->enable_cnt) != 0) | ||
685 | return; | ||
686 | |||
616 | if (dev->msi_enabled) | 687 | if (dev->msi_enabled) |
617 | disable_msi_mode(dev, pci_find_capability(dev, PCI_CAP_ID_MSI), | 688 | disable_msi_mode(dev, pci_find_capability(dev, PCI_CAP_ID_MSI), |
618 | PCI_CAP_ID_MSI); | 689 | PCI_CAP_ID_MSI); |
@@ -628,7 +699,6 @@ pci_disable_device(struct pci_dev *dev) | |||
628 | dev->is_busmaster = 0; | 699 | dev->is_busmaster = 0; |
629 | 700 | ||
630 | pcibios_disable_device(dev); | 701 | pcibios_disable_device(dev); |
631 | dev->is_enabled = 0; | ||
632 | } | 702 | } |
633 | 703 | ||
634 | /** | 704 | /** |
@@ -831,22 +901,38 @@ pci_set_master(struct pci_dev *dev) | |||
831 | pcibios_set_master(dev); | 901 | pcibios_set_master(dev); |
832 | } | 902 | } |
833 | 903 | ||
834 | #ifndef HAVE_ARCH_PCI_MWI | 904 | #ifdef PCI_DISABLE_MWI |
905 | int pci_set_mwi(struct pci_dev *dev) | ||
906 | { | ||
907 | return 0; | ||
908 | } | ||
909 | |||
910 | void pci_clear_mwi(struct pci_dev *dev) | ||
911 | { | ||
912 | } | ||
913 | |||
914 | #else | ||
915 | |||
916 | #ifndef PCI_CACHE_LINE_BYTES | ||
917 | #define PCI_CACHE_LINE_BYTES L1_CACHE_BYTES | ||
918 | #endif | ||
919 | |||
835 | /* This can be overridden by arch code. */ | 920 | /* This can be overridden by arch code. */ |
836 | u8 pci_cache_line_size = L1_CACHE_BYTES >> 2; | 921 | /* Don't forget this is measured in 32-bit words, not bytes */ |
922 | u8 pci_cache_line_size = PCI_CACHE_LINE_BYTES / 4; | ||
837 | 923 | ||
838 | /** | 924 | /** |
839 | * pci_generic_prep_mwi - helper function for pci_set_mwi | 925 | * pci_set_cacheline_size - ensure the CACHE_LINE_SIZE register is programmed |
840 | * @dev: the PCI device for which MWI is enabled | 926 | * @dev: the PCI device for which MWI is to be enabled |
841 | * | 927 | * |
842 | * Helper function for generic implementation of pcibios_prep_mwi | 928 | * Helper function for pci_set_mwi. |
843 | * function. Originally copied from drivers/net/acenic.c. | 929 | * Originally copied from drivers/net/acenic.c. |
844 | * Copyright 1998-2001 by Jes Sorensen, <jes@trained-monkey.org>. | 930 | * Copyright 1998-2001 by Jes Sorensen, <jes@trained-monkey.org>. |
845 | * | 931 | * |
846 | * RETURNS: An appropriate -ERRNO error value on error, or zero for success. | 932 | * RETURNS: An appropriate -ERRNO error value on error, or zero for success. |
847 | */ | 933 | */ |
848 | static int | 934 | static int |
849 | pci_generic_prep_mwi(struct pci_dev *dev) | 935 | pci_set_cacheline_size(struct pci_dev *dev) |
850 | { | 936 | { |
851 | u8 cacheline_size; | 937 | u8 cacheline_size; |
852 | 938 | ||
@@ -872,7 +958,6 @@ pci_generic_prep_mwi(struct pci_dev *dev) | |||
872 | 958 | ||
873 | return -EINVAL; | 959 | return -EINVAL; |
874 | } | 960 | } |
875 | #endif /* !HAVE_ARCH_PCI_MWI */ | ||
876 | 961 | ||
877 | /** | 962 | /** |
878 | * pci_set_mwi - enables memory-write-invalidate PCI transaction | 963 | * pci_set_mwi - enables memory-write-invalidate PCI transaction |
@@ -890,12 +975,7 @@ pci_set_mwi(struct pci_dev *dev) | |||
890 | int rc; | 975 | int rc; |
891 | u16 cmd; | 976 | u16 cmd; |
892 | 977 | ||
893 | #ifdef HAVE_ARCH_PCI_MWI | 978 | rc = pci_set_cacheline_size(dev); |
894 | rc = pcibios_prep_mwi(dev); | ||
895 | #else | ||
896 | rc = pci_generic_prep_mwi(dev); | ||
897 | #endif | ||
898 | |||
899 | if (rc) | 979 | if (rc) |
900 | return rc; | 980 | return rc; |
901 | 981 | ||
@@ -926,6 +1006,7 @@ pci_clear_mwi(struct pci_dev *dev) | |||
926 | pci_write_config_word(dev, PCI_COMMAND, cmd); | 1006 | pci_write_config_word(dev, PCI_COMMAND, cmd); |
927 | } | 1007 | } |
928 | } | 1008 | } |
1009 | #endif /* ! PCI_DISABLE_MWI */ | ||
929 | 1010 | ||
930 | /** | 1011 | /** |
931 | * pci_intx - enables/disables PCI INTx for device dev | 1012 | * pci_intx - enables/disables PCI INTx for device dev |
diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h index 6bf327db5c5e..398852f526a6 100644 --- a/drivers/pci/pci.h +++ b/drivers/pci/pci.h | |||
@@ -1,5 +1,6 @@ | |||
1 | /* Functions internal to the PCI core code */ | 1 | /* Functions internal to the PCI core code */ |
2 | 2 | ||
3 | extern int __must_check __pci_enable_device(struct pci_dev *); | ||
3 | extern int pci_uevent(struct device *dev, char **envp, int num_envp, | 4 | extern int pci_uevent(struct device *dev, char **envp, int num_envp, |
4 | char *buffer, int buffer_size); | 5 | char *buffer, int buffer_size); |
5 | extern int pci_create_sysfs_dev_files(struct pci_dev *pdev); | 6 | extern int pci_create_sysfs_dev_files(struct pci_dev *pdev); |
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c index e159d6604494..0eeac60042b3 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c | |||
@@ -679,6 +679,33 @@ static int pci_setup_device(struct pci_dev * dev) | |||
679 | pci_read_bases(dev, 6, PCI_ROM_ADDRESS); | 679 | pci_read_bases(dev, 6, PCI_ROM_ADDRESS); |
680 | pci_read_config_word(dev, PCI_SUBSYSTEM_VENDOR_ID, &dev->subsystem_vendor); | 680 | pci_read_config_word(dev, PCI_SUBSYSTEM_VENDOR_ID, &dev->subsystem_vendor); |
681 | pci_read_config_word(dev, PCI_SUBSYSTEM_ID, &dev->subsystem_device); | 681 | pci_read_config_word(dev, PCI_SUBSYSTEM_ID, &dev->subsystem_device); |
682 | |||
683 | /* | ||
684 | * Do the ugly legacy mode stuff here rather than broken chip | ||
685 | * quirk code. Legacy mode ATA controllers have fixed | ||
686 | * addresses. These are not always echoed in BAR0-3, and | ||
687 | * BAR0-3 in a few cases contain junk! | ||
688 | */ | ||
689 | if (class == PCI_CLASS_STORAGE_IDE) { | ||
690 | u8 progif; | ||
691 | pci_read_config_byte(dev, PCI_CLASS_PROG, &progif); | ||
692 | if ((progif & 1) == 0) { | ||
693 | dev->resource[0].start = 0x1F0; | ||
694 | dev->resource[0].end = 0x1F7; | ||
695 | dev->resource[0].flags = IORESOURCE_IO; | ||
696 | dev->resource[1].start = 0x3F6; | ||
697 | dev->resource[1].end = 0x3F6; | ||
698 | dev->resource[1].flags = IORESOURCE_IO; | ||
699 | } | ||
700 | if ((progif & 4) == 0) { | ||
701 | dev->resource[2].start = 0x170; | ||
702 | dev->resource[2].end = 0x177; | ||
703 | dev->resource[2].flags = IORESOURCE_IO; | ||
704 | dev->resource[3].start = 0x376; | ||
705 | dev->resource[3].end = 0x376; | ||
706 | dev->resource[3].flags = IORESOURCE_IO; | ||
707 | } | ||
708 | } | ||
682 | break; | 709 | break; |
683 | 710 | ||
684 | case PCI_HEADER_TYPE_BRIDGE: /* bridge header */ | 711 | case PCI_HEADER_TYPE_BRIDGE: /* bridge header */ |
diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c index 5b4483811691..9ca9b9bf6160 100644 --- a/drivers/pci/quirks.c +++ b/drivers/pci/quirks.c | |||
@@ -797,56 +797,6 @@ static void __init quirk_mediagx_master(struct pci_dev *dev) | |||
797 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_CYRIX, PCI_DEVICE_ID_CYRIX_PCI_MASTER, quirk_mediagx_master ); | 797 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_CYRIX, PCI_DEVICE_ID_CYRIX_PCI_MASTER, quirk_mediagx_master ); |
798 | 798 | ||
799 | /* | 799 | /* |
800 | * As per PCI spec, ignore base address registers 0-3 of the IDE controllers | ||
801 | * running in Compatible mode (bits 0 and 2 in the ProgIf for primary and | ||
802 | * secondary channels respectively). If the device reports Compatible mode | ||
803 | * but does use BAR0-3 for address decoding, we assume that firmware has | ||
804 | * programmed these BARs with standard values (0x1f0,0x3f4 and 0x170,0x374). | ||
805 | * Exceptions (if they exist) must be handled in chip/architecture specific | ||
806 | * fixups. | ||
807 | * | ||
808 | * Note: for non x86 people. You may need an arch specific quirk to handle | ||
809 | * moving IDE devices to native mode as well. Some plug in card devices power | ||
810 | * up in compatible mode and assume the BIOS will adjust them. | ||
811 | * | ||
812 | * Q: should we load the 0x1f0,0x3f4 into the registers or zap them as | ||
813 | * we do now ? We don't want is pci_enable_device to come along | ||
814 | * and assign new resources. Both approaches work for that. | ||
815 | */ | ||
816 | static void __devinit quirk_ide_bases(struct pci_dev *dev) | ||
817 | { | ||
818 | struct resource *res; | ||
819 | int first_bar = 2, last_bar = 0; | ||
820 | |||
821 | if ((dev->class >> 8) != PCI_CLASS_STORAGE_IDE) | ||
822 | return; | ||
823 | |||
824 | res = &dev->resource[0]; | ||
825 | |||
826 | /* primary channel: ProgIf bit 0, BAR0, BAR1 */ | ||
827 | if (!(dev->class & 1) && (res[0].flags || res[1].flags)) { | ||
828 | res[0].start = res[0].end = res[0].flags = 0; | ||
829 | res[1].start = res[1].end = res[1].flags = 0; | ||
830 | first_bar = 0; | ||
831 | last_bar = 1; | ||
832 | } | ||
833 | |||
834 | /* secondary channel: ProgIf bit 2, BAR2, BAR3 */ | ||
835 | if (!(dev->class & 4) && (res[2].flags || res[3].flags)) { | ||
836 | res[2].start = res[2].end = res[2].flags = 0; | ||
837 | res[3].start = res[3].end = res[3].flags = 0; | ||
838 | last_bar = 3; | ||
839 | } | ||
840 | |||
841 | if (!last_bar) | ||
842 | return; | ||
843 | |||
844 | printk(KERN_INFO "PCI: Ignoring BAR%d-%d of IDE controller %s\n", | ||
845 | first_bar, last_bar, pci_name(dev)); | ||
846 | } | ||
847 | DECLARE_PCI_FIXUP_HEADER(PCI_ANY_ID, PCI_ANY_ID, quirk_ide_bases); | ||
848 | |||
849 | /* | ||
850 | * Ensure C0 rev restreaming is off. This is normally done by | 800 | * Ensure C0 rev restreaming is off. This is normally done by |
851 | * the BIOS but in the odd case it is not the results are corruption | 801 | * the BIOS but in the odd case it is not the results are corruption |
852 | * hence the presence of a Linux check | 802 | * hence the presence of a Linux check |
@@ -880,11 +830,10 @@ static void __devinit quirk_svwks_csb5ide(struct pci_dev *pdev) | |||
880 | prog &= ~5; | 830 | prog &= ~5; |
881 | pdev->class &= ~5; | 831 | pdev->class &= ~5; |
882 | pci_write_config_byte(pdev, PCI_CLASS_PROG, prog); | 832 | pci_write_config_byte(pdev, PCI_CLASS_PROG, prog); |
883 | /* need to re-assign BARs for compat mode */ | 833 | /* PCI layer will sort out resources */ |
884 | quirk_ide_bases(pdev); | ||
885 | } | 834 | } |
886 | } | 835 | } |
887 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_CSB5IDE, quirk_svwks_csb5ide ); | 836 | DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_CSB5IDE, quirk_svwks_csb5ide ); |
888 | 837 | ||
889 | /* | 838 | /* |
890 | * Intel 82801CAM ICH3-M datasheet says IDE modes must be the same | 839 | * Intel 82801CAM ICH3-M datasheet says IDE modes must be the same |
@@ -900,11 +849,9 @@ static void __init quirk_ide_samemode(struct pci_dev *pdev) | |||
900 | prog &= ~5; | 849 | prog &= ~5; |
901 | pdev->class &= ~5; | 850 | pdev->class &= ~5; |
902 | pci_write_config_byte(pdev, PCI_CLASS_PROG, prog); | 851 | pci_write_config_byte(pdev, PCI_CLASS_PROG, prog); |
903 | /* need to re-assign BARs for compat mode */ | ||
904 | quirk_ide_bases(pdev); | ||
905 | } | 852 | } |
906 | } | 853 | } |
907 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801CA_10, quirk_ide_samemode); | 854 | DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801CA_10, quirk_ide_samemode); |
908 | 855 | ||
909 | /* This was originally an Alpha specific thing, but it really fits here. | 856 | /* This was originally an Alpha specific thing, but it really fits here. |
910 | * The i82375 PCI/EISA bridge appears as non-classified. Fix that. | 857 | * The i82375 PCI/EISA bridge appears as non-classified. Fix that. |
diff --git a/drivers/pci/rom.c b/drivers/pci/rom.c index e1dcefc69bb4..d087e0817715 100644 --- a/drivers/pci/rom.c +++ b/drivers/pci/rom.c | |||
@@ -81,7 +81,8 @@ void __iomem *pci_map_rom(struct pci_dev *pdev, size_t *size) | |||
81 | start = (loff_t)0xC0000; | 81 | start = (loff_t)0xC0000; |
82 | *size = 0x20000; /* cover C000:0 through E000:0 */ | 82 | *size = 0x20000; /* cover C000:0 through E000:0 */ |
83 | } else { | 83 | } else { |
84 | if (res->flags & IORESOURCE_ROM_COPY) { | 84 | if (res->flags & |
85 | (IORESOURCE_ROM_COPY | IORESOURCE_ROM_BIOS_COPY)) { | ||
85 | *size = pci_resource_len(pdev, PCI_ROM_RESOURCE); | 86 | *size = pci_resource_len(pdev, PCI_ROM_RESOURCE); |
86 | return (void __iomem *)(unsigned long) | 87 | return (void __iomem *)(unsigned long) |
87 | pci_resource_start(pdev, PCI_ROM_RESOURCE); | 88 | pci_resource_start(pdev, PCI_ROM_RESOURCE); |
@@ -165,7 +166,8 @@ void __iomem *pci_map_rom_copy(struct pci_dev *pdev, size_t *size) | |||
165 | if (!rom) | 166 | if (!rom) |
166 | return NULL; | 167 | return NULL; |
167 | 168 | ||
168 | if (res->flags & (IORESOURCE_ROM_COPY | IORESOURCE_ROM_SHADOW)) | 169 | if (res->flags & (IORESOURCE_ROM_COPY | IORESOURCE_ROM_SHADOW | |
170 | IORESOURCE_ROM_BIOS_COPY)) | ||
169 | return rom; | 171 | return rom; |
170 | 172 | ||
171 | res->start = (unsigned long)kmalloc(*size, GFP_KERNEL); | 173 | res->start = (unsigned long)kmalloc(*size, GFP_KERNEL); |
@@ -191,7 +193,7 @@ void pci_unmap_rom(struct pci_dev *pdev, void __iomem *rom) | |||
191 | { | 193 | { |
192 | struct resource *res = &pdev->resource[PCI_ROM_RESOURCE]; | 194 | struct resource *res = &pdev->resource[PCI_ROM_RESOURCE]; |
193 | 195 | ||
194 | if (res->flags & IORESOURCE_ROM_COPY) | 196 | if (res->flags & (IORESOURCE_ROM_COPY | IORESOURCE_ROM_BIOS_COPY)) |
195 | return; | 197 | return; |
196 | 198 | ||
197 | iounmap(rom); | 199 | iounmap(rom); |
@@ -215,6 +217,7 @@ void pci_remove_rom(struct pci_dev *pdev) | |||
215 | sysfs_remove_bin_file(&pdev->dev.kobj, pdev->rom_attr); | 217 | sysfs_remove_bin_file(&pdev->dev.kobj, pdev->rom_attr); |
216 | if (!(res->flags & (IORESOURCE_ROM_ENABLE | | 218 | if (!(res->flags & (IORESOURCE_ROM_ENABLE | |
217 | IORESOURCE_ROM_SHADOW | | 219 | IORESOURCE_ROM_SHADOW | |
220 | IORESOURCE_ROM_BIOS_COPY | | ||
218 | IORESOURCE_ROM_COPY))) | 221 | IORESOURCE_ROM_COPY))) |
219 | pci_disable_rom(pdev); | 222 | pci_disable_rom(pdev); |
220 | } | 223 | } |