isci: Intel(R) C600 Series Chipset Storage Control Unit Driver
[pandora-kernel.git] / drivers / scsi / isci / core / scic_sds_port_registers.h
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.
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_SDS_PORT_REGISTERS_H_
57 #define _SCIC_SDS_PORT_REGISTERS_H_
58
59 /**
60  * This file contains a set of macros that assist in reading the SCU hardware
61  *    registers.
62  *
63  *
64  */
65
66 /**
67  * scu_transport_layer_read() -
68  *
69  * Macro to read the transport layer register associated with this port object.
70  */
71 #define scu_transport_layer_read(port, reg) \
72         scu_register_read(\
73                 scic_sds_port_get_controller(port), \
74                 (port)->transport_layer_registers->reg \
75                 )
76
77 /**
78  * scu_transport_layer_write() -
79  *
80  * Macro to write the transport layer register associated with this port object.
81  */
82 #define scu_transport_layer_write(port, reg, value) \
83         scu_register_write(\
84                 scic_sds_port_get_controller(port), \
85                 (port)->transport_layer_registers->reg, \
86                 (value) \
87                 )
88
89 /**
90  * scu_port_task_scheduler_read() -
91  *
92  * Macro to read the port task scheduler register associated with this port
93  * object
94  */
95 #define scu_port_task_scheduler_read(port, reg) \
96         scu_register_read(\
97                 scic_sds_port_get_controller(port), \
98                 (port)->port_task_scheduler_registers->reg \
99                 )
100
101 /**
102  * scu_port_task_scheduler_write() -
103  *
104  * Macro to write the port task scheduler register associated with this port
105  * object
106  */
107 #define scu_port_task_scheduler_write(port, reg, value) \
108         scu_register_write(\
109                 scic_sds_port_get_controller(port), \
110                 (port)->port_task_scheduler_registers->reg, \
111                 (value) \
112                 )
113
114 #define scu_port_viit_register_write(port, reg, value) \
115         scu_register_write(\
116                 scic_sds_port_get_controller(port), \
117                 (port)->viit_registers->reg, \
118                 (value) \
119                 )
120
121 /*
122  * ****************************************************************************
123  * * Transport Layer registers controlled by the port object
124  * **************************************************************************** */
125
126 /**
127  * SCU_TLCR_READ() -
128  *
129  * This macro reads the Transport layer control register
130  */
131 #define SCU_TLCR_READ(port) \
132         scu_transport_layer_read(port, control)
133
134 /**
135  * SCU_TLCR_WRITE() -
136  *
137  * This macro writes the Transport layer control register
138  */
139 #define SCU_TLCR_WRITE(port, value) \
140         scu_transport_layer_write(port, control, value)
141
142 /**
143  * SCU_TLADTR_READ() -
144  *
145  * This macro reads the Transport layer address translation register
146  */
147 #define SCU_TLADTR_READ(port) \
148         scu_transport_layer_read(port, address_translation)
149
150 /**
151  * SCU_TLADTR_WRITE() -
152  *
153  * This macro writes the Transport layer address translation register
154  */
155 #define SCU_TLADTR_WRITE(port) \
156         scu_transport_layer_write(port, address_translation, value)
157
158 /**
159  * SCU_STPTLDARNI_WRITE() -
160  *
161  * This macro writes the STP Transport Layer Direct Attached RNi register.
162  */
163 #define SCU_STPTLDARNI_WRITE(port, index) \
164         scu_transport_layer_write(port, stp_rni, index)
165
166 /**
167  * SCU_STPTLDARNI_READ() -
168  *
169  * This macro reads the STP Transport Layer Direct Attached RNi register.
170  */
171 #define SCU_STPTLDARNI_READ(port) \
172         scu_transport_layer_read(port, stp_rni)
173
174 /*
175  * ****************************************************************************
176  * * Port Task Scheduler registers controlled by the port object
177  * **************************************************************************** */
178
179 /**
180  * SCU_PTSxCR_READ() -
181  *
182  * Macro to read the port task scheduler control register
183  */
184 #define SCU_PTSxCR_READ(port) \
185         scu_port_task_scheduler_read(port, control)
186
187 /**
188  * SCU_PTSxCR_WRITE() -
189  *
190  * Macro to write the port task scheduler control regsister
191  */
192 #define SCU_PTSxCR_WRITE(port, value) \
193         scu_port_task_scheduler_write(port, control, value)
194
195 /*
196  * ****************************************************************************
197  * * Port PE Configuration registers
198  * **************************************************************************** */
199
200 /**
201  * SCU_PCSPExCR_WRITE() -
202  *
203  * Macro to write the PE Port Configuration Register
204  */
205 #define SCU_PCSPExCR_WRITE(port, phy_id, value) \
206         scu_register_write(\
207                 scic_sds_port_get_controller(port), \
208                 (port)->port_pe_configuration_register[phy_id], \
209                 (value) \
210                 )
211
212 /**
213  * SCU_PCSPExCR_READ() -
214  *
215  * Macro to read the PE Port Configuration Regsiter
216  */
217 #define SCU_PCSPExCR_READ(port, phy_id) \
218         scu_register_read(\
219                 scic_sds_port_get_controller(port), \
220                 (port)->port_pe_configuration_register[phy_id] \
221                 )
222
223 #endif /* _SCIC_SDS_PORT_REGISTERS_H_ */