03831d35f7499c87d51205817c93e9a8d42c4baestevel * CDDL HEADER START
03831d35f7499c87d51205817c93e9a8d42c4baestevel * The contents of this file are subject to the terms of the
03831d35f7499c87d51205817c93e9a8d42c4baestevel * Common Development and Distribution License, Version 1.0 only
03831d35f7499c87d51205817c93e9a8d42c4baestevel * (the "License"). You may not use this file except in compliance
03831d35f7499c87d51205817c93e9a8d42c4baestevel * with the License.
03831d35f7499c87d51205817c93e9a8d42c4baestevel * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
03831d35f7499c87d51205817c93e9a8d42c4baestevel * See the License for the specific language governing permissions
03831d35f7499c87d51205817c93e9a8d42c4baestevel * and limitations under the License.
03831d35f7499c87d51205817c93e9a8d42c4baestevel * When distributing Covered Code, include this CDDL HEADER in each
03831d35f7499c87d51205817c93e9a8d42c4baestevel * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
03831d35f7499c87d51205817c93e9a8d42c4baestevel * If applicable, add the following below this CDDL HEADER, with the
03831d35f7499c87d51205817c93e9a8d42c4baestevel * fields enclosed by brackets "[]" replaced with your own identifying
03831d35f7499c87d51205817c93e9a8d42c4baestevel * information: Portions Copyright [yyyy] [name of copyright owner]
03831d35f7499c87d51205817c93e9a8d42c4baestevel * CDDL HEADER END
03831d35f7499c87d51205817c93e9a8d42c4baestevel * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
03831d35f7499c87d51205817c93e9a8d42c4baestevel * Use is subject to license terms.
03831d35f7499c87d51205817c93e9a8d42c4baestevel#pragma ident "%Z%%M% %I% %E% SMI"
03831d35f7499c87d51205817c93e9a8d42c4baestevelextern "C" {
03831d35f7499c87d51205817c93e9a8d42c4baestevel * serengeti.h - Serengeti/WildCat common header file
03831d35f7499c87d51205817c93e9a8d42c4baestevel * This header file contains the common definitions and macros for the
03831d35f7499c87d51205817c93e9a8d42c4baestevel * Serengeti and WildCat platforms. We define them all here to avoid them
03831d35f7499c87d51205817c93e9a8d42c4baestevel * being redefined in numerous different drivers.
03831d35f7499c87d51205817c93e9a8d42c4baestevel * Definitions
03831d35f7499c87d51205817c93e9a8d42c4baestevel * ===========
03831d35f7499c87d51205817c93e9a8d42c4baestevel#define SG_MAX_CPUS (SG_MAX_CPUS_PER_BD * SG_MAX_CPU_BDS)
03831d35f7499c87d51205817c93e9a8d42c4baestevel * possible states for the Keyswitch Position.
03831d35f7499c87d51205817c93e9a8d42c4baestevel/* we only need the 5 LSB of the portid to calculate the board number */
03831d35f7499c87d51205817c93e9a8d42c4baestevel * For Serengeti and WildCat the portid consists of 10 bits.
03831d35f7499c87d51205817c93e9a8d42c4baestevel * [9] [8 -------- 5][4 --------- 0]
03831d35f7499c87d51205817c93e9a8d42c4baestevel * ^ NodeID AgentID
03831d35f7499c87d51205817c93e9a8d42c4baestevel * |___ Used in CMP to identify core 1. Unused with non-CMP.
03831d35f7499c87d51205817c93e9a8d42c4baestevel * For CPU boards:
03831d35f7499c87d51205817c93e9a8d42c4baestevel * Aid <4:2> : Board ID/Number
03831d35f7499c87d51205817c93e9a8d42c4baestevel * Aid <1:0> : CPU ID
03831d35f7499c87d51205817c93e9a8d42c4baestevel * For IO boards:
03831d35f7499c87d51205817c93e9a8d42c4baestevel * (Aid <4:0> - 24) / 2 + 6 : Board ID/Number
03831d35f7499c87d51205817c93e9a8d42c4baestevel * (Aid <4:0> - 24) % 2 : Schizo ID
03831d35f7499c87d51205817c93e9a8d42c4baestevel * For Jaguar there are two CPU IDs the can be derived from portid
03831d35f7499c87d51205817c93e9a8d42c4baestevel * and coreid. On Serengeti, bit 9 is set for core 1, resulting in
03831d35f7499c87d51205817c93e9a8d42c4baestevel * the cpuid for core 1 being 512 off from the one for core 0.
03831d35f7499c87d51205817c93e9a8d42c4baestevel#define SG_PORTID_TO_CPUID(p, c) ((p) + ((c) << SG_JG_CORE1_SHIFT))
03831d35f7499c87d51205817c93e9a8d42c4baestevel#define SG_PORTID_TO_CPU_UNIT(p, c) ((p % SG_MAX_CMPS_PER_BD) | \
03831d35f7499c87d51205817c93e9a8d42c4baestevel#define SG_CPUID_TO_PORTID(c) ((c) & SG_SAFARI_ID_MASK)
03831d35f7499c87d51205817c93e9a8d42c4baestevel#define SG_CPUID_TO_COREID(c) (((c) & SG_CORE_ID_MASK) >> \
03831d35f7499c87d51205817c93e9a8d42c4baestevel#define SG_CPUID_TO_CPU_UNIT(c) SG_PORTID_TO_CPU_UNIT( \
03831d35f7499c87d51205817c93e9a8d42c4baestevel * SG_PORTID_TO_NODEID
03831d35f7499c87d51205817c93e9a8d42c4baestevel * Calculates the SSM NodeID from the portid
03831d35f7499c87d51205817c93e9a8d42c4baestevel#define SG_PORTID_TO_NODEID(portid) (((portid) >> SG_PORTID_NODE_SHIFT) & \
03831d35f7499c87d51205817c93e9a8d42c4baestevel * SG_PORTID_TO_SAFARI_ID
03831d35f7499c87d51205817c93e9a8d42c4baestevel * Calculates the Safari Agent ID from the portid.
03831d35f7499c87d51205817c93e9a8d42c4baestevel#define SG_PORTID_TO_SAFARI_ID(portid) ((portid) & SG_SAFARI_ID_MASK)
03831d35f7499c87d51205817c93e9a8d42c4baestevel * SG_PORTID_TO_BOARD_NUM
03831d35f7499c87d51205817c93e9a8d42c4baestevel * If a valid portid is passed in, this macro returns the board number
03831d35f7499c87d51205817c93e9a8d42c4baestevel * associated with it, otherwise it returns -1.
03831d35f7499c87d51205817c93e9a8d42c4baestevel * SG_BOARD_IS_CPU_TYPE
03831d35f7499c87d51205817c93e9a8d42c4baestevel * If the board number of a board of CPU type is passed in, TRUE is returned,
03831d35f7499c87d51205817c93e9a8d42c4baestevel * otherwise FALSE.
03831d35f7499c87d51205817c93e9a8d42c4baestevel ((((board_num) >= 0) && ((board_num) < SG_MAX_CPU_BDS)) ? TRUE: FALSE)
03831d35f7499c87d51205817c93e9a8d42c4baestevel * SG_BOARD_IS_IO_TYPE
03831d35f7499c87d51205817c93e9a8d42c4baestevel * If the board number of a board of IO type is passed in, TRUE is returned,
03831d35f7499c87d51205817c93e9a8d42c4baestevel * otherwise FALSE.
03831d35f7499c87d51205817c93e9a8d42c4baestevel * SG_PORTID_IS_CPU_TYPE
03831d35f7499c87d51205817c93e9a8d42c4baestevel * If the portid associated with a CPU board is passed in, TRUE is returned,
03831d35f7499c87d51205817c93e9a8d42c4baestevel * otherwise FALSE.
03831d35f7499c87d51205817c93e9a8d42c4baestevel (((((portid) & SG_SAFARI_ID_MASK) >= SG_MIN_CPU_SAFARI_ID) && \
03831d35f7499c87d51205817c93e9a8d42c4baestevel (((portid) & SG_SAFARI_ID_MASK) <= SG_MAX_CPU_SAFARI_ID)) ? TRUE: FALSE)
03831d35f7499c87d51205817c93e9a8d42c4baestevel * SG_PORTID_IS_IO_TYPE
03831d35f7499c87d51205817c93e9a8d42c4baestevel * If the portid associated with an IO board is passed in, TRUE is returned,
03831d35f7499c87d51205817c93e9a8d42c4baestevel * otherwise FALSE.
03831d35f7499c87d51205817c93e9a8d42c4baestevel (((((portid) & SG_SAFARI_ID_MASK) >= SG_MIN_IO_SAFARI_ID) && \
03831d35f7499c87d51205817c93e9a8d42c4baestevel (((portid) & SG_SAFARI_ID_MASK) <= SG_MAX_IO_SAFARI_ID)) ? TRUE: FALSE)
03831d35f7499c87d51205817c93e9a8d42c4baestevel * SG_CPU_BD_PORTID_TO_BD_NUM
03831d35f7499c87d51205817c93e9a8d42c4baestevel * If the portid associated with a CPU board is passed in, the board number
03831d35f7499c87d51205817c93e9a8d42c4baestevel * associated with this portid is returned, otherwise -1.
03831d35f7499c87d51205817c93e9a8d42c4baestevel * SG_IO_BD_PORTID_TO_BD_NUM
03831d35f7499c87d51205817c93e9a8d42c4baestevel * If the portid associated with an IO board is passed in, the board number
03831d35f7499c87d51205817c93e9a8d42c4baestevel * associated with this portid is returned, otherwise -1.
03831d35f7499c87d51205817c93e9a8d42c4baestevel (((((portid) & SG_SAFARI_ID_MASK) - 24) / 2) + 6) : (-1))
03831d35f7499c87d51205817c93e9a8d42c4baestevel * SG_PORTID_TO_CPU_POSN
03831d35f7499c87d51205817c93e9a8d42c4baestevel * If the portid associated with a CPU board is passed in, the position
03831d35f7499c87d51205817c93e9a8d42c4baestevel * of the CPU module for this portid is returned, otherwise -1.
03831d35f7499c87d51205817c93e9a8d42c4baestevel * Serengeti slices are defined by bits 34..41 of the physical address
03831d35f7499c87d51205817c93e9a8d42c4baestevel * space, and can contain Safari agent ID bits depending upon the SC
03831d35f7499c87d51205817c93e9a8d42c4baestevel * firmware being used.
03831d35f7499c87d51205817c93e9a8d42c4baestevel#define PFN_SLICE_SHIFT (PA_SLICE_SHIFT - MMU_PAGESHIFT)
03831d35f7499c87d51205817c93e9a8d42c4baestevel#define PA_2_SLICE(pa) (((pa) >> PA_SLICE_SHIFT) & SG_SLICE_MASK)
03831d35f7499c87d51205817c93e9a8d42c4baestevel#define PFN_2_SLICE(pfn) (((pfn) >> PFN_SLICE_SHIFT) & SG_SLICE_MASK)
03831d35f7499c87d51205817c93e9a8d42c4baestevel/* Define the max memory banks per CPU board */
03831d35f7499c87d51205817c93e9a8d42c4baestevel/* Define the number of possible slices for the span of slice bits */
03831d35f7499c87d51205817c93e9a8d42c4baestevel * b represents the SB and c represents the processor (P)
03831d35f7499c87d51205817c93e9a8d42c4baestevel * in relation to the SB.
03831d35f7499c87d51205817c93e9a8d42c4baestevel/* Each physical CPU has 2 ecache DIMMs */
03831d35f7499c87d51205817c93e9a8d42c4baestevel/* Bit 4 of the physical address indicates ecache dimm 0 or 1 */
03831d35f7499c87d51205817c93e9a8d42c4baestevelextern int sg_get_prom_version(int *sysp, int *intfp, int *bldp);
03831d35f7499c87d51205817c93e9a8d42c4baestevelextern int sg_prom_sb_dr_check(void);
03831d35f7499c87d51205817c93e9a8d42c4baestevelextern int sg_prom_cpci_dr_check(void);
03831d35f7499c87d51205817c93e9a8d42c4baestevelextern int sg_get_ecacheunum(int cpuid, uint64_t physaddr, char *buf,
03831d35f7499c87d51205817c93e9a8d42c4baestevel#endif /* _SYS_SERENGETI_H */