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
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.
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]
23 * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
30 #pragma ident "%Z%%M% %I% %E% SMI"
37 * daktari.h - Daktari common header file
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.
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)
52 * Daktari CPU numbering is...unusual:
53 * Slot SlotID Agent ID
54 * ---- ------ --------
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))
69 #define DAK_GET_SBD_APID(BUF, SZ, SLOT) (void) snprintf((BUF), (SZ), "SB%c", \
71 #define DAK_SBD_APID_SZ 4
73 #define DAK_GET_PCI_APID(BUF, SZ, SLOT) (void) snprintf((BUF), \
78 * These values are taken from Appendices R and U of the UltraSPARC-III
79 * JPS1 Implementation Supplement.
81 #define MC_VALID_SHIFT 63
82 #define MC_UK_SHIFT 41
83 #define MC_UM_SHIFT 20
84 #define MC_LK_SHIFT 14
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
100 * Daktari slices are defined by bits 36..39 of the physical address space
103 #define PA_SLICE_SHIFT (36)
104 #define PFN_SLICE_SHIFT (PA_SLICE_SHIFT - MMU_PAGESHIFT)
105 #define PA_2_SLICE(pa) (((pa) >> PA_SLICE_SHIFT) & \
107 #define PFN_2_SLICE(pfn) (((pfn) >> PFN_SLICE_SHIFT) & \
110 /* Define the number of possible slices for the span of slice bits */
111 #define DAK_SLICE_MASK (0xf)
113 extern uint64_t lddsafaddr(uint64_t physaddr
);
114 extern uint64_t lddmcdecode(uint64_t physaddr
);
120 #endif /* _DAKTARI_H */