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 _DAKTARI_H 287c478bd9Sstevel@tonic-gate #define _DAKTARI_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 * daktari.h - Daktari common header file 387c478bd9Sstevel@tonic-gate * 397c478bd9Sstevel@tonic-gate * This header file contains the common definitions and macros for the 407c478bd9Sstevel@tonic-gate * Daktari 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 447c478bd9Sstevel@tonic-gate 457c478bd9Sstevel@tonic-gate #define DAK_SBD_SLOTS 4 467c478bd9Sstevel@tonic-gate #define DAK_CPUS_PER_BOARD 2 477c478bd9Sstevel@tonic-gate #define DAK_MAX_CPUS (DAK_SBD_SLOTS * DAK_CPUS_PER_BOARD) 487c478bd9Sstevel@tonic-gate #define DAK_BANKS_PER_MC 4 497c478bd9Sstevel@tonic-gate #define DAK_MAX_SLICE (DAK_MAX_CPUS * DAK_BANKS_PER_MC) 507c478bd9Sstevel@tonic-gate 517c478bd9Sstevel@tonic-gate /* 527c478bd9Sstevel@tonic-gate * Daktari CPU numbering is...unusual: 537c478bd9Sstevel@tonic-gate * Slot SlotID Agent ID 547c478bd9Sstevel@tonic-gate * ---- ------ -------- 557c478bd9Sstevel@tonic-gate * 0 0 <==> 0 567c478bd9Sstevel@tonic-gate * 0 1 <==> 2 577c478bd9Sstevel@tonic-gate * 1 0 <==> 1 587c478bd9Sstevel@tonic-gate * 1 1 <==> 3 597c478bd9Sstevel@tonic-gate * 2 0 <==> 4 607c478bd9Sstevel@tonic-gate * 2 1 <==> 6 617c478bd9Sstevel@tonic-gate * 3 0 <==> 5 627c478bd9Sstevel@tonic-gate * 3 1 <==> 7 637c478bd9Sstevel@tonic-gate */ 647c478bd9Sstevel@tonic-gate #define DAK_GETSLOT(AID) (((AID&4)>>1)|(AID&1)) 657c478bd9Sstevel@tonic-gate #define DAK_GETSLOT_LABEL(AID) ('A' + DAK_GETSLOT(AID)) 667c478bd9Sstevel@tonic-gate #define DAK_GETSID(AID) ((AID&2)>>1) 677c478bd9Sstevel@tonic-gate #define DAK_GETAID(SLOT, RELCPU) (((SLOT&2)<<1)|(SLOT&1)|((RELCPU)<<1)) 687c478bd9Sstevel@tonic-gate 697c478bd9Sstevel@tonic-gate #define DAK_GET_SBD_APID(BUF, SZ, SLOT) (void) snprintf((BUF), (SZ), "SB%c", \ 707c478bd9Sstevel@tonic-gate 'a'+(SLOT)) 717c478bd9Sstevel@tonic-gate #define DAK_SBD_APID_SZ 4 727c478bd9Sstevel@tonic-gate 737c478bd9Sstevel@tonic-gate #define DAK_GET_PCI_APID(BUF, SZ, SLOT) (void) snprintf((BUF), \ 747c478bd9Sstevel@tonic-gate (SZ), "PCI%d", \ 757c478bd9Sstevel@tonic-gate (SLOT)) 767c478bd9Sstevel@tonic-gate 777c478bd9Sstevel@tonic-gate /* 787c478bd9Sstevel@tonic-gate * These values are taken from Appendices R and U of the UltraSPARC-III 797c478bd9Sstevel@tonic-gate * JPS1 Implementation Supplement. 807c478bd9Sstevel@tonic-gate */ 817c478bd9Sstevel@tonic-gate #define MC_VALID_SHIFT 63 827c478bd9Sstevel@tonic-gate #define MC_UK_SHIFT 41 837c478bd9Sstevel@tonic-gate #define MC_UM_SHIFT 20 847c478bd9Sstevel@tonic-gate #define MC_LK_SHIFT 14 857c478bd9Sstevel@tonic-gate #define MC_LM_SHIFT 8 867c478bd9Sstevel@tonic-gate #define PHYS2UM_SHIFT 26 877c478bd9Sstevel@tonic-gate #define MC_UK(memdec) (((memdec) >> MC_UK_SHIFT) & 0xfffu) 887c478bd9Sstevel@tonic-gate #define MC_LK(memdec) (((memdec) >> MC_LK_SHIFT)& 0x3fu) 897c478bd9Sstevel@tonic-gate #define MC_INTLV(memdec) ((~(MC_LK(memdec)) & 0xfu) + 1) 907c478bd9Sstevel@tonic-gate #define MC_UK2SPAN(memdec) ((MC_UK(memdec) + 1) << PHYS2UM_SHIFT) 917c478bd9Sstevel@tonic-gate #define MC_SPANMB(memdec) (MC_UK2SPAN(memdec) >> 20) 927c478bd9Sstevel@tonic-gate #define MC_UM(memdec) (((memdec) >> MC_UM_SHIFT) & 0x1fffffu) 937c478bd9Sstevel@tonic-gate #define MC_LM(memdec) (((memdec) >> MC_LM_SHIFT) & 0x3f) 947c478bd9Sstevel@tonic-gate #define MC_BASE(memdec) (MC_UM(memdec) & ~(MC_UK(memdec))) 957c478bd9Sstevel@tonic-gate #define MC_BASE2UM(base) (((base) & 0x1fffffu) << MC_UM_SHIFT) 967c478bd9Sstevel@tonic-gate #define SAF_MASK 0x000007ffff800000ull 977c478bd9Sstevel@tonic-gate #define MC_OFFSET_MASK 0xffu 987c478bd9Sstevel@tonic-gate 99*13bb8906Slm66018 /* 100*13bb8906Slm66018 * Daktari slices are defined by bits 36..39 of the physical address space 101*13bb8906Slm66018 */ 102*13bb8906Slm66018 103*13bb8906Slm66018 #define PA_SLICE_SHIFT (36) 104*13bb8906Slm66018 #define PFN_SLICE_SHIFT (PA_SLICE_SHIFT - MMU_PAGESHIFT) 105*13bb8906Slm66018 #define PA_2_SLICE(pa) (((pa) >> PA_SLICE_SHIFT) & \ 106*13bb8906Slm66018 DAK_SLICE_MASK) 107*13bb8906Slm66018 #define PFN_2_SLICE(pfn) (((pfn) >> PFN_SLICE_SHIFT) & \ 108*13bb8906Slm66018 DAK_SLICE_MASK) 109*13bb8906Slm66018 110*13bb8906Slm66018 /* Define the number of possible slices for the span of slice bits */ 111*13bb8906Slm66018 #define DAK_SLICE_MASK (0xf) 112*13bb8906Slm66018 1137c478bd9Sstevel@tonic-gate extern uint64_t lddsafaddr(uint64_t physaddr); 1147c478bd9Sstevel@tonic-gate extern uint64_t lddmcdecode(uint64_t physaddr); 1157c478bd9Sstevel@tonic-gate 1167c478bd9Sstevel@tonic-gate #ifdef __cplusplus 1177c478bd9Sstevel@tonic-gate } 1187c478bd9Sstevel@tonic-gate #endif 1197c478bd9Sstevel@tonic-gate 1207c478bd9Sstevel@tonic-gate #endif /* _DAKTARI_H */ 121