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 _SCIC_SDS_PHY_REGISTERS_H_
57 #define _SCIC_SDS_PHY_REGISTERS_H_
62 * @brief This file contains the macros used by the phy object to read/write
63 * to the SCU link layer registers.
70 #include <dev/isci/scil/scic_sds_controller.h>
72 //*****************************************************************************
73 //* SCU LINK LAYER REGISTER OPERATIONS
74 //*****************************************************************************
77 * Macro to read the transport layer register associated with this phy
80 #define scu_transport_layer_read(phy, reg) \
82 scic_sds_phy_get_controller(phy), \
83 (phy)->transport_layer_registers->reg \
87 * Macro to write the transport layer register associated with this phy
90 #define scu_transport_layer_write(phy, reg, value) \
92 scic_sds_phy_get_controller(phy), \
93 (phy)->transport_layer_registers->reg, \
97 //****************************************************************************
98 //* Transport Layer registers controlled by the phy object
99 //****************************************************************************
102 * This macro reads the Transport layer control register
104 #define SCU_TLCR_READ(phy) \
105 scu_transport_layer_read(phy, control)
108 * This macro writes the Transport layer control register
110 #define SCU_TLCR_WRITE(phy, value) \
111 scu_transport_layer_write(phy, control, value)
114 * This macro reads the Transport layer address translation register
116 #define SCU_TLADTR_READ(phy) \
117 scu_transport_layer_read(phy, address_translation)
120 * This macro writes the Transport layer address translation register
122 #define SCU_TLADTR_WRITE(phy) \
123 scu_transport_layer_write(phy, address_translation, value)
126 * This macro writes the STP Transport Layer Direct Attached RNi register.
128 #define SCU_STPTLDARNI_WRITE(phy, index) \
129 scu_transport_layer_write(phy, stp_rni, index)
132 * This macro reads the STP Transport Layer Direct Attached RNi register.
134 #define SCU_STPTLDARNI_READ(phy) \
135 scu_transport_layer_read(phy, stp_rni)
137 //*****************************************************************************
138 //* SCU LINK LAYER REGISTER OPERATIONS
139 //*****************************************************************************
142 * THis macro requests the SCU register write for the specified link layer
145 #define scu_link_layer_register_read(phy, reg) \
147 scic_sds_phy_get_controller(phy), \
148 (phy)->link_layer_registers->reg \
152 * This macro requests the SCU register read for the specified link layer
155 #define scu_link_layer_register_write(phy, reg, value) \
156 scu_register_write( \
157 scic_sds_phy_get_controller(phy), \
158 (phy)->link_layer_registers->reg, \
162 //*****************************************************************************
163 //* SCU LINK LAYER REGISTERS
164 //*****************************************************************************
166 /// This macro reads from the SAS Identify Frame PHY Identifier register
167 #define SCU_SAS_TIPID_READ(phy) \
168 scu_link_layer_register_read(phy, identify_frame_phy_id)
170 /// This macro writes to the SAS Identify Frame PHY Identifier register
171 #define SCU_SAS_TIPID_WRITE(phy, value) \
172 scu_link_layer_register_write(phy, identify_frame_phy_id, value)
174 /// This macro reads from the SAS Identification register
175 #define SCU_SAS_TIID_READ(phy) \
176 scu_link_layer_register_read(phy, transmit_identification)
178 /// This macro writes to the SAS Identification register
179 #define SCU_SAS_TIID_WRITE(phy, value) \
180 scu_link_layer_register_write(phy, transmit_identification, value)
182 /// This macro reads the SAS Device Name High register
183 #define SCU_SAS_TIDNH_READ(phy) \
184 scu_link_layer_register_read(phy, sas_device_name_high)
186 /// This macro writes the SAS Device Name High register
187 #define SCU_SAS_TIDNH_WRITE(phy, value) \
188 scu_link_layer_register_write(phy, sas_device_name_high, value)
190 /// This macro reads the SAS Device Name Low register
191 #define SCU_SAS_TIDNL_READ(phy) \
192 scu_link_layer_register_read(phy, sas_device_name_low)
194 /// This macro writes the SAS Device Name Low register
195 #define SCU_SAS_TIDNL_WRITE(phy, value) \
196 scu_link_layer_register_write(phy, sas_device_name_low, value)
198 /// This macro reads the Source SAS Address High register
199 #define SCU_SAS_TISSAH_READ(phy) \
200 scu_link_layer_register_read(phy, source_sas_address_high)
202 /// This macro writes the Source SAS Address High register
203 #define SCU_SAS_TISSAH_WRITE(phy, value) \
204 scu_link_layer_register_write(phy, source_sas_address_high, value)
206 /// This macro reads the Source SAS Address Low register
207 #define SCU_SAS_TISSAL_READ(phy) \
208 scu_link_layer_register_read(phy, source_sas_address_low)
210 /// This macro writes the Source SAS Address Low register
211 #define SCU_SAS_TISSAL_WRITE(phy, value) \
212 scu_link_layer_register_write(phy, source_sas_address_low, value)
214 /// This macro reads the PHY Configuration register
215 #define SCU_SAS_PCFG_READ(phy) \
216 scu_link_layer_register_read(phy, phy_configuration);
218 /// This macro writes the PHY Configuration register
219 #define SCU_SAS_PCFG_WRITE(phy, value) \
220 scu_link_layer_register_write(phy, phy_configuration, value)
222 /// This macro reads the PHY Enable Spinup register
223 #define SCU_SAS_ENSPINUP_READ(phy) \
224 scu_link_layer_register_read(phy, notify_enable_spinup_control)
226 /// This macro writes the PHY Enable Spinup register
227 #define SCU_SAS_ENSPINUP_WRITE(phy, value) \
228 scu_link_layer_register_write(phy, notify_enable_spinup_control, value)
230 /// This macro reads the CLKSM register
231 #define SCU_SAS_CLKSM_READ(phy) \
232 scu_link_layer_register_read(phy, clock_skew_management)
234 /// This macro writes the CLKSM register
235 #define SCU_SAS_CLKSM_WRITE(phy, value) \
236 scu_link_layer_register_write(phy, clock_skew_management, value)
238 /// This macro reads the PHY Capacity register
239 #define SCU_SAS_PHYCAP_READ(phy) \
240 scu_link_layer_register_read(phy, phy_capabilities)
242 /// This macro writes the PHY Capacity register
243 #define SCU_SAS_PHYCAP_WRITE(phy, value) \
244 scu_link_layer_register_write(phy, phy_capabilities, value)
246 /// This macro reads the Received PHY Capacity register
247 #define SCU_SAS_RECPHYCAP_READ(phy) \
248 scu_link_layer_register_read(phy, receive_phycap)
250 /// This macro reads the link layer control register
251 #define SCU_SAS_LLCTL_READ(phy) \
252 scu_link_layer_register_read(phy, link_layer_control);
254 /// This macro writes the link layer control register
255 #define SCU_SAS_LLCTL_WRITE(phy, value) \
256 scu_link_layer_register_write(phy, link_layer_control, value);
258 /// This macro reads the link layer status register
259 #define SCU_SAS_LLSTA_READ(phy) \
260 scu_link_layer_register_read(phy, link_layer_status);
262 #define SCU_SAS_ECENCR_READ(phy) \
263 scu_link_layer_register_read(phy, error_counter_event_notification_control)
265 #define SCU_SAS_ECENCR_WRITE(phy, value) \
266 scu_link_layer_register_write(phy, error_counter_event_notification_control, value)
270 #endif // __cplusplus
272 #endif // _SCIC_SDS_PHY_REGISTERS_H_