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 57c478bd9Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only 67c478bd9Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance 77c478bd9Sstevel@tonic-gate * with the License. 87c478bd9Sstevel@tonic-gate * 97c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 107c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 117c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 127c478bd9Sstevel@tonic-gate * and limitations under the License. 137c478bd9Sstevel@tonic-gate * 147c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 157c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 167c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 177c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 187c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 197c478bd9Sstevel@tonic-gate * 207c478bd9Sstevel@tonic-gate * CDDL HEADER END 217c478bd9Sstevel@tonic-gate */ 227c478bd9Sstevel@tonic-gate /* 23*13bb8906Slm66018 * Copyright 2005 Sun Microsystems, Inc. All rights reserved. 247c478bd9Sstevel@tonic-gate * Use is subject to license terms. 257c478bd9Sstevel@tonic-gate */ 267c478bd9Sstevel@tonic-gate 277c478bd9Sstevel@tonic-gate #ifndef _CHERRYSTONE_H 287c478bd9Sstevel@tonic-gate #define _CHERRYSTONE_H 297c478bd9Sstevel@tonic-gate 307c478bd9Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 317c478bd9Sstevel@tonic-gate 327c478bd9Sstevel@tonic-gate #ifdef __cplusplus 337c478bd9Sstevel@tonic-gate extern "C" { 347c478bd9Sstevel@tonic-gate #endif 357c478bd9Sstevel@tonic-gate 367c478bd9Sstevel@tonic-gate /* 377c478bd9Sstevel@tonic-gate * cherrystone.h - Cherrystone common header file 387c478bd9Sstevel@tonic-gate * 397c478bd9Sstevel@tonic-gate * This header file contains the common definitions and macros for the 407c478bd9Sstevel@tonic-gate * Cherrystone platform. We define them all here to avoid them being redefined 417c478bd9Sstevel@tonic-gate * in numerous different drivers and daemons. 427c478bd9Sstevel@tonic-gate */ 437c478bd9Sstevel@tonic-gate #define CHERRYSTONE_SBD_SLOTS 2 447c478bd9Sstevel@tonic-gate #define CHERRYSTONE_CPUS_PER_BOARD 2 457c478bd9Sstevel@tonic-gate #define CHERRYSTONE_MAX_CPUS (CHERRYSTONE_SBD_SLOTS * \ 467c478bd9Sstevel@tonic-gate CHERRYSTONE_CPUS_PER_BOARD) 477c478bd9Sstevel@tonic-gate #define CHERRYSTONE_BANKS_PER_MC 4 487c478bd9Sstevel@tonic-gate #define CHERRYSTONE_MAX_SLICE (CHERRYSTONE_MAX_CPUS * \ 49*13bb8906Slm66018 CHERRYSTONE_BANKS_PER_MC) 507c478bd9Sstevel@tonic-gate 517c478bd9Sstevel@tonic-gate /* 527c478bd9Sstevel@tonic-gate * Slot SlotID Agent ID 537c478bd9Sstevel@tonic-gate * ---- ------ -------- 547c478bd9Sstevel@tonic-gate * 0 0 <==> 0 557c478bd9Sstevel@tonic-gate * 0 1 <==> 2 567c478bd9Sstevel@tonic-gate * 1 0 <==> 1 577c478bd9Sstevel@tonic-gate * 1 1 <==> 3 587c478bd9Sstevel@tonic-gate * 4[*] - <==> 8 (Schizo0) 597c478bd9Sstevel@tonic-gate * 5[*] - <==> 9 (Schizo1) 607c478bd9Sstevel@tonic-gate * 617c478bd9Sstevel@tonic-gate * [*] Fake slot numbers used for prtdiag bookkeeping 627c478bd9Sstevel@tonic-gate */ 637c478bd9Sstevel@tonic-gate #define CHERRYSTONE_GETSLOT(AID) (((AID&0xc)>>1)|(AID&1)) 647c478bd9Sstevel@tonic-gate #define CHERRYSTONE_GETSLOT_LABEL(AID) ('A' + CHERRYSTONE_GETSLOT(AID)) 657c478bd9Sstevel@tonic-gate #define CHERRYSTONE_GETSID(AID) ((AID&2)>>1) 667c478bd9Sstevel@tonic-gate #define CHERRYSTONE_GETAID(SLOT, SID) (((SLOT&2)<<1)|(SLOT&1)|((SID)<<1)) 677c478bd9Sstevel@tonic-gate 687c478bd9Sstevel@tonic-gate /* 697c478bd9Sstevel@tonic-gate * These values are taken from Appendices R and U of the UltraSPARC-III 707c478bd9Sstevel@tonic-gate * JPS1 Implementation Supplement. 717c478bd9Sstevel@tonic-gate */ 727c478bd9Sstevel@tonic-gate #define MC_VALID_SHIFT 63 737c478bd9Sstevel@tonic-gate #define MC_UK_SHIFT 41 747c478bd9Sstevel@tonic-gate #define MC_UM_SHIFT 20 757c478bd9Sstevel@tonic-gate #define MC_LK_SHIFT 14 767c478bd9Sstevel@tonic-gate #define MC_LM_SHIFT 8 777c478bd9Sstevel@tonic-gate #define PHYS2UM_SHIFT 26 787c478bd9Sstevel@tonic-gate #define MC_UK(memdec) (((memdec) >> MC_UK_SHIFT) & 0xfffu) 797c478bd9Sstevel@tonic-gate #define MC_LK(memdec) (((memdec) >> MC_LK_SHIFT)& 0x3fu) 807c478bd9Sstevel@tonic-gate #define MC_INTLV(memdec) ((~(MC_LK(memdec)) & 0xfu) + 1) 817c478bd9Sstevel@tonic-gate #define MC_UK2SPAN(memdec) ((MC_UK(memdec) + 1) << PHYS2UM_SHIFT) 827c478bd9Sstevel@tonic-gate #define MC_SPANMB(memdec) (MC_UK2SPAN(memdec) >> 20) 837c478bd9Sstevel@tonic-gate #define MC_UM(memdec) (((memdec) >> MC_UM_SHIFT) & 0x1fffffu) 847c478bd9Sstevel@tonic-gate #define MC_LM(memdec) (((memdec) >> MC_LM_SHIFT) & 0x3f) 857c478bd9Sstevel@tonic-gate #define MC_BASE(memdec) (MC_UM(memdec) & ~(MC_UK(memdec))) 867c478bd9Sstevel@tonic-gate #define MC_BASE2UM(base) (((base) & 0x1fffffu) << MC_UM_SHIFT) 877c478bd9Sstevel@tonic-gate #define SAF_MASK 0x000007ffff800000ull 887c478bd9Sstevel@tonic-gate #define MC_OFFSET_MASK 0xffu 897c478bd9Sstevel@tonic-gate 90*13bb8906Slm66018 /* 91*13bb8906Slm66018 * Cherrystone slices are defined by bits 36..39 of the physical address space 92*13bb8906Slm66018 */ 93*13bb8906Slm66018 94*13bb8906Slm66018 #define PA_SLICE_SHIFT (36) 95*13bb8906Slm66018 #define PFN_SLICE_SHIFT (PA_SLICE_SHIFT - MMU_PAGESHIFT) 96*13bb8906Slm66018 #define PA_2_SLICE(pa) (((pa) >> PA_SLICE_SHIFT) & \ 97*13bb8906Slm66018 CHERRYSTONE_SLICE_MASK) 98*13bb8906Slm66018 #define PFN_2_SLICE(pfn) (((pfn) >> PFN_SLICE_SHIFT) & \ 99*13bb8906Slm66018 CHERRYSTONE_SLICE_MASK) 100*13bb8906Slm66018 101*13bb8906Slm66018 /* Define the number of possible slices for the span of slice bits */ 102*13bb8906Slm66018 #define CHERRYSTONE_SLICE_MASK (0xf) 103*13bb8906Slm66018 1047c478bd9Sstevel@tonic-gate extern uint64_t lddsafaddr(uint64_t physaddr); 1057c478bd9Sstevel@tonic-gate extern uint64_t lddmcdecode(uint64_t physaddr); 1067c478bd9Sstevel@tonic-gate 1077c478bd9Sstevel@tonic-gate #ifdef __cplusplus 1087c478bd9Sstevel@tonic-gate } 1097c478bd9Sstevel@tonic-gate #endif 1107c478bd9Sstevel@tonic-gate 1117c478bd9Sstevel@tonic-gate #endif /* _CHERRYSTONE_H */ 112