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