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 _SCI_BASE_PHY_H_
55 #define _SCI_BASE_PHY_H_
60 * @brief This file contains all of the structures, constants, and methods
61 * common to all phy object definitions.
68 #include <dev/isci/scil/sci_base_logger.h>
69 #include <dev/isci/scil/sci_base_state_machine.h>
70 #include <dev/isci/scil/sci_base_state_machine_logger.h>
73 * @enum SCI_BASE_PHY_STATES
75 * @brief This enumeration depicts the standard states common to all phy
76 * state machine implementations.
78 typedef enum _SCI_BASE_PHY_STATES
81 * Simply the initial state for the base domain state machine.
83 SCI_BASE_PHY_STATE_INITIAL,
86 * This state indicates that the phy has successfully been stopped.
87 * In this state no new IO operations are permitted on this phy.
88 * This state is entered from the INITIAL state.
89 * This state is entered from the STARTING state.
90 * This state is entered from the READY state.
91 * This state is entered from the RESETTING state.
93 SCI_BASE_PHY_STATE_STOPPED,
96 * This state indicates that the phy is in the process of becomming
97 * ready. In this state no new IO operations are permitted on this phy.
98 * This state is entered from the STOPPED state.
99 * This state is entered from the READY state.
100 * This state is entered from the RESETTING state.
102 SCI_BASE_PHY_STATE_STARTING,
105 * This state indicates the phy is now ready. Thus, the user
106 * is able to perform IO operations utilizing this phy as long as it
107 * is currently part of a valid port.
108 * This state is entered from the STARTING state.
110 SCI_BASE_PHY_STATE_READY,
113 * This state indicates that the phy is in the process of being reset.
114 * In this state no new IO operations are permitted on this phy.
115 * This state is entered from the READY state.
117 SCI_BASE_PHY_STATE_RESETTING,
120 * Simply the final state for the base phy state machine.
122 SCI_BASE_PHY_STATE_FINAL,
124 SCI_BASE_PHY_MAX_STATES
126 } SCI_BASE_PHY_STATES;
129 * @struct SCI_BASE_PHY
131 * @brief This structure defines all of the fields common to PHY objects.
133 typedef struct SCI_BASE_PHY
136 * This field depicts the parent object (SCI_BASE_OBJECT) for the phy.
138 SCI_BASE_OBJECT_T parent;
141 * This field contains the information for the base phy state machine.
143 SCI_BASE_STATE_MACHINE_T state_machine;
146 SCI_BASE_STATE_MACHINE_LOGGER_T state_machine_logger;
147 #endif // SCI_LOGGING
151 typedef SCI_STATUS (*SCI_BASE_PHY_HANDLER_T)(
156 * @struct SCI_BASE_PHY_STATE_HANDLER
158 * @brief This structure contains all of the state handler methods common to
159 * base phy state machines. Handler methods provide the ability
160 * to change the behavior for user requests or transitions depending
161 * on the state the machine is in.
163 typedef struct SCI_BASE_PHY_STATE_HANDLER
166 * The start_handler specifies the method invoked when there is an
167 * attempt to start a phy.
169 SCI_BASE_PHY_HANDLER_T start_handler;
172 * The stop_handler specifies the method invoked when there is an
173 * attempt to stop a phy.
175 SCI_BASE_PHY_HANDLER_T stop_handler;
178 * The reset_handler specifies the method invoked when there is an
179 * attempt to reset a phy.
181 SCI_BASE_PHY_HANDLER_T reset_handler;
184 * The destruct_handler specifies the method invoked when attempting to
187 SCI_BASE_PHY_HANDLER_T destruct_handler;
189 } SCI_BASE_PHY_STATE_HANDLER_T;
192 * @brief Construct the base phy
194 * @param[in] this_phy This parameter specifies the base phy to be
196 * @param[in] logger This parameter specifies the logger associated with
197 * this base phy object.
198 * @param[in] state_table This parameter specifies the table of state
199 * definitions to be utilized for the phy state machine.
203 void sci_base_phy_construct(
204 SCI_BASE_PHY_T * this_phy,
205 SCI_BASE_LOGGER_T * logger,
206 SCI_BASE_STATE_T * state_table
211 #endif // __cplusplus
213 #endif // _SCI_BASE_PHY_H_