xref: /illumos-gate/usr/src/uts/sun4u/sys/opl.h (revision 78ed97a7)
125cf1a30Sjl /*
225cf1a30Sjl  * CDDL HEADER START
325cf1a30Sjl  *
425cf1a30Sjl  * The contents of this file are subject to the terms of the
525cf1a30Sjl  * Common Development and Distribution License (the "License").
625cf1a30Sjl  * You may not use this file except in compliance with the License.
725cf1a30Sjl  *
825cf1a30Sjl  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
925cf1a30Sjl  * or http://www.opensolaris.org/os/licensing.
1025cf1a30Sjl  * See the License for the specific language governing permissions
1125cf1a30Sjl  * and limitations under the License.
1225cf1a30Sjl  *
1325cf1a30Sjl  * When distributing Covered Code, include this CDDL HEADER in each
1425cf1a30Sjl  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
1525cf1a30Sjl  * If applicable, add the following below this CDDL HEADER, with the
1625cf1a30Sjl  * fields enclosed by brackets "[]" replaced with your own identifying
1725cf1a30Sjl  * information: Portions Copyright [yyyy] [name of copyright owner]
1825cf1a30Sjl  *
1925cf1a30Sjl  * CDDL HEADER END
2025cf1a30Sjl  */
2125cf1a30Sjl /*
2204938e8bSjfrank  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
2325cf1a30Sjl  * Use is subject to license terms.
2425cf1a30Sjl  */
2525cf1a30Sjl 
2625cf1a30Sjl #ifndef	_OPL_H
2725cf1a30Sjl #define	_OPL_H
2825cf1a30Sjl 
2925cf1a30Sjl #pragma ident	"%Z%%M%	%I%	%E% SMI"
3025cf1a30Sjl 
3125cf1a30Sjl #ifdef	__cplusplus
3225cf1a30Sjl extern "C" {
3325cf1a30Sjl #endif
3425cf1a30Sjl 
35e98fafb9Sjl #define	OPL_MAX_CPU_PER_CMP		8
3625cf1a30Sjl #define	OPL_MAX_CORES_PER_CMP		4
3725cf1a30Sjl #define	OPL_MAX_STRANDS_PER_CORE	2
3825cf1a30Sjl #define	OPL_MAX_CMP_UNITS_PER_BOARD	4
3925cf1a30Sjl #define	OPL_MAX_BOARDS			16
4025cf1a30Sjl #define	OPL_MAX_CPU_PER_BOARD		\
4125cf1a30Sjl 	(OPL_MAX_CPU_PER_CMP * OPL_MAX_CMP_UNITS_PER_BOARD)
4225cf1a30Sjl #define	OPL_MAX_MEM_UNITS_PER_BOARD	1
4325cf1a30Sjl #define	OPL_MAX_IO_UNITS_PER_BOARD	16
4425cf1a30Sjl #define	OPL_MAX_PCICH_UNITS_PER_BOARD	4
4525cf1a30Sjl #define	OPL_MAX_TSBS_PER_PCICH		2
4625cf1a30Sjl #define	OPL_MAX_CORE_UNITS_PER_BOARD	\
4725cf1a30Sjl 	(OPL_MAX_CORES_PER_CMP * OPL_MAX_CMP_UNITS_PER_BOARD)
4825cf1a30Sjl 
4925cf1a30Sjl #define	OPL_MAX_COREID_PER_CMP		4
5025cf1a30Sjl #define	OPL_MAX_STRANDID_PER_CORE	2
5125cf1a30Sjl #define	OPL_MAX_CPUID_PER_CMP		(OPL_MAX_COREID_PER_CMP * \
5225cf1a30Sjl 	OPL_MAX_STRANDID_PER_CORE)
5325cf1a30Sjl #define	OPL_MAX_CMPID_PER_BOARD		4
5425cf1a30Sjl #define	OPL_MAX_CPUID_PER_BOARD		\
5525cf1a30Sjl 	(OPL_MAX_CPUID_PER_CMP * OPL_MAX_CMPID_PER_BOARD)
5625cf1a30Sjl #define	OPL_MAX_COREID_PER_BOARD	\
5725cf1a30Sjl 	(OPL_MAX_COREID_PER_CMP * OPL_MAX_CMPID_PER_BOARD)
5825cf1a30Sjl /*
5925cf1a30Sjl  * Macros to extract LSB_ID, CHIP_ID, CORE_ID, and STRAND_ID
6025cf1a30Sjl  * from the given cpuid.
6125cf1a30Sjl  */
6225cf1a30Sjl #define	LSB_ID(x)	(((uint_t)(x)/OPL_MAX_CPUID_PER_BOARD) & \
6325cf1a30Sjl 	(OPL_MAX_BOARDS - 1))
6425cf1a30Sjl #define	CHIP_ID(x)	(((uint_t)(x)/OPL_MAX_CPUID_PER_CMP) & \
6525cf1a30Sjl 	(OPL_MAX_CMPID_PER_BOARD - 1))
6625cf1a30Sjl #define	CORE_ID(x)	(((uint_t)(x)/OPL_MAX_STRANDID_PER_CORE) & \
6725cf1a30Sjl 	(OPL_MAX_COREID_PER_CMP - 1))
6825cf1a30Sjl #define	STRAND_ID(x)	((uint_t)(x) & (OPL_MAX_STRANDID_PER_CORE - 1))
6925cf1a30Sjl 
701e2e7a75Shuah /*
711e2e7a75Shuah  * Max. boards supported in a domain per model.
721e2e7a75Shuah  */
73*78ed97a7Sjl #define	OPL_MAX_BOARDS_IKKAKU	1
741e2e7a75Shuah #define	OPL_MAX_BOARDS_FF1	1
751e2e7a75Shuah #define	OPL_MAX_BOARDS_FF2	2
761e2e7a75Shuah #define	OPL_MAX_BOARDS_DC1	4
771e2e7a75Shuah #define	OPL_MAX_BOARDS_DC2	8
781e2e7a75Shuah #define	OPL_MAX_BOARDS_DC3	16
791e2e7a75Shuah 
80195196c6Ssubhan /* OPL model type */
81195196c6Ssubhan typedef enum {
82*78ed97a7Sjl 	FF1,
83*78ed97a7Sjl 	FF2,
84*78ed97a7Sjl 	DC1,
85*78ed97a7Sjl 	DC2,
86*78ed97a7Sjl 	DC3,
87*78ed97a7Sjl 	IKKAKU
88195196c6Ssubhan } opl_type_t;
89195196c6Ssubhan 
90195196c6Ssubhan /* OPL model specific cmds selection  */
91195196c6Ssubhan #define	STD_DISPATCH_TABLE	0x0
92195196c6Ssubhan #define	EXT_DISPATCH_TABLE	0x1
93195196c6Ssubhan 
941e2e7a75Shuah /*
951e2e7a75Shuah  * Structure to gather model-specific information at boot.
961e2e7a75Shuah  */
971e2e7a75Shuah typedef struct opl_model_info {
98195196c6Ssubhan 	char		model_name[MAXSYSNAME];	/* OPL model name */
99195196c6Ssubhan 	int		model_max_boards;	/* Maximum boards per model */
100195196c6Ssubhan 	opl_type_t 	model_type;		/* Model type */
101195196c6Ssubhan 	int		model_cmds;		/* Model specific cmds */
1021e2e7a75Shuah } opl_model_info_t;
1031e2e7a75Shuah 
10425cf1a30Sjl extern int	plat_max_boards(void);
10525cf1a30Sjl extern int	plat_max_cpu_units_per_board(void);
10625cf1a30Sjl extern int	plat_max_mem_units_per_board(void);
10725cf1a30Sjl extern int	plat_max_io_units_per_board(void);
10825cf1a30Sjl extern int	plat_max_cmp_units_per_board(void);
10925cf1a30Sjl 
11025cf1a30Sjl #ifdef	__cplusplus
11125cf1a30Sjl }
11225cf1a30Sjl #endif
11325cf1a30Sjl 
11425cf1a30Sjl #endif	/* _OPL_H */
115