isci: fix fragile/conditional isci_host lookups
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / drivers / scsi / isci / core / scic_sds_phy_registers.h
blobddbb2361510d31cf38754f7f8ee16751904a8c2e
1 /*
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.
5 * GPL LICENSE SUMMARY
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.
24 * BSD LICENSE
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
31 * are met:
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.
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.
56 #ifndef _SCIC_SDS_PHY_REGISTERS_H_
57 #define _SCIC_SDS_PHY_REGISTERS_H_
59 /**
60 * This file contains the macros used by the phy object to read/write to the
61 * SCU link layer registers.
66 #include "scic_sds_controller.h"
68 /* **************************************************************************
69 * * SCU TRANSPORT LAYER REGISTER OPERATIONS
70 * ************************************************************************** */
72 /**
73 * Macro to read the transport layer register associated with this phy
74 * object.
76 #define scu_transport_layer_read(phy, reg) \
77 scu_register_read( \
78 scic_sds_phy_get_controller(phy), \
79 (phy)->transport_layer_registers->reg \
82 /**
83 * Macro to write the transport layer register associated with this phy
84 * object.
86 #define scu_transport_layer_write(phy, reg, value) \
87 scu_register_write( \
88 scic_sds_phy_get_controller(phy), \
89 (phy)->transport_layer_registers->reg, \
90 (value) \
93 /* **************************************************************************
94 * * Transport Layer registers controlled by the phy object
95 * ************************************************************************** */
97 /* This macro reads the Transport layer control register */
98 #define SCU_TLCR_READ(phy) \
99 scu_transport_layer_read(phy, control)
101 /* This macro writes the Transport layer control register */
102 #define SCU_TLCR_WRITE(phy, value) \
103 scu_transport_layer_write(phy, control, value)
105 /* This macro reads the Transport layer address translation register */
106 #define SCU_TLADTR_READ(phy) \
107 scu_transport_layer_read(phy, address_translation)
109 /* This macro writes the Transport layer address translation register */
110 #define SCU_TLADTR_WRITE(phy) \
111 scu_transport_layer_write(phy, address_translation, value)
113 /* This macro writes the STP Transport Layer Direct Attached RNi register */
114 #define SCU_STPTLDARNI_WRITE(phy, index) \
115 scu_transport_layer_write(phy, stp_rni, index)
117 /* This macro reads the STP Transport Layer Direct Attached RNi register */
118 #define SCU_STPTLDARNI_READ(phy) \
119 scu_transport_layer_read(phy, stp_rni)
122 * *****************************************************************************
123 * * SCU LINK LAYER REGISTER OPERATIONS
124 * ***************************************************************************** */
127 * scu_link_layer_register_read() -
129 * THis macro requests the SCU register write for the specified link layer
130 * register.
132 #define scu_link_layer_register_read(phy, reg) \
133 scu_register_read(\
134 scic_sds_phy_get_controller(phy), \
135 (phy)->link_layer_registers->reg \
139 * scu_link_layer_register_write() -
141 * This macro requests the SCU register read for the specified link layer
142 * register.
144 #define scu_link_layer_register_write(phy, reg, value) \
145 scu_register_write(\
146 scic_sds_phy_get_controller(phy), \
147 (phy)->link_layer_registers->reg, \
148 (value) \
152 * *****************************************************************************
153 * * SCU LINK LAYER REGISTERS
154 * ***************************************************************************** */
156 /* / This macro reads from the SAS Identify Frame PHY Identifier register */
157 #define SCU_SAS_TIPID_READ(phy) \
158 scu_link_layer_register_read(phy, identify_frame_phy_id)
160 /* / This macro writes to the SAS Identify Frame PHY Identifier register */
161 #define SCU_SAS_TIPID_WRITE(phy, value) \
162 scu_link_layer_register_write(phy, identify_frame_phy_id, value)
164 /* / This macro reads from the SAS Identification register */
165 #define SCU_SAS_TIID_READ(phy) \
166 scu_link_layer_register_read(phy, transmit_identification)
168 /* / This macro writes to the SAS Identification register */
169 #define SCU_SAS_TIID_WRITE(phy, value) \
170 scu_link_layer_register_write(phy, transmit_identification, value)
172 /* / This macro reads the SAS Device Name High register */
173 #define SCU_SAS_TIDNH_READ(phy) \
174 scu_link_layer_register_read(phy, sas_device_name_high)
176 /* / This macro writes the SAS Device Name High register */
177 #define SCU_SAS_TIDNH_WRITE(phy, value) \
178 scu_link_layer_register_write(phy, sas_device_name_high, value)
180 /* / This macro reads the SAS Device Name Low register */
181 #define SCU_SAS_TIDNL_READ(phy) \
182 scu_link_layer_register_read(phy, sas_device_name_low)
184 /* / This macro writes the SAS Device Name Low register */
185 #define SCU_SAS_TIDNL_WRITE(phy, value) \
186 scu_link_layer_register_write(phy, sas_device_name_low, value)
188 /* / This macro reads the Source SAS Address High register */
189 #define SCU_SAS_TISSAH_READ(phy) \
190 scu_link_layer_register_read(phy, source_sas_address_high)
192 /* / This macro writes the Source SAS Address High register */
193 #define SCU_SAS_TISSAH_WRITE(phy, value) \
194 scu_link_layer_register_write(phy, source_sas_address_high, value)
196 /* / This macro reads the Source SAS Address Low register */
197 #define SCU_SAS_TISSAL_READ(phy) \
198 scu_link_layer_register_read(phy, source_sas_address_low)
200 /* / This macro writes the Source SAS Address Low register */
201 #define SCU_SAS_TISSAL_WRITE(phy, value) \
202 scu_link_layer_register_write(phy, source_sas_address_low, value)
204 /* / This macro reads the PHY Configuration register */
205 #define SCU_SAS_PCFG_READ(phy) \
206 scu_link_layer_register_read(phy, phy_configuration);
208 /* / This macro writes the PHY Configuration register */
209 #define SCU_SAS_PCFG_WRITE(phy, value) \
210 scu_link_layer_register_write(phy, phy_configuration, value)
212 /* / This macro reads the PHY Enable Spinup register */
213 #define SCU_SAS_ENSPINUP_READ(phy) \
214 scu_link_layer_register_read(phy, notify_enable_spinup_control)
216 /* / This macro writes the PHY Enable Spinup register */
217 #define SCU_SAS_ENSPINUP_WRITE(phy, value) \
218 scu_link_layer_register_write(phy, notify_enable_spinup_control, value)
220 /* This macro reads the CLKSM register */
221 #define SCU_SAS_CLKSM_READ(phy) \
222 scu_link_layer_register_read(phy, clock_skew_management)
224 /* This macro writes the CLKSM register */
225 #define SCU_SAS_CLKSM_WRITE(phy, value) \
226 scu_link_layer_register_write(phy, clock_skew_management, value)
228 /* / This macro reads the PHY Capacity register */
229 #define SCU_SAS_PHYCAP_READ(phy) \
230 scu_link_layer_register_read(phy, phy_capabilities)
232 /* / This macro writes the PHY Capacity register */
233 #define SCU_SAS_PHYCAP_WRITE(phy, value) \
234 scu_link_layer_register_write(phy, phy_capabilities, value)
236 /* / This macro reads the Recieved PHY Capacity register */
237 #define SCU_SAS_RECPHYCAP_READ(phy) \
238 scu_link_layer_register_read(phy, receive_phycap)
240 /* / This macro reads the link layer control register */
241 #define SCU_SAS_LLCTL_READ(phy) \
242 scu_link_layer_register_read(phy, link_layer_control);
244 /* / This macro writes the link layer control register */
245 #define SCU_SAS_LLCTL_WRITE(phy, value) \
246 scu_link_layer_register_write(phy, link_layer_control, value);
248 #endif /* _SCIC_SDS_PHY_REGISTERS_H_ */