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.
7 * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved.
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.
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.
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.
26 * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved.
27 * All rights reserved.
29 * Redistribution and use in source and binary forms, with or without
30 * modification, are permitted provided that the following conditions
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
40 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
41 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
42 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
43 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
44 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
45 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
46 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
47 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
48 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
49 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
50 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
54 #ifndef _SCIF_SAS_DOMAIN_H_
55 #define _SCIF_SAS_DOMAIN_H_
60 * @brief This file contains the protected interface structures, constants,
61 * and methods for the SCIF_SAS_DOMAIN object.
68 #include <dev/isci/scil/sci_abstract_list.h>
69 #include <dev/isci/scil/sci_fast_list.h>
70 #include <dev/isci/scil/scif_domain.h>
72 #include <dev/isci/scil/sci_base_domain.h>
73 #include <dev/isci/scil/scif_sas_request.h>
74 #include <dev/isci/scil/scif_sas_task_request.h>
75 #include <dev/isci/scil/scif_sas_remote_device.h>
78 extern SCI_BASE_DOMAIN_STATE_HANDLER_T scif_sas_domain_state_handler_table[];
79 extern SCI_BASE_STATE_T scif_sas_domain_state_table[];
81 #define PORT_HARD_RESET_TIMEOUT 1000 //1000 miliseconds
83 #define SCIF_DOMAIN_DISCOVER_TIMEOUT 20000 // miliseconds
86 * @struct SCIF_SAS_DOMAIN
88 * @brief The SCI SAS Framework domain object abstracts the SAS domain
89 * level behavior for the framework component. Additionally,
90 * it provides a higher level of abstraction for the core port
91 * object. There is a 1:1 correspondance between core ports and
92 * framework domain objects. Essentially, each core port provides
93 * the access to the remote devices in the domain.
95 typedef struct SCIF_SAS_DOMAIN
98 * The SCI_BASE_DOMAIN is the parent object for the SCIF_SAS_DOMAIN
101 SCI_BASE_DOMAIN_T parent;
104 * This field contains the handle for the SCI Core port object that
105 * is managed by this framework domain object.
107 SCI_PORT_HANDLE_T core_object;
110 * This field specifies the controller containing this domain object.
112 struct SCIF_SAS_CONTROLLER * controller;
115 * This field references the list of state specific handler methods to
116 * be utilized for this domain instance.
118 SCI_BASE_DOMAIN_STATE_HANDLER_T * state_handlers;
121 * This field contains references to all of the devices contained in
124 SCI_ABSTRACT_LIST_T remote_device_list;
127 * This field contains the list of all outstanding request (IO or
128 * management) in this domain.
130 SCI_FAST_LIST_T request_list;
133 * This field indicates whether the core port object is in a ready state
139 * This field indicates the number of remote devices that have been
140 * started in this domain.
142 U32 device_start_count;
145 * This field indicates the number of remote devices that are currently
146 * in the process of becoming ready. This field is utilized to gate
147 * the transition back to the READY state for the domain.
149 U32 device_start_in_progress_count;
152 * This field records how many broadcast change primitve are
153 * received and not processed yet.
155 U32 broadcast_change_count;
158 * This fields indicates whether the expanders in this domain need to
159 * have there config route table configured by our driver. For expample,
160 * if we found the top level expander is a self-configuring expander and
161 * it is able to config others, all the expanders in this domain don't
162 * need to configure route table.
164 BOOL is_config_route_table_needed;
169 * This field provides the domain object a scratch area to indicate
170 * status of an ongoing operation.
175 * This is the timer handle that is utilized to time the discovery
176 * or domain reset operations.
181 * This field specifies the timeout value, in milliseconds, for the
182 * entire operation (discovery or reset).
187 * This field specifies the timeout value, in milliseconds, for a
196 void scif_sas_domain_construct(
197 SCIF_SAS_DOMAIN_T * fw_domain,
199 struct SCIF_SAS_CONTROLLER * fw_controller
202 void scif_sas_domain_terminate_requests(
203 SCIF_SAS_DOMAIN_T * fw_domain,
204 SCIF_SAS_REMOTE_DEVICE_T * fw_device,
205 SCIF_SAS_REQUEST_T * fw_request,
206 SCIF_SAS_TASK_REQUEST_T * fw_requestor
209 SCIF_SAS_REQUEST_T * scif_sas_domain_get_request_by_io_tag(
210 SCIF_SAS_DOMAIN_T * fw_domain,
214 void scif_sas_domain_transition_to_stopped_state(
215 SCIF_SAS_DOMAIN_T * fw_domain
218 void scif_sas_domain_initialize(
219 SCIF_SAS_DOMAIN_T * fw_domain
222 void scif_sas_domain_remote_device_start_complete(
223 SCIF_SAS_DOMAIN_T * fw_domain,
224 SCIF_SAS_REMOTE_DEVICE_T * fw_device
227 BOOL scif_sas_domain_is_in_smp_activity(
228 SCIF_SAS_DOMAIN_T * fw_domain
231 SCIF_SAS_REMOTE_DEVICE_T * scif_sas_domain_get_device_by_containing_device(
232 SCIF_SAS_DOMAIN_T * fw_domain,
233 SCIF_SAS_REMOTE_DEVICE_T * containing_device,
237 SCIF_SAS_REMOTE_DEVICE_T * scif_sas_domain_find_device_in_spinup_hold(
238 SCIF_SAS_DOMAIN_T * fw_domain
241 SCIF_SAS_REMOTE_DEVICE_T * scif_sas_domain_find_device_has_scheduled_activity(
242 SCIF_SAS_DOMAIN_T * fw_domain,
246 void scif_sas_domain_start_smp_activity(
247 SCIF_SAS_DOMAIN_T * fw_domain
250 void scif_sas_domain_remove_expander_device(
251 SCIF_SAS_DOMAIN_T * fw_domain,
252 SCIF_SAS_REMOTE_DEVICE_T * fw_device
255 void scif_sas_domain_start_smp_discover(
256 SCIF_SAS_DOMAIN_T * fw_domain,
257 SCIF_SAS_REMOTE_DEVICE_T * top_expander
260 void scif_sas_domain_continue_discover(
261 SCIF_SAS_DOMAIN_T * fw_domain
264 void scif_sas_domain_finish_discover(
265 SCIF_SAS_DOMAIN_T * fw_domain
268 void scif_sas_domain_transition_to_discovering_state(
269 SCIF_SAS_DOMAIN_T * fw_domain
272 void scif_sas_domain_cancel_smp_activities(
273 SCIF_SAS_DOMAIN_T * fw_domain
276 U8 scif_sas_domain_get_smp_request_count(
277 SCIF_SAS_DOMAIN_T * fw_domain
280 void scif_sas_domain_schedule_clear_affiliation(
281 SCIF_SAS_DOMAIN_T * fw_domain
284 void scif_sas_domain_start_clear_affiliation(
285 SCIF_SAS_DOMAIN_T * fw_domain
288 void scif_sas_domain_continue_clear_affiliation(
289 SCIF_SAS_DOMAIN_T * fw_domain
292 void scif_sas_domain_release_resource(
293 struct SCIF_SAS_CONTROLLER * fw_controller,
294 SCIF_SAS_DOMAIN_T * fw_domain
297 SCIF_SAS_REMOTE_DEVICE_T * scif_sas_domain_find_next_ea_target_reset(
298 SCIF_SAS_DOMAIN_T * fw_domain
301 #if !defined(DISABLE_WIDE_PORTED_TARGETS)
302 void scif_sas_domain_update_device_port_width(
303 SCIF_SAS_DOMAIN_T * fw_domain,
304 SCI_PORT_HANDLE_T port
306 #else //!defined(DISABLE_WIDE_PORTED_TARGETS)
307 #define scif_sas_domain_update_device_port_width(domain, port)
308 #endif //!defined(DISABLE_WIDE_PORTED_TARGETS)
311 void scif_sas_domain_initialize_state_logging(
312 SCIF_SAS_DOMAIN_T *fw_domain
315 void scif_sas_domain_deinitialize_state_logging(
316 SCIF_SAS_DOMAIN_T *fw_domain
319 #define scif_sas_domain_initialize_state_logging(x)
320 #define scif_sas_domain_deinitialize_state_logging(x)
321 #endif // SCI_LOGGING
325 #endif // __cplusplus
327 #endif // _SCIF_SAS_DOMAIN_H_