2 * SPDX-License-Identifier: BSD-2-Clause OR GPL-2.0
4 * This file is provided under a dual BSD/GPLv2 license. When using or
5 * redistributing this file, you may do so under either license.
9 * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved.
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of version 2 of the GNU General Public License as
13 * published by the Free Software Foundation.
15 * This program is distributed in the hope that it will be useful, but
16 * WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 * General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
23 * The full GNU General Public License is included in this distribution
24 * in the file called LICENSE.GPL.
28 * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved.
29 * All rights reserved.
31 * Redistribution and use in source and binary forms, with or without
32 * modification, are permitted provided that the following conditions
35 * * Redistributions of source code must retain the above copyright
36 * notice, this list of conditions and the following disclaimer.
37 * * Redistributions in binary form must reproduce the above copyright
38 * notice, this list of conditions and the following disclaimer in
39 * the documentation and/or other materials provided with the
42 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
43 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
44 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
45 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
46 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
47 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
48 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
49 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
50 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
51 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
52 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
56 #ifndef _SCIF_SAS_DOMAIN_H_
57 #define _SCIF_SAS_DOMAIN_H_
62 * @brief This file contains the protected interface structures, constants,
63 * and methods for the SCIF_SAS_DOMAIN object.
70 #include <dev/isci/scil/sci_abstract_list.h>
71 #include <dev/isci/scil/sci_fast_list.h>
72 #include <dev/isci/scil/scif_domain.h>
74 #include <dev/isci/scil/sci_base_domain.h>
75 #include <dev/isci/scil/scif_sas_request.h>
76 #include <dev/isci/scil/scif_sas_task_request.h>
77 #include <dev/isci/scil/scif_sas_remote_device.h>
80 extern SCI_BASE_DOMAIN_STATE_HANDLER_T scif_sas_domain_state_handler_table[];
81 extern SCI_BASE_STATE_T scif_sas_domain_state_table[];
83 #define PORT_HARD_RESET_TIMEOUT 1000 //1000 miliseconds
85 #define SCIF_DOMAIN_DISCOVER_TIMEOUT 20000 // miliseconds
88 * @struct SCIF_SAS_DOMAIN
90 * @brief The SCI SAS Framework domain object abstracts the SAS domain
91 * level behavior for the framework component. Additionally,
92 * it provides a higher level of abstraction for the core port
93 * object. There is a 1:1 correspondance between core ports and
94 * framework domain objects. Essentially, each core port provides
95 * the access to the remote devices in the domain.
97 typedef struct SCIF_SAS_DOMAIN
100 * The SCI_BASE_DOMAIN is the parent object for the SCIF_SAS_DOMAIN
103 SCI_BASE_DOMAIN_T parent;
106 * This field contains the handle for the SCI Core port object that
107 * is managed by this framework domain object.
109 SCI_PORT_HANDLE_T core_object;
112 * This field specifies the controller containing this domain object.
114 struct SCIF_SAS_CONTROLLER * controller;
117 * This field references the list of state specific handler methods to
118 * be utilized for this domain instance.
120 SCI_BASE_DOMAIN_STATE_HANDLER_T * state_handlers;
123 * This field contains references to all of the devices contained in
126 SCI_ABSTRACT_LIST_T remote_device_list;
129 * This field contains the list of all outstanding request (IO or
130 * management) in this domain.
132 SCI_FAST_LIST_T request_list;
135 * This field indicates whether the core port object is in a ready state
141 * This field indicates the number of remote devices that have been
142 * started in this domain.
144 U32 device_start_count;
147 * This field indicates the number of remote devices that are currently
148 * in the process of becoming ready. This field is utilized to gate
149 * the transition back to the READY state for the domain.
151 U32 device_start_in_progress_count;
154 * This field records how many broadcast change primitve are
155 * received and not processed yet.
157 U32 broadcast_change_count;
160 * This fields indicates whether the expanders in this domain need to
161 * have there config route table configured by our driver. For expample,
162 * if we found the top level expander is a self-configuring expander and
163 * it is able to config others, all the expanders in this domain don't
164 * need to configure route table.
166 BOOL is_config_route_table_needed;
171 * This field provides the domain object a scratch area to indicate
172 * status of an ongoing operation.
177 * This is the timer handle that is utilized to time the discovery
178 * or domain reset operations.
183 * This field specifies the timeout value, in milliseconds, for the
184 * entire operation (discovery or reset).
189 * This field specifies the timeout value, in milliseconds, for a
198 void scif_sas_domain_construct(
199 SCIF_SAS_DOMAIN_T * fw_domain,
201 struct SCIF_SAS_CONTROLLER * fw_controller
204 void scif_sas_domain_terminate_requests(
205 SCIF_SAS_DOMAIN_T * fw_domain,
206 SCIF_SAS_REMOTE_DEVICE_T * fw_device,
207 SCIF_SAS_REQUEST_T * fw_request,
208 SCIF_SAS_TASK_REQUEST_T * fw_requestor
211 SCIF_SAS_REQUEST_T * scif_sas_domain_get_request_by_io_tag(
212 SCIF_SAS_DOMAIN_T * fw_domain,
216 void scif_sas_domain_transition_to_stopped_state(
217 SCIF_SAS_DOMAIN_T * fw_domain
220 void scif_sas_domain_initialize(
221 SCIF_SAS_DOMAIN_T * fw_domain
224 void scif_sas_domain_remote_device_start_complete(
225 SCIF_SAS_DOMAIN_T * fw_domain,
226 SCIF_SAS_REMOTE_DEVICE_T * fw_device
229 BOOL scif_sas_domain_is_in_smp_activity(
230 SCIF_SAS_DOMAIN_T * fw_domain
233 SCIF_SAS_REMOTE_DEVICE_T * scif_sas_domain_get_device_by_containing_device(
234 SCIF_SAS_DOMAIN_T * fw_domain,
235 SCIF_SAS_REMOTE_DEVICE_T * containing_device,
239 SCIF_SAS_REMOTE_DEVICE_T * scif_sas_domain_find_device_in_spinup_hold(
240 SCIF_SAS_DOMAIN_T * fw_domain
243 SCIF_SAS_REMOTE_DEVICE_T * scif_sas_domain_find_device_has_scheduled_activity(
244 SCIF_SAS_DOMAIN_T * fw_domain,
248 void scif_sas_domain_start_smp_activity(
249 SCIF_SAS_DOMAIN_T * fw_domain
252 void scif_sas_domain_remove_expander_device(
253 SCIF_SAS_DOMAIN_T * fw_domain,
254 SCIF_SAS_REMOTE_DEVICE_T * fw_device
257 void scif_sas_domain_start_smp_discover(
258 SCIF_SAS_DOMAIN_T * fw_domain,
259 SCIF_SAS_REMOTE_DEVICE_T * top_expander
262 void scif_sas_domain_continue_discover(
263 SCIF_SAS_DOMAIN_T * fw_domain
266 void scif_sas_domain_finish_discover(
267 SCIF_SAS_DOMAIN_T * fw_domain
270 void scif_sas_domain_transition_to_discovering_state(
271 SCIF_SAS_DOMAIN_T * fw_domain
274 void scif_sas_domain_cancel_smp_activities(
275 SCIF_SAS_DOMAIN_T * fw_domain
278 U8 scif_sas_domain_get_smp_request_count(
279 SCIF_SAS_DOMAIN_T * fw_domain
282 void scif_sas_domain_schedule_clear_affiliation(
283 SCIF_SAS_DOMAIN_T * fw_domain
286 void scif_sas_domain_start_clear_affiliation(
287 SCIF_SAS_DOMAIN_T * fw_domain
290 void scif_sas_domain_continue_clear_affiliation(
291 SCIF_SAS_DOMAIN_T * fw_domain
294 void scif_sas_domain_release_resource(
295 struct SCIF_SAS_CONTROLLER * fw_controller,
296 SCIF_SAS_DOMAIN_T * fw_domain
299 SCIF_SAS_REMOTE_DEVICE_T * scif_sas_domain_find_next_ea_target_reset(
300 SCIF_SAS_DOMAIN_T * fw_domain
303 #if !defined(DISABLE_WIDE_PORTED_TARGETS)
304 void scif_sas_domain_update_device_port_width(
305 SCIF_SAS_DOMAIN_T * fw_domain,
306 SCI_PORT_HANDLE_T port
308 #else //!defined(DISABLE_WIDE_PORTED_TARGETS)
309 #define scif_sas_domain_update_device_port_width(domain, port)
310 #endif //!defined(DISABLE_WIDE_PORTED_TARGETS)
313 void scif_sas_domain_initialize_state_logging(
314 SCIF_SAS_DOMAIN_T *fw_domain
317 void scif_sas_domain_deinitialize_state_logging(
318 SCIF_SAS_DOMAIN_T *fw_domain
321 #define scif_sas_domain_initialize_state_logging(x)
322 #define scif_sas_domain_deinitialize_state_logging(x)
323 #endif // SCI_LOGGING
327 #endif // __cplusplus
329 #endif // _SCIF_SAS_DOMAIN_H_