xref: /titanic_51/usr/src/uts/sun4u/sys/opl.h (revision 98157a7002f4f2cf7978f3084ca5577f0a1d72b2)
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 2008 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		8
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 /* OPL model type */
80 typedef enum {
81 	FF1 = 0, FF2, DC1, DC2, DC3
82 } opl_type_t;
83 
84 /* OPL model specific cmds selection  */
85 #define	STD_DISPATCH_TABLE	0x0
86 #define	EXT_DISPATCH_TABLE	0x1
87 
88 /*
89  * Structure to gather model-specific information at boot.
90  */
91 typedef struct opl_model_info {
92 	char		model_name[MAXSYSNAME];	/* OPL model name */
93 	int		model_max_boards;	/* Maximum boards per model */
94 	opl_type_t 	model_type;		/* Model type */
95 	int		model_cmds;		/* Model specific cmds */
96 } opl_model_info_t;
97 
98 extern int	plat_max_boards(void);
99 extern int	plat_max_cpu_units_per_board(void);
100 extern int	plat_max_mem_units_per_board(void);
101 extern int	plat_max_io_units_per_board(void);
102 extern int	plat_max_cmp_units_per_board(void);
103 
104 #ifdef	__cplusplus
105 }
106 #endif
107 
108 #endif	/* _OPL_H */
109