brd_xgs.c (11208B)
1 /* 2 * 3 * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenBCM/master/Legal/LICENSE file. 4 * 5 * Copyright 2007-2019 Broadcom Inc. All rights reserved. 6 * 7 * File: brd_xgs.c 8 * Purpose: XGS Board programming for 9 * White Knight, Merlin, and Lancelot references platforms 10 */ 11 12 #include <shared/bsl.h> 13 14 #include <bcm/error.h> 15 #include <bcm/stack.h> 16 #include <bcm/topo.h> 17 18 #include <appl/stktask/topo_brd.h> 19 20 #include "topo_int.h" 21 22 /* 23 * These functions map a (src_unit, dest_modid) pair to the local port 24 * on on src_unit which packets destined for dest_modid should exit. This 25 * is based on the current CPU database and topology information if active. 26 * 27 * Used for mirroring, trunking and TX. 28 */ 29 30 /* 31 * Draco board 32 * 1 x 5690 (stackable) 33 */ 34 STATIC int 35 _bcm_board_topomap_12g_stk(int src_unit, int dest_modid, bcm_port_t *exit_port) 36 { 37 *exit_port = 12; /* IPIC_PORT(src_unit) */ 38 return BCM_E_NONE; 39 } 40 41 int 42 bcm_board_topo_12g_stk(topo_cpu_t *tp_cpu, cpudb_ref_t db_ref) 43 { 44 int mod; 45 46 LOG_VERBOSE(BSL_LS_TKS_TOPOLOGY, 47 (BSL_META("TOPO: XGS 569x 12GE+1HG board topology handler\n"))); 48 bcm_topo_map_set(_bcm_board_topomap_12g_stk); 49 50 mod = tp_cpu->local_entry.mod_ids[0]; 51 52 BCM_IF_ERROR_RETURN(bcm_stk_my_modid_set(0, mod)); 53 BCM_IF_ERROR_RETURN(bcm_stk_modport_clear_all(0)); 54 return BCM_E_NONE; 55 } 56 57 /* 58 * Merlin/WhiteKnight board (BCM95690R24S) 59 * (also chassis lm24g line module board) 60 * 5670/71 + 2 x 5690 61 * External stack ports are unit 0 ports 3,6 62 */ 63 STATIC int 64 _bcm_board_topomap_24g_stk(int src_unit, int dest_modid, 65 bcm_port_t *exit_port) 66 { 67 switch (src_unit) { 68 case 0: /* 5670 */ 69 /* check for local connections */ 70 BCM_BOARD_MOD_CHECK(1, 8, dest_modid, exit_port); 71 BCM_BOARD_MOD_CHECK(2, 1, dest_modid, exit_port); 72 return bcm_board_topomap_stk(src_unit, dest_modid, exit_port); 73 74 case 1: /* 5690s */ 75 case 2: 76 *exit_port = 12; /* IPIC_PORT(src_unit) */ 77 return BCM_E_NONE; 78 79 default: 80 return BCM_E_UNIT; 81 } 82 } 83 84 int 85 bcm_board_topo_24g_stk(topo_cpu_t *tp_cpu, cpudb_ref_t db_ref) 86 { 87 int unit; 88 int unitport[3]; 89 90 LOG_VERBOSE(BSL_LS_TKS_TOPOLOGY, 91 (BSL_META("TOPO: XGS 569x 24GE+2HG board topology handler\n"))); 92 bcm_topo_map_set(_bcm_board_topomap_24g_stk); 93 94 unit = 0; /* board fabric unit */ 95 96 unitport[0] = -1; /* 5670 unit 0 */ 97 unitport[1] = 8; /* 5690 unit 1 is on port 8 */ 98 unitport[2] = 1; /* 5690 unit 2 is on port 1 */ 99 100 return bcm_board_xgs_common(unit, tp_cpu, db_ref, unitport); 101 } 102 103 104 105 /* 106 * Lancelot board (BCM95690R48S) 107 * 5670 + 4 x 5690 108 * External stack ports are unit 0 ports 3,4,5,6 109 */ 110 STATIC int 111 _bcm_board_topomap_48g_stk(int src_unit, int dest_modid, 112 bcm_port_t *exit_port) 113 { 114 switch (src_unit) { 115 case 0: /* 5670 */ 116 /* check for local connections */ 117 BCM_BOARD_MOD_CHECK(1, 7, dest_modid, exit_port); 118 BCM_BOARD_MOD_CHECK(2, 8, dest_modid, exit_port); 119 BCM_BOARD_MOD_CHECK(3, 1, dest_modid, exit_port); 120 BCM_BOARD_MOD_CHECK(4, 2, dest_modid, exit_port); 121 return bcm_board_topomap_stk(src_unit, dest_modid, exit_port); 122 123 case 1: /* 5690s */ 124 case 2: 125 case 3: 126 case 4: 127 *exit_port = 12; /* IPIC_PORT(src_unit) */ 128 return BCM_E_NONE; 129 130 default: 131 return BCM_E_UNIT; 132 } 133 } 134 135 int 136 bcm_board_topo_48g_stk(topo_cpu_t *tp_cpu, cpudb_ref_t db_ref) 137 { 138 int unit; 139 int unitport[5]; 140 141 LOG_VERBOSE(BSL_LS_TKS_TOPOLOGY, 142 (BSL_META("TOPO: XGS 569x 48GE+4HG board topology handler\n"))); 143 bcm_topo_map_set(_bcm_board_topomap_48g_stk); 144 145 unit = 0; /* board fabric unit */ 146 147 unitport[0] = -1; /* 5670 unit 0 */ 148 unitport[1] = 7; /* 5690 unit 1 is on port 7 */ 149 unitport[2] = 8; /* 5690 unit 2 is on port 8 */ 150 unitport[3] = 1; /* 5690 unit 3 is on port 1 */ 151 unitport[4] = 2; /* 5690 unit 4 is on port 2 */ 152 153 return bcm_board_xgs_common(unit, tp_cpu, db_ref, unitport); 154 } 155 156 /* 157 * Galahad/Draco-Back-to-back board (BCM95690R24/BCM95690K24) 158 * 2 x 5690 (non-stackable) 159 */ 160 STATIC int 161 _bcm_board_topomap_24g(int src_unit, int dest_modid, 162 bcm_port_t *exit_port) 163 { 164 *exit_port = 12; /* IPIC_PORT(src_unit) */ 165 return BCM_E_NONE; 166 } 167 168 int 169 bcm_board_topo_24g(topo_cpu_t *tp_cpu, cpudb_ref_t db_ref) 170 { 171 int *mod_ids; 172 173 LOG_VERBOSE(BSL_LS_TKS_TOPOLOGY, 174 (BSL_META("TOPO: XGS B2B 569x 24GE board topology handler\n"))); 175 bcm_topo_map_set(_bcm_board_topomap_24g); 176 177 mod_ids = tp_cpu->local_entry.mod_ids; 178 179 BCM_IF_ERROR_RETURN(bcm_stk_my_modid_set(0, mod_ids[0])); 180 BCM_IF_ERROR_RETURN(bcm_stk_my_modid_set(1, mod_ids[1])); 181 BCM_IF_ERROR_RETURN(bcm_stk_modport_clear_all(0)); 182 BCM_IF_ERROR_RETURN(bcm_stk_modport_clear_all(1)); 183 return BCM_E_NONE; 184 } 185 186 /* 187 * Tucana board (BCM95665P48) 188 * 1 x 5665 (stackable) 189 */ 190 STATIC int 191 _bcm_board_topomap_48f_stk(int src_unit, int dest_modid, 192 bcm_port_t *exit_port) 193 { 194 *exit_port = 56; /* IPIC_PORT(src_unit) */ 195 return BCM_E_NONE; 196 #if 0 197 /* alternate 5665 board: unit 0 is 5670, unit 1 is 5665 */ 198 switch (src_unit) { 199 case 0: /* 5670 */ 200 /* check for local connections */ 201 BCM_BOARD_MOD_CHECK(1, 8, dest_modid, exit_port); 202 return bcm_board_topomap_stk(src_unit, dest_modid, exit_port); 203 204 case 1: /* 5665 */ 205 *exit_port = 56; /* IPIC_PORT(src_unit) */ 206 return BCM_E_NONE; 207 208 default: 209 return BCM_E_UNIT; 210 } 211 #endif 212 } 213 214 int 215 bcm_board_topo_48f_stk(topo_cpu_t *tp_cpu, cpudb_ref_t db_ref) 216 { 217 int mod; 218 219 LOG_VERBOSE(BSL_LS_TKS_TOPOLOGY, 220 (BSL_META("TOPO: XGS 5665 48FE+4GE+HG board topology handler\n"))); 221 bcm_topo_map_set(_bcm_board_topomap_48f_stk); 222 223 mod = tp_cpu->local_entry.mod_ids[0]; 224 225 BCM_IF_ERROR_RETURN(bcm_stk_my_modid_set(0, mod)); 226 BCM_IF_ERROR_RETURN(bcm_stk_modport_clear_all(0)); 227 return BCM_E_NONE; 228 #if 0 229 /* alternate 5665 board: unit 0 is 5670, unit 1 is 5665 */ 230 int unit; 231 int unitport[2]; 232 233 bcm_topo_map_set(_bcm_board_topomap_48f_stk); 234 235 unit = 0; 236 unitport[0] = -1; /* 5670 unit 0 */ 237 unitport[1] = 8; /* 5665 unit 1 is on port 8 */ 238 return bcm_board_xgs_common(unit, tp_cpu, db_ref, unitport); 239 #endif 240 } 241 242 /* 243 * Guenevere board (BCM95695P24SX_10) 244 * 5675 + 2 x 5695 + 2 x 5673 245 * External stack ports are unit 0 ports 4,5 246 * Unconnected ports are unit 0 ports 3,6 247 */ 248 STATIC int 249 _bcm_board_topomap_24g2x_stk(int src_unit, int dest_modid, 250 bcm_port_t *exit_port) 251 { 252 switch (src_unit) { 253 case 0: /* 5675 */ 254 /* check for local connections */ 255 BCM_BOARD_MOD_CHECK(1, 1, dest_modid, exit_port); 256 BCM_BOARD_MOD_CHECK(2, 2, dest_modid, exit_port); 257 BCM_BOARD_MOD_CHECK(3, 8, dest_modid, exit_port); 258 BCM_BOARD_MOD_CHECK(4, 7, dest_modid, exit_port); 259 return bcm_board_topomap_stk(src_unit, dest_modid, exit_port); 260 261 case 1: /* 5695s */ 262 case 2: 263 *exit_port = 12; /* IPIC_PORT(src_unit) */ 264 return BCM_E_NONE; 265 266 case 3: /* 5673s */ 267 case 4: 268 *exit_port = 1; /* IPIC_PORT(src_unit) */ 269 return BCM_E_NONE; 270 271 default: 272 return BCM_E_UNIT; 273 } 274 } 275 276 int 277 bcm_board_topo_24g2x_stk(topo_cpu_t *tp_cpu, cpudb_ref_t db_ref) 278 { 279 int unit; 280 int unitport[5]; 281 282 LOG_VERBOSE(BSL_LS_TKS_TOPOLOGY, 283 (BSL_META("TOPO: XGS 569x 24GE+2XE board topology handler\n"))); 284 bcm_topo_map_set(_bcm_board_topomap_24g2x_stk); 285 286 unit = 0; /* board fabric unit */ 287 288 unitport[0] = -1; /* 5675 unit 0 */ 289 unitport[1] = 1; /* 5695 unit 1 is on port 1 */ 290 unitport[2] = 2; /* 5695 unit 2 is on port 2 */ 291 unitport[3] = 8; /* 5673 unit 3 is on port 8 */ 292 unitport[4] = 7; /* 5673 unit 4 is on port 7 */ 293 294 return bcm_board_xgs_common(unit, tp_cpu, db_ref, unitport); 295 } 296 297 /* 298 * Lynxalot board (BCM95673R48S) 299 * 5670 + 2 x 5673 + 4 x 5690 300 * External stack ports are unit 2 ports 5,6 301 */ 302 STATIC int 303 _bcm_board_topomap_48g2x_stk(int src_unit, int dest_modid, 304 bcm_port_t *exit_port) 305 { 306 switch (src_unit) { 307 case 0: /* 5673s */ 308 case 1: 309 *exit_port = 1; /* IPIC_PORT(src_unit) */ 310 return BCM_E_NONE; 311 312 case 2: /* 5670 */ 313 /* check for local connections */ 314 BCM_BOARD_MOD_CHECK(0, 3, dest_modid, exit_port); 315 BCM_BOARD_MOD_CHECK(1, 4, dest_modid, exit_port); 316 BCM_BOARD_MOD_CHECK(3, 7, dest_modid, exit_port); 317 BCM_BOARD_MOD_CHECK(4, 8, dest_modid, exit_port); 318 BCM_BOARD_MOD_CHECK(5, 1, dest_modid, exit_port); 319 BCM_BOARD_MOD_CHECK(6, 2, dest_modid, exit_port); 320 return bcm_board_topomap_stk(src_unit, dest_modid, exit_port); 321 322 case 3: /* 5690s */ 323 case 4: 324 case 5: 325 case 6: 326 *exit_port = 12; /* IPIC_PORT(src_unit) */ 327 return BCM_E_NONE; 328 329 default: 330 return BCM_E_UNIT; 331 } 332 } 333 334 int 335 bcm_board_topo_48g2x_stk(topo_cpu_t *tp_cpu, cpudb_ref_t db_ref) 336 { 337 int unit; 338 int unitport[7]; 339 340 LOG_VERBOSE(BSL_LS_TKS_TOPOLOGY, 341 (BSL_META("TOPO: XGS 569x 48GE+2XE board topology handler\n"))); 342 bcm_topo_map_set(_bcm_board_topomap_48g2x_stk); 343 344 unit = 2; /* board fabric unit */ 345 346 unitport[0] = 3; /* 5673 unit 0 is on port 3 */ 347 unitport[1] = 4; /* 5673 unit 1 is on port 4 */ 348 unitport[2] = -1; /* 5670 unit 2 */ 349 unitport[3] = 7; /* 5690 unit 3 is on port 7 */ 350 unitport[4] = 8; /* 5690 unit 4 is on port 8 */ 351 unitport[5] = 1; /* 5690 unit 5 is on port 1 */ 352 unitport[6] = 2; /* 5690 unit 6 is on port 2 */ 353 354 return bcm_board_xgs_common(unit, tp_cpu, db_ref, unitport); 355 } 356 357 /* 358 * Herc8 board (also chassis cfm board) 359 * 5670 360 * External stack ports are unit 0 ports 1-8 361 */ 362 int 363 bcm_board_topo_8h(topo_cpu_t *tp_cpu, cpudb_ref_t db_ref) 364 { 365 int unit; 366 int unitport[1]; 367 368 LOG_VERBOSE(BSL_LS_TKS_TOPOLOGY, 369 (BSL_META("TOPO: XGS 5670 8HG board topology handler\n"))); 370 bcm_topo_map_set(bcm_board_topomap_stk); 371 372 unit = 0; /* board fabric unit */ 373 374 unitport[0] = -1; /* 5670 unit 0 */ 375 376 return bcm_board_xgs_common(unit, tp_cpu, db_ref, unitport); 377 } 378 379 /* 380 * 5695 at Unit 0 381 */ 382 STATIC int 383 _bcm_board_topomap_xgs2_12g(int src_unit, int dest_modid, 384 bcm_port_t *exit_port) 385 { 386 *exit_port = 13; /* IPIC_PORT(src_unit) */ 387 return BCM_E_NONE; 388 } 389 390 int 391 bcm_board_topo_xgs2_12g(topo_cpu_t *tp_cpu, cpudb_ref_t db_ref) 392 { 393 int mod; 394 395 LOG_VERBOSE(BSL_LS_TKS_TOPOLOGY, 396 (BSL_META("TOPO: XGS2 5695 12GE+1HG SDK\n"))); 397 bcm_topo_map_set(_bcm_board_topomap_xgs2_12g); 398 399 mod = tp_cpu->local_entry.mod_ids[0]; 400 401 BCM_IF_ERROR_RETURN(bcm_stk_my_modid_set(0, mod)); 402 BCM_IF_ERROR_RETURN(bcm_stk_modport_clear_all(0)); 403 return BCM_E_NONE; 404 } 405 406