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