1 /* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License, Version 1.0 only 6 * (the "License"). You may not use this file except in compliance 7 * with the License. 8 * 9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10 * or http://www.opensolaris.org/os/licensing. 11 * See the License for the specific language governing permissions 12 * and limitations under the License. 13 * 14 * When distributing Covered Code, include this CDDL HEADER in each 15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16 * If applicable, add the following below this CDDL HEADER, with the 17 * fields enclosed by brackets "[]" replaced with your own identifying 18 * information: Portions Copyright [yyyy] [name of copyright owner] 19 * 20 * CDDL HEADER END 21 */ 22 /* 23 * Copyright 2000-2003 Sun Microsystems, Inc. All rights reserved. 24 * Use is subject to license terms. 25 */ 26 27 #ifndef _DAKTARI_H 28 #define _DAKTARI_H 29 30 #pragma ident "%Z%%M% %I% %E% SMI" 31 32 #ifdef __cplusplus 33 extern "C" { 34 #endif 35 36 /* 37 * daktari.h - Daktari common header file 38 * 39 * This header file contains the common definitions and macros for the 40 * Daktari platform. We define them all here to avoid them being redefined 41 * in numerous different drivers and daemons. 42 */ 43 44 45 #define DAK_SBD_SLOTS 4 46 #define DAK_CPUS_PER_BOARD 2 47 #define DAK_MAX_CPUS (DAK_SBD_SLOTS * DAK_CPUS_PER_BOARD) 48 #define DAK_BANKS_PER_MC 4 49 #define DAK_MAX_SLICE (DAK_MAX_CPUS * DAK_BANKS_PER_MC) 50 51 /* 52 * Daktari CPU numbering is...unusual: 53 * Slot SlotID Agent ID 54 * ---- ------ -------- 55 * 0 0 <==> 0 56 * 0 1 <==> 2 57 * 1 0 <==> 1 58 * 1 1 <==> 3 59 * 2 0 <==> 4 60 * 2 1 <==> 6 61 * 3 0 <==> 5 62 * 3 1 <==> 7 63 */ 64 #define DAK_GETSLOT(AID) (((AID&4)>>1)|(AID&1)) 65 #define DAK_GETSLOT_LABEL(AID) ('A' + DAK_GETSLOT(AID)) 66 #define DAK_GETSID(AID) ((AID&2)>>1) 67 #define DAK_GETAID(SLOT, RELCPU) (((SLOT&2)<<1)|(SLOT&1)|((RELCPU)<<1)) 68 69 #define DAK_GET_SBD_APID(BUF, SZ, SLOT) (void) snprintf((BUF), (SZ), "SB%c", \ 70 'a'+(SLOT)) 71 #define DAK_SBD_APID_SZ 4 72 73 #define DAK_GET_PCI_APID(BUF, SZ, SLOT) (void) snprintf((BUF), \ 74 (SZ), "PCI%d", \ 75 (SLOT)) 76 77 /* 78 * These values are taken from Appendices R and U of the UltraSPARC-III 79 * JPS1 Implementation Supplement. 80 */ 81 #define MC_VALID_SHIFT 63 82 #define MC_UK_SHIFT 41 83 #define MC_UM_SHIFT 20 84 #define MC_LK_SHIFT 14 85 #define MC_LM_SHIFT 8 86 #define PHYS2UM_SHIFT 26 87 #define MC_UK(memdec) (((memdec) >> MC_UK_SHIFT) & 0xfffu) 88 #define MC_LK(memdec) (((memdec) >> MC_LK_SHIFT)& 0x3fu) 89 #define MC_INTLV(memdec) ((~(MC_LK(memdec)) & 0xfu) + 1) 90 #define MC_UK2SPAN(memdec) ((MC_UK(memdec) + 1) << PHYS2UM_SHIFT) 91 #define MC_SPANMB(memdec) (MC_UK2SPAN(memdec) >> 20) 92 #define MC_UM(memdec) (((memdec) >> MC_UM_SHIFT) & 0x1fffffu) 93 #define MC_LM(memdec) (((memdec) >> MC_LM_SHIFT) & 0x3f) 94 #define MC_BASE(memdec) (MC_UM(memdec) & ~(MC_UK(memdec))) 95 #define MC_BASE2UM(base) (((base) & 0x1fffffu) << MC_UM_SHIFT) 96 #define SAF_MASK 0x000007ffff800000ull 97 #define MC_OFFSET_MASK 0xffu 98 99 extern uint64_t lddsafaddr(uint64_t physaddr); 100 extern uint64_t lddmcdecode(uint64_t physaddr); 101 102 #ifdef __cplusplus 103 } 104 #endif 105 106 #endif /* _DAKTARI_H */ 107