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