10Sstevel@tonic-gate /* 20Sstevel@tonic-gate * CDDL HEADER START 30Sstevel@tonic-gate * 40Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5*2241Shuah * Common Development and Distribution License (the "License"). 6*2241Shuah * You may not use this file except in compliance with the License. 70Sstevel@tonic-gate * 80Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 90Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 100Sstevel@tonic-gate * See the License for the specific language governing permissions 110Sstevel@tonic-gate * and limitations under the License. 120Sstevel@tonic-gate * 130Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 140Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 150Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 160Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 170Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 180Sstevel@tonic-gate * 190Sstevel@tonic-gate * CDDL HEADER END 200Sstevel@tonic-gate */ 210Sstevel@tonic-gate /* 22*2241Shuah * Copyright 2006 Sun Microsystems, Inc. All rights reserved. 230Sstevel@tonic-gate * Use is subject to license terms. 240Sstevel@tonic-gate */ 250Sstevel@tonic-gate 260Sstevel@tonic-gate #ifndef _SYS_STARCAT_H 270Sstevel@tonic-gate #define _SYS_STARCAT_H 280Sstevel@tonic-gate 290Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 300Sstevel@tonic-gate 310Sstevel@tonic-gate #ifdef __cplusplus 320Sstevel@tonic-gate extern "C" { 330Sstevel@tonic-gate #endif 340Sstevel@tonic-gate 350Sstevel@tonic-gate /* 360Sstevel@tonic-gate * Manifest constants of Starcat configuration 370Sstevel@tonic-gate */ 380Sstevel@tonic-gate 390Sstevel@tonic-gate #define STARCAT_BDSET_MAX 18 /* maximum number of boardsets */ 400Sstevel@tonic-gate 410Sstevel@tonic-gate #define STARCAT_BDSET_MIN 1 /* minimum number of boardsets */ 420Sstevel@tonic-gate 430Sstevel@tonic-gate #define STARCAT_BDSET_SLOT_MAX 2 /* maximum slots per boardset */ 440Sstevel@tonic-gate 450Sstevel@tonic-gate #define STARCAT_SLOT0_CPU_MAX 8 /* max CPUs per slot 0 board */ 460Sstevel@tonic-gate 470Sstevel@tonic-gate #define STARCAT_SLOT1_CPU_MAX 4 /* max CPUs per slot 1 board */ 480Sstevel@tonic-gate 490Sstevel@tonic-gate #define STARCAT_BDSET_CPU_MAX 12 /* maximum CPUs per boardset */ 500Sstevel@tonic-gate 510Sstevel@tonic-gate #define STARCAT_SLOT0_MEM_MAX 4 /* max mem units per slot 0 bd */ 520Sstevel@tonic-gate 530Sstevel@tonic-gate #define STARCAT_SLOT1_MEM_MAX 0 /* max mem units per slot 1 bd */ 540Sstevel@tonic-gate 550Sstevel@tonic-gate #define STARCAT_BDSET_MEM_MAX 4 /* max mem units per boardset */ 560Sstevel@tonic-gate 570Sstevel@tonic-gate #define STARCAT_SLOT0_IO_MAX 0 /* max I/O ctrlrs per slot 0 bd */ 580Sstevel@tonic-gate 590Sstevel@tonic-gate #define STARCAT_SLOT1_IO_MAX 2 /* max I/O ctrlrs per slot 1 bd */ 600Sstevel@tonic-gate 610Sstevel@tonic-gate #define STARCAT_BDSET_IO_MAX 2 /* max I/O ctrlrs per boardset */ 620Sstevel@tonic-gate 630Sstevel@tonic-gate #define STARCAT_TSB_PER_IO 2 /* each IO has two leaves */ 640Sstevel@tonic-gate 650Sstevel@tonic-gate /* max prealloc spare tsb's */ 660Sstevel@tonic-gate #define STARCAT_SPARE_TSB_MAX \ 670Sstevel@tonic-gate (STARCAT_BDSET_MAX * STARCAT_BDSET_IO_MAX * STARCAT_TSB_PER_IO) 680Sstevel@tonic-gate 690Sstevel@tonic-gate /* 700Sstevel@tonic-gate * Data bearing mondo vector (DMV) support 710Sstevel@tonic-gate * 720Sstevel@tonic-gate * For Starcat, we need to add a few extra "hardware" dmv interrupts. 730Sstevel@tonic-gate * These actually do not correspond to physical hardware but are used 740Sstevel@tonic-gate * by Starcat IDN. 750Sstevel@tonic-gate */ 760Sstevel@tonic-gate #define STARCAT_DMV_EXTRA 4 770Sstevel@tonic-gate #define STARCAT_DMV_HWINT (MAX_UPA + STARCAT_DMV_EXTRA) 780Sstevel@tonic-gate #define STARCAT_DMV_IDN_BASE (MAX_UPA) 790Sstevel@tonic-gate 800Sstevel@tonic-gate /* 81*2241Shuah * The CPU ID on starcat looks like this: 82*2241Shuah * 83*2241Shuah * 9 5 4 3 2 1 0 84*2241Shuah * -------------------------------------- 85*2241Shuah * | Expander | | Slot | Core | LPORT | 86*2241Shuah * -------------------------------------- 87*2241Shuah * 88*2241Shuah * Expander Starcat has STARCAT_BDSET_MAX (18) expanders. 89*2241Shuah * Slot Starcat has STARCAT_BDSET_SLOT_MAX (2) slots per expander. 90*2241Shuah * Slot 0 carries a CPU-MEM board which has 4 processor chips. 91*2241Shuah * Slot 1 carries an I/O board typically. But it can be 92*2241Shuah * configured to carry a MAXCAT board which has 2 processor 93*2241Shuah * chips on board. 94*2241Shuah * LPORT Port number within the slot for a chip. This is also the 95*2241Shuah * chip number within the slot. Note that Slot 1 can have only 96*2241Shuah * 2 chips, but this representation allows for 4. This is just 97*2241Shuah * the theoretical max. 98*2241Shuah * Core Core number within the chip. 99*2241Shuah * 100*2241Shuah * Currently, the maximum number of cores supported is 2 per chip (on 101*2241Shuah * Panther and Jaguar). 102*2241Shuah * 103*2241Shuah */ 104*2241Shuah /* 1050Sstevel@tonic-gate * Macros for manipulating CPU IDs 1060Sstevel@tonic-gate */ 1070Sstevel@tonic-gate #define STARCAT_CPUID_TO_EXPANDER(p) (((p) >> 5) & 0x1f) 1080Sstevel@tonic-gate #define STARCAT_CPUID_TO_BOARDSLOT(p) (((p) >> 3) & 0x1) 1090Sstevel@tonic-gate #define STARCAT_CPUID_TO_PORTID(p) ((p) & ~0x4) 1100Sstevel@tonic-gate #define STARCAT_CPUID_TO_COREID(p) (((p) >> 2) & 0x1) 1110Sstevel@tonic-gate #define STARCAT_CPUID_TO_CORE_BIT(p) ((p) & (0x1 << 2)) 1120Sstevel@tonic-gate #define STARCAT_CPUID_TO_AGENT(p) ((p) & 0x7) 1130Sstevel@tonic-gate #define STARCAT_CPUID_TO_LPORT(p) ((p) & 0x3) 1140Sstevel@tonic-gate 1150Sstevel@tonic-gate #define MAKE_CPUID(e, s, a) \ 1160Sstevel@tonic-gate ((((e) & 0x1f) << 5) | (((s) & 0x1) << 3) | ((a) & 0x7)) 1170Sstevel@tonic-gate 1180Sstevel@tonic-gate /* 1190Sstevel@tonic-gate * Definitions for decoding memory controller registers. These values 1200Sstevel@tonic-gate * are taken from Chapter 9 of the SPARCV9 JSP-1 US-III implementation 1210Sstevel@tonic-gate * supplement. 1220Sstevel@tonic-gate */ 1230Sstevel@tonic-gate 1240Sstevel@tonic-gate /* Starcat has four banks of memory per MC */ 1250Sstevel@tonic-gate #define MAX_BANKS_PER_MC (4) 1260Sstevel@tonic-gate 1270Sstevel@tonic-gate /* Use only low bits for local CPU MC ASI */ 1280Sstevel@tonic-gate #define MC_OFFSET_MASK (0xffu) 1290Sstevel@tonic-gate 1300Sstevel@tonic-gate /* Shifts to access specific fields of the memdecode register */ 1310Sstevel@tonic-gate #define MC_VALID_SHIFT (63) /* Shift for valid bit */ 1320Sstevel@tonic-gate #define MC_UK_SHIFT (41) /* Shift for upper mask field */ 1330Sstevel@tonic-gate #define MC_UM_SHIFT (20) /* Shift for upper match field */ 1340Sstevel@tonic-gate #define PHYS2UM_SHIFT (26) /* UM field matches bits 42-26 of PA */ 1350Sstevel@tonic-gate 1360Sstevel@tonic-gate /* Extract upper mask field from the decode register */ 1370Sstevel@tonic-gate #define MC_UK(memdec) (((memdec) >> MC_UK_SHIFT) & 0xfffu) 1380Sstevel@tonic-gate 1390Sstevel@tonic-gate /* Extract upper match field from memdecode register */ 1400Sstevel@tonic-gate #define MC_UM(memdec) (((memdec) >> MC_UM_SHIFT) & 0x1fffffu) 1410Sstevel@tonic-gate 1420Sstevel@tonic-gate /* Size of the range covered by the address mask field */ 1430Sstevel@tonic-gate #define MC_UK2SPAN(memdec) ((MC_UK(memdec) + 1) << PHYS2UM_SHIFT) 1440Sstevel@tonic-gate 1450Sstevel@tonic-gate /* The base PA the memdecode register will respond to */ 1460Sstevel@tonic-gate #define MC_BASE(memdec) (MC_UM(memdec) & ~(MC_UK(memdec))) 1470Sstevel@tonic-gate 1480Sstevel@tonic-gate 1490Sstevel@tonic-gate /* 1500Sstevel@tonic-gate * Prototypes for functions 1510Sstevel@tonic-gate */ 1520Sstevel@tonic-gate 1530Sstevel@tonic-gate extern int set_platform_max_ncpus(void); 1540Sstevel@tonic-gate extern int plat_max_boards(void); 1550Sstevel@tonic-gate extern int plat_max_cpu_units_per_board(void); 1560Sstevel@tonic-gate extern int plat_max_mem_units_per_board(void); 1570Sstevel@tonic-gate extern int plat_max_io_units_per_board(void); 1580Sstevel@tonic-gate extern uint64_t lddmcdecode(uint64_t); 1590Sstevel@tonic-gate 1600Sstevel@tonic-gate 1610Sstevel@tonic-gate #ifdef __cplusplus 1620Sstevel@tonic-gate } 1630Sstevel@tonic-gate #endif 1640Sstevel@tonic-gate 1650Sstevel@tonic-gate #endif /* _SYS_STARCAT_H */ 166