xref: /titanic_53/usr/src/uts/sun4u/sys/opl.h (revision 25cf1a301a396c38e8adf52c15f537b80d2483f7)
1*25cf1a30Sjl139090 /*
2*25cf1a30Sjl139090  * CDDL HEADER START
3*25cf1a30Sjl139090  *
4*25cf1a30Sjl139090  * The contents of this file are subject to the terms of the
5*25cf1a30Sjl139090  * Common Development and Distribution License (the "License").
6*25cf1a30Sjl139090  * You may not use this file except in compliance with the License.
7*25cf1a30Sjl139090  *
8*25cf1a30Sjl139090  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9*25cf1a30Sjl139090  * or http://www.opensolaris.org/os/licensing.
10*25cf1a30Sjl139090  * See the License for the specific language governing permissions
11*25cf1a30Sjl139090  * and limitations under the License.
12*25cf1a30Sjl139090  *
13*25cf1a30Sjl139090  * When distributing Covered Code, include this CDDL HEADER in each
14*25cf1a30Sjl139090  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15*25cf1a30Sjl139090  * If applicable, add the following below this CDDL HEADER, with the
16*25cf1a30Sjl139090  * fields enclosed by brackets "[]" replaced with your own identifying
17*25cf1a30Sjl139090  * information: Portions Copyright [yyyy] [name of copyright owner]
18*25cf1a30Sjl139090  *
19*25cf1a30Sjl139090  * CDDL HEADER END
20*25cf1a30Sjl139090  */
21*25cf1a30Sjl139090 /*
22*25cf1a30Sjl139090  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
23*25cf1a30Sjl139090  * Use is subject to license terms.
24*25cf1a30Sjl139090  */
25*25cf1a30Sjl139090 
26*25cf1a30Sjl139090 #ifndef	_OPL_H
27*25cf1a30Sjl139090 #define	_OPL_H
28*25cf1a30Sjl139090 
29*25cf1a30Sjl139090 #pragma ident	"%Z%%M%	%I%	%E% SMI"
30*25cf1a30Sjl139090 
31*25cf1a30Sjl139090 #ifdef	__cplusplus
32*25cf1a30Sjl139090 extern "C" {
33*25cf1a30Sjl139090 #endif
34*25cf1a30Sjl139090 
35*25cf1a30Sjl139090 #define	OPL_MAX_CPU_PER_CMP		4
36*25cf1a30Sjl139090 #define	OPL_MAX_CORES_PER_CMP		4
37*25cf1a30Sjl139090 #define	OPL_MAX_STRANDS_PER_CORE	2
38*25cf1a30Sjl139090 #define	OPL_MAX_CMP_UNITS_PER_BOARD	4
39*25cf1a30Sjl139090 #define	OPL_MAX_BOARDS			16
40*25cf1a30Sjl139090 #define	OPL_MAX_CPU_PER_BOARD		\
41*25cf1a30Sjl139090 	(OPL_MAX_CPU_PER_CMP * OPL_MAX_CMP_UNITS_PER_BOARD)
42*25cf1a30Sjl139090 #define	OPL_MAX_MEM_UNITS_PER_BOARD	1
43*25cf1a30Sjl139090 #define	OPL_MAX_IO_UNITS_PER_BOARD	16
44*25cf1a30Sjl139090 #define	OPL_MAX_PCICH_UNITS_PER_BOARD	4
45*25cf1a30Sjl139090 #define	OPL_MAX_TSBS_PER_PCICH		2
46*25cf1a30Sjl139090 #define	OPL_MAX_CORE_UNITS_PER_BOARD	\
47*25cf1a30Sjl139090 	(OPL_MAX_CORES_PER_CMP * OPL_MAX_CMP_UNITS_PER_BOARD)
48*25cf1a30Sjl139090 
49*25cf1a30Sjl139090 #define	OPL_MAX_COREID_PER_CMP		4
50*25cf1a30Sjl139090 #define	OPL_MAX_STRANDID_PER_CORE	2
51*25cf1a30Sjl139090 #define	OPL_MAX_CPUID_PER_CMP		(OPL_MAX_COREID_PER_CMP * \
52*25cf1a30Sjl139090 	OPL_MAX_STRANDID_PER_CORE)
53*25cf1a30Sjl139090 #define	OPL_MAX_CMPID_PER_BOARD		4
54*25cf1a30Sjl139090 #define	OPL_MAX_CPUID_PER_BOARD		\
55*25cf1a30Sjl139090 	(OPL_MAX_CPUID_PER_CMP * OPL_MAX_CMPID_PER_BOARD)
56*25cf1a30Sjl139090 #define	OPL_MAX_COREID_PER_BOARD	\
57*25cf1a30Sjl139090 	(OPL_MAX_COREID_PER_CMP * OPL_MAX_CMPID_PER_BOARD)
58*25cf1a30Sjl139090 /*
59*25cf1a30Sjl139090  * Macros to extract LSB_ID, CHIP_ID, CORE_ID, and STRAND_ID
60*25cf1a30Sjl139090  * from the given cpuid.
61*25cf1a30Sjl139090  */
62*25cf1a30Sjl139090 #define	LSB_ID(x)	(((uint_t)(x)/OPL_MAX_CPUID_PER_BOARD) & \
63*25cf1a30Sjl139090 	(OPL_MAX_BOARDS - 1))
64*25cf1a30Sjl139090 #define	CHIP_ID(x)	(((uint_t)(x)/OPL_MAX_CPUID_PER_CMP) & \
65*25cf1a30Sjl139090 	(OPL_MAX_CMPID_PER_BOARD - 1))
66*25cf1a30Sjl139090 #define	CORE_ID(x)	(((uint_t)(x)/OPL_MAX_STRANDID_PER_CORE) & \
67*25cf1a30Sjl139090 	(OPL_MAX_COREID_PER_CMP - 1))
68*25cf1a30Sjl139090 #define	STRAND_ID(x)	((uint_t)(x) & (OPL_MAX_STRANDID_PER_CORE - 1))
69*25cf1a30Sjl139090 
70*25cf1a30Sjl139090 extern int	plat_max_boards(void);
71*25cf1a30Sjl139090 extern int	plat_max_cpu_units_per_board(void);
72*25cf1a30Sjl139090 extern int	plat_max_mem_units_per_board(void);
73*25cf1a30Sjl139090 extern int	plat_max_io_units_per_board(void);
74*25cf1a30Sjl139090 extern int	plat_max_cmp_units_per_board(void);
75*25cf1a30Sjl139090 
76*25cf1a30Sjl139090 #ifdef	__cplusplus
77*25cf1a30Sjl139090 }
78*25cf1a30Sjl139090 #endif
79*25cf1a30Sjl139090 
80*25cf1a30Sjl139090 #endif	/* _OPL_H */
81