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 *
40 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
41 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
42 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
43 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
44 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
45 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
46 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
47 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
48 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
49 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
50 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
51 *
52 * $FreeBSD$
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
69extern "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