Commit | Line | Data |
---|---|---|
6f231dda DW |
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 | /** | |
58 | * This file contains isci module object implementation. | |
59 | * | |
60 | * | |
61 | */ | |
62 | ||
63 | #include "isci.h" | |
64 | #include "request.h" | |
65 | #include "sata.h" | |
66 | #include "task.h" | |
a1914059 | 67 | #include "events.h" |
6f231dda DW |
68 | |
69 | /** | |
a1914059 | 70 | * isci_event_timer_create() - This callback method asks the user to create a |
6f231dda DW |
71 | * timer and provide a handle for this timer for use in further timer |
72 | * interactions. The appropriate isci timer object function is called to | |
73 | * create a timer object. | |
74 | * @timer_callback: This parameter specifies the callback method to be invoked | |
75 | * whenever the timer expires. | |
76 | * @controller: This parameter specifies the controller with which this timer | |
77 | * is to be associated. | |
7c40a803 | 78 | * @cb_param: opaque callback parameter |
6f231dda DW |
79 | * |
80 | * This method returns a handle to a timer object created by the user. The | |
81 | * handle will be utilized for all further interactions relating to this timer. | |
82 | */ | |
7c40a803 DW |
83 | void *isci_event_timer_create(struct scic_sds_controller *scic, |
84 | void (*timer_callback)(void *), | |
85 | void *cb_param) | |
6f231dda | 86 | { |
7c40a803 DW |
87 | struct isci_host *ihost = sci_object_get_association(scic); |
88 | struct isci_timer *itimer; | |
6f231dda | 89 | |
7c40a803 | 90 | itimer = isci_timer_create(ihost, cb_param, timer_callback); |
6f231dda | 91 | |
7c40a803 | 92 | dev_dbg(&ihost->pdev->dev, "%s: timer = %p\n", __func__, itimer); |
6f231dda | 93 | |
7c40a803 | 94 | return itimer; |
6f231dda DW |
95 | } |
96 | ||
97 | ||
98 | /** | |
a1914059 | 99 | * isci_event_timer_start() - This callback method asks the user to start the |
6f231dda DW |
100 | * supplied timer. The appropriate isci timer object function is called to |
101 | * start the timer. | |
102 | * @controller: This parameter specifies the controller with which this timer | |
103 | * is to associated. | |
104 | * @timer: This parameter specifies the timer to be started. | |
105 | * @milliseconds: This parameter specifies the number of milliseconds for which | |
106 | * to stall. The operating system driver is allowed to round this value up | |
107 | * where necessary. | |
108 | * | |
109 | */ | |
a1914059 | 110 | void isci_event_timer_start( |
6f231dda DW |
111 | struct scic_sds_controller *controller, |
112 | void *timer, | |
113 | u32 milliseconds) | |
114 | { | |
115 | struct isci_host *isci_host; | |
116 | ||
117 | isci_host = | |
118 | (struct isci_host *)sci_object_get_association(controller); | |
119 | ||
120 | dev_dbg(&isci_host->pdev->dev, | |
121 | "%s: isci_host = %p, timer = %p, milliseconds = %d\n", | |
122 | __func__, isci_host, timer, milliseconds); | |
123 | ||
124 | isci_timer_start((struct isci_timer *)timer, milliseconds); | |
125 | ||
126 | } | |
127 | ||
128 | /** | |
a1914059 | 129 | * isci_event_timer_stop() - This callback method asks the user to stop the |
6f231dda DW |
130 | * supplied timer. The appropriate isci timer object function is called to |
131 | * stop the timer. | |
132 | * @controller: This parameter specifies the controller with which this timer | |
133 | * is to associated. | |
134 | * @timer: This parameter specifies the timer to be stopped. | |
135 | * | |
136 | */ | |
7c40a803 | 137 | void isci_event_timer_stop(struct scic_sds_controller *controller, void *timer) |
6f231dda | 138 | { |
7c40a803 | 139 | struct isci_host *isci_host = sci_object_get_association(controller); |
6f231dda DW |
140 | |
141 | dev_dbg(&isci_host->pdev->dev, | |
142 | "%s: isci_host = %p, timer = %p\n", | |
143 | __func__, isci_host, timer); | |
144 | ||
145 | isci_timer_stop((struct isci_timer *)timer); | |
146 | } | |
147 | ||
7c40a803 DW |
148 | void isci_event_timer_destroy(struct scic_sds_controller *scic, void *timer) |
149 | { | |
150 | struct isci_host *ihost = sci_object_get_association(scic); | |
151 | ||
152 | dev_dbg(&ihost->pdev->dev, "%s: ihost = %p, timer = %p\n", | |
153 | __func__, ihost, timer); | |
154 | ||
155 | isci_del_timer(ihost, timer); | |
156 | } | |
157 | ||
6f231dda | 158 | /** |
a1914059 | 159 | * isci_event_controller_start_complete() - This user callback will inform the |
6f231dda DW |
160 | * user that the controller has finished the start process. The associated |
161 | * isci host adapter's start_complete function is called. | |
162 | * @controller: This parameter specifies the controller that was started. | |
163 | * @completion_status: This parameter specifies the results of the start | |
164 | * operation. SCI_SUCCESS indicates successful completion. | |
165 | * | |
166 | */ | |
a1914059 | 167 | void isci_event_controller_start_complete( |
6f231dda DW |
168 | struct scic_sds_controller *controller, |
169 | enum sci_status completion_status) | |
170 | { | |
171 | struct isci_host *isci_host = | |
172 | (struct isci_host *)sci_object_get_association(controller); | |
173 | ||
174 | dev_dbg(&isci_host->pdev->dev, | |
175 | "%s: isci_host = %p\n", __func__, isci_host); | |
176 | ||
177 | isci_host_start_complete(isci_host, completion_status); | |
178 | } | |
179 | ||
180 | /** | |
a1914059 | 181 | * isci_event_controller_stop_complete() - This user callback will inform the user |
6f231dda DW |
182 | * that the controller has finished the stop process. The associated isci |
183 | * host adapter's start_complete function is called. | |
184 | * @controller: This parameter specifies the controller that was stopped. | |
185 | * @completion_status: This parameter specifies the results of the stop | |
186 | * operation. SCI_SUCCESS indicates successful completion. | |
187 | * | |
188 | */ | |
a1914059 | 189 | void isci_event_controller_stop_complete( |
6f231dda DW |
190 | struct scic_sds_controller *controller, |
191 | enum sci_status completion_status) | |
192 | { | |
193 | struct isci_host *isci_host = | |
194 | (struct isci_host *)sci_object_get_association(controller); | |
195 | ||
196 | dev_dbg(&isci_host->pdev->dev, | |
197 | "%s: status = 0x%x\n", __func__, completion_status); | |
198 | isci_host_stop_complete(isci_host, completion_status); | |
199 | } | |
200 | ||
201 | /** | |
a1914059 | 202 | * isci_event_io_request_complete() - This user callback will inform the user that |
6f231dda DW |
203 | * an IO request has completed. |
204 | * @controller: This parameter specifies the controller on which the IO is | |
205 | * completing. | |
206 | * @remote_device: This parameter specifies the remote device on which this IO | |
207 | * request is completing. | |
208 | * @io_request: This parameter specifies the IO request that has completed. | |
209 | * @completion_status: This parameter specifies the results of the IO request | |
210 | * operation. SCI_SUCCESS indicates successful completion. | |
211 | * | |
212 | */ | |
a1914059 | 213 | void isci_event_io_request_complete( |
6f231dda DW |
214 | struct scic_sds_controller *controller, |
215 | struct scic_sds_remote_device *remote_device, | |
216 | struct scic_sds_request *scic_io_request, | |
217 | enum sci_io_status completion_status) | |
218 | { | |
219 | struct isci_request *request; | |
220 | struct isci_host *isci_host; | |
221 | ||
222 | isci_host = | |
223 | (struct isci_host *)sci_object_get_association(controller); | |
224 | ||
225 | request = | |
226 | (struct isci_request *)sci_object_get_association( | |
227 | scic_io_request | |
228 | ); | |
229 | ||
230 | isci_request_io_request_complete(isci_host, | |
231 | request, | |
232 | completion_status); | |
233 | } | |
234 | ||
235 | /** | |
a1914059 | 236 | * isci_event_task_request_complete() - This user callback will inform the user |
6f231dda DW |
237 | * that a task management request completed. |
238 | * @controller: This parameter specifies the controller on which the task | |
239 | * management request is completing. | |
240 | * @remote_device: This parameter specifies the remote device on which this | |
241 | * task management request is completing. | |
242 | * @task_request: This parameter specifies the task management request that has | |
243 | * completed. | |
244 | * @completion_status: This parameter specifies the results of the IO request | |
245 | * operation. SCI_SUCCESS indicates successful completion. | |
246 | * | |
247 | */ | |
a1914059 | 248 | void isci_event_task_request_complete( |
6f231dda DW |
249 | struct scic_sds_controller *controller, |
250 | struct scic_sds_remote_device *remote_device, | |
251 | struct scic_sds_request *scic_task_request, | |
252 | enum sci_task_status completion_status) | |
253 | { | |
254 | struct isci_request *request; | |
255 | struct isci_host *isci_host; | |
256 | ||
257 | isci_host = | |
258 | (struct isci_host *)sci_object_get_association(controller); | |
259 | ||
260 | request = | |
261 | (struct isci_request *)sci_object_get_association( | |
262 | scic_task_request); | |
263 | ||
264 | isci_task_request_complete(isci_host, request, completion_status); | |
265 | } | |
266 | ||
267 | /** | |
a1914059 | 268 | * isci_event_port_stop_complete() - This method informs the user when a stop |
6f231dda DW |
269 | * operation on the port has completed. |
270 | * @controller: This parameter represents the controller which contains the | |
271 | * port. | |
272 | * @port: This parameter specifies the SCI port object for which the callback | |
273 | * is being invoked. | |
274 | * @completion_status: This parameter specifies the status for the operation | |
275 | * being completed. | |
276 | * | |
277 | */ | |
a1914059 | 278 | void isci_event_port_stop_complete( |
6f231dda DW |
279 | struct scic_sds_controller *controller, |
280 | struct scic_sds_port *port, | |
281 | enum sci_status completion_status) | |
282 | { | |
a1914059 DJ |
283 | struct isci_host *isci_host; |
284 | ||
285 | isci_host = (struct isci_host *)sci_object_get_association(controller); | |
286 | ||
287 | dev_notice(&isci_host->pdev->dev, "Port stop complete\n"); | |
6f231dda DW |
288 | } |
289 | ||
290 | /** | |
a1914059 | 291 | * isci_event_port_hard_reset_complete() - This method informs the user when a |
6f231dda DW |
292 | * hard reset on the port has completed. This hard reset could have been |
293 | * initiated by the user or by the remote port. | |
294 | * @controller: This parameter represents the controller which contains the | |
295 | * port. | |
296 | * @port: This parameter specifies the SCI port object for which the callback | |
297 | * is being invoked. | |
298 | * @completion_status: This parameter specifies the status for the operation | |
299 | * being completed. | |
300 | * | |
301 | */ | |
a1914059 | 302 | void isci_event_port_hard_reset_complete( |
6f231dda DW |
303 | struct scic_sds_controller *controller, |
304 | struct scic_sds_port *port, | |
305 | enum sci_status completion_status) | |
306 | { | |
307 | struct isci_port *isci_port | |
308 | = (struct isci_port *)sci_object_get_association(port); | |
309 | ||
310 | isci_port_hard_reset_complete(isci_port, completion_status); | |
311 | } | |
312 | ||
313 | /** | |
a1914059 | 314 | * isci_event_port_ready() - This method informs the user that the port is now in |
6f231dda DW |
315 | * a ready state and can be utilized to issue IOs. |
316 | * @controller: This parameter represents the controller which contains the | |
317 | * port. | |
318 | * @port: This parameter specifies the SCI port object for which the callback | |
319 | * is being invoked. | |
320 | * | |
321 | */ | |
a1914059 | 322 | void isci_event_port_ready( |
6f231dda DW |
323 | struct scic_sds_controller *controller, |
324 | struct scic_sds_port *port) | |
325 | { | |
326 | struct isci_port *isci_port; | |
327 | struct isci_host *isci_host; | |
328 | ||
329 | isci_host = | |
330 | (struct isci_host *)sci_object_get_association(controller); | |
331 | ||
332 | isci_port = | |
333 | (struct isci_port *)sci_object_get_association(port); | |
334 | ||
335 | dev_dbg(&isci_host->pdev->dev, | |
336 | "%s: isci_port = %p\n", __func__, isci_port); | |
337 | ||
338 | isci_port_ready(isci_host, isci_port); | |
339 | } | |
340 | ||
341 | /** | |
a1914059 | 342 | * isci_event_port_not_ready() - This method informs the user that the port is now |
6f231dda DW |
343 | * not in a ready (i.e. busy) state and can't be utilized to issue IOs. |
344 | * @controller: This parameter represents the controller which contains the | |
345 | * port. | |
346 | * @port: This parameter specifies the SCI port object for which the callback | |
347 | * is being invoked. | |
348 | * | |
349 | */ | |
a1914059 | 350 | void isci_event_port_not_ready( |
6f231dda DW |
351 | struct scic_sds_controller *controller, |
352 | struct scic_sds_port *port, | |
353 | u32 reason_code) | |
354 | { | |
355 | struct isci_port *isci_port; | |
356 | struct isci_host *isci_host; | |
357 | ||
358 | isci_host = | |
359 | (struct isci_host *)sci_object_get_association(controller); | |
360 | ||
361 | isci_port = | |
362 | (struct isci_port *)sci_object_get_association(port); | |
363 | ||
364 | dev_dbg(&isci_host->pdev->dev, | |
365 | "%s: isci_port = %p\n", __func__, isci_port); | |
366 | ||
367 | isci_port_not_ready(isci_host, isci_port); | |
368 | } | |
369 | ||
370 | /** | |
a1914059 | 371 | * isci_event_port_invalid_link_up() - This method informs the SCI Core user that |
6f231dda DW |
372 | * a phy/link became ready, but the phy is not allowed in the port. In some |
373 | * situations the underlying hardware only allows for certain phy to port | |
374 | * mappings. If these mappings are violated, then this API is invoked. | |
375 | * @controller: This parameter represents the controller which contains the | |
376 | * port. | |
377 | * @port: This parameter specifies the SCI port object for which the callback | |
378 | * is being invoked. | |
379 | * @phy: This parameter specifies the phy that came ready, but the phy can't be | |
380 | * a valid member of the port. | |
381 | * | |
382 | */ | |
a1914059 | 383 | void isci_event_port_invalid_link_up( |
6f231dda DW |
384 | struct scic_sds_controller *controller, |
385 | struct scic_sds_port *port, | |
386 | struct scic_sds_phy *phy) | |
387 | { | |
a1914059 DJ |
388 | struct isci_host *isci_host; |
389 | ||
390 | isci_host = (struct isci_host *)sci_object_get_association(controller); | |
391 | dev_warn(&isci_host->pdev->dev, "Invalid link up!\n"); | |
6f231dda DW |
392 | } |
393 | ||
394 | /** | |
a1914059 | 395 | * isci_event_port_bc_change_primitive_received() - This callback method informs |
6f231dda DW |
396 | * the user that a broadcast change primitive was received. |
397 | * @controller: This parameter represents the controller which contains the | |
398 | * port. | |
399 | * @port: This parameter specifies the SCI port object for which the callback | |
400 | * is being invoked. For instances where the phy on which the primitive was | |
a7e536c7 | 401 | * received is not part of a port, this parameter will be NULL. |
6f231dda DW |
402 | * @phy: This parameter specifies the phy on which the primitive was received. |
403 | * | |
404 | */ | |
a1914059 | 405 | void isci_event_port_bc_change_primitive_received( |
6f231dda DW |
406 | struct scic_sds_controller *controller, |
407 | struct scic_sds_port *port, | |
408 | struct scic_sds_phy *phy) | |
409 | { | |
410 | struct isci_host *isci_host; | |
411 | ||
412 | isci_host = | |
413 | (struct isci_host *)sci_object_get_association(controller); | |
414 | ||
415 | dev_dbg(&isci_host->pdev->dev, | |
416 | "%s: port = %p, phy = %p\n", __func__, port, phy); | |
417 | isci_port_bc_change_received(isci_host, port, phy); | |
418 | } | |
419 | ||
420 | ||
421 | ||
422 | ||
423 | /** | |
a1914059 | 424 | * isci_event_port_link_up() - This callback method informs the user that a phy |
6f231dda DW |
425 | * has become operational and is capable of communicating with the remote |
426 | * end point. | |
427 | * @controller: This parameter represents the controller associated with the | |
428 | * phy. | |
429 | * @port: This parameter specifies the port object for which the user callback | |
430 | * is being invoked. There may be conditions where this parameter can be | |
a7e536c7 | 431 | * NULL |
6f231dda DW |
432 | * @phy: This parameter specifies the phy object for which the user callback is |
433 | * being invoked. | |
434 | * | |
435 | * none. | |
436 | */ | |
a1914059 | 437 | void isci_event_port_link_up( |
6f231dda DW |
438 | struct scic_sds_controller *controller, |
439 | struct scic_sds_port *port, | |
440 | struct scic_sds_phy *phy) | |
441 | { | |
442 | struct isci_host *isci_host; | |
443 | ||
444 | isci_host = | |
445 | (struct isci_host *)sci_object_get_association(controller); | |
446 | ||
447 | dev_dbg(&isci_host->pdev->dev, | |
448 | "%s: phy = %p\n", __func__, phy); | |
449 | ||
450 | isci_port_link_up(isci_host, port, phy); | |
451 | } | |
452 | ||
453 | /** | |
a1914059 | 454 | * isci_event_port_link_down() - This callback method informs the user that a phy |
6f231dda DW |
455 | * is no longer operational and is not capable of communicating with the |
456 | * remote end point. | |
457 | * @controller: This parameter represents the controller associated with the | |
458 | * phy. | |
459 | * @port: This parameter specifies the port object for which the user callback | |
460 | * is being invoked. There may be conditions where this parameter can be | |
a7e536c7 | 461 | * NULL |
6f231dda DW |
462 | * @phy: This parameter specifies the phy object for which the user callback is |
463 | * being invoked. | |
464 | * | |
465 | * none. | |
466 | */ | |
a1914059 | 467 | void isci_event_port_link_down( |
6f231dda DW |
468 | struct scic_sds_controller *controller, |
469 | struct scic_sds_port *port, | |
470 | struct scic_sds_phy *phy) | |
471 | { | |
472 | struct isci_host *isci_host; | |
473 | struct isci_phy *isci_phy; | |
474 | struct isci_port *isci_port; | |
475 | ||
476 | isci_host = | |
477 | (struct isci_host *)sci_object_get_association(controller); | |
478 | ||
479 | isci_phy = | |
480 | (struct isci_phy *)sci_object_get_association(phy); | |
481 | ||
482 | isci_port = | |
483 | (struct isci_port *)sci_object_get_association(port); | |
484 | ||
485 | dev_dbg(&isci_host->pdev->dev, | |
486 | "%s: isci_port = %p\n", __func__, isci_port); | |
487 | ||
488 | isci_port_link_down(isci_host, isci_phy, isci_port); | |
489 | } | |
490 | ||
491 | /** | |
a1914059 | 492 | * isci_event_remote_device_start_complete() - This user callback method will |
6f231dda DW |
493 | * inform the user that a start operation has completed. |
494 | * @controller: This parameter specifies the core controller associated with | |
495 | * the completion callback. | |
496 | * @remote_device: This parameter specifies the remote device associated with | |
497 | * the completion callback. | |
498 | * @completion_status: This parameter specifies the completion status for the | |
499 | * operation. | |
500 | * | |
501 | */ | |
a1914059 | 502 | void isci_event_remote_device_start_complete( |
6f231dda DW |
503 | struct scic_sds_controller *controller, |
504 | struct scic_sds_remote_device *remote_device, | |
505 | enum sci_status completion_status) | |
506 | { | |
507 | struct isci_host *isci_host; | |
508 | struct isci_remote_device *isci_device; | |
509 | ||
510 | isci_host = | |
511 | (struct isci_host *)sci_object_get_association(controller); | |
512 | ||
513 | isci_device = | |
514 | (struct isci_remote_device *)sci_object_get_association( | |
515 | remote_device | |
516 | ); | |
517 | ||
518 | dev_dbg(&isci_host->pdev->dev, | |
519 | "%s: isci_device = %p\n", __func__, isci_device); | |
520 | ||
521 | isci_remote_device_start_complete( | |
522 | isci_host, isci_device, completion_status); | |
523 | ||
524 | } | |
525 | ||
526 | /** | |
a1914059 | 527 | * isci_event_remote_device_stop_complete() - This user callback method will |
6f231dda | 528 | * inform the user that a stop operation has completed. |
6ad31fec | 529 | * @scic: This parameter specifies the core controller associated with |
6f231dda DW |
530 | * the completion callback. |
531 | * @remote_device: This parameter specifies the remote device associated with | |
532 | * the completion callback. | |
533 | * @completion_status: This parameter specifies the completion status for the | |
534 | * operation. | |
535 | * | |
536 | */ | |
6ad31fec DW |
537 | void isci_event_remote_device_stop_complete(struct scic_sds_controller *scic, |
538 | struct scic_sds_remote_device *sci_dev, | |
539 | enum sci_status completion_status) | |
6f231dda | 540 | { |
6ad31fec DW |
541 | struct isci_host *ihost; |
542 | struct isci_remote_device *idev; | |
6f231dda | 543 | |
6ad31fec DW |
544 | ihost = sci_object_get_association(scic); |
545 | idev = sci_object_get_association(sci_dev); | |
6f231dda | 546 | |
6ad31fec DW |
547 | dev_dbg(&ihost->pdev->dev, |
548 | "%s: idev = %p\n", __func__, idev); | |
6f231dda | 549 | |
6ad31fec | 550 | isci_remote_device_stop_complete(ihost, idev, completion_status); |
6f231dda DW |
551 | } |
552 | ||
553 | /** | |
a1914059 | 554 | * isci_event_remote_device_ready() - This user callback method will inform the |
6f231dda DW |
555 | * user that a remote device is now capable of handling IO requests. |
556 | * @controller: This parameter specifies the core controller associated with | |
557 | * the completion callback. | |
558 | * @remote_device: This parameter specifies the remote device associated with | |
559 | * the callback. | |
560 | * | |
561 | */ | |
a1914059 | 562 | void isci_event_remote_device_ready( |
6f231dda DW |
563 | struct scic_sds_controller *controller, |
564 | struct scic_sds_remote_device *remote_device) | |
565 | { | |
566 | struct isci_remote_device *isci_device = | |
567 | (struct isci_remote_device *) | |
568 | sci_object_get_association(remote_device); | |
569 | ||
570 | dev_dbg(&isci_device->isci_port->isci_host->pdev->dev, | |
571 | "%s: isci_device = %p\n", __func__, isci_device); | |
572 | ||
573 | isci_remote_device_ready(isci_device); | |
574 | } | |
575 | ||
576 | /** | |
a1914059 | 577 | * isci_event_remote_device_not_ready() - This user callback method will inform |
6f231dda DW |
578 | * the user that a remote device is no longer capable of handling IO |
579 | * requests (until a ready callback is invoked). | |
580 | * @controller: This parameter specifies the core controller associated with | |
581 | * the completion callback. | |
582 | * @remote_device: This parameter specifies the remote device associated with | |
583 | * the callback. | |
584 | * @reason_code: This parameter specifies the reason for the remote device | |
585 | * going to a not ready state. | |
586 | * | |
587 | */ | |
a1914059 | 588 | void isci_event_remote_device_not_ready( |
6f231dda DW |
589 | struct scic_sds_controller *controller, |
590 | struct scic_sds_remote_device *remote_device, | |
591 | u32 reason_code) | |
592 | { | |
593 | struct isci_remote_device *isci_device = | |
594 | (struct isci_remote_device *) | |
595 | sci_object_get_association(remote_device); | |
596 | ||
597 | struct isci_host *isci_host; | |
598 | ||
599 | isci_host = | |
600 | (struct isci_host *)sci_object_get_association(controller); | |
601 | ||
602 | dev_dbg(&isci_host->pdev->dev, | |
603 | "%s: isci_device = %p, reason_code = %x\n", | |
604 | __func__, isci_device, reason_code); | |
605 | ||
606 | isci_remote_device_not_ready(isci_device, reason_code); | |
607 | } | |
608 | ||
609 |