aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorArthur Jones <arthur.jones@qlogic.com>2008-04-17 00:09:31 -0400
committerRoland Dreier <rolandd@cisco.com>2008-04-17 00:09:31 -0400
commitbb9171448deb1f7ece27674e2e431e4f267fd453 (patch)
treeb042155205bbbe3deb317d65a53a4180fb512435 /drivers
parent8babfa4fb9bfe93d57c700410a4f8be9fbd3edd7 (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')
-rw-r--r--drivers/infiniband/hw/ipath/ipath_driver.c61
-rw-r--r--drivers/infiniband/hw/ipath/ipath_file_ops.c2
-rw-r--r--drivers/infiniband/hw/ipath/ipath_init_chip.c24
-rw-r--r--drivers/infiniband/hw/ipath/ipath_intr.c11
-rw-r--r--drivers/infiniband/hw/ipath/ipath_kernel.h1
-rw-r--r--drivers/infiniband/hw/ipath/ipath_sysfs.c18
6 files changed, 83 insertions, 34 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");
89MODULE_AUTHOR("QLogic <support@qlogic.com>"); 89MODULE_AUTHOR("QLogic <support@qlogic.com>");
90MODULE_DESCRIPTION("QLogic InfiniPath driver"); 90MODULE_DESCRIPTION("QLogic InfiniPath driver");
91 91
92/*
93 * Table to translate the LINKTRAININGSTATE portion of
94 * IBCStatus to a human-readable form.
95 */
92const char *ipath_ibcstatus_str[] = { 96const 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
111static void __devexit ipath_remove_one(struct pci_dev *); 126static 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);
951done: 980done:
952 return iserr; 981 return iserr;
953} 982}
@@ -1701,6 +1730,10 @@ bail:
1701 */ 1730 */
1702void ipath_cancel_sends(struct ipath_devdata *dd, int restore_sendctrl) 1731void 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);
1757bail:;
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 }
diff --git a/drivers/infiniband/hw/ipath/ipath_file_ops.c b/drivers/infiniband/hw/ipath/ipath_file_ops.c
index eab69dfdc28e..b87d3126e4dc 100644
--- a/drivers/infiniband/hw/ipath/ipath_file_ops.c
+++ b/drivers/infiniband/hw/ipath/ipath_file_ops.c
@@ -2074,7 +2074,7 @@ static int ipath_close(struct inode *in, struct file *fp)
2074 pd->port_rcvnowait = pd->port_pionowait = 0; 2074 pd->port_rcvnowait = pd->port_pionowait = 0;
2075 } 2075 }
2076 if (pd->port_flag) { 2076 if (pd->port_flag) {
2077 ipath_dbg("port %u port_flag still set to 0x%lx\n", 2077 ipath_cdbg(PROC, "port %u port_flag set: 0x%lx\n",
2078 pd->port_port, pd->port_flag); 2078 pd->port_port, pd->port_flag);
2079 pd->port_flag = 0; 2079 pd->port_flag = 0;
2080 } 2080 }
diff --git a/drivers/infiniband/hw/ipath/ipath_init_chip.c b/drivers/infiniband/hw/ipath/ipath_init_chip.c
index 8d8e572baf6e..c012e05649b3 100644
--- a/drivers/infiniband/hw/ipath/ipath_init_chip.c
+++ b/drivers/infiniband/hw/ipath/ipath_init_chip.c
@@ -230,6 +230,15 @@ static int init_chip_first(struct ipath_devdata *dd)
230 int ret = 0; 230 int ret = 0;
231 u64 val; 231 u64 val;
232 232
233 spin_lock_init(&dd->ipath_kernel_tid_lock);
234 spin_lock_init(&dd->ipath_user_tid_lock);
235 spin_lock_init(&dd->ipath_sendctrl_lock);
236 spin_lock_init(&dd->ipath_sdma_lock);
237 spin_lock_init(&dd->ipath_gpio_lock);
238 spin_lock_init(&dd->ipath_eep_st_lock);
239 spin_lock_init(&dd->ipath_sdepb_lock);
240 mutex_init(&dd->ipath_eep_lock);
241
233 /* 242 /*
234 * skip cfgports stuff because we are not allocating memory, 243 * skip cfgports stuff because we are not allocating memory,
235 * and we don't want problems if the portcnt changed due to 244 * and we don't want problems if the portcnt changed due to
@@ -319,12 +328,6 @@ static int init_chip_first(struct ipath_devdata *dd)
319 else ipath_dbg("%u 2k piobufs @ %p\n", 328 else ipath_dbg("%u 2k piobufs @ %p\n",
320 dd->ipath_piobcnt2k, dd->ipath_pio2kbase); 329 dd->ipath_piobcnt2k, dd->ipath_pio2kbase);
321 330
322 spin_lock_init(&dd->ipath_user_tid_lock);
323 spin_lock_init(&dd->ipath_sendctrl_lock);
324 spin_lock_init(&dd->ipath_gpio_lock);
325 spin_lock_init(&dd->ipath_eep_st_lock);
326 mutex_init(&dd->ipath_eep_lock);
327
328done: 331done:
329 return ret; 332 return ret;
330} 333}
@@ -553,7 +556,7 @@ static void enable_chip(struct ipath_devdata *dd, int reinit)
553 556
554static int init_housekeeping(struct ipath_devdata *dd, int reinit) 557static int init_housekeeping(struct ipath_devdata *dd, int reinit)
555{ 558{
556 char boardn[32]; 559 char boardn[40];
557 int ret = 0; 560 int ret = 0;
558 561
559 /* 562 /*
@@ -800,7 +803,12 @@ int ipath_init_chip(struct ipath_devdata *dd, int reinit)
800 dd->ipath_pioupd_thresh = kpiobufs; 803 dd->ipath_pioupd_thresh = kpiobufs;
801 } 804 }
802 805
803 dd->ipath_f_early_init(dd); 806 ret = dd->ipath_f_early_init(dd);
807 if (ret) {
808 ipath_dev_err(dd, "Early initialization failure\n");
809 goto done;
810 }
811
804 /* 812 /*
805 * Cancel any possible active sends from early driver load. 813 * Cancel any possible active sends from early driver load.
806 * Follows early_init because some chips have to initialize 814 * Follows early_init because some chips have to initialize
diff --git a/drivers/infiniband/hw/ipath/ipath_intr.c b/drivers/infiniband/hw/ipath/ipath_intr.c
index 3bad601fcc90..90b972f6a840 100644
--- a/drivers/infiniband/hw/ipath/ipath_intr.c
+++ b/drivers/infiniband/hw/ipath/ipath_intr.c
@@ -73,7 +73,7 @@ static void ipath_clrpiobuf(struct ipath_devdata *dd, u32 pnum)
73 * If rewrite is true, and bits are set in the sendbufferror registers, 73 * If rewrite is true, and bits are set in the sendbufferror registers,
74 * we'll write to the buffer, for error recovery on parity errors. 74 * we'll write to the buffer, for error recovery on parity errors.
75 */ 75 */
76static void ipath_disarm_senderrbufs(struct ipath_devdata *dd, int rewrite) 76void ipath_disarm_senderrbufs(struct ipath_devdata *dd, int rewrite)
77{ 77{
78 u32 piobcnt; 78 u32 piobcnt;
79 unsigned long sbuf[4]; 79 unsigned long sbuf[4];
@@ -87,12 +87,14 @@ static void ipath_disarm_senderrbufs(struct ipath_devdata *dd, int rewrite)
87 dd, dd->ipath_kregs->kr_sendbuffererror); 87 dd, dd->ipath_kregs->kr_sendbuffererror);
88 sbuf[1] = ipath_read_kreg64( 88 sbuf[1] = ipath_read_kreg64(
89 dd, dd->ipath_kregs->kr_sendbuffererror + 1); 89 dd, dd->ipath_kregs->kr_sendbuffererror + 1);
90 if (piobcnt > 128) { 90 if (piobcnt > 128)
91 sbuf[2] = ipath_read_kreg64( 91 sbuf[2] = ipath_read_kreg64(
92 dd, dd->ipath_kregs->kr_sendbuffererror + 2); 92 dd, dd->ipath_kregs->kr_sendbuffererror + 2);
93 if (piobcnt > 192)
93 sbuf[3] = ipath_read_kreg64( 94 sbuf[3] = ipath_read_kreg64(
94 dd, dd->ipath_kregs->kr_sendbuffererror + 3); 95 dd, dd->ipath_kregs->kr_sendbuffererror + 3);
95 } 96 else
97 sbuf[3] = 0;
96 98
97 if (sbuf[0] || sbuf[1] || (piobcnt > 128 && (sbuf[2] || sbuf[3]))) { 99 if (sbuf[0] || sbuf[1] || (piobcnt > 128 && (sbuf[2] || sbuf[3]))) {
98 int i; 100 int i;
@@ -365,7 +367,8 @@ static void handle_e_ibstatuschanged(struct ipath_devdata *dd,
365 */ 367 */
366 if (lastlts == INFINIPATH_IBCS_LT_STATE_POLLACTIVE || 368 if (lastlts == INFINIPATH_IBCS_LT_STATE_POLLACTIVE ||
367 lastlts == INFINIPATH_IBCS_LT_STATE_POLLQUIET) { 369 lastlts == INFINIPATH_IBCS_LT_STATE_POLLQUIET) {
368 if (++dd->ipath_ibpollcnt == 40) { 370 if (!(dd->ipath_flags & IPATH_IB_AUTONEG_INPROG) &&
371 (++dd->ipath_ibpollcnt == 40)) {
369 dd->ipath_flags |= IPATH_NOCABLE; 372 dd->ipath_flags |= IPATH_NOCABLE;
370 *dd->ipath_statusp |= 373 *dd->ipath_statusp |=
371 IPATH_STATUS_IB_NOCABLE; 374 IPATH_STATUS_IB_NOCABLE;
diff --git a/drivers/infiniband/hw/ipath/ipath_kernel.h b/drivers/infiniband/hw/ipath/ipath_kernel.h
index feb4f9dbac77..550d46c1aefb 100644
--- a/drivers/infiniband/hw/ipath/ipath_kernel.h
+++ b/drivers/infiniband/hw/ipath/ipath_kernel.h
@@ -1010,6 +1010,7 @@ void ipath_get_eeprom_info(struct ipath_devdata *);
1010int ipath_update_eeprom_log(struct ipath_devdata *dd); 1010int ipath_update_eeprom_log(struct ipath_devdata *dd);
1011void ipath_inc_eeprom_err(struct ipath_devdata *dd, u32 eidx, u32 incr); 1011void ipath_inc_eeprom_err(struct ipath_devdata *dd, u32 eidx, u32 incr);
1012u64 ipath_snap_cntr(struct ipath_devdata *, ipath_creg); 1012u64 ipath_snap_cntr(struct ipath_devdata *, ipath_creg);
1013void ipath_disarm_senderrbufs(struct ipath_devdata *, int);
1013void ipath_force_pio_avail_update(struct ipath_devdata *); 1014void ipath_force_pio_avail_update(struct ipath_devdata *);
1014void signal_ib_event(struct ipath_devdata *dd, enum ib_event_type ev); 1015void signal_ib_event(struct ipath_devdata *dd, enum ib_event_type ev);
1015 1016
diff --git a/drivers/infiniband/hw/ipath/ipath_sysfs.c b/drivers/infiniband/hw/ipath/ipath_sysfs.c
index 7961d26404f1..2e6d2aab2600 100644
--- a/drivers/infiniband/hw/ipath/ipath_sysfs.c
+++ b/drivers/infiniband/hw/ipath/ipath_sysfs.c
@@ -34,6 +34,7 @@
34#include <linux/ctype.h> 34#include <linux/ctype.h>
35 35
36#include "ipath_kernel.h" 36#include "ipath_kernel.h"
37#include "ipath_verbs.h"
37#include "ipath_common.h" 38#include "ipath_common.h"
38 39
39/** 40/**
@@ -320,6 +321,8 @@ static ssize_t store_guid(struct device *dev,
320 321
321 dd->ipath_guid = new_guid; 322 dd->ipath_guid = new_guid;
322 dd->ipath_nguid = 1; 323 dd->ipath_nguid = 1;
324 if (dd->verbs_dev)
325 dd->verbs_dev->ibdev.node_guid = new_guid;
323 326
324 ret = strlen(buf); 327 ret = strlen(buf);
325 goto bail; 328 goto bail;
@@ -928,18 +931,17 @@ static ssize_t store_rx_polinv_enb(struct device *dev,
928 u16 val; 931 u16 val;
929 932
930 ret = ipath_parse_ushort(buf, &val); 933 ret = ipath_parse_ushort(buf, &val);
931 if (ret < 0 || val > 1) 934 if (ret >= 0 && val > 1) {
932 goto invalid; 935 ipath_dev_err(dd,
936 "attempt to set invalid Rx Polarity (enable)\n");
937 ret = -EINVAL;
938 goto bail;
939 }
933 940
934 r = dd->ipath_f_set_ib_cfg(dd, IPATH_IB_CFG_RXPOL_ENB, val); 941 r = dd->ipath_f_set_ib_cfg(dd, IPATH_IB_CFG_RXPOL_ENB, val);
935 if (r < 0) { 942 if (r < 0)
936 ret = r; 943 ret = r;
937 goto bail;
938 }
939 944
940 goto bail;
941invalid:
942 ipath_dev_err(dd, "attempt to set invalid Rx Polarity (enable)\n");
943bail: 945bail:
944 return ret; 946 return ret;
945} 947}