diff options
author | Arthur Jones <arthur.jones@qlogic.com> | 2008-04-17 00:09:31 -0400 |
---|---|---|
committer | Roland Dreier <rolandd@cisco.com> | 2008-04-17 00:09:31 -0400 |
commit | bb9171448deb1f7ece27674e2e431e4f267fd453 (patch) | |
tree | b042155205bbbe3deb317d65a53a4180fb512435 /drivers/infiniband/hw/ipath/ipath_driver.c | |
parent | 8babfa4fb9bfe93d57c700410a4f8be9fbd3edd7 (diff) |
IB/ipath: Misc changes to prepare for IB7220 introduction
The patch adds a number of minor changes to support newer HCAs:
- New send buffer control bits
- New error condition bits
- Locking and initialization changes
- More send buffers
Signed-off-by: Ralph Campbell <ralph.campbell@qlogic.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
Diffstat (limited to 'drivers/infiniband/hw/ipath/ipath_driver.c')
-rw-r--r-- | drivers/infiniband/hw/ipath/ipath_driver.c | 61 |
1 files changed, 48 insertions, 13 deletions
diff --git a/drivers/infiniband/hw/ipath/ipath_driver.c b/drivers/infiniband/hw/ipath/ipath_driver.c index a3141bbc177a..c94bc4730b2b 100644 --- a/drivers/infiniband/hw/ipath/ipath_driver.c +++ b/drivers/infiniband/hw/ipath/ipath_driver.c | |||
@@ -89,6 +89,10 @@ MODULE_LICENSE("GPL"); | |||
89 | MODULE_AUTHOR("QLogic <support@qlogic.com>"); | 89 | MODULE_AUTHOR("QLogic <support@qlogic.com>"); |
90 | MODULE_DESCRIPTION("QLogic InfiniPath driver"); | 90 | MODULE_DESCRIPTION("QLogic InfiniPath driver"); |
91 | 91 | ||
92 | /* | ||
93 | * Table to translate the LINKTRAININGSTATE portion of | ||
94 | * IBCStatus to a human-readable form. | ||
95 | */ | ||
92 | const char *ipath_ibcstatus_str[] = { | 96 | const char *ipath_ibcstatus_str[] = { |
93 | "Disabled", | 97 | "Disabled", |
94 | "LinkUp", | 98 | "LinkUp", |
@@ -103,9 +107,20 @@ const char *ipath_ibcstatus_str[] = { | |||
103 | "CfgWaitRmt", | 107 | "CfgWaitRmt", |
104 | "CfgIdle", | 108 | "CfgIdle", |
105 | "RecovRetrain", | 109 | "RecovRetrain", |
106 | "LState0xD", /* unused */ | 110 | "CfgTxRevLane", /* unused before IBA7220 */ |
107 | "RecovWaitRmt", | 111 | "RecovWaitRmt", |
108 | "RecovIdle", | 112 | "RecovIdle", |
113 | /* below were added for IBA7220 */ | ||
114 | "CfgEnhanced", | ||
115 | "CfgTest", | ||
116 | "CfgWaitRmtTest", | ||
117 | "CfgWaitCfgEnhanced", | ||
118 | "SendTS_T", | ||
119 | "SendTstIdles", | ||
120 | "RcvTS_T", | ||
121 | "SendTst_TS1s", | ||
122 | "LTState18", "LTState19", "LTState1A", "LTState1B", | ||
123 | "LTState1C", "LTState1D", "LTState1E", "LTState1F" | ||
109 | }; | 124 | }; |
110 | 125 | ||
111 | static void __devexit ipath_remove_one(struct pci_dev *); | 126 | static void __devexit ipath_remove_one(struct pci_dev *); |
@@ -333,7 +348,14 @@ static void ipath_verify_pioperf(struct ipath_devdata *dd) | |||
333 | 348 | ||
334 | ipath_disable_armlaunch(dd); | 349 | ipath_disable_armlaunch(dd); |
335 | 350 | ||
336 | writeq(0, piobuf); /* length 0, no dwords actually sent */ | 351 | /* |
352 | * length 0, no dwords actually sent, and mark as VL15 | ||
353 | * on chips where that may matter (due to IB flowcontrol) | ||
354 | */ | ||
355 | if ((dd->ipath_flags & IPATH_HAS_PBC_CNT)) | ||
356 | writeq(1UL << 63, piobuf); | ||
357 | else | ||
358 | writeq(0, piobuf); | ||
337 | ipath_flush_wc(); | 359 | ipath_flush_wc(); |
338 | 360 | ||
339 | /* | 361 | /* |
@@ -374,6 +396,7 @@ static int __devinit ipath_init_one(struct pci_dev *pdev, | |||
374 | struct ipath_devdata *dd; | 396 | struct ipath_devdata *dd; |
375 | unsigned long long addr; | 397 | unsigned long long addr; |
376 | u32 bar0 = 0, bar1 = 0; | 398 | u32 bar0 = 0, bar1 = 0; |
399 | u8 rev; | ||
377 | 400 | ||
378 | dd = ipath_alloc_devdata(pdev); | 401 | dd = ipath_alloc_devdata(pdev); |
379 | if (IS_ERR(dd)) { | 402 | if (IS_ERR(dd)) { |
@@ -405,7 +428,7 @@ static int __devinit ipath_init_one(struct pci_dev *pdev, | |||
405 | } | 428 | } |
406 | addr = pci_resource_start(pdev, 0); | 429 | addr = pci_resource_start(pdev, 0); |
407 | len = pci_resource_len(pdev, 0); | 430 | len = pci_resource_len(pdev, 0); |
408 | ipath_cdbg(VERBOSE, "regbase (0) %llx len %d pdev->irq %d, vend %x/%x " | 431 | ipath_cdbg(VERBOSE, "regbase (0) %llx len %d irq %d, vend %x/%x " |
409 | "driver_data %lx\n", addr, len, pdev->irq, ent->vendor, | 432 | "driver_data %lx\n", addr, len, pdev->irq, ent->vendor, |
410 | ent->device, ent->driver_data); | 433 | ent->device, ent->driver_data); |
411 | 434 | ||
@@ -530,7 +553,13 @@ static int __devinit ipath_init_one(struct pci_dev *pdev, | |||
530 | goto bail_regions; | 553 | goto bail_regions; |
531 | } | 554 | } |
532 | 555 | ||
533 | dd->ipath_pcirev = pdev->revision; | 556 | ret = pci_read_config_byte(pdev, PCI_REVISION_ID, &rev); |
557 | if (ret) { | ||
558 | ipath_dev_err(dd, "Failed to read PCI revision ID unit " | ||
559 | "%u: err %d\n", dd->ipath_unit, -ret); | ||
560 | goto bail_regions; /* shouldn't ever happen */ | ||
561 | } | ||
562 | dd->ipath_pcirev = rev; | ||
534 | 563 | ||
535 | #if defined(__powerpc__) | 564 | #if defined(__powerpc__) |
536 | /* There isn't a generic way to specify writethrough mappings */ | 565 | /* There isn't a generic way to specify writethrough mappings */ |
@@ -553,14 +582,6 @@ static int __devinit ipath_init_one(struct pci_dev *pdev, | |||
553 | ipath_cdbg(VERBOSE, "mapped io addr %llx to kregbase %p\n", | 582 | ipath_cdbg(VERBOSE, "mapped io addr %llx to kregbase %p\n", |
554 | addr, dd->ipath_kregbase); | 583 | addr, dd->ipath_kregbase); |
555 | 584 | ||
556 | /* | ||
557 | * clear ipath_flags here instead of in ipath_init_chip as it is set | ||
558 | * by ipath_setup_htconfig. | ||
559 | */ | ||
560 | dd->ipath_flags = 0; | ||
561 | dd->ipath_lli_counter = 0; | ||
562 | dd->ipath_lli_errors = 0; | ||
563 | |||
564 | if (dd->ipath_f_bus(dd, pdev)) | 585 | if (dd->ipath_f_bus(dd, pdev)) |
565 | ipath_dev_err(dd, "Failed to setup config space; " | 586 | ipath_dev_err(dd, "Failed to setup config space; " |
566 | "continuing anyway\n"); | 587 | "continuing anyway\n"); |
@@ -649,6 +670,10 @@ static void __devexit cleanup_device(struct ipath_devdata *dd) | |||
649 | ipath_disable_wc(dd); | 670 | ipath_disable_wc(dd); |
650 | } | 671 | } |
651 | 672 | ||
673 | if (dd->ipath_spectriggerhit) | ||
674 | dev_info(&dd->pcidev->dev, "%lu special trigger hits\n", | ||
675 | dd->ipath_spectriggerhit); | ||
676 | |||
652 | if (dd->ipath_pioavailregs_dma) { | 677 | if (dd->ipath_pioavailregs_dma) { |
653 | dma_free_coherent(&dd->pcidev->dev, PAGE_SIZE, | 678 | dma_free_coherent(&dd->pcidev->dev, PAGE_SIZE, |
654 | (void *) dd->ipath_pioavailregs_dma, | 679 | (void *) dd->ipath_pioavailregs_dma, |
@@ -857,7 +882,7 @@ int ipath_wait_linkstate(struct ipath_devdata *dd, u32 state, int msecs) | |||
857 | (unsigned long long) ipath_read_kreg64( | 882 | (unsigned long long) ipath_read_kreg64( |
858 | dd, dd->ipath_kregs->kr_ibcctrl), | 883 | dd, dd->ipath_kregs->kr_ibcctrl), |
859 | (unsigned long long) val, | 884 | (unsigned long long) val, |
860 | ipath_ibcstatus_str[val & 0xf]); | 885 | ipath_ibcstatus_str[val & dd->ibcs_lts_mask]); |
861 | } | 886 | } |
862 | return (dd->ipath_flags & state) ? 0 : -ETIMEDOUT; | 887 | return (dd->ipath_flags & state) ? 0 : -ETIMEDOUT; |
863 | } | 888 | } |
@@ -906,6 +931,8 @@ int ipath_decode_err(char *buf, size_t blen, ipath_err_t err) | |||
906 | strlcat(buf, "rbadversion ", blen); | 931 | strlcat(buf, "rbadversion ", blen); |
907 | if (err & INFINIPATH_E_RHDR) | 932 | if (err & INFINIPATH_E_RHDR) |
908 | strlcat(buf, "rhdr ", blen); | 933 | strlcat(buf, "rhdr ", blen); |
934 | if (err & INFINIPATH_E_SENDSPECIALTRIGGER) | ||
935 | strlcat(buf, "sendspecialtrigger ", blen); | ||
909 | if (err & INFINIPATH_E_RLONGPKTLEN) | 936 | if (err & INFINIPATH_E_RLONGPKTLEN) |
910 | strlcat(buf, "rlongpktlen ", blen); | 937 | strlcat(buf, "rlongpktlen ", blen); |
911 | if (err & INFINIPATH_E_RMAXPKTLEN) | 938 | if (err & INFINIPATH_E_RMAXPKTLEN) |
@@ -948,6 +975,8 @@ int ipath_decode_err(char *buf, size_t blen, ipath_err_t err) | |||
948 | strlcat(buf, "hardware ", blen); | 975 | strlcat(buf, "hardware ", blen); |
949 | if (err & INFINIPATH_E_RESET) | 976 | if (err & INFINIPATH_E_RESET) |
950 | strlcat(buf, "reset ", blen); | 977 | strlcat(buf, "reset ", blen); |
978 | if (err & INFINIPATH_E_INVALIDEEPCMD) | ||
979 | strlcat(buf, "invalideepromcmd ", blen); | ||
951 | done: | 980 | done: |
952 | return iserr; | 981 | return iserr; |
953 | } | 982 | } |
@@ -1701,6 +1730,10 @@ bail: | |||
1701 | */ | 1730 | */ |
1702 | void ipath_cancel_sends(struct ipath_devdata *dd, int restore_sendctrl) | 1731 | void ipath_cancel_sends(struct ipath_devdata *dd, int restore_sendctrl) |
1703 | { | 1732 | { |
1733 | if (dd->ipath_flags & IPATH_IB_AUTONEG_INPROG) { | ||
1734 | ipath_cdbg(VERBOSE, "Ignore while in autonegotiation\n"); | ||
1735 | goto bail; | ||
1736 | } | ||
1704 | ipath_dbg("Cancelling all in-progress send buffers\n"); | 1737 | ipath_dbg("Cancelling all in-progress send buffers\n"); |
1705 | 1738 | ||
1706 | /* skip armlaunch errs for a while */ | 1739 | /* skip armlaunch errs for a while */ |
@@ -1721,6 +1754,7 @@ void ipath_cancel_sends(struct ipath_devdata *dd, int restore_sendctrl) | |||
1721 | 1754 | ||
1722 | /* and again, be sure all have hit the chip */ | 1755 | /* and again, be sure all have hit the chip */ |
1723 | ipath_read_kreg64(dd, dd->ipath_kregs->kr_scratch); | 1756 | ipath_read_kreg64(dd, dd->ipath_kregs->kr_scratch); |
1757 | bail:; | ||
1724 | } | 1758 | } |
1725 | 1759 | ||
1726 | /* | 1760 | /* |
@@ -2282,6 +2316,7 @@ static int __init infinipath_init(void) | |||
2282 | */ | 2316 | */ |
2283 | idr_init(&unit_table); | 2317 | idr_init(&unit_table); |
2284 | if (!idr_pre_get(&unit_table, GFP_KERNEL)) { | 2318 | if (!idr_pre_get(&unit_table, GFP_KERNEL)) { |
2319 | printk(KERN_ERR IPATH_DRV_NAME ": idr_pre_get() failed\n"); | ||
2285 | ret = -ENOMEM; | 2320 | ret = -ENOMEM; |
2286 | goto bail; | 2321 | goto bail; |
2287 | } | 2322 | } |