4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
22 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
26 #ifndef _SYS_MEMNODE_H
27 #define _SYS_MEMNODE_H
39 * This file defines the mappings between physical addresses and memory
40 * nodes. Memory nodes are defined so that the low-order bits are the
41 * memory slice ID and the high-order bits are the SSM nodeid.
44 #define MAX_MEM_NODES_PER_LGROUP 3
46 #define MAX_MEM_NODES (8 * MAX_MEM_NODES_PER_LGROUP)
47 #endif /* MAX_MEM_NODES */
49 #define PFN_2_MEM_NODE(pfn) \
50 ((max_mem_nodes > 1) ? plat_pfn_to_mem_node(pfn) : 0)
52 #define MEM_NODE_2_LGRPHAND(mnode) \
53 ((max_mem_nodes > 1) ? plat_mem_node_to_lgrphand(mnode) : \
60 extern int plat_pfn_to_mem_node(pfn_t
);
61 extern void plat_assign_lgrphand_to_mem_node(lgrp_handle_t
, int);
62 extern lgrp_handle_t
plat_mem_node_to_lgrphand(int);
63 extern void plat_slice_add(pfn_t
, pfn_t
);
64 extern void plat_slice_del(pfn_t
, pfn_t
);
66 #pragma weak plat_pfn_to_mem_node
67 #pragma weak plat_mem_node_to_lgrphand
68 #pragma weak plat_slice_add
69 #pragma weak plat_slice_del
71 struct mem_node_conf
{
72 int exists
; /* only try if set, list may still be empty */
73 pfn_t physbase
; /* lowest PFN in this memnode */
74 pfn_t physmax
; /* highest PFN in this memnode */
79 extern void startup_build_mem_nodes(struct memlist
*);
80 extern void mem_node_add_slice(pfn_t
, pfn_t
);
81 extern void mem_node_del_slice(pfn_t
, pfn_t
);
82 extern int mem_node_alloc(void);
83 extern pgcnt_t
mem_node_memlist_pages(int, struct memlist
*);
84 extern void mem_node_add_range(pfn_t
, pfn_t
);
85 extern void mem_node_del_range(pfn_t
, pfn_t
);
87 extern int plat_mnode_xcheck(pfn_t
);
89 extern struct mem_node_conf mem_node_config
[];
90 extern uint64_t mem_node_physalign
;
91 extern int mem_node_pfn_shift
;
92 extern int max_mem_nodes
;
94 extern uint_t lgrp_plat_node_cnt
;
102 #endif /* _SYS_MEMNODE_H */