xref: /freebsd/sys/dev/isci/scil/sci_controller_constants.h (revision 95ee2897e98f5d444f26ed2334cc7c439f9c16c6)
1f11c7f63SJim Harris /*-
2718cf2ccSPedro F. Giffuni  * SPDX-License-Identifier: BSD-2-Clause OR GPL-2.0
3718cf2ccSPedro F. Giffuni  *
4f11c7f63SJim Harris  * This file is provided under a dual BSD/GPLv2 license.  When using or
5f11c7f63SJim Harris  * redistributing this file, you may do so under either license.
6f11c7f63SJim Harris  *
7f11c7f63SJim Harris  * GPL LICENSE SUMMARY
8f11c7f63SJim Harris  *
9f11c7f63SJim Harris  * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved.
10f11c7f63SJim Harris  *
11f11c7f63SJim Harris  * This program is free software; you can redistribute it and/or modify
12f11c7f63SJim Harris  * it under the terms of version 2 of the GNU General Public License as
13f11c7f63SJim Harris  * published by the Free Software Foundation.
14f11c7f63SJim Harris  *
15f11c7f63SJim Harris  * This program is distributed in the hope that it will be useful, but
16f11c7f63SJim Harris  * WITHOUT ANY WARRANTY; without even the implied warranty of
17f11c7f63SJim Harris  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18f11c7f63SJim Harris  * General Public License for more details.
19f11c7f63SJim Harris  *
20f11c7f63SJim Harris  * You should have received a copy of the GNU General Public License
21f11c7f63SJim Harris  * along with this program; if not, write to the Free Software
22f11c7f63SJim Harris  * Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
23f11c7f63SJim Harris  * The full GNU General Public License is included in this distribution
24f11c7f63SJim Harris  * in the file called LICENSE.GPL.
25f11c7f63SJim Harris  *
26f11c7f63SJim Harris  * BSD LICENSE
27f11c7f63SJim Harris  *
28f11c7f63SJim Harris  * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved.
29f11c7f63SJim Harris  * All rights reserved.
30f11c7f63SJim Harris  *
31f11c7f63SJim Harris  * Redistribution and use in source and binary forms, with or without
32f11c7f63SJim Harris  * modification, are permitted provided that the following conditions
33f11c7f63SJim Harris  * are met:
34f11c7f63SJim Harris  *
35f11c7f63SJim Harris  *   * Redistributions of source code must retain the above copyright
36f11c7f63SJim Harris  *     notice, this list of conditions and the following disclaimer.
37f11c7f63SJim Harris  *   * Redistributions in binary form must reproduce the above copyright
38f11c7f63SJim Harris  *     notice, this list of conditions and the following disclaimer in
39f11c7f63SJim Harris  *     the documentation and/or other materials provided with the
40f11c7f63SJim Harris  *     distribution.
41f11c7f63SJim Harris  *
42f11c7f63SJim Harris  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
43f11c7f63SJim Harris  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
44f11c7f63SJim Harris  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
45f11c7f63SJim Harris  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
46f11c7f63SJim Harris  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
47f11c7f63SJim Harris  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
48f11c7f63SJim Harris  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
49f11c7f63SJim Harris  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
50f11c7f63SJim Harris  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
51f11c7f63SJim Harris  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
52f11c7f63SJim Harris  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
53f11c7f63SJim Harris  */
54f11c7f63SJim Harris #ifndef _SCI_CONTROLLER_CONSTANTS_H_
55f11c7f63SJim Harris #define _SCI_CONTROLLER_CONSTANTS_H_
56f11c7f63SJim Harris 
575d16b897SJim Harris #include <sys/param.h>
585d16b897SJim Harris 
59f11c7f63SJim Harris /**
60f11c7f63SJim Harris  * @file
61f11c7f63SJim Harris  *
62f11c7f63SJim Harris  * @brief This file contains constant values that change based on the type
63f11c7f63SJim Harris  *        of core or framework being managed.  These constants are exported
64f11c7f63SJim Harris  *        in order to provide the user with information as to the bounds
65f11c7f63SJim Harris  *        (i.e. how many) of specific objects.
66f11c7f63SJim Harris  */
67f11c7f63SJim Harris 
68f11c7f63SJim Harris #ifdef __cplusplus
69f11c7f63SJim Harris extern "C" {
70f11c7f63SJim Harris #endif // __cplusplus
71f11c7f63SJim Harris 
72f11c7f63SJim Harris #ifdef SCIC_SDS_4_ENABLED
73f11c7f63SJim Harris 
74f11c7f63SJim Harris #ifndef SCI_MAX_PHYS
75f11c7f63SJim Harris /**
76f11c7f63SJim Harris  * This constant defines the maximum number of phy objects that can be
77f11c7f63SJim Harris  * supported for the SCU Driver Standard (SDS) library.  This is tied
78f11c7f63SJim Harris  * directly to silicon capabilities.
79f11c7f63SJim Harris  */
80f11c7f63SJim Harris #define SCI_MAX_PHYS  (4)
81f11c7f63SJim Harris #endif
82f11c7f63SJim Harris 
83f11c7f63SJim Harris #ifndef SCI_MAX_PORTS
84f11c7f63SJim Harris /**
85f11c7f63SJim Harris  * This constant defines the maximum number of port objects that can be
86f11c7f63SJim Harris  * supported for the SCU Driver Standard (SDS) library.  This is tied
87f11c7f63SJim Harris  * directly to silicon capabilities.
88f11c7f63SJim Harris  */
89f11c7f63SJim Harris #define SCI_MAX_PORTS SCI_MAX_PHYS
90f11c7f63SJim Harris #endif
91f11c7f63SJim Harris 
92f11c7f63SJim Harris #ifndef SCI_MIN_SMP_PHYS
93f11c7f63SJim Harris /**
94f11c7f63SJim Harris  * This constant defines the minimum number of SMP phy objects that
95f11c7f63SJim Harris  * can be supported for a single expander level.
96f11c7f63SJim Harris  * This was determined by using 36 physical phys and room for 2 virtual
97f11c7f63SJim Harris  * phys.
98f11c7f63SJim Harris  */
99f11c7f63SJim Harris #define SCI_MIN_SMP_PHYS  (38)
100f11c7f63SJim Harris #endif
101f11c7f63SJim Harris 
102f11c7f63SJim Harris #ifndef SCI_MAX_SMP_PHYS
103f11c7f63SJim Harris /**
104f11c7f63SJim Harris  * This constant defines the maximum number of SMP phy objects that
105f11c7f63SJim Harris  * can be supported for the SCU Driver Standard (SDS) library.
106f11c7f63SJim Harris  * This number can be increased if required.
107f11c7f63SJim Harris  */
108f11c7f63SJim Harris #define SCI_MAX_SMP_PHYS  (384)
109f11c7f63SJim Harris #endif
110f11c7f63SJim Harris 
111f11c7f63SJim Harris #ifndef SCI_MAX_REMOTE_DEVICES
112f11c7f63SJim Harris /**
113f11c7f63SJim Harris  * This constant defines the maximum number of remote device objects that
114f11c7f63SJim Harris  * can be supported for the SCU Driver Standard (SDS) library.  This is tied
115f11c7f63SJim Harris  * directly to silicon capabilities.
116f11c7f63SJim Harris  */
117f11c7f63SJim Harris #define SCI_MAX_REMOTE_DEVICES (256)
118f11c7f63SJim Harris #endif
119f11c7f63SJim Harris 
120f11c7f63SJim Harris #ifndef SCI_MIN_REMOTE_DEVICES
121f11c7f63SJim Harris /**
122f11c7f63SJim Harris  * This constant defines the minimum number of remote device objects that
123f11c7f63SJim Harris  * can be supported for the SCU Driver Standard (SDS) library.  This # can
124f11c7f63SJim Harris  * be configured for minimum memory environments to any value less than
125f11c7f63SJim Harris  * SCI_MAX_REMOTE_DEVICES
126f11c7f63SJim Harris  */
127f11c7f63SJim Harris #define SCI_MIN_REMOTE_DEVICES (16)
128f11c7f63SJim Harris #endif
129f11c7f63SJim Harris 
130f11c7f63SJim Harris #ifndef SCI_MAX_IO_REQUESTS
131f11c7f63SJim Harris /**
132f11c7f63SJim Harris  * This constant defines the maximum number of IO request objects that
133f11c7f63SJim Harris  * can be supported for the SCU Driver Standard (SDS) library.  This is tied
134f11c7f63SJim Harris  * directly to silicon capabilities.
135f11c7f63SJim Harris  */
136f11c7f63SJim Harris #define SCI_MAX_IO_REQUESTS (256)
137f11c7f63SJim Harris #endif
138f11c7f63SJim Harris 
139f11c7f63SJim Harris #ifndef SCI_MIN_IO_REQUESTS
140f11c7f63SJim Harris /**
141f11c7f63SJim Harris  * This constant defines the minimum number of IO request objects that
142f11c7f63SJim Harris  * can be supported for the SCU Driver Standard (SDS) library.  This #
143f11c7f63SJim Harris  * can be configured for minimum memory environments to any value less
144f11c7f63SJim Harris  * than SCI_MAX_IO_REQUESTS.
145f11c7f63SJim Harris  */
146f11c7f63SJim Harris #define SCI_MIN_IO_REQUESTS (1)
147f11c7f63SJim Harris #endif
148f11c7f63SJim Harris 
149f11c7f63SJim Harris #ifndef SCI_MAX_SCATTER_GATHER_ELEMENTS
150f11c7f63SJim Harris /**
151f11c7f63SJim Harris  * This constant defines the maximum number of Scatter-Gather Elements
152f11c7f63SJim Harris  * to be used by any SCI component.
1535d16b897SJim Harris  *
1545d16b897SJim Harris  * Note: number of elements must be an even number, since descriptors
1555d16b897SJim Harris  * posted to hardware always contain pairs of elements (with second
1565d16b897SJim Harris  * element set to zeroes if not needed).
157f11c7f63SJim Harris  */
158*a2fc8adeSAndrew Gallatin #define __MAXPHYS_ELEMENTS ((maxphys / PAGE_SIZE) + 1)
1595d16b897SJim Harris #define SCI_MAX_SCATTER_GATHER_ELEMENTS  ((__MAXPHYS_ELEMENTS + 1) & ~0x1)
160f11c7f63SJim Harris #endif
161f11c7f63SJim Harris 
162f11c7f63SJim Harris #ifndef SCI_MIN_SCATTER_GATHER_ELEMENTS
163f11c7f63SJim Harris /**
164f11c7f63SJim Harris  * This constant defines the minimum number of Scatter-Gather Elements
165f11c7f63SJim Harris  * to be used by any SCI component.
166f11c7f63SJim Harris  */
167f11c7f63SJim Harris #define SCI_MIN_SCATTER_GATHER_ELEMENTS 1
168f11c7f63SJim Harris #endif
169f11c7f63SJim Harris 
170f11c7f63SJim Harris #else // SCIC_SDS_4_ENABLED
171f11c7f63SJim Harris 
172f11c7f63SJim Harris #error "SCI Core configuration left unspecified (e.g. SCIC_SDS_4_ENABLED)"
173f11c7f63SJim Harris 
174f11c7f63SJim Harris #endif // SCIC_SDS_4_ENABLED
175f11c7f63SJim Harris 
176f11c7f63SJim Harris /**
177f11c7f63SJim Harris  * This constant defines the maximum number of PCI devices that can be supported
178f11c7f63SJim Harris  * by the driver.
179f11c7f63SJim Harris  */
180f11c7f63SJim Harris #define SCI_MAX_PCI_DEVICES (2)
181f11c7f63SJim Harris 
182f11c7f63SJim Harris /**
183f11c7f63SJim Harris  * This constant defines the maximum number of controllers that can
184f11c7f63SJim Harris  * occur in a single silicon package.
185f11c7f63SJim Harris  */
186f11c7f63SJim Harris #define SCI_MAX_CONTROLLERS_PER_PCI_DEVICE  (2)
187f11c7f63SJim Harris 
188f11c7f63SJim Harris /**
189f11c7f63SJim Harris  * This constant defines the maximum number of controllers that can
190f11c7f63SJim Harris  * be supported by a library object.  The user specified maximum controller
191f11c7f63SJim Harris  * count must be less than or equal to this number.  This is a driver
192f11c7f63SJim Harris  * specific constant that is not tied to silicon capabilities.
193f11c7f63SJim Harris  */
194f11c7f63SJim Harris #if !defined(SCI_MAX_CONTROLLERS)
195f11c7f63SJim Harris #define SCI_MAX_CONTROLLERS  (2)
196f11c7f63SJim Harris #endif
197f11c7f63SJim Harris 
198f11c7f63SJim Harris #ifndef SCI_MAX_MSIX_MESSAGES_PER_CONTROLLER
199f11c7f63SJim Harris /**
200f11c7f63SJim Harris  * This constant defines the maximum number of MSI-X interrupt vectors/messages
201f11c7f63SJim Harris  * supported for an SCU hardware controller instance.
202f11c7f63SJim Harris  */
203f11c7f63SJim Harris #define SCI_MAX_MSIX_MESSAGES_PER_CONTROLLER  (2)
204f11c7f63SJim Harris #endif
205f11c7f63SJim Harris 
206f11c7f63SJim Harris /**
207f11c7f63SJim Harris  * This constant defines the maximum number of MSI-X interrupt vectors/messages
208f11c7f63SJim Harris  * supported for an SCU device.
209f11c7f63SJim Harris  */
210f11c7f63SJim Harris #define SCI_MAX_MSIX_MESSAGES \
211f11c7f63SJim Harris     (SCI_MAX_MSIX_MESSAGES_PER_CONTROLLER * SCI_MAX_CONTROLLERS)
212f11c7f63SJim Harris 
213f11c7f63SJim Harris /**
214f11c7f63SJim Harris  * The maximum number of supported domain objects is currently tied to the
215f11c7f63SJim Harris  * maximum number of support port objects.
216f11c7f63SJim Harris  */
217f11c7f63SJim Harris #define SCI_MAX_DOMAINS  SCI_MAX_PORTS
218f11c7f63SJim Harris 
219f11c7f63SJim Harris #ifdef __cplusplus
220f11c7f63SJim Harris }
221f11c7f63SJim Harris #endif // __cplusplus
222f11c7f63SJim Harris 
223f11c7f63SJim Harris #endif // _SCI_CONTROLLER_CONSTANTS_H_
224f11c7f63SJim Harris 
225