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.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index 9af986085d09..5c80b59c5931 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -2601,13 +2601,13 @@ EXPORT_SYMBOL(pcix_get_max_mmrbc);
2601int pcix_get_mmrbc(struct pci_dev *dev) 2601int pcix_get_mmrbc(struct pci_dev *dev)
2602{ 2602{
2603 int ret, cap; 2603 int ret, cap;
2604 u32 cmd; 2604 u16 cmd;
2605 2605
2606 cap = pci_find_capability(dev, PCI_CAP_ID_PCIX); 2606 cap = pci_find_capability(dev, PCI_CAP_ID_PCIX);
2607 if (!cap) 2607 if (!cap)
2608 return -EINVAL; 2608 return -EINVAL;
2609 2609
2610 ret = pci_read_config_dword(dev, cap + PCI_X_CMD, &cmd); 2610 ret = pci_read_config_word(dev, cap + PCI_X_CMD, &cmd);
2611 if (!ret) 2611 if (!ret)
2612 ret = 512 << ((cmd & PCI_X_CMD_MAX_READ) >> 2); 2612 ret = 512 << ((cmd & PCI_X_CMD_MAX_READ) >> 2);
2613 2613
@@ -2627,7 +2627,8 @@ EXPORT_SYMBOL(pcix_get_mmrbc);
2627int pcix_set_mmrbc(struct pci_dev *dev, int mmrbc) 2627int pcix_set_mmrbc(struct pci_dev *dev, int mmrbc)
2628{ 2628{
2629 int cap, err = -EINVAL; 2629 int cap, err = -EINVAL;
2630 u32 stat, cmd, v, o; 2630 u32 stat, v, o;
2631 u16 cmd;
2631 2632
2632 if (mmrbc < 512 || mmrbc > 4096 || !is_power_of_2(mmrbc)) 2633 if (mmrbc < 512 || mmrbc > 4096 || !is_power_of_2(mmrbc))
2633 goto out; 2634 goto out;
@@ -2645,7 +2646,7 @@ int pcix_set_mmrbc(struct pci_dev *dev, int mmrbc)
2645 if (v > (stat & PCI_X_STATUS_MAX_READ) >> 21) 2646 if (v > (stat & PCI_X_STATUS_MAX_READ) >> 21)
2646 return -E2BIG; 2647 return -E2BIG;
2647 2648
2648 err = pci_read_config_dword(dev, cap + PCI_X_CMD, &cmd); 2649 err = pci_read_config_word(dev, cap + PCI_X_CMD, &cmd);
2649 if (err) 2650 if (err)
2650 goto out; 2651 goto out;
2651 2652
@@ -2657,7 +2658,7 @@ int pcix_set_mmrbc(struct pci_dev *dev, int mmrbc)
2657 2658
2658 cmd &= ~PCI_X_CMD_MAX_READ; 2659 cmd &= ~PCI_X_CMD_MAX_READ;
2659 cmd |= v << 2; 2660 cmd |= v << 2;
2660 err = pci_write_config_dword(dev, cap + PCI_X_CMD, cmd); 2661 err = pci_write_config_word(dev, cap + PCI_X_CMD, cmd);
2661 } 2662 }
2662out: 2663out:
2663 return err; 2664 return err;