xref: /freebsd/sys/dev/isci/scil/sci_controller_constants.h (revision 95ee2897e98f5d444f26ed2334cc7c439f9c16c6)
1 /*-
2  * SPDX-License-Identifier: BSD-2-Clause OR GPL-2.0
3  *
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.
6  *
7  * GPL LICENSE SUMMARY
8  *
9  * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved.
10  *
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.
14  *
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.
19  *
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.
25  *
26  * BSD LICENSE
27  *
28  * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved.
29  * All rights reserved.
30  *
31  * Redistribution and use in source and binary forms, with or without
32  * modification, are permitted provided that the following conditions
33  * are met:
34  *
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
40  *     distribution.
41  *
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.
53  */
54 #ifndef _SCI_CONTROLLER_CONSTANTS_H_
55 #define _SCI_CONTROLLER_CONSTANTS_H_
56 
57 #include <sys/param.h>
58 
59 /**
60  * @file
61  *
62  * @brief This file contains constant values that change based on the type
63  *        of core or framework being managed.  These constants are exported
64  *        in order to provide the user with information as to the bounds
65  *        (i.e. how many) of specific objects.
66  */
67 
68 #ifdef __cplusplus
69 extern "C" {
70 #endif // __cplusplus
71 
72 #ifdef SCIC_SDS_4_ENABLED
73 
74 #ifndef SCI_MAX_PHYS
75 /**
76  * This constant defines the maximum number of phy objects that can be
77  * supported for the SCU Driver Standard (SDS) library.  This is tied
78  * directly to silicon capabilities.
79  */
80 #define SCI_MAX_PHYS  (4)
81 #endif
82 
83 #ifndef SCI_MAX_PORTS
84 /**
85  * This constant defines the maximum number of port objects that can be
86  * supported for the SCU Driver Standard (SDS) library.  This is tied
87  * directly to silicon capabilities.
88  */
89 #define SCI_MAX_PORTS SCI_MAX_PHYS
90 #endif
91 
92 #ifndef SCI_MIN_SMP_PHYS
93 /**
94  * This constant defines the minimum number of SMP phy objects that
95  * can be supported for a single expander level.
96  * This was determined by using 36 physical phys and room for 2 virtual
97  * phys.
98  */
99 #define SCI_MIN_SMP_PHYS  (38)
100 #endif
101 
102 #ifndef SCI_MAX_SMP_PHYS
103 /**
104  * This constant defines the maximum number of SMP phy objects that
105  * can be supported for the SCU Driver Standard (SDS) library.
106  * This number can be increased if required.
107  */
108 #define SCI_MAX_SMP_PHYS  (384)
109 #endif
110 
111 #ifndef SCI_MAX_REMOTE_DEVICES
112 /**
113  * This constant defines the maximum number of remote device objects that
114  * can be supported for the SCU Driver Standard (SDS) library.  This is tied
115  * directly to silicon capabilities.
116  */
117 #define SCI_MAX_REMOTE_DEVICES (256)
118 #endif
119 
120 #ifndef SCI_MIN_REMOTE_DEVICES
121 /**
122  * This constant defines the minimum number of remote device objects that
123  * can be supported for the SCU Driver Standard (SDS) library.  This # can
124  * be configured for minimum memory environments to any value less than
125  * SCI_MAX_REMOTE_DEVICES
126  */
127 #define SCI_MIN_REMOTE_DEVICES (16)
128 #endif
129 
130 #ifndef SCI_MAX_IO_REQUESTS
131 /**
132  * This constant defines the maximum number of IO request objects that
133  * can be supported for the SCU Driver Standard (SDS) library.  This is tied
134  * directly to silicon capabilities.
135  */
136 #define SCI_MAX_IO_REQUESTS (256)
137 #endif
138 
139 #ifndef SCI_MIN_IO_REQUESTS
140 /**
141  * This constant defines the minimum number of IO request objects that
142  * can be supported for the SCU Driver Standard (SDS) library.  This #
143  * can be configured for minimum memory environments to any value less
144  * than SCI_MAX_IO_REQUESTS.
145  */
146 #define SCI_MIN_IO_REQUESTS (1)
147 #endif
148 
149 #ifndef SCI_MAX_SCATTER_GATHER_ELEMENTS
150 /**
151  * This constant defines the maximum number of Scatter-Gather Elements
152  * to be used by any SCI component.
153  *
154  * Note: number of elements must be an even number, since descriptors
155  * posted to hardware always contain pairs of elements (with second
156  * element set to zeroes if not needed).
157  */
158 #define __MAXPHYS_ELEMENTS ((maxphys / PAGE_SIZE) + 1)
159 #define SCI_MAX_SCATTER_GATHER_ELEMENTS  ((__MAXPHYS_ELEMENTS + 1) & ~0x1)
160 #endif
161 
162 #ifndef SCI_MIN_SCATTER_GATHER_ELEMENTS
163 /**
164  * This constant defines the minimum number of Scatter-Gather Elements
165  * to be used by any SCI component.
166  */
167 #define SCI_MIN_SCATTER_GATHER_ELEMENTS 1
168 #endif
169 
170 #else // SCIC_SDS_4_ENABLED
171 
172 #error "SCI Core configuration left unspecified (e.g. SCIC_SDS_4_ENABLED)"
173 
174 #endif // SCIC_SDS_4_ENABLED
175 
176 /**
177  * This constant defines the maximum number of PCI devices that can be supported
178  * by the driver.
179  */
180 #define SCI_MAX_PCI_DEVICES (2)
181 
182 /**
183  * This constant defines the maximum number of controllers that can
184  * occur in a single silicon package.
185  */
186 #define SCI_MAX_CONTROLLERS_PER_PCI_DEVICE  (2)
187 
188 /**
189  * This constant defines the maximum number of controllers that can
190  * be supported by a library object.  The user specified maximum controller
191  * count must be less than or equal to this number.  This is a driver
192  * specific constant that is not tied to silicon capabilities.
193  */
194 #if !defined(SCI_MAX_CONTROLLERS)
195 #define SCI_MAX_CONTROLLERS  (2)
196 #endif
197 
198 #ifndef SCI_MAX_MSIX_MESSAGES_PER_CONTROLLER
199 /**
200  * This constant defines the maximum number of MSI-X interrupt vectors/messages
201  * supported for an SCU hardware controller instance.
202  */
203 #define SCI_MAX_MSIX_MESSAGES_PER_CONTROLLER  (2)
204 #endif
205 
206 /**
207  * This constant defines the maximum number of MSI-X interrupt vectors/messages
208  * supported for an SCU device.
209  */
210 #define SCI_MAX_MSIX_MESSAGES \
211     (SCI_MAX_MSIX_MESSAGES_PER_CONTROLLER * SCI_MAX_CONTROLLERS)
212 
213 /**
214  * The maximum number of supported domain objects is currently tied to the
215  * maximum number of support port objects.
216  */
217 #define SCI_MAX_DOMAINS  SCI_MAX_PORTS
218 
219 #ifdef __cplusplus
220 }
221 #endif // __cplusplus
222 
223 #endif // _SCI_CONTROLLER_CONSTANTS_H_
224 
225