diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-10-01 15:05:36 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-10-01 15:05:36 -0400 |
commit | fdb2f9c2ebd4f07d7b11a3bc86d8c669eb841697 (patch) | |
tree | d85824518fc13a8c84b7399019fc11ad77aaa120 /drivers/net | |
parent | 81f56e5375e84689b891e0e6c5a02ec12a1f18d9 (diff) | |
parent | 78c8f84302ce007aedcfa11912fd4aacf22727ab (diff) |
Merge tag 'for-3.7' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci
Pull PCI changes from Bjorn Helgaas:
"Host bridge hotplug
- Protect acpi_pci_drivers and acpi_pci_roots (Taku Izumi)
- Clear host bridge resource info to avoid issue when releasing
(Yinghai Lu)
- Notify acpi_pci_drivers when hot-plugging host bridges (Jiang Liu)
- Use standard list ops for acpi_pci_drivers (Jiang Liu)
Device hotplug
- Use pci_get_domain_bus_and_slot() to close hotplug races (Jiang
Liu)
- Remove fakephp driver (Bjorn Helgaas)
- Fix VGA ref count in hotplug remove path (Yinghai Lu)
- Allow acpiphp to handle PCIe ports without native hotplug (Jiang
Liu)
- Implement resume regardless of pciehp_force param (Oliver Neukum)
- Make pci_fixup_irqs() work after init (Thierry Reding)
Miscellaneous
- Add pci_pcie_type(dev) and remove pci_dev.pcie_type (Yijing Wang)
- Factor out PCI Express Capability accessors (Jiang Liu)
- Add pcibios_window_alignment() so powerpc EEH can use generic
resource assignment (Gavin Shan)
- Make pci_error_handlers const (Stephen Hemminger)
- Cleanup drivers/pci/remove.c (Bjorn Helgaas)
- Improve Vendor-Specific Extended Capability support (Bjorn
Helgaas)
- Use standard list ops for bus->devices (Bjorn Helgaas)
- Avoid kmalloc in pci_get_subsys() and pci_get_class() (Feng Tang)
- Reassign invalid bus number ranges (Intel DP43BF workaround)
(Yinghai Lu)"
* tag 'for-3.7' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci: (102 commits)
PCI: acpiphp: Handle PCIe ports without native hotplug capability
PCI/ACPI: Use acpi_driver_data() rather than searching acpi_pci_roots
PCI/ACPI: Protect acpi_pci_roots list with mutex
PCI/ACPI: Use acpi_pci_root info rather than looking it up again
PCI/ACPI: Pass acpi_pci_root to acpi_pci_drivers' add/remove interface
PCI/ACPI: Protect acpi_pci_drivers list with mutex
PCI/ACPI: Notify acpi_pci_drivers when hot-plugging PCI root bridges
PCI/ACPI: Use normal list for struct acpi_pci_driver
PCI/ACPI: Use DEVICE_ACPI_HANDLE rather than searching acpi_pci_roots
PCI: Fix default vga ref_count
ia64/PCI: Clear host bridge aperture struct resource
x86/PCI: Clear host bridge aperture struct resource
PCI: Stop all children first, before removing all children
Revert "PCI: Use hotplug-safe pci_get_domain_bus_and_slot()"
PCI: Provide a default pcibios_update_irq()
PCI: Discard __init annotations for pci_fixup_irqs() and related functions
PCI: Use correct type when freeing bus resource list
PCI: Check P2P bridge for invalid secondary/subordinate range
PCI: Convert "new_id"/"remove_id" into generic pci_bus driver attributes
xen-pcifront: Use hotplug-safe pci_get_domain_bus_and_slot()
...
Diffstat (limited to 'drivers/net')
34 files changed, 106 insertions, 237 deletions
diff --git a/drivers/net/ethernet/atheros/atl1c/atl1c_main.c b/drivers/net/ethernet/atheros/atl1c/atl1c_main.c index 1bf5bbfe778e..55a2e3795055 100644 --- a/drivers/net/ethernet/atheros/atl1c/atl1c_main.c +++ b/drivers/net/ethernet/atheros/atl1c/atl1c_main.c | |||
@@ -149,7 +149,7 @@ static void atl1c_reset_pcie(struct atl1c_hw *hw, u32 flag) | |||
149 | data &= ~(PCI_ERR_UNC_DLP | PCI_ERR_UNC_FCP); | 149 | data &= ~(PCI_ERR_UNC_DLP | PCI_ERR_UNC_FCP); |
150 | pci_write_config_dword(pdev, pos + PCI_ERR_UNCOR_SEVER, data); | 150 | pci_write_config_dword(pdev, pos + PCI_ERR_UNCOR_SEVER, data); |
151 | /* clear error status */ | 151 | /* clear error status */ |
152 | pci_write_config_word(pdev, pci_pcie_cap(pdev) + PCI_EXP_DEVSTA, | 152 | pcie_capability_write_word(pdev, PCI_EXP_DEVSTA, |
153 | PCI_EXP_DEVSTA_NFED | | 153 | PCI_EXP_DEVSTA_NFED | |
154 | PCI_EXP_DEVSTA_FED | | 154 | PCI_EXP_DEVSTA_FED | |
155 | PCI_EXP_DEVSTA_CED | | 155 | PCI_EXP_DEVSTA_CED | |
@@ -2685,7 +2685,7 @@ static void atl1c_io_resume(struct pci_dev *pdev) | |||
2685 | netif_device_attach(netdev); | 2685 | netif_device_attach(netdev); |
2686 | } | 2686 | } |
2687 | 2687 | ||
2688 | static struct pci_error_handlers atl1c_err_handler = { | 2688 | static const struct pci_error_handlers atl1c_err_handler = { |
2689 | .error_detected = atl1c_io_error_detected, | 2689 | .error_detected = atl1c_io_error_detected, |
2690 | .slot_reset = atl1c_io_slot_reset, | 2690 | .slot_reset = atl1c_io_slot_reset, |
2691 | .resume = atl1c_io_resume, | 2691 | .resume = atl1c_io_resume, |
diff --git a/drivers/net/ethernet/atheros/atl1e/atl1e_main.c b/drivers/net/ethernet/atheros/atl1e/atl1e_main.c index a98acc8a956f..e213da29e73d 100644 --- a/drivers/net/ethernet/atheros/atl1e/atl1e_main.c +++ b/drivers/net/ethernet/atheros/atl1e/atl1e_main.c | |||
@@ -2489,7 +2489,7 @@ static void atl1e_io_resume(struct pci_dev *pdev) | |||
2489 | netif_device_attach(netdev); | 2489 | netif_device_attach(netdev); |
2490 | } | 2490 | } |
2491 | 2491 | ||
2492 | static struct pci_error_handlers atl1e_err_handler = { | 2492 | static const struct pci_error_handlers atl1e_err_handler = { |
2493 | .error_detected = atl1e_io_error_detected, | 2493 | .error_detected = atl1e_io_error_detected, |
2494 | .slot_reset = atl1e_io_slot_reset, | 2494 | .slot_reset = atl1e_io_slot_reset, |
2495 | .resume = atl1e_io_resume, | 2495 | .resume = atl1e_io_resume, |
diff --git a/drivers/net/ethernet/broadcom/bnx2.c b/drivers/net/ethernet/broadcom/bnx2.c index e48312f2305d..d4310700c7a7 100644 --- a/drivers/net/ethernet/broadcom/bnx2.c +++ b/drivers/net/ethernet/broadcom/bnx2.c | |||
@@ -8742,7 +8742,7 @@ static void bnx2_io_resume(struct pci_dev *pdev) | |||
8742 | rtnl_unlock(); | 8742 | rtnl_unlock(); |
8743 | } | 8743 | } |
8744 | 8744 | ||
8745 | static struct pci_error_handlers bnx2_err_handler = { | 8745 | static const struct pci_error_handlers bnx2_err_handler = { |
8746 | .error_detected = bnx2_io_error_detected, | 8746 | .error_detected = bnx2_io_error_detected, |
8747 | .slot_reset = bnx2_io_slot_reset, | 8747 | .slot_reset = bnx2_io_slot_reset, |
8748 | .resume = bnx2_io_resume, | 8748 | .resume = bnx2_io_resume, |
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c index 0875ecfe3372..e11485ca037d 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c | |||
@@ -1162,14 +1162,9 @@ static int bnx2x_send_final_clnup(struct bnx2x *bp, u8 clnup_func, | |||
1162 | 1162 | ||
1163 | static u8 bnx2x_is_pcie_pending(struct pci_dev *dev) | 1163 | static u8 bnx2x_is_pcie_pending(struct pci_dev *dev) |
1164 | { | 1164 | { |
1165 | int pos; | ||
1166 | u16 status; | 1165 | u16 status; |
1167 | 1166 | ||
1168 | pos = pci_pcie_cap(dev); | 1167 | pcie_capability_read_word(dev, PCI_EXP_DEVSTA, &status); |
1169 | if (!pos) | ||
1170 | return false; | ||
1171 | |||
1172 | pci_read_config_word(dev, pos + PCI_EXP_DEVSTA, &status); | ||
1173 | return status & PCI_EXP_DEVSTA_TRPND; | 1168 | return status & PCI_EXP_DEVSTA_TRPND; |
1174 | } | 1169 | } |
1175 | 1170 | ||
@@ -6135,8 +6130,7 @@ static void bnx2x_init_pxp(struct bnx2x *bp) | |||
6135 | u16 devctl; | 6130 | u16 devctl; |
6136 | int r_order, w_order; | 6131 | int r_order, w_order; |
6137 | 6132 | ||
6138 | pci_read_config_word(bp->pdev, | 6133 | pcie_capability_read_word(bp->pdev, PCI_EXP_DEVCTL, &devctl); |
6139 | pci_pcie_cap(bp->pdev) + PCI_EXP_DEVCTL, &devctl); | ||
6140 | DP(NETIF_MSG_HW, "read 0x%x from devctl\n", devctl); | 6134 | DP(NETIF_MSG_HW, "read 0x%x from devctl\n", devctl); |
6141 | w_order = ((devctl & PCI_EXP_DEVCTL_PAYLOAD) >> 5); | 6135 | w_order = ((devctl & PCI_EXP_DEVCTL_PAYLOAD) >> 5); |
6142 | if (bp->mrrs == -1) | 6136 | if (bp->mrrs == -1) |
@@ -9380,7 +9374,7 @@ static int __devinit bnx2x_prev_mark_path(struct bnx2x *bp) | |||
9380 | 9374 | ||
9381 | static int __devinit bnx2x_do_flr(struct bnx2x *bp) | 9375 | static int __devinit bnx2x_do_flr(struct bnx2x *bp) |
9382 | { | 9376 | { |
9383 | int i, pos; | 9377 | int i; |
9384 | u16 status; | 9378 | u16 status; |
9385 | struct pci_dev *dev = bp->pdev; | 9379 | struct pci_dev *dev = bp->pdev; |
9386 | 9380 | ||
@@ -9397,16 +9391,12 @@ static int __devinit bnx2x_do_flr(struct bnx2x *bp) | |||
9397 | return -EINVAL; | 9391 | return -EINVAL; |
9398 | } | 9392 | } |
9399 | 9393 | ||
9400 | pos = pci_pcie_cap(dev); | ||
9401 | if (!pos) | ||
9402 | return -ENOTTY; | ||
9403 | |||
9404 | /* Wait for Transaction Pending bit clean */ | 9394 | /* Wait for Transaction Pending bit clean */ |
9405 | for (i = 0; i < 4; i++) { | 9395 | for (i = 0; i < 4; i++) { |
9406 | if (i) | 9396 | if (i) |
9407 | msleep((1 << (i - 1)) * 100); | 9397 | msleep((1 << (i - 1)) * 100); |
9408 | 9398 | ||
9409 | pci_read_config_word(dev, pos + PCI_EXP_DEVSTA, &status); | 9399 | pcie_capability_read_word(dev, PCI_EXP_DEVSTA, &status); |
9410 | if (!(status & PCI_EXP_DEVSTA_TRPND)) | 9400 | if (!(status & PCI_EXP_DEVSTA_TRPND)) |
9411 | goto clear; | 9401 | goto clear; |
9412 | } | 9402 | } |
@@ -12167,7 +12157,7 @@ static void bnx2x_io_resume(struct pci_dev *pdev) | |||
12167 | rtnl_unlock(); | 12157 | rtnl_unlock(); |
12168 | } | 12158 | } |
12169 | 12159 | ||
12170 | static struct pci_error_handlers bnx2x_err_handler = { | 12160 | static const struct pci_error_handlers bnx2x_err_handler = { |
12171 | .error_detected = bnx2x_io_error_detected, | 12161 | .error_detected = bnx2x_io_error_detected, |
12172 | .slot_reset = bnx2x_io_slot_reset, | 12162 | .slot_reset = bnx2x_io_slot_reset, |
12173 | .resume = bnx2x_io_resume, | 12163 | .resume = bnx2x_io_resume, |
diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c index bf906c51d82a..388d32213937 100644 --- a/drivers/net/ethernet/broadcom/tg3.c +++ b/drivers/net/ethernet/broadcom/tg3.c | |||
@@ -3653,17 +3653,9 @@ static int tg3_power_down_prepare(struct tg3 *tp) | |||
3653 | tg3_enable_register_access(tp); | 3653 | tg3_enable_register_access(tp); |
3654 | 3654 | ||
3655 | /* Restore the CLKREQ setting. */ | 3655 | /* Restore the CLKREQ setting. */ |
3656 | if (tg3_flag(tp, CLKREQ_BUG)) { | 3656 | if (tg3_flag(tp, CLKREQ_BUG)) |
3657 | u16 lnkctl; | 3657 | pcie_capability_set_word(tp->pdev, PCI_EXP_LNKCTL, |
3658 | 3658 | PCI_EXP_LNKCTL_CLKREQ_EN); | |
3659 | pci_read_config_word(tp->pdev, | ||
3660 | pci_pcie_cap(tp->pdev) + PCI_EXP_LNKCTL, | ||
3661 | &lnkctl); | ||
3662 | lnkctl |= PCI_EXP_LNKCTL_CLKREQ_EN; | ||
3663 | pci_write_config_word(tp->pdev, | ||
3664 | pci_pcie_cap(tp->pdev) + PCI_EXP_LNKCTL, | ||
3665 | lnkctl); | ||
3666 | } | ||
3667 | 3659 | ||
3668 | misc_host_ctrl = tr32(TG3PCI_MISC_HOST_CTRL); | 3660 | misc_host_ctrl = tr32(TG3PCI_MISC_HOST_CTRL); |
3669 | tw32(TG3PCI_MISC_HOST_CTRL, | 3661 | tw32(TG3PCI_MISC_HOST_CTRL, |
@@ -4434,20 +4426,13 @@ relink: | |||
4434 | 4426 | ||
4435 | /* Prevent send BD corruption. */ | 4427 | /* Prevent send BD corruption. */ |
4436 | if (tg3_flag(tp, CLKREQ_BUG)) { | 4428 | if (tg3_flag(tp, CLKREQ_BUG)) { |
4437 | u16 oldlnkctl, newlnkctl; | ||
4438 | |||
4439 | pci_read_config_word(tp->pdev, | ||
4440 | pci_pcie_cap(tp->pdev) + PCI_EXP_LNKCTL, | ||
4441 | &oldlnkctl); | ||
4442 | if (tp->link_config.active_speed == SPEED_100 || | 4429 | if (tp->link_config.active_speed == SPEED_100 || |
4443 | tp->link_config.active_speed == SPEED_10) | 4430 | tp->link_config.active_speed == SPEED_10) |
4444 | newlnkctl = oldlnkctl & ~PCI_EXP_LNKCTL_CLKREQ_EN; | 4431 | pcie_capability_clear_word(tp->pdev, PCI_EXP_LNKCTL, |
4432 | PCI_EXP_LNKCTL_CLKREQ_EN); | ||
4445 | else | 4433 | else |
4446 | newlnkctl = oldlnkctl | PCI_EXP_LNKCTL_CLKREQ_EN; | 4434 | pcie_capability_set_word(tp->pdev, PCI_EXP_LNKCTL, |
4447 | if (newlnkctl != oldlnkctl) | 4435 | PCI_EXP_LNKCTL_CLKREQ_EN); |
4448 | pci_write_config_word(tp->pdev, | ||
4449 | pci_pcie_cap(tp->pdev) + | ||
4450 | PCI_EXP_LNKCTL, newlnkctl); | ||
4451 | } | 4436 | } |
4452 | 4437 | ||
4453 | if (current_link_up != netif_carrier_ok(tp->dev)) { | 4438 | if (current_link_up != netif_carrier_ok(tp->dev)) { |
@@ -8054,7 +8039,7 @@ static int tg3_chip_reset(struct tg3 *tp) | |||
8054 | 8039 | ||
8055 | udelay(120); | 8040 | udelay(120); |
8056 | 8041 | ||
8057 | if (tg3_flag(tp, PCI_EXPRESS) && pci_pcie_cap(tp->pdev)) { | 8042 | if (tg3_flag(tp, PCI_EXPRESS) && pci_is_pcie(tp->pdev)) { |
8058 | u16 val16; | 8043 | u16 val16; |
8059 | 8044 | ||
8060 | if (tp->pci_chip_rev_id == CHIPREV_ID_5750_A0) { | 8045 | if (tp->pci_chip_rev_id == CHIPREV_ID_5750_A0) { |
@@ -8071,24 +8056,17 @@ static int tg3_chip_reset(struct tg3 *tp) | |||
8071 | } | 8056 | } |
8072 | 8057 | ||
8073 | /* Clear the "no snoop" and "relaxed ordering" bits. */ | 8058 | /* Clear the "no snoop" and "relaxed ordering" bits. */ |
8074 | pci_read_config_word(tp->pdev, | 8059 | val16 = PCI_EXP_DEVCTL_RELAX_EN | PCI_EXP_DEVCTL_NOSNOOP_EN; |
8075 | pci_pcie_cap(tp->pdev) + PCI_EXP_DEVCTL, | ||
8076 | &val16); | ||
8077 | val16 &= ~(PCI_EXP_DEVCTL_RELAX_EN | | ||
8078 | PCI_EXP_DEVCTL_NOSNOOP_EN); | ||
8079 | /* | 8060 | /* |
8080 | * Older PCIe devices only support the 128 byte | 8061 | * Older PCIe devices only support the 128 byte |
8081 | * MPS setting. Enforce the restriction. | 8062 | * MPS setting. Enforce the restriction. |
8082 | */ | 8063 | */ |
8083 | if (!tg3_flag(tp, CPMU_PRESENT)) | 8064 | if (!tg3_flag(tp, CPMU_PRESENT)) |
8084 | val16 &= ~PCI_EXP_DEVCTL_PAYLOAD; | 8065 | val16 |= PCI_EXP_DEVCTL_PAYLOAD; |
8085 | pci_write_config_word(tp->pdev, | 8066 | pcie_capability_clear_word(tp->pdev, PCI_EXP_DEVCTL, val16); |
8086 | pci_pcie_cap(tp->pdev) + PCI_EXP_DEVCTL, | ||
8087 | val16); | ||
8088 | 8067 | ||
8089 | /* Clear error status */ | 8068 | /* Clear error status */ |
8090 | pci_write_config_word(tp->pdev, | 8069 | pcie_capability_write_word(tp->pdev, PCI_EXP_DEVSTA, |
8091 | pci_pcie_cap(tp->pdev) + PCI_EXP_DEVSTA, | ||
8092 | PCI_EXP_DEVSTA_CED | | 8070 | PCI_EXP_DEVSTA_CED | |
8093 | PCI_EXP_DEVSTA_NFED | | 8071 | PCI_EXP_DEVSTA_NFED | |
8094 | PCI_EXP_DEVSTA_FED | | 8072 | PCI_EXP_DEVSTA_FED | |
@@ -14565,9 +14543,7 @@ static int __devinit tg3_get_invariants(struct tg3 *tp) | |||
14565 | 14543 | ||
14566 | tg3_flag_set(tp, PCI_EXPRESS); | 14544 | tg3_flag_set(tp, PCI_EXPRESS); |
14567 | 14545 | ||
14568 | pci_read_config_word(tp->pdev, | 14546 | pcie_capability_read_word(tp->pdev, PCI_EXP_LNKCTL, &lnkctl); |
14569 | pci_pcie_cap(tp->pdev) + PCI_EXP_LNKCTL, | ||
14570 | &lnkctl); | ||
14571 | if (lnkctl & PCI_EXP_LNKCTL_CLKREQ_EN) { | 14547 | if (lnkctl & PCI_EXP_LNKCTL_CLKREQ_EN) { |
14572 | if (GET_ASIC_REV(tp->pci_chip_rev_id) == | 14548 | if (GET_ASIC_REV(tp->pci_chip_rev_id) == |
14573 | ASIC_REV_5906) { | 14549 | ASIC_REV_5906) { |
@@ -16397,7 +16373,7 @@ done: | |||
16397 | rtnl_unlock(); | 16373 | rtnl_unlock(); |
16398 | } | 16374 | } |
16399 | 16375 | ||
16400 | static struct pci_error_handlers tg3_err_handler = { | 16376 | static const struct pci_error_handlers tg3_err_handler = { |
16401 | .error_detected = tg3_io_error_detected, | 16377 | .error_detected = tg3_io_error_detected, |
16402 | .slot_reset = tg3_io_slot_reset, | 16378 | .slot_reset = tg3_io_slot_reset, |
16403 | .resume = tg3_io_resume | 16379 | .resume = tg3_io_resume |
diff --git a/drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c b/drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c index 6505070abcfa..875bbb999aa2 100644 --- a/drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c +++ b/drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c | |||
@@ -3036,7 +3036,7 @@ static void t3_io_resume(struct pci_dev *pdev) | |||
3036 | t3_resume_ports(adapter); | 3036 | t3_resume_ports(adapter); |
3037 | } | 3037 | } |
3038 | 3038 | ||
3039 | static struct pci_error_handlers t3_err_handler = { | 3039 | static const struct pci_error_handlers t3_err_handler = { |
3040 | .error_detected = t3_io_error_detected, | 3040 | .error_detected = t3_io_error_detected, |
3041 | .slot_reset = t3_io_slot_reset, | 3041 | .slot_reset = t3_io_slot_reset, |
3042 | .resume = t3_io_resume, | 3042 | .resume = t3_io_resume, |
diff --git a/drivers/net/ethernet/chelsio/cxgb3/t3_hw.c b/drivers/net/ethernet/chelsio/cxgb3/t3_hw.c index bff8a3cdd3df..aef45d3113ba 100644 --- a/drivers/net/ethernet/chelsio/cxgb3/t3_hw.c +++ b/drivers/net/ethernet/chelsio/cxgb3/t3_hw.c | |||
@@ -3289,22 +3289,18 @@ static void config_pcie(struct adapter *adap) | |||
3289 | unsigned int log2_width, pldsize; | 3289 | unsigned int log2_width, pldsize; |
3290 | unsigned int fst_trn_rx, fst_trn_tx, acklat, rpllmt; | 3290 | unsigned int fst_trn_rx, fst_trn_tx, acklat, rpllmt; |
3291 | 3291 | ||
3292 | pci_read_config_word(adap->pdev, | 3292 | pcie_capability_read_word(adap->pdev, PCI_EXP_DEVCTL, &val); |
3293 | adap->pdev->pcie_cap + PCI_EXP_DEVCTL, | ||
3294 | &val); | ||
3295 | pldsize = (val & PCI_EXP_DEVCTL_PAYLOAD) >> 5; | 3293 | pldsize = (val & PCI_EXP_DEVCTL_PAYLOAD) >> 5; |
3296 | 3294 | ||
3297 | pci_read_config_word(adap->pdev, 0x2, &devid); | 3295 | pci_read_config_word(adap->pdev, 0x2, &devid); |
3298 | if (devid == 0x37) { | 3296 | if (devid == 0x37) { |
3299 | pci_write_config_word(adap->pdev, | 3297 | pcie_capability_write_word(adap->pdev, PCI_EXP_DEVCTL, |
3300 | adap->pdev->pcie_cap + PCI_EXP_DEVCTL, | 3298 | val & ~PCI_EXP_DEVCTL_READRQ & |
3301 | val & ~PCI_EXP_DEVCTL_READRQ & | 3299 | ~PCI_EXP_DEVCTL_PAYLOAD); |
3302 | ~PCI_EXP_DEVCTL_PAYLOAD); | ||
3303 | pldsize = 0; | 3300 | pldsize = 0; |
3304 | } | 3301 | } |
3305 | 3302 | ||
3306 | pci_read_config_word(adap->pdev, adap->pdev->pcie_cap + PCI_EXP_LNKCTL, | 3303 | pcie_capability_read_word(adap->pdev, PCI_EXP_LNKCTL, &val); |
3307 | &val); | ||
3308 | 3304 | ||
3309 | fst_trn_tx = G_NUMFSTTRNSEQ(t3_read_reg(adap, A_PCIE_PEX_CTRL0)); | 3305 | fst_trn_tx = G_NUMFSTTRNSEQ(t3_read_reg(adap, A_PCIE_PEX_CTRL0)); |
3310 | fst_trn_rx = adap->params.rev == 0 ? fst_trn_tx : | 3306 | fst_trn_rx = adap->params.rev == 0 ? fst_trn_tx : |
@@ -3425,15 +3421,13 @@ out_err: | |||
3425 | static void get_pci_mode(struct adapter *adapter, struct pci_params *p) | 3421 | static void get_pci_mode(struct adapter *adapter, struct pci_params *p) |
3426 | { | 3422 | { |
3427 | static unsigned short speed_map[] = { 33, 66, 100, 133 }; | 3423 | static unsigned short speed_map[] = { 33, 66, 100, 133 }; |
3428 | u32 pci_mode, pcie_cap; | 3424 | u32 pci_mode; |
3429 | 3425 | ||
3430 | pcie_cap = pci_pcie_cap(adapter->pdev); | 3426 | if (pci_is_pcie(adapter->pdev)) { |
3431 | if (pcie_cap) { | ||
3432 | u16 val; | 3427 | u16 val; |
3433 | 3428 | ||
3434 | p->variant = PCI_VARIANT_PCIE; | 3429 | p->variant = PCI_VARIANT_PCIE; |
3435 | pci_read_config_word(adapter->pdev, pcie_cap + PCI_EXP_LNKSTA, | 3430 | pcie_capability_read_word(adapter->pdev, PCI_EXP_LNKSTA, &val); |
3436 | &val); | ||
3437 | p->width = (val >> 4) & 0x3f; | 3431 | p->width = (val >> 4) & 0x3f; |
3438 | return; | 3432 | return; |
3439 | } | 3433 | } |
diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c index 5ed49af23d6a..933985420acb 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c +++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c | |||
@@ -3453,7 +3453,7 @@ static void eeh_resume(struct pci_dev *pdev) | |||
3453 | rtnl_unlock(); | 3453 | rtnl_unlock(); |
3454 | } | 3454 | } |
3455 | 3455 | ||
3456 | static struct pci_error_handlers cxgb4_eeh = { | 3456 | static const struct pci_error_handlers cxgb4_eeh = { |
3457 | .error_detected = eeh_err_detected, | 3457 | .error_detected = eeh_err_detected, |
3458 | .slot_reset = eeh_slot_reset, | 3458 | .slot_reset = eeh_slot_reset, |
3459 | .resume = eeh_resume, | 3459 | .resume = eeh_resume, |
@@ -3694,15 +3694,7 @@ static void __devinit print_port_info(const struct net_device *dev) | |||
3694 | 3694 | ||
3695 | static void __devinit enable_pcie_relaxed_ordering(struct pci_dev *dev) | 3695 | static void __devinit enable_pcie_relaxed_ordering(struct pci_dev *dev) |
3696 | { | 3696 | { |
3697 | u16 v; | 3697 | pcie_capability_set_word(dev, PCI_EXP_DEVCTL, PCI_EXP_DEVCTL_RELAX_EN); |
3698 | int pos; | ||
3699 | |||
3700 | pos = pci_pcie_cap(dev); | ||
3701 | if (pos > 0) { | ||
3702 | pci_read_config_word(dev, pos + PCI_EXP_DEVCTL, &v); | ||
3703 | v |= PCI_EXP_DEVCTL_RELAX_EN; | ||
3704 | pci_write_config_word(dev, pos + PCI_EXP_DEVCTL, v); | ||
3705 | } | ||
3706 | } | 3698 | } |
3707 | 3699 | ||
3708 | /* | 3700 | /* |
diff --git a/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c b/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c index fa947dfa4c30..af1601323173 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c +++ b/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c | |||
@@ -2741,11 +2741,9 @@ static void __devinit get_pci_mode(struct adapter *adapter, | |||
2741 | struct pci_params *p) | 2741 | struct pci_params *p) |
2742 | { | 2742 | { |
2743 | u16 val; | 2743 | u16 val; |
2744 | u32 pcie_cap = pci_pcie_cap(adapter->pdev); | ||
2745 | 2744 | ||
2746 | if (pcie_cap) { | 2745 | if (pci_is_pcie(adapter->pdev)) { |
2747 | pci_read_config_word(adapter->pdev, pcie_cap + PCI_EXP_LNKSTA, | 2746 | pcie_capability_read_word(adapter->pdev, PCI_EXP_LNKSTA, &val); |
2748 | &val); | ||
2749 | p->speed = val & PCI_EXP_LNKSTA_CLS; | 2747 | p->speed = val & PCI_EXP_LNKSTA_CLS; |
2750 | p->width = (val & PCI_EXP_LNKSTA_NLW) >> 4; | 2748 | p->width = (val & PCI_EXP_LNKSTA_NLW) >> 4; |
2751 | } | 2749 | } |
diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c index 78b8aa8069f0..95d10472f236 100644 --- a/drivers/net/ethernet/emulex/benet/be_main.c +++ b/drivers/net/ethernet/emulex/benet/be_main.c | |||
@@ -4106,7 +4106,7 @@ err: | |||
4106 | dev_err(&adapter->pdev->dev, "EEH resume failed\n"); | 4106 | dev_err(&adapter->pdev->dev, "EEH resume failed\n"); |
4107 | } | 4107 | } |
4108 | 4108 | ||
4109 | static struct pci_error_handlers be_eeh_handlers = { | 4109 | static const struct pci_error_handlers be_eeh_handlers = { |
4110 | .error_detected = be_eeh_err_detected, | 4110 | .error_detected = be_eeh_err_detected, |
4111 | .slot_reset = be_eeh_reset, | 4111 | .slot_reset = be_eeh_reset, |
4112 | .resume = be_eeh_resume, | 4112 | .resume = be_eeh_resume, |
diff --git a/drivers/net/ethernet/intel/e100.c b/drivers/net/ethernet/intel/e100.c index 535f94fac4a1..29ce9bd27f94 100644 --- a/drivers/net/ethernet/intel/e100.c +++ b/drivers/net/ethernet/intel/e100.c | |||
@@ -3157,7 +3157,7 @@ static void e100_io_resume(struct pci_dev *pdev) | |||
3157 | } | 3157 | } |
3158 | } | 3158 | } |
3159 | 3159 | ||
3160 | static struct pci_error_handlers e100_err_handler = { | 3160 | static const struct pci_error_handlers e100_err_handler = { |
3161 | .error_detected = e100_io_error_detected, | 3161 | .error_detected = e100_io_error_detected, |
3162 | .slot_reset = e100_io_slot_reset, | 3162 | .slot_reset = e100_io_slot_reset, |
3163 | .resume = e100_io_resume, | 3163 | .resume = e100_io_resume, |
diff --git a/drivers/net/ethernet/intel/e1000/e1000_main.c b/drivers/net/ethernet/intel/e1000/e1000_main.c index bde337ee1a34..f3f9aeb7d1e1 100644 --- a/drivers/net/ethernet/intel/e1000/e1000_main.c +++ b/drivers/net/ethernet/intel/e1000/e1000_main.c | |||
@@ -192,7 +192,7 @@ static pci_ers_result_t e1000_io_error_detected(struct pci_dev *pdev, | |||
192 | static pci_ers_result_t e1000_io_slot_reset(struct pci_dev *pdev); | 192 | static pci_ers_result_t e1000_io_slot_reset(struct pci_dev *pdev); |
193 | static void e1000_io_resume(struct pci_dev *pdev); | 193 | static void e1000_io_resume(struct pci_dev *pdev); |
194 | 194 | ||
195 | static struct pci_error_handlers e1000_err_handler = { | 195 | static const struct pci_error_handlers e1000_err_handler = { |
196 | .error_detected = e1000_io_error_detected, | 196 | .error_detected = e1000_io_error_detected, |
197 | .slot_reset = e1000_io_slot_reset, | 197 | .slot_reset = e1000_io_slot_reset, |
198 | .resume = e1000_io_resume, | 198 | .resume = e1000_io_resume, |
diff --git a/drivers/net/ethernet/intel/e1000e/netdev.c b/drivers/net/ethernet/intel/e1000e/netdev.c index d01a099475a1..3f0223ac4c7c 100644 --- a/drivers/net/ethernet/intel/e1000e/netdev.c +++ b/drivers/net/ethernet/intel/e1000e/netdev.c | |||
@@ -5584,16 +5584,15 @@ static void e1000_complete_shutdown(struct pci_dev *pdev, bool sleep, | |||
5584 | */ | 5584 | */ |
5585 | if (adapter->flags & FLAG_IS_QUAD_PORT) { | 5585 | if (adapter->flags & FLAG_IS_QUAD_PORT) { |
5586 | struct pci_dev *us_dev = pdev->bus->self; | 5586 | struct pci_dev *us_dev = pdev->bus->self; |
5587 | int pos = pci_pcie_cap(us_dev); | ||
5588 | u16 devctl; | 5587 | u16 devctl; |
5589 | 5588 | ||
5590 | pci_read_config_word(us_dev, pos + PCI_EXP_DEVCTL, &devctl); | 5589 | pcie_capability_read_word(us_dev, PCI_EXP_DEVCTL, &devctl); |
5591 | pci_write_config_word(us_dev, pos + PCI_EXP_DEVCTL, | 5590 | pcie_capability_write_word(us_dev, PCI_EXP_DEVCTL, |
5592 | (devctl & ~PCI_EXP_DEVCTL_CERE)); | 5591 | (devctl & ~PCI_EXP_DEVCTL_CERE)); |
5593 | 5592 | ||
5594 | e1000_power_off(pdev, sleep, wake); | 5593 | e1000_power_off(pdev, sleep, wake); |
5595 | 5594 | ||
5596 | pci_write_config_word(us_dev, pos + PCI_EXP_DEVCTL, devctl); | 5595 | pcie_capability_write_word(us_dev, PCI_EXP_DEVCTL, devctl); |
5597 | } else { | 5596 | } else { |
5598 | e1000_power_off(pdev, sleep, wake); | 5597 | e1000_power_off(pdev, sleep, wake); |
5599 | } | 5598 | } |
@@ -5607,25 +5606,15 @@ static void __e1000e_disable_aspm(struct pci_dev *pdev, u16 state) | |||
5607 | #else | 5606 | #else |
5608 | static void __e1000e_disable_aspm(struct pci_dev *pdev, u16 state) | 5607 | static void __e1000e_disable_aspm(struct pci_dev *pdev, u16 state) |
5609 | { | 5608 | { |
5610 | int pos; | ||
5611 | u16 reg16; | ||
5612 | |||
5613 | /* | 5609 | /* |
5614 | * Both device and parent should have the same ASPM setting. | 5610 | * Both device and parent should have the same ASPM setting. |
5615 | * Disable ASPM in downstream component first and then upstream. | 5611 | * Disable ASPM in downstream component first and then upstream. |
5616 | */ | 5612 | */ |
5617 | pos = pci_pcie_cap(pdev); | 5613 | pcie_capability_clear_word(pdev, PCI_EXP_LNKCTL, state); |
5618 | pci_read_config_word(pdev, pos + PCI_EXP_LNKCTL, ®16); | ||
5619 | reg16 &= ~state; | ||
5620 | pci_write_config_word(pdev, pos + PCI_EXP_LNKCTL, reg16); | ||
5621 | |||
5622 | if (!pdev->bus->self) | ||
5623 | return; | ||
5624 | 5614 | ||
5625 | pos = pci_pcie_cap(pdev->bus->self); | 5615 | if (pdev->bus->self) |
5626 | pci_read_config_word(pdev->bus->self, pos + PCI_EXP_LNKCTL, ®16); | 5616 | pcie_capability_clear_word(pdev->bus->self, PCI_EXP_LNKCTL, |
5627 | reg16 &= ~state; | 5617 | state); |
5628 | pci_write_config_word(pdev->bus->self, pos + PCI_EXP_LNKCTL, reg16); | ||
5629 | } | 5618 | } |
5630 | #endif | 5619 | #endif |
5631 | static void e1000e_disable_aspm(struct pci_dev *pdev, u16 state) | 5620 | static void e1000e_disable_aspm(struct pci_dev *pdev, u16 state) |
@@ -6486,7 +6475,7 @@ static void __devexit e1000_remove(struct pci_dev *pdev) | |||
6486 | } | 6475 | } |
6487 | 6476 | ||
6488 | /* PCI Error Recovery (ERS) */ | 6477 | /* PCI Error Recovery (ERS) */ |
6489 | static struct pci_error_handlers e1000_err_handler = { | 6478 | static const struct pci_error_handlers e1000_err_handler = { |
6490 | .error_detected = e1000_io_error_detected, | 6479 | .error_detected = e1000_io_error_detected, |
6491 | .slot_reset = e1000_io_slot_reset, | 6480 | .slot_reset = e1000_io_slot_reset, |
6492 | .resume = e1000_io_resume, | 6481 | .resume = e1000_io_resume, |
diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c index 48cc4fb1a307..f88c822e57a6 100644 --- a/drivers/net/ethernet/intel/igb/igb_main.c +++ b/drivers/net/ethernet/intel/igb/igb_main.c | |||
@@ -217,7 +217,7 @@ static pci_ers_result_t igb_io_error_detected(struct pci_dev *, | |||
217 | static pci_ers_result_t igb_io_slot_reset(struct pci_dev *); | 217 | static pci_ers_result_t igb_io_slot_reset(struct pci_dev *); |
218 | static void igb_io_resume(struct pci_dev *); | 218 | static void igb_io_resume(struct pci_dev *); |
219 | 219 | ||
220 | static struct pci_error_handlers igb_err_handler = { | 220 | static const struct pci_error_handlers igb_err_handler = { |
221 | .error_detected = igb_io_error_detected, | 221 | .error_detected = igb_io_error_detected, |
222 | .slot_reset = igb_io_slot_reset, | 222 | .slot_reset = igb_io_slot_reset, |
223 | .resume = igb_io_resume, | 223 | .resume = igb_io_resume, |
@@ -6538,28 +6538,20 @@ static int igb_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd) | |||
6538 | s32 igb_read_pcie_cap_reg(struct e1000_hw *hw, u32 reg, u16 *value) | 6538 | s32 igb_read_pcie_cap_reg(struct e1000_hw *hw, u32 reg, u16 *value) |
6539 | { | 6539 | { |
6540 | struct igb_adapter *adapter = hw->back; | 6540 | struct igb_adapter *adapter = hw->back; |
6541 | u16 cap_offset; | ||
6542 | 6541 | ||
6543 | cap_offset = adapter->pdev->pcie_cap; | 6542 | if (pcie_capability_read_word(adapter->pdev, reg, value)) |
6544 | if (!cap_offset) | ||
6545 | return -E1000_ERR_CONFIG; | 6543 | return -E1000_ERR_CONFIG; |
6546 | 6544 | ||
6547 | pci_read_config_word(adapter->pdev, cap_offset + reg, value); | ||
6548 | |||
6549 | return 0; | 6545 | return 0; |
6550 | } | 6546 | } |
6551 | 6547 | ||
6552 | s32 igb_write_pcie_cap_reg(struct e1000_hw *hw, u32 reg, u16 *value) | 6548 | s32 igb_write_pcie_cap_reg(struct e1000_hw *hw, u32 reg, u16 *value) |
6553 | { | 6549 | { |
6554 | struct igb_adapter *adapter = hw->back; | 6550 | struct igb_adapter *adapter = hw->back; |
6555 | u16 cap_offset; | ||
6556 | 6551 | ||
6557 | cap_offset = adapter->pdev->pcie_cap; | 6552 | if (pcie_capability_write_word(adapter->pdev, reg, *value)) |
6558 | if (!cap_offset) | ||
6559 | return -E1000_ERR_CONFIG; | 6553 | return -E1000_ERR_CONFIG; |
6560 | 6554 | ||
6561 | pci_write_config_word(adapter->pdev, cap_offset + reg, *value); | ||
6562 | |||
6563 | return 0; | 6555 | return 0; |
6564 | } | 6556 | } |
6565 | 6557 | ||
diff --git a/drivers/net/ethernet/intel/igbvf/netdev.c b/drivers/net/ethernet/intel/igbvf/netdev.c index 0696abfe9944..0ac11f527a84 100644 --- a/drivers/net/ethernet/intel/igbvf/netdev.c +++ b/drivers/net/ethernet/intel/igbvf/netdev.c | |||
@@ -2833,7 +2833,7 @@ static void __devexit igbvf_remove(struct pci_dev *pdev) | |||
2833 | } | 2833 | } |
2834 | 2834 | ||
2835 | /* PCI Error Recovery (ERS) */ | 2835 | /* PCI Error Recovery (ERS) */ |
2836 | static struct pci_error_handlers igbvf_err_handler = { | 2836 | static const struct pci_error_handlers igbvf_err_handler = { |
2837 | .error_detected = igbvf_io_error_detected, | 2837 | .error_detected = igbvf_io_error_detected, |
2838 | .slot_reset = igbvf_io_slot_reset, | 2838 | .slot_reset = igbvf_io_slot_reset, |
2839 | .resume = igbvf_io_resume, | 2839 | .resume = igbvf_io_resume, |
diff --git a/drivers/net/ethernet/intel/ixgb/ixgb_main.c b/drivers/net/ethernet/intel/ixgb/ixgb_main.c index d05fc95befc5..d99a2d51b948 100644 --- a/drivers/net/ethernet/intel/ixgb/ixgb_main.c +++ b/drivers/net/ethernet/intel/ixgb/ixgb_main.c | |||
@@ -115,7 +115,7 @@ static pci_ers_result_t ixgb_io_error_detected (struct pci_dev *pdev, | |||
115 | static pci_ers_result_t ixgb_io_slot_reset (struct pci_dev *pdev); | 115 | static pci_ers_result_t ixgb_io_slot_reset (struct pci_dev *pdev); |
116 | static void ixgb_io_resume (struct pci_dev *pdev); | 116 | static void ixgb_io_resume (struct pci_dev *pdev); |
117 | 117 | ||
118 | static struct pci_error_handlers ixgb_err_handler = { | 118 | static const struct pci_error_handlers ixgb_err_handler = { |
119 | .error_detected = ixgb_io_error_detected, | 119 | .error_detected = ixgb_io_error_detected, |
120 | .slot_reset = ixgb_io_slot_reset, | 120 | .slot_reset = ixgb_io_slot_reset, |
121 | .resume = ixgb_io_resume, | 121 | .resume = ixgb_io_resume, |
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c index 4326f74f7137..ee61819d6088 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | |||
@@ -7527,7 +7527,7 @@ static pci_ers_result_t ixgbe_io_error_detected(struct pci_dev *pdev, | |||
7527 | goto skip_bad_vf_detection; | 7527 | goto skip_bad_vf_detection; |
7528 | 7528 | ||
7529 | bdev = pdev->bus->self; | 7529 | bdev = pdev->bus->self; |
7530 | while (bdev && (bdev->pcie_type != PCI_EXP_TYPE_ROOT_PORT)) | 7530 | while (bdev && (pci_pcie_type(bdev) != PCI_EXP_TYPE_ROOT_PORT)) |
7531 | bdev = bdev->bus->self; | 7531 | bdev = bdev->bus->self; |
7532 | 7532 | ||
7533 | if (!bdev) | 7533 | if (!bdev) |
@@ -7677,7 +7677,7 @@ static void ixgbe_io_resume(struct pci_dev *pdev) | |||
7677 | netif_device_attach(netdev); | 7677 | netif_device_attach(netdev); |
7678 | } | 7678 | } |
7679 | 7679 | ||
7680 | static struct pci_error_handlers ixgbe_err_handler = { | 7680 | static const struct pci_error_handlers ixgbe_err_handler = { |
7681 | .error_detected = ixgbe_io_error_detected, | 7681 | .error_detected = ixgbe_io_error_detected, |
7682 | .slot_reset = ixgbe_io_slot_reset, | 7682 | .slot_reset = ixgbe_io_slot_reset, |
7683 | .resume = ixgbe_io_resume, | 7683 | .resume = ixgbe_io_resume, |
diff --git a/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c b/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c index 60ef64587412..6647383c4ddc 100644 --- a/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c +++ b/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c | |||
@@ -3256,7 +3256,7 @@ static void ixgbevf_io_resume(struct pci_dev *pdev) | |||
3256 | } | 3256 | } |
3257 | 3257 | ||
3258 | /* PCI Error Recovery (ERS) */ | 3258 | /* PCI Error Recovery (ERS) */ |
3259 | static struct pci_error_handlers ixgbevf_err_handler = { | 3259 | static const struct pci_error_handlers ixgbevf_err_handler = { |
3260 | .error_detected = ixgbevf_io_error_detected, | 3260 | .error_detected = ixgbevf_io_error_detected, |
3261 | .slot_reset = ixgbevf_io_slot_reset, | 3261 | .slot_reset = ixgbevf_io_slot_reset, |
3262 | .resume = ixgbevf_io_resume, | 3262 | .resume = ixgbevf_io_resume, |
diff --git a/drivers/net/ethernet/mellanox/mlx4/main.c b/drivers/net/ethernet/mellanox/mlx4/main.c index 2f816c6aed72..dd6ea942625c 100644 --- a/drivers/net/ethernet/mellanox/mlx4/main.c +++ b/drivers/net/ethernet/mellanox/mlx4/main.c | |||
@@ -2300,7 +2300,7 @@ static pci_ers_result_t mlx4_pci_slot_reset(struct pci_dev *pdev) | |||
2300 | return ret ? PCI_ERS_RESULT_DISCONNECT : PCI_ERS_RESULT_RECOVERED; | 2300 | return ret ? PCI_ERS_RESULT_DISCONNECT : PCI_ERS_RESULT_RECOVERED; |
2301 | } | 2301 | } |
2302 | 2302 | ||
2303 | static struct pci_error_handlers mlx4_err_handler = { | 2303 | static const struct pci_error_handlers mlx4_err_handler = { |
2304 | .error_detected = mlx4_pci_err_detected, | 2304 | .error_detected = mlx4_pci_err_detected, |
2305 | .slot_reset = mlx4_pci_slot_reset, | 2305 | .slot_reset = mlx4_pci_slot_reset, |
2306 | }; | 2306 | }; |
diff --git a/drivers/net/ethernet/mellanox/mlx4/reset.c b/drivers/net/ethernet/mellanox/mlx4/reset.c index 11e7c1cb99bf..dd1b5093d8b1 100644 --- a/drivers/net/ethernet/mellanox/mlx4/reset.c +++ b/drivers/net/ethernet/mellanox/mlx4/reset.c | |||
@@ -141,16 +141,16 @@ int mlx4_reset(struct mlx4_dev *dev) | |||
141 | /* Now restore the PCI headers */ | 141 | /* Now restore the PCI headers */ |
142 | if (pcie_cap) { | 142 | if (pcie_cap) { |
143 | devctl = hca_header[(pcie_cap + PCI_EXP_DEVCTL) / 4]; | 143 | devctl = hca_header[(pcie_cap + PCI_EXP_DEVCTL) / 4]; |
144 | if (pci_write_config_word(dev->pdev, pcie_cap + PCI_EXP_DEVCTL, | 144 | if (pcie_capability_write_word(dev->pdev, PCI_EXP_DEVCTL, |
145 | devctl)) { | 145 | devctl)) { |
146 | err = -ENODEV; | 146 | err = -ENODEV; |
147 | mlx4_err(dev, "Couldn't restore HCA PCI Express " | 147 | mlx4_err(dev, "Couldn't restore HCA PCI Express " |
148 | "Device Control register, aborting.\n"); | 148 | "Device Control register, aborting.\n"); |
149 | goto out; | 149 | goto out; |
150 | } | 150 | } |
151 | linkctl = hca_header[(pcie_cap + PCI_EXP_LNKCTL) / 4]; | 151 | linkctl = hca_header[(pcie_cap + PCI_EXP_LNKCTL) / 4]; |
152 | if (pci_write_config_word(dev->pdev, pcie_cap + PCI_EXP_LNKCTL, | 152 | if (pcie_capability_write_word(dev->pdev, PCI_EXP_LNKCTL, |
153 | linkctl)) { | 153 | linkctl)) { |
154 | err = -ENODEV; | 154 | err = -ENODEV; |
155 | mlx4_err(dev, "Couldn't restore HCA PCI Express " | 155 | mlx4_err(dev, "Couldn't restore HCA PCI Express " |
156 | "Link control register, aborting.\n"); | 156 | "Link control register, aborting.\n"); |
diff --git a/drivers/net/ethernet/myricom/myri10ge/myri10ge.c b/drivers/net/ethernet/myricom/myri10ge/myri10ge.c index fa85cf1353fd..83516e3369c9 100644 --- a/drivers/net/ethernet/myricom/myri10ge/myri10ge.c +++ b/drivers/net/ethernet/myricom/myri10ge/myri10ge.c | |||
@@ -1078,22 +1078,16 @@ static int myri10ge_reset(struct myri10ge_priv *mgp) | |||
1078 | #ifdef CONFIG_MYRI10GE_DCA | 1078 | #ifdef CONFIG_MYRI10GE_DCA |
1079 | static int myri10ge_toggle_relaxed(struct pci_dev *pdev, int on) | 1079 | static int myri10ge_toggle_relaxed(struct pci_dev *pdev, int on) |
1080 | { | 1080 | { |
1081 | int ret, cap, err; | 1081 | int ret; |
1082 | u16 ctl; | 1082 | u16 ctl; |
1083 | 1083 | ||
1084 | cap = pci_pcie_cap(pdev); | 1084 | pcie_capability_read_word(pdev, PCI_EXP_DEVCTL, &ctl); |
1085 | if (!cap) | ||
1086 | return 0; | ||
1087 | |||
1088 | err = pci_read_config_word(pdev, cap + PCI_EXP_DEVCTL, &ctl); | ||
1089 | if (err) | ||
1090 | return 0; | ||
1091 | 1085 | ||
1092 | ret = (ctl & PCI_EXP_DEVCTL_RELAX_EN) >> 4; | 1086 | ret = (ctl & PCI_EXP_DEVCTL_RELAX_EN) >> 4; |
1093 | if (ret != on) { | 1087 | if (ret != on) { |
1094 | ctl &= ~PCI_EXP_DEVCTL_RELAX_EN; | 1088 | ctl &= ~PCI_EXP_DEVCTL_RELAX_EN; |
1095 | ctl |= (on << 4); | 1089 | ctl |= (on << 4); |
1096 | pci_write_config_word(pdev, cap + PCI_EXP_DEVCTL, ctl); | 1090 | pcie_capability_write_word(pdev, PCI_EXP_DEVCTL, ctl); |
1097 | } | 1091 | } |
1098 | return ret; | 1092 | return ret; |
1099 | } | 1093 | } |
@@ -3192,18 +3186,13 @@ static void myri10ge_enable_ecrc(struct myri10ge_priv *mgp) | |||
3192 | struct device *dev = &mgp->pdev->dev; | 3186 | struct device *dev = &mgp->pdev->dev; |
3193 | int cap; | 3187 | int cap; |
3194 | unsigned err_cap; | 3188 | unsigned err_cap; |
3195 | u16 val; | ||
3196 | u8 ext_type; | ||
3197 | int ret; | 3189 | int ret; |
3198 | 3190 | ||
3199 | if (!myri10ge_ecrc_enable || !bridge) | 3191 | if (!myri10ge_ecrc_enable || !bridge) |
3200 | return; | 3192 | return; |
3201 | 3193 | ||
3202 | /* check that the bridge is a root port */ | 3194 | /* check that the bridge is a root port */ |
3203 | cap = pci_pcie_cap(bridge); | 3195 | if (pci_pcie_type(bridge) != PCI_EXP_TYPE_ROOT_PORT) { |
3204 | pci_read_config_word(bridge, cap + PCI_CAP_FLAGS, &val); | ||
3205 | ext_type = (val & PCI_EXP_FLAGS_TYPE) >> 4; | ||
3206 | if (ext_type != PCI_EXP_TYPE_ROOT_PORT) { | ||
3207 | if (myri10ge_ecrc_enable > 1) { | 3196 | if (myri10ge_ecrc_enable > 1) { |
3208 | struct pci_dev *prev_bridge, *old_bridge = bridge; | 3197 | struct pci_dev *prev_bridge, *old_bridge = bridge; |
3209 | 3198 | ||
@@ -3218,11 +3207,8 @@ static void myri10ge_enable_ecrc(struct myri10ge_priv *mgp) | |||
3218 | " to force ECRC\n"); | 3207 | " to force ECRC\n"); |
3219 | return; | 3208 | return; |
3220 | } | 3209 | } |
3221 | cap = pci_pcie_cap(bridge); | 3210 | } while (pci_pcie_type(bridge) != |
3222 | pci_read_config_word(bridge, | 3211 | PCI_EXP_TYPE_ROOT_PORT); |
3223 | cap + PCI_CAP_FLAGS, &val); | ||
3224 | ext_type = (val & PCI_EXP_FLAGS_TYPE) >> 4; | ||
3225 | } while (ext_type != PCI_EXP_TYPE_ROOT_PORT); | ||
3226 | 3212 | ||
3227 | dev_info(dev, | 3213 | dev_info(dev, |
3228 | "Forcing ECRC on non-root port %s" | 3214 | "Forcing ECRC on non-root port %s" |
@@ -3335,11 +3321,10 @@ static void myri10ge_select_firmware(struct myri10ge_priv *mgp) | |||
3335 | int overridden = 0; | 3321 | int overridden = 0; |
3336 | 3322 | ||
3337 | if (myri10ge_force_firmware == 0) { | 3323 | if (myri10ge_force_firmware == 0) { |
3338 | int link_width, exp_cap; | 3324 | int link_width; |
3339 | u16 lnk; | 3325 | u16 lnk; |
3340 | 3326 | ||
3341 | exp_cap = pci_pcie_cap(mgp->pdev); | 3327 | pcie_capability_read_word(mgp->pdev, PCI_EXP_LNKSTA, &lnk); |
3342 | pci_read_config_word(mgp->pdev, exp_cap + PCI_EXP_LNKSTA, &lnk); | ||
3343 | link_width = (lnk >> 4) & 0x3f; | 3328 | link_width = (lnk >> 4) & 0x3f; |
3344 | 3329 | ||
3345 | /* Check to see if Link is less than 8 or if the | 3330 | /* Check to see if Link is less than 8 or if the |
diff --git a/drivers/net/ethernet/neterion/s2io.c b/drivers/net/ethernet/neterion/s2io.c index d958c2299372..de50547c187d 100644 --- a/drivers/net/ethernet/neterion/s2io.c +++ b/drivers/net/ethernet/neterion/s2io.c | |||
@@ -484,7 +484,7 @@ static DEFINE_PCI_DEVICE_TABLE(s2io_tbl) = { | |||
484 | 484 | ||
485 | MODULE_DEVICE_TABLE(pci, s2io_tbl); | 485 | MODULE_DEVICE_TABLE(pci, s2io_tbl); |
486 | 486 | ||
487 | static struct pci_error_handlers s2io_err_handler = { | 487 | static const struct pci_error_handlers s2io_err_handler = { |
488 | .error_detected = s2io_io_error_detected, | 488 | .error_detected = s2io_io_error_detected, |
489 | .slot_reset = s2io_io_slot_reset, | 489 | .slot_reset = s2io_io_slot_reset, |
490 | .resume = s2io_io_resume, | 490 | .resume = s2io_io_resume, |
diff --git a/drivers/net/ethernet/neterion/vxge/vxge-config.c b/drivers/net/ethernet/neterion/vxge/vxge-config.c index 32d06824fe3e..c2e420a84d22 100644 --- a/drivers/net/ethernet/neterion/vxge/vxge-config.c +++ b/drivers/net/ethernet/neterion/vxge/vxge-config.c | |||
@@ -757,7 +757,7 @@ __vxge_hw_verify_pci_e_info(struct __vxge_hw_device *hldev) | |||
757 | u16 lnk; | 757 | u16 lnk; |
758 | 758 | ||
759 | /* Get the negotiated link width and speed from PCI config space */ | 759 | /* Get the negotiated link width and speed from PCI config space */ |
760 | pci_read_config_word(dev, dev->pcie_cap + PCI_EXP_LNKSTA, &lnk); | 760 | pcie_capability_read_word(dev, PCI_EXP_LNKSTA, &lnk); |
761 | 761 | ||
762 | if ((lnk & PCI_EXP_LNKSTA_CLS) != 1) | 762 | if ((lnk & PCI_EXP_LNKSTA_CLS) != 1) |
763 | return VXGE_HW_ERR_INVALID_PCI_INFO; | 763 | return VXGE_HW_ERR_INVALID_PCI_INFO; |
@@ -1982,7 +1982,7 @@ u16 vxge_hw_device_link_width_get(struct __vxge_hw_device *hldev) | |||
1982 | struct pci_dev *dev = hldev->pdev; | 1982 | struct pci_dev *dev = hldev->pdev; |
1983 | u16 lnk; | 1983 | u16 lnk; |
1984 | 1984 | ||
1985 | pci_read_config_word(dev, dev->pcie_cap + PCI_EXP_LNKSTA, &lnk); | 1985 | pcie_capability_read_word(dev, PCI_EXP_LNKSTA, &lnk); |
1986 | return (lnk & VXGE_HW_PCI_EXP_LNKCAP_LNK_WIDTH) >> 4; | 1986 | return (lnk & VXGE_HW_PCI_EXP_LNKCAP_LNK_WIDTH) >> 4; |
1987 | } | 1987 | } |
1988 | 1988 | ||
diff --git a/drivers/net/ethernet/neterion/vxge/vxge-main.c b/drivers/net/ethernet/neterion/vxge/vxge-main.c index de2190443510..cfa71a30dc8d 100644 --- a/drivers/net/ethernet/neterion/vxge/vxge-main.c +++ b/drivers/net/ethernet/neterion/vxge/vxge-main.c | |||
@@ -4799,7 +4799,7 @@ static void __devexit vxge_remove(struct pci_dev *pdev) | |||
4799 | __LINE__); | 4799 | __LINE__); |
4800 | } | 4800 | } |
4801 | 4801 | ||
4802 | static struct pci_error_handlers vxge_err_handler = { | 4802 | static const struct pci_error_handlers vxge_err_handler = { |
4803 | .error_detected = vxge_io_error_detected, | 4803 | .error_detected = vxge_io_error_detected, |
4804 | .slot_reset = vxge_io_slot_reset, | 4804 | .slot_reset = vxge_io_slot_reset, |
4805 | .resume = vxge_io_resume, | 4805 | .resume = vxge_io_resume, |
diff --git a/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c b/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c index feb85d56c750..b2a94d02a521 100644 --- a/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c +++ b/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c | |||
@@ -2795,7 +2795,7 @@ static const struct dev_pm_ops pch_gbe_pm_ops = { | |||
2795 | }; | 2795 | }; |
2796 | #endif | 2796 | #endif |
2797 | 2797 | ||
2798 | static struct pci_error_handlers pch_gbe_err_handler = { | 2798 | static const struct pci_error_handlers pch_gbe_err_handler = { |
2799 | .error_detected = pch_gbe_io_error_detected, | 2799 | .error_detected = pch_gbe_io_error_detected, |
2800 | .slot_reset = pch_gbe_io_slot_reset, | 2800 | .slot_reset = pch_gbe_io_slot_reset, |
2801 | .resume = pch_gbe_io_resume | 2801 | .resume = pch_gbe_io_resume |
diff --git a/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c b/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c index a77c558d8f40..df450616ab37 100644 --- a/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c +++ b/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c | |||
@@ -1386,7 +1386,7 @@ static void netxen_mask_aer_correctable(struct netxen_adapter *adapter) | |||
1386 | adapter->ahw.board_type != NETXEN_BRDTYPE_P3_10G_TP) | 1386 | adapter->ahw.board_type != NETXEN_BRDTYPE_P3_10G_TP) |
1387 | return; | 1387 | return; |
1388 | 1388 | ||
1389 | if (root->pcie_type != PCI_EXP_TYPE_ROOT_PORT) | 1389 | if (pci_pcie_type(root) != PCI_EXP_TYPE_ROOT_PORT) |
1390 | return; | 1390 | return; |
1391 | 1391 | ||
1392 | aer_pos = pci_find_ext_capability(root, PCI_EXT_CAP_ID_ERR); | 1392 | aer_pos = pci_find_ext_capability(root, PCI_EXT_CAP_ID_ERR); |
@@ -3340,7 +3340,7 @@ netxen_free_vlan_ip_list(struct netxen_adapter *adapter) | |||
3340 | { } | 3340 | { } |
3341 | #endif | 3341 | #endif |
3342 | 3342 | ||
3343 | static struct pci_error_handlers netxen_err_handler = { | 3343 | static const struct pci_error_handlers netxen_err_handler = { |
3344 | .error_detected = netxen_io_error_detected, | 3344 | .error_detected = netxen_io_error_detected, |
3345 | .slot_reset = netxen_io_slot_reset, | 3345 | .slot_reset = netxen_io_slot_reset, |
3346 | .resume = netxen_io_resume, | 3346 | .resume = netxen_io_resume, |
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c index 212c12193275..473ce134ca63 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c | |||
@@ -4522,7 +4522,7 @@ static void | |||
4522 | qlcnic_restore_indev_addr(struct net_device *dev, unsigned long event) | 4522 | qlcnic_restore_indev_addr(struct net_device *dev, unsigned long event) |
4523 | { } | 4523 | { } |
4524 | #endif | 4524 | #endif |
4525 | static struct pci_error_handlers qlcnic_err_handler = { | 4525 | static const struct pci_error_handlers qlcnic_err_handler = { |
4526 | .error_detected = qlcnic_io_error_detected, | 4526 | .error_detected = qlcnic_io_error_detected, |
4527 | .slot_reset = qlcnic_io_slot_reset, | 4527 | .slot_reset = qlcnic_io_slot_reset, |
4528 | .resume = qlcnic_io_resume, | 4528 | .resume = qlcnic_io_resume, |
diff --git a/drivers/net/ethernet/qlogic/qlge/qlge_main.c b/drivers/net/ethernet/qlogic/qlge/qlge_main.c index b53a3b60b648..b262d6156816 100644 --- a/drivers/net/ethernet/qlogic/qlge/qlge_main.c +++ b/drivers/net/ethernet/qlogic/qlge/qlge_main.c | |||
@@ -4847,7 +4847,7 @@ static void qlge_io_resume(struct pci_dev *pdev) | |||
4847 | netif_device_attach(ndev); | 4847 | netif_device_attach(ndev); |
4848 | } | 4848 | } |
4849 | 4849 | ||
4850 | static struct pci_error_handlers qlge_err_handler = { | 4850 | static const struct pci_error_handlers qlge_err_handler = { |
4851 | .error_detected = qlge_io_error_detected, | 4851 | .error_detected = qlge_io_error_detected, |
4852 | .slot_reset = qlge_io_slot_reset, | 4852 | .slot_reset = qlge_io_slot_reset, |
4853 | .resume = qlge_io_resume, | 4853 | .resume = qlge_io_resume, |
diff --git a/drivers/net/ethernet/realtek/r8169.c b/drivers/net/ethernet/realtek/r8169.c index b47d5b35024e..a7cc56007b33 100644 --- a/drivers/net/ethernet/realtek/r8169.c +++ b/drivers/net/ethernet/realtek/r8169.c | |||
@@ -833,15 +833,8 @@ static void rtl_unlock_work(struct rtl8169_private *tp) | |||
833 | 833 | ||
834 | static void rtl_tx_performance_tweak(struct pci_dev *pdev, u16 force) | 834 | static void rtl_tx_performance_tweak(struct pci_dev *pdev, u16 force) |
835 | { | 835 | { |
836 | int cap = pci_pcie_cap(pdev); | 836 | pcie_capability_clear_and_set_word(pdev, PCI_EXP_DEVCTL, |
837 | 837 | PCI_EXP_DEVCTL_READRQ, force); | |
838 | if (cap) { | ||
839 | u16 ctl; | ||
840 | |||
841 | pci_read_config_word(pdev, cap + PCI_EXP_DEVCTL, &ctl); | ||
842 | ctl = (ctl & ~PCI_EXP_DEVCTL_READRQ) | force; | ||
843 | pci_write_config_word(pdev, cap + PCI_EXP_DEVCTL, ctl); | ||
844 | } | ||
845 | } | 838 | } |
846 | 839 | ||
847 | struct rtl_cond { | 840 | struct rtl_cond { |
@@ -4739,28 +4732,14 @@ static void rtl_ephy_init(struct rtl8169_private *tp, const struct ephy_info *e, | |||
4739 | 4732 | ||
4740 | static void rtl_disable_clock_request(struct pci_dev *pdev) | 4733 | static void rtl_disable_clock_request(struct pci_dev *pdev) |
4741 | { | 4734 | { |
4742 | int cap = pci_pcie_cap(pdev); | 4735 | pcie_capability_clear_word(pdev, PCI_EXP_LNKCTL, |
4743 | 4736 | PCI_EXP_LNKCTL_CLKREQ_EN); | |
4744 | if (cap) { | ||
4745 | u16 ctl; | ||
4746 | |||
4747 | pci_read_config_word(pdev, cap + PCI_EXP_LNKCTL, &ctl); | ||
4748 | ctl &= ~PCI_EXP_LNKCTL_CLKREQ_EN; | ||
4749 | pci_write_config_word(pdev, cap + PCI_EXP_LNKCTL, ctl); | ||
4750 | } | ||
4751 | } | 4737 | } |
4752 | 4738 | ||
4753 | static void rtl_enable_clock_request(struct pci_dev *pdev) | 4739 | static void rtl_enable_clock_request(struct pci_dev *pdev) |
4754 | { | 4740 | { |
4755 | int cap = pci_pcie_cap(pdev); | 4741 | pcie_capability_set_word(pdev, PCI_EXP_LNKCTL, |
4756 | 4742 | PCI_EXP_LNKCTL_CLKREQ_EN); | |
4757 | if (cap) { | ||
4758 | u16 ctl; | ||
4759 | |||
4760 | pci_read_config_word(pdev, cap + PCI_EXP_LNKCTL, &ctl); | ||
4761 | ctl |= PCI_EXP_LNKCTL_CLKREQ_EN; | ||
4762 | pci_write_config_word(pdev, cap + PCI_EXP_LNKCTL, ctl); | ||
4763 | } | ||
4764 | } | 4743 | } |
4765 | 4744 | ||
4766 | #define R8168_CPCMD_QUIRK_MASK (\ | 4745 | #define R8168_CPCMD_QUIRK_MASK (\ |
@@ -5405,14 +5384,9 @@ static void rtl_hw_start_8101(struct net_device *dev) | |||
5405 | tp->event_slow &= ~RxFIFOOver; | 5384 | tp->event_slow &= ~RxFIFOOver; |
5406 | 5385 | ||
5407 | if (tp->mac_version == RTL_GIGA_MAC_VER_13 || | 5386 | if (tp->mac_version == RTL_GIGA_MAC_VER_13 || |
5408 | tp->mac_version == RTL_GIGA_MAC_VER_16) { | 5387 | tp->mac_version == RTL_GIGA_MAC_VER_16) |
5409 | int cap = pci_pcie_cap(pdev); | 5388 | pcie_capability_set_word(pdev, PCI_EXP_DEVCTL, |
5410 | 5389 | PCI_EXP_DEVCTL_NOSNOOP_EN); | |
5411 | if (cap) { | ||
5412 | pci_write_config_word(pdev, cap + PCI_EXP_DEVCTL, | ||
5413 | PCI_EXP_DEVCTL_NOSNOOP_EN); | ||
5414 | } | ||
5415 | } | ||
5416 | 5390 | ||
5417 | RTL_W8(Cfg9346, Cfg9346_Unlock); | 5391 | RTL_W8(Cfg9346, Cfg9346_Unlock); |
5418 | 5392 | ||
diff --git a/drivers/net/ethernet/sun/niu.c b/drivers/net/ethernet/sun/niu.c index c2a0fe393267..3208dca66758 100644 --- a/drivers/net/ethernet/sun/niu.c +++ b/drivers/net/ethernet/sun/niu.c | |||
@@ -9762,9 +9762,8 @@ static int __devinit niu_pci_init_one(struct pci_dev *pdev, | |||
9762 | union niu_parent_id parent_id; | 9762 | union niu_parent_id parent_id; |
9763 | struct net_device *dev; | 9763 | struct net_device *dev; |
9764 | struct niu *np; | 9764 | struct niu *np; |
9765 | int err, pos; | 9765 | int err; |
9766 | u64 dma_mask; | 9766 | u64 dma_mask; |
9767 | u16 val16; | ||
9768 | 9767 | ||
9769 | niu_driver_version(); | 9768 | niu_driver_version(); |
9770 | 9769 | ||
@@ -9787,8 +9786,7 @@ static int __devinit niu_pci_init_one(struct pci_dev *pdev, | |||
9787 | goto err_out_disable_pdev; | 9786 | goto err_out_disable_pdev; |
9788 | } | 9787 | } |
9789 | 9788 | ||
9790 | pos = pci_pcie_cap(pdev); | 9789 | if (!pci_is_pcie(pdev)) { |
9791 | if (pos <= 0) { | ||
9792 | dev_err(&pdev->dev, "Cannot find PCI Express capability, aborting\n"); | 9790 | dev_err(&pdev->dev, "Cannot find PCI Express capability, aborting\n"); |
9793 | goto err_out_free_res; | 9791 | goto err_out_free_res; |
9794 | } | 9792 | } |
@@ -9813,14 +9811,11 @@ static int __devinit niu_pci_init_one(struct pci_dev *pdev, | |||
9813 | goto err_out_free_dev; | 9811 | goto err_out_free_dev; |
9814 | } | 9812 | } |
9815 | 9813 | ||
9816 | pci_read_config_word(pdev, pos + PCI_EXP_DEVCTL, &val16); | 9814 | pcie_capability_clear_and_set_word(pdev, PCI_EXP_DEVCTL, |
9817 | val16 &= ~PCI_EXP_DEVCTL_NOSNOOP_EN; | 9815 | PCI_EXP_DEVCTL_NOSNOOP_EN, |
9818 | val16 |= (PCI_EXP_DEVCTL_CERE | | 9816 | PCI_EXP_DEVCTL_CERE | PCI_EXP_DEVCTL_NFERE | |
9819 | PCI_EXP_DEVCTL_NFERE | | 9817 | PCI_EXP_DEVCTL_FERE | PCI_EXP_DEVCTL_URRE | |
9820 | PCI_EXP_DEVCTL_FERE | | 9818 | PCI_EXP_DEVCTL_RELAX_EN); |
9821 | PCI_EXP_DEVCTL_URRE | | ||
9822 | PCI_EXP_DEVCTL_RELAX_EN); | ||
9823 | pci_write_config_word(pdev, pos + PCI_EXP_DEVCTL, val16); | ||
9824 | 9819 | ||
9825 | dma_mask = DMA_BIT_MASK(44); | 9820 | dma_mask = DMA_BIT_MASK(44); |
9826 | err = pci_set_dma_mask(pdev, dma_mask); | 9821 | err = pci_set_dma_mask(pdev, dma_mask); |
diff --git a/drivers/net/wireless/ath/ath9k/pci.c b/drivers/net/wireless/ath/ath9k/pci.c index a978984d78a5..ef11dc639461 100644 --- a/drivers/net/wireless/ath/ath9k/pci.c +++ b/drivers/net/wireless/ath/ath9k/pci.c | |||
@@ -113,41 +113,32 @@ static void ath_pci_aspm_init(struct ath_common *common) | |||
113 | struct ath_hw *ah = sc->sc_ah; | 113 | struct ath_hw *ah = sc->sc_ah; |
114 | struct pci_dev *pdev = to_pci_dev(sc->dev); | 114 | struct pci_dev *pdev = to_pci_dev(sc->dev); |
115 | struct pci_dev *parent; | 115 | struct pci_dev *parent; |
116 | int pos; | 116 | u16 aspm; |
117 | u8 aspm; | ||
118 | 117 | ||
119 | if (!ah->is_pciexpress) | 118 | if (!ah->is_pciexpress) |
120 | return; | 119 | return; |
121 | 120 | ||
122 | pos = pci_pcie_cap(pdev); | ||
123 | if (!pos) | ||
124 | return; | ||
125 | |||
126 | parent = pdev->bus->self; | 121 | parent = pdev->bus->self; |
127 | if (!parent) | 122 | if (!parent) |
128 | return; | 123 | return; |
129 | 124 | ||
130 | if (ath9k_hw_get_btcoex_scheme(ah) != ATH_BTCOEX_CFG_NONE) { | 125 | if (ath9k_hw_get_btcoex_scheme(ah) != ATH_BTCOEX_CFG_NONE) { |
131 | /* Bluetooth coexistance requires disabling ASPM. */ | 126 | /* Bluetooth coexistance requires disabling ASPM. */ |
132 | pci_read_config_byte(pdev, pos + PCI_EXP_LNKCTL, &aspm); | 127 | pcie_capability_clear_word(pdev, PCI_EXP_LNKCTL, |
133 | aspm &= ~(PCIE_LINK_STATE_L0S | PCIE_LINK_STATE_L1); | 128 | PCIE_LINK_STATE_L0S | PCIE_LINK_STATE_L1); |
134 | pci_write_config_byte(pdev, pos + PCI_EXP_LNKCTL, aspm); | ||
135 | 129 | ||
136 | /* | 130 | /* |
137 | * Both upstream and downstream PCIe components should | 131 | * Both upstream and downstream PCIe components should |
138 | * have the same ASPM settings. | 132 | * have the same ASPM settings. |
139 | */ | 133 | */ |
140 | pos = pci_pcie_cap(parent); | 134 | pcie_capability_clear_word(parent, PCI_EXP_LNKCTL, |
141 | pci_read_config_byte(parent, pos + PCI_EXP_LNKCTL, &aspm); | 135 | PCIE_LINK_STATE_L0S | PCIE_LINK_STATE_L1); |
142 | aspm &= ~(PCIE_LINK_STATE_L0S | PCIE_LINK_STATE_L1); | ||
143 | pci_write_config_byte(parent, pos + PCI_EXP_LNKCTL, aspm); | ||
144 | 136 | ||
145 | ath_info(common, "Disabling ASPM since BTCOEX is enabled\n"); | 137 | ath_info(common, "Disabling ASPM since BTCOEX is enabled\n"); |
146 | return; | 138 | return; |
147 | } | 139 | } |
148 | 140 | ||
149 | pos = pci_pcie_cap(parent); | 141 | pcie_capability_read_word(parent, PCI_EXP_LNKCTL, &aspm); |
150 | pci_read_config_byte(parent, pos + PCI_EXP_LNKCTL, &aspm); | ||
151 | if (aspm & (PCIE_LINK_STATE_L0S | PCIE_LINK_STATE_L1)) { | 142 | if (aspm & (PCIE_LINK_STATE_L0S | PCIE_LINK_STATE_L1)) { |
152 | ah->aspm_enabled = true; | 143 | ah->aspm_enabled = true; |
153 | /* Initialize PCIe PM and SERDES registers. */ | 144 | /* Initialize PCIe PM and SERDES registers. */ |
diff --git a/drivers/net/wireless/iwlegacy/common.h b/drivers/net/wireless/iwlegacy/common.h index 5f5017767b99..724682669060 100644 --- a/drivers/net/wireless/iwlegacy/common.h +++ b/drivers/net/wireless/iwlegacy/common.h | |||
@@ -1832,10 +1832,8 @@ int il_enqueue_hcmd(struct il_priv *il, struct il_host_cmd *cmd); | |||
1832 | static inline u16 | 1832 | static inline u16 |
1833 | il_pcie_link_ctl(struct il_priv *il) | 1833 | il_pcie_link_ctl(struct il_priv *il) |
1834 | { | 1834 | { |
1835 | int pos; | ||
1836 | u16 pci_lnk_ctl; | 1835 | u16 pci_lnk_ctl; |
1837 | pos = pci_pcie_cap(il->pci_dev); | 1836 | pcie_capability_read_word(il->pci_dev, PCI_EXP_LNKCTL, &pci_lnk_ctl); |
1838 | pci_read_config_word(il->pci_dev, pos + PCI_EXP_LNKCTL, &pci_lnk_ctl); | ||
1839 | return pci_lnk_ctl; | 1837 | return pci_lnk_ctl; |
1840 | } | 1838 | } |
1841 | 1839 | ||
diff --git a/drivers/net/wireless/iwlwifi/pcie/trans.c b/drivers/net/wireless/iwlwifi/pcie/trans.c index dbeebef562d5..063ecaff5b56 100644 --- a/drivers/net/wireless/iwlwifi/pcie/trans.c +++ b/drivers/net/wireless/iwlwifi/pcie/trans.c | |||
@@ -675,13 +675,10 @@ static void iwl_set_pwr_vmain(struct iwl_trans *trans) | |||
675 | static u16 iwl_pciexp_link_ctrl(struct iwl_trans *trans) | 675 | static u16 iwl_pciexp_link_ctrl(struct iwl_trans *trans) |
676 | { | 676 | { |
677 | struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); | 677 | struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); |
678 | int pos; | ||
679 | u16 pci_lnk_ctl; | 678 | u16 pci_lnk_ctl; |
680 | 679 | ||
681 | struct pci_dev *pci_dev = trans_pcie->pci_dev; | 680 | pcie_capability_read_word(trans_pcie->pci_dev, PCI_EXP_LNKCTL, |
682 | 681 | &pci_lnk_ctl); | |
683 | pos = pci_pcie_cap(pci_dev); | ||
684 | pci_read_config_word(pci_dev, pos + PCI_EXP_LNKCTL, &pci_lnk_ctl); | ||
685 | return pci_lnk_ctl; | 682 | return pci_lnk_ctl; |
686 | } | 683 | } |
687 | 684 | ||
diff --git a/drivers/net/wireless/rtlwifi/pci.c b/drivers/net/wireless/rtlwifi/pci.c index 80f75d3ba84a..5983631a1b1a 100644 --- a/drivers/net/wireless/rtlwifi/pci.c +++ b/drivers/net/wireless/rtlwifi/pci.c | |||
@@ -372,13 +372,11 @@ static void rtl_pci_parse_configuration(struct pci_dev *pdev, | |||
372 | struct rtl_pci_priv *pcipriv = rtl_pcipriv(hw); | 372 | struct rtl_pci_priv *pcipriv = rtl_pcipriv(hw); |
373 | 373 | ||
374 | u8 tmp; | 374 | u8 tmp; |
375 | int pos; | 375 | u16 linkctrl_reg; |
376 | u8 linkctrl_reg; | ||
377 | 376 | ||
378 | /*Link Control Register */ | 377 | /*Link Control Register */ |
379 | pos = pci_pcie_cap(pdev); | 378 | pcie_capability_read_word(pdev, PCI_EXP_LNKCTL, &linkctrl_reg); |
380 | pci_read_config_byte(pdev, pos + PCI_EXP_LNKCTL, &linkctrl_reg); | 379 | pcipriv->ndis_adapter.linkctrl_reg = (u8)linkctrl_reg; |
381 | pcipriv->ndis_adapter.linkctrl_reg = linkctrl_reg; | ||
382 | 380 | ||
383 | RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, "Link Control Register =%x\n", | 381 | RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, "Link Control Register =%x\n", |
384 | pcipriv->ndis_adapter.linkctrl_reg); | 382 | pcipriv->ndis_adapter.linkctrl_reg); |