diff options
author | Ralph Campbell <ralph.campbell@qlogic.com> | 2008-04-17 00:09:30 -0400 |
---|---|---|
committer | Roland Dreier <rolandd@cisco.com> | 2008-04-17 00:09:30 -0400 |
commit | afce688ba968723a9e281b141bf7b0ab43a36968 (patch) | |
tree | f8e2999000a3be7a34bc307f2b8c4471ee2e3dad /drivers/infiniband/hw/ipath/ipath_kernel.h | |
parent | 6bb68835d3eb72cd490056fda75d95493c31461b (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>
Diffstat (limited to 'drivers/infiniband/hw/ipath/ipath_kernel.h')
-rw-r--r-- | drivers/infiniband/hw/ipath/ipath_kernel.h | 165 |
1 files changed, 156 insertions, 9 deletions
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 | ||
182 | struct sk_buff; | 184 | struct sk_buff; |
185 | struct ipath_sge_state; | ||
186 | struct 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 | ||
200 | struct 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 | |||
215 | struct 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 */ |
728 | struct ipath_filedata { | 838 | struct 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 | }; |
733 | extern struct list_head ipath_dev_list; | 844 | extern struct list_head ipath_dev_list; |
734 | extern spinlock_t ipath_devs_lock; | 845 | extern spinlock_t ipath_devs_lock; |
@@ -796,6 +907,10 @@ void ipath_disable_armlaunch(struct ipath_devdata *); | |||
796 | void ipath_hol_down(struct ipath_devdata *); | 907 | void ipath_hol_down(struct ipath_devdata *); |
797 | void ipath_hol_up(struct ipath_devdata *); | 908 | void ipath_hol_up(struct ipath_devdata *); |
798 | void ipath_hol_event(unsigned long); | 909 | void ipath_hol_event(unsigned long); |
910 | void ipath_toggle_rclkrls(struct ipath_devdata *); | ||
911 | void ipath_sd7220_clr_ibpar(struct ipath_devdata *); | ||
912 | void ipath_set_relock_poll(struct ipath_devdata *, int); | ||
913 | void 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); | |||
879 | u32 __iomem *ipath_getpiobuf(struct ipath_devdata *, u32, u32 *); | 1003 | u32 __iomem *ipath_getpiobuf(struct ipath_devdata *, u32, u32 *); |
880 | void ipath_chg_pioavailkernel(struct ipath_devdata *dd, unsigned start, | 1004 | void ipath_chg_pioavailkernel(struct ipath_devdata *dd, unsigned start, |
881 | unsigned len, int avail); | 1005 | unsigned len, int avail); |
1006 | void ipath_init_iba7220_funcs(struct ipath_devdata *); | ||
882 | void ipath_init_iba6120_funcs(struct ipath_devdata *); | 1007 | void ipath_init_iba6120_funcs(struct ipath_devdata *); |
883 | void ipath_init_iba6110_funcs(struct ipath_devdata *); | 1008 | void ipath_init_iba6110_funcs(struct ipath_devdata *); |
884 | void ipath_get_eeprom_info(struct ipath_devdata *); | 1009 | void 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 */ |
898 | void ipath_set_led_override(struct ipath_devdata *dd, unsigned int val); | 1023 | void ipath_set_led_override(struct ipath_devdata *dd, unsigned int val); |
899 | 1024 | ||
1025 | /* send dma routines */ | ||
1026 | int setup_sdma(struct ipath_devdata *); | ||
1027 | void teardown_sdma(struct ipath_devdata *); | ||
1028 | void ipath_sdma_intr(struct ipath_devdata *); | ||
1029 | int 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. */ | ||
1032 | int ipath_sdma_make_progress(struct ipath_devdata *dd); | ||
1033 | |||
1034 | /* must be called under ipath_sdma_lock */ | ||
1035 | static 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 | |||
1042 | static inline void ipath_sdma_desc_reserve(struct ipath_devdata *dd, u16 cnt) | ||
1043 | { | ||
1044 | dd->ipath_sdma_desc_nreserved += cnt; | ||
1045 | } | ||
1046 | |||
1047 | static 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 *); | |||
1123 | dma_addr_t ipath_map_page(struct pci_dev *, struct page *, unsigned long, | 1274 | dma_addr_t ipath_map_page(struct pci_dev *, struct page *, unsigned long, |
1124 | size_t, int); | 1275 | size_t, int); |
1125 | dma_addr_t ipath_map_single(struct pci_dev *, void *, size_t, int); | 1276 | dma_addr_t ipath_map_single(struct pci_dev *, void *, size_t, int); |
1277 | const 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); | |||
1137 | extern unsigned ipath_debug; /* debugging bit mask */ | 1289 | extern unsigned ipath_debug; /* debugging bit mask */ |
1138 | extern unsigned ipath_linkrecovery; | 1290 | extern unsigned ipath_linkrecovery; |
1139 | extern unsigned ipath_mtu4096; | 1291 | extern unsigned ipath_mtu4096; |
1140 | |||
1141 | #define IPATH_MAX_PARITY_ATTEMPTS 10000 /* max times to try recovery */ | ||
1142 | |||
1143 | const char *ipath_get_unit_name(int unit); | ||
1144 | |||
1145 | extern struct mutex ipath_mutex; | 1292 | extern struct mutex ipath_mutex; |
1146 | 1293 | ||
1147 | #define IPATH_DRV_NAME "ib_ipath" | 1294 | #define IPATH_DRV_NAME "ib_ipath" |