17c478bd9Sstevel@tonic-gate /* 27c478bd9Sstevel@tonic-gate * CDDL HEADER START 37c478bd9Sstevel@tonic-gate * 47c478bd9Sstevel@tonic-gate * 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. 77c478bd9Sstevel@tonic-gate * 87c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 97c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 107c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 117c478bd9Sstevel@tonic-gate * and limitations under the License. 127c478bd9Sstevel@tonic-gate * 137c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 147c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 157c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 167c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 177c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 187c478bd9Sstevel@tonic-gate * 197c478bd9Sstevel@tonic-gate * CDDL HEADER END 207c478bd9Sstevel@tonic-gate */ 217c478bd9Sstevel@tonic-gate /* 229853d9e8SJason Beloro * Copyright 2009 Sun Microsystems, Inc. All rights reserved. 237c478bd9Sstevel@tonic-gate * Use is subject to license terms. 247c478bd9Sstevel@tonic-gate */ 257c478bd9Sstevel@tonic-gate 267c478bd9Sstevel@tonic-gate #ifndef _SYS_MEMNODE_H 277c478bd9Sstevel@tonic-gate #define _SYS_MEMNODE_H 287c478bd9Sstevel@tonic-gate 297c478bd9Sstevel@tonic-gate #ifdef __cplusplus 307c478bd9Sstevel@tonic-gate extern "C" { 317c478bd9Sstevel@tonic-gate #endif 327c478bd9Sstevel@tonic-gate 337c478bd9Sstevel@tonic-gate #ifdef _KERNEL 347c478bd9Sstevel@tonic-gate 357c478bd9Sstevel@tonic-gate #include <sys/lgrp.h> 367c478bd9Sstevel@tonic-gate 377c478bd9Sstevel@tonic-gate 387c478bd9Sstevel@tonic-gate /* 397c478bd9Sstevel@tonic-gate * This file defines the mappings between physical addresses and memory 407c478bd9Sstevel@tonic-gate * nodes. Memory nodes are defined so that the low-order bits are the 417c478bd9Sstevel@tonic-gate * memory slice ID and the high-order bits are the SSM nodeid. 427c478bd9Sstevel@tonic-gate */ 437c478bd9Sstevel@tonic-gate 44*a3114836SGerry Liu #define MAX_MEM_NODES_PER_LGROUP 3 457c478bd9Sstevel@tonic-gate #ifndef MAX_MEM_NODES 46*a3114836SGerry Liu #define MAX_MEM_NODES (8 * MAX_MEM_NODES_PER_LGROUP) 477c478bd9Sstevel@tonic-gate #endif /* MAX_MEM_NODES */ 487c478bd9Sstevel@tonic-gate 497c478bd9Sstevel@tonic-gate #define PFN_2_MEM_NODE(pfn) \ 507c478bd9Sstevel@tonic-gate ((max_mem_nodes > 1) ? plat_pfn_to_mem_node(pfn) : 0) 517c478bd9Sstevel@tonic-gate 527c478bd9Sstevel@tonic-gate #define MEM_NODE_2_LGRPHAND(mnode) \ 537c478bd9Sstevel@tonic-gate ((max_mem_nodes > 1) ? plat_mem_node_to_lgrphand(mnode) : \ 547c478bd9Sstevel@tonic-gate LGRP_DEFAULT_HANDLE) 557c478bd9Sstevel@tonic-gate 567c478bd9Sstevel@tonic-gate /* 577c478bd9Sstevel@tonic-gate * Platmod hooks 587c478bd9Sstevel@tonic-gate */ 597c478bd9Sstevel@tonic-gate 607c478bd9Sstevel@tonic-gate extern int plat_pfn_to_mem_node(pfn_t); 617c478bd9Sstevel@tonic-gate extern void plat_assign_lgrphand_to_mem_node(lgrp_handle_t, int); 627c478bd9Sstevel@tonic-gate extern lgrp_handle_t plat_mem_node_to_lgrphand(int); 637c478bd9Sstevel@tonic-gate extern void plat_slice_add(pfn_t, pfn_t); 647c478bd9Sstevel@tonic-gate extern void plat_slice_del(pfn_t, pfn_t); 657c478bd9Sstevel@tonic-gate 667c478bd9Sstevel@tonic-gate #pragma weak plat_pfn_to_mem_node 677c478bd9Sstevel@tonic-gate #pragma weak plat_mem_node_to_lgrphand 687c478bd9Sstevel@tonic-gate #pragma weak plat_slice_add 697c478bd9Sstevel@tonic-gate #pragma weak plat_slice_del 707c478bd9Sstevel@tonic-gate 717c478bd9Sstevel@tonic-gate struct mem_node_conf { 727c478bd9Sstevel@tonic-gate int exists; /* only try if set, list may still be empty */ 737c478bd9Sstevel@tonic-gate pfn_t physbase; /* lowest PFN in this memnode */ 747c478bd9Sstevel@tonic-gate pfn_t physmax; /* highest PFN in this memnode */ 757c478bd9Sstevel@tonic-gate }; 767c478bd9Sstevel@tonic-gate 777c478bd9Sstevel@tonic-gate struct memlist; 787c478bd9Sstevel@tonic-gate 797c478bd9Sstevel@tonic-gate extern void startup_build_mem_nodes(struct memlist *); 807c478bd9Sstevel@tonic-gate extern void mem_node_add_slice(pfn_t, pfn_t); 819853d9e8SJason Beloro extern void mem_node_del_slice(pfn_t, pfn_t); 827c478bd9Sstevel@tonic-gate extern int mem_node_alloc(void); 837c478bd9Sstevel@tonic-gate extern pgcnt_t mem_node_memlist_pages(int, struct memlist *); 849853d9e8SJason Beloro extern void mem_node_add_range(pfn_t, pfn_t); 859853d9e8SJason Beloro extern void mem_node_del_range(pfn_t, pfn_t); 867c478bd9Sstevel@tonic-gate 87472714d6Skchow extern int plat_mnode_xcheck(pfn_t); 88472714d6Skchow 897c478bd9Sstevel@tonic-gate extern struct mem_node_conf mem_node_config[]; 907c478bd9Sstevel@tonic-gate extern uint64_t mem_node_physalign; 917c478bd9Sstevel@tonic-gate extern int mem_node_pfn_shift; 927c478bd9Sstevel@tonic-gate extern int max_mem_nodes; 937c478bd9Sstevel@tonic-gate 947c478bd9Sstevel@tonic-gate extern uint_t lgrp_plat_node_cnt; 957c478bd9Sstevel@tonic-gate 967c478bd9Sstevel@tonic-gate #endif /* _KERNEL */ 977c478bd9Sstevel@tonic-gate 987c478bd9Sstevel@tonic-gate #ifdef __cplusplus 997c478bd9Sstevel@tonic-gate } 1007c478bd9Sstevel@tonic-gate #endif 1017c478bd9Sstevel@tonic-gate 1027c478bd9Sstevel@tonic-gate #endif /* _SYS_MEMNODE_H */ 103