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 /* 22*472714d6Skchow * Copyright 2008 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 #pragma ident "%Z%%M% %I% %E% SMI" 307c478bd9Sstevel@tonic-gate 317c478bd9Sstevel@tonic-gate #ifdef __cplusplus 327c478bd9Sstevel@tonic-gate extern "C" { 337c478bd9Sstevel@tonic-gate #endif 347c478bd9Sstevel@tonic-gate 357c478bd9Sstevel@tonic-gate #ifdef _KERNEL 367c478bd9Sstevel@tonic-gate 377c478bd9Sstevel@tonic-gate #include <sys/lgrp.h> 387c478bd9Sstevel@tonic-gate 397c478bd9Sstevel@tonic-gate 407c478bd9Sstevel@tonic-gate /* 417c478bd9Sstevel@tonic-gate * This file defines the mappings between physical addresses and memory 427c478bd9Sstevel@tonic-gate * nodes. Memory nodes are defined so that the low-order bits are the 437c478bd9Sstevel@tonic-gate * memory slice ID and the high-order bits are the SSM nodeid. 447c478bd9Sstevel@tonic-gate */ 457c478bd9Sstevel@tonic-gate 467c478bd9Sstevel@tonic-gate #ifndef MAX_MEM_NODES 477c478bd9Sstevel@tonic-gate #define MAX_MEM_NODES (8) 487c478bd9Sstevel@tonic-gate #endif /* MAX_MEM_NODES */ 497c478bd9Sstevel@tonic-gate 507c478bd9Sstevel@tonic-gate #define PFN_2_MEM_NODE(pfn) \ 517c478bd9Sstevel@tonic-gate ((max_mem_nodes > 1) ? plat_pfn_to_mem_node(pfn) : 0) 527c478bd9Sstevel@tonic-gate 537c478bd9Sstevel@tonic-gate #define MEM_NODE_2_LGRPHAND(mnode) \ 547c478bd9Sstevel@tonic-gate ((max_mem_nodes > 1) ? plat_mem_node_to_lgrphand(mnode) : \ 557c478bd9Sstevel@tonic-gate LGRP_DEFAULT_HANDLE) 567c478bd9Sstevel@tonic-gate 577c478bd9Sstevel@tonic-gate /* 587c478bd9Sstevel@tonic-gate * Platmod hooks 597c478bd9Sstevel@tonic-gate */ 607c478bd9Sstevel@tonic-gate 617c478bd9Sstevel@tonic-gate extern int plat_pfn_to_mem_node(pfn_t); 627c478bd9Sstevel@tonic-gate extern int plat_lgrphand_to_mem_node(lgrp_handle_t); 637c478bd9Sstevel@tonic-gate extern void plat_assign_lgrphand_to_mem_node(lgrp_handle_t, int); 647c478bd9Sstevel@tonic-gate extern lgrp_handle_t plat_mem_node_to_lgrphand(int); 657c478bd9Sstevel@tonic-gate extern void plat_slice_add(pfn_t, pfn_t); 667c478bd9Sstevel@tonic-gate extern void plat_slice_del(pfn_t, pfn_t); 677c478bd9Sstevel@tonic-gate 687c478bd9Sstevel@tonic-gate #pragma weak plat_pfn_to_mem_node 697c478bd9Sstevel@tonic-gate #pragma weak plat_lgrphand_to_mem_node 707c478bd9Sstevel@tonic-gate #pragma weak plat_mem_node_to_lgrphand 717c478bd9Sstevel@tonic-gate #pragma weak plat_slice_add 727c478bd9Sstevel@tonic-gate #pragma weak plat_slice_del 737c478bd9Sstevel@tonic-gate 747c478bd9Sstevel@tonic-gate struct mem_node_conf { 757c478bd9Sstevel@tonic-gate int exists; /* only try if set, list may still be empty */ 767c478bd9Sstevel@tonic-gate pfn_t physbase; /* lowest PFN in this memnode */ 777c478bd9Sstevel@tonic-gate pfn_t physmax; /* highest PFN in this memnode */ 787c478bd9Sstevel@tonic-gate }; 797c478bd9Sstevel@tonic-gate 807c478bd9Sstevel@tonic-gate struct memlist; 817c478bd9Sstevel@tonic-gate 827c478bd9Sstevel@tonic-gate extern void startup_build_mem_nodes(struct memlist *); 837c478bd9Sstevel@tonic-gate extern void mem_node_add_slice(pfn_t, pfn_t); 847c478bd9Sstevel@tonic-gate extern void mem_node_pre_del_slice(pfn_t, pfn_t); 857c478bd9Sstevel@tonic-gate extern void mem_node_post_del_slice(pfn_t, pfn_t, int); 867c478bd9Sstevel@tonic-gate extern int mem_node_alloc(void); 877c478bd9Sstevel@tonic-gate extern pgcnt_t mem_node_memlist_pages(int, struct memlist *); 887c478bd9Sstevel@tonic-gate 89*472714d6Skchow extern int plat_mnode_xcheck(pfn_t); 90*472714d6Skchow 917c478bd9Sstevel@tonic-gate extern struct mem_node_conf mem_node_config[]; 927c478bd9Sstevel@tonic-gate extern uint64_t mem_node_physalign; 937c478bd9Sstevel@tonic-gate extern int mem_node_pfn_shift; 947c478bd9Sstevel@tonic-gate extern int max_mem_nodes; 957c478bd9Sstevel@tonic-gate 967c478bd9Sstevel@tonic-gate extern uint_t lgrp_plat_node_cnt; 977c478bd9Sstevel@tonic-gate 987c478bd9Sstevel@tonic-gate #endif /* _KERNEL */ 997c478bd9Sstevel@tonic-gate 1007c478bd9Sstevel@tonic-gate #ifdef __cplusplus 1017c478bd9Sstevel@tonic-gate } 1027c478bd9Sstevel@tonic-gate #endif 1037c478bd9Sstevel@tonic-gate 1047c478bd9Sstevel@tonic-gate #endif /* _SYS_MEMNODE_H */ 105