17c478bd9Sstevel@tonic-gate /* 27c478bd9Sstevel@tonic-gate * CDDL HEADER START 37c478bd9Sstevel@tonic-gate * 47c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5*1e2e7a75Shuah * Common Development and Distribution License (the "License"). 6*1e2e7a75Shuah * You may not use this file except in compliance with the License. 77c478bd9Sstevel@tonic-gate * 87c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 97c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 107c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 117c478bd9Sstevel@tonic-gate * and limitations under the License. 127c478bd9Sstevel@tonic-gate * 137c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 147c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 157c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 167c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 177c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 187c478bd9Sstevel@tonic-gate * 197c478bd9Sstevel@tonic-gate * CDDL HEADER END 207c478bd9Sstevel@tonic-gate */ 217c478bd9Sstevel@tonic-gate /* 22*1e2e7a75Shuah * Copyright 2006 Sun Microsystems, Inc. All rights reserved. 237c478bd9Sstevel@tonic-gate * Use is subject to license terms. 247c478bd9Sstevel@tonic-gate */ 257c478bd9Sstevel@tonic-gate 267c478bd9Sstevel@tonic-gate #ifndef _SYS_STARCAT_H 277c478bd9Sstevel@tonic-gate #define _SYS_STARCAT_H 287c478bd9Sstevel@tonic-gate 297c478bd9Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 307c478bd9Sstevel@tonic-gate 317c478bd9Sstevel@tonic-gate #ifdef __cplusplus 327c478bd9Sstevel@tonic-gate extern "C" { 337c478bd9Sstevel@tonic-gate #endif 347c478bd9Sstevel@tonic-gate 357c478bd9Sstevel@tonic-gate /* 367c478bd9Sstevel@tonic-gate * Manifest constants of Starcat configuration 377c478bd9Sstevel@tonic-gate */ 387c478bd9Sstevel@tonic-gate 397c478bd9Sstevel@tonic-gate #define STARCAT_BDSET_MAX 18 /* maximum number of boardsets */ 407c478bd9Sstevel@tonic-gate 417c478bd9Sstevel@tonic-gate #define STARCAT_BDSET_MIN 1 /* minimum number of boardsets */ 427c478bd9Sstevel@tonic-gate 437c478bd9Sstevel@tonic-gate #define STARCAT_BDSET_SLOT_MAX 2 /* maximum slots per boardset */ 447c478bd9Sstevel@tonic-gate 457c478bd9Sstevel@tonic-gate #define STARCAT_SLOT0_CPU_MAX 8 /* max CPUs per slot 0 board */ 467c478bd9Sstevel@tonic-gate 477c478bd9Sstevel@tonic-gate #define STARCAT_SLOT1_CPU_MAX 4 /* max CPUs per slot 1 board */ 487c478bd9Sstevel@tonic-gate 497c478bd9Sstevel@tonic-gate #define STARCAT_BDSET_CPU_MAX 12 /* maximum CPUs per boardset */ 507c478bd9Sstevel@tonic-gate 517c478bd9Sstevel@tonic-gate #define STARCAT_SLOT0_MEM_MAX 4 /* max mem units per slot 0 bd */ 527c478bd9Sstevel@tonic-gate 537c478bd9Sstevel@tonic-gate #define STARCAT_SLOT1_MEM_MAX 0 /* max mem units per slot 1 bd */ 547c478bd9Sstevel@tonic-gate 557c478bd9Sstevel@tonic-gate #define STARCAT_BDSET_MEM_MAX 4 /* max mem units per boardset */ 567c478bd9Sstevel@tonic-gate 577c478bd9Sstevel@tonic-gate #define STARCAT_SLOT0_IO_MAX 0 /* max I/O ctrlrs per slot 0 bd */ 587c478bd9Sstevel@tonic-gate 597c478bd9Sstevel@tonic-gate #define STARCAT_SLOT1_IO_MAX 2 /* max I/O ctrlrs per slot 1 bd */ 607c478bd9Sstevel@tonic-gate 617c478bd9Sstevel@tonic-gate #define STARCAT_BDSET_IO_MAX 2 /* max I/O ctrlrs per boardset */ 627c478bd9Sstevel@tonic-gate 637c478bd9Sstevel@tonic-gate #define STARCAT_TSB_PER_IO 2 /* each IO has two leaves */ 647c478bd9Sstevel@tonic-gate 657c478bd9Sstevel@tonic-gate /* max prealloc spare tsb's */ 667c478bd9Sstevel@tonic-gate #define STARCAT_SPARE_TSB_MAX \ 677c478bd9Sstevel@tonic-gate (STARCAT_BDSET_MAX * STARCAT_BDSET_IO_MAX * STARCAT_TSB_PER_IO) 687c478bd9Sstevel@tonic-gate 697c478bd9Sstevel@tonic-gate /* 707c478bd9Sstevel@tonic-gate * Data bearing mondo vector (DMV) support 717c478bd9Sstevel@tonic-gate * 727c478bd9Sstevel@tonic-gate * For Starcat, we need to add a few extra "hardware" dmv interrupts. 737c478bd9Sstevel@tonic-gate * These actually do not correspond to physical hardware but are used 747c478bd9Sstevel@tonic-gate * by Starcat IDN. 757c478bd9Sstevel@tonic-gate */ 767c478bd9Sstevel@tonic-gate #define STARCAT_DMV_EXTRA 4 777c478bd9Sstevel@tonic-gate #define STARCAT_DMV_HWINT (MAX_UPA + STARCAT_DMV_EXTRA) 787c478bd9Sstevel@tonic-gate #define STARCAT_DMV_IDN_BASE (MAX_UPA) 797c478bd9Sstevel@tonic-gate 807c478bd9Sstevel@tonic-gate /* 81*1e2e7a75Shuah * The CPU ID on starcat looks like this: 82*1e2e7a75Shuah * 83*1e2e7a75Shuah * 9 5 4 3 2 1 0 84*1e2e7a75Shuah * -------------------------------------- 85*1e2e7a75Shuah * | Expander | | Slot | Core | LPORT | 86*1e2e7a75Shuah * -------------------------------------- 87*1e2e7a75Shuah * 88*1e2e7a75Shuah * Expander Starcat has STARCAT_BDSET_MAX (18) expanders. 89*1e2e7a75Shuah * Slot Starcat has STARCAT_BDSET_SLOT_MAX (2) slots per expander. 90*1e2e7a75Shuah * Slot 0 carries a CPU-MEM board which has 4 processor chips. 91*1e2e7a75Shuah * Slot 1 carries an I/O board typically. But it can be 92*1e2e7a75Shuah * configured to carry a MAXCAT board which has 2 processor 93*1e2e7a75Shuah * chips on board. 94*1e2e7a75Shuah * LPORT Port number within the slot for a chip. This is also the 95*1e2e7a75Shuah * chip number within the slot. Note that Slot 1 can have only 96*1e2e7a75Shuah * 2 chips, but this representation allows for 4. This is just 97*1e2e7a75Shuah * the theoretical max. 98*1e2e7a75Shuah * Core Core number within the chip. 99*1e2e7a75Shuah * 100*1e2e7a75Shuah * Currently, the maximum number of cores supported is 2 per chip (on 101*1e2e7a75Shuah * Panther and Jaguar). 102*1e2e7a75Shuah * 103*1e2e7a75Shuah */ 104*1e2e7a75Shuah /* 1057c478bd9Sstevel@tonic-gate * Macros for manipulating CPU IDs 1067c478bd9Sstevel@tonic-gate */ 1077c478bd9Sstevel@tonic-gate #define STARCAT_CPUID_TO_EXPANDER(p) (((p) >> 5) & 0x1f) 1087c478bd9Sstevel@tonic-gate #define STARCAT_CPUID_TO_BOARDSLOT(p) (((p) >> 3) & 0x1) 1097c478bd9Sstevel@tonic-gate #define STARCAT_CPUID_TO_PORTID(p) ((p) & ~0x4) 1107c478bd9Sstevel@tonic-gate #define STARCAT_CPUID_TO_COREID(p) (((p) >> 2) & 0x1) 1117c478bd9Sstevel@tonic-gate #define STARCAT_CPUID_TO_CORE_BIT(p) ((p) & (0x1 << 2)) 1127c478bd9Sstevel@tonic-gate #define STARCAT_CPUID_TO_AGENT(p) ((p) & 0x7) 1137c478bd9Sstevel@tonic-gate #define STARCAT_CPUID_TO_LPORT(p) ((p) & 0x3) 1147c478bd9Sstevel@tonic-gate 1157c478bd9Sstevel@tonic-gate #define MAKE_CPUID(e, s, a) \ 1167c478bd9Sstevel@tonic-gate ((((e) & 0x1f) << 5) | (((s) & 0x1) << 3) | ((a) & 0x7)) 1177c478bd9Sstevel@tonic-gate 1187c478bd9Sstevel@tonic-gate /* 1197c478bd9Sstevel@tonic-gate * Definitions for decoding memory controller registers. These values 1207c478bd9Sstevel@tonic-gate * are taken from Chapter 9 of the SPARCV9 JSP-1 US-III implementation 1217c478bd9Sstevel@tonic-gate * supplement. 1227c478bd9Sstevel@tonic-gate */ 1237c478bd9Sstevel@tonic-gate 1247c478bd9Sstevel@tonic-gate /* Starcat has four banks of memory per MC */ 1257c478bd9Sstevel@tonic-gate #define MAX_BANKS_PER_MC (4) 1267c478bd9Sstevel@tonic-gate 1277c478bd9Sstevel@tonic-gate /* Use only low bits for local CPU MC ASI */ 1287c478bd9Sstevel@tonic-gate #define MC_OFFSET_MASK (0xffu) 1297c478bd9Sstevel@tonic-gate 1307c478bd9Sstevel@tonic-gate /* Shifts to access specific fields of the memdecode register */ 1317c478bd9Sstevel@tonic-gate #define MC_VALID_SHIFT (63) /* Shift for valid bit */ 1327c478bd9Sstevel@tonic-gate #define MC_UK_SHIFT (41) /* Shift for upper mask field */ 1337c478bd9Sstevel@tonic-gate #define MC_UM_SHIFT (20) /* Shift for upper match field */ 1347c478bd9Sstevel@tonic-gate #define PHYS2UM_SHIFT (26) /* UM field matches bits 42-26 of PA */ 1357c478bd9Sstevel@tonic-gate 1367c478bd9Sstevel@tonic-gate /* Extract upper mask field from the decode register */ 1377c478bd9Sstevel@tonic-gate #define MC_UK(memdec) (((memdec) >> MC_UK_SHIFT) & 0xfffu) 1387c478bd9Sstevel@tonic-gate 1397c478bd9Sstevel@tonic-gate /* Extract upper match field from memdecode register */ 1407c478bd9Sstevel@tonic-gate #define MC_UM(memdec) (((memdec) >> MC_UM_SHIFT) & 0x1fffffu) 1417c478bd9Sstevel@tonic-gate 1427c478bd9Sstevel@tonic-gate /* Size of the range covered by the address mask field */ 1437c478bd9Sstevel@tonic-gate #define MC_UK2SPAN(memdec) ((MC_UK(memdec) + 1) << PHYS2UM_SHIFT) 1447c478bd9Sstevel@tonic-gate 1457c478bd9Sstevel@tonic-gate /* The base PA the memdecode register will respond to */ 1467c478bd9Sstevel@tonic-gate #define MC_BASE(memdec) (MC_UM(memdec) & ~(MC_UK(memdec))) 1477c478bd9Sstevel@tonic-gate 1487c478bd9Sstevel@tonic-gate 1497c478bd9Sstevel@tonic-gate /* 1507c478bd9Sstevel@tonic-gate * Prototypes for functions 1517c478bd9Sstevel@tonic-gate */ 1527c478bd9Sstevel@tonic-gate 1537c478bd9Sstevel@tonic-gate extern int set_platform_max_ncpus(void); 1547c478bd9Sstevel@tonic-gate extern int plat_max_boards(void); 1557c478bd9Sstevel@tonic-gate extern int plat_max_cpu_units_per_board(void); 1567c478bd9Sstevel@tonic-gate extern int plat_max_mem_units_per_board(void); 1577c478bd9Sstevel@tonic-gate extern int plat_max_io_units_per_board(void); 1587c478bd9Sstevel@tonic-gate extern uint64_t lddmcdecode(uint64_t); 1597c478bd9Sstevel@tonic-gate 1607c478bd9Sstevel@tonic-gate 1617c478bd9Sstevel@tonic-gate #ifdef __cplusplus 1627c478bd9Sstevel@tonic-gate } 1637c478bd9Sstevel@tonic-gate #endif 1647c478bd9Sstevel@tonic-gate 1657c478bd9Sstevel@tonic-gate #endif /* _SYS_STARCAT_H */ 166