Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6

SCSI updates on 20120118

* tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6: (49 commits)
[SCSI] libfc: remove redundant timer init for fcp
[SCSI] fcoe: Move fcoe_debug_logging from fcoe.h to fcoe.c
[SCSI] libfc: Declare local functions static
[SCSI] fcoe: fix regression on offload em matching function for initiator/target
[SCSI] qla4xxx: Update driver version to 5.02.00-k12
[SCSI] qla4xxx: Cleanup modinfo display
[SCSI] qla4xxx: Update license
[SCSI] qla4xxx: Clear the RISC interrupt bit during FW init
[SCSI] qla4xxx: Added error logging for firmware abort
[SCSI] qla4xxx: Disable generating pause frames in case of FW hung
[SCSI] qla4xxx: Temperature monitoring for ISP82XX core.
[SCSI] megaraid: fix sparse warnings
[SCSI] sg: convert to kstrtoul_from_user()
[SCSI] don't change sdev starvation list order without request dispatched
[SCSI] isci: fix, prevent port from getting stuck in the 'configuring' state
[SCSI] isci: fix start OOB
[SCSI] isci: fix io failures while wide port links are coming up
[SCSI] isci: allow more time for wide port targets
[SCSI] isci: enable wide port targets
[SCSI] isci: Fix IO fails when pull cable from phy in x4 wideport in MPC mode.
...

+1201 -1491
+10
Documentation/scsi/ChangeLog.megaraid_sas
··· 1 + Release Date : Fri. Jan 6, 2012 17:00:00 PST 2010 - 2 + (emaild-id:megaraidlinux@lsi.com) 3 + Adam Radford 4 + Current Version : 00.00.06.14-rc1 5 + Old Version : 00.00.06.12-rc1 6 + 1. Fix reglockFlags for degraded raid5/6 for MR 9360/9380. 7 + 2. Mask off flags in ioctl path to prevent memory scribble with older 8 + MegaCLI versions. 9 + 3. Remove poll_mode_io module paramater, sysfs node, and associated code. 10 + ------------------------------------------------------------------------------- 1 11 Release Date : Wed. Oct 5, 2011 17:00:00 PST 2010 - 2 12 (emaild-id:megaraidlinux@lsi.com) 3 13 Adam Radford
+1 -22
Documentation/scsi/LICENSE.qla4xxx
··· 1 1 Copyright (c) 2003-2011 QLogic Corporation 2 - QLogic Linux iSCSI HBA Driver 2 + QLogic Linux iSCSI Driver 3 3 4 4 This program includes a device driver for Linux 3.x. 5 5 You may modify and redistribute the device driver code under the 6 6 GNU General Public License (a copy of which is attached hereto as 7 7 Exhibit A) published by the Free Software Foundation (version 2). 8 - 9 - REGARDLESS OF WHAT LICENSING MECHANISM IS USED OR APPLICABLE, 10 - THIS PROGRAM IS PROVIDED BY QLOGIC CORPORATION "AS IS'' AND ANY 11 - EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 12 - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 13 - PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR 14 - BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 15 - EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 16 - TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 17 - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 18 - ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 19 - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 20 - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 21 - POSSIBILITY OF SUCH DAMAGE. 22 - 23 - USER ACKNOWLEDGES AND AGREES THAT USE OF THIS PROGRAM WILL NOT 24 - CREATE OR GIVE GROUNDS FOR A LICENSE BY IMPLICATION, ESTOPPEL, OR 25 - OTHERWISE IN ANY INTELLECTUAL PROPERTY RIGHTS (PATENT, COPYRIGHT, 26 - TRADE SECRET, MASK WORK, OR OTHER PROPRIETARY RIGHT) EMBODIED IN 27 - ANY OTHER QLOGIC HARDWARE OR SOFTWARE EITHER SOLELY OR IN 28 - COMBINATION WITH THIS PROGRAM. 29 8 30 9 31 10 EXHIBIT A
+1 -1
MAINTAINERS
··· 7200 7200 F: drivers/net/vmxnet3/ 7201 7201 7202 7202 VMware PVSCSI driver 7203 - M: Alok Kataria <akataria@vmware.com> 7203 + M: Arvind Kumar <arvindkumar@vmware.com> 7204 7204 M: VMware PV-Drivers <pv-drivers@vmware.com> 7205 7205 L: linux-scsi@vger.kernel.org 7206 7206 S: Maintained
-5
drivers/scsi/Kconfig
··· 830 830 tristate "Intel(R) C600 Series Chipset SAS Controller" 831 831 depends on PCI && SCSI 832 832 depends on X86 833 - # (temporary): known alpha quality driver 834 - depends on EXPERIMENTAL 835 833 select SCSI_SAS_LIBSAS 836 - select SCSI_SAS_HOST_SMP 837 834 ---help--- 838 835 This driver supports the 6Gb/s SAS capabilities of the storage 839 836 control unit found in the Intel(R) C600 series chipset. 840 - 841 - The experimental tag will be removed after the driver exits alpha 842 837 843 838 config SCSI_GENERIC_NCR5380 844 839 tristate "Generic NCR5380/53c400 SCSI PIO support"
+1 -6
drivers/scsi/bfa/bfa_defs_svc.h
··· 673 673 u32 tm_iocdowns; /* TM cleaned-up due to IOC down */ 674 674 u32 tm_cleanups; /* TM cleanup requests */ 675 675 u32 tm_cleanup_comps; /* TM cleanup completions */ 676 - u32 lm_lun_across_sg; /* LM lun is across sg data buf */ 677 - u32 lm_lun_not_sup; /* LM lun not supported */ 678 - u32 lm_rpl_data_changed; /* LM report-lun data changed */ 679 - u32 lm_wire_residue_changed; /* LM report-lun rsp residue changed */ 680 - u32 lm_small_buf_addresidue; /* LM buf smaller than reported cnt */ 681 - u32 lm_lun_not_rdy; /* LM lun not ready */ 676 + u32 rsvd[6]; 682 677 }; 683 678 684 679 /* Modify char* port_stt[] in bfal_port.c if a new state was added */
-155
drivers/scsi/bfa/bfa_fc.h
··· 56 56 57 57 #define SCSI_MAX_ALLOC_LEN 0xFF /* maximum allocarion length */ 58 58 59 - #define SCSI_SENSE_CUR_ERR 0x70 60 - #define SCSI_SENSE_DEF_ERR 0x71 61 - 62 - /* 63 - * SCSI additional sense codes 64 - */ 65 - #define SCSI_ASC_LUN_NOT_READY 0x04 66 - #define SCSI_ASC_LUN_NOT_SUPPORTED 0x25 67 - #define SCSI_ASC_TOCC 0x3F 68 - 69 - /* 70 - * SCSI additional sense code qualifiers 71 - */ 72 - #define SCSI_ASCQ_MAN_INTR_REQ 0x03 /* manual intervention req */ 73 - #define SCSI_ASCQ_RL_DATA_CHANGED 0x0E /* report luns data changed */ 74 - 75 - /* 76 - * Methods of reporting informational exceptions 77 - */ 78 - #define SCSI_MP_IEC_UNIT_ATTN 0x2 /* generate unit attention */ 79 - 80 - struct scsi_report_luns_data_s { 81 - u32 lun_list_length; /* length of LUN list length */ 82 - u32 reserved; 83 - struct scsi_lun lun[1]; /* first LUN in lun list */ 84 - }; 85 - 86 - struct scsi_inquiry_vendor_s { 87 - u8 vendor_id[8]; 88 - }; 89 - 90 - struct scsi_inquiry_prodid_s { 91 - u8 product_id[16]; 92 - }; 93 - 94 - struct scsi_inquiry_prodrev_s { 95 - u8 product_rev[4]; 96 - }; 97 - 98 - struct scsi_inquiry_data_s { 99 - #ifdef __BIG_ENDIAN 100 - u8 peripheral_qual:3; /* peripheral qualifier */ 101 - u8 device_type:5; /* peripheral device type */ 102 - u8 rmb:1; /* removable medium bit */ 103 - u8 device_type_mod:7; /* device type modifier */ 104 - u8 version; 105 - u8 aenc:1; /* async evt notification capability */ 106 - u8 trm_iop:1; /* terminate I/O process */ 107 - u8 norm_aca:1; /* normal ACA supported */ 108 - u8 hi_support:1; /* SCSI-3: supports REPORT LUNS */ 109 - u8 rsp_data_format:4; 110 - u8 additional_len; 111 - u8 sccs:1; 112 - u8 reserved1:7; 113 - u8 reserved2:1; 114 - u8 enc_serv:1; /* enclosure service component */ 115 - u8 reserved3:1; 116 - u8 multi_port:1; /* multi-port device */ 117 - u8 m_chngr:1; /* device in medium transport element */ 118 - u8 ack_req_q:1; /* SIP specific bit */ 119 - u8 addr32:1; /* SIP specific bit */ 120 - u8 addr16:1; /* SIP specific bit */ 121 - u8 rel_adr:1; /* relative address */ 122 - u8 w_bus32:1; 123 - u8 w_bus16:1; 124 - u8 synchronous:1; 125 - u8 linked_commands:1; 126 - u8 trans_dis:1; 127 - u8 cmd_queue:1; /* command queueing supported */ 128 - u8 soft_reset:1; /* soft reset alternative (VS) */ 129 - #else 130 - u8 device_type:5; /* peripheral device type */ 131 - u8 peripheral_qual:3; /* peripheral qualifier */ 132 - u8 device_type_mod:7; /* device type modifier */ 133 - u8 rmb:1; /* removable medium bit */ 134 - u8 version; 135 - u8 rsp_data_format:4; 136 - u8 hi_support:1; /* SCSI-3: supports REPORT LUNS */ 137 - u8 norm_aca:1; /* normal ACA supported */ 138 - u8 terminate_iop:1;/* terminate I/O process */ 139 - u8 aenc:1; /* async evt notification capability */ 140 - u8 additional_len; 141 - u8 reserved1:7; 142 - u8 sccs:1; 143 - u8 addr16:1; /* SIP specific bit */ 144 - u8 addr32:1; /* SIP specific bit */ 145 - u8 ack_req_q:1; /* SIP specific bit */ 146 - u8 m_chngr:1; /* device in medium transport element */ 147 - u8 multi_port:1; /* multi-port device */ 148 - u8 reserved3:1; /* TBD - Vendor Specific */ 149 - u8 enc_serv:1; /* enclosure service component */ 150 - u8 reserved2:1; 151 - u8 soft_seset:1; /* soft reset alternative (VS) */ 152 - u8 cmd_queue:1; /* command queueing supported */ 153 - u8 trans_dis:1; 154 - u8 linked_commands:1; 155 - u8 synchronous:1; 156 - u8 w_bus16:1; 157 - u8 w_bus32:1; 158 - u8 rel_adr:1; /* relative address */ 159 - #endif 160 - struct scsi_inquiry_vendor_s vendor_id; 161 - struct scsi_inquiry_prodid_s product_id; 162 - struct scsi_inquiry_prodrev_s product_rev; 163 - u8 vendor_specific[20]; 164 - u8 reserved4[40]; 165 - }; 166 - 167 - /* 168 - * SCSI sense data format 169 - */ 170 - struct scsi_sense_s { 171 - #ifdef __BIG_ENDIAN 172 - u8 valid:1; 173 - u8 rsp_code:7; 174 - #else 175 - u8 rsp_code:7; 176 - u8 valid:1; 177 - #endif 178 - u8 seg_num; 179 - #ifdef __BIG_ENDIAN 180 - u8 file_mark:1; 181 - u8 eom:1; /* end of media */ 182 - u8 ili:1; /* incorrect length indicator */ 183 - u8 reserved:1; 184 - u8 sense_key:4; 185 - #else 186 - u8 sense_key:4; 187 - u8 reserved:1; 188 - u8 ili:1; /* incorrect length indicator */ 189 - u8 eom:1; /* end of media */ 190 - u8 file_mark:1; 191 - #endif 192 - u8 information[4]; /* device-type or cmd specific info */ 193 - u8 add_sense_length; /* additional sense length */ 194 - u8 command_info[4];/* command specific information */ 195 - u8 asc; /* additional sense code */ 196 - u8 ascq; /* additional sense code qualifier */ 197 - u8 fru_code; /* field replaceable unit code */ 198 - #ifdef __BIG_ENDIAN 199 - u8 sksv:1; /* sense key specific valid */ 200 - u8 c_d:1; /* command/data bit */ 201 - u8 res1:2; 202 - u8 bpv:1; /* bit pointer valid */ 203 - u8 bpointer:3; /* bit pointer */ 204 - #else 205 - u8 bpointer:3; /* bit pointer */ 206 - u8 bpv:1; /* bit pointer valid */ 207 - u8 res1:2; 208 - u8 c_d:1; /* command/data bit */ 209 - u8 sksv:1; /* sense key specific valid */ 210 - #endif 211 - u8 fpointer[2]; /* field pointer */ 212 - }; 213 - 214 59 /* 215 60 * Fibre Channel Header Structure (FCHS) definition 216 61 */
+5 -411
drivers/scsi/bfa/bfa_fcpim.c
··· 24 24 * BFA ITNIM Related definitions 25 25 */ 26 26 static void bfa_itnim_update_del_itn_stats(struct bfa_itnim_s *itnim); 27 - static bfa_boolean_t bfa_ioim_lm_proc_rpl_data(struct bfa_ioim_s *ioim); 28 - static bfa_boolean_t bfa_ioim_lm_proc_inq_data(struct bfa_ioim_s *ioim); 29 27 static void bfa_ioim_lm_init(struct bfa_s *bfa); 30 28 31 29 #define BFA_ITNIM_FROM_TAG(_fcpim, _tag) \ ··· 58 60 } \ 59 61 } while (0) 60 62 61 - #define bfa_ioim_rp_wwn(__ioim) \ 62 - (((struct bfa_fcs_rport_s *) \ 63 - (__ioim)->itnim->rport->rport_drv)->pwwn) 64 - 65 - #define bfa_ioim_lp_wwn(__ioim) \ 66 - ((BFA_LPS_FROM_TAG(BFA_LPS_MOD((__ioim)->bfa), \ 67 - (__ioim)->itnim->rport->rport_info.lp_tag))->pwwn) \ 68 - 69 63 #define bfa_itnim_sler_cb(__itnim) do { \ 70 64 if ((__itnim)->bfa->fcs) \ 71 65 bfa_cb_itnim_sler((__itnim)->ditn); \ ··· 66 76 __bfa_cb_itnim_sler, (__itnim)); \ 67 77 } \ 68 78 } while (0) 69 - 70 - enum bfa_ioim_lm_status { 71 - BFA_IOIM_LM_PRESENT = 1, 72 - BFA_IOIM_LM_LUN_NOT_SUP = 2, 73 - BFA_IOIM_LM_RPL_DATA_CHANGED = 3, 74 - BFA_IOIM_LM_LUN_NOT_RDY = 4, 75 - }; 76 79 77 80 enum bfa_ioim_lm_ua_status { 78 81 BFA_IOIM_LM_UA_RESET = 0, ··· 128 145 BFA_IOIM_SM_TMDONE = 16, /* IO cleanup from tskim */ 129 146 BFA_IOIM_SM_HWFAIL = 17, /* IOC h/w failure event */ 130 147 BFA_IOIM_SM_IOTOV = 18, /* ITN offline TOV */ 131 - BFA_IOIM_SM_LM_LUN_NOT_SUP = 19,/* lunmask lun not supported */ 132 - BFA_IOIM_SM_LM_RPL_DC = 20, /* lunmask report-lun data changed */ 133 - BFA_IOIM_SM_LM_LUN_NOT_RDY = 21,/* lunmask lun not ready */ 134 148 }; 135 149 136 150 ··· 225 245 static void __bfa_cb_ioim_failed(void *cbarg, bfa_boolean_t complete); 226 246 static void __bfa_cb_ioim_pathtov(void *cbarg, bfa_boolean_t complete); 227 247 static bfa_boolean_t bfa_ioim_is_abortable(struct bfa_ioim_s *ioim); 228 - static void __bfa_cb_ioim_lm_lun_not_sup(void *cbarg, bfa_boolean_t complete); 229 - static void __bfa_cb_ioim_lm_rpl_dc(void *cbarg, bfa_boolean_t complete); 230 - static void __bfa_cb_ioim_lm_lun_not_rdy(void *cbarg, bfa_boolean_t complete); 231 248 232 249 /* 233 250 * forward declaration of BFA IO state machine ··· 422 445 bfa_fcpim_add_iostats(lstats, rstats, output_reqs); 423 446 bfa_fcpim_add_iostats(lstats, rstats, rd_throughput); 424 447 bfa_fcpim_add_iostats(lstats, rstats, wr_throughput); 425 - bfa_fcpim_add_iostats(lstats, rstats, lm_lun_across_sg); 426 - bfa_fcpim_add_iostats(lstats, rstats, lm_lun_not_sup); 427 - bfa_fcpim_add_iostats(lstats, rstats, lm_rpl_data_changed); 428 - bfa_fcpim_add_iostats(lstats, rstats, lm_wire_residue_changed); 429 - bfa_fcpim_add_iostats(lstats, rstats, lm_small_buf_addresidue); 430 - bfa_fcpim_add_iostats(lstats, rstats, lm_lun_not_rdy); 431 448 } 432 449 433 450 bfa_status_t ··· 1551 1580 __bfa_cb_ioim_abort, ioim); 1552 1581 break; 1553 1582 1554 - case BFA_IOIM_SM_LM_LUN_NOT_SUP: 1555 - bfa_sm_set_state(ioim, bfa_ioim_sm_hcb); 1556 - bfa_ioim_move_to_comp_q(ioim); 1557 - bfa_cb_queue(ioim->bfa, &ioim->hcb_qe, 1558 - __bfa_cb_ioim_lm_lun_not_sup, ioim); 1559 - break; 1560 - 1561 - case BFA_IOIM_SM_LM_RPL_DC: 1562 - bfa_sm_set_state(ioim, bfa_ioim_sm_hcb); 1563 - bfa_ioim_move_to_comp_q(ioim); 1564 - bfa_cb_queue(ioim->bfa, &ioim->hcb_qe, 1565 - __bfa_cb_ioim_lm_rpl_dc, ioim); 1566 - break; 1567 - 1568 - case BFA_IOIM_SM_LM_LUN_NOT_RDY: 1569 - bfa_sm_set_state(ioim, bfa_ioim_sm_hcb); 1570 - bfa_ioim_move_to_comp_q(ioim); 1571 - bfa_cb_queue(ioim->bfa, &ioim->hcb_qe, 1572 - __bfa_cb_ioim_lm_lun_not_rdy, ioim); 1573 - break; 1574 - 1575 1583 default: 1576 1584 bfa_sm_fault(ioim->bfa, event); 1577 1585 } ··· 2110 2160 } 2111 2161 } 2112 2162 2113 - /* 2114 - * Validate LUN for LUN masking 2115 - */ 2116 - static enum bfa_ioim_lm_status 2117 - bfa_ioim_lm_check(struct bfa_ioim_s *ioim, struct bfa_lps_s *lps, 2118 - struct bfa_rport_s *rp, struct scsi_lun lun) 2119 - { 2120 - u8 i; 2121 - struct bfa_lun_mask_s *lun_list = bfa_get_lun_mask_list(ioim->bfa); 2122 - struct scsi_cmnd *cmnd = (struct scsi_cmnd *)ioim->dio; 2123 - struct scsi_cdb_s *cdb = (struct scsi_cdb_s *)cmnd->cmnd; 2124 - 2125 - if ((cdb->scsi_cdb[0] == REPORT_LUNS) && 2126 - (scsilun_to_int((struct scsi_lun *)&lun) == 0)) { 2127 - ioim->proc_rsp_data = bfa_ioim_lm_proc_rpl_data; 2128 - return BFA_IOIM_LM_PRESENT; 2129 - } 2130 - 2131 - for (i = 0; i < MAX_LUN_MASK_CFG; i++) { 2132 - 2133 - if (lun_list[i].state != BFA_IOIM_LUN_MASK_ACTIVE) 2134 - continue; 2135 - 2136 - if ((scsilun_to_int((struct scsi_lun *)&lun_list[i].lun) == 2137 - scsilun_to_int((struct scsi_lun *)&lun)) 2138 - && (rp->rport_tag == lun_list[i].rp_tag) 2139 - && ((u8)ioim->itnim->rport->rport_info.lp_tag == 2140 - lun_list[i].lp_tag)) { 2141 - bfa_trc(ioim->bfa, lun_list[i].rp_tag); 2142 - bfa_trc(ioim->bfa, lun_list[i].lp_tag); 2143 - bfa_trc(ioim->bfa, scsilun_to_int( 2144 - (struct scsi_lun *)&lun_list[i].lun)); 2145 - 2146 - if ((lun_list[i].ua == BFA_IOIM_LM_UA_SET) && 2147 - ((cdb->scsi_cdb[0] != INQUIRY) || 2148 - (cdb->scsi_cdb[0] != REPORT_LUNS))) { 2149 - lun_list[i].ua = BFA_IOIM_LM_UA_RESET; 2150 - return BFA_IOIM_LM_RPL_DATA_CHANGED; 2151 - } 2152 - 2153 - if (cdb->scsi_cdb[0] == REPORT_LUNS) 2154 - ioim->proc_rsp_data = bfa_ioim_lm_proc_rpl_data; 2155 - 2156 - return BFA_IOIM_LM_PRESENT; 2157 - } 2158 - } 2159 - 2160 - if ((cdb->scsi_cdb[0] == INQUIRY) && 2161 - (scsilun_to_int((struct scsi_lun *)&lun) == 0)) { 2162 - ioim->proc_rsp_data = bfa_ioim_lm_proc_inq_data; 2163 - return BFA_IOIM_LM_PRESENT; 2164 - } 2165 - 2166 - if (cdb->scsi_cdb[0] == TEST_UNIT_READY) 2167 - return BFA_IOIM_LM_LUN_NOT_RDY; 2168 - 2169 - return BFA_IOIM_LM_LUN_NOT_SUP; 2170 - } 2171 - 2172 - static bfa_boolean_t 2173 - bfa_ioim_lm_proc_rsp_data_dummy(struct bfa_ioim_s *ioim) 2174 - { 2175 - return BFA_TRUE; 2176 - } 2177 - 2178 - static void 2179 - bfa_ioim_lm_fetch_lun(struct bfa_ioim_s *ioim, u8 *rl_data, int offset, 2180 - int buf_lun_cnt) 2181 - { 2182 - struct bfa_lun_mask_s *lun_list = bfa_get_lun_mask_list(ioim->bfa); 2183 - struct scsi_lun *lun_data = (struct scsi_lun *)(rl_data + offset); 2184 - struct scsi_lun lun; 2185 - int i, j; 2186 - 2187 - bfa_trc(ioim->bfa, buf_lun_cnt); 2188 - for (j = 0; j < buf_lun_cnt; j++) { 2189 - lun = *((struct scsi_lun *)(lun_data + j)); 2190 - for (i = 0; i < MAX_LUN_MASK_CFG; i++) { 2191 - if (lun_list[i].state != BFA_IOIM_LUN_MASK_ACTIVE) 2192 - continue; 2193 - if ((lun_list[i].rp_wwn == bfa_ioim_rp_wwn(ioim)) && 2194 - (lun_list[i].lp_wwn == bfa_ioim_lp_wwn(ioim)) && 2195 - (scsilun_to_int((struct scsi_lun *)&lun_list[i].lun) 2196 - == scsilun_to_int((struct scsi_lun *)&lun))) { 2197 - lun_list[i].state = BFA_IOIM_LUN_MASK_FETCHED; 2198 - break; 2199 - } 2200 - } /* next lun in mask DB */ 2201 - } /* next lun in buf */ 2202 - } 2203 - 2204 - static int 2205 - bfa_ioim_lm_update_lun_sg(struct bfa_ioim_s *ioim, u32 *pgdlen, 2206 - struct scsi_report_luns_data_s *rl) 2207 - { 2208 - struct scsi_cmnd *cmnd = (struct scsi_cmnd *)ioim->dio; 2209 - struct scatterlist *sg = scsi_sglist(cmnd); 2210 - struct bfa_lun_mask_s *lun_list = bfa_get_lun_mask_list(ioim->bfa); 2211 - struct scsi_lun *prev_rl_data = NULL, *base_rl_data; 2212 - int i, j, sgeid, lun_fetched_cnt = 0, prev_sg_len = 0, base_count; 2213 - int lun_across_sg_bytes, bytes_from_next_buf; 2214 - u64 last_lun, temp_last_lun; 2215 - 2216 - /* fetch luns from the first sg element */ 2217 - bfa_ioim_lm_fetch_lun(ioim, (u8 *)(rl->lun), 0, 2218 - (sg_dma_len(sg) / sizeof(struct scsi_lun)) - 1); 2219 - 2220 - /* fetch luns from multiple sg elements */ 2221 - scsi_for_each_sg(cmnd, sg, scsi_sg_count(cmnd), sgeid) { 2222 - if (sgeid == 0) { 2223 - prev_sg_len = sg_dma_len(sg); 2224 - prev_rl_data = (struct scsi_lun *) 2225 - phys_to_virt(sg_dma_address(sg)); 2226 - continue; 2227 - } 2228 - 2229 - /* if the buf is having more data */ 2230 - lun_across_sg_bytes = prev_sg_len % sizeof(struct scsi_lun); 2231 - if (lun_across_sg_bytes) { 2232 - bfa_trc(ioim->bfa, lun_across_sg_bytes); 2233 - bfa_stats(ioim->itnim, lm_lun_across_sg); 2234 - bytes_from_next_buf = sizeof(struct scsi_lun) - 2235 - lun_across_sg_bytes; 2236 - 2237 - /* from next buf take higher bytes */ 2238 - temp_last_lun = *((u64 *) 2239 - phys_to_virt(sg_dma_address(sg))); 2240 - last_lun |= temp_last_lun >> 2241 - (lun_across_sg_bytes * BITS_PER_BYTE); 2242 - 2243 - /* from prev buf take higher bytes */ 2244 - temp_last_lun = *((u64 *)(prev_rl_data + 2245 - (prev_sg_len - lun_across_sg_bytes))); 2246 - temp_last_lun >>= bytes_from_next_buf * BITS_PER_BYTE; 2247 - last_lun = last_lun | (temp_last_lun << 2248 - (bytes_from_next_buf * BITS_PER_BYTE)); 2249 - 2250 - bfa_ioim_lm_fetch_lun(ioim, (u8 *)&last_lun, 0, 1); 2251 - } else 2252 - bytes_from_next_buf = 0; 2253 - 2254 - *pgdlen += sg_dma_len(sg); 2255 - prev_sg_len = sg_dma_len(sg); 2256 - prev_rl_data = (struct scsi_lun *) 2257 - phys_to_virt(sg_dma_address(sg)); 2258 - bfa_ioim_lm_fetch_lun(ioim, (u8 *)prev_rl_data, 2259 - bytes_from_next_buf, 2260 - sg_dma_len(sg) / sizeof(struct scsi_lun)); 2261 - } 2262 - 2263 - /* update the report luns data - based on fetched luns */ 2264 - sg = scsi_sglist(cmnd); 2265 - base_rl_data = (struct scsi_lun *)rl->lun; 2266 - base_count = (sg_dma_len(sg) / sizeof(struct scsi_lun)) - 1; 2267 - for (i = 0, j = 0; i < MAX_LUN_MASK_CFG; i++) { 2268 - if (lun_list[i].state == BFA_IOIM_LUN_MASK_FETCHED) { 2269 - base_rl_data[j] = lun_list[i].lun; 2270 - lun_list[i].state = BFA_IOIM_LUN_MASK_ACTIVE; 2271 - j++; 2272 - lun_fetched_cnt++; 2273 - } 2274 - 2275 - if (j > base_count) { 2276 - j = 0; 2277 - sg = sg_next(sg); 2278 - base_rl_data = (struct scsi_lun *) 2279 - phys_to_virt(sg_dma_address(sg)); 2280 - base_count = sg_dma_len(sg) / sizeof(struct scsi_lun); 2281 - } 2282 - } 2283 - 2284 - bfa_trc(ioim->bfa, lun_fetched_cnt); 2285 - return lun_fetched_cnt; 2286 - } 2287 - 2288 - static bfa_boolean_t 2289 - bfa_ioim_lm_proc_inq_data(struct bfa_ioim_s *ioim) 2290 - { 2291 - struct scsi_inquiry_data_s *inq; 2292 - struct scatterlist *sg = scsi_sglist((struct scsi_cmnd *)ioim->dio); 2293 - 2294 - ioim->proc_rsp_data = bfa_ioim_lm_proc_rsp_data_dummy; 2295 - inq = (struct scsi_inquiry_data_s *)phys_to_virt(sg_dma_address(sg)); 2296 - 2297 - bfa_trc(ioim->bfa, inq->device_type); 2298 - inq->peripheral_qual = SCSI_INQ_PQ_NOT_CON; 2299 - return 0; 2300 - } 2301 - 2302 - static bfa_boolean_t 2303 - bfa_ioim_lm_proc_rpl_data(struct bfa_ioim_s *ioim) 2304 - { 2305 - struct scsi_cmnd *cmnd = (struct scsi_cmnd *)ioim->dio; 2306 - struct scatterlist *sg = scsi_sglist(cmnd); 2307 - struct bfi_ioim_rsp_s *m; 2308 - struct scsi_report_luns_data_s *rl = NULL; 2309 - int lun_count = 0, lun_fetched_cnt = 0; 2310 - u32 residue, pgdlen = 0; 2311 - 2312 - ioim->proc_rsp_data = bfa_ioim_lm_proc_rsp_data_dummy; 2313 - if (bfa_get_lun_mask_status(ioim->bfa) != BFA_LUNMASK_ENABLED) 2314 - return BFA_TRUE; 2315 - 2316 - m = (struct bfi_ioim_rsp_s *) &ioim->iosp->comp_rspmsg; 2317 - if (m->scsi_status == SCSI_STATUS_CHECK_CONDITION) 2318 - return BFA_TRUE; 2319 - 2320 - pgdlen = sg_dma_len(sg); 2321 - bfa_trc(ioim->bfa, pgdlen); 2322 - rl = (struct scsi_report_luns_data_s *)phys_to_virt(sg_dma_address(sg)); 2323 - lun_count = cpu_to_be32(rl->lun_list_length) / sizeof(struct scsi_lun); 2324 - lun_fetched_cnt = bfa_ioim_lm_update_lun_sg(ioim, &pgdlen, rl); 2325 - 2326 - if (lun_count == lun_fetched_cnt) 2327 - return BFA_TRUE; 2328 - 2329 - bfa_trc(ioim->bfa, lun_count); 2330 - bfa_trc(ioim->bfa, lun_fetched_cnt); 2331 - bfa_trc(ioim->bfa, be32_to_cpu(rl->lun_list_length)); 2332 - 2333 - if (be32_to_cpu(rl->lun_list_length) <= pgdlen) 2334 - rl->lun_list_length = be32_to_cpu(lun_fetched_cnt) * 2335 - sizeof(struct scsi_lun); 2336 - else 2337 - bfa_stats(ioim->itnim, lm_small_buf_addresidue); 2338 - 2339 - bfa_trc(ioim->bfa, be32_to_cpu(rl->lun_list_length)); 2340 - bfa_trc(ioim->bfa, be32_to_cpu(m->residue)); 2341 - 2342 - residue = be32_to_cpu(m->residue); 2343 - residue += (lun_count - lun_fetched_cnt) * sizeof(struct scsi_lun); 2344 - bfa_stats(ioim->itnim, lm_wire_residue_changed); 2345 - m->residue = be32_to_cpu(residue); 2346 - bfa_trc(ioim->bfa, ioim->nsges); 2347 - return BFA_FALSE; 2348 - } 2349 - 2350 2163 static void 2351 2164 __bfa_cb_ioim_good_comp(void *cbarg, bfa_boolean_t complete) 2352 2165 { ··· 2165 2452 2166 2453 bfa_cb_ioim_done(ioim->bfa->bfad, ioim->dio, m->io_status, 2167 2454 m->scsi_status, sns_len, snsinfo, residue); 2168 - } 2169 - 2170 - static void 2171 - __bfa_cb_ioim_lm_lun_not_sup(void *cbarg, bfa_boolean_t complete) 2172 - { 2173 - struct bfa_ioim_s *ioim = cbarg; 2174 - int sns_len = 0xD; 2175 - u32 residue = scsi_bufflen((struct scsi_cmnd *)ioim->dio); 2176 - struct scsi_sense_s *snsinfo; 2177 - 2178 - if (!complete) { 2179 - bfa_sm_send_event(ioim, BFA_IOIM_SM_HCB); 2180 - return; 2181 - } 2182 - 2183 - snsinfo = (struct scsi_sense_s *)BFA_SNSINFO_FROM_TAG( 2184 - ioim->fcpim->fcp, ioim->iotag); 2185 - snsinfo->rsp_code = SCSI_SENSE_CUR_ERR; 2186 - snsinfo->add_sense_length = 0xa; 2187 - snsinfo->asc = SCSI_ASC_LUN_NOT_SUPPORTED; 2188 - snsinfo->sense_key = ILLEGAL_REQUEST; 2189 - bfa_trc(ioim->bfa, residue); 2190 - bfa_cb_ioim_done(ioim->bfa->bfad, ioim->dio, BFI_IOIM_STS_OK, 2191 - SCSI_STATUS_CHECK_CONDITION, sns_len, 2192 - (u8 *)snsinfo, residue); 2193 - } 2194 - 2195 - static void 2196 - __bfa_cb_ioim_lm_rpl_dc(void *cbarg, bfa_boolean_t complete) 2197 - { 2198 - struct bfa_ioim_s *ioim = cbarg; 2199 - int sns_len = 0xD; 2200 - u32 residue = scsi_bufflen((struct scsi_cmnd *)ioim->dio); 2201 - struct scsi_sense_s *snsinfo; 2202 - 2203 - if (!complete) { 2204 - bfa_sm_send_event(ioim, BFA_IOIM_SM_HCB); 2205 - return; 2206 - } 2207 - 2208 - snsinfo = (struct scsi_sense_s *)BFA_SNSINFO_FROM_TAG(ioim->fcpim->fcp, 2209 - ioim->iotag); 2210 - snsinfo->rsp_code = SCSI_SENSE_CUR_ERR; 2211 - snsinfo->sense_key = SCSI_MP_IEC_UNIT_ATTN; 2212 - snsinfo->asc = SCSI_ASC_TOCC; 2213 - snsinfo->add_sense_length = 0x6; 2214 - snsinfo->ascq = SCSI_ASCQ_RL_DATA_CHANGED; 2215 - bfa_trc(ioim->bfa, residue); 2216 - bfa_cb_ioim_done(ioim->bfa->bfad, ioim->dio, BFI_IOIM_STS_OK, 2217 - SCSI_STATUS_CHECK_CONDITION, sns_len, 2218 - (u8 *)snsinfo, residue); 2219 - } 2220 - 2221 - static void 2222 - __bfa_cb_ioim_lm_lun_not_rdy(void *cbarg, bfa_boolean_t complete) 2223 - { 2224 - struct bfa_ioim_s *ioim = cbarg; 2225 - int sns_len = 0xD; 2226 - u32 residue = scsi_bufflen((struct scsi_cmnd *)ioim->dio); 2227 - struct scsi_sense_s *snsinfo; 2228 - 2229 - if (!complete) { 2230 - bfa_sm_send_event(ioim, BFA_IOIM_SM_HCB); 2231 - return; 2232 - } 2233 - 2234 - snsinfo = (struct scsi_sense_s *)BFA_SNSINFO_FROM_TAG( 2235 - ioim->fcpim->fcp, ioim->iotag); 2236 - snsinfo->rsp_code = SCSI_SENSE_CUR_ERR; 2237 - snsinfo->add_sense_length = 0xa; 2238 - snsinfo->sense_key = NOT_READY; 2239 - snsinfo->asc = SCSI_ASC_LUN_NOT_READY; 2240 - snsinfo->ascq = SCSI_ASCQ_MAN_INTR_REQ; 2241 - bfa_trc(ioim->bfa, residue); 2242 - bfa_cb_ioim_done(ioim->bfa->bfad, ioim->dio, BFI_IOIM_STS_OK, 2243 - SCSI_STATUS_CHECK_CONDITION, sns_len, 2244 - (u8 *)snsinfo, residue); 2245 2455 } 2246 2456 2247 2457 void ··· 2283 2647 if (port) { 2284 2648 *pwwn = port->port_cfg.pwwn; 2285 2649 rp_fcs = bfa_fcs_lport_get_rport_by_pwwn(port, rpwwn); 2286 - rp = rp_fcs->bfa_rport; 2650 + if (rp_fcs) 2651 + rp = rp_fcs->bfa_rport; 2287 2652 } 2288 2653 2289 2654 lunm_list = bfa_get_lun_mask_list(bfa); ··· 2352 2715 if (port) { 2353 2716 *pwwn = port->port_cfg.pwwn; 2354 2717 rp_fcs = bfa_fcs_lport_get_rport_by_pwwn(port, rpwwn); 2355 - rp = rp_fcs->bfa_rport; 2718 + if (rp_fcs) 2719 + rp = rp_fcs->bfa_rport; 2356 2720 } 2357 2721 } 2358 2722 ··· 2395 2757 return; 2396 2758 } 2397 2759 2398 - ioim->proc_rsp_data = bfa_ioim_lm_proc_rsp_data_dummy; 2399 2760 bfa_cb_ioim_done(ioim->bfa->bfad, ioim->dio, BFI_IOIM_STS_ABORTED, 2400 2761 0, 0, NULL, 0); 2401 2762 } ··· 2410 2773 return; 2411 2774 } 2412 2775 2413 - ioim->proc_rsp_data = bfa_ioim_lm_proc_rsp_data_dummy; 2414 2776 bfa_cb_ioim_done(ioim->bfa->bfad, ioim->dio, BFI_IOIM_STS_PATHTOV, 2415 2777 0, 0, NULL, 0); 2416 2778 } ··· 2424 2788 return; 2425 2789 } 2426 2790 2427 - ioim->proc_rsp_data = bfa_ioim_lm_proc_rsp_data_dummy; 2428 2791 bfa_cb_ioim_abort(ioim->bfa->bfad, ioim->dio); 2429 2792 } 2430 2793 ··· 2767 3132 ioim->bfa = fcpim->bfa; 2768 3133 ioim->fcpim = fcpim; 2769 3134 ioim->iosp = iosp; 2770 - ioim->proc_rsp_data = bfa_ioim_lm_proc_rsp_data_dummy; 2771 3135 INIT_LIST_HEAD(&ioim->sgpg_q); 2772 3136 bfa_reqq_winit(&ioim->iosp->reqq_wait, 2773 3137 bfa_ioim_qresume, ioim); ··· 2804 3170 evt = BFA_IOIM_SM_DONE; 2805 3171 else 2806 3172 evt = BFA_IOIM_SM_COMP; 2807 - ioim->proc_rsp_data(ioim); 2808 3173 break; 2809 3174 2810 3175 case BFI_IOIM_STS_TIMEDOUT: ··· 2839 3206 if (rsp->abort_tag != ioim->abort_tag) { 2840 3207 bfa_trc(ioim->bfa, rsp->abort_tag); 2841 3208 bfa_trc(ioim->bfa, ioim->abort_tag); 2842 - ioim->proc_rsp_data = bfa_ioim_lm_proc_rsp_data_dummy; 2843 3209 return; 2844 3210 } 2845 3211 ··· 2857 3225 WARN_ON(1); 2858 3226 } 2859 3227 2860 - ioim->proc_rsp_data = bfa_ioim_lm_proc_rsp_data_dummy; 2861 3228 bfa_sm_send_event(ioim, evt); 2862 3229 } 2863 3230 ··· 2875 3244 2876 3245 bfa_ioim_cb_profile_comp(fcpim, ioim); 2877 3246 2878 - if (bfa_get_lun_mask_status(bfa) != BFA_LUNMASK_ENABLED) { 2879 - bfa_sm_send_event(ioim, BFA_IOIM_SM_COMP_GOOD); 2880 - return; 2881 - } 2882 - 2883 - if (ioim->proc_rsp_data(ioim) == BFA_TRUE) 2884 - bfa_sm_send_event(ioim, BFA_IOIM_SM_COMP_GOOD); 2885 - else 2886 - bfa_sm_send_event(ioim, BFA_IOIM_SM_COMP); 3247 + bfa_sm_send_event(ioim, BFA_IOIM_SM_COMP_GOOD); 2887 3248 } 2888 3249 2889 3250 /* ··· 2987 3364 void 2988 3365 bfa_ioim_start(struct bfa_ioim_s *ioim) 2989 3366 { 2990 - struct scsi_cmnd *cmnd = (struct scsi_cmnd *)ioim->dio; 2991 - struct bfa_lps_s *lps; 2992 - enum bfa_ioim_lm_status status; 2993 - struct scsi_lun scsilun; 2994 - 2995 - if (bfa_get_lun_mask_status(ioim->bfa) == BFA_LUNMASK_ENABLED) { 2996 - lps = BFA_IOIM_TO_LPS(ioim); 2997 - int_to_scsilun(cmnd->device->lun, &scsilun); 2998 - status = bfa_ioim_lm_check(ioim, lps, 2999 - ioim->itnim->rport, scsilun); 3000 - if (status == BFA_IOIM_LM_LUN_NOT_RDY) { 3001 - bfa_sm_send_event(ioim, BFA_IOIM_SM_LM_LUN_NOT_RDY); 3002 - bfa_stats(ioim->itnim, lm_lun_not_rdy); 3003 - return; 3004 - } 3005 - 3006 - if (status == BFA_IOIM_LM_LUN_NOT_SUP) { 3007 - bfa_sm_send_event(ioim, BFA_IOIM_SM_LM_LUN_NOT_SUP); 3008 - bfa_stats(ioim->itnim, lm_lun_not_sup); 3009 - return; 3010 - } 3011 - 3012 - if (status == BFA_IOIM_LM_RPL_DATA_CHANGED) { 3013 - bfa_sm_send_event(ioim, BFA_IOIM_SM_LM_RPL_DC); 3014 - bfa_stats(ioim->itnim, lm_rpl_data_changed); 3015 - return; 3016 - } 3017 - } 3018 - 3019 3367 bfa_ioim_cb_profile_start(ioim->fcpim, ioim); 3020 3368 3021 3369 /*
-7
drivers/scsi/bfa/bfa_fcpim.h
··· 110 110 struct bfad_tskim_s; 111 111 112 112 typedef void (*bfa_fcpim_profile_t) (struct bfa_ioim_s *ioim); 113 - typedef bfa_boolean_t (*bfa_ioim_lm_proc_rsp_data_t) (struct bfa_ioim_s *ioim); 114 113 115 114 struct bfa_fcpim_s { 116 115 struct bfa_s *bfa; ··· 123 124 u32 path_tov; 124 125 u16 q_depth; 125 126 u8 reqq; /* Request queue to be used */ 126 - u8 lun_masking_pending; 127 127 struct list_head itnim_q; /* queue of active itnim */ 128 128 struct list_head ioim_resfree_q; /* IOs waiting for f/w */ 129 129 struct list_head ioim_comp_q; /* IO global comp Q */ ··· 179 181 u8 reqq; /* Request queue for I/O */ 180 182 u8 mode; /* IO is passthrough or not */ 181 183 u64 start_time; /* IO's Profile start val */ 182 - bfa_ioim_lm_proc_rsp_data_t proc_rsp_data; /* RSP data adjust */ 183 184 }; 184 185 185 186 struct bfa_ioim_sp_s { ··· 257 260 k++; (__ioim)->iotag &= BFA_IOIM_IOTAG_MASK; \ 258 261 (__ioim)->iotag |= k << BFA_IOIM_RETRY_TAG_OFFSET; \ 259 262 } while (0) 260 - 261 - #define BFA_IOIM_TO_LPS(__ioim) \ 262 - BFA_LPS_FROM_TAG(BFA_LPS_MOD(__ioim->bfa), \ 263 - __ioim->itnim->rport->rport_info.lp_tag) 264 263 265 264 static inline bfa_boolean_t 266 265 bfa_ioim_maxretry_reached(struct bfa_ioim_s *ioim)
-5
drivers/scsi/bfa/bfa_svc.h
··· 582 582 #define BFA_LP_TAG_INVALID 0xff 583 583 void bfa_rport_set_lunmask(struct bfa_s *bfa, struct bfa_rport_s *rp); 584 584 void bfa_rport_unset_lunmask(struct bfa_s *bfa, struct bfa_rport_s *rp); 585 - bfa_boolean_t bfa_rport_lunmask_active(struct bfa_rport_s *rp); 586 - wwn_t bfa_rport_get_pwwn(struct bfa_s *bfa, struct bfa_rport_s *rp); 587 - struct bfa_rport_s *bfa_rport_get_by_wwn(struct bfa_s *bfa, u16 vf_id, 588 - wwn_t *lpwwn, wwn_t rpwwn); 589 - void *bfa_cb_get_rp_by_wwn(void *arg, u16 vf_id, wwn_t *lpwwn, wwn_t rpwwn); 590 585 591 586 /* 592 587 * bfa fcxp API functions
+2
drivers/scsi/bfa/bfad.c
··· 674 674 675 675 spin_lock_irqsave(&bfad->bfad_lock, flags); 676 676 bfa_fcs_vport_start(&vport->fcs_vport); 677 + list_add_tail(&vport->list_entry, &bfad->vport_list); 677 678 spin_unlock_irqrestore(&bfad->bfad_lock, flags); 678 679 679 680 return BFA_STATUS_OK; ··· 1405 1404 bfad->ref_count = 0; 1406 1405 bfad->pport.bfad = bfad; 1407 1406 INIT_LIST_HEAD(&bfad->pbc_vport_list); 1407 + INIT_LIST_HEAD(&bfad->vport_list); 1408 1408 1409 1409 /* Setup the debugfs node for this bfad */ 1410 1410 if (bfa_debugfs_enable)
+1 -1
drivers/scsi/bfa/bfad_attr.c
··· 491 491 492 492 free_scsi_host: 493 493 bfad_scsi_host_free(bfad, im_port); 494 - 494 + list_del(&vport->list_entry); 495 495 kfree(vport); 496 496 497 497 return 0;
+24 -3
drivers/scsi/bfa/bfad_bsg.c
··· 2394 2394 return 0; 2395 2395 } 2396 2396 2397 + /* Function to reset the LUN SCAN mode */ 2398 + static void 2399 + bfad_iocmd_lunmask_reset_lunscan_mode(struct bfad_s *bfad, int lunmask_cfg) 2400 + { 2401 + struct bfad_im_port_s *pport_im = bfad->pport.im_port; 2402 + struct bfad_vport_s *vport = NULL; 2403 + 2404 + /* Set the scsi device LUN SCAN flags for base port */ 2405 + bfad_reset_sdev_bflags(pport_im, lunmask_cfg); 2406 + 2407 + /* Set the scsi device LUN SCAN flags for the vports */ 2408 + list_for_each_entry(vport, &bfad->vport_list, list_entry) 2409 + bfad_reset_sdev_bflags(vport->drv_port.im_port, lunmask_cfg); 2410 + } 2411 + 2397 2412 int 2398 2413 bfad_iocmd_lunmask(struct bfad_s *bfad, void *pcmd, unsigned int v_cmd) 2399 2414 { ··· 2416 2401 unsigned long flags; 2417 2402 2418 2403 spin_lock_irqsave(&bfad->bfad_lock, flags); 2419 - if (v_cmd == IOCMD_FCPIM_LUNMASK_ENABLE) 2404 + if (v_cmd == IOCMD_FCPIM_LUNMASK_ENABLE) { 2420 2405 iocmd->status = bfa_fcpim_lunmask_update(&bfad->bfa, BFA_TRUE); 2421 - else if (v_cmd == IOCMD_FCPIM_LUNMASK_DISABLE) 2406 + /* Set the LUN Scanning mode to be Sequential scan */ 2407 + if (iocmd->status == BFA_STATUS_OK) 2408 + bfad_iocmd_lunmask_reset_lunscan_mode(bfad, BFA_TRUE); 2409 + } else if (v_cmd == IOCMD_FCPIM_LUNMASK_DISABLE) { 2422 2410 iocmd->status = bfa_fcpim_lunmask_update(&bfad->bfa, BFA_FALSE); 2423 - else if (v_cmd == IOCMD_FCPIM_LUNMASK_CLEAR) 2411 + /* Set the LUN Scanning mode to default REPORT_LUNS scan */ 2412 + if (iocmd->status == BFA_STATUS_OK) 2413 + bfad_iocmd_lunmask_reset_lunscan_mode(bfad, BFA_FALSE); 2414 + } else if (v_cmd == IOCMD_FCPIM_LUNMASK_CLEAR) 2424 2415 iocmd->status = bfa_fcpim_lunmask_clear(&bfad->bfa); 2425 2416 spin_unlock_irqrestore(&bfad->bfad_lock, flags); 2426 2417 return 0;
+2
drivers/scsi/bfa/bfad_drv.h
··· 43 43 #include <scsi/scsi_transport_fc.h> 44 44 #include <scsi/scsi_transport.h> 45 45 #include <scsi/scsi_bsg_fc.h> 46 + #include <scsi/scsi_devinfo.h> 46 47 47 48 #include "bfa_modules.h" 48 49 #include "bfa_fcs.h" ··· 228 227 struct list_head active_aen_q; 229 228 struct bfa_aen_entry_s aen_list[BFA_AEN_MAX_ENTRY]; 230 229 spinlock_t bfad_aen_spinlock; 230 + struct list_head vport_list; 231 231 }; 232 232 233 233 /* BFAD state machine events */
+56
drivers/scsi/bfa/bfad_im.c
··· 918 918 } 919 919 920 920 /* 921 + * Function is invoked from the SCSI Host Template slave_alloc() entry point. 922 + * Has the logic to query the LUN Mask database to check if this LUN needs to 923 + * be made visible to the SCSI mid-layer or not. 924 + * 925 + * Returns BFA_STATUS_OK if this LUN needs to be added to the OS stack. 926 + * Returns -ENXIO to notify SCSI mid-layer to not add this LUN to the OS stack. 927 + */ 928 + static int 929 + bfad_im_check_if_make_lun_visible(struct scsi_device *sdev, 930 + struct fc_rport *rport) 931 + { 932 + struct bfad_itnim_data_s *itnim_data = 933 + (struct bfad_itnim_data_s *) rport->dd_data; 934 + struct bfa_s *bfa = itnim_data->itnim->bfa_itnim->bfa; 935 + struct bfa_rport_s *bfa_rport = itnim_data->itnim->bfa_itnim->rport; 936 + struct bfa_lun_mask_s *lun_list = bfa_get_lun_mask_list(bfa); 937 + int i = 0, ret = -ENXIO; 938 + 939 + for (i = 0; i < MAX_LUN_MASK_CFG; i++) { 940 + if (lun_list[i].state == BFA_IOIM_LUN_MASK_ACTIVE && 941 + scsilun_to_int(&lun_list[i].lun) == sdev->lun && 942 + lun_list[i].rp_tag == bfa_rport->rport_tag && 943 + lun_list[i].lp_tag == (u8)bfa_rport->rport_info.lp_tag) { 944 + ret = BFA_STATUS_OK; 945 + break; 946 + } 947 + } 948 + return ret; 949 + } 950 + 951 + /* 921 952 * Scsi_Host template entry slave_alloc 922 953 */ 923 954 static int 924 955 bfad_im_slave_alloc(struct scsi_device *sdev) 925 956 { 926 957 struct fc_rport *rport = starget_to_rport(scsi_target(sdev)); 958 + struct bfad_itnim_data_s *itnim_data = 959 + (struct bfad_itnim_data_s *) rport->dd_data; 960 + struct bfa_s *bfa = itnim_data->itnim->bfa_itnim->bfa; 927 961 928 962 if (!rport || fc_remote_port_chkready(rport)) 929 963 return -ENXIO; 930 964 965 + if (bfa_get_lun_mask_status(bfa) == BFA_LUNMASK_ENABLED) { 966 + /* 967 + * We should not mask LUN 0 - since this will translate 968 + * to no LUN / TARGET for SCSI ml resulting no scan. 969 + */ 970 + if (sdev->lun == 0) { 971 + sdev->sdev_bflags |= BLIST_NOREPORTLUN | 972 + BLIST_SPARSELUN; 973 + goto done; 974 + } 975 + 976 + /* 977 + * Query LUN Mask configuration - to expose this LUN 978 + * to the SCSI mid-layer or to mask it. 979 + */ 980 + if (bfad_im_check_if_make_lun_visible(sdev, rport) != 981 + BFA_STATUS_OK) 982 + return -ENXIO; 983 + } 984 + done: 931 985 sdev->hostdata = rport->dd_data; 932 986 933 987 return 0; ··· 1090 1036 if ((fc_rport->scsi_target_id != -1) 1091 1037 && (fc_rport->scsi_target_id < MAX_FCP_TARGET)) 1092 1038 itnim->scsi_tgt_id = fc_rport->scsi_target_id; 1039 + 1040 + itnim->channel = fc_rport->channel; 1093 1041 1094 1042 return; 1095 1043 }
+27
drivers/scsi/bfa/bfad_im.h
··· 91 91 struct fc_rport *fc_rport; 92 92 struct bfa_itnim_s *bfa_itnim; 93 93 u16 scsi_tgt_id; 94 + u16 channel; 94 95 u16 queue_work; 95 96 unsigned long last_ramp_up_time; 96 97 unsigned long last_queue_full_time; ··· 166 165 167 166 int bfad_im_bsg_request(struct fc_bsg_job *job); 168 167 int bfad_im_bsg_timeout(struct fc_bsg_job *job); 168 + 169 + /* 170 + * Macro to set the SCSI device sdev_bflags - sdev_bflags are used by the 171 + * SCSI mid-layer to choose LUN Scanning mode REPORT_LUNS vs. Sequential Scan 172 + * 173 + * Internally iterate's over all the ITNIM's part of the im_port & set's the 174 + * sdev_bflags for the scsi_device associated with LUN #0. 175 + */ 176 + #define bfad_reset_sdev_bflags(__im_port, __lunmask_cfg) do { \ 177 + struct scsi_device *__sdev = NULL; \ 178 + struct bfad_itnim_s *__itnim = NULL; \ 179 + u32 scan_flags = BLIST_NOREPORTLUN | BLIST_SPARSELUN; \ 180 + list_for_each_entry(__itnim, &((__im_port)->itnim_mapped_list), \ 181 + list_entry) { \ 182 + __sdev = scsi_device_lookup((__im_port)->shost, \ 183 + __itnim->channel, \ 184 + __itnim->scsi_tgt_id, 0); \ 185 + if (__sdev) { \ 186 + if ((__lunmask_cfg) == BFA_TRUE) \ 187 + __sdev->sdev_bflags |= scan_flags; \ 188 + else \ 189 + __sdev->sdev_bflags &= ~scan_flags; \ 190 + scsi_device_put(__sdev); \ 191 + } \ 192 + } \ 193 + } while (0) 169 194 170 195 #endif
+3 -2
drivers/scsi/cxgbi/libcxgbi.c
··· 1868 1868 1869 1869 tdata->skb = alloc_skb(cdev->skb_tx_rsvd + headroom, GFP_ATOMIC); 1870 1870 if (!tdata->skb) { 1871 - pr_warn("alloc skb %u+%u, opcode 0x%x failed.\n", 1872 - cdev->skb_tx_rsvd, headroom, opcode); 1871 + struct cxgbi_sock *csk = cconn->cep->csk; 1872 + struct net_device *ndev = cdev->ports[csk->port_id]; 1873 + ndev->stats.tx_dropped++; 1873 1874 return -ENOMEM; 1874 1875 } 1875 1876
+5
drivers/scsi/device_handler/scsi_dh_alua.c
··· 466 466 * Power On, Reset, or Bus Device Reset, just retry. 467 467 */ 468 468 return ADD_TO_MLQUEUE; 469 + if (sense_hdr->asc == 0x2a && sense_hdr->ascq == 0x01) 470 + /* 471 + * Mode Parameters Changed 472 + */ 473 + return ADD_TO_MLQUEUE; 469 474 if (sense_hdr->asc == 0x2a && sense_hdr->ascq == 0x06) 470 475 /* 471 476 * ALUA state changed
+2
drivers/scsi/device_handler/scsi_dh_rdac.c
··· 953 953 if (!kmpath_rdacd) { 954 954 scsi_unregister_device_handler(&rdac_dh); 955 955 printk(KERN_ERR "kmpath_rdacd creation failed.\n"); 956 + 957 + r = -EINVAL; 956 958 } 957 959 done: 958 960 return r;
+25 -21
drivers/scsi/fcoe/fcoe.c
··· 58 58 MODULE_PARM_DESC(ddp_min, "Minimum I/O size in bytes for " \ 59 59 "Direct Data Placement (DDP)."); 60 60 61 - DEFINE_MUTEX(fcoe_config_mutex); 61 + unsigned int fcoe_debug_logging; 62 + module_param_named(debug_logging, fcoe_debug_logging, int, S_IRUGO|S_IWUSR); 63 + MODULE_PARM_DESC(debug_logging, "a bit mask of logging levels"); 64 + 65 + static DEFINE_MUTEX(fcoe_config_mutex); 62 66 63 67 static struct workqueue_struct *fcoe_wq; 64 68 ··· 71 67 72 68 /* fcoe host list */ 73 69 /* must only by accessed under the RTNL mutex */ 74 - LIST_HEAD(fcoe_hostlist); 75 - DEFINE_PER_CPU(struct fcoe_percpu_s, fcoe_percpu); 70 + static LIST_HEAD(fcoe_hostlist); 71 + static DEFINE_PER_CPU(struct fcoe_percpu_s, fcoe_percpu); 76 72 77 73 /* Function Prototypes */ 78 74 static int fcoe_reset(struct Scsi_Host *); ··· 161 157 .lport_set_port_id = fcoe_set_port_id, 162 158 }; 163 159 164 - struct fc_function_template fcoe_nport_fc_functions = { 160 + static struct fc_function_template fcoe_nport_fc_functions = { 165 161 .show_host_node_name = 1, 166 162 .show_host_port_name = 1, 167 163 .show_host_supported_classes = 1, ··· 201 197 .bsg_request = fc_lport_bsg_request, 202 198 }; 203 199 204 - struct fc_function_template fcoe_vport_fc_functions = { 200 + static struct fc_function_template fcoe_vport_fc_functions = { 205 201 .show_host_node_name = 1, 206 202 .show_host_port_name = 1, 207 203 .show_host_supported_classes = 1, ··· 437 433 * 438 434 * Caller must be holding the RTNL mutex 439 435 */ 440 - void fcoe_interface_cleanup(struct fcoe_interface *fcoe) 436 + static void fcoe_interface_cleanup(struct fcoe_interface *fcoe) 441 437 { 442 438 struct net_device *netdev = fcoe->netdev; 443 439 struct fcoe_ctlr *fip = &fcoe->ctlr; ··· 752 748 * 753 749 * Returns: True for read types I/O, otherwise returns false. 754 750 */ 755 - bool fcoe_oem_match(struct fc_frame *fp) 751 + static bool fcoe_oem_match(struct fc_frame *fp) 756 752 { 757 753 struct fc_frame_header *fh = fc_frame_header_get(fp); 758 754 struct fcp_cmnd *fcp; ··· 760 756 if (fc_fcp_is_read(fr_fsp(fp)) && 761 757 (fr_fsp(fp)->data_len > fcoe_ddp_min)) 762 758 return true; 763 - else if (!(ntoh24(fh->fh_f_ctl) & FC_FC_EX_CTX)) { 759 + else if ((fr_fsp(fp) == NULL) && 760 + (fh->fh_r_ctl == FC_RCTL_DD_UNSOL_CMD) && 761 + (ntohs(fh->fh_rx_id) == FC_XID_UNKNOWN)) { 764 762 fcp = fc_frame_payload_get(fp, sizeof(*fcp)); 765 - if (ntohs(fh->fh_rx_id) == FC_XID_UNKNOWN && 766 - fcp && (ntohl(fcp->fc_dl) > fcoe_ddp_min) && 767 - (fcp->fc_flags & FCP_CFL_WRDATA)) 763 + if ((fcp->fc_flags & FCP_CFL_WRDATA) && 764 + (ntohl(fcp->fc_dl) > fcoe_ddp_min)) 768 765 return true; 769 766 } 770 767 return false; ··· 1111 1106 * 1112 1107 * Returns: 0 on success 1113 1108 */ 1114 - int __exit fcoe_if_exit(void) 1109 + static int __exit fcoe_if_exit(void) 1115 1110 { 1116 1111 fc_release_transport(fcoe_nport_scsi_transport); 1117 1112 fc_release_transport(fcoe_vport_scsi_transport); ··· 1300 1295 * 1301 1296 * Returns: 0 for success 1302 1297 */ 1303 - int fcoe_rcv(struct sk_buff *skb, struct net_device *netdev, 1298 + static int fcoe_rcv(struct sk_buff *skb, struct net_device *netdev, 1304 1299 struct packet_type *ptype, struct net_device *olddev) 1305 1300 { 1306 1301 struct fc_lport *lport; ··· 1456 1451 * 1457 1452 * Return: 0 for success 1458 1453 */ 1459 - int fcoe_xmit(struct fc_lport *lport, struct fc_frame *fp) 1454 + static int fcoe_xmit(struct fc_lport *lport, struct fc_frame *fp) 1460 1455 { 1461 1456 int wlen; 1462 1457 u32 crc; ··· 1676 1671 skb->dev ? skb->dev->name : "<NULL>"); 1677 1672 1678 1673 port = lport_priv(lport); 1679 - if (skb_is_nonlinear(skb)) 1680 - skb_linearize(skb); /* not ideal */ 1674 + skb_linearize(skb); /* check for skb_is_nonlinear is within skb_linearize */ 1681 1675 1682 1676 /* 1683 1677 * Frame length checks and setting up the header pointers ··· 1732 1728 * 1733 1729 * Return: 0 for success 1734 1730 */ 1735 - int fcoe_percpu_receive_thread(void *arg) 1731 + static int fcoe_percpu_receive_thread(void *arg) 1736 1732 { 1737 1733 struct fcoe_percpu_s *p = arg; 1738 1734 struct sk_buff *skb; ··· 2150 2146 * Returns: 0 if the ethtool query was successful 2151 2147 * -1 if the ethtool query failed 2152 2148 */ 2153 - int fcoe_link_speed_update(struct fc_lport *lport) 2149 + static int fcoe_link_speed_update(struct fc_lport *lport) 2154 2150 { 2155 2151 struct net_device *netdev = fcoe_netdev(lport); 2156 2152 struct ethtool_cmd ecmd; ··· 2184 2180 * Returns: 0 if link is UP and OK, -1 if not 2185 2181 * 2186 2182 */ 2187 - int fcoe_link_ok(struct fc_lport *lport) 2183 + static int fcoe_link_ok(struct fc_lport *lport) 2188 2184 { 2189 2185 struct net_device *netdev = fcoe_netdev(lport); 2190 2186 ··· 2204 2200 * there no packets that will be handled by the lport, but also that any 2205 2201 * threads already handling packet have returned. 2206 2202 */ 2207 - void fcoe_percpu_clean(struct fc_lport *lport) 2203 + static void fcoe_percpu_clean(struct fc_lport *lport) 2208 2204 { 2209 2205 struct fcoe_percpu_s *pp; 2210 2206 struct fcoe_rcv_info *fr; ··· 2255 2251 * 2256 2252 * Returns: Always 0 (return value required by FC transport template) 2257 2253 */ 2258 - int fcoe_reset(struct Scsi_Host *shost) 2254 + static int fcoe_reset(struct Scsi_Host *shost) 2259 2255 { 2260 2256 struct fc_lport *lport = shost_priv(shost); 2261 2257 struct fcoe_port *port = lport_priv(lport);
+1 -3
drivers/scsi/fcoe/fcoe.h
··· 40 40 #define FCOE_MIN_XID 0x0000 /* the min xid supported by fcoe_sw */ 41 41 #define FCOE_MAX_XID 0x0FFF /* the max xid supported by fcoe_sw */ 42 42 43 - unsigned int fcoe_debug_logging; 44 - module_param_named(debug_logging, fcoe_debug_logging, int, S_IRUGO|S_IWUSR); 45 - MODULE_PARM_DESC(debug_logging, "a bit mask of logging levels"); 43 + extern unsigned int fcoe_debug_logging; 46 44 47 45 #define FCOE_LOGGING 0x01 /* General logging, not categorized */ 48 46 #define FCOE_NETDEV_LOGGING 0x02 /* Netdevice logging */
+2
drivers/scsi/hpsa.c
··· 4271 4271 remove_ctlr_from_lockup_detector_list(h); 4272 4272 /* If the list of ctlr's to monitor is empty, stop the thread */ 4273 4273 if (list_empty(&hpsa_ctlr_list)) { 4274 + spin_unlock_irqrestore(&lockup_detector_lock, flags); 4274 4275 kthread_stop(hpsa_lockup_detector); 4276 + spin_lock_irqsave(&lockup_detector_lock, flags); 4275 4277 hpsa_lockup_detector = NULL; 4276 4278 } 4277 4279 spin_unlock_irqrestore(&lockup_detector_lock, flags);
-19
drivers/scsi/isci/firmware/Makefile
··· 1 - # Makefile for create_fw 2 - # 3 - CC=gcc 4 - CFLAGS=-c -Wall -O2 -g 5 - LDFLAGS= 6 - SOURCES=create_fw.c 7 - OBJECTS=$(SOURCES:.cpp=.o) 8 - EXECUTABLE=create_fw 9 - 10 - all: $(SOURCES) $(EXECUTABLE) 11 - 12 - $(EXECUTABLE): $(OBJECTS) 13 - $(CC) $(LDFLAGS) $(OBJECTS) -o $@ 14 - 15 - .c.o: 16 - $(CC) $(CFLAGS) $< -O $@ 17 - 18 - clean: 19 - rm -f *.o $(EXECUTABLE)
-36
drivers/scsi/isci/firmware/README
··· 1 - This defines the temporary binary blow we are to pass to the SCU 2 - driver to emulate the binary firmware that we will eventually be 3 - able to access via NVRAM on the SCU controller. 4 - 5 - The current size of the binary blob is expected to be 149 bytes or larger 6 - 7 - Header Types: 8 - 0x1: Phy Masks 9 - 0x2: Phy Gens 10 - 0x3: SAS Addrs 11 - 0xff: End of Data 12 - 13 - ID string - u8[12]: "#SCU MAGIC#\0" 14 - Version - u8: 1 15 - SubVersion - u8: 0 16 - 17 - Header Type - u8: 0x1 18 - Size - u8: 8 19 - Phy Mask - u32[8] 20 - 21 - Header Type - u8: 0x2 22 - Size - u8: 8 23 - Phy Gen - u32[8] 24 - 25 - Header Type - u8: 0x3 26 - Size - u8: 8 27 - Sas Addr - u64[8] 28 - 29 - Header Type - u8: 0xf 30 - 31 - 32 - ============================================================================== 33 - 34 - Place isci_firmware.bin in /lib/firmware 35 - Be sure to recreate the initramfs image to include the firmware. 36 -
-99
drivers/scsi/isci/firmware/create_fw.c
··· 1 - #include <stdio.h> 2 - #include <stdlib.h> 3 - #include <unistd.h> 4 - #include <sys/types.h> 5 - #include <sys/stat.h> 6 - #include <fcntl.h> 7 - #include <string.h> 8 - #include <errno.h> 9 - #include <asm/types.h> 10 - #include <strings.h> 11 - #include <stdint.h> 12 - 13 - #include "create_fw.h" 14 - #include "../probe_roms.h" 15 - 16 - int write_blob(struct isci_orom *isci_orom) 17 - { 18 - FILE *fd; 19 - int err; 20 - size_t count; 21 - 22 - fd = fopen(blob_name, "w+"); 23 - if (!fd) { 24 - perror("Open file for write failed"); 25 - fclose(fd); 26 - return -EIO; 27 - } 28 - 29 - count = fwrite(isci_orom, sizeof(struct isci_orom), 1, fd); 30 - if (count != 1) { 31 - perror("Write data failed"); 32 - fclose(fd); 33 - return -EIO; 34 - } 35 - 36 - fclose(fd); 37 - 38 - return 0; 39 - } 40 - 41 - void set_binary_values(struct isci_orom *isci_orom) 42 - { 43 - int ctrl_idx, phy_idx, port_idx; 44 - 45 - /* setting OROM signature */ 46 - strncpy(isci_orom->hdr.signature, sig, strlen(sig)); 47 - isci_orom->hdr.version = version; 48 - isci_orom->hdr.total_block_length = sizeof(struct isci_orom); 49 - isci_orom->hdr.hdr_length = sizeof(struct sci_bios_oem_param_block_hdr); 50 - isci_orom->hdr.num_elements = num_elements; 51 - 52 - for (ctrl_idx = 0; ctrl_idx < 2; ctrl_idx++) { 53 - isci_orom->ctrl[ctrl_idx].controller.mode_type = mode_type; 54 - isci_orom->ctrl[ctrl_idx].controller.max_concurrent_dev_spin_up = 55 - max_num_concurrent_dev_spin_up; 56 - isci_orom->ctrl[ctrl_idx].controller.do_enable_ssc = 57 - enable_ssc; 58 - 59 - for (port_idx = 0; port_idx < 4; port_idx++) 60 - isci_orom->ctrl[ctrl_idx].ports[port_idx].phy_mask = 61 - phy_mask[ctrl_idx][port_idx]; 62 - 63 - for (phy_idx = 0; phy_idx < 4; phy_idx++) { 64 - isci_orom->ctrl[ctrl_idx].phys[phy_idx].sas_address.high = 65 - (__u32)(sas_addr[ctrl_idx][phy_idx] >> 32); 66 - isci_orom->ctrl[ctrl_idx].phys[phy_idx].sas_address.low = 67 - (__u32)(sas_addr[ctrl_idx][phy_idx]); 68 - 69 - isci_orom->ctrl[ctrl_idx].phys[phy_idx].afe_tx_amp_control0 = 70 - afe_tx_amp_control0; 71 - isci_orom->ctrl[ctrl_idx].phys[phy_idx].afe_tx_amp_control1 = 72 - afe_tx_amp_control1; 73 - isci_orom->ctrl[ctrl_idx].phys[phy_idx].afe_tx_amp_control2 = 74 - afe_tx_amp_control2; 75 - isci_orom->ctrl[ctrl_idx].phys[phy_idx].afe_tx_amp_control3 = 76 - afe_tx_amp_control3; 77 - } 78 - } 79 - } 80 - 81 - int main(void) 82 - { 83 - int err; 84 - struct isci_orom *isci_orom; 85 - 86 - isci_orom = malloc(sizeof(struct isci_orom)); 87 - memset(isci_orom, 0, sizeof(struct isci_orom)); 88 - 89 - set_binary_values(isci_orom); 90 - 91 - err = write_blob(isci_orom); 92 - if (err < 0) { 93 - free(isci_orom); 94 - return err; 95 - } 96 - 97 - free(isci_orom); 98 - return 0; 99 - }
-77
drivers/scsi/isci/firmware/create_fw.h
··· 1 - #ifndef _CREATE_FW_H_ 2 - #define _CREATE_FW_H_ 3 - #include "../probe_roms.h" 4 - 5 - 6 - /* we are configuring for 2 SCUs */ 7 - static const int num_elements = 2; 8 - 9 - /* 10 - * For all defined arrays: 11 - * elements 0-3 are for SCU0, ports 0-3 12 - * elements 4-7 are for SCU1, ports 0-3 13 - * 14 - * valid configurations for one SCU are: 15 - * P0 P1 P2 P3 16 - * ---------------- 17 - * 0xF,0x0,0x0,0x0 # 1 x4 port 18 - * 0x3,0x0,0x4,0x8 # Phys 0 and 1 are a x2 port, phy 2 and phy 3 are each x1 19 - * # ports 20 - * 0x1,0x2,0xC,0x0 # Phys 0 and 1 are each x1 ports, phy 2 and phy 3 are a x2 21 - * # port 22 - * 0x3,0x0,0xC,0x0 # Phys 0 and 1 are a x2 port, phy 2 and phy 3 are a x2 port 23 - * 0x1,0x2,0x4,0x8 # Each phy is a x1 port (this is the default configuration) 24 - * 25 - * if there is a port/phy on which you do not wish to override the default 26 - * values, use the value assigned to UNINIT_PARAM (255). 27 - */ 28 - 29 - /* discovery mode type (port auto config mode by default ) */ 30 - 31 - /* 32 - * if there is a port/phy on which you do not wish to override the default 33 - * values, use the value "0000000000000000". SAS address of zero's is 34 - * considered invalid and will not be used. 35 - */ 36 - #ifdef MPC 37 - static const int mode_type = SCIC_PORT_MANUAL_CONFIGURATION_MODE; 38 - static const __u8 phy_mask[2][4] = { {1, 2, 4, 8}, 39 - {1, 2, 4, 8} }; 40 - static const unsigned long long sas_addr[2][4] = { { 0x5FCFFFFFF0000001ULL, 41 - 0x5FCFFFFFF0000002ULL, 42 - 0x5FCFFFFFF0000003ULL, 43 - 0x5FCFFFFFF0000004ULL }, 44 - { 0x5FCFFFFFF0000005ULL, 45 - 0x5FCFFFFFF0000006ULL, 46 - 0x5FCFFFFFF0000007ULL, 47 - 0x5FCFFFFFF0000008ULL } }; 48 - #else /* APC (default) */ 49 - static const int mode_type = SCIC_PORT_AUTOMATIC_CONFIGURATION_MODE; 50 - static const __u8 phy_mask[2][4]; 51 - static const unsigned long long sas_addr[2][4] = { { 0x5FCFFFFF00000001ULL, 52 - 0x5FCFFFFF00000001ULL, 53 - 0x5FCFFFFF00000001ULL, 54 - 0x5FCFFFFF00000001ULL }, 55 - { 0x5FCFFFFF00000002ULL, 56 - 0x5FCFFFFF00000002ULL, 57 - 0x5FCFFFFF00000002ULL, 58 - 0x5FCFFFFF00000002ULL } }; 59 - #endif 60 - 61 - /* Maximum number of concurrent device spin up */ 62 - static const int max_num_concurrent_dev_spin_up = 1; 63 - 64 - /* enable of ssc operation */ 65 - static const int enable_ssc; 66 - 67 - /* AFE_TX_AMP_CONTROL */ 68 - static const unsigned int afe_tx_amp_control0 = 0x000bdd08; 69 - static const unsigned int afe_tx_amp_control1 = 0x000ffc00; 70 - static const unsigned int afe_tx_amp_control2 = 0x000b7c09; 71 - static const unsigned int afe_tx_amp_control3 = 0x000afc6e; 72 - 73 - static const char blob_name[] = "isci_firmware.bin"; 74 - static const char sig[] = "ISCUOEMB"; 75 - static const unsigned char version = 0x10; 76 - 77 - #endif
+263 -77
drivers/scsi/isci/host.c
··· 899 899 */ 900 900 if ((iphy->is_in_link_training == false && state == SCI_PHY_INITIAL) || 901 901 (iphy->is_in_link_training == false && state == SCI_PHY_STOPPED) || 902 - (iphy->is_in_link_training == true && is_phy_starting(iphy))) { 902 + (iphy->is_in_link_training == true && is_phy_starting(iphy)) || 903 + (ihost->port_agent.phy_ready_mask != ihost->port_agent.phy_configured_mask)) { 903 904 is_controller_start_complete = false; 904 905 break; 905 906 } ··· 1667 1666 /* Default to no SSC operation. */ 1668 1667 ihost->oem_parameters.controller.do_enable_ssc = false; 1669 1668 1669 + /* Default to short cables on all phys. */ 1670 + ihost->oem_parameters.controller.cable_selection_mask = 0; 1671 + 1670 1672 /* Initialize all of the port parameter information to narrow ports. */ 1671 1673 for (index = 0; index < SCI_MAX_PORTS; index++) { 1672 1674 ihost->oem_parameters.ports[index].phy_mask = 0; ··· 1677 1673 1678 1674 /* Initialize all of the phy parameter information. */ 1679 1675 for (index = 0; index < SCI_MAX_PHYS; index++) { 1680 - /* Default to 6G (i.e. Gen 3) for now. */ 1681 - ihost->user_parameters.phys[index].max_speed_generation = 3; 1676 + /* Default to 3G (i.e. Gen 2). */ 1677 + ihost->user_parameters.phys[index].max_speed_generation = 1678 + SCIC_SDS_PARM_GEN2_SPEED; 1682 1679 1683 1680 /* the frequencies cannot be 0 */ 1684 1681 ihost->user_parameters.phys[index].align_insertion_frequency = 0x7f; ··· 1699 1694 ihost->user_parameters.ssp_inactivity_timeout = 5; 1700 1695 ihost->user_parameters.stp_max_occupancy_timeout = 5; 1701 1696 ihost->user_parameters.ssp_max_occupancy_timeout = 20; 1702 - ihost->user_parameters.no_outbound_task_timeout = 20; 1697 + ihost->user_parameters.no_outbound_task_timeout = 2; 1703 1698 } 1704 1699 1705 1700 static void controller_timeout(unsigned long data) ··· 1764 1759 return sci_controller_reset(ihost); 1765 1760 } 1766 1761 1767 - int sci_oem_parameters_validate(struct sci_oem_params *oem) 1762 + int sci_oem_parameters_validate(struct sci_oem_params *oem, u8 version) 1768 1763 { 1769 1764 int i; 1770 1765 ··· 1796 1791 oem->controller.max_concurr_spin_up < 1) 1797 1792 return -EINVAL; 1798 1793 1794 + if (oem->controller.do_enable_ssc) { 1795 + if (version < ISCI_ROM_VER_1_1 && oem->controller.do_enable_ssc != 1) 1796 + return -EINVAL; 1797 + 1798 + if (version >= ISCI_ROM_VER_1_1) { 1799 + u8 test = oem->controller.ssc_sata_tx_spread_level; 1800 + 1801 + switch (test) { 1802 + case 0: 1803 + case 2: 1804 + case 3: 1805 + case 6: 1806 + case 7: 1807 + break; 1808 + default: 1809 + return -EINVAL; 1810 + } 1811 + 1812 + test = oem->controller.ssc_sas_tx_spread_level; 1813 + if (oem->controller.ssc_sas_tx_type == 0) { 1814 + switch (test) { 1815 + case 0: 1816 + case 2: 1817 + case 3: 1818 + break; 1819 + default: 1820 + return -EINVAL; 1821 + } 1822 + } else if (oem->controller.ssc_sas_tx_type == 1) { 1823 + switch (test) { 1824 + case 0: 1825 + case 3: 1826 + case 6: 1827 + break; 1828 + default: 1829 + return -EINVAL; 1830 + } 1831 + } 1832 + } 1833 + } 1834 + 1799 1835 return 0; 1800 1836 } 1801 1837 1802 1838 static enum sci_status sci_oem_parameters_set(struct isci_host *ihost) 1803 1839 { 1804 1840 u32 state = ihost->sm.current_state_id; 1841 + struct isci_pci_info *pci_info = to_pci_info(ihost->pdev); 1805 1842 1806 1843 if (state == SCIC_RESET || 1807 1844 state == SCIC_INITIALIZING || 1808 1845 state == SCIC_INITIALIZED) { 1809 1846 1810 - if (sci_oem_parameters_validate(&ihost->oem_parameters)) 1847 + if (sci_oem_parameters_validate(&ihost->oem_parameters, 1848 + pci_info->orom->hdr.version)) 1811 1849 return SCI_FAILURE_INVALID_PARAMETER_VALUE; 1812 1850 1813 1851 return SCI_SUCCESS; ··· 1905 1857 ihost->power_control.phys_waiting--; 1906 1858 ihost->power_control.phys_granted_power++; 1907 1859 sci_phy_consume_power_handler(iphy); 1860 + 1861 + if (iphy->protocol == SCIC_SDS_PHY_PROTOCOL_SAS) { 1862 + u8 j; 1863 + 1864 + for (j = 0; j < SCI_MAX_PHYS; j++) { 1865 + struct isci_phy *requester = ihost->power_control.requesters[j]; 1866 + 1867 + /* 1868 + * Search the power_control queue to see if there are other phys 1869 + * attached to the same remote device. If found, take all of 1870 + * them out of await_sas_power state. 1871 + */ 1872 + if (requester != NULL && requester != iphy) { 1873 + u8 other = memcmp(requester->frame_rcvd.iaf.sas_addr, 1874 + iphy->frame_rcvd.iaf.sas_addr, 1875 + sizeof(requester->frame_rcvd.iaf.sas_addr)); 1876 + 1877 + if (other == 0) { 1878 + ihost->power_control.requesters[j] = NULL; 1879 + ihost->power_control.phys_waiting--; 1880 + sci_phy_consume_power_handler(requester); 1881 + } 1882 + } 1883 + } 1884 + } 1908 1885 } 1909 1886 1910 1887 /* ··· 1964 1891 ihost->power_control.timer_started = true; 1965 1892 1966 1893 } else { 1967 - /* Add the phy in the waiting list */ 1968 - ihost->power_control.requesters[iphy->phy_index] = iphy; 1969 - ihost->power_control.phys_waiting++; 1894 + /* 1895 + * There are phys, attached to the same sas address as this phy, are 1896 + * already in READY state, this phy don't need wait. 1897 + */ 1898 + u8 i; 1899 + struct isci_phy *current_phy; 1900 + 1901 + for (i = 0; i < SCI_MAX_PHYS; i++) { 1902 + u8 other; 1903 + current_phy = &ihost->phys[i]; 1904 + 1905 + other = memcmp(current_phy->frame_rcvd.iaf.sas_addr, 1906 + iphy->frame_rcvd.iaf.sas_addr, 1907 + sizeof(current_phy->frame_rcvd.iaf.sas_addr)); 1908 + 1909 + if (current_phy->sm.current_state_id == SCI_PHY_READY && 1910 + current_phy->protocol == SCIC_SDS_PHY_PROTOCOL_SAS && 1911 + other == 0) { 1912 + sci_phy_consume_power_handler(iphy); 1913 + break; 1914 + } 1915 + } 1916 + 1917 + if (i == SCI_MAX_PHYS) { 1918 + /* Add the phy in the waiting list */ 1919 + ihost->power_control.requesters[iphy->phy_index] = iphy; 1920 + ihost->power_control.phys_waiting++; 1921 + } 1970 1922 } 1971 1923 } 1972 1924 ··· 2006 1908 ihost->power_control.requesters[iphy->phy_index] = NULL; 2007 1909 } 2008 1910 1911 + static int is_long_cable(int phy, unsigned char selection_byte) 1912 + { 1913 + return !!(selection_byte & (1 << phy)); 1914 + } 1915 + 1916 + static int is_medium_cable(int phy, unsigned char selection_byte) 1917 + { 1918 + return !!(selection_byte & (1 << (phy + 4))); 1919 + } 1920 + 1921 + static enum cable_selections decode_selection_byte( 1922 + int phy, 1923 + unsigned char selection_byte) 1924 + { 1925 + return ((selection_byte & (1 << phy)) ? 1 : 0) 1926 + + (selection_byte & (1 << (phy + 4)) ? 2 : 0); 1927 + } 1928 + 1929 + static unsigned char *to_cable_select(struct isci_host *ihost) 1930 + { 1931 + if (is_cable_select_overridden()) 1932 + return ((unsigned char *)&cable_selection_override) 1933 + + ihost->id; 1934 + else 1935 + return &ihost->oem_parameters.controller.cable_selection_mask; 1936 + } 1937 + 1938 + enum cable_selections decode_cable_selection(struct isci_host *ihost, int phy) 1939 + { 1940 + return decode_selection_byte(phy, *to_cable_select(ihost)); 1941 + } 1942 + 1943 + char *lookup_cable_names(enum cable_selections selection) 1944 + { 1945 + static char *cable_names[] = { 1946 + [short_cable] = "short", 1947 + [long_cable] = "long", 1948 + [medium_cable] = "medium", 1949 + [undefined_cable] = "<undefined, assumed long>" /* bit 0==1 */ 1950 + }; 1951 + return (selection <= undefined_cable) ? cable_names[selection] 1952 + : cable_names[undefined_cable]; 1953 + } 1954 + 2009 1955 #define AFE_REGISTER_WRITE_DELAY 10 2010 1956 2011 - /* Initialize the AFE for this phy index. We need to read the AFE setup from 2012 - * the OEM parameters 2013 - */ 2014 1957 static void sci_controller_afe_initialization(struct isci_host *ihost) 2015 1958 { 1959 + struct scu_afe_registers __iomem *afe = &ihost->scu_registers->afe; 2016 1960 const struct sci_oem_params *oem = &ihost->oem_parameters; 2017 1961 struct pci_dev *pdev = ihost->pdev; 2018 1962 u32 afe_status; 2019 1963 u32 phy_id; 1964 + unsigned char cable_selection_mask = *to_cable_select(ihost); 2020 1965 2021 1966 /* Clear DFX Status registers */ 2022 - writel(0x0081000f, &ihost->scu_registers->afe.afe_dfx_master_control0); 1967 + writel(0x0081000f, &afe->afe_dfx_master_control0); 2023 1968 udelay(AFE_REGISTER_WRITE_DELAY); 2024 1969 2025 - if (is_b0(pdev)) { 1970 + if (is_b0(pdev) || is_c0(pdev) || is_c1(pdev)) { 2026 1971 /* PM Rx Equalization Save, PM SPhy Rx Acknowledgement 2027 - * Timer, PM Stagger Timer */ 2028 - writel(0x0007BFFF, &ihost->scu_registers->afe.afe_pmsn_master_control2); 1972 + * Timer, PM Stagger Timer 1973 + */ 1974 + writel(0x0007FFFF, &afe->afe_pmsn_master_control2); 2029 1975 udelay(AFE_REGISTER_WRITE_DELAY); 2030 1976 } 2031 1977 2032 1978 /* Configure bias currents to normal */ 2033 1979 if (is_a2(pdev)) 2034 - writel(0x00005A00, &ihost->scu_registers->afe.afe_bias_control); 1980 + writel(0x00005A00, &afe->afe_bias_control); 2035 1981 else if (is_b0(pdev) || is_c0(pdev)) 2036 - writel(0x00005F00, &ihost->scu_registers->afe.afe_bias_control); 1982 + writel(0x00005F00, &afe->afe_bias_control); 1983 + else if (is_c1(pdev)) 1984 + writel(0x00005500, &afe->afe_bias_control); 2037 1985 2038 1986 udelay(AFE_REGISTER_WRITE_DELAY); 2039 1987 2040 1988 /* Enable PLL */ 2041 - if (is_b0(pdev) || is_c0(pdev)) 2042 - writel(0x80040A08, &ihost->scu_registers->afe.afe_pll_control0); 2043 - else 2044 - writel(0x80040908, &ihost->scu_registers->afe.afe_pll_control0); 1989 + if (is_a2(pdev)) 1990 + writel(0x80040908, &afe->afe_pll_control0); 1991 + else if (is_b0(pdev) || is_c0(pdev)) 1992 + writel(0x80040A08, &afe->afe_pll_control0); 1993 + else if (is_c1(pdev)) { 1994 + writel(0x80000B08, &afe->afe_pll_control0); 1995 + udelay(AFE_REGISTER_WRITE_DELAY); 1996 + writel(0x00000B08, &afe->afe_pll_control0); 1997 + udelay(AFE_REGISTER_WRITE_DELAY); 1998 + writel(0x80000B08, &afe->afe_pll_control0); 1999 + } 2045 2000 2046 2001 udelay(AFE_REGISTER_WRITE_DELAY); 2047 2002 2048 2003 /* Wait for the PLL to lock */ 2049 2004 do { 2050 - afe_status = readl(&ihost->scu_registers->afe.afe_common_block_status); 2005 + afe_status = readl(&afe->afe_common_block_status); 2051 2006 udelay(AFE_REGISTER_WRITE_DELAY); 2052 2007 } while ((afe_status & 0x00001000) == 0); 2053 2008 2054 2009 if (is_a2(pdev)) { 2055 - /* Shorten SAS SNW lock time (RxLock timer value from 76 us to 50 us) */ 2056 - writel(0x7bcc96ad, &ihost->scu_registers->afe.afe_pmsn_master_control0); 2010 + /* Shorten SAS SNW lock time (RxLock timer value from 76 2011 + * us to 50 us) 2012 + */ 2013 + writel(0x7bcc96ad, &afe->afe_pmsn_master_control0); 2057 2014 udelay(AFE_REGISTER_WRITE_DELAY); 2058 2015 } 2059 2016 2060 2017 for (phy_id = 0; phy_id < SCI_MAX_PHYS; phy_id++) { 2018 + struct scu_afe_transceiver *xcvr = &afe->scu_afe_xcvr[phy_id]; 2061 2019 const struct sci_phy_oem_params *oem_phy = &oem->phys[phy_id]; 2020 + int cable_length_long = 2021 + is_long_cable(phy_id, cable_selection_mask); 2022 + int cable_length_medium = 2023 + is_medium_cable(phy_id, cable_selection_mask); 2062 2024 2063 - if (is_b0(pdev)) { 2064 - /* Configure transmitter SSC parameters */ 2065 - writel(0x00030000, &ihost->scu_registers->afe.scu_afe_xcvr[phy_id].afe_tx_ssc_control); 2025 + if (is_a2(pdev)) { 2026 + /* All defaults, except the Receive Word 2027 + * Alignament/Comma Detect Enable....(0xe800) 2028 + */ 2029 + writel(0x00004512, &xcvr->afe_xcvr_control0); 2030 + udelay(AFE_REGISTER_WRITE_DELAY); 2031 + 2032 + writel(0x0050100F, &xcvr->afe_xcvr_control1); 2033 + udelay(AFE_REGISTER_WRITE_DELAY); 2034 + } else if (is_b0(pdev)) { 2035 + /* Configure transmitter SSC parameters */ 2036 + writel(0x00030000, &xcvr->afe_tx_ssc_control); 2066 2037 udelay(AFE_REGISTER_WRITE_DELAY); 2067 2038 } else if (is_c0(pdev)) { 2068 - /* Configure transmitter SSC parameters */ 2069 - writel(0x0003000, &ihost->scu_registers->afe.scu_afe_xcvr[phy_id].afe_tx_ssc_control); 2039 + /* Configure transmitter SSC parameters */ 2040 + writel(0x00010202, &xcvr->afe_tx_ssc_control); 2070 2041 udelay(AFE_REGISTER_WRITE_DELAY); 2071 2042 2072 - /* 2073 - * All defaults, except the Receive Word Alignament/Comma Detect 2074 - * Enable....(0xe800) */ 2075 - writel(0x00004500, &ihost->scu_registers->afe.scu_afe_xcvr[phy_id].afe_xcvr_control0); 2043 + /* All defaults, except the Receive Word 2044 + * Alignament/Comma Detect Enable....(0xe800) 2045 + */ 2046 + writel(0x00014500, &xcvr->afe_xcvr_control0); 2076 2047 udelay(AFE_REGISTER_WRITE_DELAY); 2077 - } else { 2078 - /* 2079 - * All defaults, except the Receive Word Alignament/Comma Detect 2080 - * Enable....(0xe800) */ 2081 - writel(0x00004512, &ihost->scu_registers->afe.scu_afe_xcvr[phy_id].afe_xcvr_control0); 2048 + } else if (is_c1(pdev)) { 2049 + /* Configure transmitter SSC parameters */ 2050 + writel(0x00010202, &xcvr->afe_tx_ssc_control); 2082 2051 udelay(AFE_REGISTER_WRITE_DELAY); 2083 2052 2084 - writel(0x0050100F, &ihost->scu_registers->afe.scu_afe_xcvr[phy_id].afe_xcvr_control1); 2053 + /* All defaults, except the Receive Word 2054 + * Alignament/Comma Detect Enable....(0xe800) 2055 + */ 2056 + writel(0x0001C500, &xcvr->afe_xcvr_control0); 2085 2057 udelay(AFE_REGISTER_WRITE_DELAY); 2086 2058 } 2087 2059 2088 - /* 2089 - * Power up TX and RX out from power down (PWRDNTX and PWRDNRX) 2090 - * & increase TX int & ext bias 20%....(0xe85c) */ 2060 + /* Power up TX and RX out from power down (PWRDNTX and 2061 + * PWRDNRX) & increase TX int & ext bias 20%....(0xe85c) 2062 + */ 2091 2063 if (is_a2(pdev)) 2092 - writel(0x000003F0, &ihost->scu_registers->afe.scu_afe_xcvr[phy_id].afe_channel_control); 2064 + writel(0x000003F0, &xcvr->afe_channel_control); 2093 2065 else if (is_b0(pdev)) { 2094 - /* Power down TX and RX (PWRDNTX and PWRDNRX) */ 2095 - writel(0x000003D7, &ihost->scu_registers->afe.scu_afe_xcvr[phy_id].afe_channel_control); 2066 + writel(0x000003D7, &xcvr->afe_channel_control); 2096 2067 udelay(AFE_REGISTER_WRITE_DELAY); 2097 2068 2098 - /* 2099 - * Power up TX and RX out from power down (PWRDNTX and PWRDNRX) 2100 - * & increase TX int & ext bias 20%....(0xe85c) */ 2101 - writel(0x000003D4, &ihost->scu_registers->afe.scu_afe_xcvr[phy_id].afe_channel_control); 2102 - } else { 2103 - writel(0x000001E7, &ihost->scu_registers->afe.scu_afe_xcvr[phy_id].afe_channel_control); 2069 + writel(0x000003D4, &xcvr->afe_channel_control); 2070 + } else if (is_c0(pdev)) { 2071 + writel(0x000001E7, &xcvr->afe_channel_control); 2104 2072 udelay(AFE_REGISTER_WRITE_DELAY); 2105 2073 2106 - /* 2107 - * Power up TX and RX out from power down (PWRDNTX and PWRDNRX) 2108 - * & increase TX int & ext bias 20%....(0xe85c) */ 2109 - writel(0x000001E4, &ihost->scu_registers->afe.scu_afe_xcvr[phy_id].afe_channel_control); 2074 + writel(0x000001E4, &xcvr->afe_channel_control); 2075 + } else if (is_c1(pdev)) { 2076 + writel(cable_length_long ? 0x000002F7 : 0x000001F7, 2077 + &xcvr->afe_channel_control); 2078 + udelay(AFE_REGISTER_WRITE_DELAY); 2079 + 2080 + writel(cable_length_long ? 0x000002F4 : 0x000001F4, 2081 + &xcvr->afe_channel_control); 2110 2082 } 2111 2083 udelay(AFE_REGISTER_WRITE_DELAY); 2112 2084 2113 2085 if (is_a2(pdev)) { 2114 2086 /* Enable TX equalization (0xe824) */ 2115 - writel(0x00040000, &ihost->scu_registers->afe.scu_afe_xcvr[phy_id].afe_tx_control); 2087 + writel(0x00040000, &xcvr->afe_tx_control); 2116 2088 udelay(AFE_REGISTER_WRITE_DELAY); 2117 2089 } 2118 2090 2119 - /* 2120 - * RDPI=0x0(RX Power On), RXOOBDETPDNC=0x0, TPD=0x0(TX Power On), 2121 - * RDD=0x0(RX Detect Enabled) ....(0xe800) */ 2122 - writel(0x00004100, &ihost->scu_registers->afe.scu_afe_xcvr[phy_id].afe_xcvr_control0); 2091 + if (is_a2(pdev) || is_b0(pdev)) 2092 + /* RDPI=0x0(RX Power On), RXOOBDETPDNC=0x0, 2093 + * TPD=0x0(TX Power On), RDD=0x0(RX Detect 2094 + * Enabled) ....(0xe800) 2095 + */ 2096 + writel(0x00004100, &xcvr->afe_xcvr_control0); 2097 + else if (is_c0(pdev)) 2098 + writel(0x00014100, &xcvr->afe_xcvr_control0); 2099 + else if (is_c1(pdev)) 2100 + writel(0x0001C100, &xcvr->afe_xcvr_control0); 2123 2101 udelay(AFE_REGISTER_WRITE_DELAY); 2124 2102 2125 2103 /* Leave DFE/FFE on */ 2126 2104 if (is_a2(pdev)) 2127 - writel(0x3F11103F, &ihost->scu_registers->afe.scu_afe_xcvr[phy_id].afe_rx_ssc_control0); 2105 + writel(0x3F11103F, &xcvr->afe_rx_ssc_control0); 2128 2106 else if (is_b0(pdev)) { 2129 - writel(0x3F11103F, &ihost->scu_registers->afe.scu_afe_xcvr[phy_id].afe_rx_ssc_control0); 2107 + writel(0x3F11103F, &xcvr->afe_rx_ssc_control0); 2130 2108 udelay(AFE_REGISTER_WRITE_DELAY); 2131 2109 /* Enable TX equalization (0xe824) */ 2132 - writel(0x00040000, &ihost->scu_registers->afe.scu_afe_xcvr[phy_id].afe_tx_control); 2133 - } else { 2134 - writel(0x0140DF0F, &ihost->scu_registers->afe.scu_afe_xcvr[phy_id].afe_rx_ssc_control1); 2110 + writel(0x00040000, &xcvr->afe_tx_control); 2111 + } else if (is_c0(pdev)) { 2112 + writel(0x01400C0F, &xcvr->afe_rx_ssc_control1); 2135 2113 udelay(AFE_REGISTER_WRITE_DELAY); 2136 2114 2137 - writel(0x3F6F103F, &ihost->scu_registers->afe.scu_afe_xcvr[phy_id].afe_rx_ssc_control0); 2115 + writel(0x3F6F103F, &xcvr->afe_rx_ssc_control0); 2138 2116 udelay(AFE_REGISTER_WRITE_DELAY); 2139 2117 2140 2118 /* Enable TX equalization (0xe824) */ 2141 - writel(0x00040000, &ihost->scu_registers->afe.scu_afe_xcvr[phy_id].afe_tx_control); 2119 + writel(0x00040000, &xcvr->afe_tx_control); 2120 + } else if (is_c1(pdev)) { 2121 + writel(cable_length_long ? 0x01500C0C : 2122 + cable_length_medium ? 0x01400C0D : 0x02400C0D, 2123 + &xcvr->afe_xcvr_control1); 2124 + udelay(AFE_REGISTER_WRITE_DELAY); 2125 + 2126 + writel(0x000003E0, &xcvr->afe_dfx_rx_control1); 2127 + udelay(AFE_REGISTER_WRITE_DELAY); 2128 + 2129 + writel(cable_length_long ? 0x33091C1F : 2130 + cable_length_medium ? 0x3315181F : 0x2B17161F, 2131 + &xcvr->afe_rx_ssc_control0); 2132 + udelay(AFE_REGISTER_WRITE_DELAY); 2133 + 2134 + /* Enable TX equalization (0xe824) */ 2135 + writel(0x00040000, &xcvr->afe_tx_control); 2142 2136 } 2143 2137 2144 2138 udelay(AFE_REGISTER_WRITE_DELAY); 2145 2139 2146 - writel(oem_phy->afe_tx_amp_control0, 2147 - &ihost->scu_registers->afe.scu_afe_xcvr[phy_id].afe_tx_amp_control0); 2140 + writel(oem_phy->afe_tx_amp_control0, &xcvr->afe_tx_amp_control0); 2148 2141 udelay(AFE_REGISTER_WRITE_DELAY); 2149 2142 2150 - writel(oem_phy->afe_tx_amp_control1, 2151 - &ihost->scu_registers->afe.scu_afe_xcvr[phy_id].afe_tx_amp_control1); 2143 + writel(oem_phy->afe_tx_amp_control1, &xcvr->afe_tx_amp_control1); 2152 2144 udelay(AFE_REGISTER_WRITE_DELAY); 2153 2145 2154 - writel(oem_phy->afe_tx_amp_control2, 2155 - &ihost->scu_registers->afe.scu_afe_xcvr[phy_id].afe_tx_amp_control2); 2146 + writel(oem_phy->afe_tx_amp_control2, &xcvr->afe_tx_amp_control2); 2156 2147 udelay(AFE_REGISTER_WRITE_DELAY); 2157 2148 2158 - writel(oem_phy->afe_tx_amp_control3, 2159 - &ihost->scu_registers->afe.scu_afe_xcvr[phy_id].afe_tx_amp_control3); 2149 + writel(oem_phy->afe_tx_amp_control3, &xcvr->afe_tx_amp_control3); 2160 2150 udelay(AFE_REGISTER_WRITE_DELAY); 2161 2151 } 2162 2152 2163 2153 /* Transfer control to the PEs */ 2164 - writel(0x00010f00, &ihost->scu_registers->afe.afe_dfx_master_control0); 2154 + writel(0x00010f00, &afe->afe_dfx_master_control0); 2165 2155 udelay(AFE_REGISTER_WRITE_DELAY); 2166 2156 } 2167 2157
+26 -1
drivers/scsi/isci/host.h
··· 435 435 436 436 static inline bool is_c0(struct pci_dev *pdev) 437 437 { 438 - if (pdev->revision >= 5) 438 + if (pdev->revision == 5) 439 439 return true; 440 440 return false; 441 441 } 442 + 443 + static inline bool is_c1(struct pci_dev *pdev) 444 + { 445 + if (pdev->revision >= 6) 446 + return true; 447 + return false; 448 + } 449 + 450 + enum cable_selections { 451 + short_cable = 0, 452 + long_cable = 1, 453 + medium_cable = 2, 454 + undefined_cable = 3 455 + }; 456 + 457 + #define CABLE_OVERRIDE_DISABLED (0x10000) 458 + 459 + static inline int is_cable_select_overridden(void) 460 + { 461 + return cable_selection_override < CABLE_OVERRIDE_DISABLED; 462 + } 463 + 464 + enum cable_selections decode_cable_selection(struct isci_host *ihost, int phy); 465 + void validate_cable_selections(struct isci_host *ihost); 466 + char *lookup_cable_names(enum cable_selections); 442 467 443 468 /* set hw control for 'activity', even though active enclosures seem to drive 444 469 * the activity led on their own. Skip setting FSENG control on 'status' due
+21 -4
drivers/scsi/isci/init.c
··· 65 65 #include "probe_roms.h" 66 66 67 67 #define MAJ 1 68 - #define MIN 0 68 + #define MIN 1 69 69 #define BUILD 0 70 70 #define DRV_VERSION __stringify(MAJ) "." __stringify(MIN) "." \ 71 71 __stringify(BUILD) ··· 94 94 95 95 /* linux isci specific settings */ 96 96 97 - unsigned char no_outbound_task_to = 20; 97 + unsigned char no_outbound_task_to = 2; 98 98 module_param(no_outbound_task_to, byte, 0); 99 99 MODULE_PARM_DESC(no_outbound_task_to, "No Outbound Task Timeout (1us incr)"); 100 100 ··· 114 114 module_param(stp_inactive_to, ushort, 0); 115 115 MODULE_PARM_DESC(stp_inactive_to, "STP inactivity timeout (100us incr)"); 116 116 117 - unsigned char phy_gen = 3; 117 + unsigned char phy_gen = SCIC_SDS_PARM_GEN2_SPEED; 118 118 module_param(phy_gen, byte, 0); 119 119 MODULE_PARM_DESC(phy_gen, "PHY generation (1: 1.5Gbps 2: 3.0Gbps 3: 6.0Gbps)"); 120 120 121 121 unsigned char max_concurr_spinup; 122 122 module_param(max_concurr_spinup, byte, 0); 123 123 MODULE_PARM_DESC(max_concurr_spinup, "Max concurrent device spinup"); 124 + 125 + uint cable_selection_override = CABLE_OVERRIDE_DISABLED; 126 + module_param(cable_selection_override, uint, 0); 127 + 128 + MODULE_PARM_DESC(cable_selection_override, 129 + "This field indicates length of the SAS/SATA cable between " 130 + "host and device. If any bits > 15 are set (default) " 131 + "indicates \"use platform defaults\""); 124 132 125 133 static ssize_t isci_show_id(struct device *dev, struct device_attribute *attr, char *buf) 126 134 { ··· 420 412 return NULL; 421 413 isci_host->shost = shost; 422 414 415 + dev_info(&pdev->dev, "%sSCU controller %d: phy 3-0 cables: " 416 + "{%s, %s, %s, %s}\n", 417 + (is_cable_select_overridden() ? "* " : ""), isci_host->id, 418 + lookup_cable_names(decode_cable_selection(isci_host, 3)), 419 + lookup_cable_names(decode_cable_selection(isci_host, 2)), 420 + lookup_cable_names(decode_cable_selection(isci_host, 1)), 421 + lookup_cable_names(decode_cable_selection(isci_host, 0))); 422 + 423 423 err = isci_host_init(isci_host); 424 424 if (err) 425 425 goto err_shost; ··· 482 466 orom = isci_request_oprom(pdev); 483 467 484 468 for (i = 0; orom && i < ARRAY_SIZE(orom->ctrl); i++) { 485 - if (sci_oem_parameters_validate(&orom->ctrl[i])) { 469 + if (sci_oem_parameters_validate(&orom->ctrl[i], 470 + orom->hdr.version)) { 486 471 dev_warn(&pdev->dev, 487 472 "[%d]: invalid oem parameters detected, falling back to firmware\n", i); 488 473 devm_kfree(&pdev->dev, orom);
+1
drivers/scsi/isci/isci.h
··· 480 480 extern u16 stp_inactive_to; 481 481 extern unsigned char phy_gen; 482 482 extern unsigned char max_concurr_spinup; 483 + extern uint cable_selection_override; 483 484 484 485 irqreturn_t isci_msix_isr(int vec, void *data); 485 486 irqreturn_t isci_intx_isr(int vec, void *data);
+110 -60
drivers/scsi/isci/phy.c
··· 91 91 92 92 static enum sci_status 93 93 sci_phy_link_layer_initialization(struct isci_phy *iphy, 94 - struct scu_link_layer_registers __iomem *reg) 94 + struct scu_link_layer_registers __iomem *llr) 95 95 { 96 96 struct isci_host *ihost = iphy->owning_port->owning_controller; 97 + struct sci_phy_user_params *phy_user; 98 + struct sci_phy_oem_params *phy_oem; 97 99 int phy_idx = iphy->phy_index; 98 - struct sci_phy_user_params *phy_user = &ihost->user_parameters.phys[phy_idx]; 99 - struct sci_phy_oem_params *phy_oem = 100 - &ihost->oem_parameters.phys[phy_idx]; 101 - u32 phy_configuration; 102 100 struct sci_phy_cap phy_cap; 101 + u32 phy_configuration; 103 102 u32 parity_check = 0; 104 103 u32 parity_count = 0; 105 104 u32 llctl, link_rate; 106 105 u32 clksm_value = 0; 107 106 u32 sp_timeouts = 0; 108 107 109 - iphy->link_layer_registers = reg; 108 + phy_user = &ihost->user_parameters.phys[phy_idx]; 109 + phy_oem = &ihost->oem_parameters.phys[phy_idx]; 110 + iphy->link_layer_registers = llr; 110 111 111 112 /* Set our IDENTIFY frame data */ 112 113 #define SCI_END_DEVICE 0x01 ··· 117 116 SCU_SAS_TIID_GEN_BIT(STP_INITIATOR) | 118 117 SCU_SAS_TIID_GEN_BIT(DA_SATA_HOST) | 119 118 SCU_SAS_TIID_GEN_VAL(DEVICE_TYPE, SCI_END_DEVICE), 120 - &iphy->link_layer_registers->transmit_identification); 119 + &llr->transmit_identification); 121 120 122 121 /* Write the device SAS Address */ 123 - writel(0xFEDCBA98, 124 - &iphy->link_layer_registers->sas_device_name_high); 125 - writel(phy_idx, &iphy->link_layer_registers->sas_device_name_low); 122 + writel(0xFEDCBA98, &llr->sas_device_name_high); 123 + writel(phy_idx, &llr->sas_device_name_low); 126 124 127 125 /* Write the source SAS Address */ 128 - writel(phy_oem->sas_address.high, 129 - &iphy->link_layer_registers->source_sas_address_high); 130 - writel(phy_oem->sas_address.low, 131 - &iphy->link_layer_registers->source_sas_address_low); 126 + writel(phy_oem->sas_address.high, &llr->source_sas_address_high); 127 + writel(phy_oem->sas_address.low, &llr->source_sas_address_low); 132 128 133 129 /* Clear and Set the PHY Identifier */ 134 - writel(0, &iphy->link_layer_registers->identify_frame_phy_id); 135 - writel(SCU_SAS_TIPID_GEN_VALUE(ID, phy_idx), 136 - &iphy->link_layer_registers->identify_frame_phy_id); 130 + writel(0, &llr->identify_frame_phy_id); 131 + writel(SCU_SAS_TIPID_GEN_VALUE(ID, phy_idx), &llr->identify_frame_phy_id); 137 132 138 133 /* Change the initial state of the phy configuration register */ 139 - phy_configuration = 140 - readl(&iphy->link_layer_registers->phy_configuration); 134 + phy_configuration = readl(&llr->phy_configuration); 141 135 142 136 /* Hold OOB state machine in reset */ 143 137 phy_configuration |= SCU_SAS_PCFG_GEN_BIT(OOB_RESET); 144 - writel(phy_configuration, 145 - &iphy->link_layer_registers->phy_configuration); 138 + writel(phy_configuration, &llr->phy_configuration); 146 139 147 140 /* Configure the SNW capabilities */ 148 141 phy_cap.all = 0; ··· 144 149 phy_cap.gen3_no_ssc = 1; 145 150 phy_cap.gen2_no_ssc = 1; 146 151 phy_cap.gen1_no_ssc = 1; 147 - if (ihost->oem_parameters.controller.do_enable_ssc == true) { 152 + if (ihost->oem_parameters.controller.do_enable_ssc) { 153 + struct scu_afe_registers __iomem *afe = &ihost->scu_registers->afe; 154 + struct scu_afe_transceiver *xcvr = &afe->scu_afe_xcvr[phy_idx]; 155 + struct isci_pci_info *pci_info = to_pci_info(ihost->pdev); 156 + bool en_sas = false; 157 + bool en_sata = false; 158 + u32 sas_type = 0; 159 + u32 sata_spread = 0x2; 160 + u32 sas_spread = 0x2; 161 + 148 162 phy_cap.gen3_ssc = 1; 149 163 phy_cap.gen2_ssc = 1; 150 164 phy_cap.gen1_ssc = 1; 165 + 166 + if (pci_info->orom->hdr.version < ISCI_ROM_VER_1_1) 167 + en_sas = en_sata = true; 168 + else { 169 + sata_spread = ihost->oem_parameters.controller.ssc_sata_tx_spread_level; 170 + sas_spread = ihost->oem_parameters.controller.ssc_sas_tx_spread_level; 171 + 172 + if (sata_spread) 173 + en_sata = true; 174 + 175 + if (sas_spread) { 176 + en_sas = true; 177 + sas_type = ihost->oem_parameters.controller.ssc_sas_tx_type; 178 + } 179 + 180 + } 181 + 182 + if (en_sas) { 183 + u32 reg; 184 + 185 + reg = readl(&xcvr->afe_xcvr_control0); 186 + reg |= (0x00100000 | (sas_type << 19)); 187 + writel(reg, &xcvr->afe_xcvr_control0); 188 + 189 + reg = readl(&xcvr->afe_tx_ssc_control); 190 + reg |= sas_spread << 8; 191 + writel(reg, &xcvr->afe_tx_ssc_control); 192 + } 193 + 194 + if (en_sata) { 195 + u32 reg; 196 + 197 + reg = readl(&xcvr->afe_tx_ssc_control); 198 + reg |= sata_spread; 199 + writel(reg, &xcvr->afe_tx_ssc_control); 200 + 201 + reg = readl(&llr->stp_control); 202 + reg |= 1 << 12; 203 + writel(reg, &llr->stp_control); 204 + } 151 205 } 152 206 153 - /* 154 - * The SAS specification indicates that the phy_capabilities that 155 - * are transmitted shall have an even parity. Calculate the parity. */ 207 + /* The SAS specification indicates that the phy_capabilities that 208 + * are transmitted shall have an even parity. Calculate the parity. 209 + */ 156 210 parity_check = phy_cap.all; 157 211 while (parity_check != 0) { 158 212 if (parity_check & 0x1) ··· 209 165 parity_check >>= 1; 210 166 } 211 167 212 - /* 213 - * If parity indicates there are an odd number of bits set, then 214 - * set the parity bit to 1 in the phy capabilities. */ 168 + /* If parity indicates there are an odd number of bits set, then 169 + * set the parity bit to 1 in the phy capabilities. 170 + */ 215 171 if ((parity_count % 2) != 0) 216 172 phy_cap.parity = 1; 217 173 218 - writel(phy_cap.all, &iphy->link_layer_registers->phy_capabilities); 174 + writel(phy_cap.all, &llr->phy_capabilities); 219 175 220 176 /* Set the enable spinup period but disable the ability to send 221 177 * notify enable spinup 222 178 */ 223 179 writel(SCU_ENSPINUP_GEN_VAL(COUNT, 224 180 phy_user->notify_enable_spin_up_insertion_frequency), 225 - &iphy->link_layer_registers->notify_enable_spinup_control); 181 + &llr->notify_enable_spinup_control); 226 182 227 183 /* Write the ALIGN Insertion Ferequency for connected phy and 228 184 * inpendent of connected state ··· 233 189 clksm_value |= SCU_ALIGN_INSERTION_FREQUENCY_GEN_VAL(GENERAL, 234 190 phy_user->align_insertion_frequency); 235 191 236 - writel(clksm_value, &iphy->link_layer_registers->clock_skew_management); 192 + writel(clksm_value, &llr->clock_skew_management); 237 193 238 - /* @todo Provide a way to write this register correctly */ 239 - writel(0x02108421, 240 - &iphy->link_layer_registers->afe_lookup_table_control); 194 + if (is_c0(ihost->pdev) || is_c1(ihost->pdev)) { 195 + writel(0x04210400, &llr->afe_lookup_table_control); 196 + writel(0x020A7C05, &llr->sas_primitive_timeout); 197 + } else 198 + writel(0x02108421, &llr->afe_lookup_table_control); 241 199 242 200 llctl = SCU_SAS_LLCTL_GEN_VAL(NO_OUTBOUND_TASK_TIMEOUT, 243 201 (u8)ihost->user_parameters.no_outbound_task_timeout); ··· 256 210 break; 257 211 } 258 212 llctl |= SCU_SAS_LLCTL_GEN_VAL(MAX_LINK_RATE, link_rate); 259 - writel(llctl, &iphy->link_layer_registers->link_layer_control); 213 + writel(llctl, &llr->link_layer_control); 260 214 261 - sp_timeouts = readl(&iphy->link_layer_registers->sas_phy_timeouts); 215 + sp_timeouts = readl(&llr->sas_phy_timeouts); 262 216 263 217 /* Clear the default 0x36 (54us) RATE_CHANGE timeout value. */ 264 218 sp_timeouts &= ~SCU_SAS_PHYTOV_GEN_VAL(RATE_CHANGE, 0xFF); ··· 268 222 */ 269 223 sp_timeouts |= SCU_SAS_PHYTOV_GEN_VAL(RATE_CHANGE, 0x3B); 270 224 271 - writel(sp_timeouts, &iphy->link_layer_registers->sas_phy_timeouts); 225 + writel(sp_timeouts, &llr->sas_phy_timeouts); 272 226 273 227 if (is_a2(ihost->pdev)) { 274 - /* Program the max ARB time for the PHY to 700us so we inter-operate with 275 - * the PMC expander which shuts down PHYs if the expander PHY generates too 276 - * many breaks. This time value will guarantee that the initiator PHY will 277 - * generate the break. 228 + /* Program the max ARB time for the PHY to 700us so we 229 + * inter-operate with the PMC expander which shuts down 230 + * PHYs if the expander PHY generates too many breaks. 231 + * This time value will guarantee that the initiator PHY 232 + * will generate the break. 278 233 */ 279 234 writel(SCIC_SDS_PHY_MAX_ARBITRATION_WAIT_TIME, 280 - &iphy->link_layer_registers->maximum_arbitration_wait_timer_timeout); 235 + &llr->maximum_arbitration_wait_timer_timeout); 281 236 } 282 237 283 - /* Disable link layer hang detection, rely on the OS timeout for I/O timeouts. */ 284 - writel(0, &iphy->link_layer_registers->link_layer_hang_detection_timeout); 238 + /* Disable link layer hang detection, rely on the OS timeout for 239 + * I/O timeouts. 240 + */ 241 + writel(0, &llr->link_layer_hang_detection_timeout); 285 242 286 243 /* We can exit the initial state to the stopped state */ 287 244 sci_change_state(&iphy->sm, SCI_PHY_STOPPED); ··· 1098 1049 writel(enable_spinup_value, &iphy->link_layer_registers->notify_enable_spinup_control); 1099 1050 } 1100 1051 1101 - /** 1102 - * 1103 - * 1104 - * This method will start the OOB/SN state machine for this struct isci_phy object. 1105 - */ 1106 - static void scu_link_layer_start_oob( 1107 - struct isci_phy *iphy) 1052 + static void scu_link_layer_start_oob(struct isci_phy *iphy) 1108 1053 { 1109 - u32 scu_sas_pcfg_value; 1054 + struct scu_link_layer_registers __iomem *ll = iphy->link_layer_registers; 1055 + u32 val; 1110 1056 1111 - scu_sas_pcfg_value = 1112 - readl(&iphy->link_layer_registers->phy_configuration); 1113 - scu_sas_pcfg_value |= SCU_SAS_PCFG_GEN_BIT(OOB_ENABLE); 1114 - scu_sas_pcfg_value &= 1115 - ~(SCU_SAS_PCFG_GEN_BIT(OOB_RESET) | 1116 - SCU_SAS_PCFG_GEN_BIT(HARD_RESET)); 1117 - writel(scu_sas_pcfg_value, 1118 - &iphy->link_layer_registers->phy_configuration); 1057 + /** Reset OOB sequence - start */ 1058 + val = readl(&ll->phy_configuration); 1059 + val &= ~(SCU_SAS_PCFG_GEN_BIT(OOB_RESET) | 1060 + SCU_SAS_PCFG_GEN_BIT(HARD_RESET)); 1061 + writel(val, &ll->phy_configuration); 1062 + readl(&ll->phy_configuration); /* flush */ 1063 + /** Reset OOB sequence - end */ 1064 + 1065 + /** Start OOB sequence - start */ 1066 + val = readl(&ll->phy_configuration); 1067 + val |= SCU_SAS_PCFG_GEN_BIT(OOB_ENABLE); 1068 + writel(val, &ll->phy_configuration); 1069 + readl(&ll->phy_configuration); /* flush */ 1070 + /** Start OOB sequence - end */ 1119 1071 } 1120 1072 1121 1073 /**
+58 -46
drivers/scsi/isci/port.c
··· 114 114 * value is returned if the specified port is not valid. When this value is 115 115 * returned, no data is copied to the properties output parameter. 116 116 */ 117 - static enum sci_status sci_port_get_properties(struct isci_port *iport, 117 + enum sci_status sci_port_get_properties(struct isci_port *iport, 118 118 struct sci_port_properties *prop) 119 119 { 120 120 if (!iport || iport->logical_port_index == SCIC_SDS_DUMMY_PORT) ··· 647 647 } 648 648 } 649 649 650 - static void sci_port_activate_phy(struct isci_port *iport, struct isci_phy *iphy, 651 - bool do_notify_user) 650 + static void sci_port_resume_phy(struct isci_port *iport, struct isci_phy *iphy) 651 + { 652 + sci_phy_resume(iphy); 653 + iport->enabled_phy_mask |= 1 << iphy->phy_index; 654 + } 655 + 656 + static void sci_port_activate_phy(struct isci_port *iport, 657 + struct isci_phy *iphy, 658 + u8 flags) 652 659 { 653 660 struct isci_host *ihost = iport->owning_controller; 654 661 655 - if (iphy->protocol != SCIC_SDS_PHY_PROTOCOL_SATA) 662 + if (iphy->protocol != SCIC_SDS_PHY_PROTOCOL_SATA && (flags & PF_RESUME)) 656 663 sci_phy_resume(iphy); 657 664 658 665 iport->active_phy_mask |= 1 << iphy->phy_index; 659 666 660 667 sci_controller_clear_invalid_phy(ihost, iphy); 661 668 662 - if (do_notify_user == true) 669 + if (flags & PF_NOTIFY) 663 670 isci_port_link_up(ihost, iport, iphy); 664 671 } 665 672 ··· 676 669 struct isci_host *ihost = iport->owning_controller; 677 670 678 671 iport->active_phy_mask &= ~(1 << iphy->phy_index); 672 + iport->enabled_phy_mask &= ~(1 << iphy->phy_index); 679 673 if (!iport->active_phy_mask) 680 674 iport->last_active_phy = iphy->phy_index; 681 675 682 676 iphy->max_negotiated_speed = SAS_LINK_RATE_UNKNOWN; 683 677 684 - /* Re-assign the phy back to the LP as if it were a narrow port */ 685 - writel(iphy->phy_index, 686 - &iport->port_pe_configuration_register[iphy->phy_index]); 678 + /* Re-assign the phy back to the LP as if it were a narrow port for APC 679 + * mode. For MPC mode, the phy will remain in the port. 680 + */ 681 + if (iport->owning_controller->oem_parameters.controller.mode_type == 682 + SCIC_PORT_AUTOMATIC_CONFIGURATION_MODE) 683 + writel(iphy->phy_index, 684 + &iport->port_pe_configuration_register[iphy->phy_index]); 687 685 688 686 if (do_notify_user == true) 689 687 isci_port_link_down(ihost, iphy, iport); ··· 713 701 * sci_port_general_link_up_handler - phy can be assigned to port? 714 702 * @sci_port: sci_port object for which has a phy that has gone link up. 715 703 * @sci_phy: This is the struct isci_phy object that has gone link up. 716 - * @do_notify_user: This parameter specifies whether to inform the user (via 717 - * sci_port_link_up()) as to the fact that a new phy as become ready. 704 + * @flags: PF_RESUME, PF_NOTIFY to sci_port_activate_phy 718 705 * 719 - * Determine if this phy can be assigned to this 720 - * port . If the phy is not a valid PHY for 721 - * this port then the function will notify the user. A PHY can only be 722 - * part of a port if it's attached SAS ADDRESS is the same as all other PHYs in 723 - * the same port. none 706 + * Determine if this phy can be assigned to this port . If the phy is 707 + * not a valid PHY for this port then the function will notify the user. 708 + * A PHY can only be part of a port if it's attached SAS ADDRESS is the 709 + * same as all other PHYs in the same port. 724 710 */ 725 711 static void sci_port_general_link_up_handler(struct isci_port *iport, 726 - struct isci_phy *iphy, 727 - bool do_notify_user) 712 + struct isci_phy *iphy, 713 + u8 flags) 728 714 { 729 715 struct sci_sas_address port_sas_address; 730 716 struct sci_sas_address phy_sas_address; ··· 740 730 iport->active_phy_mask == 0) { 741 731 struct sci_base_state_machine *sm = &iport->sm; 742 732 743 - sci_port_activate_phy(iport, iphy, do_notify_user); 733 + sci_port_activate_phy(iport, iphy, flags); 744 734 if (sm->current_state_id == SCI_PORT_RESETTING) 745 735 port_state_machine_change(iport, SCI_PORT_READY); 746 736 } else ··· 791 781 struct isci_phy *iphy) 792 782 { 793 783 if ((iport->logical_port_index != SCIC_SDS_DUMMY_PORT) && 794 - (iphy->protocol == SCIC_SDS_PHY_PROTOCOL_SATA) && 795 - sci_port_is_wide(iport)) { 796 - sci_port_invalid_link_up(iport, iphy); 797 - 798 - return false; 784 + (iphy->protocol == SCIC_SDS_PHY_PROTOCOL_SATA)) { 785 + if (sci_port_is_wide(iport)) { 786 + sci_port_invalid_link_up(iport, iphy); 787 + return false; 788 + } else { 789 + struct isci_host *ihost = iport->owning_controller; 790 + struct isci_port *dst_port = &(ihost->ports[iphy->phy_index]); 791 + writel(iphy->phy_index, 792 + &dst_port->port_pe_configuration_register[iphy->phy_index]); 793 + } 799 794 } 800 795 801 796 return true; ··· 990 975 } 991 976 } 992 977 978 + static void scic_sds_port_ready_substate_waiting_exit( 979 + struct sci_base_state_machine *sm) 980 + { 981 + struct isci_port *iport = container_of(sm, typeof(*iport), sm); 982 + sci_port_resume_port_task_scheduler(iport); 983 + } 984 + 993 985 static void sci_port_ready_substate_operational_enter(struct sci_base_state_machine *sm) 994 986 { 995 987 u32 index; ··· 1010 988 writel(iport->physical_port_index, 1011 989 &iport->port_pe_configuration_register[ 1012 990 iport->phy_table[index]->phy_index]); 991 + if (((iport->active_phy_mask^iport->enabled_phy_mask) & (1 << index)) != 0) 992 + sci_port_resume_phy(iport, iport->phy_table[index]); 1013 993 } 1014 994 } 1015 995 1016 996 sci_port_update_viit_entry(iport); 1017 - 1018 - sci_port_resume_port_task_scheduler(iport); 1019 997 1020 998 /* 1021 999 * Post the dummy task for the port so the hardware can schedule ··· 1083 1061 if (iport->active_phy_mask == 0) { 1084 1062 isci_port_not_ready(ihost, iport); 1085 1063 1086 - port_state_machine_change(iport, 1087 - SCI_PORT_SUB_WAITING); 1088 - } else if (iport->started_request_count == 0) 1089 - port_state_machine_change(iport, 1090 - SCI_PORT_SUB_OPERATIONAL); 1091 - } 1092 - 1093 - static void sci_port_ready_substate_configuring_exit(struct sci_base_state_machine *sm) 1094 - { 1095 - struct isci_port *iport = container_of(sm, typeof(*iport), sm); 1096 - 1097 - sci_port_suspend_port_task_scheduler(iport); 1098 - if (iport->ready_exit) 1099 - sci_port_invalidate_dummy_remote_node(iport); 1064 + port_state_machine_change(iport, SCI_PORT_SUB_WAITING); 1065 + } else 1066 + port_state_machine_change(iport, SCI_PORT_SUB_OPERATIONAL); 1100 1067 } 1101 1068 1102 1069 enum sci_status sci_port_start(struct isci_port *iport) ··· 1263 1252 if (status != SCI_SUCCESS) 1264 1253 return status; 1265 1254 1266 - sci_port_general_link_up_handler(iport, iphy, true); 1255 + sci_port_general_link_up_handler(iport, iphy, PF_NOTIFY|PF_RESUME); 1267 1256 iport->not_ready_reason = SCIC_PORT_NOT_READY_RECONFIGURING; 1268 1257 port_state_machine_change(iport, SCI_PORT_SUB_CONFIGURING); 1269 1258 ··· 1273 1262 1274 1263 if (status != SCI_SUCCESS) 1275 1264 return status; 1276 - sci_port_general_link_up_handler(iport, iphy, true); 1265 + sci_port_general_link_up_handler(iport, iphy, PF_NOTIFY); 1277 1266 1278 1267 /* Re-enter the configuring state since this may be the last phy in 1279 1268 * the port. ··· 1349 1338 /* Since this is the first phy going link up for the port we 1350 1339 * can just enable it and continue 1351 1340 */ 1352 - sci_port_activate_phy(iport, iphy, true); 1341 + sci_port_activate_phy(iport, iphy, PF_NOTIFY|PF_RESUME); 1353 1342 1354 1343 port_state_machine_change(iport, 1355 1344 SCI_PORT_SUB_OPERATIONAL); 1356 1345 return SCI_SUCCESS; 1357 1346 case SCI_PORT_SUB_OPERATIONAL: 1358 - sci_port_general_link_up_handler(iport, iphy, true); 1347 + sci_port_general_link_up_handler(iport, iphy, PF_NOTIFY|PF_RESUME); 1359 1348 return SCI_SUCCESS; 1360 1349 case SCI_PORT_RESETTING: 1361 1350 /* TODO We should make sure that the phy that has gone ··· 1372 1361 /* In the resetting state we don't notify the user regarding 1373 1362 * link up and link down notifications. 1374 1363 */ 1375 - sci_port_general_link_up_handler(iport, iphy, false); 1364 + sci_port_general_link_up_handler(iport, iphy, PF_RESUME); 1376 1365 return SCI_SUCCESS; 1377 1366 default: 1378 1367 dev_warn(sciport_to_dev(iport), ··· 1595 1584 }, 1596 1585 [SCI_PORT_SUB_WAITING] = { 1597 1586 .enter_state = sci_port_ready_substate_waiting_enter, 1587 + .exit_state = scic_sds_port_ready_substate_waiting_exit, 1598 1588 }, 1599 1589 [SCI_PORT_SUB_OPERATIONAL] = { 1600 1590 .enter_state = sci_port_ready_substate_operational_enter, 1601 1591 .exit_state = sci_port_ready_substate_operational_exit 1602 1592 }, 1603 1593 [SCI_PORT_SUB_CONFIGURING] = { 1604 - .enter_state = sci_port_ready_substate_configuring_enter, 1605 - .exit_state = sci_port_ready_substate_configuring_exit 1594 + .enter_state = sci_port_ready_substate_configuring_enter 1606 1595 }, 1607 1596 [SCI_PORT_RESETTING] = { 1608 1597 .exit_state = sci_port_resetting_state_exit ··· 1620 1609 iport->logical_port_index = SCIC_SDS_DUMMY_PORT; 1621 1610 iport->physical_port_index = index; 1622 1611 iport->active_phy_mask = 0; 1612 + iport->enabled_phy_mask = 0; 1623 1613 iport->last_active_phy = 0; 1624 1614 iport->ready_exit = false; 1625 1615
+10
drivers/scsi/isci/port.h
··· 63 63 64 64 #define SCIC_SDS_DUMMY_PORT 0xFF 65 65 66 + #define PF_NOTIFY (1 << 0) 67 + #define PF_RESUME (1 << 1) 68 + 66 69 struct isci_phy; 67 70 struct isci_host; 68 71 ··· 86 83 * @logical_port_index: software port index 87 84 * @physical_port_index: hardware port index 88 85 * @active_phy_mask: identifies phy members 86 + * @enabled_phy_mask: phy mask for the port 87 + * that are already part of the port 89 88 * @reserved_tag: 90 89 * @reserved_rni: reserver for port task scheduler workaround 91 90 * @started_request_count: reference count for outstanding commands ··· 109 104 u8 logical_port_index; 110 105 u8 physical_port_index; 111 106 u8 active_phy_mask; 107 + u8 enabled_phy_mask; 112 108 u8 last_active_phy; 113 109 u16 reserved_rni; 114 110 u16 reserved_tag; ··· 255 249 bool sci_port_link_detected( 256 250 struct isci_port *iport, 257 251 struct isci_phy *iphy); 252 + 253 + enum sci_status sci_port_get_properties( 254 + struct isci_port *iport, 255 + struct sci_port_properties *prop); 258 256 259 257 enum sci_status sci_port_link_up(struct isci_port *iport, 260 258 struct isci_phy *iphy);
+22 -13
drivers/scsi/isci/port_config.c
··· 57 57 58 58 #define SCIC_SDS_MPC_RECONFIGURATION_TIMEOUT (10) 59 59 #define SCIC_SDS_APC_RECONFIGURATION_TIMEOUT (10) 60 - #define SCIC_SDS_APC_WAIT_LINK_UP_NOTIFICATION (100) 60 + #define SCIC_SDS_APC_WAIT_LINK_UP_NOTIFICATION (250) 61 61 62 62 enum SCIC_SDS_APC_ACTIVITY { 63 63 SCIC_SDS_APC_SKIP_PHY, ··· 466 466 return sci_port_configuration_agent_validate_ports(ihost, port_agent); 467 467 } 468 468 469 + /* 470 + * This routine will restart the automatic port configuration timeout 471 + * timer for the next time period. This could be caused by either a link 472 + * down event or a link up event where we can not yet tell to which a phy 473 + * belongs. 474 + */ 475 + static void sci_apc_agent_start_timer( 476 + struct sci_port_configuration_agent *port_agent, 477 + u32 timeout) 478 + { 479 + if (port_agent->timer_pending) 480 + sci_del_timer(&port_agent->timer); 481 + 482 + port_agent->timer_pending = true; 483 + sci_mod_timer(&port_agent->timer, timeout); 484 + } 485 + 469 486 static void sci_apc_agent_configure_ports(struct isci_host *ihost, 470 487 struct sci_port_configuration_agent *port_agent, 471 488 struct isci_phy *iphy, ··· 582 565 break; 583 566 584 567 case SCIC_SDS_APC_START_TIMER: 585 - /* 586 - * This can occur for either a link down event, or a link 587 - * up event where we cannot yet tell the port to which a 588 - * phy belongs. 589 - */ 590 - if (port_agent->timer_pending) 591 - sci_del_timer(&port_agent->timer); 592 - 593 - port_agent->timer_pending = true; 594 - sci_mod_timer(&port_agent->timer, 595 - SCIC_SDS_APC_WAIT_LINK_UP_NOTIFICATION); 568 + sci_apc_agent_start_timer(port_agent, 569 + SCIC_SDS_APC_WAIT_LINK_UP_NOTIFICATION); 596 570 break; 597 571 598 572 case SCIC_SDS_APC_SKIP_PHY: ··· 615 607 if (!iport) { 616 608 /* the phy is not the part of this port */ 617 609 port_agent->phy_ready_mask |= 1 << phy_index; 618 - sci_apc_agent_configure_ports(ihost, port_agent, iphy, true); 610 + sci_apc_agent_start_timer(port_agent, 611 + SCIC_SDS_APC_WAIT_LINK_UP_NOTIFICATION); 619 612 } else { 620 613 /* the phy is already the part of the port */ 621 614 u32 port_state = iport->sm.current_state_id;
+1 -1
drivers/scsi/isci/probe_roms.c
··· 147 147 148 148 memcpy(orom, fw->data, fw->size); 149 149 150 - if (is_c0(pdev)) 150 + if (is_c0(pdev) || is_c1(pdev)) 151 151 goto out; 152 152 153 153 /*
+86 -3
drivers/scsi/isci/probe_roms.h
··· 152 152 #define MAX_CONCURRENT_DEVICE_SPIN_UP_COUNT 4 153 153 154 154 struct sci_oem_params; 155 - int sci_oem_parameters_validate(struct sci_oem_params *oem); 155 + int sci_oem_parameters_validate(struct sci_oem_params *oem, u8 version); 156 156 157 157 struct isci_orom; 158 158 struct isci_orom *isci_request_oprom(struct pci_dev *pdev); ··· 191 191 0x1a, 0x04, 0xc6) 192 192 #define ISCI_EFI_VAR_NAME "RstScuO" 193 193 194 + #define ISCI_ROM_VER_1_0 0x10 195 + #define ISCI_ROM_VER_1_1 0x11 196 + #define ISCI_ROM_VER_1_3 0x13 197 + #define ISCI_ROM_VER_LATEST ISCI_ROM_VER_1_3 198 + 194 199 /* Allowed PORT configuration modes APC Automatic PORT configuration mode is 195 200 * defined by the OEM configuration parameters providing no PHY_MASK parameters 196 201 * for any PORT. i.e. There are no phys assigned to any of the ports at start. ··· 225 220 struct { 226 221 uint8_t mode_type; 227 222 uint8_t max_concurr_spin_up; 228 - uint8_t do_enable_ssc; 229 - uint8_t reserved; 223 + /* 224 + * This bitfield indicates the OEM's desired default Tx 225 + * Spread Spectrum Clocking (SSC) settings for SATA and SAS. 226 + * NOTE: Default SSC Modulation Frequency is 31.5KHz. 227 + */ 228 + union { 229 + struct { 230 + /* 231 + * NOTE: Max spread for SATA is +0 / -5000 PPM. 232 + * Down-spreading SSC (only method allowed for SATA): 233 + * SATA SSC Tx Disabled = 0x0 234 + * SATA SSC Tx at +0 / -1419 PPM Spread = 0x2 235 + * SATA SSC Tx at +0 / -2129 PPM Spread = 0x3 236 + * SATA SSC Tx at +0 / -4257 PPM Spread = 0x6 237 + * SATA SSC Tx at +0 / -4967 PPM Spread = 0x7 238 + */ 239 + uint8_t ssc_sata_tx_spread_level:4; 240 + /* 241 + * SAS SSC Tx Disabled = 0x0 242 + * 243 + * NOTE: Max spread for SAS down-spreading +0 / 244 + * -2300 PPM 245 + * Down-spreading SSC: 246 + * SAS SSC Tx at +0 / -1419 PPM Spread = 0x2 247 + * SAS SSC Tx at +0 / -2129 PPM Spread = 0x3 248 + * 249 + * NOTE: Max spread for SAS center-spreading +2300 / 250 + * -2300 PPM 251 + * Center-spreading SSC: 252 + * SAS SSC Tx at +1064 / -1064 PPM Spread = 0x3 253 + * SAS SSC Tx at +2129 / -2129 PPM Spread = 0x6 254 + */ 255 + uint8_t ssc_sas_tx_spread_level:3; 256 + /* 257 + * NOTE: Refer to the SSC section of the SAS 2.x 258 + * Specification for proper setting of this field. 259 + * For standard SAS Initiator SAS PHY operation it 260 + * should be 0 for Down-spreading. 261 + * SAS SSC Tx spread type: 262 + * Down-spreading SSC = 0 263 + * Center-spreading SSC = 1 264 + */ 265 + uint8_t ssc_sas_tx_type:1; 266 + }; 267 + uint8_t do_enable_ssc; 268 + }; 269 + /* 270 + * This field indicates length of the SAS/SATA cable between 271 + * host and device. 272 + * This field is used make relationship between analog 273 + * parameters of the phy in the silicon and length of the cable. 274 + * Supported cable attenuation levels: 275 + * "short"- up to 3m, "medium"-3m to 6m, and "long"- more than 276 + * 6m. 277 + * 278 + * This is bit mask field: 279 + * 280 + * BIT: (MSB) 7 6 5 4 281 + * ASSIGNMENT: <phy3><phy2><phy1><phy0> - Medium cable 282 + * length assignment 283 + * BIT: 3 2 1 0 (LSB) 284 + * ASSIGNMENT: <phy3><phy2><phy1><phy0> - Long cable length 285 + * assignment 286 + * 287 + * BITS 7-4 are set when the cable length is assigned to medium 288 + * BITS 3-0 are set when the cable length is assigned to long 289 + * 290 + * The BIT positions are clear when the cable length is 291 + * assigned to short. 292 + * 293 + * Setting the bits for both long and medium cable length is 294 + * undefined. 295 + * 296 + * A value of 0x84 would assign 297 + * phy3 - medium 298 + * phy2 - long 299 + * phy1 - short 300 + * phy0 - short 301 + */ 302 + uint8_t cable_selection_mask; 230 303 } controller; 231 304 232 305 struct {
+7 -3
drivers/scsi/isci/remote_device.c
··· 53 53 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 54 54 */ 55 55 #include <scsi/sas.h> 56 + #include <linux/bitops.h> 56 57 #include "isci.h" 57 58 #include "port.h" 58 59 #include "remote_device.h" ··· 1102 1101 struct isci_remote_device *idev) 1103 1102 { 1104 1103 enum sci_status status; 1104 + struct sci_port_properties properties; 1105 1105 struct domain_device *dev = idev->domain_dev; 1106 1106 1107 1107 sci_remote_device_construct(iport, idev); ··· 1112 1110 * entries will be needed to store the remote node. 1113 1111 */ 1114 1112 idev->is_direct_attached = true; 1113 + 1114 + sci_port_get_properties(iport, &properties); 1115 + /* Get accurate port width from port's phy mask for a DA device. */ 1116 + idev->device_port_width = hweight32(properties.phy_mask); 1117 + 1115 1118 status = sci_controller_allocate_remote_node_context(iport->owning_controller, 1116 1119 idev, 1117 1120 &idev->rnc.remote_node_index); ··· 1131 1124 return SCI_FAILURE_UNSUPPORTED_PROTOCOL; 1132 1125 1133 1126 idev->connection_rate = sci_port_get_max_allowed_speed(iport); 1134 - 1135 - /* / @todo Should I assign the port width by reading all of the phys on the port? */ 1136 - idev->device_port_width = 1; 1137 1127 1138 1128 return SCI_SUCCESS; 1139 1129 }
+1 -1
drivers/scsi/isci/task.c
··· 496 496 } 497 497 } 498 498 499 - isci_print_tmf(tmf); 499 + isci_print_tmf(ihost, tmf); 500 500 501 501 if (tmf->status == SCI_SUCCESS) 502 502 ret = TMF_RESP_FUNC_COMPLETE;
+3 -4
drivers/scsi/isci/task.h
··· 106 106 } resp; 107 107 unsigned char lun[8]; 108 108 u16 io_tag; 109 - struct isci_remote_device *device; 110 109 enum isci_tmf_function_codes tmf_code; 111 110 int status; 112 111 ··· 119 120 120 121 }; 121 122 122 - static inline void isci_print_tmf(struct isci_tmf *tmf) 123 + static inline void isci_print_tmf(struct isci_host *ihost, struct isci_tmf *tmf) 123 124 { 124 125 if (SAS_PROTOCOL_SATA == tmf->proto) 125 - dev_dbg(&tmf->device->isci_port->isci_host->pdev->dev, 126 + dev_dbg(&ihost->pdev->dev, 126 127 "%s: status = %x\n" 127 128 "tmf->resp.d2h_fis.status = %x\n" 128 129 "tmf->resp.d2h_fis.error = %x\n", ··· 131 132 tmf->resp.d2h_fis.status, 132 133 tmf->resp.d2h_fis.error); 133 134 else 134 - dev_dbg(&tmf->device->isci_port->isci_host->pdev->dev, 135 + dev_dbg(&ihost->pdev->dev, 135 136 "%s: status = %x\n" 136 137 "tmf->resp.resp_iu.data_present = %x\n" 137 138 "tmf->resp.resp_iu.status = %x\n"
+3 -3
drivers/scsi/libfc/fc_disc.c
··· 61 61 * Locking Note: This function expects that the lport mutex is locked before 62 62 * calling it. 63 63 */ 64 - void fc_disc_stop_rports(struct fc_disc *disc) 64 + static void fc_disc_stop_rports(struct fc_disc *disc) 65 65 { 66 66 struct fc_lport *lport; 67 67 struct fc_rport_priv *rdata; ··· 682 682 * fc_disc_stop() - Stop discovery for a given lport 683 683 * @lport: The local port that discovery should stop on 684 684 */ 685 - void fc_disc_stop(struct fc_lport *lport) 685 + static void fc_disc_stop(struct fc_lport *lport) 686 686 { 687 687 struct fc_disc *disc = &lport->disc; 688 688 ··· 698 698 * This function will block until discovery has been 699 699 * completely stopped and all rports have been deleted. 700 700 */ 701 - void fc_disc_stop_final(struct fc_lport *lport) 701 + static void fc_disc_stop_final(struct fc_lport *lport) 702 702 { 703 703 fc_disc_stop(lport); 704 704 lport->tt.rport_flush_queue();
+1
drivers/scsi/libfc/fc_elsct.c
··· 28 28 #include <scsi/fc/fc_els.h> 29 29 #include <scsi/libfc.h> 30 30 #include <scsi/fc_encode.h> 31 + #include "fc_libfc.h" 31 32 32 33 /** 33 34 * fc_elsct_send() - Send an ELS or CT frame
+1 -1
drivers/scsi/libfc/fc_exch.c
··· 91 91 * It manages the allocation of exchange IDs. 92 92 */ 93 93 struct fc_exch_mgr { 94 - struct fc_exch_pool *pool; 94 + struct fc_exch_pool __percpu *pool; 95 95 mempool_t *ep_pool; 96 96 enum fc_class class; 97 97 struct kref kref;
+1 -3
drivers/scsi/libfc/fc_fcp.c
··· 155 155 fsp->xfer_ddp = FC_XID_UNKNOWN; 156 156 atomic_set(&fsp->ref_cnt, 1); 157 157 init_timer(&fsp->timer); 158 + fsp->timer.data = (unsigned long)fsp; 158 159 INIT_LIST_HEAD(&fsp->list); 159 160 spin_lock_init(&fsp->scsi_pkt_lock); 160 161 } ··· 1850 1849 stats->ControlRequests++; 1851 1850 } 1852 1851 put_cpu(); 1853 - 1854 - init_timer(&fsp->timer); 1855 - fsp->timer.data = (unsigned long)fsp; 1856 1852 1857 1853 /* 1858 1854 * send it to the lower layer
+3 -2
drivers/scsi/libfc/fc_lport.c
··· 677 677 * @lport: The local port receiving the event 678 678 * @event: The discovery event 679 679 */ 680 - void fc_lport_disc_callback(struct fc_lport *lport, enum fc_disc_event event) 680 + static void fc_lport_disc_callback(struct fc_lport *lport, 681 + enum fc_disc_event event) 681 682 { 682 683 switch (event) { 683 684 case DISC_EV_SUCCESS: ··· 1569 1568 * Locking Note: The lport lock is expected to be held before calling 1570 1569 * this routine. 1571 1570 */ 1572 - void fc_lport_enter_flogi(struct fc_lport *lport) 1571 + static void fc_lport_enter_flogi(struct fc_lport *lport) 1573 1572 { 1574 1573 struct fc_frame *fp; 1575 1574
+5 -5
drivers/scsi/libfc/fc_rport.c
··· 391 391 * If it appears we are already logged in, ADISC is used to verify 392 392 * the setup. 393 393 */ 394 - int fc_rport_login(struct fc_rport_priv *rdata) 394 + static int fc_rport_login(struct fc_rport_priv *rdata) 395 395 { 396 396 mutex_lock(&rdata->rp_mutex); 397 397 ··· 451 451 * function will hold the rport lock, call an _enter_* 452 452 * function and then unlock the rport. 453 453 */ 454 - int fc_rport_logoff(struct fc_rport_priv *rdata) 454 + static int fc_rport_logoff(struct fc_rport_priv *rdata) 455 455 { 456 456 mutex_lock(&rdata->rp_mutex); 457 457 ··· 653 653 * @fp: The FLOGI response frame 654 654 * @rp_arg: The remote port that received the FLOGI response 655 655 */ 656 - void fc_rport_flogi_resp(struct fc_seq *sp, struct fc_frame *fp, 657 - void *rp_arg) 656 + static void fc_rport_flogi_resp(struct fc_seq *sp, struct fc_frame *fp, 657 + void *rp_arg) 658 658 { 659 659 struct fc_rport_priv *rdata = rp_arg; 660 660 struct fc_lport *lport = rdata->local_port; ··· 1520 1520 * 1521 1521 * Locking Note: Called with the lport lock held. 1522 1522 */ 1523 - void fc_rport_recv_req(struct fc_lport *lport, struct fc_frame *fp) 1523 + static void fc_rport_recv_req(struct fc_lport *lport, struct fc_frame *fp) 1524 1524 { 1525 1525 struct fc_seq_els_data els_data; 1526 1526
+8 -5
drivers/scsi/megaraid.c
··· 306 306 adapter->host->sg_tablesize = adapter->sglen; 307 307 308 308 309 - /* use HP firmware and bios version encoding */ 309 + /* use HP firmware and bios version encoding 310 + Note: fw_version[0|1] and bios_version[0|1] were originally shifted 311 + right 8 bits making them zero. This 0 value was hardcoded to fix 312 + sparse warnings. */ 310 313 if (adapter->product_info.subsysvid == HP_SUBSYS_VID) { 311 314 sprintf (adapter->fw_version, "%c%d%d.%d%d", 312 315 adapter->product_info.fw_version[2], 313 - adapter->product_info.fw_version[1] >> 8, 316 + 0, 314 317 adapter->product_info.fw_version[1] & 0x0f, 315 - adapter->product_info.fw_version[0] >> 8, 318 + 0, 316 319 adapter->product_info.fw_version[0] & 0x0f); 317 320 sprintf (adapter->bios_version, "%c%d%d.%d%d", 318 321 adapter->product_info.bios_version[2], 319 - adapter->product_info.bios_version[1] >> 8, 322 + 0, 320 323 adapter->product_info.bios_version[1] & 0x0f, 321 - adapter->product_info.bios_version[0] >> 8, 324 + 0, 322 325 adapter->product_info.bios_version[0] & 0x0f); 323 326 } else { 324 327 memcpy(adapter->fw_version,
+3 -5
drivers/scsi/megaraid/megaraid_sas.h
··· 33 33 /* 34 34 * MegaRAID SAS Driver meta data 35 35 */ 36 - #define MEGASAS_VERSION "00.00.06.12-rc1" 37 - #define MEGASAS_RELDATE "Oct. 5, 2011" 38 - #define MEGASAS_EXT_VERSION "Wed. Oct. 5 17:00:00 PDT 2011" 36 + #define MEGASAS_VERSION "00.00.06.14-rc1" 37 + #define MEGASAS_RELDATE "Jan. 6, 2012" 38 + #define MEGASAS_EXT_VERSION "Fri. Jan. 6 17:00:00 PDT 2012" 39 39 40 40 /* 41 41 * Device IDs ··· 773 773 774 774 #define MFI_OB_INTR_STATUS_MASK 0x00000002 775 775 #define MFI_POLL_TIMEOUT_SECS 60 776 - #define MEGASAS_COMPLETION_TIMER_INTERVAL (HZ/10) 777 776 778 777 #define MFI_REPLY_1078_MESSAGE_INTERRUPT 0x80000000 779 778 #define MFI_REPLY_GEN2_MESSAGE_INTERRUPT 0x00000001 ··· 1352 1353 u32 mfiStatus; 1353 1354 u32 last_seq_num; 1354 1355 1355 - struct timer_list io_completion_timer; 1356 1356 struct list_head internal_reset_pending_q; 1357 1357 1358 1358 /* Ptr to hba specific information */
+3 -142
drivers/scsi/megaraid/megaraid_sas_base.c
··· 18 18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 19 * 20 20 * FILE: megaraid_sas_base.c 21 - * Version : v00.00.06.12-rc1 21 + * Version : v00.00.06.14-rc1 22 22 * 23 23 * Authors: LSI Corporation 24 24 * Sreenivas Bagalkote ··· 57 57 #include <scsi/scsi_tcq.h> 58 58 #include "megaraid_sas_fusion.h" 59 59 #include "megaraid_sas.h" 60 - 61 - /* 62 - * poll_mode_io:1- schedule complete completion from q cmd 63 - */ 64 - static unsigned int poll_mode_io; 65 - module_param_named(poll_mode_io, poll_mode_io, int, 0); 66 - MODULE_PARM_DESC(poll_mode_io, 67 - "Complete cmds from IO path, (default=0)"); 68 60 69 61 /* 70 62 * Number of sectors per IO command ··· 1431 1439 1432 1440 instance->instancet->fire_cmd(instance, cmd->frame_phys_addr, 1433 1441 cmd->frame_count-1, instance->reg_set); 1434 - /* 1435 - * Check if we have pend cmds to be completed 1436 - */ 1437 - if (poll_mode_io && atomic_read(&instance->fw_outstanding)) 1438 - tasklet_schedule(&instance->isr_tasklet); 1439 1442 1440 1443 return 0; 1441 1444 out_return_cmd: ··· 3357 3370 return -EINVAL; 3358 3371 } 3359 3372 3360 - /** 3361 - * megasas_start_timer - Initializes a timer object 3362 - * @instance: Adapter soft state 3363 - * @timer: timer object to be initialized 3364 - * @fn: timer function 3365 - * @interval: time interval between timer function call 3366 - */ 3367 - static inline void 3368 - megasas_start_timer(struct megasas_instance *instance, 3369 - struct timer_list *timer, 3370 - void *fn, unsigned long interval) 3371 - { 3372 - init_timer(timer); 3373 - timer->expires = jiffies + interval; 3374 - timer->data = (unsigned long)instance; 3375 - timer->function = fn; 3376 - add_timer(timer); 3377 - } 3378 - 3379 - /** 3380 - * megasas_io_completion_timer - Timer fn 3381 - * @instance_addr: Address of adapter soft state 3382 - * 3383 - * Schedules tasklet for cmd completion 3384 - * if poll_mode_io is set 3385 - */ 3386 - static void 3387 - megasas_io_completion_timer(unsigned long instance_addr) 3388 - { 3389 - struct megasas_instance *instance = 3390 - (struct megasas_instance *)instance_addr; 3391 - 3392 - if (atomic_read(&instance->fw_outstanding)) 3393 - tasklet_schedule(&instance->isr_tasklet); 3394 - 3395 - /* Restart timer */ 3396 - if (poll_mode_io) 3397 - mod_timer(&instance->io_completion_timer, 3398 - jiffies + MEGASAS_COMPLETION_TIMER_INTERVAL); 3399 - } 3400 - 3401 3373 static u32 3402 3374 megasas_init_adapter_mfi(struct megasas_instance *instance) 3403 3375 { ··· 3584 3638 tasklet_init(&instance->isr_tasklet, instance->instancet->tasklet, 3585 3639 (unsigned long)instance); 3586 3640 3587 - /* Initialize the cmd completion timer */ 3588 - if (poll_mode_io) 3589 - megasas_start_timer(instance, &instance->io_completion_timer, 3590 - megasas_io_completion_timer, 3591 - MEGASAS_COMPLETION_TIMER_INTERVAL); 3592 3641 return 0; 3593 3642 3594 3643 fail_init_adapter: ··· 4310 4369 host = instance->host; 4311 4370 instance->unload = 1; 4312 4371 4313 - if (poll_mode_io) 4314 - del_timer_sync(&instance->io_completion_timer); 4315 - 4316 4372 megasas_flush_cache(instance); 4317 4373 megasas_shutdown_controller(instance, MR_DCMD_HIBERNATE_SHUTDOWN); 4318 4374 ··· 4449 4511 } 4450 4512 4451 4513 instance->instancet->enable_intr(instance->reg_set); 4452 - 4453 - /* Initialize the cmd completion timer */ 4454 - if (poll_mode_io) 4455 - megasas_start_timer(instance, &instance->io_completion_timer, 4456 - megasas_io_completion_timer, 4457 - MEGASAS_COMPLETION_TIMER_INTERVAL); 4458 4514 instance->unload = 0; 4459 4515 4460 4516 /* ··· 4501 4569 instance->unload = 1; 4502 4570 host = instance->host; 4503 4571 fusion = instance->ctrl_context; 4504 - 4505 - if (poll_mode_io) 4506 - del_timer_sync(&instance->io_completion_timer); 4507 4572 4508 4573 scsi_remove_host(instance->host); 4509 4574 megasas_flush_cache(instance); ··· 4702 4773 memcpy(cmd->frame, ioc->frame.raw, 2 * MEGAMFI_FRAME_SIZE); 4703 4774 cmd->frame->hdr.context = cmd->index; 4704 4775 cmd->frame->hdr.pad_0 = 0; 4776 + cmd->frame->hdr.flags &= ~(MFI_FRAME_IEEE | MFI_FRAME_SGL64 | 4777 + MFI_FRAME_SENSE64); 4705 4778 4706 4779 /* 4707 4780 * The management interface between applications and the fw uses ··· 5150 5219 static DRIVER_ATTR(dbg_lvl, S_IRUGO|S_IWUSR, megasas_sysfs_show_dbg_lvl, 5151 5220 megasas_sysfs_set_dbg_lvl); 5152 5221 5153 - static ssize_t 5154 - megasas_sysfs_show_poll_mode_io(struct device_driver *dd, char *buf) 5155 - { 5156 - return sprintf(buf, "%u\n", poll_mode_io); 5157 - } 5158 - 5159 - static ssize_t 5160 - megasas_sysfs_set_poll_mode_io(struct device_driver *dd, 5161 - const char *buf, size_t count) 5162 - { 5163 - int retval = count; 5164 - int tmp = poll_mode_io; 5165 - int i; 5166 - struct megasas_instance *instance; 5167 - 5168 - if (sscanf(buf, "%u", &poll_mode_io) < 1) { 5169 - printk(KERN_ERR "megasas: could not set poll_mode_io\n"); 5170 - retval = -EINVAL; 5171 - } 5172 - 5173 - /* 5174 - * Check if poll_mode_io is already set or is same as previous value 5175 - */ 5176 - if ((tmp && poll_mode_io) || (tmp == poll_mode_io)) 5177 - goto out; 5178 - 5179 - if (poll_mode_io) { 5180 - /* 5181 - * Start timers for all adapters 5182 - */ 5183 - for (i = 0; i < megasas_mgmt_info.max_index; i++) { 5184 - instance = megasas_mgmt_info.instance[i]; 5185 - if (instance) { 5186 - megasas_start_timer(instance, 5187 - &instance->io_completion_timer, 5188 - megasas_io_completion_timer, 5189 - MEGASAS_COMPLETION_TIMER_INTERVAL); 5190 - } 5191 - } 5192 - } else { 5193 - /* 5194 - * Delete timers for all adapters 5195 - */ 5196 - for (i = 0; i < megasas_mgmt_info.max_index; i++) { 5197 - instance = megasas_mgmt_info.instance[i]; 5198 - if (instance) 5199 - del_timer_sync(&instance->io_completion_timer); 5200 - } 5201 - } 5202 - 5203 - out: 5204 - return retval; 5205 - } 5206 - 5207 5222 static void 5208 5223 megasas_aen_polling(struct work_struct *work) 5209 5224 { ··· 5379 5502 kfree(ev); 5380 5503 } 5381 5504 5382 - 5383 - static DRIVER_ATTR(poll_mode_io, S_IRUGO|S_IWUSR, 5384 - megasas_sysfs_show_poll_mode_io, 5385 - megasas_sysfs_set_poll_mode_io); 5386 - 5387 5505 /** 5388 5506 * megasas_init - Driver load entry point 5389 5507 */ ··· 5438 5566 if (rval) 5439 5567 goto err_dcf_dbg_lvl; 5440 5568 rval = driver_create_file(&megasas_pci_driver.driver, 5441 - &driver_attr_poll_mode_io); 5442 - if (rval) 5443 - goto err_dcf_poll_mode_io; 5444 - 5445 - rval = driver_create_file(&megasas_pci_driver.driver, 5446 5569 &driver_attr_support_device_change); 5447 5570 if (rval) 5448 5571 goto err_dcf_support_device_change; ··· 5445 5578 return rval; 5446 5579 5447 5580 err_dcf_support_device_change: 5448 - driver_remove_file(&megasas_pci_driver.driver, 5449 - &driver_attr_poll_mode_io); 5450 - 5451 - err_dcf_poll_mode_io: 5452 5581 driver_remove_file(&megasas_pci_driver.driver, 5453 5582 &driver_attr_dbg_lvl); 5454 5583 err_dcf_dbg_lvl: ··· 5469 5606 */ 5470 5607 static void __exit megasas_exit(void) 5471 5608 { 5472 - driver_remove_file(&megasas_pci_driver.driver, 5473 - &driver_attr_poll_mode_io); 5474 5609 driver_remove_file(&megasas_pci_driver.driver, 5475 5610 &driver_attr_dbg_lvl); 5476 5611 driver_remove_file(&megasas_pci_driver.driver,
+3 -1
drivers/scsi/megaraid/megaraid_sas_fp.c
··· 282 282 else { 283 283 *pDevHandle = MR_PD_INVALID; /* set dev handle as invalid. */ 284 284 if ((raid->level >= 5) && 285 - (instance->pdev->device != PCI_DEVICE_ID_LSI_INVADER)) 285 + ((instance->pdev->device != PCI_DEVICE_ID_LSI_INVADER) || 286 + (instance->pdev->device == PCI_DEVICE_ID_LSI_INVADER && 287 + raid->regTypeReqOnRead != REGION_TYPE_UNUSED))) 286 288 pRAID_Context->regLockFlags = REGION_TYPE_EXCLUSIVE; 287 289 else if (raid->level == 1) { 288 290 /* Get alternate Pd. */
+3
drivers/scsi/qla4xxx/ql4_def.h
··· 150 150 #define QL4_SESS_RECOVERY_TMO 120 /* iSCSI session */ 151 151 /* recovery timeout */ 152 152 153 + #define MSB(x) ((uint8_t)((uint16_t)(x) >> 8)) 154 + #define LSW(x) ((uint16_t)(x)) 153 155 #define LSDW(x) ((u32)((u64)(x))) 154 156 #define MSDW(x) ((u32)((((u64)(x)) >> 16) >> 16)) 155 157 ··· 673 671 uint16_t pri_ddb_idx; 674 672 uint16_t sec_ddb_idx; 675 673 int is_reset; 674 + uint16_t temperature; 676 675 }; 677 676 678 677 struct ql4_task_data {
+3
drivers/scsi/qla4xxx/ql4_init.c
··· 697 697 writel(set_rmask(CSR_SCSI_PROCESSOR_INTR), 698 698 &ha->reg->ctrl_status); 699 699 readl(&ha->reg->ctrl_status); 700 + writel(set_rmask(CSR_SCSI_COMPLETION_INTR), 701 + &ha->reg->ctrl_status); 702 + readl(&ha->reg->ctrl_status); 700 703 spin_unlock_irqrestore(&ha->hardware_lock, flags); 701 704 if (qla4xxx_get_firmware_state(ha) == QLA_SUCCESS) { 702 705 DEBUG2(printk("scsi%ld: %s: Get firmware "
+7
drivers/scsi/qla4xxx/ql4_mbx.c
··· 219 219 ha->mailbox_timeout_count++; 220 220 mbx_sts[0] = (-1); 221 221 set_bit(DPC_RESET_HA, &ha->dpc_flags); 222 + if (is_qla8022(ha)) { 223 + ql4_printk(KERN_INFO, ha, 224 + "disabling pause transmit on port 0 & 1.\n"); 225 + qla4_8xxx_wr_32(ha, QLA82XX_CRB_NIU + 0x98, 226 + CRB_NIU_XG_PAUSE_CTL_P0 | 227 + CRB_NIU_XG_PAUSE_CTL_P1); 228 + } 222 229 goto mbox_exit; 223 230 } 224 231
+5
drivers/scsi/qla4xxx/ql4_nx.c
··· 1875 1875 int qla4_8xxx_load_risc(struct scsi_qla_host *ha) 1876 1876 { 1877 1877 int retval; 1878 + 1879 + /* clear the interrupt */ 1880 + writel(0, &ha->qla4_8xxx_reg->host_int); 1881 + readl(&ha->qla4_8xxx_reg->host_int); 1882 + 1878 1883 retval = qla4_8xxx_device_state_handler(ha); 1879 1884 1880 1885 if (retval == QLA_SUCCESS && !test_bit(AF_INIT_DONE, &ha->flags))
+19 -3
drivers/scsi/qla4xxx/ql4_nx.h
··· 19 19 #define PHAN_PEG_RCV_INITIALIZED 0xff01 20 20 21 21 /*CRB_RELATED*/ 22 - #define QLA82XX_CRB_BASE QLA82XX_CAM_RAM(0x200) 23 - #define QLA82XX_REG(X) (QLA82XX_CRB_BASE+(X)) 24 - 22 + #define QLA82XX_CRB_BASE (QLA82XX_CAM_RAM(0x200)) 23 + #define QLA82XX_REG(X) (QLA82XX_CRB_BASE+(X)) 25 24 #define CRB_CMDPEG_STATE QLA82XX_REG(0x50) 26 25 #define CRB_RCVPEG_STATE QLA82XX_REG(0x13c) 27 26 #define CRB_DMA_SHIFT QLA82XX_REG(0xcc) 27 + #define CRB_TEMP_STATE QLA82XX_REG(0x1b4) 28 + 29 + #define qla82xx_get_temp_val(x) ((x) >> 16) 30 + #define qla82xx_get_temp_state(x) ((x) & 0xffff) 31 + #define qla82xx_encode_temp(val, state) (((val) << 16) | (state)) 32 + 33 + /* 34 + * Temperature control. 35 + */ 36 + enum { 37 + QLA82XX_TEMP_NORMAL = 0x1, /* Normal operating range */ 38 + QLA82XX_TEMP_WARN, /* Sound alert, temperature getting high */ 39 + QLA82XX_TEMP_PANIC /* Fatal error, hardware has shut down. */ 40 + }; 41 + 42 + #define CRB_NIU_XG_PAUSE_CTL_P0 0x1 43 + #define CRB_NIU_XG_PAUSE_CTL_P1 0x8 28 44 29 45 #define QLA82XX_HW_H0_CH_HUB_ADR 0x05 30 46 #define QLA82XX_HW_H1_CH_HUB_ADR 0x0E
+336 -195
drivers/scsi/qla4xxx/ql4_os.c
··· 35 35 int ql4xdisablesysfsboot = 1; 36 36 module_param(ql4xdisablesysfsboot, int, S_IRUGO | S_IWUSR); 37 37 MODULE_PARM_DESC(ql4xdisablesysfsboot, 38 - "Set to disable exporting boot targets to sysfs\n" 39 - " 0 - Export boot targets\n" 40 - " 1 - Do not export boot targets (Default)"); 38 + " Set to disable exporting boot targets to sysfs.\n" 39 + "\t\t 0 - Export boot targets\n" 40 + "\t\t 1 - Do not export boot targets (Default)"); 41 41 42 42 int ql4xdontresethba = 0; 43 43 module_param(ql4xdontresethba, int, S_IRUGO | S_IWUSR); 44 44 MODULE_PARM_DESC(ql4xdontresethba, 45 - "Don't reset the HBA for driver recovery \n" 46 - " 0 - It will reset HBA (Default)\n" 47 - " 1 - It will NOT reset HBA"); 45 + " Don't reset the HBA for driver recovery.\n" 46 + "\t\t 0 - It will reset HBA (Default)\n" 47 + "\t\t 1 - It will NOT reset HBA"); 48 48 49 - int ql4xextended_error_logging = 0; /* 0 = off, 1 = log errors */ 49 + int ql4xextended_error_logging; 50 50 module_param(ql4xextended_error_logging, int, S_IRUGO | S_IWUSR); 51 51 MODULE_PARM_DESC(ql4xextended_error_logging, 52 - "Option to enable extended error logging, " 53 - "Default is 0 - no logging, 1 - debug logging"); 52 + " Option to enable extended error logging.\n" 53 + "\t\t 0 - no logging (Default)\n" 54 + "\t\t 2 - debug logging"); 54 55 55 56 int ql4xenablemsix = 1; 56 57 module_param(ql4xenablemsix, int, S_IRUGO|S_IWUSR); 57 58 MODULE_PARM_DESC(ql4xenablemsix, 58 - "Set to enable MSI or MSI-X interrupt mechanism.\n" 59 - " 0 = enable INTx interrupt mechanism.\n" 60 - " 1 = enable MSI-X interrupt mechanism (Default).\n" 61 - " 2 = enable MSI interrupt mechanism."); 59 + " Set to enable MSI or MSI-X interrupt mechanism.\n" 60 + "\t\t 0 = enable INTx interrupt mechanism.\n" 61 + "\t\t 1 = enable MSI-X interrupt mechanism (Default).\n" 62 + "\t\t 2 = enable MSI interrupt mechanism."); 62 63 63 64 #define QL4_DEF_QDEPTH 32 64 65 static int ql4xmaxqdepth = QL4_DEF_QDEPTH; 65 66 module_param(ql4xmaxqdepth, int, S_IRUGO | S_IWUSR); 66 67 MODULE_PARM_DESC(ql4xmaxqdepth, 67 - "Maximum queue depth to report for target devices.\n" 68 - " Default: 32."); 68 + " Maximum queue depth to report for target devices.\n" 69 + "\t\t Default: 32."); 69 70 70 71 static int ql4xsess_recovery_tmo = QL4_SESS_RECOVERY_TMO; 71 72 module_param(ql4xsess_recovery_tmo, int, S_IRUGO); 72 73 MODULE_PARM_DESC(ql4xsess_recovery_tmo, 73 74 "Target Session Recovery Timeout.\n" 74 - " Default: 120 sec."); 75 + "\t\t Default: 120 sec."); 75 76 76 77 static int qla4xxx_wait_for_hba_online(struct scsi_qla_host *ha); 77 78 /* ··· 1631 1630 1632 1631 /* Update timers after login */ 1633 1632 ddb_entry->default_relogin_timeout = 1634 - le16_to_cpu(fw_ddb_entry->def_timeout); 1633 + (le16_to_cpu(fw_ddb_entry->def_timeout) > LOGIN_TOV) && 1634 + (le16_to_cpu(fw_ddb_entry->def_timeout) < LOGIN_TOV * 10) ? 1635 + le16_to_cpu(fw_ddb_entry->def_timeout) : LOGIN_TOV; 1635 1636 ddb_entry->default_time2wait = 1636 1637 le16_to_cpu(fw_ddb_entry->iscsi_def_time2wait); 1637 1638 ··· 1973 1970 } 1974 1971 1975 1972 /** 1973 + * qla4_8xxx_check_temp - Check the ISP82XX temperature. 1974 + * @ha: adapter block pointer. 1975 + * 1976 + * Note: The caller should not hold the idc lock. 1977 + **/ 1978 + static int qla4_8xxx_check_temp(struct scsi_qla_host *ha) 1979 + { 1980 + uint32_t temp, temp_state, temp_val; 1981 + int status = QLA_SUCCESS; 1982 + 1983 + temp = qla4_8xxx_rd_32(ha, CRB_TEMP_STATE); 1984 + 1985 + temp_state = qla82xx_get_temp_state(temp); 1986 + temp_val = qla82xx_get_temp_val(temp); 1987 + 1988 + if (temp_state == QLA82XX_TEMP_PANIC) { 1989 + ql4_printk(KERN_WARNING, ha, "Device temperature %d degrees C" 1990 + " exceeds maximum allowed. Hardware has been shut" 1991 + " down.\n", temp_val); 1992 + status = QLA_ERROR; 1993 + } else if (temp_state == QLA82XX_TEMP_WARN) { 1994 + if (ha->temperature == QLA82XX_TEMP_NORMAL) 1995 + ql4_printk(KERN_WARNING, ha, "Device temperature %d" 1996 + " degrees C exceeds operating range." 1997 + " Immediate action needed.\n", temp_val); 1998 + } else { 1999 + if (ha->temperature == QLA82XX_TEMP_WARN) 2000 + ql4_printk(KERN_INFO, ha, "Device temperature is" 2001 + " now %d degrees C in normal range.\n", 2002 + temp_val); 2003 + } 2004 + ha->temperature = temp_state; 2005 + return status; 2006 + } 2007 + 2008 + /** 1976 2009 * qla4_8xxx_check_fw_alive - Check firmware health 1977 2010 * @ha: Pointer to host adapter structure. 1978 2011 * ··· 2079 2040 test_bit(DPC_RESET_HA, &ha->dpc_flags) || 2080 2041 test_bit(DPC_RETRY_RESET_HA, &ha->dpc_flags))) { 2081 2042 dev_state = qla4_8xxx_rd_32(ha, QLA82XX_CRB_DEV_STATE); 2082 - if (dev_state == QLA82XX_DEV_NEED_RESET && 2043 + 2044 + if (qla4_8xxx_check_temp(ha)) { 2045 + ql4_printk(KERN_INFO, ha, "disabling pause" 2046 + " transmit on port 0 & 1.\n"); 2047 + qla4_8xxx_wr_32(ha, QLA82XX_CRB_NIU + 0x98, 2048 + CRB_NIU_XG_PAUSE_CTL_P0 | 2049 + CRB_NIU_XG_PAUSE_CTL_P1); 2050 + set_bit(DPC_HA_UNRECOVERABLE, &ha->dpc_flags); 2051 + qla4xxx_wake_dpc(ha); 2052 + } else if (dev_state == QLA82XX_DEV_NEED_RESET && 2083 2053 !test_bit(DPC_RESET_HA, &ha->dpc_flags)) { 2084 2054 if (!ql4xdontresethba) { 2085 2055 ql4_printk(KERN_INFO, ha, "%s: HW State: " ··· 2105 2057 } else { 2106 2058 /* Check firmware health */ 2107 2059 if (qla4_8xxx_check_fw_alive(ha)) { 2060 + ql4_printk(KERN_INFO, ha, "disabling pause" 2061 + " transmit on port 0 & 1.\n"); 2062 + qla4_8xxx_wr_32(ha, QLA82XX_CRB_NIU + 0x98, 2063 + CRB_NIU_XG_PAUSE_CTL_P0 | 2064 + CRB_NIU_XG_PAUSE_CTL_P1); 2108 2065 halt_status = qla4_8xxx_rd_32(ha, 2109 2066 QLA82XX_PEG_HALT_STATUS1); 2067 + 2068 + if (LSW(MSB(halt_status)) == 0x67) 2069 + ql4_printk(KERN_ERR, ha, "%s:" 2070 + " Firmware aborted with" 2071 + " error code 0x00006700." 2072 + " Device is being reset\n", 2073 + __func__); 2110 2074 2111 2075 /* Since we cannot change dev_state in interrupt 2112 2076 * context, set appropriate DPC flag then wakeup ··· 2138 2078 } 2139 2079 } 2140 2080 2141 - void qla4xxx_check_relogin_flash_ddb(struct iscsi_cls_session *cls_sess) 2081 + static void qla4xxx_check_relogin_flash_ddb(struct iscsi_cls_session *cls_sess) 2142 2082 { 2143 2083 struct iscsi_session *sess; 2144 2084 struct ddb_entry *ddb_entry; ··· 3886 3826 return ret; 3887 3827 } 3888 3828 3889 - static void qla4xxx_free_nt_list(struct list_head *list_nt) 3829 + static void qla4xxx_free_ddb_list(struct list_head *list_ddb) 3890 3830 { 3891 - struct qla_ddb_index *nt_ddb_idx, *nt_ddb_idx_tmp; 3831 + struct qla_ddb_index *ddb_idx, *ddb_idx_tmp; 3892 3832 3893 - /* Free up the normaltargets list */ 3894 - list_for_each_entry_safe(nt_ddb_idx, nt_ddb_idx_tmp, list_nt, list) { 3895 - list_del_init(&nt_ddb_idx->list); 3896 - vfree(nt_ddb_idx); 3833 + list_for_each_entry_safe(ddb_idx, ddb_idx_tmp, list_ddb, list) { 3834 + list_del_init(&ddb_idx->list); 3835 + vfree(ddb_idx); 3897 3836 } 3898 - 3899 3837 } 3900 3838 3901 3839 static struct iscsi_endpoint *qla4xxx_get_ep_fwdb(struct scsi_qla_host *ha, ··· 3942 3884 static void qla4xxx_setup_flash_ddb_entry(struct scsi_qla_host *ha, 3943 3885 struct ddb_entry *ddb_entry) 3944 3886 { 3887 + uint16_t def_timeout; 3888 + 3945 3889 ddb_entry->ddb_type = FLASH_DDB; 3946 3890 ddb_entry->fw_ddb_index = INVALID_ENTRY; 3947 3891 ddb_entry->fw_ddb_device_state = DDB_DS_NO_CONNECTION_ACTIVE; ··· 3954 3894 atomic_set(&ddb_entry->retry_relogin_timer, INVALID_ENTRY); 3955 3895 atomic_set(&ddb_entry->relogin_timer, 0); 3956 3896 atomic_set(&ddb_entry->relogin_retry_count, 0); 3957 - 3897 + def_timeout = le16_to_cpu(ddb_entry->fw_ddb_entry.def_timeout); 3958 3898 ddb_entry->default_relogin_timeout = 3959 - le16_to_cpu(ddb_entry->fw_ddb_entry.def_timeout); 3899 + (def_timeout > LOGIN_TOV) && (def_timeout < LOGIN_TOV * 10) ? 3900 + def_timeout : LOGIN_TOV; 3960 3901 ddb_entry->default_time2wait = 3961 3902 le16_to_cpu(ddb_entry->fw_ddb_entry.iscsi_def_time2wait); 3962 3903 } ··· 3995 3934 ip_state == IP_ADDRSTATE_DEPRICATED || 3996 3935 ip_state == IP_ADDRSTATE_DISABLING) 3997 3936 ip_idx[idx] = -1; 3998 - 3999 3937 } 4000 3938 4001 3939 /* Break if all IP states checked */ ··· 4007 3947 } while (time_after(wtime, jiffies)); 4008 3948 } 4009 3949 4010 - void qla4xxx_build_ddb_list(struct scsi_qla_host *ha, int is_reset) 3950 + static void qla4xxx_build_st_list(struct scsi_qla_host *ha, 3951 + struct list_head *list_st) 4011 3952 { 3953 + struct qla_ddb_index *st_ddb_idx; 4012 3954 int max_ddbs; 3955 + int fw_idx_size; 3956 + struct dev_db_entry *fw_ddb_entry; 3957 + dma_addr_t fw_ddb_dma; 4013 3958 int ret; 4014 3959 uint32_t idx = 0, next_idx = 0; 4015 3960 uint32_t state = 0, conn_err = 0; 4016 - uint16_t conn_id; 4017 - struct dev_db_entry *fw_ddb_entry; 4018 - struct ddb_entry *ddb_entry = NULL; 4019 - dma_addr_t fw_ddb_dma; 4020 - struct iscsi_cls_session *cls_sess; 4021 - struct iscsi_session *sess; 4022 - struct iscsi_cls_conn *cls_conn; 4023 - struct iscsi_endpoint *ep; 4024 - uint16_t cmds_max = 32, tmo = 0; 4025 - uint32_t initial_cmdsn = 0; 4026 - struct list_head list_st, list_nt; /* List of sendtargets */ 4027 - struct qla_ddb_index *st_ddb_idx, *st_ddb_idx_tmp; 4028 - int fw_idx_size; 4029 - unsigned long wtime; 4030 - struct qla_ddb_index *nt_ddb_idx; 4031 - 4032 - if (!test_bit(AF_LINK_UP, &ha->flags)) { 4033 - set_bit(AF_BUILD_DDB_LIST, &ha->flags); 4034 - ha->is_reset = is_reset; 4035 - return; 4036 - } 4037 - max_ddbs = is_qla40XX(ha) ? MAX_DEV_DB_ENTRIES_40XX : 4038 - MAX_DEV_DB_ENTRIES; 3961 + uint16_t conn_id = 0; 4039 3962 4040 3963 fw_ddb_entry = dma_pool_alloc(ha->fw_ddb_dma_pool, GFP_KERNEL, 4041 3964 &fw_ddb_dma); 4042 3965 if (fw_ddb_entry == NULL) { 4043 3966 DEBUG2(ql4_printk(KERN_ERR, ha, "Out of memory\n")); 4044 - goto exit_ddb_list; 3967 + goto exit_st_list; 4045 3968 } 4046 3969 4047 - INIT_LIST_HEAD(&list_st); 4048 - INIT_LIST_HEAD(&list_nt); 3970 + max_ddbs = is_qla40XX(ha) ? MAX_DEV_DB_ENTRIES_40XX : 3971 + MAX_DEV_DB_ENTRIES; 4049 3972 fw_idx_size = sizeof(struct qla_ddb_index); 4050 3973 4051 3974 for (idx = 0; idx < max_ddbs; idx = next_idx) { 4052 - ret = qla4xxx_get_fwddb_entry(ha, idx, fw_ddb_entry, 4053 - fw_ddb_dma, NULL, 4054 - &next_idx, &state, &conn_err, 4055 - NULL, &conn_id); 3975 + ret = qla4xxx_get_fwddb_entry(ha, idx, fw_ddb_entry, fw_ddb_dma, 3976 + NULL, &next_idx, &state, 3977 + &conn_err, NULL, &conn_id); 4056 3978 if (ret == QLA_ERROR) 4057 3979 break; 4058 - 4059 - if (qla4xxx_verify_boot_idx(ha, idx) != QLA_SUCCESS) 4060 - goto continue_next_st; 4061 3980 4062 3981 /* Check if ST, add to the list_st */ 4063 3982 if (strlen((char *) fw_ddb_entry->iscsi_name) != 0) ··· 4048 4009 4049 4010 st_ddb_idx->fw_ddb_idx = idx; 4050 4011 4051 - list_add_tail(&st_ddb_idx->list, &list_st); 4012 + list_add_tail(&st_ddb_idx->list, list_st); 4052 4013 continue_next_st: 4053 4014 if (next_idx == 0) 4054 4015 break; 4055 4016 } 4017 + 4018 + exit_st_list: 4019 + if (fw_ddb_entry) 4020 + dma_pool_free(ha->fw_ddb_dma_pool, fw_ddb_entry, fw_ddb_dma); 4021 + } 4022 + 4023 + /** 4024 + * qla4xxx_remove_failed_ddb - Remove inactive or failed ddb from list 4025 + * @ha: pointer to adapter structure 4026 + * @list_ddb: List from which failed ddb to be removed 4027 + * 4028 + * Iterate over the list of DDBs and find and remove DDBs that are either in 4029 + * no connection active state or failed state 4030 + **/ 4031 + static void qla4xxx_remove_failed_ddb(struct scsi_qla_host *ha, 4032 + struct list_head *list_ddb) 4033 + { 4034 + struct qla_ddb_index *ddb_idx, *ddb_idx_tmp; 4035 + uint32_t next_idx = 0; 4036 + uint32_t state = 0, conn_err = 0; 4037 + int ret; 4038 + 4039 + list_for_each_entry_safe(ddb_idx, ddb_idx_tmp, list_ddb, list) { 4040 + ret = qla4xxx_get_fwddb_entry(ha, ddb_idx->fw_ddb_idx, 4041 + NULL, 0, NULL, &next_idx, &state, 4042 + &conn_err, NULL, NULL); 4043 + if (ret == QLA_ERROR) 4044 + continue; 4045 + 4046 + if (state == DDB_DS_NO_CONNECTION_ACTIVE || 4047 + state == DDB_DS_SESSION_FAILED) { 4048 + list_del_init(&ddb_idx->list); 4049 + vfree(ddb_idx); 4050 + } 4051 + } 4052 + } 4053 + 4054 + static int qla4xxx_sess_conn_setup(struct scsi_qla_host *ha, 4055 + struct dev_db_entry *fw_ddb_entry, 4056 + int is_reset) 4057 + { 4058 + struct iscsi_cls_session *cls_sess; 4059 + struct iscsi_session *sess; 4060 + struct iscsi_cls_conn *cls_conn; 4061 + struct iscsi_endpoint *ep; 4062 + uint16_t cmds_max = 32; 4063 + uint16_t conn_id = 0; 4064 + uint32_t initial_cmdsn = 0; 4065 + int ret = QLA_SUCCESS; 4066 + 4067 + struct ddb_entry *ddb_entry = NULL; 4068 + 4069 + /* Create session object, with INVALID_ENTRY, 4070 + * the targer_id would get set when we issue the login 4071 + */ 4072 + cls_sess = iscsi_session_setup(&qla4xxx_iscsi_transport, ha->host, 4073 + cmds_max, sizeof(struct ddb_entry), 4074 + sizeof(struct ql4_task_data), 4075 + initial_cmdsn, INVALID_ENTRY); 4076 + if (!cls_sess) { 4077 + ret = QLA_ERROR; 4078 + goto exit_setup; 4079 + } 4080 + 4081 + /* 4082 + * so calling module_put function to decrement the 4083 + * reference count. 4084 + **/ 4085 + module_put(qla4xxx_iscsi_transport.owner); 4086 + sess = cls_sess->dd_data; 4087 + ddb_entry = sess->dd_data; 4088 + ddb_entry->sess = cls_sess; 4089 + 4090 + cls_sess->recovery_tmo = ql4xsess_recovery_tmo; 4091 + memcpy(&ddb_entry->fw_ddb_entry, fw_ddb_entry, 4092 + sizeof(struct dev_db_entry)); 4093 + 4094 + qla4xxx_setup_flash_ddb_entry(ha, ddb_entry); 4095 + 4096 + cls_conn = iscsi_conn_setup(cls_sess, sizeof(struct qla_conn), conn_id); 4097 + 4098 + if (!cls_conn) { 4099 + ret = QLA_ERROR; 4100 + goto exit_setup; 4101 + } 4102 + 4103 + ddb_entry->conn = cls_conn; 4104 + 4105 + /* Setup ep, for displaying attributes in sysfs */ 4106 + ep = qla4xxx_get_ep_fwdb(ha, fw_ddb_entry); 4107 + if (ep) { 4108 + ep->conn = cls_conn; 4109 + cls_conn->ep = ep; 4110 + } else { 4111 + DEBUG2(ql4_printk(KERN_ERR, ha, "Unable to get ep\n")); 4112 + ret = QLA_ERROR; 4113 + goto exit_setup; 4114 + } 4115 + 4116 + /* Update sess/conn params */ 4117 + qla4xxx_copy_fwddb_param(ha, fw_ddb_entry, cls_sess, cls_conn); 4118 + 4119 + if (is_reset == RESET_ADAPTER) { 4120 + iscsi_block_session(cls_sess); 4121 + /* Use the relogin path to discover new devices 4122 + * by short-circuting the logic of setting 4123 + * timer to relogin - instead set the flags 4124 + * to initiate login right away. 4125 + */ 4126 + set_bit(DPC_RELOGIN_DEVICE, &ha->dpc_flags); 4127 + set_bit(DF_RELOGIN, &ddb_entry->flags); 4128 + } 4129 + 4130 + exit_setup: 4131 + return ret; 4132 + } 4133 + 4134 + static void qla4xxx_build_nt_list(struct scsi_qla_host *ha, 4135 + struct list_head *list_nt, int is_reset) 4136 + { 4137 + struct dev_db_entry *fw_ddb_entry; 4138 + dma_addr_t fw_ddb_dma; 4139 + int max_ddbs; 4140 + int fw_idx_size; 4141 + int ret; 4142 + uint32_t idx = 0, next_idx = 0; 4143 + uint32_t state = 0, conn_err = 0; 4144 + uint16_t conn_id = 0; 4145 + struct qla_ddb_index *nt_ddb_idx; 4146 + 4147 + fw_ddb_entry = dma_pool_alloc(ha->fw_ddb_dma_pool, GFP_KERNEL, 4148 + &fw_ddb_dma); 4149 + if (fw_ddb_entry == NULL) { 4150 + DEBUG2(ql4_printk(KERN_ERR, ha, "Out of memory\n")); 4151 + goto exit_nt_list; 4152 + } 4153 + max_ddbs = is_qla40XX(ha) ? MAX_DEV_DB_ENTRIES_40XX : 4154 + MAX_DEV_DB_ENTRIES; 4155 + fw_idx_size = sizeof(struct qla_ddb_index); 4156 + 4157 + for (idx = 0; idx < max_ddbs; idx = next_idx) { 4158 + ret = qla4xxx_get_fwddb_entry(ha, idx, fw_ddb_entry, fw_ddb_dma, 4159 + NULL, &next_idx, &state, 4160 + &conn_err, NULL, &conn_id); 4161 + if (ret == QLA_ERROR) 4162 + break; 4163 + 4164 + if (qla4xxx_verify_boot_idx(ha, idx) != QLA_SUCCESS) 4165 + goto continue_next_nt; 4166 + 4167 + /* Check if NT, then add to list it */ 4168 + if (strlen((char *) fw_ddb_entry->iscsi_name) == 0) 4169 + goto continue_next_nt; 4170 + 4171 + if (!(state == DDB_DS_NO_CONNECTION_ACTIVE || 4172 + state == DDB_DS_SESSION_FAILED)) 4173 + goto continue_next_nt; 4174 + 4175 + DEBUG2(ql4_printk(KERN_INFO, ha, 4176 + "Adding DDB to session = 0x%x\n", idx)); 4177 + if (is_reset == INIT_ADAPTER) { 4178 + nt_ddb_idx = vmalloc(fw_idx_size); 4179 + if (!nt_ddb_idx) 4180 + break; 4181 + 4182 + nt_ddb_idx->fw_ddb_idx = idx; 4183 + 4184 + memcpy(&nt_ddb_idx->fw_ddb, fw_ddb_entry, 4185 + sizeof(struct dev_db_entry)); 4186 + 4187 + if (qla4xxx_is_flash_ddb_exists(ha, list_nt, 4188 + fw_ddb_entry) == QLA_SUCCESS) { 4189 + vfree(nt_ddb_idx); 4190 + goto continue_next_nt; 4191 + } 4192 + list_add_tail(&nt_ddb_idx->list, list_nt); 4193 + } else if (is_reset == RESET_ADAPTER) { 4194 + if (qla4xxx_is_session_exists(ha, fw_ddb_entry) == 4195 + QLA_SUCCESS) 4196 + goto continue_next_nt; 4197 + } 4198 + 4199 + ret = qla4xxx_sess_conn_setup(ha, fw_ddb_entry, is_reset); 4200 + if (ret == QLA_ERROR) 4201 + goto exit_nt_list; 4202 + 4203 + continue_next_nt: 4204 + if (next_idx == 0) 4205 + break; 4206 + } 4207 + 4208 + exit_nt_list: 4209 + if (fw_ddb_entry) 4210 + dma_pool_free(ha->fw_ddb_dma_pool, fw_ddb_entry, fw_ddb_dma); 4211 + } 4212 + 4213 + /** 4214 + * qla4xxx_build_ddb_list - Build ddb list and setup sessions 4215 + * @ha: pointer to adapter structure 4216 + * @is_reset: Is this init path or reset path 4217 + * 4218 + * Create a list of sendtargets (st) from firmware DDBs, issue send targets 4219 + * using connection open, then create the list of normal targets (nt) 4220 + * from firmware DDBs. Based on the list of nt setup session and connection 4221 + * objects. 4222 + **/ 4223 + void qla4xxx_build_ddb_list(struct scsi_qla_host *ha, int is_reset) 4224 + { 4225 + uint16_t tmo = 0; 4226 + struct list_head list_st, list_nt; 4227 + struct qla_ddb_index *st_ddb_idx, *st_ddb_idx_tmp; 4228 + unsigned long wtime; 4229 + 4230 + if (!test_bit(AF_LINK_UP, &ha->flags)) { 4231 + set_bit(AF_BUILD_DDB_LIST, &ha->flags); 4232 + ha->is_reset = is_reset; 4233 + return; 4234 + } 4235 + 4236 + INIT_LIST_HEAD(&list_st); 4237 + INIT_LIST_HEAD(&list_nt); 4238 + 4239 + qla4xxx_build_st_list(ha, &list_st); 4056 4240 4057 4241 /* Before issuing conn open mbox, ensure all IPs states are configured 4058 4242 * Note, conn open fails if IPs are not configured ··· 4288 4026 } 4289 4027 4290 4028 /* Wait to ensure all sendtargets are done for min 12 sec wait */ 4291 - tmo = ((ha->def_timeout < LOGIN_TOV) ? LOGIN_TOV : ha->def_timeout); 4029 + tmo = ((ha->def_timeout > LOGIN_TOV) && 4030 + (ha->def_timeout < LOGIN_TOV * 10) ? 4031 + ha->def_timeout : LOGIN_TOV); 4032 + 4292 4033 DEBUG2(ql4_printk(KERN_INFO, ha, 4293 4034 "Default time to wait for build ddb %d\n", tmo)); 4294 4035 4295 4036 wtime = jiffies + (HZ * tmo); 4296 4037 do { 4297 - list_for_each_entry_safe(st_ddb_idx, st_ddb_idx_tmp, &list_st, 4298 - list) { 4299 - ret = qla4xxx_get_fwddb_entry(ha, 4300 - st_ddb_idx->fw_ddb_idx, 4301 - NULL, 0, NULL, &next_idx, 4302 - &state, &conn_err, NULL, 4303 - NULL); 4304 - if (ret == QLA_ERROR) 4305 - continue; 4038 + if (list_empty(&list_st)) 4039 + break; 4306 4040 4307 - if (state == DDB_DS_NO_CONNECTION_ACTIVE || 4308 - state == DDB_DS_SESSION_FAILED) { 4309 - list_del_init(&st_ddb_idx->list); 4310 - vfree(st_ddb_idx); 4311 - } 4312 - } 4041 + qla4xxx_remove_failed_ddb(ha, &list_st); 4313 4042 schedule_timeout_uninterruptible(HZ / 10); 4314 4043 } while (time_after(wtime, jiffies)); 4315 4044 4316 4045 /* Free up the sendtargets list */ 4317 - list_for_each_entry_safe(st_ddb_idx, st_ddb_idx_tmp, &list_st, list) { 4318 - list_del_init(&st_ddb_idx->list); 4319 - vfree(st_ddb_idx); 4320 - } 4046 + qla4xxx_free_ddb_list(&list_st); 4321 4047 4322 - for (idx = 0; idx < max_ddbs; idx = next_idx) { 4323 - ret = qla4xxx_get_fwddb_entry(ha, idx, fw_ddb_entry, 4324 - fw_ddb_dma, NULL, 4325 - &next_idx, &state, &conn_err, 4326 - NULL, &conn_id); 4327 - if (ret == QLA_ERROR) 4328 - break; 4048 + qla4xxx_build_nt_list(ha, &list_nt, is_reset); 4329 4049 4330 - if (qla4xxx_verify_boot_idx(ha, idx) != QLA_SUCCESS) 4331 - goto continue_next_nt; 4332 - 4333 - /* Check if NT, then add to list it */ 4334 - if (strlen((char *) fw_ddb_entry->iscsi_name) == 0) 4335 - goto continue_next_nt; 4336 - 4337 - if (state == DDB_DS_NO_CONNECTION_ACTIVE || 4338 - state == DDB_DS_SESSION_FAILED) { 4339 - DEBUG2(ql4_printk(KERN_INFO, ha, 4340 - "Adding DDB to session = 0x%x\n", 4341 - idx)); 4342 - if (is_reset == INIT_ADAPTER) { 4343 - nt_ddb_idx = vmalloc(fw_idx_size); 4344 - if (!nt_ddb_idx) 4345 - break; 4346 - 4347 - nt_ddb_idx->fw_ddb_idx = idx; 4348 - 4349 - memcpy(&nt_ddb_idx->fw_ddb, fw_ddb_entry, 4350 - sizeof(struct dev_db_entry)); 4351 - 4352 - if (qla4xxx_is_flash_ddb_exists(ha, &list_nt, 4353 - fw_ddb_entry) == QLA_SUCCESS) { 4354 - vfree(nt_ddb_idx); 4355 - goto continue_next_nt; 4356 - } 4357 - list_add_tail(&nt_ddb_idx->list, &list_nt); 4358 - } else if (is_reset == RESET_ADAPTER) { 4359 - if (qla4xxx_is_session_exists(ha, 4360 - fw_ddb_entry) == QLA_SUCCESS) 4361 - goto continue_next_nt; 4362 - } 4363 - 4364 - /* Create session object, with INVALID_ENTRY, 4365 - * the targer_id would get set when we issue the login 4366 - */ 4367 - cls_sess = iscsi_session_setup(&qla4xxx_iscsi_transport, 4368 - ha->host, cmds_max, 4369 - sizeof(struct ddb_entry), 4370 - sizeof(struct ql4_task_data), 4371 - initial_cmdsn, INVALID_ENTRY); 4372 - if (!cls_sess) 4373 - goto exit_ddb_list; 4374 - 4375 - /* 4376 - * iscsi_session_setup increments the driver reference 4377 - * count which wouldn't let the driver to be unloaded. 4378 - * so calling module_put function to decrement the 4379 - * reference count. 4380 - **/ 4381 - module_put(qla4xxx_iscsi_transport.owner); 4382 - sess = cls_sess->dd_data; 4383 - ddb_entry = sess->dd_data; 4384 - ddb_entry->sess = cls_sess; 4385 - 4386 - cls_sess->recovery_tmo = ql4xsess_recovery_tmo; 4387 - memcpy(&ddb_entry->fw_ddb_entry, fw_ddb_entry, 4388 - sizeof(struct dev_db_entry)); 4389 - 4390 - qla4xxx_setup_flash_ddb_entry(ha, ddb_entry); 4391 - 4392 - cls_conn = iscsi_conn_setup(cls_sess, 4393 - sizeof(struct qla_conn), 4394 - conn_id); 4395 - if (!cls_conn) 4396 - goto exit_ddb_list; 4397 - 4398 - ddb_entry->conn = cls_conn; 4399 - 4400 - /* Setup ep, for displaying attributes in sysfs */ 4401 - ep = qla4xxx_get_ep_fwdb(ha, fw_ddb_entry); 4402 - if (ep) { 4403 - ep->conn = cls_conn; 4404 - cls_conn->ep = ep; 4405 - } else { 4406 - DEBUG2(ql4_printk(KERN_ERR, ha, 4407 - "Unable to get ep\n")); 4408 - } 4409 - 4410 - /* Update sess/conn params */ 4411 - qla4xxx_copy_fwddb_param(ha, fw_ddb_entry, cls_sess, 4412 - cls_conn); 4413 - 4414 - if (is_reset == RESET_ADAPTER) { 4415 - iscsi_block_session(cls_sess); 4416 - /* Use the relogin path to discover new devices 4417 - * by short-circuting the logic of setting 4418 - * timer to relogin - instead set the flags 4419 - * to initiate login right away. 4420 - */ 4421 - set_bit(DPC_RELOGIN_DEVICE, &ha->dpc_flags); 4422 - set_bit(DF_RELOGIN, &ddb_entry->flags); 4423 - } 4424 - } 4425 - continue_next_nt: 4426 - if (next_idx == 0) 4427 - break; 4428 - } 4429 - exit_ddb_list: 4430 - qla4xxx_free_nt_list(&list_nt); 4431 - if (fw_ddb_entry) 4432 - dma_pool_free(ha->fw_ddb_dma_pool, fw_ddb_entry, fw_ddb_dma); 4050 + qla4xxx_free_ddb_list(&list_nt); 4433 4051 4434 4052 qla4xxx_free_ddb_index(ha); 4435 4053 } 4436 - 4437 4054 4438 4055 /** 4439 4056 * qla4xxx_probe_adapter - callback function to probe HBA
+1 -1
drivers/scsi/qla4xxx/ql4_version.h
··· 5 5 * See LICENSE.qla4xxx for copyright and licensing details. 6 6 */ 7 7 8 - #define QLA4XXX_DRIVER_VERSION "5.02.00-k10" 8 + #define QLA4XXX_DRIVER_VERSION "5.02.00-k12"
+1 -6
drivers/scsi/scsi_lib.c
··· 1316 1316 } 1317 1317 1318 1318 if (scsi_target_is_busy(starget)) { 1319 - if (list_empty(&sdev->starved_entry)) 1320 - list_add_tail(&sdev->starved_entry, 1321 - &shost->starved_list); 1319 + list_move_tail(&sdev->starved_entry, &shost->starved_list); 1322 1320 return 0; 1323 1321 } 1324 1322 1325 - /* We're OK to process the command, so we can't be starved */ 1326 - if (!list_empty(&sdev->starved_entry)) 1327 - list_del_init(&sdev->starved_entry); 1328 1323 return 1; 1329 1324 } 1330 1325
+2 -1
drivers/scsi/scsi_transport_fc.c
··· 3048 3048 3049 3049 spin_lock_irqsave(shost->host_lock, flags); 3050 3050 rport->flags &= ~(FC_RPORT_FAST_FAIL_TIMEDOUT | 3051 - FC_RPORT_DEVLOSS_PENDING); 3051 + FC_RPORT_DEVLOSS_PENDING | 3052 + FC_RPORT_DEVLOSS_CALLBK_DONE); 3052 3053 spin_unlock_irqrestore(shost->host_lock, flags); 3053 3054 3054 3055 /* ensure any stgt delete functions are done */
+11 -14
drivers/scsi/sg.c
··· 2368 2368 sg_proc_write_adio(struct file *filp, const char __user *buffer, 2369 2369 size_t count, loff_t *off) 2370 2370 { 2371 - int num; 2372 - char buff[11]; 2371 + int err; 2372 + unsigned long num; 2373 2373 2374 2374 if (!capable(CAP_SYS_ADMIN) || !capable(CAP_SYS_RAWIO)) 2375 2375 return -EACCES; 2376 - num = (count < 10) ? count : 10; 2377 - if (copy_from_user(buff, buffer, num)) 2378 - return -EFAULT; 2379 - buff[num] = '\0'; 2380 - sg_allow_dio = simple_strtoul(buff, NULL, 10) ? 1 : 0; 2376 + err = kstrtoul_from_user(buffer, count, 0, &num); 2377 + if (err) 2378 + return err; 2379 + sg_allow_dio = num ? 1 : 0; 2381 2380 return count; 2382 2381 } 2383 2382 ··· 2389 2390 sg_proc_write_dressz(struct file *filp, const char __user *buffer, 2390 2391 size_t count, loff_t *off) 2391 2392 { 2392 - int num; 2393 + int err; 2393 2394 unsigned long k = ULONG_MAX; 2394 - char buff[11]; 2395 2395 2396 2396 if (!capable(CAP_SYS_ADMIN) || !capable(CAP_SYS_RAWIO)) 2397 2397 return -EACCES; 2398 - num = (count < 10) ? count : 10; 2399 - if (copy_from_user(buff, buffer, num)) 2400 - return -EFAULT; 2401 - buff[num] = '\0'; 2402 - k = simple_strtoul(buff, NULL, 10); 2398 + 2399 + err = kstrtoul_from_user(buffer, count, 0, &k); 2400 + if (err) 2401 + return err; 2403 2402 if (k <= 1048576) { /* limit "big buff" to 1 MB */ 2404 2403 sg_big_buff = k; 2405 2404 return count;
+4
drivers/scsi/sym53c8xx_2/sym_glue.c
··· 839 839 struct sym_lcb *lp = sym_lp(tp, sdev->lun); 840 840 unsigned long flags; 841 841 842 + /* if slave_alloc returned before allocating a sym_lcb, return */ 843 + if (!lp) 844 + return; 845 + 842 846 spin_lock_irqsave(np->s.host->host_lock, flags); 843 847 844 848 if (lp->busy_itlq || lp->busy_itl) {
-1
firmware/Makefile
··· 82 82 fw-shipped-$(CONFIG_PCMCIA_SMC91C92) += ositech/Xilinx7OD.bin 83 83 fw-shipped-$(CONFIG_SCSI_ADVANSYS) += advansys/mcode.bin advansys/38C1600.bin \ 84 84 advansys/3550.bin advansys/38C0800.bin 85 - fw-shipped-$(CONFIG_SCSI_ISCI) += isci/isci_firmware.bin 86 85 fw-shipped-$(CONFIG_SCSI_QLOGIC_1280) += qlogic/1040.bin qlogic/1280.bin \ 87 86 qlogic/12160.bin 88 87 fw-shipped-$(CONFIG_SCSI_QLOGICPTI) += qlogic/isp1000.bin
-16
firmware/isci/isci_firmware.bin.ihex
··· 1 - :10000000495343554F454D42E80018100002000087 2 - :1000100000000000000000000101000000000000DE 3 - :10002000FFFFCF5F0100000008DD0B0000FC0F00A8 4 - :10003000097C0B006EFC0A00FFFFCF5F010000008F 5 - :1000400008DD0B0000FC0F00097C0B006EFC0A00B1 6 - :10005000FFFFCF5F0100000008DD0B0000FC0F0078 7 - :10006000097C0B006EFC0A00FFFFCF5F010000005F 8 - :1000700008DD0B0000FC0F00097C0B006EFC0A0081 9 - :100080000101000000000000FFFFCF5F0200000040 10 - :1000900008DD0B0000FC0F00097C0B006EFC0A0061 11 - :1000A000FFFFCF5F0200000008DD0B0000FC0F0027 12 - :1000B000097C0B006EFC0A00FFFFCF5F020000000E 13 - :1000C00008DD0B0000FC0F00097C0B006EFC0A0031 14 - :1000D000FFFFCF5F0200000008DD0B0000FC0F00F7 15 - :0800E000097C0B006EFC0A0014 16 - :00000001FF
+1 -1
include/scsi/libfc.h
··· 857 857 enum fc_lport_state state; 858 858 unsigned long boot_time; 859 859 struct fc_host_statistics host_stats; 860 - struct fcoe_dev_stats *dev_stats; 860 + struct fcoe_dev_stats __percpu *dev_stats; 861 861 u8 retry_count; 862 862 863 863 /* Fabric information */