aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci/pci.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/pci/pci.c')
-rw-r--r--drivers/pci/pci.c506
1 files changed, 450 insertions, 56 deletions
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index 44a1a8a0ad7b..d3fdce8f3d65 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -22,6 +22,7 @@
22#include <linux/interrupt.h> 22#include <linux/interrupt.h>
23#include <linux/device.h> 23#include <linux/device.h>
24#include <linux/pm_runtime.h> 24#include <linux/pm_runtime.h>
25#include <linux/pci_hotplug.h>
25#include <asm-generic/pci-bridge.h> 26#include <asm-generic/pci-bridge.h>
26#include <asm/setup.h> 27#include <asm/setup.h>
27#include "pci.h" 28#include "pci.h"
@@ -2012,7 +2013,7 @@ static void pci_add_saved_cap(struct pci_dev *pci_dev,
2012} 2013}
2013 2014
2014/** 2015/**
2015 * pci_add_save_buffer - allocate buffer for saving given capability registers 2016 * pci_add_cap_save_buffer - allocate buffer for saving given capability registers
2016 * @dev: the PCI device 2017 * @dev: the PCI device
2017 * @cap: the capability to allocate the buffer for 2018 * @cap: the capability to allocate the buffer for
2018 * @size: requested size of the buffer 2019 * @size: requested size of the buffer
@@ -2379,6 +2380,27 @@ void pci_enable_acs(struct pci_dev *dev)
2379 pci_write_config_word(dev, pos + PCI_ACS_CTRL, ctrl); 2380 pci_write_config_word(dev, pos + PCI_ACS_CTRL, ctrl);
2380} 2381}
2381 2382
2383static bool pci_acs_flags_enabled(struct pci_dev *pdev, u16 acs_flags)
2384{
2385 int pos;
2386 u16 cap, ctrl;
2387
2388 pos = pci_find_ext_capability(pdev, PCI_EXT_CAP_ID_ACS);
2389 if (!pos)
2390 return false;
2391
2392 /*
2393 * Except for egress control, capabilities are either required
2394 * or only required if controllable. Features missing from the
2395 * capability field can therefore be assumed as hard-wired enabled.
2396 */
2397 pci_read_config_word(pdev, pos + PCI_ACS_CAP, &cap);
2398 acs_flags &= (cap | PCI_ACS_EC);
2399
2400 pci_read_config_word(pdev, pos + PCI_ACS_CTRL, &ctrl);
2401 return (ctrl & acs_flags) == acs_flags;
2402}
2403
2382/** 2404/**
2383 * pci_acs_enabled - test ACS against required flags for a given device 2405 * pci_acs_enabled - test ACS against required flags for a given device
2384 * @pdev: device to test 2406 * @pdev: device to test
@@ -2386,36 +2408,76 @@ void pci_enable_acs(struct pci_dev *dev)
2386 * 2408 *
2387 * Return true if the device supports the provided flags. Automatically 2409 * Return true if the device supports the provided flags. Automatically
2388 * filters out flags that are not implemented on multifunction devices. 2410 * filters out flags that are not implemented on multifunction devices.
2411 *
2412 * Note that this interface checks the effective ACS capabilities of the
2413 * device rather than the actual capabilities. For instance, most single
2414 * function endpoints are not required to support ACS because they have no
2415 * opportunity for peer-to-peer access. We therefore return 'true'
2416 * regardless of whether the device exposes an ACS capability. This makes
2417 * it much easier for callers of this function to ignore the actual type
2418 * or topology of the device when testing ACS support.
2389 */ 2419 */
2390bool pci_acs_enabled(struct pci_dev *pdev, u16 acs_flags) 2420bool pci_acs_enabled(struct pci_dev *pdev, u16 acs_flags)
2391{ 2421{
2392 int pos, ret; 2422 int ret;
2393 u16 ctrl;
2394 2423
2395 ret = pci_dev_specific_acs_enabled(pdev, acs_flags); 2424 ret = pci_dev_specific_acs_enabled(pdev, acs_flags);
2396 if (ret >= 0) 2425 if (ret >= 0)
2397 return ret > 0; 2426 return ret > 0;
2398 2427
2428 /*
2429 * Conventional PCI and PCI-X devices never support ACS, either
2430 * effectively or actually. The shared bus topology implies that
2431 * any device on the bus can receive or snoop DMA.
2432 */
2399 if (!pci_is_pcie(pdev)) 2433 if (!pci_is_pcie(pdev))
2400 return false; 2434 return false;
2401 2435
2402 /* Filter out flags not applicable to multifunction */ 2436 switch (pci_pcie_type(pdev)) {
2403 if (pdev->multifunction) 2437 /*
2404 acs_flags &= (PCI_ACS_RR | PCI_ACS_CR | 2438 * PCI/X-to-PCIe bridges are not specifically mentioned by the spec,
2405 PCI_ACS_EC | PCI_ACS_DT); 2439 * but since their primary inteface is PCI/X, we conservatively
2406 2440 * handle them as we would a non-PCIe device.
2407 if (pci_pcie_type(pdev) == PCI_EXP_TYPE_DOWNSTREAM || 2441 */
2408 pci_pcie_type(pdev) == PCI_EXP_TYPE_ROOT_PORT || 2442 case PCI_EXP_TYPE_PCIE_BRIDGE:
2409 pdev->multifunction) { 2443 /*
2410 pos = pci_find_ext_capability(pdev, PCI_EXT_CAP_ID_ACS); 2444 * PCIe 3.0, 6.12.1 excludes ACS on these devices. "ACS is never
2411 if (!pos) 2445 * applicable... must never implement an ACS Extended Capability...".
2412 return false; 2446 * This seems arbitrary, but we take a conservative interpretation
2447 * of this statement.
2448 */
2449 case PCI_EXP_TYPE_PCI_BRIDGE:
2450 case PCI_EXP_TYPE_RC_EC:
2451 return false;
2452 /*
2453 * PCIe 3.0, 6.12.1.1 specifies that downstream and root ports should
2454 * implement ACS in order to indicate their peer-to-peer capabilities,
2455 * regardless of whether they are single- or multi-function devices.
2456 */
2457 case PCI_EXP_TYPE_DOWNSTREAM:
2458 case PCI_EXP_TYPE_ROOT_PORT:
2459 return pci_acs_flags_enabled(pdev, acs_flags);
2460 /*
2461 * PCIe 3.0, 6.12.1.2 specifies ACS capabilities that should be
2462 * implemented by the remaining PCIe types to indicate peer-to-peer
2463 * capabilities, but only when they are part of a multifunciton
2464 * device. The footnote for section 6.12 indicates the specific
2465 * PCIe types included here.
2466 */
2467 case PCI_EXP_TYPE_ENDPOINT:
2468 case PCI_EXP_TYPE_UPSTREAM:
2469 case PCI_EXP_TYPE_LEG_END:
2470 case PCI_EXP_TYPE_RC_END:
2471 if (!pdev->multifunction)
2472 break;
2413 2473
2414 pci_read_config_word(pdev, pos + PCI_ACS_CTRL, &ctrl); 2474 return pci_acs_flags_enabled(pdev, acs_flags);
2415 if ((ctrl & acs_flags) != acs_flags)
2416 return false;
2417 } 2475 }
2418 2476
2477 /*
2478 * PCIe 3.0, 6.12.1.3 specifies no ACS capabilties are applicable
2479 * to single function devices with the exception of downstream ports.
2480 */
2419 return true; 2481 return true;
2420} 2482}
2421 2483
@@ -3118,19 +3180,17 @@ int pci_set_dma_seg_boundary(struct pci_dev *dev, unsigned long mask)
3118} 3180}
3119EXPORT_SYMBOL(pci_set_dma_seg_boundary); 3181EXPORT_SYMBOL(pci_set_dma_seg_boundary);
3120 3182
3121static int pcie_flr(struct pci_dev *dev, int probe) 3183/**
3184 * pci_wait_for_pending_transaction - waits for pending transaction
3185 * @dev: the PCI device to operate on
3186 *
3187 * Return 0 if transaction is pending 1 otherwise.
3188 */
3189int pci_wait_for_pending_transaction(struct pci_dev *dev)
3122{ 3190{
3123 int i; 3191 int i;
3124 u32 cap;
3125 u16 status; 3192 u16 status;
3126 3193
3127 pcie_capability_read_dword(dev, PCI_EXP_DEVCAP, &cap);
3128 if (!(cap & PCI_EXP_DEVCAP_FLR))
3129 return -ENOTTY;
3130
3131 if (probe)
3132 return 0;
3133
3134 /* Wait for Transaction Pending bit clean */ 3194 /* Wait for Transaction Pending bit clean */
3135 for (i = 0; i < 4; i++) { 3195 for (i = 0; i < 4; i++) {
3136 if (i) 3196 if (i)
@@ -3138,13 +3198,27 @@ static int pcie_flr(struct pci_dev *dev, int probe)
3138 3198
3139 pcie_capability_read_word(dev, PCI_EXP_DEVSTA, &status); 3199 pcie_capability_read_word(dev, PCI_EXP_DEVSTA, &status);
3140 if (!(status & PCI_EXP_DEVSTA_TRPND)) 3200 if (!(status & PCI_EXP_DEVSTA_TRPND))
3141 goto clear; 3201 return 1;
3142 } 3202 }
3143 3203
3144 dev_err(&dev->dev, "transaction is not cleared; " 3204 return 0;
3145 "proceeding with reset anyway\n"); 3205}
3206EXPORT_SYMBOL(pci_wait_for_pending_transaction);
3207
3208static int pcie_flr(struct pci_dev *dev, int probe)
3209{
3210 u32 cap;
3211
3212 pcie_capability_read_dword(dev, PCI_EXP_DEVCAP, &cap);
3213 if (!(cap & PCI_EXP_DEVCAP_FLR))
3214 return -ENOTTY;
3215
3216 if (probe)
3217 return 0;
3218
3219 if (!pci_wait_for_pending_transaction(dev))
3220 dev_err(&dev->dev, "transaction is not cleared; proceeding with reset anyway\n");
3146 3221
3147clear:
3148 pcie_capability_set_word(dev, PCI_EXP_DEVCTL, PCI_EXP_DEVCTL_BCR_FLR); 3222 pcie_capability_set_word(dev, PCI_EXP_DEVCTL, PCI_EXP_DEVCTL_BCR_FLR);
3149 3223
3150 msleep(100); 3224 msleep(100);
@@ -3235,9 +3309,42 @@ static int pci_pm_reset(struct pci_dev *dev, int probe)
3235 return 0; 3309 return 0;
3236} 3310}
3237 3311
3238static int pci_parent_bus_reset(struct pci_dev *dev, int probe) 3312/**
3313 * pci_reset_bridge_secondary_bus - Reset the secondary bus on a PCI bridge.
3314 * @dev: Bridge device
3315 *
3316 * Use the bridge control register to assert reset on the secondary bus.
3317 * Devices on the secondary bus are left in power-on state.
3318 */
3319void pci_reset_bridge_secondary_bus(struct pci_dev *dev)
3239{ 3320{
3240 u16 ctrl; 3321 u16 ctrl;
3322
3323 pci_read_config_word(dev, PCI_BRIDGE_CONTROL, &ctrl);
3324 ctrl |= PCI_BRIDGE_CTL_BUS_RESET;
3325 pci_write_config_word(dev, PCI_BRIDGE_CONTROL, ctrl);
3326 /*
3327 * PCI spec v3.0 7.6.4.2 requires minimum Trst of 1ms. Double
3328 * this to 2ms to ensure that we meet the minium requirement.
3329 */
3330 msleep(2);
3331
3332 ctrl &= ~PCI_BRIDGE_CTL_BUS_RESET;
3333 pci_write_config_word(dev, PCI_BRIDGE_CONTROL, ctrl);
3334
3335 /*
3336 * Trhfa for conventional PCI is 2^25 clock cycles.
3337 * Assuming a minimum 33MHz clock this results in a 1s
3338 * delay before we can consider subordinate devices to
3339 * be re-initialized. PCIe has some ways to shorten this,
3340 * but we don't make use of them yet.
3341 */
3342 ssleep(1);
3343}
3344EXPORT_SYMBOL_GPL(pci_reset_bridge_secondary_bus);
3345
3346static int pci_parent_bus_reset(struct pci_dev *dev, int probe)
3347{
3241 struct pci_dev *pdev; 3348 struct pci_dev *pdev;
3242 3349
3243 if (pci_is_root_bus(dev->bus) || dev->subordinate || !dev->bus->self) 3350 if (pci_is_root_bus(dev->bus) || dev->subordinate || !dev->bus->self)
@@ -3250,18 +3357,40 @@ static int pci_parent_bus_reset(struct pci_dev *dev, int probe)
3250 if (probe) 3357 if (probe)
3251 return 0; 3358 return 0;
3252 3359
3253 pci_read_config_word(dev->bus->self, PCI_BRIDGE_CONTROL, &ctrl); 3360 pci_reset_bridge_secondary_bus(dev->bus->self);
3254 ctrl |= PCI_BRIDGE_CTL_BUS_RESET;
3255 pci_write_config_word(dev->bus->self, PCI_BRIDGE_CONTROL, ctrl);
3256 msleep(100);
3257
3258 ctrl &= ~PCI_BRIDGE_CTL_BUS_RESET;
3259 pci_write_config_word(dev->bus->self, PCI_BRIDGE_CONTROL, ctrl);
3260 msleep(100);
3261 3361
3262 return 0; 3362 return 0;
3263} 3363}
3264 3364
3365static int pci_reset_hotplug_slot(struct hotplug_slot *hotplug, int probe)
3366{
3367 int rc = -ENOTTY;
3368
3369 if (!hotplug || !try_module_get(hotplug->ops->owner))
3370 return rc;
3371
3372 if (hotplug->ops->reset_slot)
3373 rc = hotplug->ops->reset_slot(hotplug, probe);
3374
3375 module_put(hotplug->ops->owner);
3376
3377 return rc;
3378}
3379
3380static int pci_dev_reset_slot_function(struct pci_dev *dev, int probe)
3381{
3382 struct pci_dev *pdev;
3383
3384 if (dev->subordinate || !dev->slot)
3385 return -ENOTTY;
3386
3387 list_for_each_entry(pdev, &dev->bus->devices, bus_list)
3388 if (pdev != dev && pdev->slot == dev->slot)
3389 return -ENOTTY;
3390
3391 return pci_reset_hotplug_slot(dev->slot->hotplug, probe);
3392}
3393
3265static int __pci_dev_reset(struct pci_dev *dev, int probe) 3394static int __pci_dev_reset(struct pci_dev *dev, int probe)
3266{ 3395{
3267 int rc; 3396 int rc;
@@ -3284,27 +3413,65 @@ static int __pci_dev_reset(struct pci_dev *dev, int probe)
3284 if (rc != -ENOTTY) 3413 if (rc != -ENOTTY)
3285 goto done; 3414 goto done;
3286 3415
3416 rc = pci_dev_reset_slot_function(dev, probe);
3417 if (rc != -ENOTTY)
3418 goto done;
3419
3287 rc = pci_parent_bus_reset(dev, probe); 3420 rc = pci_parent_bus_reset(dev, probe);
3288done: 3421done:
3289 return rc; 3422 return rc;
3290} 3423}
3291 3424
3425static void pci_dev_lock(struct pci_dev *dev)
3426{
3427 pci_cfg_access_lock(dev);
3428 /* block PM suspend, driver probe, etc. */
3429 device_lock(&dev->dev);
3430}
3431
3432static void pci_dev_unlock(struct pci_dev *dev)
3433{
3434 device_unlock(&dev->dev);
3435 pci_cfg_access_unlock(dev);
3436}
3437
3438static void pci_dev_save_and_disable(struct pci_dev *dev)
3439{
3440 /*
3441 * Wake-up device prior to save. PM registers default to D0 after
3442 * reset and a simple register restore doesn't reliably return
3443 * to a non-D0 state anyway.
3444 */
3445 pci_set_power_state(dev, PCI_D0);
3446
3447 pci_save_state(dev);
3448 /*
3449 * Disable the device by clearing the Command register, except for
3450 * INTx-disable which is set. This not only disables MMIO and I/O port
3451 * BARs, but also prevents the device from being Bus Master, preventing
3452 * DMA from the device including MSI/MSI-X interrupts. For PCI 2.3
3453 * compliant devices, INTx-disable prevents legacy interrupts.
3454 */
3455 pci_write_config_word(dev, PCI_COMMAND, PCI_COMMAND_INTX_DISABLE);
3456}
3457
3458static void pci_dev_restore(struct pci_dev *dev)
3459{
3460 pci_restore_state(dev);
3461}
3462
3292static int pci_dev_reset(struct pci_dev *dev, int probe) 3463static int pci_dev_reset(struct pci_dev *dev, int probe)
3293{ 3464{
3294 int rc; 3465 int rc;
3295 3466
3296 if (!probe) { 3467 if (!probe)
3297 pci_cfg_access_lock(dev); 3468 pci_dev_lock(dev);
3298 /* block PM suspend, driver probe, etc. */
3299 device_lock(&dev->dev);
3300 }
3301 3469
3302 rc = __pci_dev_reset(dev, probe); 3470 rc = __pci_dev_reset(dev, probe);
3303 3471
3304 if (!probe) { 3472 if (!probe)
3305 device_unlock(&dev->dev); 3473 pci_dev_unlock(dev);
3306 pci_cfg_access_unlock(dev); 3474
3307 }
3308 return rc; 3475 return rc;
3309} 3476}
3310/** 3477/**
@@ -3395,22 +3562,249 @@ int pci_reset_function(struct pci_dev *dev)
3395 if (rc) 3562 if (rc)
3396 return rc; 3563 return rc;
3397 3564
3398 pci_save_state(dev); 3565 pci_dev_save_and_disable(dev);
3399
3400 /*
3401 * both INTx and MSI are disabled after the Interrupt Disable bit
3402 * is set and the Bus Master bit is cleared.
3403 */
3404 pci_write_config_word(dev, PCI_COMMAND, PCI_COMMAND_INTX_DISABLE);
3405 3566
3406 rc = pci_dev_reset(dev, 0); 3567 rc = pci_dev_reset(dev, 0);
3407 3568
3408 pci_restore_state(dev); 3569 pci_dev_restore(dev);
3409 3570
3410 return rc; 3571 return rc;
3411} 3572}
3412EXPORT_SYMBOL_GPL(pci_reset_function); 3573EXPORT_SYMBOL_GPL(pci_reset_function);
3413 3574
3575/* Lock devices from the top of the tree down */
3576static void pci_bus_lock(struct pci_bus *bus)
3577{
3578 struct pci_dev *dev;
3579
3580 list_for_each_entry(dev, &bus->devices, bus_list) {
3581 pci_dev_lock(dev);
3582 if (dev->subordinate)
3583 pci_bus_lock(dev->subordinate);
3584 }
3585}
3586
3587/* Unlock devices from the bottom of the tree up */
3588static void pci_bus_unlock(struct pci_bus *bus)
3589{
3590 struct pci_dev *dev;
3591
3592 list_for_each_entry(dev, &bus->devices, bus_list) {
3593 if (dev->subordinate)
3594 pci_bus_unlock(dev->subordinate);
3595 pci_dev_unlock(dev);
3596 }
3597}
3598
3599/* Lock devices from the top of the tree down */
3600static void pci_slot_lock(struct pci_slot *slot)
3601{
3602 struct pci_dev *dev;
3603
3604 list_for_each_entry(dev, &slot->bus->devices, bus_list) {
3605 if (!dev->slot || dev->slot != slot)
3606 continue;
3607 pci_dev_lock(dev);
3608 if (dev->subordinate)
3609 pci_bus_lock(dev->subordinate);
3610 }
3611}
3612
3613/* Unlock devices from the bottom of the tree up */
3614static void pci_slot_unlock(struct pci_slot *slot)
3615{
3616 struct pci_dev *dev;
3617
3618 list_for_each_entry(dev, &slot->bus->devices, bus_list) {
3619 if (!dev->slot || dev->slot != slot)
3620 continue;
3621 if (dev->subordinate)
3622 pci_bus_unlock(dev->subordinate);
3623 pci_dev_unlock(dev);
3624 }
3625}
3626
3627/* Save and disable devices from the top of the tree down */
3628static void pci_bus_save_and_disable(struct pci_bus *bus)
3629{
3630 struct pci_dev *dev;
3631
3632 list_for_each_entry(dev, &bus->devices, bus_list) {
3633 pci_dev_save_and_disable(dev);
3634 if (dev->subordinate)
3635 pci_bus_save_and_disable(dev->subordinate);
3636 }
3637}
3638
3639/*
3640 * Restore devices from top of the tree down - parent bridges need to be
3641 * restored before we can get to subordinate devices.
3642 */
3643static void pci_bus_restore(struct pci_bus *bus)
3644{
3645 struct pci_dev *dev;
3646
3647 list_for_each_entry(dev, &bus->devices, bus_list) {
3648 pci_dev_restore(dev);
3649 if (dev->subordinate)
3650 pci_bus_restore(dev->subordinate);
3651 }
3652}
3653
3654/* Save and disable devices from the top of the tree down */
3655static void pci_slot_save_and_disable(struct pci_slot *slot)
3656{
3657 struct pci_dev *dev;
3658
3659 list_for_each_entry(dev, &slot->bus->devices, bus_list) {
3660 if (!dev->slot || dev->slot != slot)
3661 continue;
3662 pci_dev_save_and_disable(dev);
3663 if (dev->subordinate)
3664 pci_bus_save_and_disable(dev->subordinate);
3665 }
3666}
3667
3668/*
3669 * Restore devices from top of the tree down - parent bridges need to be
3670 * restored before we can get to subordinate devices.
3671 */
3672static void pci_slot_restore(struct pci_slot *slot)
3673{
3674 struct pci_dev *dev;
3675
3676 list_for_each_entry(dev, &slot->bus->devices, bus_list) {
3677 if (!dev->slot || dev->slot != slot)
3678 continue;
3679 pci_dev_restore(dev);
3680 if (dev->subordinate)
3681 pci_bus_restore(dev->subordinate);
3682 }
3683}
3684
3685static int pci_slot_reset(struct pci_slot *slot, int probe)
3686{
3687 int rc;
3688
3689 if (!slot)
3690 return -ENOTTY;
3691
3692 if (!probe)
3693 pci_slot_lock(slot);
3694
3695 might_sleep();
3696
3697 rc = pci_reset_hotplug_slot(slot->hotplug, probe);
3698
3699 if (!probe)
3700 pci_slot_unlock(slot);
3701
3702 return rc;
3703}
3704
3705/**
3706 * pci_probe_reset_slot - probe whether a PCI slot can be reset
3707 * @slot: PCI slot to probe
3708 *
3709 * Return 0 if slot can be reset, negative if a slot reset is not supported.
3710 */
3711int pci_probe_reset_slot(struct pci_slot *slot)
3712{
3713 return pci_slot_reset(slot, 1);
3714}
3715EXPORT_SYMBOL_GPL(pci_probe_reset_slot);
3716
3717/**
3718 * pci_reset_slot - reset a PCI slot
3719 * @slot: PCI slot to reset
3720 *
3721 * A PCI bus may host multiple slots, each slot may support a reset mechanism
3722 * independent of other slots. For instance, some slots may support slot power
3723 * control. In the case of a 1:1 bus to slot architecture, this function may
3724 * wrap the bus reset to avoid spurious slot related events such as hotplug.
3725 * Generally a slot reset should be attempted before a bus reset. All of the
3726 * function of the slot and any subordinate buses behind the slot are reset
3727 * through this function. PCI config space of all devices in the slot and
3728 * behind the slot is saved before and restored after reset.
3729 *
3730 * Return 0 on success, non-zero on error.
3731 */
3732int pci_reset_slot(struct pci_slot *slot)
3733{
3734 int rc;
3735
3736 rc = pci_slot_reset(slot, 1);
3737 if (rc)
3738 return rc;
3739
3740 pci_slot_save_and_disable(slot);
3741
3742 rc = pci_slot_reset(slot, 0);
3743
3744 pci_slot_restore(slot);
3745
3746 return rc;
3747}
3748EXPORT_SYMBOL_GPL(pci_reset_slot);
3749
3750static int pci_bus_reset(struct pci_bus *bus, int probe)
3751{
3752 if (!bus->self)
3753 return -ENOTTY;
3754
3755 if (probe)
3756 return 0;
3757
3758 pci_bus_lock(bus);
3759
3760 might_sleep();
3761
3762 pci_reset_bridge_secondary_bus(bus->self);
3763
3764 pci_bus_unlock(bus);
3765
3766 return 0;
3767}
3768
3769/**
3770 * pci_probe_reset_bus - probe whether a PCI bus can be reset
3771 * @bus: PCI bus to probe
3772 *
3773 * Return 0 if bus can be reset, negative if a bus reset is not supported.
3774 */
3775int pci_probe_reset_bus(struct pci_bus *bus)
3776{
3777 return pci_bus_reset(bus, 1);
3778}
3779EXPORT_SYMBOL_GPL(pci_probe_reset_bus);
3780
3781/**
3782 * pci_reset_bus - reset a PCI bus
3783 * @bus: top level PCI bus to reset
3784 *
3785 * Do a bus reset on the given bus and any subordinate buses, saving
3786 * and restoring state of all devices.
3787 *
3788 * Return 0 on success, non-zero on error.
3789 */
3790int pci_reset_bus(struct pci_bus *bus)
3791{
3792 int rc;
3793
3794 rc = pci_bus_reset(bus, 1);
3795 if (rc)
3796 return rc;
3797
3798 pci_bus_save_and_disable(bus);
3799
3800 rc = pci_bus_reset(bus, 0);
3801
3802 pci_bus_restore(bus);
3803
3804 return rc;
3805}
3806EXPORT_SYMBOL_GPL(pci_reset_bus);
3807
3414/** 3808/**
3415 * pcix_get_max_mmrbc - get PCI-X maximum designed memory read byte count 3809 * pcix_get_max_mmrbc - get PCI-X maximum designed memory read byte count
3416 * @dev: PCI device to query 3810 * @dev: PCI device to query