events.h 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373
  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. #ifndef _ISCI_EVENT_H_
  56. #define _ISCI_EVENT_H_
  57. /**
  58. * isci_event_timer_create() - This callback method asks the user to create a
  59. * timer and provide a handle for this timer for use in further timer
  60. * interactions.
  61. * @controller: This parameter specifies the controller with which this timer
  62. * is to be associated.
  63. * @timer_callback: This parameter specifies the callback method to be invoked
  64. * whenever the timer expires.
  65. * @cookie: This parameter specifies a piece of information that the user must
  66. * retain. This cookie is to be supplied by the user anytime a timeout
  67. * occurs for the created timer.
  68. *
  69. * The "timer_callback" method should be executed in a mutually exlusive manner
  70. * from the controller completion handler handler. This method returns a handle
  71. * to a timer object created by the user. The handle will be utilized for all
  72. * further interactions relating to this timer.
  73. */
  74. void *isci_event_timer_create(
  75. struct scic_sds_controller *controller,
  76. void (*timer_callback)(void *),
  77. void *cookie);
  78. /**
  79. * isci_event_timer_start() - This callback method asks the user to start the
  80. * supplied timer.
  81. * @controller: This parameter specifies the controller with which this timer
  82. * is to associated.
  83. * @timer: This parameter specifies the timer to be started.
  84. * @milliseconds: This parameter specifies the number of milliseconds for which
  85. * to stall. The operating system driver is allowed to round this value up
  86. * where necessary.
  87. *
  88. * All timers in the system started by the SCI Core are one shot timers.
  89. * Therefore, the SCI user should make sure that it removes the timer from it's
  90. * list when a timer actually fires. Additionally, SCI Core user's should be
  91. * able to handle calls from the SCI Core to stop a timer that may already be
  92. * stopped. none
  93. */
  94. void isci_event_timer_start(
  95. struct scic_sds_controller *controller,
  96. void *timer,
  97. u32 milliseconds);
  98. /**
  99. * isci_event_timer_stop() - This callback method asks the user to stop the
  100. * supplied timer.
  101. * @controller: This parameter specifies the controller with which this timer
  102. * is to associated.
  103. * @timer: This parameter specifies the timer to be stopped.
  104. *
  105. */
  106. void isci_event_timer_stop(
  107. struct scic_sds_controller *controller,
  108. void *timer);
  109. void isci_event_timer_destroy(struct scic_sds_controller *scic, void *timer);
  110. /**
  111. * isci_event_controller_start_complete() - This user callback will inform the
  112. * user that the controller has finished the start process.
  113. * @controller: This parameter specifies the controller that was started.
  114. * @completion_status: This parameter specifies the results of the start
  115. * operation. SCI_SUCCESS indicates successful completion.
  116. *
  117. */
  118. void isci_event_controller_start_complete(
  119. struct scic_sds_controller *controller,
  120. enum sci_status completion_status);
  121. /**
  122. * isci_event_controller_stop_complete() - This user callback will inform the
  123. * user that the controller has finished the stop process.
  124. * @controller: This parameter specifies the controller that was stopped.
  125. * @completion_status: This parameter specifies the results of the stop
  126. * operation. SCI_SUCCESS indicates successful completion.
  127. *
  128. */
  129. void isci_event_controller_stop_complete(
  130. struct scic_sds_controller *controller,
  131. enum sci_status completion_status);
  132. /**
  133. * isci_event_io_request_complete() - This user callback will inform the user
  134. * that an IO request has completed.
  135. * @controller: This parameter specifies the controller on which the IO is
  136. * completing.
  137. * @remote_device: This parameter specifies the remote device on which this IO
  138. * request is completing.
  139. * @io_request: This parameter specifies the IO request that has completed.
  140. * @completion_status: This parameter specifies the results of the IO request
  141. * operation. SCI_SUCCESS indicates successful completion.
  142. *
  143. */
  144. void isci_event_io_request_complete(
  145. struct scic_sds_controller *controller,
  146. struct scic_sds_remote_device *remote_device,
  147. struct scic_sds_request *scic_io_request,
  148. enum sci_io_status completion_status);
  149. /**
  150. * isci_event_task_request_complete() - This user callback will inform the user
  151. * that a task management request completed.
  152. * @controller: This parameter specifies the controller on which the task
  153. * management request is completing.
  154. * @remote_device: This parameter specifies the remote device on which this
  155. * task management request is completing.
  156. * @task_request: This parameter specifies the task management request that has
  157. * completed.
  158. * @completion_status: This parameter specifies the results of the IO request
  159. * operation. SCI_SUCCESS indicates successful completion.
  160. *
  161. */
  162. void isci_event_task_request_complete(
  163. struct scic_sds_controller *controller,
  164. struct scic_sds_remote_device *remote_device,
  165. struct scic_sds_request *scic_task_request,
  166. enum sci_task_status completion_status);
  167. /**
  168. * isci_event_port_stop_complete() - This method informs the user when a stop
  169. * operation on the port has completed.
  170. * @controller: This parameter represents the controller which contains the
  171. * port.
  172. * @port: This parameter specifies the SCI port object for which the callback
  173. * is being invoked.
  174. * @completion_status: This parameter specifies the status for the operation
  175. * being completed.
  176. *
  177. */
  178. void isci_event_port_stop_complete(
  179. struct scic_sds_controller *controller,
  180. struct scic_sds_port *port,
  181. enum sci_status completion_status);
  182. /**
  183. * isci_event_port_hard_reset_complete() - This method informs the user when a
  184. * hard reset on the port has completed. This hard reset could have been
  185. * initiated by the user or by the remote port.
  186. * @controller: This parameter represents the controller which contains the
  187. * port.
  188. * @port: This parameter specifies the SCI port object for which the callback
  189. * is being invoked.
  190. * @completion_status: This parameter specifies the status for the operation
  191. * being completed.
  192. *
  193. */
  194. void isci_event_port_hard_reset_complete(
  195. struct scic_sds_controller *controller,
  196. struct scic_sds_port *port,
  197. enum sci_status completion_status);
  198. /**
  199. * isci_event_port_ready() - This method informs the user that the port is now
  200. * in a ready state and can be utilized to issue IOs.
  201. * @controller: This parameter represents the controller which contains the
  202. * port.
  203. * @port: This parameter specifies the SCI port object for which the callback
  204. * is being invoked.
  205. *
  206. */
  207. void isci_event_port_ready(
  208. struct scic_sds_controller *controller,
  209. struct scic_sds_port *port);
  210. /**
  211. * isci_event_port_not_ready() - This method informs the user that the port is
  212. * now not in a ready (i.e. busy) state and can't be utilized to issue IOs.
  213. * @controller: This parameter represents the controller which contains the
  214. * port.
  215. * @port: This parameter specifies the SCI port object for which the callback
  216. * is being invoked.
  217. * @reason_code: This parameter specifies the reason for the port not ready
  218. * callback.
  219. *
  220. */
  221. void isci_event_port_not_ready(
  222. struct scic_sds_controller *controller,
  223. struct scic_sds_port *port,
  224. u32 reason_code);
  225. /**
  226. * isci_event_port_invalid_link_up() - This method informs the SCI Core user
  227. * that a phy/link became ready, but the phy is not allowed in the port. In
  228. * some situations the underlying hardware only allows for certain phy to port
  229. * mappings. If these mappings are violated, then this API is invoked.
  230. * @controller: This parameter represents the controller which contains the
  231. * port.
  232. * @port: This parameter specifies the SCI port object for which the callback
  233. * is being invoked.
  234. * @phy: This parameter specifies the phy that came ready, but the phy can't be
  235. * a valid member of the port.
  236. *
  237. */
  238. void isci_event_port_invalid_link_up(
  239. struct scic_sds_controller *controller,
  240. struct scic_sds_port *port,
  241. struct scic_sds_phy *phy);
  242. /**
  243. * isci_event_port_bc_change_primitive_received() - This callback method informs
  244. * the user that a broadcast change primitive was received.
  245. * @controller: This parameter represents the controller which contains the
  246. * port.
  247. * @port: This parameter specifies the SCI port object for which the callback
  248. * is being invoked. For instances where the phy on which the primitive was
  249. * received is not part of a port, this parameter will be
  250. * NULL.
  251. * @phy: This parameter specifies the phy on which the primitive was received.
  252. *
  253. */
  254. void isci_event_port_bc_change_primitive_received(
  255. struct scic_sds_controller *controller,
  256. struct scic_sds_port *port,
  257. struct scic_sds_phy *phy);
  258. /**
  259. * isci_event_port_link_up() - This callback method informs the user that a phy
  260. * has become operational and is capable of communicating with the remote
  261. * end point.
  262. * @controller: This parameter represents the controller associated with the
  263. * phy.
  264. * @port: This parameter specifies the port object for which the user callback
  265. * is being invoked. There may be conditions where this parameter can be
  266. * NULL
  267. * @phy: This parameter specifies the phy object for which the user callback is
  268. * being invoked.
  269. *
  270. */
  271. void isci_event_port_link_up(
  272. struct scic_sds_controller *controller,
  273. struct scic_sds_port *port,
  274. struct scic_sds_phy *phy);
  275. /**
  276. * isci_event_port_link_down() - This callback method informs the user that a
  277. * phy is no longer operational and is not capable of communicating with the
  278. * remote end point.
  279. * @controller: This parameter represents the controller associated with the
  280. * phy.
  281. * @port: This parameter specifies the port object for which the user callback
  282. * is being invoked. There may be conditions where this parameter can be
  283. * NULL
  284. * @phy: This parameter specifies the phy object for which the user callback is
  285. * being invoked.
  286. *
  287. */
  288. void isci_event_port_link_down(
  289. struct scic_sds_controller *controller,
  290. struct scic_sds_port *port,
  291. struct scic_sds_phy *phy);
  292. /**
  293. * isci_event_remote_device_start_complete() - This user callback method will
  294. * inform the user that a start operation has completed.
  295. * @controller: This parameter specifies the core controller associated with
  296. * the completion callback.
  297. * @remote_device: This parameter specifies the remote device associated with
  298. * the completion callback.
  299. * @completion_status: This parameter specifies the completion status for the
  300. * operation.
  301. *
  302. */
  303. void isci_event_remote_device_start_complete(
  304. struct scic_sds_controller *controller,
  305. struct scic_sds_remote_device *remote_device,
  306. enum sci_status completion_status);
  307. /**
  308. * isci_event_remote_device_stop_complete() - This user callback method will
  309. * inform the user that a stop operation has completed.
  310. * @controller: This parameter specifies the core controller associated with
  311. * the completion callback.
  312. * @remote_device: This parameter specifies the remote device associated with
  313. * the completion callback.
  314. * @completion_status: This parameter specifies the completion status for the
  315. * operation.
  316. *
  317. */
  318. void isci_event_remote_device_stop_complete(
  319. struct scic_sds_controller *controller,
  320. struct scic_sds_remote_device *remote_device,
  321. enum sci_status completion_status);
  322. /**
  323. * isci_event_remote_device_ready() - This user callback method will inform the
  324. * user that a remote device is now capable of handling IO requests.
  325. * @controller: This parameter specifies the core controller associated with
  326. * the completion callback.
  327. * @remote_device: This parameter specifies the remote device associated with
  328. * the callback.
  329. *
  330. */
  331. void isci_event_remote_device_ready(
  332. struct scic_sds_controller *controller,
  333. struct scic_sds_remote_device *remote_device);
  334. /**
  335. * isci_event_remote_device_not_ready() - This user callback method will inform
  336. * the user that a remote device is no longer capable of handling IO
  337. * requests (until a ready callback is invoked).
  338. * @controller: This parameter specifies the core controller associated with
  339. * the completion callback.
  340. * @remote_device: This parameter specifies the remote device associated with
  341. * the callback.
  342. * @reason_code: This paramete specifies the reason the remote device is not
  343. * ready.
  344. *
  345. */
  346. void isci_event_remote_device_not_ready(
  347. struct scic_sds_controller *controller,
  348. struct scic_sds_remote_device *remote_device,
  349. u32 reason_code);
  350. #endif