blob: 34d22c04aa567fcefdbf7a96c9d5446fe7312d52 [file] [log] [blame]
Dan Williams6f231dd2011-07-02 22:56:22 -07001/*
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#ifndef _SCIC_PORT_H_
57#define _SCIC_PORT_H_
58
59/**
60 * This file contains all of the interface methods that can be called by an SCI
61 * Core user on a SAS or SATA port.
62 *
63 *
64 */
65
66
67#include "sci_types.h"
68#include "sci_status.h"
69#include "intel_sas.h"
70
71struct scic_sds_port;
72
73enum SCIC_PORT_NOT_READY_REASON_CODE {
74 SCIC_PORT_NOT_READY_NO_ACTIVE_PHYS,
75 SCIC_PORT_NOT_READY_HARD_RESET_REQUESTED,
76 SCIC_PORT_NOT_READY_INVALID_PORT_CONFIGURATION,
77 SCIC_PORT_NOT_READY_RECONFIGURING,
78
79 SCIC_PORT_NOT_READY_REASON_CODE_MAX
80};
81
82/**
83 * struct scic_port_end_point_properties - This structure defines the
84 * properties that can be retrieved for each end-point local or remote
85 * (attached) port in the controller.
86 *
87 *
88 */
89struct scic_port_end_point_properties {
90 /**
91 * This field indicates the SAS address for the associated end
92 * point in the port.
93 */
94 struct sci_sas_address sas_address;
95
96 /**
97 * This field indicates the protocols supported by the associated
98 * end-point in the port.
99 */
100 struct sci_sas_identify_address_frame_protocols protocols;
101
102};
103
104/**
105 * struct scic_port_properties - This structure defines the properties that can
106 * be retrieved for each port in the controller.
107 *
108 *
109 */
110struct scic_port_properties {
111 /**
112 * This field specifies the logical index of the port (0 relative).
113 */
114 u32 index;
115
116 /**
117 * This field indicates the local end-point properties for port.
118 */
119 struct scic_port_end_point_properties local;
120
121 /**
122 * This field indicates the remote (attached) end-point properties
123 * for the port.
124 */
125 struct scic_port_end_point_properties remote;
126
127 /**
128 * This field specifies the phys contained inside the port.
129 */
130 u32 phy_mask;
131
132};
133
134/**
135 * scic_port_get_properties() - This method simply returns the properties
136 * regarding the port, such as: physical index, protocols, sas address, etc.
137 * @port: this parameter specifies the port for which to retrieve the physical
138 * index.
139 * @properties: This parameter specifies the properties structure into which to
140 * copy the requested information.
141 *
142 * Indicate if the user specified a valid port. SCI_SUCCESS This value is
143 * returned if the specified port was valid. SCI_FAILURE_INVALID_PORT This
144 * value is returned if the specified port is not valid. When this value is
145 * returned, no data is copied to the properties output parameter.
146 */
147enum sci_status scic_port_get_properties(
148 struct scic_sds_port *port,
149 struct scic_port_properties *properties);
150
151
152
153/**
154 * scic_port_start() - This method will make the port ready for operation.
155 * Prior to calling the start method IO operation is not possible.
156 * @port: This parameter specifies the port to be started.
157 *
158 * Indicate if the port was successfully started. SCI_SUCCESS This value is
159 * returned if the port was successfully started. SCI_WARNING_ALREADY_IN_STATE
160 * This value is returned if the port is in the process of starting.
161 * SCI_FAILURE_INVALID_PORT This value is returned if the supplied port is not
162 * valid. SCI_FAILURE_INVALID_STATE This value is returned if a start operation
163 * can't be completed due to the state of port.
164 */
165enum sci_status scic_port_start(
166 struct scic_sds_port *port);
167
168/**
169 * scic_port_stop() - This method will make the port no longer ready for
170 * operation. After invoking this method IO operation is not possible.
171 * @port: This parameter specifies the port to be stopped.
172 *
173 * Indicate if the port was successfully stopped. SCI_SUCCESS This value is
174 * returned if the port was successfully stopped. SCI_WARNING_ALREADY_IN_STATE
175 * This value is returned if the port is already stopped or in the process of
176 * stopping. SCI_FAILURE_INVALID_PORT This value is returned if the supplied
177 * port is not valid. SCI_FAILURE_INVALID_STATE This value is returned if a
178 * stop operation can't be completed due to the state of port.
179 */
180enum sci_status scic_port_stop(
181 struct scic_sds_port *port);
182
183/**
184 * scic_port_hard_reset() - This method will request the SCI implementation to
185 * perform a HARD RESET on the SAS Port. If/When the HARD RESET completes
186 * the SCI user will be notified via an SCI OS callback indicating a direct
187 * attached device was found.
188 * @port: a handle corresponding to the SAS port to be hard reset.
189 * @reset_timeout: This parameter specifies the number of milliseconds in which
190 * the port reset operation should complete.
191 *
192 * The SCI User callback in SCIC_USER_CALLBACKS_T will only be called once for
193 * each phy in the SAS Port at completion of the hard reset sequence. Return a
194 * status indicating whether the hard reset started successfully. SCI_SUCCESS
195 * This value is returned if the hard reset operation started successfully.
196 */
197enum sci_status scic_port_hard_reset(
198 struct scic_sds_port *port,
199 u32 reset_timeout);
200
201/**
202 * scic_port_enable_broadcast_change_notification() - This API method enables
203 * the broadcast change notification from underneath hardware.
204 * @port: The port upon which broadcast change notifications (BCN) are to be
205 * enabled.
206 *
207 */
208void scic_port_enable_broadcast_change_notification(
209 struct scic_sds_port *port);
210
211
212#endif /* _SCIC_PORT_H_ */
213