xref: /titanic_44/usr/src/uts/sun4u/sys/opl.h (revision bde3d612a7c090234c60e6e4578821237a5db135)
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_IKKAKU	1
74 #define	OPL_MAX_BOARDS_FF1	1
75 #define	OPL_MAX_BOARDS_FF2	2
76 #define	OPL_MAX_BOARDS_DC1	4
77 #define	OPL_MAX_BOARDS_DC2	8
78 #define	OPL_MAX_BOARDS_DC3	16
79 
80 /* OPL model type */
81 typedef enum {
82 	FF1,
83 	FF2,
84 	DC1,
85 	DC2,
86 	DC3,
87 	IKKAKU
88 } opl_type_t;
89 
90 /* OPL model specific cmds selection  */
91 #define	STD_DISPATCH_TABLE	0x0
92 #define	EXT_DISPATCH_TABLE	0x1
93 
94 /*
95  * Structure to gather model-specific information at boot.
96  */
97 typedef struct opl_model_info {
98 	char		model_name[MAXSYSNAME];	/* OPL model name */
99 	int		model_max_boards;	/* Maximum boards per model */
100 	opl_type_t 	model_type;		/* Model type */
101 	int		model_cmds;		/* Model specific cmds */
102 } opl_model_info_t;
103 
104 extern int	plat_max_boards(void);
105 extern int	plat_max_cpu_units_per_board(void);
106 extern int	plat_max_mem_units_per_board(void);
107 extern int	plat_max_io_units_per_board(void);
108 extern int	plat_max_cmp_units_per_board(void);
109 
110 #ifdef	__cplusplus
111 }
112 #endif
113 
114 #endif	/* _OPL_H */
115