xref: /onnv-gate/usr/src/uts/sun4u/starfire/sys/idn_xf.h (revision 0:68f95e015346)
1*0Sstevel@tonic-gate /*
2*0Sstevel@tonic-gate  * CDDL HEADER START
3*0Sstevel@tonic-gate  *
4*0Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*0Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
6*0Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
7*0Sstevel@tonic-gate  * with the License.
8*0Sstevel@tonic-gate  *
9*0Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10*0Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
11*0Sstevel@tonic-gate  * See the License for the specific language governing permissions
12*0Sstevel@tonic-gate  * and limitations under the License.
13*0Sstevel@tonic-gate  *
14*0Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
15*0Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16*0Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
17*0Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
18*0Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
19*0Sstevel@tonic-gate  *
20*0Sstevel@tonic-gate  * CDDL HEADER END
21*0Sstevel@tonic-gate  */
22*0Sstevel@tonic-gate /*
23*0Sstevel@tonic-gate  * Copyright (c) 1999 by Sun Microsystems, Inc.
24*0Sstevel@tonic-gate  * All rights reserved.
25*0Sstevel@tonic-gate  *
26*0Sstevel@tonic-gate  * Inter-Domain Network - Xfire specifics.
27*0Sstevel@tonic-gate  */
28*0Sstevel@tonic-gate 
29*0Sstevel@tonic-gate #ifndef	_SYS_IDN_XF_H
30*0Sstevel@tonic-gate #define	_SYS_IDN_XF_H
31*0Sstevel@tonic-gate 
32*0Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
33*0Sstevel@tonic-gate 
34*0Sstevel@tonic-gate #include <sys/pda.h>
35*0Sstevel@tonic-gate #include <sys/cpu_sgnblk_defs.h>
36*0Sstevel@tonic-gate #include <sys/idn_sigb.h>
37*0Sstevel@tonic-gate #include <sys/starfire.h>
38*0Sstevel@tonic-gate 
39*0Sstevel@tonic-gate #include <sys/idn.h>
40*0Sstevel@tonic-gate 
41*0Sstevel@tonic-gate #ifdef	__cplusplus
42*0Sstevel@tonic-gate extern "C" {
43*0Sstevel@tonic-gate #endif
44*0Sstevel@tonic-gate 
45*0Sstevel@tonic-gate /*
46*0Sstevel@tonic-gate  * These address bits fit into PA[17:9].
47*0Sstevel@tonic-gate  */
48*0Sstevel@tonic-gate #define	CIC_CONFIG0_ADDR	0x002
49*0Sstevel@tonic-gate #define	CIC_CONFIG1_ADDR	0x003
50*0Sstevel@tonic-gate #define	CIC_DOMAIN_MASK_ADDR	0x004
51*0Sstevel@tonic-gate #define	CIC_SM_MASK_ADDR	0x005
52*0Sstevel@tonic-gate #define	CIC_SM_BAR_LSB_ADDR	0x006
53*0Sstevel@tonic-gate #define	CIC_SM_BAR_MSB_ADDR	0x007
54*0Sstevel@tonic-gate #define	CIC_SM_LAR_LSB_ADDR	0x008
55*0Sstevel@tonic-gate #define	CIC_SM_LAR_MSB_ADDR	0x009
56*0Sstevel@tonic-gate 
57*0Sstevel@tonic-gate #define	CIC_CONFIG0_BUSMODE_MASK	0x3
58*0Sstevel@tonic-gate #define	CIC_CONFIG0_BUSMODE_SHIFT	2
59*0Sstevel@tonic-gate #define	CIC_CONFIG0_BUSMODE(c) \
60*0Sstevel@tonic-gate 	(((c) >> CIC_CONFIG0_BUSMODE_SHIFT) & CIC_CONFIG0_BUSMODE_MASK)
61*0Sstevel@tonic-gate #define	CIC_CONFIG1_SMMASK_MASK		0x1
62*0Sstevel@tonic-gate #define	CIC_CONFIG1_SMMASK_SHIFT	1
63*0Sstevel@tonic-gate #define	CIC_CONFIG1_SMMASK_BIT(c) \
64*0Sstevel@tonic-gate 	(((c) >> CIC_CONFIG1_SMMASK_SHIFT) & CIC_CONFIG1_SMMASK_MASK)
65*0Sstevel@tonic-gate 
66*0Sstevel@tonic-gate #define	CIC_CSR_ADDR_MASK	0x1ff
67*0Sstevel@tonic-gate #define	CIC_CSR_ADDR_SHIFT	9
68*0Sstevel@tonic-gate #define	CSR_TYPE_CIC		0xe
69*0Sstevel@tonic-gate 
70*0Sstevel@tonic-gate #define	CSR_BOARD_MASK		0xf	/* PA[39:36] */
71*0Sstevel@tonic-gate #define	CSR_BOARD_SHIFT		36
72*0Sstevel@tonic-gate 
73*0Sstevel@tonic-gate #define	CSR_TYPE_MASK		0xf	/* PA[35:32] */
74*0Sstevel@tonic-gate #define	CSR_TYPE_SHIFT		32
75*0Sstevel@tonic-gate 
76*0Sstevel@tonic-gate #define	CSR_BUS_MASK		0x3
77*0Sstevel@tonic-gate #define	CSR_BUS_SHIFT		6    /* XXX - depends on config/shuffle */
78*0Sstevel@tonic-gate 
79*0Sstevel@tonic-gate 				/* bd=board, t=type, a=addr, bs=bus */
80*0Sstevel@tonic-gate #define	MAKE_CIC_CSR_PA(bd, t, a, bs) \
81*0Sstevel@tonic-gate 		(((u_longlong_t)1 << 40) \
82*0Sstevel@tonic-gate 		    | ((u_longlong_t)((bd) & CSR_BOARD_MASK) \
83*0Sstevel@tonic-gate 			<< CSR_BOARD_SHIFT) \
84*0Sstevel@tonic-gate 		    | ((u_longlong_t)((t) & CSR_TYPE_MASK) \
85*0Sstevel@tonic-gate 			<< CSR_TYPE_SHIFT) \
86*0Sstevel@tonic-gate 		    | ((u_longlong_t)((a) & CIC_CSR_ADDR_MASK) \
87*0Sstevel@tonic-gate 			<< CIC_CSR_ADDR_SHIFT) \
88*0Sstevel@tonic-gate 		    | ((u_longlong_t)((bs) & CSR_BUS_MASK) \
89*0Sstevel@tonic-gate 			<< CSR_BUS_SHIFT))
90*0Sstevel@tonic-gate 
91*0Sstevel@tonic-gate #define	STARFIRE_PC_MADR_VALIDBIT	0x80000000
92*0Sstevel@tonic-gate 
93*0Sstevel@tonic-gate /*
94*0Sstevel@tonic-gate  * Macro to calculate address of CIC prep buffer
95*0Sstevel@tonic-gate  * that resides in PC.
96*0Sstevel@tonic-gate  * This macro really belongs in <sys/starfire.h>
97*0Sstevel@tonic-gate  */
98*0Sstevel@tonic-gate #define	STARFIRE_PC_CICBUF_ADDR(bb, p) \
99*0Sstevel@tonic-gate 		(STARFIRE_BRD_TO_PSI(bb) | \
100*0Sstevel@tonic-gate 		((uint64_t)(p) << STARFIRE_UPS_MID_SHIFT) | \
101*0Sstevel@tonic-gate 		STARFIRE_PSI_PCREG_OFF | \
102*0Sstevel@tonic-gate 		STARFIRE_PC_CIC_WRITE_DATA)
103*0Sstevel@tonic-gate 
104*0Sstevel@tonic-gate /*
105*0Sstevel@tonic-gate  * ---------------------------------------------------------------------
106*0Sstevel@tonic-gate  */
107*0Sstevel@tonic-gate 
108*0Sstevel@tonic-gate extern cpu_t		cpu0;
109*0Sstevel@tonic-gate 
110*0Sstevel@tonic-gate extern int	get_hw_config(struct hwconfig *loc_hw);
111*0Sstevel@tonic-gate extern int	update_local_hw_config(idn_domain_t *ldp,
112*0Sstevel@tonic-gate 				struct hwconfig *loc_hw);
113*0Sstevel@tonic-gate extern boardset_t	cic_read_domain_mask(int board, int bus);
114*0Sstevel@tonic-gate extern boardset_t	cic_read_sm_mask(int board, int bus);
115*0Sstevel@tonic-gate extern uint_t	cic_read_sm_bar(int board, int bus);
116*0Sstevel@tonic-gate extern uint_t	cic_read_sm_lar(int board, int bus);
117*0Sstevel@tonic-gate extern void	pc_read_madr(pda_handle_t ph, int lboard,
118*0Sstevel@tonic-gate 				uint_t mc_adr[], int  local_only);
119*0Sstevel@tonic-gate extern void	mc_get_adr_all(pda_handle_t ph, uint_t mc_adr[],
120*0Sstevel@tonic-gate 				int *nmcadr);
121*0Sstevel@tonic-gate extern int	post2obp_valid(post2obp_info_t *p2o);
122*0Sstevel@tonic-gate 
123*0Sstevel@tonic-gate extern uint_t	xf_physio_rdword(u_longlong_t physaddr);
124*0Sstevel@tonic-gate extern void	xf_physio_wrword(u_longlong_t physaddr, uint_t value);
125*0Sstevel@tonic-gate extern ushort_t	xf_physio_rdhword(u_longlong_t physaddr);
126*0Sstevel@tonic-gate extern void	xf_physio_wrhword(u_longlong_t physaddr, ushort_t value);
127*0Sstevel@tonic-gate 
128*0Sstevel@tonic-gate 
129*0Sstevel@tonic-gate #ifdef	__cplusplus
130*0Sstevel@tonic-gate }
131*0Sstevel@tonic-gate #endif
132*0Sstevel@tonic-gate 
133*0Sstevel@tonic-gate #endif /* _SYS_IDN_XF_H */
134