1ce8eb11aSdp78419 /* 2ce8eb11aSdp78419 * CDDL HEADER START 3ce8eb11aSdp78419 * 4ce8eb11aSdp78419 * The contents of this file are subject to the terms of the 5ce8eb11aSdp78419 * Common Development and Distribution License (the "License"). 6ce8eb11aSdp78419 * You may not use this file except in compliance with the License. 7ce8eb11aSdp78419 * 8ce8eb11aSdp78419 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9ce8eb11aSdp78419 * or http://www.opensolaris.org/os/licensing. 10ce8eb11aSdp78419 * See the License for the specific language governing permissions 11ce8eb11aSdp78419 * and limitations under the License. 12ce8eb11aSdp78419 * 13ce8eb11aSdp78419 * When distributing Covered Code, include this CDDL HEADER in each 14ce8eb11aSdp78419 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15ce8eb11aSdp78419 * If applicable, add the following below this CDDL HEADER, with the 16ce8eb11aSdp78419 * fields enclosed by brackets "[]" replaced with your own identifying 17ce8eb11aSdp78419 * information: Portions Copyright [yyyy] [name of copyright owner] 18ce8eb11aSdp78419 * 19ce8eb11aSdp78419 * CDDL HEADER END 20ce8eb11aSdp78419 */ 21ce8eb11aSdp78419 22ce8eb11aSdp78419 /* 23*183ef8a1SHaik Aftandilian * Copyright 2010 Sun Microsystems, Inc. All rights reserved. 24ce8eb11aSdp78419 * Use is subject to license terms. 25ce8eb11aSdp78419 */ 26ce8eb11aSdp78419 27ce8eb11aSdp78419 #ifndef _SYS_MPO_H 28ce8eb11aSdp78419 #define _SYS_MPO_H 29ce8eb11aSdp78419 30ce8eb11aSdp78419 #ifdef __cplusplus 31ce8eb11aSdp78419 extern "C" { 32ce8eb11aSdp78419 #endif 33ce8eb11aSdp78419 34bb57d1f5Sjc25722 #include <sys/lgrp.h> 35bb57d1f5Sjc25722 36ce8eb11aSdp78419 /* 37ce8eb11aSdp78419 * mpo.h - Sun4v MPO common header file 38ce8eb11aSdp78419 * 39ce8eb11aSdp78419 */ 40ce8eb11aSdp78419 41ce8eb11aSdp78419 #define PROP_LG_CPU_ID "id" 42ce8eb11aSdp78419 #define PROP_LG_MASK "address-mask" 43ce8eb11aSdp78419 #define PROP_LG_LATENCY "latency" 44ce8eb11aSdp78419 #define PROP_LG_MATCH "address-match" 45ce8eb11aSdp78419 #define PROP_LG_MEM_LG "memory-latency-group" 46ce8eb11aSdp78419 #define PROP_LG_CPU "cpu" 47ce8eb11aSdp78419 #define PROP_LG_MBLOCK "mblock" 48ce8eb11aSdp78419 #define PROP_LG_BASE "base" 49ce8eb11aSdp78419 #define PROP_LG_SIZE "size" 50ce8eb11aSdp78419 #define PROP_LG_RA_PA_OFFSET "address-congruence-offset" 51ce8eb11aSdp78419 52ce8eb11aSdp78419 /* Macro to set the correspending bit if an mem-lg homeid is a member */ 53ce8eb11aSdp78419 #define HOMESET_ADD(homeset, home)\ 54ce8eb11aSdp78419 homeset |= ((int)1 << (home)) 55ce8eb11aSdp78419 56ce8eb11aSdp78419 /* Macro to check if an mem_lg homeid is a member of the homeset */ 57ce8eb11aSdp78419 #define MEM_LG_ISMEMBER(homeset, home)\ 58ce8eb11aSdp78419 ((homeset) & ((uint64_t)1 << (home))) 59ce8eb11aSdp78419 60ce8eb11aSdp78419 /* Structure to store CPU information from the MD */ 61ce8eb11aSdp78419 62ce8eb11aSdp78419 struct cpu_md { 63ce8eb11aSdp78419 uint_t home; 64924db11bSjc25722 int lgrp_index; 65ce8eb11aSdp78419 }; 66ce8eb11aSdp78419 67ce8eb11aSdp78419 /* Structure to store mem-lg information from the MD */ 68ce8eb11aSdp78419 69ce8eb11aSdp78419 struct lgrp_md { 70ce8eb11aSdp78419 uint64_t id; 71ce8eb11aSdp78419 uint64_t addr_mask; 72ce8eb11aSdp78419 uint64_t addr_match; 73ce8eb11aSdp78419 uint64_t latency; 74ce8eb11aSdp78419 mde_cookie_t node; 75ce8eb11aSdp78419 int ncpu; 76ce8eb11aSdp78419 }; 77ce8eb11aSdp78419 78ce8eb11aSdp78419 /* Structure to store mblock information retrieved from the MD */ 79ce8eb11aSdp78419 809853d9e8SJason Beloro typedef struct mblock_md { 81ce8eb11aSdp78419 uint64_t base; 82ce8eb11aSdp78419 uint64_t size; 83ce8eb11aSdp78419 uint64_t ra_to_pa; 84ce8eb11aSdp78419 pfn_t base_pfn; 85ce8eb11aSdp78419 pfn_t end_pfn; 869853d9e8SJason Beloro } mblock_md_t; 87ce8eb11aSdp78419 88ce8eb11aSdp78419 /* Structure for memnode information for use by plat_pfn_to_mem_node */ 89ce8eb11aSdp78419 90ce8eb11aSdp78419 struct mnode_info { 91ce8eb11aSdp78419 pfn_t base_pfn; 92ce8eb11aSdp78419 pfn_t end_pfn; 93ce8eb11aSdp78419 }; 94ce8eb11aSdp78419 95ce8eb11aSdp78419 /* A stripe defines the portion of a mem_node that falls in one mblock */ 96ce8eb11aSdp78419 typedef struct { 97ce8eb11aSdp78419 pfn_t physbase; /* first page in mnode in the corresponding mblock */ 98ce8eb11aSdp78419 pfn_t physmax; /* last valid page in mnode in mblock */ 99ce8eb11aSdp78419 pfn_t offset; /* stripe starts at physbase - offset */ 100ce8eb11aSdp78419 int exists; /* set to 1 if mblock has memory in this mnode stripe */ 101ce8eb11aSdp78419 } mem_stripe_t; 102ce8eb11aSdp78419 1039853d9e8SJason Beloro /* Configuration including allocation state of mblocks and stripes */ 1049853d9e8SJason Beloro 1059853d9e8SJason Beloro typedef struct { 1069853d9e8SJason Beloro mblock_md_t *mc_mblocks; /* mblock array */ 1079853d9e8SJason Beloro int mc_nmblocks; /* number in array */ 1089853d9e8SJason Beloro mem_stripe_t *mc_stripes; /* stripe array */ 1099853d9e8SJason Beloro int mc_nstripes; /* number in array */ 1109853d9e8SJason Beloro int mc_alloc_sz; /* size in bytes of mc_mblocks if */ 1119853d9e8SJason Beloro /* it was kmem_alloc'd, else 0 */ 1129853d9e8SJason Beloro } mpo_config_t; 1139853d9e8SJason Beloro 114bb57d1f5Sjc25722 /* These are used when MPO requires preallocated kvseg32 space */ 115bb57d1f5Sjc25722 extern caddr_t mpo_heap32_buf; 116bb57d1f5Sjc25722 extern size_t mpo_heap32_bufsz; 117*183ef8a1SHaik Aftandilian extern void mpo_cpu_add(md_t *md, int cpuid); 118924db11bSjc25722 extern void mpo_cpu_remove(int cpuid); 119ce8eb11aSdp78419 120ce8eb11aSdp78419 #ifdef __cplusplus 121ce8eb11aSdp78419 } 122ce8eb11aSdp78419 #endif 123ce8eb11aSdp78419 124ce8eb11aSdp78419 #endif /* _SYS_MPO_H */ 125