1*ce8eb11aSdp78419 2*ce8eb11aSdp78419 /* 3*ce8eb11aSdp78419 * CDDL HEADER START 4*ce8eb11aSdp78419 * 5*ce8eb11aSdp78419 * The contents of this file are subject to the terms of the 6*ce8eb11aSdp78419 * Common Development and Distribution License (the "License"). 7*ce8eb11aSdp78419 * You may not use this file except in compliance with the License. 8*ce8eb11aSdp78419 * 9*ce8eb11aSdp78419 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10*ce8eb11aSdp78419 * or http://www.opensolaris.org/os/licensing. 11*ce8eb11aSdp78419 * See the License for the specific language governing permissions 12*ce8eb11aSdp78419 * and limitations under the License. 13*ce8eb11aSdp78419 * 14*ce8eb11aSdp78419 * When distributing Covered Code, include this CDDL HEADER in each 15*ce8eb11aSdp78419 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16*ce8eb11aSdp78419 * If applicable, add the following below this CDDL HEADER, with the 17*ce8eb11aSdp78419 * fields enclosed by brackets "[]" replaced with your own identifying 18*ce8eb11aSdp78419 * information: Portions Copyright [yyyy] [name of copyright owner] 19*ce8eb11aSdp78419 * 20*ce8eb11aSdp78419 * CDDL HEADER END 21*ce8eb11aSdp78419 */ 22*ce8eb11aSdp78419 23*ce8eb11aSdp78419 /* 24*ce8eb11aSdp78419 * Copyright 2007 Sun Microsystems, Inc. All rights reserved. 25*ce8eb11aSdp78419 * Use is subject to license terms. 26*ce8eb11aSdp78419 */ 27*ce8eb11aSdp78419 28*ce8eb11aSdp78419 #ifndef _SYS_MPO_H 29*ce8eb11aSdp78419 #define _SYS_MPO_H 30*ce8eb11aSdp78419 31*ce8eb11aSdp78419 #pragma ident "%Z%%M% %I% %E% SMI" 32*ce8eb11aSdp78419 33*ce8eb11aSdp78419 #ifdef __cplusplus 34*ce8eb11aSdp78419 extern "C" { 35*ce8eb11aSdp78419 #endif 36*ce8eb11aSdp78419 37*ce8eb11aSdp78419 /* 38*ce8eb11aSdp78419 * mpo.h - Sun4v MPO common header file 39*ce8eb11aSdp78419 * 40*ce8eb11aSdp78419 */ 41*ce8eb11aSdp78419 #define MPO_MAX_MBLOCKS 16 42*ce8eb11aSdp78419 #define MAX_MEM_STRIPES (MAX_MEM_NODES * MPO_MAX_MBLOCKS) 43*ce8eb11aSdp78419 44*ce8eb11aSdp78419 #define PROP_LG_CPU_ID "id" 45*ce8eb11aSdp78419 #define PROP_LG_MASK "address-mask" 46*ce8eb11aSdp78419 #define PROP_LG_LATENCY "latency" 47*ce8eb11aSdp78419 #define PROP_LG_MATCH "address-match" 48*ce8eb11aSdp78419 #define PROP_LG_MEM_LG "memory-latency-group" 49*ce8eb11aSdp78419 #define PROP_LG_CPU "cpu" 50*ce8eb11aSdp78419 #define PROP_LG_MBLOCK "mblock" 51*ce8eb11aSdp78419 #define PROP_LG_BASE "base" 52*ce8eb11aSdp78419 #define PROP_LG_SIZE "size" 53*ce8eb11aSdp78419 #define PROP_LG_RA_PA_OFFSET "address-congruence-offset" 54*ce8eb11aSdp78419 55*ce8eb11aSdp78419 /* Macro to set the correspending bit if an mem-lg homeid is a member */ 56*ce8eb11aSdp78419 #define HOMESET_ADD(homeset, home)\ 57*ce8eb11aSdp78419 homeset |= ((int)1 << (home)) 58*ce8eb11aSdp78419 59*ce8eb11aSdp78419 /* Macro to check if an mem_lg homeid is a member of the homeset */ 60*ce8eb11aSdp78419 #define MEM_LG_ISMEMBER(homeset, home)\ 61*ce8eb11aSdp78419 ((homeset) & ((uint64_t)1 << (home))) 62*ce8eb11aSdp78419 63*ce8eb11aSdp78419 /* Structure to store CPU information from the MD */ 64*ce8eb11aSdp78419 65*ce8eb11aSdp78419 struct cpu_md { 66*ce8eb11aSdp78419 uint_t home; 67*ce8eb11aSdp78419 uint64_t latency; 68*ce8eb11aSdp78419 }; 69*ce8eb11aSdp78419 70*ce8eb11aSdp78419 /* Structure to store mem-lg information from the MD */ 71*ce8eb11aSdp78419 72*ce8eb11aSdp78419 struct lgrp_md { 73*ce8eb11aSdp78419 uint64_t id; 74*ce8eb11aSdp78419 uint64_t addr_mask; 75*ce8eb11aSdp78419 uint64_t addr_match; 76*ce8eb11aSdp78419 uint64_t latency; 77*ce8eb11aSdp78419 mde_cookie_t node; 78*ce8eb11aSdp78419 int ncpu; 79*ce8eb11aSdp78419 }; 80*ce8eb11aSdp78419 81*ce8eb11aSdp78419 /* Structure to store mblock information retrieved from the MD */ 82*ce8eb11aSdp78419 83*ce8eb11aSdp78419 struct mblock_md { 84*ce8eb11aSdp78419 uint64_t base; 85*ce8eb11aSdp78419 uint64_t size; 86*ce8eb11aSdp78419 uint64_t ra_to_pa; 87*ce8eb11aSdp78419 mde_cookie_t node; 88*ce8eb11aSdp78419 pfn_t base_pfn; 89*ce8eb11aSdp78419 pfn_t end_pfn; 90*ce8eb11aSdp78419 }; 91*ce8eb11aSdp78419 92*ce8eb11aSdp78419 /* Structure for memnode information for use by plat_pfn_to_mem_node */ 93*ce8eb11aSdp78419 94*ce8eb11aSdp78419 struct mnode_info { 95*ce8eb11aSdp78419 pfn_t base_pfn; 96*ce8eb11aSdp78419 pfn_t end_pfn; 97*ce8eb11aSdp78419 }; 98*ce8eb11aSdp78419 99*ce8eb11aSdp78419 /* A stripe defines the portion of a mem_node that falls in one mblock */ 100*ce8eb11aSdp78419 typedef struct { 101*ce8eb11aSdp78419 pfn_t physbase; /* first page in mnode in the corresponding mblock */ 102*ce8eb11aSdp78419 pfn_t physmax; /* last valid page in mnode in mblock */ 103*ce8eb11aSdp78419 pfn_t offset; /* stripe starts at physbase - offset */ 104*ce8eb11aSdp78419 int exists; /* set to 1 if mblock has memory in this mnode stripe */ 105*ce8eb11aSdp78419 } mem_stripe_t; 106*ce8eb11aSdp78419 107*ce8eb11aSdp78419 108*ce8eb11aSdp78419 #ifdef __cplusplus 109*ce8eb11aSdp78419 } 110*ce8eb11aSdp78419 #endif 111*ce8eb11aSdp78419 112*ce8eb11aSdp78419 #endif /* _SYS_MPO_H */ 113