xref: /onnv-gate/usr/src/uts/sun4u/sys/opl.h (revision 6297:410df87bc54b)
11772Sjl139090 /*
21772Sjl139090  * CDDL HEADER START
31772Sjl139090  *
41772Sjl139090  * The contents of this file are subject to the terms of the
51772Sjl139090  * Common Development and Distribution License (the "License").
61772Sjl139090  * You may not use this file except in compliance with the License.
71772Sjl139090  *
81772Sjl139090  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
91772Sjl139090  * or http://www.opensolaris.org/os/licensing.
101772Sjl139090  * See the License for the specific language governing permissions
111772Sjl139090  * and limitations under the License.
121772Sjl139090  *
131772Sjl139090  * When distributing Covered Code, include this CDDL HEADER in each
141772Sjl139090  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
151772Sjl139090  * If applicable, add the following below this CDDL HEADER, with the
161772Sjl139090  * fields enclosed by brackets "[]" replaced with your own identifying
171772Sjl139090  * information: Portions Copyright [yyyy] [name of copyright owner]
181772Sjl139090  *
191772Sjl139090  * CDDL HEADER END
201772Sjl139090  */
211772Sjl139090 /*
225923Sjfrank  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
231772Sjl139090  * Use is subject to license terms.
241772Sjl139090  */
251772Sjl139090 
261772Sjl139090 #ifndef	_OPL_H
271772Sjl139090 #define	_OPL_H
281772Sjl139090 
291772Sjl139090 #pragma ident	"%Z%%M%	%I%	%E% SMI"
301772Sjl139090 
311772Sjl139090 #ifdef	__cplusplus
321772Sjl139090 extern "C" {
331772Sjl139090 #endif
341772Sjl139090 
355037Sjl139090 #define	OPL_MAX_CPU_PER_CMP		8
361772Sjl139090 #define	OPL_MAX_CORES_PER_CMP		4
371772Sjl139090 #define	OPL_MAX_STRANDS_PER_CORE	2
381772Sjl139090 #define	OPL_MAX_CMP_UNITS_PER_BOARD	4
391772Sjl139090 #define	OPL_MAX_BOARDS			16
401772Sjl139090 #define	OPL_MAX_CPU_PER_BOARD		\
411772Sjl139090 	(OPL_MAX_CPU_PER_CMP * OPL_MAX_CMP_UNITS_PER_BOARD)
421772Sjl139090 #define	OPL_MAX_MEM_UNITS_PER_BOARD	1
431772Sjl139090 #define	OPL_MAX_IO_UNITS_PER_BOARD	16
441772Sjl139090 #define	OPL_MAX_PCICH_UNITS_PER_BOARD	4
451772Sjl139090 #define	OPL_MAX_TSBS_PER_PCICH		2
461772Sjl139090 #define	OPL_MAX_CORE_UNITS_PER_BOARD	\
471772Sjl139090 	(OPL_MAX_CORES_PER_CMP * OPL_MAX_CMP_UNITS_PER_BOARD)
481772Sjl139090 
491772Sjl139090 #define	OPL_MAX_COREID_PER_CMP		4
501772Sjl139090 #define	OPL_MAX_STRANDID_PER_CORE	2
511772Sjl139090 #define	OPL_MAX_CPUID_PER_CMP		(OPL_MAX_COREID_PER_CMP * \
521772Sjl139090 	OPL_MAX_STRANDID_PER_CORE)
531772Sjl139090 #define	OPL_MAX_CMPID_PER_BOARD		4
541772Sjl139090 #define	OPL_MAX_CPUID_PER_BOARD		\
551772Sjl139090 	(OPL_MAX_CPUID_PER_CMP * OPL_MAX_CMPID_PER_BOARD)
561772Sjl139090 #define	OPL_MAX_COREID_PER_BOARD	\
571772Sjl139090 	(OPL_MAX_COREID_PER_CMP * OPL_MAX_CMPID_PER_BOARD)
581772Sjl139090 /*
591772Sjl139090  * Macros to extract LSB_ID, CHIP_ID, CORE_ID, and STRAND_ID
601772Sjl139090  * from the given cpuid.
611772Sjl139090  */
621772Sjl139090 #define	LSB_ID(x)	(((uint_t)(x)/OPL_MAX_CPUID_PER_BOARD) & \
631772Sjl139090 	(OPL_MAX_BOARDS - 1))
641772Sjl139090 #define	CHIP_ID(x)	(((uint_t)(x)/OPL_MAX_CPUID_PER_CMP) & \
651772Sjl139090 	(OPL_MAX_CMPID_PER_BOARD - 1))
661772Sjl139090 #define	CORE_ID(x)	(((uint_t)(x)/OPL_MAX_STRANDID_PER_CORE) & \
671772Sjl139090 	(OPL_MAX_COREID_PER_CMP - 1))
681772Sjl139090 #define	STRAND_ID(x)	((uint_t)(x) & (OPL_MAX_STRANDID_PER_CORE - 1))
691772Sjl139090 
702241Shuah /*
712241Shuah  * Max. boards supported in a domain per model.
722241Shuah  */
73*6297Sjl139090 #define	OPL_MAX_BOARDS_IKKAKU	1
742241Shuah #define	OPL_MAX_BOARDS_FF1	1
752241Shuah #define	OPL_MAX_BOARDS_FF2	2
762241Shuah #define	OPL_MAX_BOARDS_DC1	4
772241Shuah #define	OPL_MAX_BOARDS_DC2	8
782241Shuah #define	OPL_MAX_BOARDS_DC3	16
792241Shuah 
803123Ssubhan /* OPL model type */
813123Ssubhan typedef enum {
82*6297Sjl139090 	FF1,
83*6297Sjl139090 	FF2,
84*6297Sjl139090 	DC1,
85*6297Sjl139090 	DC2,
86*6297Sjl139090 	DC3,
87*6297Sjl139090 	IKKAKU
883123Ssubhan } opl_type_t;
893123Ssubhan 
903123Ssubhan /* OPL model specific cmds selection  */
913123Ssubhan #define	STD_DISPATCH_TABLE	0x0
923123Ssubhan #define	EXT_DISPATCH_TABLE	0x1
933123Ssubhan 
942241Shuah /*
952241Shuah  * Structure to gather model-specific information at boot.
962241Shuah  */
972241Shuah typedef struct opl_model_info {
983123Ssubhan 	char		model_name[MAXSYSNAME];	/* OPL model name */
993123Ssubhan 	int		model_max_boards;	/* Maximum boards per model */
1003123Ssubhan 	opl_type_t 	model_type;		/* Model type */
1013123Ssubhan 	int		model_cmds;		/* Model specific cmds */
1022241Shuah } opl_model_info_t;
1032241Shuah 
1041772Sjl139090 extern int	plat_max_boards(void);
1051772Sjl139090 extern int	plat_max_cpu_units_per_board(void);
1061772Sjl139090 extern int	plat_max_mem_units_per_board(void);
1071772Sjl139090 extern int	plat_max_io_units_per_board(void);
1081772Sjl139090 extern int	plat_max_cmp_units_per_board(void);
1091772Sjl139090 
1101772Sjl139090 #ifdef	__cplusplus
1111772Sjl139090 }
1121772Sjl139090 #endif
1131772Sjl139090 
1141772Sjl139090 #endif	/* _OPL_H */
115