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