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