xref: /titanic_50/usr/src/uts/sun4u/sys/opl.h (revision df4cb6e0bcfc660e38e1e96ccd7b794c0466228a)
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 #define	MMU_ID(x) \
70 	((opl_get_physical_board(LSB_ID(x)) * OPL_MAX_COREID_PER_BOARD) + \
71 	(CHIP_ID(x) * OPL_MAX_COREID_PER_CMP) + \
72 	CORE_ID(x))
73 
74 /*
75  * Max. boards supported in a domain per model.
76  */
77 #define	OPL_MAX_BOARDS_FF1	1
78 #define	OPL_MAX_BOARDS_FF2	2
79 #define	OPL_MAX_BOARDS_DC1	4
80 #define	OPL_MAX_BOARDS_DC2	8
81 #define	OPL_MAX_BOARDS_DC3	16
82 
83 /*
84  * Structure to gather model-specific information at boot.
85  */
86 typedef struct opl_model_info {
87 	char	model_name[MAXSYSNAME];
88 	int	model_max_boards;
89 } opl_model_info_t;
90 
91 extern int	plat_max_boards(void);
92 extern int	plat_max_cpu_units_per_board(void);
93 extern int	plat_max_mem_units_per_board(void);
94 extern int	plat_max_io_units_per_board(void);
95 extern int	plat_max_cmp_units_per_board(void);
96 
97 #ifdef	__cplusplus
98 }
99 #endif
100 
101 #endif	/* _OPL_H */
102