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, Version 1.0 only 6 * (the "License"). You may not use this file except in compliance 7 * with the License. 8 * 9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10 * or http://www.opensolaris.org/os/licensing. 11 * See the License for the specific language governing permissions 12 * and limitations under the License. 13 * 14 * When distributing Covered Code, include this CDDL HEADER in each 15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16 * If applicable, add the following below this CDDL HEADER, with the 17 * fields enclosed by brackets "[]" replaced with your own identifying 18 * information: Portions Copyright [yyyy] [name of copyright owner] 19 * 20 * CDDL HEADER END 21 */ 22 /* 23 * Copyright (c) 1996-2000 by Sun Microsystems, Inc. 24 * All rights reserved. 25 */ 26 27 #ifndef _SCAT_CONST_H 28 #define _SCAT_CONST_H 29 30 #pragma ident "%Z%%M% %I% %E% SMI" 31 32 /* 33 * This file contains definitions fundamental to the Starcat architecture; 34 * how many exps, how many of each asic type, etc. 35 */ 36 37 /* 38 * POST DEVELOPERS: 39 * This file is copied to the OS workspace, and thus must abide by the OS 40 * coding standards. This file must always pass cstyle and hdrchk. 41 */ 42 43 #ifdef __cplusplus 44 extern "C" { 45 #endif 46 47 48 #define SSC_COUNT (2) 49 #define SSC_MAX (SSC_COUNT - 1) 50 #define IS_VALID_SSC(ssc) ((ssc) >= 0 && (ssc) < SSC_COUNT) 51 52 #define EXP_COUNT (18) 53 #define EXP_MAX (EXP_COUNT - 1) 54 #define IS_VALID_EXP(exp) ((exp) >= 0 && (exp) < EXP_COUNT) 55 56 #define EXB_COUNT EXP_COUNT 57 #define EXB_MAX EXP_MAX 58 #define IS_VALID_EXB(exb) IS_VALID_EXP(exb) 59 60 #ifdef No_More_No_More 61 /* Support this for awhile until we purge everywhere: */ 62 #define NODE_COUNT EXP_COUNT 63 #define NODE_MAX EXP_MAX 64 #define IS_VALID_NODE(node) IS_VALID_EXP(node) 65 #endif /* No_More_No_More */ 66 67 /* Slots are L1 boards within an expander */ 68 #define SLOT_COUNT (2) 69 #define SLOT_MAX (SLOT_COUNT - 1) 70 #define IS_VALID_SLOT(slot) ((slot) >= 0 && (slot) < SLOT_COUNT) 71 72 73 #ifdef REFERENCE 74 /* XXX: temporary definitions till Dan decides what he wants */ 75 #define L1_COUNT (SLOT_COUNT * EXP_COUNT) 76 #define L1_MAX (L1_COUNT - 1) 77 #define IS_VALID_L1_BOARD(brd) ((brd) >= 0 && (brd) < L1_COUNT) 78 79 #define S0_PROC_COUNT (4) /* max procs on slot 0 L1 board */ 80 #define S1_PROC_COUNT (2) /* max procs on slot 1 L1 board */ 81 82 #define SPM_COUNT (S0_PROC_COUNT + S1_PROC_COUNT) 83 84 #define PROC_COUNT ((S0_PROC_COUNT * EXP_COUNT) + \ 85 (S1_PROC_COUNT * EXP_COUNT)) 86 #define PROC_MAX (PROC_COUNT - 1) 87 #define IS_VALID_PROC(proc) ((proc) >= 0 && (proc) < PROC_COUNT) 88 89 #define EXP2PROC(exp, spm) ((exp) * (spm)) 90 #define EXPSLTBBC2SRAM(exp, slt, bbc) ((exp * 3) + (slt * 2) + (bbc)) 91 92 #define PROC2EXP(proc) ((proc) / 6) 93 #define PROC2SPM(proc) ((proc) % 6) 94 #define PROC2CPU(proc) (PROC2SPM(proc) & 0x3) 95 #define PROC2SLT(proc) (PROC2SPM(proc) >> 2) 96 #define PROC2BBC(proc) (((PROC2CPU(proc)) & 0x2) >> 1) 97 #define PROC2PRT(proc) ((proc) & 0x1) 98 #define EXPSLT(proc) PROC2EXP(proc), PROC2SLT(proc) 99 #define EXPSLTCPU(proc) PROC2EXP(proc), PROC2SLT(proc), PROC2CPU(proc) 100 #endif /* REFERENCE */ 101 102 103 /* 104 * PFP = Packed flat port. 105 * For cases where one might need to maintain information 106 * (pcd arrays), or write loops, over all 18 X 6 = 108 ports. 107 * It is expected that this flat view of the ports is not made 108 * visible to the user, they should see only the ordered triple 109 * <exp>.<slot>.<lport> or the 10-bit Safari PortId. 110 * PWE = Port Within Expander. [0-5]. Comes along with the 111 * PFP model, should also not be externally visible. 112 */ 113 #define PORT_PER_EXP 6 114 #define PWE_COUNT PORT_PER_EXP 115 #define PWE_MAX (PWE_COUNT - 1) 116 #define IS_VALID_PWE(pwe) ((pwe) >= 0 && (pwe) < PWE_COUNT) 117 118 #define PFP_COUNT (EXP_COUNT * PORT_PER_EXP) 119 #define PFP_MAX (PFP_COUNT - 1) 120 #define IS_VALID_PFP(pfp) ((pfp) >= 0 && (pfp) < PFP_COUNT) 121 122 #define PFP2EXP(pfp) ((pfp) / 6) 123 #define PFP2PWE(pfp) ((pfp) % 6) 124 #define PWE2SLOT(pwe) ((pwe) >> 2) 125 #define PWE2LPORT(pwe) ((pwe) & 0x3) 126 #define PFP2SLOT(pfp) (PWE2SLOT(PFP2PWE(pfp))) 127 #define PFP2LPORT(pfp) (PWE2LPORT(PFP2PWE(pfp))) 128 #define PFP2BBC(pfp) (((PFP2PWE(pfp)) >> 1) & 1) 129 #define PFP2BBCPORT(pfp) ((pfp) & 1) 130 131 #define SL2PWE(slot, lport) (((slot) << 2) + (lport)) 132 #define EPWE2PFP(exp, pwe) (((exp) * 6) + (pwe)) 133 #define ESL2PFP(exp, slot, lport) (EPWE2PFP((exp), SL2PWE((slot), (lport)))) 134 135 #define S0_LPORT_COUNT 4 /* Ports on slot 0 L1 board */ 136 #define S0_LPORT_MAX (S0_LPORT_COUNT - 1) 137 #define IS_VALID_S0LPORT(lport) ((lport) >= 0 && (lport) < S0_LPORT_COUNT) 138 #define S1_LPORT_COUNT 2 /* Ports on slot 1 L1 board */ 139 #define S1_LPORT_MAX (S1_LPORT_COUNT - 1) 140 #define IS_VALID_S1LPORT(lport) ((lport) >= 0 && (lport) < S1_LPORT_COUNT) 141 #define LPORT_COUNT(slot) ((slot) ? S1_LPORT_COUNT : S0_LPORT_COUNT) 142 #define LPORT_MAX(slot) (LPORT_COUNT(slot) - 1) 143 #define IS_VALID_LPORT(slot, lport) \ 144 ((lport) >= 0 && (lport) < LPORT_COUNT(slot)) 145 #define XC_IOBUS_PER_PORT 2 146 #define XC_IOCARD_PER_PORT 1 147 #define IS_VALID_IOBUS(bus) ((bus) >= 0 && (bus) < XC_IOBUS_PER_PORT) 148 #define IS_VALID_IOCARD(card) ((card) >= 0 && (card) < XC_IOCARD_PER_PORT) 149 150 /* BBC in these macros is local to a slot, either 0 or 1: */ 151 #define S0_BBC_COUNT 2 /* BBCs on slot 0 L1 board */ 152 #define S0_BBC_MAX (S0_BBC_COUNT - 1) 153 #define IS_VALID_S0BBC(bbc) ((bbc) >= 0 && (bbc) < S0_BBC_COUNT) 154 #define S1_BBC_COUNT 1 /* BBCs on slot 1 L1 board */ 155 #define S1_BBC_MAX (S1_BBC_COUNT - 1) 156 #define IS_VALID_S1BBC(bbc) ((bbc) >= 0 && (bbc) < S1_BBC_COUNT) 157 #define BBC_COUNT(slot) ((slot) ? S1_BBC_COUNT : S0_BBC_COUNT) 158 #define BBC_MAX(slot) (BBC_COUNT(slot) - 1) 159 #define IS_VALID_BBC(slot, bbc) \ 160 ((bbc) >= 0 && (bbc) < BBC_COUNT(slot)) 161 162 #define LPORT2BBC(lport) ((lport) >> 1) 163 #define PWE2BBC(pwe) (((pwe) >> 1) & 1) 164 165 166 /* These are for use as printf() arguments for "%2d.%d", etc.: */ 167 #define EXPSLOT(pfp) PFP2EXP(pfp), PFP2SLOT(pfp) 168 #define EXPSLOTLPORT(pfp) PFP2EXP(pfp), PFP2SLOT(pfp), PFP2LPORT(pfp) 169 170 171 /* Build a 5-bit Safari Agent ID: */ 172 #define SAFAGENT(slot, lport, is_ioport) \ 173 (((slot) ? ((is_ioport) ? 0x1C : 8) : 0) + (lport)) 174 175 /* Build a 10-bit Safari ID: */ 176 #define SAFARI_ID(exp, slot, lport, is_ioport) \ 177 (SAFAGENT(slot, lport, is_ioport) | ((exp) << 5)) 178 179 /* Given a Safari Agent ID, extract the expander number */ 180 #define GET_EXP(aid) ((aid & 0x3E0ull) >> 5) 181 182 /* Cacheable memory per (CPU) port */ 183 #define DIMMS_PER_PORT 8 184 #define IS_VALID_DIMM(dimm) \ 185 (((dimm) >= 0) && (dimm < (DIMMS_PER_PORT))) 186 #define PMBANKS_PER_PORT 2 187 #define LMBANKS_PER_PMBANK 2 188 #define IS_VALID_PMBANK(pmbank) \ 189 (((pmbank) >= 0) && (pmbank < PMBANKS_PER_PORT)) 190 #define IS_VALID_LMBANK(lmbank) \ 191 (((lmbank) >= 0) && (lmbank < PMBANKS_PER_PORT)) 192 193 /* Ecache per (CPU) port */ 194 #define ECDIMMS_PER_PORT 2 195 #define IS_VALID_ECACHE(ecache) \ 196 (((ecache) >= 0) && (ecache < ECDIMMS_PER_PORT)) 197 198 /* SCM asics per CSB: */ 199 #define SCM_COUNT (2) 200 #define SCM_MAX (SCM_COUNT - 1) 201 #define IS_VALID_SCM(scm) ((scm) >= 0 && (scm) < SCM_COUNT) 202 203 /* Master ports in an SCM: */ 204 #define SCM_MPORT_COUNT 10 205 206 /* SDI asics per EXB: */ 207 #define SDI_COUNT (6) 208 #define SDI_MAX (SDI_COUNT - 1) 209 #define IS_VALID_SDI(sdi) ((sdi) >= 0 && (sdi) < SDI_COUNT) 210 211 /* Half-centerplanes, CSBs, etc. */ 212 #define CP_COUNT (2) 213 #define CP_MAX (CP_COUNT - 1) 214 #define IS_VALID_CP(cp) ((cp) >= 0 && (cp) < CP_COUNT) 215 216 /* DMX asics on the half-centerplane: */ 217 #define DMX_COUNT (6) 218 #define DMX_MAX (DMX_COUNT - 1) 219 #define IS_VALID_DMX(dmx) ((dmx) >= 0 && (dmx) < DMX_COUNT) 220 221 /* AMX asics on the half-centerplane: */ 222 #define AMX_COUNT (2) 223 #define AMX_MAX (AMX_COUNT - 1) 224 #define IS_VALID_AMX(amx) ((amx) >= 0 && (amx) < AMX_COUNT) 225 226 /* Number of CPUs per SBBC on the various boards: */ 227 #define CPU_COUNT (2) 228 229 /* Number of WCI per WIB: */ 230 #define S0_WCI_COUNT (2) 231 #define S0_WCI_MIN (2) 232 #define S0_WCI_MAX (S0_WCI_MIN + S0_WCI_COUNT - 1) 233 #define S0_IS_VALID_WCI(wci) ((wci) >= S0_WCI_MIN && (wci) <= S0_WCI_MAX) 234 #define S1_WCI_COUNT (1) 235 #define S1_WCI_MIN (1) 236 #define S1_WCI_MAX (S1_WCI_MIN + S1_WCI_COUNT - 1) 237 #define WCI_COUNT(slot) ((slot) ? S1_WCI_COUNT : S0_WCI_COUNT) 238 #define WCI_MIN(slot) ((slot) ? S1_WCI_MIN : S0_WCI_MIN) 239 #define WCI_MAX(slot) ((slot) ? S1_WCI_MAX : S0_WCI_MAX) 240 #define S1_IS_VALID_WCI(wci) ((wci) >= S1_WCI_MIN && (wci) <= S1_WCI_MAX) 241 #define IS_VALID_WCI(slot, wci) ((slot) ? S1_IS_VALID_WCI((wci)) : \ 242 S0_IS_VALID_WCI((wci))) 243 244 /* Safari reset number (within sbbc) given slot & lport */ 245 #define WCI_RST_NUM(slot, lport) \ 246 ((slot) ? 1 : ((lport) & 1 ? 1 : 0)) 247 248 /* Number of non WCI safari devices per WIB */ 249 #define S0_WIB_PROC_COUNT (2) /* max procs on slot 0 WIB */ 250 #define S1_WIB_SCHIZO_COUNT (1) /* max schizos on slot 1 WIB */ 251 252 /* Number of Schizo per PCI I/O board: */ 253 #define SCHIZO_COUNT (2) 254 255 /* 256 * CPU and Maxcat L1 boards have 4 DXs, I/O boards have 2. 257 * But it's useful to have this for array dimensions, etc. 258 */ 259 #define DX_COUNT_MAX (4) 260 #define IS_VALID_CPU_DX(dx) ((dx) >= 0 && (dx) < DX_COUNT_MAX) 261 262 /* 263 * DCDS asics for half of a CPU board. The DCDS is a data slice, 264 * 8 are required for a full Safari data path. 265 */ 266 #define DCDS_COUNT (8) 267 #define DCDS_MAX (DCDS_COUNT - 1) 268 #define IS_VALID_DCDS(dcds) ((dcds) >= 0 && (dcds) < DCDS_COUNT) 269 270 271 /* 272 * Address, Data, or Response Bus. 273 * For all three, 0 or 1 is a valid value. 274 */ 275 #define BUS_COUNT (CP_COUNT) 276 #define BUS_MAX (BUS_COUNT - 1) 277 #define IS_VALID_BUS(bus) ((bus) >= 0 && (bus) < BUS_COUNT) 278 279 /* 280 * Address, Data, or Response Bus configuration. 281 * For all three, 1. 2. or 3 is a valid value. 282 */ 283 #define BCONF_MIN 0x1 284 #define BCONF_MAX 0x3 285 #define BCONF_COUNT 3 286 #define IS_VALID_BCONF(bconf) ((bconf) >= BCONF_MIN && (bconf) <= BCONF_MAX) 287 288 /* 289 * This might seem a little obscure to be here, but it's needed 290 * for some array sizes and function prototypes: 291 */ 292 #define AXQ_NASM_SIZE 256 293 294 295 #ifdef __cplusplus 296 } 297 #endif 298 299 #endif /* !_SCAT_CONST_H */ 300