aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRalph Campbell <ralph.campbell@qlogic.com>2008-04-17 00:09:30 -0400
committerRoland Dreier <rolandd@cisco.com>2008-04-17 00:09:30 -0400
commitafce688ba968723a9e281b141bf7b0ab43a36968 (patch)
treef8e2999000a3be7a34bc307f2b8c4471ee2e3dad
parent6bb68835d3eb72cd490056fda75d95493c31461b (diff)
IB/ipath: Header file changes to support IBA7220
This is part of a patch series to add support for a new HCA. This patch adds new fields to the header files. Signed-off-by: Ralph Campbell <ralph.campbell@qlogic.com> Signed-off-by: Roland Dreier <rolandd@cisco.com>
-rw-r--r--drivers/infiniband/hw/ipath/ipath_common.h3
-rw-r--r--drivers/infiniband/hw/ipath/ipath_kernel.h165
-rw-r--r--drivers/infiniband/hw/ipath/ipath_registers.h138
-rw-r--r--drivers/infiniband/hw/ipath/ipath_verbs.h30
4 files changed, 282 insertions, 54 deletions
diff --git a/drivers/infiniband/hw/ipath/ipath_common.h b/drivers/infiniband/hw/ipath/ipath_common.h
index 3c05d4be34fd..02fd310d1ef4 100644
--- a/drivers/infiniband/hw/ipath/ipath_common.h
+++ b/drivers/infiniband/hw/ipath/ipath_common.h
@@ -201,6 +201,7 @@ typedef enum _ipath_ureg {
201#define IPATH_RUNTIME_RCVHDR_COPY 0x8 201#define IPATH_RUNTIME_RCVHDR_COPY 0x8
202#define IPATH_RUNTIME_MASTER 0x10 202#define IPATH_RUNTIME_MASTER 0x10
203#define IPATH_RUNTIME_NODMA_RTAIL 0x80 203#define IPATH_RUNTIME_NODMA_RTAIL 0x80
204#define IPATH_RUNTIME_SDMA 0x200
204#define IPATH_RUNTIME_FORCE_PIOAVAIL 0x400 205#define IPATH_RUNTIME_FORCE_PIOAVAIL 0x400
205#define IPATH_RUNTIME_PIO_REGSWAPPED 0x800 206#define IPATH_RUNTIME_PIO_REGSWAPPED 0x800
206 207
@@ -539,7 +540,7 @@ struct ipath_diag_pkt {
539 540
540/* The second diag_pkt struct is the expanded version that allows 541/* The second diag_pkt struct is the expanded version that allows
541 * more control over the packet, specifically, by allowing a custom 542 * more control over the packet, specifically, by allowing a custom
542 * pbc (+ extra) qword, so that special modes and deliberate 543 * pbc (+ static rate) qword, so that special modes and deliberate
543 * changes to CRCs can be used. The elements were also re-ordered 544 * changes to CRCs can be used. The elements were also re-ordered
544 * for better alignment and to avoid padding issues. 545 * for better alignment and to avoid padding issues.
545 */ 546 */
diff --git a/drivers/infiniband/hw/ipath/ipath_kernel.h b/drivers/infiniband/hw/ipath/ipath_kernel.h
index 890599621098..feb4f9dbac77 100644
--- a/drivers/infiniband/hw/ipath/ipath_kernel.h
+++ b/drivers/infiniband/hw/ipath/ipath_kernel.h
@@ -42,6 +42,8 @@
42#include <linux/pci.h> 42#include <linux/pci.h>
43#include <linux/dma-mapping.h> 43#include <linux/dma-mapping.h>
44#include <linux/mutex.h> 44#include <linux/mutex.h>
45#include <linux/list.h>
46#include <linux/scatterlist.h>
45#include <asm/io.h> 47#include <asm/io.h>
46#include <rdma/ib_verbs.h> 48#include <rdma/ib_verbs.h>
47 49
@@ -180,6 +182,8 @@ struct ipath_portdata {
180}; 182};
181 183
182struct sk_buff; 184struct sk_buff;
185struct ipath_sge_state;
186struct ipath_verbs_txreq;
183 187
184/* 188/*
185 * control information for layered drivers 189 * control information for layered drivers
@@ -193,6 +197,37 @@ struct ipath_skbinfo {
193 dma_addr_t phys; 197 dma_addr_t phys;
194}; 198};
195 199
200struct ipath_sdma_txreq {
201 int flags;
202 int sg_count;
203 union {
204 struct scatterlist *sg;
205 void *map_addr;
206 };
207 void (*callback)(void *, int);
208 void *callback_cookie;
209 int callback_status;
210 u16 start_idx; /* sdma private */
211 u16 next_descq_idx; /* sdma private */
212 struct list_head list; /* sdma private */
213};
214
215struct ipath_sdma_desc {
216 __le64 qw[2];
217};
218
219#define IPATH_SDMA_TXREQ_F_USELARGEBUF 0x1
220#define IPATH_SDMA_TXREQ_F_HEADTOHOST 0x2
221#define IPATH_SDMA_TXREQ_F_INTREQ 0x4
222#define IPATH_SDMA_TXREQ_F_FREEBUF 0x8
223#define IPATH_SDMA_TXREQ_F_FREEDESC 0x10
224#define IPATH_SDMA_TXREQ_F_VL15 0x20
225
226#define IPATH_SDMA_TXREQ_S_OK 0
227#define IPATH_SDMA_TXREQ_S_SENDERROR 1
228#define IPATH_SDMA_TXREQ_S_ABORTED 2
229#define IPATH_SDMA_TXREQ_S_SHUTDOWN 3
230
196/* max dwords in small buffer packet */ 231/* max dwords in small buffer packet */
197#define IPATH_SMALLBUF_DWORDS (dd->ipath_piosize2k >> 2) 232#define IPATH_SMALLBUF_DWORDS (dd->ipath_piosize2k >> 2)
198 233
@@ -385,6 +420,15 @@ struct ipath_devdata {
385 u32 ipath_pcibar0; 420 u32 ipath_pcibar0;
386 /* so we can rewrite it after a chip reset */ 421 /* so we can rewrite it after a chip reset */
387 u32 ipath_pcibar1; 422 u32 ipath_pcibar1;
423 u32 ipath_x1_fix_tries;
424 u32 ipath_autoneg_tries;
425 u32 serdes_first_init_done;
426
427 struct ipath_relock {
428 atomic_t ipath_relock_timer_active;
429 struct timer_list ipath_relock_timer;
430 unsigned int ipath_relock_interval; /* in jiffies */
431 } ipath_relock_singleton;
388 432
389 /* interrupt number */ 433 /* interrupt number */
390 int ipath_irq; 434 int ipath_irq;
@@ -431,8 +475,38 @@ struct ipath_devdata {
431 void *ipath_dummy_hdrq; /* used after port close */ 475 void *ipath_dummy_hdrq; /* used after port close */
432 dma_addr_t ipath_dummy_hdrq_phys; 476 dma_addr_t ipath_dummy_hdrq_phys;
433 477
478 /* SendDMA related entries */
479 spinlock_t ipath_sdma_lock;
480 u64 ipath_sdma_status;
481 unsigned long ipath_sdma_abort_jiffies;
482 unsigned long ipath_sdma_abort_intr_timeout;
483 unsigned long ipath_sdma_buf_jiffies;
484 struct ipath_sdma_desc *ipath_sdma_descq;
485 u64 ipath_sdma_descq_added;
486 u64 ipath_sdma_descq_removed;
487 int ipath_sdma_desc_nreserved;
488 u16 ipath_sdma_descq_cnt;
489 u16 ipath_sdma_descq_tail;
490 u16 ipath_sdma_descq_head;
491 u16 ipath_sdma_next_intr;
492 u16 ipath_sdma_reset_wait;
493 u8 ipath_sdma_generation;
494 struct tasklet_struct ipath_sdma_abort_task;
495 struct tasklet_struct ipath_sdma_notify_task;
496 struct list_head ipath_sdma_activelist;
497 struct list_head ipath_sdma_notifylist;
498 atomic_t ipath_sdma_vl15_count;
499 struct timer_list ipath_sdma_vl15_timer;
500
501 dma_addr_t ipath_sdma_descq_phys;
502 volatile __le64 *ipath_sdma_head_dma;
503 dma_addr_t ipath_sdma_head_phys;
504
434 unsigned long ipath_ureg_align; /* user register alignment */ 505 unsigned long ipath_ureg_align; /* user register alignment */
435 506
507 struct delayed_work ipath_autoneg_work;
508 wait_queue_head_t ipath_autoneg_wait;
509
436 /* HoL blocking / user app forward-progress state */ 510 /* HoL blocking / user app forward-progress state */
437 unsigned ipath_hol_state; 511 unsigned ipath_hol_state;
438 unsigned ipath_hol_next; 512 unsigned ipath_hol_next;
@@ -485,6 +559,8 @@ struct ipath_devdata {
485 u64 ipath_intconfig; 559 u64 ipath_intconfig;
486 /* kr_sendpiobufbase value */ 560 /* kr_sendpiobufbase value */
487 u64 ipath_piobufbase; 561 u64 ipath_piobufbase;
562 /* kr_ibcddrctrl shadow */
563 u64 ipath_ibcddrctrl;
488 564
489 /* these are the "32 bit" regs */ 565 /* these are the "32 bit" regs */
490 566
@@ -501,7 +577,10 @@ struct ipath_devdata {
501 unsigned long ipath_rcvctrl; 577 unsigned long ipath_rcvctrl;
502 /* shadow kr_sendctrl */ 578 /* shadow kr_sendctrl */
503 unsigned long ipath_sendctrl; 579 unsigned long ipath_sendctrl;
504 unsigned long ipath_lastcancel; /* to not count armlaunch after cancel */ 580 /* to not count armlaunch after cancel */
581 unsigned long ipath_lastcancel;
582 /* count cases where special trigger was needed (double write) */
583 unsigned long ipath_spectriggerhit;
505 584
506 /* value we put in kr_rcvhdrcnt */ 585 /* value we put in kr_rcvhdrcnt */
507 u32 ipath_rcvhdrcnt; 586 u32 ipath_rcvhdrcnt;
@@ -523,6 +602,7 @@ struct ipath_devdata {
523 u32 ipath_piobcnt4k; 602 u32 ipath_piobcnt4k;
524 /* size in bytes of "4KB" PIO buffers */ 603 /* size in bytes of "4KB" PIO buffers */
525 u32 ipath_piosize4k; 604 u32 ipath_piosize4k;
605 u32 ipath_pioreserved; /* reserved special-inkernel; */
526 /* kr_rcvegrbase value */ 606 /* kr_rcvegrbase value */
527 u32 ipath_rcvegrbase; 607 u32 ipath_rcvegrbase;
528 /* kr_rcvegrcnt value */ 608 /* kr_rcvegrcnt value */
@@ -586,7 +666,7 @@ struct ipath_devdata {
586 */ 666 */
587 u8 ipath_serial[16]; 667 u8 ipath_serial[16];
588 /* human readable board version */ 668 /* human readable board version */
589 u8 ipath_boardversion[80]; 669 u8 ipath_boardversion[96];
590 u8 ipath_lbus_info[32]; /* human readable localbus info */ 670 u8 ipath_lbus_info[32]; /* human readable localbus info */
591 /* chip major rev, from ipath_revision */ 671 /* chip major rev, from ipath_revision */
592 u8 ipath_majrev; 672 u8 ipath_majrev;
@@ -715,6 +795,13 @@ struct ipath_devdata {
715 /* interrupt mitigation reload register info */ 795 /* interrupt mitigation reload register info */
716 u16 ipath_jint_idle_ticks; /* idle clock ticks */ 796 u16 ipath_jint_idle_ticks; /* idle clock ticks */
717 u16 ipath_jint_max_packets; /* max packets across all ports */ 797 u16 ipath_jint_max_packets; /* max packets across all ports */
798
799 /*
800 * lock for access to SerDes, and flags to sequence preset
801 * versus steady-state. 7220-only at the moment.
802 */
803 spinlock_t ipath_sdepb_lock;
804 u8 ipath_presets_needed; /* Set if presets to be restored next DOWN */
718}; 805};
719 806
720/* ipath_hol_state values (stopping/starting user proc, send flushing) */ 807/* ipath_hol_state values (stopping/starting user proc, send flushing) */
@@ -724,11 +811,35 @@ struct ipath_devdata {
724#define IPATH_HOL_DOWNSTOP 0 811#define IPATH_HOL_DOWNSTOP 0
725#define IPATH_HOL_DOWNCONT 1 812#define IPATH_HOL_DOWNCONT 1
726 813
814/* bit positions for sdma_status */
815#define IPATH_SDMA_ABORTING 0
816#define IPATH_SDMA_DISARMED 1
817#define IPATH_SDMA_DISABLED 2
818#define IPATH_SDMA_LAYERBUF 3
819#define IPATH_SDMA_RUNNING 62
820#define IPATH_SDMA_SHUTDOWN 63
821
822/* bit combinations that correspond to abort states */
823#define IPATH_SDMA_ABORT_NONE 0
824#define IPATH_SDMA_ABORT_ABORTING (1UL << IPATH_SDMA_ABORTING)
825#define IPATH_SDMA_ABORT_DISARMED ((1UL << IPATH_SDMA_ABORTING) | \
826 (1UL << IPATH_SDMA_DISARMED))
827#define IPATH_SDMA_ABORT_DISABLED ((1UL << IPATH_SDMA_ABORTING) | \
828 (1UL << IPATH_SDMA_DISABLED))
829#define IPATH_SDMA_ABORT_ABORTED ((1UL << IPATH_SDMA_ABORTING) | \
830 (1UL << IPATH_SDMA_DISARMED) | (1UL << IPATH_SDMA_DISABLED))
831#define IPATH_SDMA_ABORT_MASK ((1UL<<IPATH_SDMA_ABORTING) | \
832 (1UL << IPATH_SDMA_DISARMED) | (1UL << IPATH_SDMA_DISABLED))
833
834#define IPATH_SDMA_BUF_NONE 0
835#define IPATH_SDMA_BUF_MASK (1UL<<IPATH_SDMA_LAYERBUF)
836
727/* Private data for file operations */ 837/* Private data for file operations */
728struct ipath_filedata { 838struct ipath_filedata {
729 struct ipath_portdata *pd; 839 struct ipath_portdata *pd;
730 unsigned subport; 840 unsigned subport;
731 unsigned tidcursor; 841 unsigned tidcursor;
842 struct ipath_user_sdma_queue *pq;
732}; 843};
733extern struct list_head ipath_dev_list; 844extern struct list_head ipath_dev_list;
734extern spinlock_t ipath_devs_lock; 845extern spinlock_t ipath_devs_lock;
@@ -796,6 +907,10 @@ void ipath_disable_armlaunch(struct ipath_devdata *);
796void ipath_hol_down(struct ipath_devdata *); 907void ipath_hol_down(struct ipath_devdata *);
797void ipath_hol_up(struct ipath_devdata *); 908void ipath_hol_up(struct ipath_devdata *);
798void ipath_hol_event(unsigned long); 909void ipath_hol_event(unsigned long);
910void ipath_toggle_rclkrls(struct ipath_devdata *);
911void ipath_sd7220_clr_ibpar(struct ipath_devdata *);
912void ipath_set_relock_poll(struct ipath_devdata *, int);
913void ipath_shutdown_relock_poll(struct ipath_devdata *);
799 914
800/* for use in system calls, where we want to know device type, etc. */ 915/* for use in system calls, where we want to know device type, etc. */
801#define port_fp(fp) ((struct ipath_filedata *)(fp)->private_data)->pd 916#define port_fp(fp) ((struct ipath_filedata *)(fp)->private_data)->pd
@@ -803,6 +918,8 @@ void ipath_hol_event(unsigned long);
803 ((struct ipath_filedata *)(fp)->private_data)->subport 918 ((struct ipath_filedata *)(fp)->private_data)->subport
804#define tidcursor_fp(fp) \ 919#define tidcursor_fp(fp) \
805 ((struct ipath_filedata *)(fp)->private_data)->tidcursor 920 ((struct ipath_filedata *)(fp)->private_data)->tidcursor
921#define user_sdma_queue_fp(fp) \
922 ((struct ipath_filedata *)(fp)->private_data)->pq
806 923
807/* 924/*
808 * values for ipath_flags 925 * values for ipath_flags
@@ -852,9 +969,16 @@ void ipath_hol_event(unsigned long);
852 /* Use GPIO interrupts for new counters */ 969 /* Use GPIO interrupts for new counters */
853#define IPATH_GPIO_ERRINTRS 0x100000 970#define IPATH_GPIO_ERRINTRS 0x100000
854#define IPATH_SWAP_PIOBUFS 0x200000 971#define IPATH_SWAP_PIOBUFS 0x200000
972 /* Supports Send DMA */
973#define IPATH_HAS_SEND_DMA 0x400000
974 /* Supports Send Count (not just word count) in PBC */
975#define IPATH_HAS_PBC_CNT 0x800000
855 /* Suppress heartbeat, even if turning off loopback */ 976 /* Suppress heartbeat, even if turning off loopback */
856#define IPATH_NO_HRTBT 0x1000000 977#define IPATH_NO_HRTBT 0x1000000
978#define IPATH_HAS_THRESH_UPDATE 0x4000000
857#define IPATH_HAS_MULT_IB_SPEED 0x8000000 979#define IPATH_HAS_MULT_IB_SPEED 0x8000000
980#define IPATH_IB_AUTONEG_INPROG 0x10000000
981#define IPATH_IB_AUTONEG_FAILED 0x20000000
858 /* Linkdown-disable intentionally, Do not attempt to bring up */ 982 /* Linkdown-disable intentionally, Do not attempt to bring up */
859#define IPATH_IB_LINK_DISABLED 0x40000000 983#define IPATH_IB_LINK_DISABLED 0x40000000
860#define IPATH_IB_FORCE_NOTIFY 0x80000000 /* force notify on next ib change */ 984#define IPATH_IB_FORCE_NOTIFY 0x80000000 /* force notify on next ib change */
@@ -879,6 +1003,7 @@ void ipath_free_data(struct ipath_portdata *dd);
879u32 __iomem *ipath_getpiobuf(struct ipath_devdata *, u32, u32 *); 1003u32 __iomem *ipath_getpiobuf(struct ipath_devdata *, u32, u32 *);
880void ipath_chg_pioavailkernel(struct ipath_devdata *dd, unsigned start, 1004void ipath_chg_pioavailkernel(struct ipath_devdata *dd, unsigned start,
881 unsigned len, int avail); 1005 unsigned len, int avail);
1006void ipath_init_iba7220_funcs(struct ipath_devdata *);
882void ipath_init_iba6120_funcs(struct ipath_devdata *); 1007void ipath_init_iba6120_funcs(struct ipath_devdata *);
883void ipath_init_iba6110_funcs(struct ipath_devdata *); 1008void ipath_init_iba6110_funcs(struct ipath_devdata *);
884void ipath_get_eeprom_info(struct ipath_devdata *); 1009void ipath_get_eeprom_info(struct ipath_devdata *);
@@ -897,6 +1022,33 @@ void signal_ib_event(struct ipath_devdata *dd, enum ib_event_type ev);
897#define IPATH_LED_LOG 2 /* Logical (link) YELLOW LED */ 1022#define IPATH_LED_LOG 2 /* Logical (link) YELLOW LED */
898void ipath_set_led_override(struct ipath_devdata *dd, unsigned int val); 1023void ipath_set_led_override(struct ipath_devdata *dd, unsigned int val);
899 1024
1025/* send dma routines */
1026int setup_sdma(struct ipath_devdata *);
1027void teardown_sdma(struct ipath_devdata *);
1028void ipath_sdma_intr(struct ipath_devdata *);
1029int ipath_sdma_verbs_send(struct ipath_devdata *, struct ipath_sge_state *,
1030 u32, struct ipath_verbs_txreq *);
1031/* ipath_sdma_lock should be locked before calling this. */
1032int ipath_sdma_make_progress(struct ipath_devdata *dd);
1033
1034/* must be called under ipath_sdma_lock */
1035static inline u16 ipath_sdma_descq_freecnt(const struct ipath_devdata *dd)
1036{
1037 return dd->ipath_sdma_descq_cnt -
1038 (dd->ipath_sdma_descq_added - dd->ipath_sdma_descq_removed) -
1039 1 - dd->ipath_sdma_desc_nreserved;
1040}
1041
1042static inline void ipath_sdma_desc_reserve(struct ipath_devdata *dd, u16 cnt)
1043{
1044 dd->ipath_sdma_desc_nreserved += cnt;
1045}
1046
1047static inline void ipath_sdma_desc_unreserve(struct ipath_devdata *dd, u16 cnt)
1048{
1049 dd->ipath_sdma_desc_nreserved -= cnt;
1050}
1051
900/* 1052/*
901 * number of words used for protocol header if not set by ipath_userinit(); 1053 * number of words used for protocol header if not set by ipath_userinit();
902 */ 1054 */
@@ -925,8 +1077,7 @@ void ipath_write_kreg_port(const struct ipath_devdata *, ipath_kreg,
925 1077
926/* 1078/*
927 * At the moment, none of the s-registers are writable, so no 1079 * At the moment, none of the s-registers are writable, so no
928 * ipath_write_sreg(), and none of the c-registers are writable, so no 1080 * ipath_write_sreg().
929 * ipath_write_creg().
930 */ 1081 */
931 1082
932/** 1083/**
@@ -1123,6 +1274,7 @@ int ipathfs_remove_device(struct ipath_devdata *);
1123dma_addr_t ipath_map_page(struct pci_dev *, struct page *, unsigned long, 1274dma_addr_t ipath_map_page(struct pci_dev *, struct page *, unsigned long,
1124 size_t, int); 1275 size_t, int);
1125dma_addr_t ipath_map_single(struct pci_dev *, void *, size_t, int); 1276dma_addr_t ipath_map_single(struct pci_dev *, void *, size_t, int);
1277const char *ipath_get_unit_name(int unit);
1126 1278
1127/* 1279/*
1128 * Flush write combining store buffers (if present) and perform a write 1280 * Flush write combining store buffers (if present) and perform a write
@@ -1137,11 +1289,6 @@ dma_addr_t ipath_map_single(struct pci_dev *, void *, size_t, int);
1137extern unsigned ipath_debug; /* debugging bit mask */ 1289extern unsigned ipath_debug; /* debugging bit mask */
1138extern unsigned ipath_linkrecovery; 1290extern unsigned ipath_linkrecovery;
1139extern unsigned ipath_mtu4096; 1291extern unsigned ipath_mtu4096;
1140
1141#define IPATH_MAX_PARITY_ATTEMPTS 10000 /* max times to try recovery */
1142
1143const char *ipath_get_unit_name(int unit);
1144
1145extern struct mutex ipath_mutex; 1292extern struct mutex ipath_mutex;
1146 1293
1147#define IPATH_DRV_NAME "ib_ipath" 1294#define IPATH_DRV_NAME "ib_ipath"
diff --git a/drivers/infiniband/hw/ipath/ipath_registers.h b/drivers/infiniband/hw/ipath/ipath_registers.h
index b7d87d3252e2..8f44d0cf3833 100644
--- a/drivers/infiniband/hw/ipath/ipath_registers.h
+++ b/drivers/infiniband/hw/ipath/ipath_registers.h
@@ -73,56 +73,82 @@
73#define IPATH_S_PIOINTBUFAVAIL 1 73#define IPATH_S_PIOINTBUFAVAIL 1
74#define IPATH_S_PIOBUFAVAILUPD 2 74#define IPATH_S_PIOBUFAVAILUPD 2
75#define IPATH_S_PIOENABLE 3 75#define IPATH_S_PIOENABLE 3
76#define IPATH_S_SDMAINTENABLE 9
77#define IPATH_S_SDMASINGLEDESCRIPTOR 10
78#define IPATH_S_SDMAENABLE 11
79#define IPATH_S_SDMAHALT 12
76#define IPATH_S_DISARM 31 80#define IPATH_S_DISARM 31
77 81
78#define INFINIPATH_S_ABORT (1U << IPATH_S_ABORT) 82#define INFINIPATH_S_ABORT (1U << IPATH_S_ABORT)
79#define INFINIPATH_S_PIOINTBUFAVAIL (1U << IPATH_S_PIOINTBUFAVAIL) 83#define INFINIPATH_S_PIOINTBUFAVAIL (1U << IPATH_S_PIOINTBUFAVAIL)
80#define INFINIPATH_S_PIOBUFAVAILUPD (1U << IPATH_S_PIOBUFAVAILUPD) 84#define INFINIPATH_S_PIOBUFAVAILUPD (1U << IPATH_S_PIOBUFAVAILUPD)
81#define INFINIPATH_S_PIOENABLE (1U << IPATH_S_PIOENABLE) 85#define INFINIPATH_S_PIOENABLE (1U << IPATH_S_PIOENABLE)
86#define INFINIPATH_S_SDMAINTENABLE (1U << IPATH_S_SDMAINTENABLE)
87#define INFINIPATH_S_SDMASINGLEDESCRIPTOR \
88 (1U << IPATH_S_SDMASINGLEDESCRIPTOR)
89#define INFINIPATH_S_SDMAENABLE (1U << IPATH_S_SDMAENABLE)
90#define INFINIPATH_S_SDMAHALT (1U << IPATH_S_SDMAHALT)
82#define INFINIPATH_S_DISARM (1U << IPATH_S_DISARM) 91#define INFINIPATH_S_DISARM (1U << IPATH_S_DISARM)
83 92
84/* kr_rcvctrl bits */ 93/* kr_rcvctrl bits that are the same on multiple chips */
85#define INFINIPATH_R_PORTENABLE_SHIFT 0 94#define INFINIPATH_R_PORTENABLE_SHIFT 0
86#define INFINIPATH_R_QPMAP_ENABLE (1ULL << 38) 95#define INFINIPATH_R_QPMAP_ENABLE (1ULL << 38)
87 96
88/* kr_intstatus, kr_intclear, kr_intmask bits */ 97/* kr_intstatus, kr_intclear, kr_intmask bits */
89#define INFINIPATH_I_ERROR 0x80000000 98#define INFINIPATH_I_SDMAINT 0x8000000000000000ULL
90#define INFINIPATH_I_SPIOSENT 0x40000000 99#define INFINIPATH_I_SDMADISABLED 0x4000000000000000ULL
91#define INFINIPATH_I_SPIOBUFAVAIL 0x20000000 100#define INFINIPATH_I_ERROR 0x0000000080000000ULL
92#define INFINIPATH_I_GPIO 0x10000000 101#define INFINIPATH_I_SPIOSENT 0x0000000040000000ULL
102#define INFINIPATH_I_SPIOBUFAVAIL 0x0000000020000000ULL
103#define INFINIPATH_I_GPIO 0x0000000010000000ULL
104#define INFINIPATH_I_JINT 0x0000000004000000ULL
93 105
94/* kr_errorstatus, kr_errorclear, kr_errormask bits */ 106/* kr_errorstatus, kr_errorclear, kr_errormask bits */
95#define INFINIPATH_E_RFORMATERR 0x0000000000000001ULL 107#define INFINIPATH_E_RFORMATERR 0x0000000000000001ULL
96#define INFINIPATH_E_RVCRC 0x0000000000000002ULL 108#define INFINIPATH_E_RVCRC 0x0000000000000002ULL
97#define INFINIPATH_E_RICRC 0x0000000000000004ULL 109#define INFINIPATH_E_RICRC 0x0000000000000004ULL
98#define INFINIPATH_E_RMINPKTLEN 0x0000000000000008ULL 110#define INFINIPATH_E_RMINPKTLEN 0x0000000000000008ULL
99#define INFINIPATH_E_RMAXPKTLEN 0x0000000000000010ULL 111#define INFINIPATH_E_RMAXPKTLEN 0x0000000000000010ULL
100#define INFINIPATH_E_RLONGPKTLEN 0x0000000000000020ULL 112#define INFINIPATH_E_RLONGPKTLEN 0x0000000000000020ULL
101#define INFINIPATH_E_RSHORTPKTLEN 0x0000000000000040ULL 113#define INFINIPATH_E_RSHORTPKTLEN 0x0000000000000040ULL
102#define INFINIPATH_E_RUNEXPCHAR 0x0000000000000080ULL 114#define INFINIPATH_E_RUNEXPCHAR 0x0000000000000080ULL
103#define INFINIPATH_E_RUNSUPVL 0x0000000000000100ULL 115#define INFINIPATH_E_RUNSUPVL 0x0000000000000100ULL
104#define INFINIPATH_E_REBP 0x0000000000000200ULL 116#define INFINIPATH_E_REBP 0x0000000000000200ULL
105#define INFINIPATH_E_RIBFLOW 0x0000000000000400ULL 117#define INFINIPATH_E_RIBFLOW 0x0000000000000400ULL
106#define INFINIPATH_E_RBADVERSION 0x0000000000000800ULL 118#define INFINIPATH_E_RBADVERSION 0x0000000000000800ULL
107#define INFINIPATH_E_RRCVEGRFULL 0x0000000000001000ULL 119#define INFINIPATH_E_RRCVEGRFULL 0x0000000000001000ULL
108#define INFINIPATH_E_RRCVHDRFULL 0x0000000000002000ULL 120#define INFINIPATH_E_RRCVHDRFULL 0x0000000000002000ULL
109#define INFINIPATH_E_RBADTID 0x0000000000004000ULL 121#define INFINIPATH_E_RBADTID 0x0000000000004000ULL
110#define INFINIPATH_E_RHDRLEN 0x0000000000008000ULL 122#define INFINIPATH_E_RHDRLEN 0x0000000000008000ULL
111#define INFINIPATH_E_RHDR 0x0000000000010000ULL 123#define INFINIPATH_E_RHDR 0x0000000000010000ULL
112#define INFINIPATH_E_RIBLOSTLINK 0x0000000000020000ULL 124#define INFINIPATH_E_RIBLOSTLINK 0x0000000000020000ULL
113#define INFINIPATH_E_SMINPKTLEN 0x0000000020000000ULL 125#define INFINIPATH_E_SENDSPECIALTRIGGER 0x0000000008000000ULL
114#define INFINIPATH_E_SMAXPKTLEN 0x0000000040000000ULL 126#define INFINIPATH_E_SDMADISABLED 0x0000000010000000ULL
115#define INFINIPATH_E_SUNDERRUN 0x0000000080000000ULL 127#define INFINIPATH_E_SMINPKTLEN 0x0000000020000000ULL
116#define INFINIPATH_E_SPKTLEN 0x0000000100000000ULL 128#define INFINIPATH_E_SMAXPKTLEN 0x0000000040000000ULL
117#define INFINIPATH_E_SDROPPEDSMPPKT 0x0000000200000000ULL 129#define INFINIPATH_E_SUNDERRUN 0x0000000080000000ULL
118#define INFINIPATH_E_SDROPPEDDATAPKT 0x0000000400000000ULL 130#define INFINIPATH_E_SPKTLEN 0x0000000100000000ULL
119#define INFINIPATH_E_SPIOARMLAUNCH 0x0000000800000000ULL 131#define INFINIPATH_E_SDROPPEDSMPPKT 0x0000000200000000ULL
120#define INFINIPATH_E_SUNEXPERRPKTNUM 0x0000001000000000ULL 132#define INFINIPATH_E_SDROPPEDDATAPKT 0x0000000400000000ULL
121#define INFINIPATH_E_SUNSUPVL 0x0000002000000000ULL 133#define INFINIPATH_E_SPIOARMLAUNCH 0x0000000800000000ULL
122#define INFINIPATH_E_IBSTATUSCHANGED 0x0001000000000000ULL 134#define INFINIPATH_E_SUNEXPERRPKTNUM 0x0000001000000000ULL
123#define INFINIPATH_E_INVALIDADDR 0x0002000000000000ULL 135#define INFINIPATH_E_SUNSUPVL 0x0000002000000000ULL
124#define INFINIPATH_E_RESET 0x0004000000000000ULL 136#define INFINIPATH_E_SENDBUFMISUSE 0x0000004000000000ULL
125#define INFINIPATH_E_HARDWARE 0x0008000000000000ULL 137#define INFINIPATH_E_SDMAGENMISMATCH 0x0000008000000000ULL
138#define INFINIPATH_E_SDMAOUTOFBOUND 0x0000010000000000ULL
139#define INFINIPATH_E_SDMATAILOUTOFBOUND 0x0000020000000000ULL
140#define INFINIPATH_E_SDMABASE 0x0000040000000000ULL
141#define INFINIPATH_E_SDMA1STDESC 0x0000080000000000ULL
142#define INFINIPATH_E_SDMARPYTAG 0x0000100000000000ULL
143#define INFINIPATH_E_SDMADWEN 0x0000200000000000ULL
144#define INFINIPATH_E_SDMAMISSINGDW 0x0000400000000000ULL
145#define INFINIPATH_E_SDMAUNEXPDATA 0x0000800000000000ULL
146#define INFINIPATH_E_IBSTATUSCHANGED 0x0001000000000000ULL
147#define INFINIPATH_E_INVALIDADDR 0x0002000000000000ULL
148#define INFINIPATH_E_RESET 0x0004000000000000ULL
149#define INFINIPATH_E_HARDWARE 0x0008000000000000ULL
150#define INFINIPATH_E_SDMADESCADDRMISALIGN 0x0010000000000000ULL
151#define INFINIPATH_E_INVALIDEEPCMD 0x0020000000000000ULL
126 152
127/* 153/*
128 * this is used to print "common" packet errors only when the 154 * this is used to print "common" packet errors only when the
@@ -133,6 +159,17 @@
133 | INFINIPATH_E_RICRC | INFINIPATH_E_RSHORTPKTLEN \ 159 | INFINIPATH_E_RICRC | INFINIPATH_E_RSHORTPKTLEN \
134 | INFINIPATH_E_REBP ) 160 | INFINIPATH_E_REBP )
135 161
162/* Convenience for decoding Send DMA errors */
163#define INFINIPATH_E_SDMAERRS ( \
164 INFINIPATH_E_SDMAGENMISMATCH | INFINIPATH_E_SDMAOUTOFBOUND | \
165 INFINIPATH_E_SDMATAILOUTOFBOUND | INFINIPATH_E_SDMABASE | \
166 INFINIPATH_E_SDMA1STDESC | INFINIPATH_E_SDMARPYTAG | \
167 INFINIPATH_E_SDMADWEN | INFINIPATH_E_SDMAMISSINGDW | \
168 INFINIPATH_E_SDMAUNEXPDATA | \
169 INFINIPATH_E_SDMADESCADDRMISALIGN | \
170 INFINIPATH_E_SDMADISABLED | \
171 INFINIPATH_E_SENDBUFMISUSE)
172
136/* kr_hwerrclear, kr_hwerrmask, kr_hwerrstatus, bits */ 173/* kr_hwerrclear, kr_hwerrmask, kr_hwerrstatus, bits */
137/* TXEMEMPARITYERR bit 0: PIObuf, 1: PIOpbc, 2: launchfifo 174/* TXEMEMPARITYERR bit 0: PIObuf, 1: PIOpbc, 2: launchfifo
138 * RXEMEMPARITYERR bit 0: rcvbuf, 1: lookupq, 2: expTID, 3: eagerTID 175 * RXEMEMPARITYERR bit 0: rcvbuf, 1: lookupq, 2: expTID, 3: eagerTID
@@ -157,7 +194,7 @@
157#define INFINIPATH_HWE_RXEMEMPARITYERR_HDRINFO 0x40ULL 194#define INFINIPATH_HWE_RXEMEMPARITYERR_HDRINFO 0x40ULL
158/* waldo specific -- find the rest in ipath_6110.c */ 195/* waldo specific -- find the rest in ipath_6110.c */
159#define INFINIPATH_HWE_RXDSYNCMEMPARITYERR 0x0000000400000000ULL 196#define INFINIPATH_HWE_RXDSYNCMEMPARITYERR 0x0000000400000000ULL
160/* monty specific -- find the rest in ipath_6120.c */ 197/* 6120/7220 specific -- find the rest in ipath_6120.c and ipath_7220.c */
161#define INFINIPATH_HWE_MEMBISTFAILED 0x0040000000000000ULL 198#define INFINIPATH_HWE_MEMBISTFAILED 0x0040000000000000ULL
162 199
163/* kr_hwdiagctrl bits */ 200/* kr_hwdiagctrl bits */
@@ -202,7 +239,7 @@
202/* kr_ibcstatus bits */ 239/* kr_ibcstatus bits */
203#define INFINIPATH_IBCS_LINKTRAININGSTATE_SHIFT 0 240#define INFINIPATH_IBCS_LINKTRAININGSTATE_SHIFT 0
204#define INFINIPATH_IBCS_LINKSTATE_MASK 0x7 241#define INFINIPATH_IBCS_LINKSTATE_MASK 0x7
205#define INFINIPATH_IBCS_LINKSTATE_SHIFT 4 242
206#define INFINIPATH_IBCS_TXREADY 0x40000000 243#define INFINIPATH_IBCS_TXREADY 0x40000000
207#define INFINIPATH_IBCS_TXCREDITOK 0x80000000 244#define INFINIPATH_IBCS_TXCREDITOK 0x80000000
208/* link training states (shift by 245/* link training states (shift by
@@ -267,7 +304,7 @@
267/* L1 Power down; use with RXDETECT, Otherwise not used on IB side */ 304/* L1 Power down; use with RXDETECT, Otherwise not used on IB side */
268#define INFINIPATH_SERDC0_L1PWR_DN 0xF0ULL 305#define INFINIPATH_SERDC0_L1PWR_DN 0xF0ULL
269 306
270/* kr_xgxsconfig bits */ 307/* common kr_xgxsconfig bits (or safe in all, even if not implemented) */
271#define INFINIPATH_XGXS_RX_POL_SHIFT 19 308#define INFINIPATH_XGXS_RX_POL_SHIFT 19
272#define INFINIPATH_XGXS_RX_POL_MASK 0xfULL 309#define INFINIPATH_XGXS_RX_POL_MASK 0xfULL
273 310
@@ -397,6 +434,29 @@ struct ipath_kregs {
397 ipath_kreg kr_pcieq1serdesconfig0; 434 ipath_kreg kr_pcieq1serdesconfig0;
398 ipath_kreg kr_pcieq1serdesconfig1; 435 ipath_kreg kr_pcieq1serdesconfig1;
399 ipath_kreg kr_pcieq1serdesstatus; 436 ipath_kreg kr_pcieq1serdesstatus;
437 ipath_kreg kr_hrtbt_guid;
438 ipath_kreg kr_ibcddrctrl;
439 ipath_kreg kr_ibcddrstatus;
440 ipath_kreg kr_jintreload;
441
442 /* send dma related regs */
443 ipath_kreg kr_senddmabase;
444 ipath_kreg kr_senddmalengen;
445 ipath_kreg kr_senddmatail;
446 ipath_kreg kr_senddmahead;
447 ipath_kreg kr_senddmaheadaddr;
448 ipath_kreg kr_senddmabufmask0;
449 ipath_kreg kr_senddmabufmask1;
450 ipath_kreg kr_senddmabufmask2;
451 ipath_kreg kr_senddmastatus;
452
453 /* SerDes related regs (IBA7220-only) */
454 ipath_kreg kr_ibserdesctrl;
455 ipath_kreg kr_ib_epbacc;
456 ipath_kreg kr_ib_epbtrans;
457 ipath_kreg kr_pcie_epbacc;
458 ipath_kreg kr_pcie_epbtrans;
459 ipath_kreg kr_ib_ddsrxeq;
400}; 460};
401 461
402struct ipath_cregs { 462struct ipath_cregs {
diff --git a/drivers/infiniband/hw/ipath/ipath_verbs.h b/drivers/infiniband/hw/ipath/ipath_verbs.h
index 3d59736b49b2..5ed00e6d9270 100644
--- a/drivers/infiniband/hw/ipath/ipath_verbs.h
+++ b/drivers/infiniband/hw/ipath/ipath_verbs.h
@@ -138,6 +138,11 @@ struct ipath_ib_header {
138 } u; 138 } u;
139} __attribute__ ((packed)); 139} __attribute__ ((packed));
140 140
141struct ipath_pio_header {
142 __le32 pbc[2];
143 struct ipath_ib_header hdr;
144} __attribute__ ((packed));
145
141/* 146/*
142 * There is one struct ipath_mcast for each multicast GID. 147 * There is one struct ipath_mcast for each multicast GID.
143 * All attached QPs are then stored as a list of 148 * All attached QPs are then stored as a list of
@@ -319,6 +324,7 @@ struct ipath_sge_state {
319 struct ipath_sge *sg_list; /* next SGE to be used if any */ 324 struct ipath_sge *sg_list; /* next SGE to be used if any */
320 struct ipath_sge sge; /* progress state for the current SGE */ 325 struct ipath_sge sge; /* progress state for the current SGE */
321 u8 num_sge; 326 u8 num_sge;
327 u8 static_rate;
322}; 328};
323 329
324/* 330/*
@@ -356,6 +362,7 @@ struct ipath_qp {
356 struct tasklet_struct s_task; 362 struct tasklet_struct s_task;
357 struct ipath_mmap_info *ip; 363 struct ipath_mmap_info *ip;
358 struct ipath_sge_state *s_cur_sge; 364 struct ipath_sge_state *s_cur_sge;
365 struct ipath_verbs_txreq *s_tx;
359 struct ipath_sge_state s_sge; /* current send request data */ 366 struct ipath_sge_state s_sge; /* current send request data */
360 struct ipath_ack_entry s_ack_queue[IPATH_MAX_RDMA_ATOMIC + 1]; 367 struct ipath_ack_entry s_ack_queue[IPATH_MAX_RDMA_ATOMIC + 1];
361 struct ipath_sge_state s_ack_rdma_sge; 368 struct ipath_sge_state s_ack_rdma_sge;
@@ -363,7 +370,8 @@ struct ipath_qp {
363 struct ipath_sge_state r_sge; /* current receive data */ 370 struct ipath_sge_state r_sge; /* current receive data */
364 spinlock_t s_lock; 371 spinlock_t s_lock;
365 unsigned long s_busy; 372 unsigned long s_busy;
366 u32 s_hdrwords; /* size of s_hdr in 32 bit words */ 373 u16 s_pkt_delay;
374 u16 s_hdrwords; /* size of s_hdr in 32 bit words */
367 u32 s_cur_size; /* size of send packet in bytes */ 375 u32 s_cur_size; /* size of send packet in bytes */
368 u32 s_len; /* total length of s_sge */ 376 u32 s_len; /* total length of s_sge */
369 u32 s_rdma_read_len; /* total length of s_rdma_read_sge */ 377 u32 s_rdma_read_len; /* total length of s_rdma_read_sge */
@@ -387,7 +395,6 @@ struct ipath_qp {
387 u8 r_nak_state; /* non-zero if NAK is pending */ 395 u8 r_nak_state; /* non-zero if NAK is pending */
388 u8 r_min_rnr_timer; /* retry timeout value for RNR NAKs */ 396 u8 r_min_rnr_timer; /* retry timeout value for RNR NAKs */
389 u8 r_reuse_sge; /* for UC receive errors */ 397 u8 r_reuse_sge; /* for UC receive errors */
390 u8 r_sge_inx; /* current index into sg_list */
391 u8 r_wrid_valid; /* r_wrid set but CQ entry not yet made */ 398 u8 r_wrid_valid; /* r_wrid set but CQ entry not yet made */
392 u8 r_max_rd_atomic; /* max number of RDMA read/atomic to receive */ 399 u8 r_max_rd_atomic; /* max number of RDMA read/atomic to receive */
393 u8 r_head_ack_queue; /* index into s_ack_queue[] */ 400 u8 r_head_ack_queue; /* index into s_ack_queue[] */
@@ -403,6 +410,7 @@ struct ipath_qp {
403 u8 s_num_rd_atomic; /* number of RDMA read/atomic pending */ 410 u8 s_num_rd_atomic; /* number of RDMA read/atomic pending */
404 u8 s_tail_ack_queue; /* index into s_ack_queue[] */ 411 u8 s_tail_ack_queue; /* index into s_ack_queue[] */
405 u8 s_flags; 412 u8 s_flags;
413 u8 s_dmult;
406 u8 timeout; /* Timeout for this QP */ 414 u8 timeout; /* Timeout for this QP */
407 enum ib_mtu path_mtu; 415 enum ib_mtu path_mtu;
408 u32 remote_qpn; 416 u32 remote_qpn;
@@ -510,6 +518,8 @@ struct ipath_ibdev {
510 struct ipath_lkey_table lk_table; 518 struct ipath_lkey_table lk_table;
511 struct list_head pending[3]; /* FIFO of QPs waiting for ACKs */ 519 struct list_head pending[3]; /* FIFO of QPs waiting for ACKs */
512 struct list_head piowait; /* list for wait PIO buf */ 520 struct list_head piowait; /* list for wait PIO buf */
521 struct list_head txreq_free;
522 void *txreq_bufs;
513 /* list of QPs waiting for RNR timer */ 523 /* list of QPs waiting for RNR timer */
514 struct list_head rnrwait; 524 struct list_head rnrwait;
515 spinlock_t pending_lock; 525 spinlock_t pending_lock;
@@ -570,6 +580,7 @@ struct ipath_ibdev {
570 u32 n_rdma_dup_busy; 580 u32 n_rdma_dup_busy;
571 u32 n_piowait; 581 u32 n_piowait;
572 u32 n_no_piobuf; 582 u32 n_no_piobuf;
583 u32 n_unaligned;
573 u32 port_cap_flags; 584 u32 port_cap_flags;
574 u32 pma_sample_start; 585 u32 pma_sample_start;
575 u32 pma_sample_interval; 586 u32 pma_sample_interval;
@@ -581,7 +592,6 @@ struct ipath_ibdev {
581 u16 pending_index; /* which pending queue is active */ 592 u16 pending_index; /* which pending queue is active */
582 u8 pma_sample_status; 593 u8 pma_sample_status;
583 u8 subnet_timeout; 594 u8 subnet_timeout;
584 u8 link_width_enabled;
585 u8 vl_high_limit; 595 u8 vl_high_limit;
586 struct ipath_opcode_stats opstats[128]; 596 struct ipath_opcode_stats opstats[128];
587}; 597};
@@ -602,6 +612,16 @@ struct ipath_verbs_counters {
602 u32 vl15_dropped; 612 u32 vl15_dropped;
603}; 613};
604 614
615struct ipath_verbs_txreq {
616 struct ipath_qp *qp;
617 struct ipath_swqe *wqe;
618 u32 map_len;
619 u32 len;
620 struct ipath_sge_state *ss;
621 struct ipath_pio_header hdr;
622 struct ipath_sdma_txreq txreq;
623};
624
605static inline struct ipath_mr *to_imr(struct ib_mr *ibmr) 625static inline struct ipath_mr *to_imr(struct ib_mr *ibmr)
606{ 626{
607 return container_of(ibmr, struct ipath_mr, ibmr); 627 return container_of(ibmr, struct ipath_mr, ibmr);
@@ -694,11 +714,11 @@ void ipath_sqerror_qp(struct ipath_qp *qp, struct ib_wc *wc);
694 714
695void ipath_get_credit(struct ipath_qp *qp, u32 aeth); 715void ipath_get_credit(struct ipath_qp *qp, u32 aeth);
696 716
717unsigned ipath_ib_rate_to_mult(enum ib_rate rate);
718
697int ipath_verbs_send(struct ipath_qp *qp, struct ipath_ib_header *hdr, 719int ipath_verbs_send(struct ipath_qp *qp, struct ipath_ib_header *hdr,
698 u32 hdrwords, struct ipath_sge_state *ss, u32 len); 720 u32 hdrwords, struct ipath_sge_state *ss, u32 len);
699 721
700void ipath_cq_enter(struct ipath_cq *cq, struct ib_wc *entry, int sig);
701
702void ipath_copy_sge(struct ipath_sge_state *ss, void *data, u32 length); 722void ipath_copy_sge(struct ipath_sge_state *ss, void *data, u32 length);
703 723
704void ipath_skip_sge(struct ipath_sge_state *ss, u32 length); 724void ipath_skip_sge(struct ipath_sge_state *ss, u32 length);