1230557Sjimharris/*-
2230557Sjimharris * This file is provided under a dual BSD/GPLv2 license.  When using or
3230557Sjimharris * redistributing this file, you may do so under either license.
4230557Sjimharris *
5230557Sjimharris * GPL LICENSE SUMMARY
6230557Sjimharris *
7230557Sjimharris * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved.
8230557Sjimharris *
9230557Sjimharris * This program is free software; you can redistribute it and/or modify
10230557Sjimharris * it under the terms of version 2 of the GNU General Public License as
11230557Sjimharris * published by the Free Software Foundation.
12230557Sjimharris *
13230557Sjimharris * This program is distributed in the hope that it will be useful, but
14230557Sjimharris * WITHOUT ANY WARRANTY; without even the implied warranty of
15230557Sjimharris * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16230557Sjimharris * General Public License for more details.
17230557Sjimharris *
18230557Sjimharris * You should have received a copy of the GNU General Public License
19230557Sjimharris * along with this program; if not, write to the Free Software
20230557Sjimharris * Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
21230557Sjimharris * The full GNU General Public License is included in this distribution
22230557Sjimharris * in the file called LICENSE.GPL.
23230557Sjimharris *
24230557Sjimharris * BSD LICENSE
25230557Sjimharris *
26230557Sjimharris * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved.
27230557Sjimharris * All rights reserved.
28230557Sjimharris *
29230557Sjimharris * Redistribution and use in source and binary forms, with or without
30230557Sjimharris * modification, are permitted provided that the following conditions
31230557Sjimharris * are met:
32230557Sjimharris *
33230557Sjimharris *   * Redistributions of source code must retain the above copyright
34230557Sjimharris *     notice, this list of conditions and the following disclaimer.
35230557Sjimharris *   * Redistributions in binary form must reproduce the above copyright
36230557Sjimharris *     notice, this list of conditions and the following disclaimer in
37230557Sjimharris *     the documentation and/or other materials provided with the
38230557Sjimharris *     distribution.
39230557Sjimharris *
40230557Sjimharris * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
41230557Sjimharris * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
42230557Sjimharris * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
43230557Sjimharris * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
44230557Sjimharris * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
45230557Sjimharris * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
46230557Sjimharris * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
47230557Sjimharris * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
48230557Sjimharris * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
49230557Sjimharris * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
50230557Sjimharris * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
51230557Sjimharris *
52230557Sjimharris * $FreeBSD$
53230557Sjimharris */
54230557Sjimharris#ifndef _SCI_CONTROLLER_CONSTANTS_H_
55230557Sjimharris#define _SCI_CONTROLLER_CONSTANTS_H_
56230557Sjimharris
57263276Sjimharris#include <sys/param.h>
58263276Sjimharris
59230557Sjimharris/**
60230557Sjimharris * @file
61230557Sjimharris *
62230557Sjimharris * @brief This file contains constant values that change based on the type
63230557Sjimharris *        of core or framework being managed.  These constants are exported
64230557Sjimharris *        in order to provide the user with information as to the bounds
65230557Sjimharris *        (i.e. how many) of specific objects.
66230557Sjimharris */
67230557Sjimharris
68230557Sjimharris#ifdef __cplusplus
69230557Sjimharrisextern "C" {
70230557Sjimharris#endif // __cplusplus
71230557Sjimharris
72230557Sjimharris#ifdef SCIC_SDS_4_ENABLED
73230557Sjimharris
74230557Sjimharris#ifndef SCI_MAX_PHYS
75230557Sjimharris/**
76230557Sjimharris * This constant defines the maximum number of phy objects that can be
77230557Sjimharris * supported for the SCU Driver Standard (SDS) library.  This is tied
78230557Sjimharris * directly to silicon capabilities.
79230557Sjimharris */
80230557Sjimharris#define SCI_MAX_PHYS  (4)
81230557Sjimharris#endif
82230557Sjimharris
83230557Sjimharris#ifndef SCI_MAX_PORTS
84230557Sjimharris/**
85230557Sjimharris * This constant defines the maximum number of port objects that can be
86230557Sjimharris * supported for the SCU Driver Standard (SDS) library.  This is tied
87230557Sjimharris * directly to silicon capabilities.
88230557Sjimharris */
89230557Sjimharris#define SCI_MAX_PORTS SCI_MAX_PHYS
90230557Sjimharris#endif
91230557Sjimharris
92230557Sjimharris#ifndef SCI_MIN_SMP_PHYS
93230557Sjimharris/**
94230557Sjimharris * This constant defines the minimum number of SMP phy objects that
95230557Sjimharris * can be supported for a single expander level.
96230557Sjimharris * This was determined by using 36 physical phys and room for 2 virtual
97230557Sjimharris * phys.
98230557Sjimharris */
99230557Sjimharris#define SCI_MIN_SMP_PHYS  (38)
100230557Sjimharris#endif
101230557Sjimharris
102230557Sjimharris#ifndef SCI_MAX_SMP_PHYS
103230557Sjimharris/**
104230557Sjimharris * This constant defines the maximum number of SMP phy objects that
105230557Sjimharris * can be supported for the SCU Driver Standard (SDS) library.
106230557Sjimharris * This number can be increased if required.
107230557Sjimharris */
108230557Sjimharris#define SCI_MAX_SMP_PHYS  (384)
109230557Sjimharris#endif
110230557Sjimharris
111230557Sjimharris#ifndef SCI_MAX_REMOTE_DEVICES
112230557Sjimharris/**
113230557Sjimharris * This constant defines the maximum number of remote device objects that
114230557Sjimharris * can be supported for the SCU Driver Standard (SDS) library.  This is tied
115230557Sjimharris * directly to silicon capabilities.
116230557Sjimharris */
117230557Sjimharris#define SCI_MAX_REMOTE_DEVICES (256)
118230557Sjimharris#endif
119230557Sjimharris
120230557Sjimharris#ifndef SCI_MIN_REMOTE_DEVICES
121230557Sjimharris/**
122230557Sjimharris * This constant defines the minimum number of remote device objects that
123230557Sjimharris * can be supported for the SCU Driver Standard (SDS) library.  This # can
124230557Sjimharris * be configured for minimum memory environments to any value less than
125230557Sjimharris * SCI_MAX_REMOTE_DEVICES
126230557Sjimharris */
127230557Sjimharris#define SCI_MIN_REMOTE_DEVICES (16)
128230557Sjimharris#endif
129230557Sjimharris
130230557Sjimharris#ifndef SCI_MAX_IO_REQUESTS
131230557Sjimharris/**
132230557Sjimharris * This constant defines the maximum number of IO request objects that
133230557Sjimharris * can be supported for the SCU Driver Standard (SDS) library.  This is tied
134230557Sjimharris * directly to silicon capabilities.
135230557Sjimharris */
136230557Sjimharris#define SCI_MAX_IO_REQUESTS (256)
137230557Sjimharris#endif
138230557Sjimharris
139230557Sjimharris#ifndef SCI_MIN_IO_REQUESTS
140230557Sjimharris/**
141230557Sjimharris * This constant defines the minimum number of IO request objects that
142230557Sjimharris * can be supported for the SCU Driver Standard (SDS) library.  This #
143230557Sjimharris * can be configured for minimum memory environments to any value less
144230557Sjimharris * than SCI_MAX_IO_REQUESTS.
145230557Sjimharris */
146230557Sjimharris#define SCI_MIN_IO_REQUESTS (1)
147230557Sjimharris#endif
148230557Sjimharris
149230557Sjimharris#ifndef SCI_MAX_SCATTER_GATHER_ELEMENTS
150230557Sjimharris/**
151230557Sjimharris * This constant defines the maximum number of Scatter-Gather Elements
152230557Sjimharris * to be used by any SCI component.
153263276Sjimharris *
154263276Sjimharris * Note: number of elements must be an even number, since descriptors
155263276Sjimharris * posted to hardware always contain pairs of elements (with second
156263276Sjimharris * element set to zeroes if not needed).
157230557Sjimharris */
158263276Sjimharris#define __MAXPHYS_ELEMENTS ((MAXPHYS / PAGE_SIZE) + 1)
159263276Sjimharris#define SCI_MAX_SCATTER_GATHER_ELEMENTS  ((__MAXPHYS_ELEMENTS + 1) & ~0x1)
160230557Sjimharris#endif
161230557Sjimharris
162230557Sjimharris#ifndef SCI_MIN_SCATTER_GATHER_ELEMENTS
163230557Sjimharris/**
164230557Sjimharris * This constant defines the minimum number of Scatter-Gather Elements
165230557Sjimharris * to be used by any SCI component.
166230557Sjimharris */
167230557Sjimharris#define SCI_MIN_SCATTER_GATHER_ELEMENTS 1
168230557Sjimharris#endif
169230557Sjimharris
170230557Sjimharris#else // SCIC_SDS_4_ENABLED
171230557Sjimharris
172230557Sjimharris#error "SCI Core configuration left unspecified (e.g. SCIC_SDS_4_ENABLED)"
173230557Sjimharris
174230557Sjimharris#endif // SCIC_SDS_4_ENABLED
175230557Sjimharris
176230557Sjimharris/**
177230557Sjimharris * This constant defines the maximum number of PCI devices that can be supported
178230557Sjimharris * by the driver.
179230557Sjimharris */
180230557Sjimharris#define SCI_MAX_PCI_DEVICES (2)
181230557Sjimharris
182230557Sjimharris/**
183230557Sjimharris * This constant defines the maximum number of controllers that can
184230557Sjimharris * occur in a single silicon package.
185230557Sjimharris */
186230557Sjimharris#define SCI_MAX_CONTROLLERS_PER_PCI_DEVICE  (2)
187230557Sjimharris
188230557Sjimharris/**
189230557Sjimharris * This constant defines the maximum number of controllers that can
190230557Sjimharris * be supported by a library object.  The user specified maximum controller
191230557Sjimharris * count must be less than or equal to this number.  This is a driver
192230557Sjimharris * specific constant that is not tied to silicon capabilities.
193230557Sjimharris */
194230557Sjimharris#if !defined(SCI_MAX_CONTROLLERS)
195230557Sjimharris#define SCI_MAX_CONTROLLERS  (2)
196230557Sjimharris#endif
197230557Sjimharris
198230557Sjimharris#ifndef SCI_MAX_MSIX_MESSAGES_PER_CONTROLLER
199230557Sjimharris/**
200230557Sjimharris * This constant defines the maximum number of MSI-X interrupt vectors/messages
201230557Sjimharris * supported for an SCU hardware controller instance.
202230557Sjimharris */
203230557Sjimharris#define SCI_MAX_MSIX_MESSAGES_PER_CONTROLLER  (2)
204230557Sjimharris#endif
205230557Sjimharris
206230557Sjimharris/**
207230557Sjimharris * This constant defines the maximum number of MSI-X interrupt vectors/messages
208230557Sjimharris * supported for an SCU device.
209230557Sjimharris */
210230557Sjimharris#define SCI_MAX_MSIX_MESSAGES \
211230557Sjimharris    (SCI_MAX_MSIX_MESSAGES_PER_CONTROLLER * SCI_MAX_CONTROLLERS)
212230557Sjimharris
213230557Sjimharris/**
214230557Sjimharris * The maximum number of supported domain objects is currently tied to the
215230557Sjimharris * maximum number of support port objects.
216230557Sjimharris */
217230557Sjimharris#define SCI_MAX_DOMAINS  SCI_MAX_PORTS
218230557Sjimharris
219230557Sjimharris#ifdef __cplusplus
220230557Sjimharris}
221230557Sjimharris#endif // __cplusplus
222230557Sjimharris
223230557Sjimharris#endif // _SCI_CONTROLLER_CONSTANTS_H_
224230557Sjimharris
225