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) 1996-2000 by Sun Microsystems, Inc. 24*7c478bd9Sstevel@tonic-gate * All rights reserved. 25*7c478bd9Sstevel@tonic-gate */ 26*7c478bd9Sstevel@tonic-gate 27*7c478bd9Sstevel@tonic-gate #ifndef _STARFIRE_H 28*7c478bd9Sstevel@tonic-gate #define _STARFIRE_H 29*7c478bd9Sstevel@tonic-gate 30*7c478bd9Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 31*7c478bd9Sstevel@tonic-gate 32*7c478bd9Sstevel@tonic-gate #ifdef __cplusplus 33*7c478bd9Sstevel@tonic-gate extern "C" { 34*7c478bd9Sstevel@tonic-gate #endif 35*7c478bd9Sstevel@tonic-gate 36*7c478bd9Sstevel@tonic-gate /* I/O space definitions */ 37*7c478bd9Sstevel@tonic-gate #define STARFIRE_IO_BASE 0x10000000000ULL 38*7c478bd9Sstevel@tonic-gate 39*7c478bd9Sstevel@tonic-gate /* UPA Port Space (UPS) definitions */ 40*7c478bd9Sstevel@tonic-gate #define STARFIRE_UPS_MID_SHIFT 33 /* MID is 7 bits */ 41*7c478bd9Sstevel@tonic-gate #define STARFIRE_UPS_BRD_SHIFT 36 42*7c478bd9Sstevel@tonic-gate #define STARFIRE_UPS_BUS_SHIFT 6 43*7c478bd9Sstevel@tonic-gate 44*7c478bd9Sstevel@tonic-gate /* Starfire Interconnect Space (IS) definitions */ 45*7c478bd9Sstevel@tonic-gate #define STARFIRE_IS_MC_BASE 0x10e80000000ULL /* MC Register Space */ 46*7c478bd9Sstevel@tonic-gate 47*7c478bd9Sstevel@tonic-gate 48*7c478bd9Sstevel@tonic-gate /* Port Specific Interconnect Space (PSI) */ 49*7c478bd9Sstevel@tonic-gate #define STARFIRE_PSI_BASE \ 50*7c478bd9Sstevel@tonic-gate 0x100f8000000ULL /* put mid in [39:33] */ 51*7c478bd9Sstevel@tonic-gate #define STARFIRE_PSI_PCREG_OFF \ 52*7c478bd9Sstevel@tonic-gate 0x4000000ULL /* PSI offset for PC regs */ 53*7c478bd9Sstevel@tonic-gate #define STARFIRE_BRD_TO_PSI(board) \ 54*7c478bd9Sstevel@tonic-gate (STARFIRE_PSI_BASE | \ 55*7c478bd9Sstevel@tonic-gate (((uint64_t)board) << STARFIRE_UPS_BRD_SHIFT)) 56*7c478bd9Sstevel@tonic-gate 57*7c478bd9Sstevel@tonic-gate 58*7c478bd9Sstevel@tonic-gate /* Starfire BootBus Space (BS) definitions */ 59*7c478bd9Sstevel@tonic-gate #define STARFIRE_PSI_BS_BASE \ 60*7c478bd9Sstevel@tonic-gate STARFIRE_PSI_BASE /* BS at start of PSI Space */ 61*7c478bd9Sstevel@tonic-gate 62*7c478bd9Sstevel@tonic-gate #define STARFIRE_UPAID2PSI_BS(upaid) \ 63*7c478bd9Sstevel@tonic-gate (STARFIRE_PSI_BS_BASE | \ 64*7c478bd9Sstevel@tonic-gate ((u_longlong_t)STARFIRE_UPAID2HWMID(upaid) << \ 65*7c478bd9Sstevel@tonic-gate STARFIRE_UPS_MID_SHIFT)) 66*7c478bd9Sstevel@tonic-gate 67*7c478bd9Sstevel@tonic-gate #define STARFIRE_DEV2UPAID(b, p, i) \ 68*7c478bd9Sstevel@tonic-gate ((((i) & 0x1) << 6) | \ 69*7c478bd9Sstevel@tonic-gate (((b) & 0xf) << 2) | \ 70*7c478bd9Sstevel@tonic-gate ((p) & 0x3)) 71*7c478bd9Sstevel@tonic-gate 72*7c478bd9Sstevel@tonic-gate /* Starfire Port Controller Register offsets */ 73*7c478bd9Sstevel@tonic-gate #define STARFIRE_PC_CONF 0x000000UL /* Configuration Reg */ 74*7c478bd9Sstevel@tonic-gate #define STARFIRE_PC_COMP_ID 0x000010UL /* Component ID Reg */ 75*7c478bd9Sstevel@tonic-gate #define STARFIRE_PC_BUS_CONF 0x000020UL /* Bus Configuration Reg */ 76*7c478bd9Sstevel@tonic-gate #define STARFIRE_PC_TO_HOLD_CONF 0x000030UL /* Timeout/Hold Config Reg */ 77*7c478bd9Sstevel@tonic-gate #define STARFIRE_PC_CIC_WRITE_DATA 0x000040UL /* CIC Write Data Reg */ 78*7c478bd9Sstevel@tonic-gate #define STARFIRE_PC_FORCE_PARITY_ERR 0x000050UL /* Force Parity Err Reg */ 79*7c478bd9Sstevel@tonic-gate #define STARFIRE_PC_ERR_0_MASK 0x000060UL /* Err 0 Mask Reg */ 80*7c478bd9Sstevel@tonic-gate #define STARFIRE_PC_ERR_1_MASK 0x000070UL /* Err 1 Mask Reg */ 81*7c478bd9Sstevel@tonic-gate #define STARFIRE_PC_ERR_0 0x000080UL /* Err 0 Reg */ 82*7c478bd9Sstevel@tonic-gate #define STARFIRE_PC_ERR_1 0x000090UL /* Err 1 Reg */ 83*7c478bd9Sstevel@tonic-gate #define STARFIRE_PC_ERR_DATA_SRC 0x0000a0UL /* Err Data Src Reg */ 84*7c478bd9Sstevel@tonic-gate #define STARFIRE_PC_ERR_DATA_LOW 0x0000b0UL /* Err Data Lower Reg */ 85*7c478bd9Sstevel@tonic-gate #define STARFIRE_PC_ERR_DATA_HI 0x0000c0UL /* Err Data Upper Reg */ 86*7c478bd9Sstevel@tonic-gate #define STARFIRE_PC_PORT_ID 0x0000d0UL 87*7c478bd9Sstevel@tonic-gate #define STARFIRE_PC_PERF_COUNT_0 0x0000e0UL 88*7c478bd9Sstevel@tonic-gate #define STARFIRE_PC_PERF_COUNT_1 0x0000f0UL 89*7c478bd9Sstevel@tonic-gate #define STARFIRE_PC_PERF_COUNT_CNTRL 0x000100UL 90*7c478bd9Sstevel@tonic-gate #define STARFIRE_PC_BLOCK 0x0001c0UL /* 512 Byte scr area */ 91*7c478bd9Sstevel@tonic-gate #define STARFIRE_PC_INT_MAP 0x000200UL /* 32 regs 00.0200-00.03f0 */ 92*7c478bd9Sstevel@tonic-gate #define STARFIRE_PC_MADR 0x000400UL /* 16 regs 00.0400-00.04f0 */ 93*7c478bd9Sstevel@tonic-gate 94*7c478bd9Sstevel@tonic-gate /* Starfire PC definitions/macros */ 95*7c478bd9Sstevel@tonic-gate #define STARFIRE_PC_MADR_BOARD_SHIFT 4 96*7c478bd9Sstevel@tonic-gate #define STARFIRE_PC_MADR_ADDR(bb, rb, p) \ 97*7c478bd9Sstevel@tonic-gate (STARFIRE_BRD_TO_PSI(bb) | \ 98*7c478bd9Sstevel@tonic-gate ((uint64_t)(p) << STARFIRE_UPS_MID_SHIFT) | \ 99*7c478bd9Sstevel@tonic-gate ((uint64_t)(rb) << STARFIRE_PC_MADR_BOARD_SHIFT) | \ 100*7c478bd9Sstevel@tonic-gate STARFIRE_PSI_PCREG_OFF | \ 101*7c478bd9Sstevel@tonic-gate STARFIRE_PC_MADR) 102*7c478bd9Sstevel@tonic-gate 103*7c478bd9Sstevel@tonic-gate /* Starfire BB (BootBus) definitions/macros */ 104*7c478bd9Sstevel@tonic-gate #define STARFIRE_BB_SYSRESET_CNTRL 0x800000ULL 105*7c478bd9Sstevel@tonic-gate #define STARFIRE_BB_PAUSE_FLUSH 0x800016ULL 106*7c478bd9Sstevel@tonic-gate 107*7c478bd9Sstevel@tonic-gate #define STARFIRE_BB_PC_PAUSE(i) ((uchar_t)(1 << (i))) 108*7c478bd9Sstevel@tonic-gate #define STARFIRE_BB_PC_FLUSH(i) ((uchar_t)(1 << ((i)+2))) 109*7c478bd9Sstevel@tonic-gate #define STARFIRE_BB_PC_IDLE(i) ((uchar_t)(1 << ((i)+4))) 110*7c478bd9Sstevel@tonic-gate 111*7c478bd9Sstevel@tonic-gate #define STARFIRE_BB_SYSRESET(i) ((uchar_t)(1 << (i))) 112*7c478bd9Sstevel@tonic-gate 113*7c478bd9Sstevel@tonic-gate #define STARFIRE_BB_PC_ADDR(bb, p, io) \ 114*7c478bd9Sstevel@tonic-gate (STARFIRE_UPAID2PSI_BS(STARFIRE_DEV2UPAID((bb), (p), (io))) | \ 115*7c478bd9Sstevel@tonic-gate STARFIRE_BB_PAUSE_FLUSH) 116*7c478bd9Sstevel@tonic-gate #define STARFIRE_BB_RESET_ADDR(bb, p) \ 117*7c478bd9Sstevel@tonic-gate (STARFIRE_UPAID2PSI_BS(STARFIRE_DEV2UPAID((bb), (p), 0)) | \ 118*7c478bd9Sstevel@tonic-gate STARFIRE_BB_SYSRESET_CNTRL) 119*7c478bd9Sstevel@tonic-gate 120*7c478bd9Sstevel@tonic-gate /* Starfire Memory Controller Register offsets */ 121*7c478bd9Sstevel@tonic-gate #define STARFIRE_MC_ASR 0x000400U /* Addr Select Reg */ 122*7c478bd9Sstevel@tonic-gate #define STARFIRE_MC_DIMMTYPE 0x00c800U /* DIMM Type Code Reg */ 123*7c478bd9Sstevel@tonic-gate #define STARFIRE_MC_IDLE 0x00cc00U /* Idle MC Reg */ 124*7c478bd9Sstevel@tonic-gate 125*7c478bd9Sstevel@tonic-gate /* Starfire MC definitions/macros */ 126*7c478bd9Sstevel@tonic-gate #define STARFIRE_MC_MEM_PRESENT_MASK 0x80000000U 127*7c478bd9Sstevel@tonic-gate #define STARFIRE_MC_MEM_BASEADDR_MASK 0x7fff0000U 128*7c478bd9Sstevel@tonic-gate #define STARFIRE_MC_IDLE_MASK 0x00008000U 129*7c478bd9Sstevel@tonic-gate #define STARFIRE_MC_MASK_MASK 0x00007f00U 130*7c478bd9Sstevel@tonic-gate #define STARFIRE_MC_DIMMSIZE_MASK 0x0000001fU 131*7c478bd9Sstevel@tonic-gate #define STARFIRE_MC_INTERLEAVE_MASK 0x00000001U 132*7c478bd9Sstevel@tonic-gate #define STARFIRE_MC_MASK_SHIFT 18 133*7c478bd9Sstevel@tonic-gate #define STARFIRE_MC_BASE_SHIFT 10 134*7c478bd9Sstevel@tonic-gate #define STARFIRE_MC_ADDR_HIBITS 0x1fe00000000ULL 135*7c478bd9Sstevel@tonic-gate #define STARFIRE_MC_ASR_ADDR(reg) ((reg) | (uint64_t)STARFIRE_MC_ASR) 136*7c478bd9Sstevel@tonic-gate #define STARFIRE_MC_IDLE_ADDR(reg) ((reg) | (uint64_t)STARFIRE_MC_IDLE) 137*7c478bd9Sstevel@tonic-gate #define STARFIRE_MC_DIMMTYPE_ADDR(reg) ((reg) | (uint64_t)STARFIRE_MC_DIMMTYPE) 138*7c478bd9Sstevel@tonic-gate #define STARFIRE_MC_ASR_ADDR_BOARD(b) \ 139*7c478bd9Sstevel@tonic-gate (((uint64_t)(b) << STARFIRE_UPS_BRD_SHIFT) | \ 140*7c478bd9Sstevel@tonic-gate STARFIRE_IS_MC_BASE | \ 141*7c478bd9Sstevel@tonic-gate (uint64_t)STARFIRE_MC_ASR) 142*7c478bd9Sstevel@tonic-gate 143*7c478bd9Sstevel@tonic-gate /* 144*7c478bd9Sstevel@tonic-gate * Memory boards on Starfire are aligned on 8GB 145*7c478bd9Sstevel@tonic-gate * boundaries, i.e. the physical address space 146*7c478bd9Sstevel@tonic-gate * is not physically contiguous. 147*7c478bd9Sstevel@tonic-gate */ 148*7c478bd9Sstevel@tonic-gate #define STARFIRE_MC_MEMBOARD_SHIFT 33 149*7c478bd9Sstevel@tonic-gate #define STARFIRE_MC_MEMBOARD_ALIGNMENT \ 150*7c478bd9Sstevel@tonic-gate (UINT64_C(1) << STARFIRE_MC_MEMBOARD_SHIFT) 151*7c478bd9Sstevel@tonic-gate 152*7c478bd9Sstevel@tonic-gate /* 153*7c478bd9Sstevel@tonic-gate * Starfire has a special regspec for the "reg" property of the 154*7c478bd9Sstevel@tonic-gate * mem-unit node since this node is homegrown. 155*7c478bd9Sstevel@tonic-gate */ 156*7c478bd9Sstevel@tonic-gate struct sf_memunit_regspec { 157*7c478bd9Sstevel@tonic-gate uint_t regspec_addr_hi; 158*7c478bd9Sstevel@tonic-gate uint_t regspec_addr_lo; 159*7c478bd9Sstevel@tonic-gate uint_t regspec_size_hi; 160*7c478bd9Sstevel@tonic-gate uint_t regspec_size_lo; 161*7c478bd9Sstevel@tonic-gate }; 162*7c478bd9Sstevel@tonic-gate 163*7c478bd9Sstevel@tonic-gate /* 164*7c478bd9Sstevel@tonic-gate * Conversion macros 165*7c478bd9Sstevel@tonic-gate */ 166*7c478bd9Sstevel@tonic-gate 167*7c478bd9Sstevel@tonic-gate /* 168*7c478bd9Sstevel@tonic-gate * Starfire hardware version of the upaid (commonly known as 169*7c478bd9Sstevel@tonic-gate * HWMID) is different from the software version (also known as upaid). 170*7c478bd9Sstevel@tonic-gate * HW version BBBBIPp == SW version IBBBBPp 171*7c478bd9Sstevel@tonic-gate */ 172*7c478bd9Sstevel@tonic-gate #define STARFIRE_UPAID2HWMID(upaid) (((upaid & 0x3C) << 1) | \ 173*7c478bd9Sstevel@tonic-gate ((upaid & 0x40) >> 4) | (upaid & 0x3)) 174*7c478bd9Sstevel@tonic-gate 175*7c478bd9Sstevel@tonic-gate 176*7c478bd9Sstevel@tonic-gate /* Xfire UPA ID to UPA Port Specific Space */ 177*7c478bd9Sstevel@tonic-gate #define STARFIRE_UPAID2UPS(upaid) \ 178*7c478bd9Sstevel@tonic-gate (((u_longlong_t)STARFIRE_UPAID2HWMID(upaid) << \ 179*7c478bd9Sstevel@tonic-gate STARFIRE_UPS_MID_SHIFT) | STARFIRE_IO_BASE) 180*7c478bd9Sstevel@tonic-gate 181*7c478bd9Sstevel@tonic-gate /* 182*7c478bd9Sstevel@tonic-gate * Macro to convert our 7 bits HW MID to 7 bits SW MID 183*7c478bd9Sstevel@tonic-gate * That is "BBBBIPp" to "IBBBBPp". 184*7c478bd9Sstevel@tonic-gate */ 185*7c478bd9Sstevel@tonic-gate #define STARFIRE_HWMID2SWMID(mid) ((mid & 0x3) | ((mid & 0x78) >> 1) | \ 186*7c478bd9Sstevel@tonic-gate ((mid & 0x4) << 4)) 187*7c478bd9Sstevel@tonic-gate 188*7c478bd9Sstevel@tonic-gate /* 189*7c478bd9Sstevel@tonic-gate * Macro to convert our 7 bits UPAid to Sun's 5 bit HW Interrupt 190*7c478bd9Sstevel@tonic-gate * group number required in some hardware registers (sysios). 191*7c478bd9Sstevel@tonic-gate * That is "IBBBBPp" to "BBBBp", where "BBBB" is the board number, 192*7c478bd9Sstevel@tonic-gate * "IP" is the PC id and "p" is the port number. 193*7c478bd9Sstevel@tonic-gate */ 194*7c478bd9Sstevel@tonic-gate #define STARFIRE_UPAID2HWIGN(upaid) \ 195*7c478bd9Sstevel@tonic-gate (((upaid & 0x3C) >> 1) | (upaid & 0x1)) 196*7c478bd9Sstevel@tonic-gate 197*7c478bd9Sstevel@tonic-gate /* 198*7c478bd9Sstevel@tonic-gate * Macro to convert our UPAid to a 7 bit Starfire version of the 199*7c478bd9Sstevel@tonic-gate * interrupt group number. This so-called IGN is part of 200*7c478bd9Sstevel@tonic-gate * the interrupt vector number read by the CPU serving this interrupt. 201*7c478bd9Sstevel@tonic-gate * Thanks to the warp minds of our hardware guys, it is in this 202*7c478bd9Sstevel@tonic-gate * convoluted weird format. Note that the interrupt vector number is 203*7c478bd9Sstevel@tonic-gate * then used to index into the interrupt dispatch table to get its 204*7c478bd9Sstevel@tonic-gate * interrupt handler. 205*7c478bd9Sstevel@tonic-gate * Convert "IBBBBPp" to "XPBBBBp" where "BBBB" is the 4bit board #, 206*7c478bd9Sstevel@tonic-gate * "IP" is the 2 bit PC id, "p" is the port # and "X" is ~I. 207*7c478bd9Sstevel@tonic-gate */ 208*7c478bd9Sstevel@tonic-gate #define STARFIRE_UPAID2IGN(upaid) (STARFIRE_UPAID2HWIGN(upaid) | \ 209*7c478bd9Sstevel@tonic-gate ((upaid & 0x2) << 4) | \ 210*7c478bd9Sstevel@tonic-gate ((upaid & 0x40) ^ 0x40)) 211*7c478bd9Sstevel@tonic-gate 212*7c478bd9Sstevel@tonic-gate /* 213*7c478bd9Sstevel@tonic-gate * Starfire platform specific routines currently only defined 214*7c478bd9Sstevel@tonic-gate * in starfire.c and referenced by DR. 215*7c478bd9Sstevel@tonic-gate */ 216*7c478bd9Sstevel@tonic-gate extern int plat_max_boards(); 217*7c478bd9Sstevel@tonic-gate extern int plat_max_cpu_units_per_board(); 218*7c478bd9Sstevel@tonic-gate extern int plat_max_mem_units_per_board(); 219*7c478bd9Sstevel@tonic-gate extern int plat_max_io_units_per_board(); 220*7c478bd9Sstevel@tonic-gate 221*7c478bd9Sstevel@tonic-gate /* 222*7c478bd9Sstevel@tonic-gate * Starfire platform specific interrupt translation routines 223*7c478bd9Sstevel@tonic-gate */ 224*7c478bd9Sstevel@tonic-gate extern void pc_ittrans_init(int, caddr_t *); 225*7c478bd9Sstevel@tonic-gate extern void pc_ittrans_uninit(caddr_t); 226*7c478bd9Sstevel@tonic-gate extern int pc_translate_tgtid(caddr_t, int, volatile uint64_t *); 227*7c478bd9Sstevel@tonic-gate extern void pc_ittrans_cleanup(caddr_t, volatile uint64_t *); 228*7c478bd9Sstevel@tonic-gate 229*7c478bd9Sstevel@tonic-gate /* 230*7c478bd9Sstevel@tonic-gate * Maximum number of system boards supported in a Starfire. 231*7c478bd9Sstevel@tonic-gate */ 232*7c478bd9Sstevel@tonic-gate #define STARFIRE_MAX_BOARDS 16 233*7c478bd9Sstevel@tonic-gate 234*7c478bd9Sstevel@tonic-gate /* 235*7c478bd9Sstevel@tonic-gate * We reserve some "fake" DMV values for Starfire IDN. These are treated 236*7c478bd9Sstevel@tonic-gate * as hardware interrupt numbers, but they don't correspond to an actual UPA 237*7c478bd9Sstevel@tonic-gate * port; they can thus be allocated as "well-known" numbers for IDN purposes. 238*7c478bd9Sstevel@tonic-gate */ 239*7c478bd9Sstevel@tonic-gate #define STARFIRE_DMV_EXTRA 4 240*7c478bd9Sstevel@tonic-gate #define STARFIRE_DMV_HWINT (MAX_UPA+STARFIRE_DMV_EXTRA) 241*7c478bd9Sstevel@tonic-gate #define STARFIRE_DMV_IDN_BASE (MAX_UPA) 242*7c478bd9Sstevel@tonic-gate 243*7c478bd9Sstevel@tonic-gate 244*7c478bd9Sstevel@tonic-gate #ifdef __cplusplus 245*7c478bd9Sstevel@tonic-gate } 246*7c478bd9Sstevel@tonic-gate #endif 247*7c478bd9Sstevel@tonic-gate 248*7c478bd9Sstevel@tonic-gate #endif /* _STARFIRE_H */ 249