Dan Williams | 6f231dd | 2011-07-02 22:56:22 -0700 | [diff] [blame] | 1 | /* |
| 2 | * This file is provided under a dual BSD/GPLv2 license. When using or |
| 3 | * redistributing this file, you may do so under either license. |
| 4 | * |
| 5 | * GPL LICENSE SUMMARY |
| 6 | * |
| 7 | * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved. |
| 8 | * |
| 9 | * This program is free software; you can redistribute it and/or modify |
| 10 | * it under the terms of version 2 of the GNU General Public License as |
| 11 | * published by the Free Software Foundation. |
| 12 | * |
| 13 | * This program is distributed in the hope that it will be useful, but |
| 14 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 16 | * General Public License for more details. |
| 17 | * |
| 18 | * You should have received a copy of the GNU General Public License |
| 19 | * along with this program; if not, write to the Free Software |
| 20 | * Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. |
| 21 | * The full GNU General Public License is included in this distribution |
| 22 | * in the file called LICENSE.GPL. |
| 23 | * |
| 24 | * BSD LICENSE |
| 25 | * |
| 26 | * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved. |
| 27 | * All rights reserved. |
| 28 | * |
| 29 | * Redistribution and use in source and binary forms, with or without |
| 30 | * modification, are permitted provided that the following conditions |
| 31 | * are met: |
| 32 | * |
| 33 | * * Redistributions of source code must retain the above copyright |
| 34 | * notice, this list of conditions and the following disclaimer. |
| 35 | * * Redistributions in binary form must reproduce the above copyright |
| 36 | * notice, this list of conditions and the following disclaimer in |
| 37 | * the documentation and/or other materials provided with the |
| 38 | * distribution. |
| 39 | * * Neither the name of Intel Corporation nor the names of its |
| 40 | * contributors may be used to endorse or promote products derived |
| 41 | * from this software without specific prior written permission. |
| 42 | * |
| 43 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 44 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 45 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 46 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 47 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 48 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 49 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 50 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 51 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 52 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 53 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 54 | */ |
| 55 | |
| 56 | /** |
| 57 | * This file contains the isci port implementation. |
| 58 | * |
| 59 | * |
| 60 | */ |
| 61 | |
| 62 | |
| 63 | #include <linux/workqueue.h> |
| 64 | #include "isci.h" |
| 65 | #include "scic_io_request.h" |
Dan Williams | 6f231dd | 2011-07-02 22:56:22 -0700 | [diff] [blame] | 66 | #include "scic_phy.h" |
| 67 | #include "scic_sds_phy.h" |
| 68 | #include "scic_port.h" |
| 69 | #include "port.h" |
| 70 | #include "request.h" |
Maciej Patelczyk | d3757c3 | 2011-04-28 22:06:06 +0000 | [diff] [blame] | 71 | #include "core/scic_sds_controller.h" |
Dan Williams | 6f231dd | 2011-07-02 22:56:22 -0700 | [diff] [blame] | 72 | |
Dan Williams | e531381 | 2011-05-07 10:11:43 -0700 | [diff] [blame^] | 73 | static void isci_port_change_state(struct isci_port *iport, enum isci_status status) |
| 74 | { |
| 75 | unsigned long flags; |
Dan Williams | 6f231dd | 2011-07-02 22:56:22 -0700 | [diff] [blame] | 76 | |
Dan Williams | e531381 | 2011-05-07 10:11:43 -0700 | [diff] [blame^] | 77 | dev_dbg(&iport->isci_host->pdev->dev, |
| 78 | "%s: iport = %p, state = 0x%x\n", |
| 79 | __func__, iport, status); |
Dan Williams | 6f231dd | 2011-07-02 22:56:22 -0700 | [diff] [blame] | 80 | |
Dan Williams | e531381 | 2011-05-07 10:11:43 -0700 | [diff] [blame^] | 81 | /* XXX pointless lock */ |
| 82 | spin_lock_irqsave(&iport->state_lock, flags); |
| 83 | iport->status = status; |
| 84 | spin_unlock_irqrestore(&iport->state_lock, flags); |
| 85 | } |
Dan Williams | 6f231dd | 2011-07-02 22:56:22 -0700 | [diff] [blame] | 86 | |
Edmund Nadolski | ed30c27 | 2011-05-05 01:11:43 +0000 | [diff] [blame] | 87 | void isci_port_init(struct isci_port *iport, struct isci_host *ihost, int index) |
Dan Williams | 6f231dd | 2011-07-02 22:56:22 -0700 | [diff] [blame] | 88 | { |
Edmund Nadolski | ed30c27 | 2011-05-05 01:11:43 +0000 | [diff] [blame] | 89 | INIT_LIST_HEAD(&iport->remote_dev_list); |
| 90 | INIT_LIST_HEAD(&iport->domain_dev_list); |
| 91 | spin_lock_init(&iport->state_lock); |
| 92 | init_completion(&iport->start_complete); |
| 93 | iport->isci_host = ihost; |
| 94 | isci_port_change_state(iport, isci_freed); |
Dan Williams | 6f231dd | 2011-07-02 22:56:22 -0700 | [diff] [blame] | 95 | } |
| 96 | |
Dan Williams | 6f231dd | 2011-07-02 22:56:22 -0700 | [diff] [blame] | 97 | /** |
| 98 | * isci_port_get_state() - This function gets the status of the port object. |
| 99 | * @isci_port: This parameter points to the isci_port object |
| 100 | * |
| 101 | * status of the object as a isci_status enum. |
| 102 | */ |
| 103 | enum isci_status isci_port_get_state( |
| 104 | struct isci_port *isci_port) |
| 105 | { |
| 106 | return isci_port->status; |
| 107 | } |
| 108 | |
Dan Williams | 4b33981 | 2011-05-06 17:36:38 -0700 | [diff] [blame] | 109 | void isci_port_bc_change_received(struct isci_host *ihost, |
| 110 | struct scic_sds_port *sci_port, |
| 111 | struct scic_sds_phy *sci_phy) |
Dan Williams | 6f231dd | 2011-07-02 22:56:22 -0700 | [diff] [blame] | 112 | { |
Dan Williams | 4b33981 | 2011-05-06 17:36:38 -0700 | [diff] [blame] | 113 | struct isci_phy *iphy = sci_phy_to_iphy(sci_phy); |
Dan Williams | 6f231dd | 2011-07-02 22:56:22 -0700 | [diff] [blame] | 114 | |
Dan Williams | 4b33981 | 2011-05-06 17:36:38 -0700 | [diff] [blame] | 115 | dev_dbg(&ihost->pdev->dev, "%s: iphy = %p, sas_phy = %p\n", |
| 116 | __func__, iphy, &iphy->sas_phy); |
Dan Williams | 6f231dd | 2011-07-02 22:56:22 -0700 | [diff] [blame] | 117 | |
Dan Williams | 4b33981 | 2011-05-06 17:36:38 -0700 | [diff] [blame] | 118 | ihost->sas_ha.notify_port_event(&iphy->sas_phy, PORTE_BROADCAST_RCVD); |
| 119 | scic_port_enable_broadcast_change_notification(sci_port); |
Dan Williams | 6f231dd | 2011-07-02 22:56:22 -0700 | [diff] [blame] | 120 | } |
| 121 | |
Dan Williams | 4b33981 | 2011-05-06 17:36:38 -0700 | [diff] [blame] | 122 | void isci_port_link_up(struct isci_host *isci_host, |
| 123 | struct scic_sds_port *port, |
| 124 | struct scic_sds_phy *phy) |
Dan Williams | 6f231dd | 2011-07-02 22:56:22 -0700 | [diff] [blame] | 125 | { |
| 126 | unsigned long flags; |
| 127 | struct scic_port_properties properties; |
Dan Williams | 4b33981 | 2011-05-06 17:36:38 -0700 | [diff] [blame] | 128 | struct isci_phy *isci_phy = sci_phy_to_iphy(phy); |
Dan Williams | e531381 | 2011-05-07 10:11:43 -0700 | [diff] [blame^] | 129 | struct isci_port *isci_port = sci_port_to_iport(port); |
Dan Williams | 6f231dd | 2011-07-02 22:56:22 -0700 | [diff] [blame] | 130 | unsigned long success = true; |
| 131 | |
| 132 | BUG_ON(isci_phy->isci_port != NULL); |
Bartosz Barcinski | 6cb4d6b | 2011-04-12 17:28:43 -0700 | [diff] [blame] | 133 | |
Dan Williams | 6f231dd | 2011-07-02 22:56:22 -0700 | [diff] [blame] | 134 | isci_phy->isci_port = isci_port; |
| 135 | |
| 136 | dev_dbg(&isci_host->pdev->dev, |
| 137 | "%s: isci_port = %p\n", |
| 138 | __func__, isci_port); |
| 139 | |
| 140 | spin_lock_irqsave(&isci_phy->sas_phy.frame_rcvd_lock, flags); |
| 141 | |
| 142 | isci_port_change_state(isci_phy->isci_port, isci_starting); |
| 143 | |
| 144 | scic_port_get_properties(port, &properties); |
| 145 | |
Dave Jiang | d7b90fc | 2011-05-04 18:22:33 -0700 | [diff] [blame] | 146 | if (phy->protocol == SCIC_SDS_PHY_PROTOCOL_SATA) { |
Dan Williams | 150fc6f | 2011-02-25 10:25:21 -0800 | [diff] [blame] | 147 | u64 attached_sas_address; |
Dan Williams | 6f231dd | 2011-07-02 22:56:22 -0700 | [diff] [blame] | 148 | |
Dan Williams | 6f231dd | 2011-07-02 22:56:22 -0700 | [diff] [blame] | 149 | isci_phy->sas_phy.oob_mode = SATA_OOB_MODE; |
Dave Jiang | f2f3008 | 2011-05-04 15:02:02 -0700 | [diff] [blame] | 150 | isci_phy->sas_phy.frame_rcvd_size = sizeof(struct dev_to_host_fis); |
Dan Williams | 6f231dd | 2011-07-02 22:56:22 -0700 | [diff] [blame] | 151 | |
| 152 | /* |
| 153 | * For direct-attached SATA devices, the SCI core will |
| 154 | * automagically assign a SAS address to the end device |
| 155 | * for the purpose of creating a port. This SAS address |
| 156 | * will not be the same as assigned to the PHY and needs |
| 157 | * to be obtained from struct scic_port_properties properties. |
| 158 | */ |
Dan Williams | 150fc6f | 2011-02-25 10:25:21 -0800 | [diff] [blame] | 159 | attached_sas_address = properties.remote.sas_address.high; |
| 160 | attached_sas_address <<= 32; |
| 161 | attached_sas_address |= properties.remote.sas_address.low; |
| 162 | swab64s(&attached_sas_address); |
Dan Williams | 6f231dd | 2011-07-02 22:56:22 -0700 | [diff] [blame] | 163 | |
Dan Williams | 150fc6f | 2011-02-25 10:25:21 -0800 | [diff] [blame] | 164 | memcpy(&isci_phy->sas_phy.attached_sas_addr, |
| 165 | &attached_sas_address, sizeof(attached_sas_address)); |
Dave Jiang | d7b90fc | 2011-05-04 18:22:33 -0700 | [diff] [blame] | 166 | } else if (phy->protocol == SCIC_SDS_PHY_PROTOCOL_SAS) { |
Dan Williams | 6f231dd | 2011-07-02 22:56:22 -0700 | [diff] [blame] | 167 | isci_phy->sas_phy.oob_mode = SAS_OOB_MODE; |
Dave Jiang | 4b7ebd0 | 2011-05-04 15:37:52 -0700 | [diff] [blame] | 168 | isci_phy->sas_phy.frame_rcvd_size = sizeof(struct sas_identify_frame); |
Dan Williams | 6f231dd | 2011-07-02 22:56:22 -0700 | [diff] [blame] | 169 | |
| 170 | /* Copy the attached SAS address from the IAF */ |
| 171 | memcpy(isci_phy->sas_phy.attached_sas_addr, |
Dave Jiang | 4b7ebd0 | 2011-05-04 15:37:52 -0700 | [diff] [blame] | 172 | isci_phy->frame_rcvd.iaf.sas_addr, SAS_ADDR_SIZE); |
Dan Williams | 6f231dd | 2011-07-02 22:56:22 -0700 | [diff] [blame] | 173 | } else { |
| 174 | dev_err(&isci_host->pdev->dev, "%s: unkown target\n", __func__); |
| 175 | success = false; |
| 176 | } |
| 177 | |
Dan Williams | 83e5143 | 2011-02-18 09:25:13 -0800 | [diff] [blame] | 178 | isci_phy->sas_phy.phy->negotiated_linkrate = sci_phy_linkrate(phy); |
| 179 | |
Dan Williams | 6f231dd | 2011-07-02 22:56:22 -0700 | [diff] [blame] | 180 | spin_unlock_irqrestore(&isci_phy->sas_phy.frame_rcvd_lock, flags); |
| 181 | |
| 182 | /* Notify libsas that we have an address frame, if indeed |
| 183 | * we've found an SSP, SMP, or STP target */ |
| 184 | if (success) |
| 185 | isci_host->sas_ha.notify_port_event(&isci_phy->sas_phy, |
| 186 | PORTE_BYTES_DMAED); |
| 187 | } |
| 188 | |
| 189 | |
| 190 | /** |
| 191 | * isci_port_link_down() - This function is called by the sci core when a link |
| 192 | * becomes inactive. |
| 193 | * @isci_host: This parameter specifies the isci host object. |
| 194 | * @phy: This parameter specifies the isci phy with the active link. |
| 195 | * @port: This parameter specifies the isci port with the active link. |
| 196 | * |
| 197 | */ |
Dave Jiang | 09d7da1 | 2011-03-26 16:11:51 -0700 | [diff] [blame] | 198 | void isci_port_link_down(struct isci_host *isci_host, struct isci_phy *isci_phy, |
| 199 | struct isci_port *isci_port) |
Dan Williams | 6f231dd | 2011-07-02 22:56:22 -0700 | [diff] [blame] | 200 | { |
| 201 | struct isci_remote_device *isci_device; |
| 202 | |
| 203 | dev_dbg(&isci_host->pdev->dev, |
| 204 | "%s: isci_port = %p\n", __func__, isci_port); |
| 205 | |
| 206 | if (isci_port) { |
| 207 | |
| 208 | /* check to see if this is the last phy on this port. */ |
| 209 | if (isci_phy->sas_phy.port |
| 210 | && isci_phy->sas_phy.port->num_phys == 1) { |
| 211 | |
| 212 | /* change the state for all devices on this port. |
| 213 | * The next task sent to this device will be returned |
| 214 | * as SAS_TASK_UNDELIVERED, and the scsi mid layer |
| 215 | * will remove the target |
| 216 | */ |
| 217 | list_for_each_entry(isci_device, |
| 218 | &isci_port->remote_dev_list, |
| 219 | node) { |
| 220 | dev_dbg(&isci_host->pdev->dev, |
| 221 | "%s: isci_device = %p\n", |
| 222 | __func__, isci_device); |
| 223 | isci_remote_device_change_state(isci_device, |
| 224 | isci_stopping); |
| 225 | } |
| 226 | } |
| 227 | isci_port_change_state(isci_port, isci_stopping); |
| 228 | } |
| 229 | |
| 230 | /* Notify libsas of the borken link, this will trigger calls to our |
| 231 | * isci_port_deformed and isci_dev_gone functions. |
| 232 | */ |
| 233 | sas_phy_disconnected(&isci_phy->sas_phy); |
| 234 | isci_host->sas_ha.notify_phy_event(&isci_phy->sas_phy, |
| 235 | PHYE_LOSS_OF_SIGNAL); |
| 236 | |
| 237 | isci_phy->isci_port = NULL; |
| 238 | |
| 239 | dev_dbg(&isci_host->pdev->dev, |
| 240 | "%s: isci_port = %p - Done\n", __func__, isci_port); |
| 241 | } |
| 242 | |
| 243 | |
| 244 | /** |
| 245 | * isci_port_deformed() - This function is called by libsas when a port becomes |
| 246 | * inactive. |
| 247 | * @phy: This parameter specifies the libsas phy with the inactive port. |
| 248 | * |
| 249 | */ |
| 250 | void isci_port_deformed( |
| 251 | struct asd_sas_phy *phy) |
| 252 | { |
| 253 | pr_debug("%s: sas_phy = %p\n", __func__, phy); |
| 254 | } |
| 255 | |
| 256 | /** |
| 257 | * isci_port_formed() - This function is called by libsas when a port becomes |
| 258 | * active. |
| 259 | * @phy: This parameter specifies the libsas phy with the active port. |
| 260 | * |
| 261 | */ |
| 262 | void isci_port_formed( |
| 263 | struct asd_sas_phy *phy) |
| 264 | { |
| 265 | pr_debug("%s: sas_phy = %p, sas_port = %p\n", __func__, phy, phy->port); |
| 266 | } |
| 267 | |
| 268 | /** |
| 269 | * isci_port_ready() - This function is called by the sci core when a link |
| 270 | * becomes ready. |
| 271 | * @isci_host: This parameter specifies the isci host object. |
| 272 | * @port: This parameter specifies the sci port with the active link. |
| 273 | * |
| 274 | */ |
Dave Jiang | 09d7da1 | 2011-03-26 16:11:51 -0700 | [diff] [blame] | 275 | void isci_port_ready(struct isci_host *isci_host, struct isci_port *isci_port) |
Dan Williams | 6f231dd | 2011-07-02 22:56:22 -0700 | [diff] [blame] | 276 | { |
| 277 | dev_dbg(&isci_host->pdev->dev, |
| 278 | "%s: isci_port = %p\n", __func__, isci_port); |
| 279 | |
| 280 | complete_all(&isci_port->start_complete); |
| 281 | isci_port_change_state(isci_port, isci_ready); |
| 282 | return; |
| 283 | } |
| 284 | |
| 285 | /** |
| 286 | * isci_port_not_ready() - This function is called by the sci core when a link |
| 287 | * is not ready. All remote devices on this link will be removed if they are |
| 288 | * in the stopping state. |
| 289 | * @isci_host: This parameter specifies the isci host object. |
| 290 | * @port: This parameter specifies the sci port with the active link. |
| 291 | * |
| 292 | */ |
Dave Jiang | 09d7da1 | 2011-03-26 16:11:51 -0700 | [diff] [blame] | 293 | void isci_port_not_ready(struct isci_host *isci_host, struct isci_port *isci_port) |
Dan Williams | 6f231dd | 2011-07-02 22:56:22 -0700 | [diff] [blame] | 294 | { |
| 295 | dev_dbg(&isci_host->pdev->dev, |
| 296 | "%s: isci_port = %p\n", __func__, isci_port); |
| 297 | } |
| 298 | |
| 299 | /** |
| 300 | * isci_port_hard_reset_complete() - This function is called by the sci core |
| 301 | * when the hard reset complete notification has been received. |
| 302 | * @port: This parameter specifies the sci port with the active link. |
| 303 | * @completion_status: This parameter specifies the core status for the reset |
| 304 | * process. |
| 305 | * |
| 306 | */ |
Dave Jiang | 09d7da1 | 2011-03-26 16:11:51 -0700 | [diff] [blame] | 307 | void isci_port_hard_reset_complete(struct isci_port *isci_port, |
| 308 | enum sci_status completion_status) |
Dan Williams | 6f231dd | 2011-07-02 22:56:22 -0700 | [diff] [blame] | 309 | { |
| 310 | dev_dbg(&isci_port->isci_host->pdev->dev, |
| 311 | "%s: isci_port = %p, completion_status=%x\n", |
| 312 | __func__, isci_port, completion_status); |
| 313 | |
| 314 | /* Save the status of the hard reset from the port. */ |
| 315 | isci_port->hard_reset_status = completion_status; |
| 316 | |
| 317 | complete_all(&isci_port->hard_reset_complete); |
| 318 | } |
Dan Williams | 4393aa4 | 2011-03-31 13:10:44 -0700 | [diff] [blame] | 319 | |
| 320 | int isci_port_perform_hard_reset(struct isci_host *ihost, struct isci_port *iport, |
| 321 | struct isci_phy *iphy) |
Dan Williams | 6f231dd | 2011-07-02 22:56:22 -0700 | [diff] [blame] | 322 | { |
Dan Williams | 4393aa4 | 2011-03-31 13:10:44 -0700 | [diff] [blame] | 323 | unsigned long flags; |
Dan Williams | 6f231dd | 2011-07-02 22:56:22 -0700 | [diff] [blame] | 324 | enum sci_status status; |
| 325 | int ret = TMF_RESP_FUNC_COMPLETE; |
Dan Williams | 6f231dd | 2011-07-02 22:56:22 -0700 | [diff] [blame] | 326 | |
Dan Williams | 4393aa4 | 2011-03-31 13:10:44 -0700 | [diff] [blame] | 327 | dev_dbg(&ihost->pdev->dev, "%s: iport = %p\n", |
| 328 | __func__, iport); |
Dan Williams | 6f231dd | 2011-07-02 22:56:22 -0700 | [diff] [blame] | 329 | |
Dan Williams | 4393aa4 | 2011-03-31 13:10:44 -0700 | [diff] [blame] | 330 | init_completion(&iport->hard_reset_complete); |
Dan Williams | 6f231dd | 2011-07-02 22:56:22 -0700 | [diff] [blame] | 331 | |
Dan Williams | 4393aa4 | 2011-03-31 13:10:44 -0700 | [diff] [blame] | 332 | spin_lock_irqsave(&ihost->scic_lock, flags); |
Dan Williams | 6f231dd | 2011-07-02 22:56:22 -0700 | [diff] [blame] | 333 | |
| 334 | #define ISCI_PORT_RESET_TIMEOUT SCIC_SDS_SIGNATURE_FIS_TIMEOUT |
Dan Williams | e531381 | 2011-05-07 10:11:43 -0700 | [diff] [blame^] | 335 | status = scic_port_hard_reset(&iport->sci, ISCI_PORT_RESET_TIMEOUT); |
Dan Williams | 6f231dd | 2011-07-02 22:56:22 -0700 | [diff] [blame] | 336 | |
Dan Williams | 4393aa4 | 2011-03-31 13:10:44 -0700 | [diff] [blame] | 337 | spin_unlock_irqrestore(&ihost->scic_lock, flags); |
Dan Williams | 6f231dd | 2011-07-02 22:56:22 -0700 | [diff] [blame] | 338 | |
| 339 | if (status == SCI_SUCCESS) { |
Dan Williams | 4393aa4 | 2011-03-31 13:10:44 -0700 | [diff] [blame] | 340 | wait_for_completion(&iport->hard_reset_complete); |
Dan Williams | 6f231dd | 2011-07-02 22:56:22 -0700 | [diff] [blame] | 341 | |
Dan Williams | 4393aa4 | 2011-03-31 13:10:44 -0700 | [diff] [blame] | 342 | dev_dbg(&ihost->pdev->dev, |
| 343 | "%s: iport = %p; hard reset completion\n", |
| 344 | __func__, iport); |
Dan Williams | 6f231dd | 2011-07-02 22:56:22 -0700 | [diff] [blame] | 345 | |
Dan Williams | 4393aa4 | 2011-03-31 13:10:44 -0700 | [diff] [blame] | 346 | if (iport->hard_reset_status != SCI_SUCCESS) |
Dan Williams | 6f231dd | 2011-07-02 22:56:22 -0700 | [diff] [blame] | 347 | ret = TMF_RESP_FUNC_FAILED; |
| 348 | } else { |
| 349 | ret = TMF_RESP_FUNC_FAILED; |
| 350 | |
Dan Williams | 4393aa4 | 2011-03-31 13:10:44 -0700 | [diff] [blame] | 351 | dev_err(&ihost->pdev->dev, |
| 352 | "%s: iport = %p; scic_port_hard_reset call" |
Dan Williams | 6f231dd | 2011-07-02 22:56:22 -0700 | [diff] [blame] | 353 | " failed 0x%x\n", |
Dan Williams | 4393aa4 | 2011-03-31 13:10:44 -0700 | [diff] [blame] | 354 | __func__, iport, status); |
Dan Williams | 6f231dd | 2011-07-02 22:56:22 -0700 | [diff] [blame] | 355 | |
| 356 | } |
| 357 | |
| 358 | /* If the hard reset for the port has failed, consider this |
| 359 | * the same as link failures on all phys in the port. |
| 360 | */ |
| 361 | if (ret != TMF_RESP_FUNC_COMPLETE) { |
Dan Williams | 4393aa4 | 2011-03-31 13:10:44 -0700 | [diff] [blame] | 362 | dev_err(&ihost->pdev->dev, |
| 363 | "%s: iport = %p; hard reset failed " |
Dan Williams | 6f231dd | 2011-07-02 22:56:22 -0700 | [diff] [blame] | 364 | "(0x%x) - sending link down to libsas for phy %p\n", |
Dan Williams | 4393aa4 | 2011-03-31 13:10:44 -0700 | [diff] [blame] | 365 | __func__, iport, iport->hard_reset_status, iphy); |
Dan Williams | 6f231dd | 2011-07-02 22:56:22 -0700 | [diff] [blame] | 366 | |
Dan Williams | 4393aa4 | 2011-03-31 13:10:44 -0700 | [diff] [blame] | 367 | isci_port_link_down(ihost, iphy, iport); |
Dan Williams | 6f231dd | 2011-07-02 22:56:22 -0700 | [diff] [blame] | 368 | } |
| 369 | |
| 370 | return ret; |
| 371 | } |
Dave Jiang | 09d7da1 | 2011-03-26 16:11:51 -0700 | [diff] [blame] | 372 | |
Dave Jiang | 09d7da1 | 2011-03-26 16:11:51 -0700 | [diff] [blame] | 373 | void isci_port_stop_complete(struct scic_sds_controller *scic, |
| 374 | struct scic_sds_port *sci_port, |
| 375 | enum sci_status completion_status) |
| 376 | { |
Artur Wojcik | cc3dbd0 | 2011-05-04 07:58:16 +0000 | [diff] [blame] | 377 | dev_dbg(&scic_to_ihost(scic)->pdev->dev, "Port stop complete\n"); |
Dave Jiang | 09d7da1 | 2011-03-26 16:11:51 -0700 | [diff] [blame] | 378 | } |