aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-ppc64/iSeries/HvLpConfig.h
blob: bdbd70f42c9dfbce3781404def899e743cc15ec1 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
/*
 * HvLpConfig.h
 * Copyright (C) 2001  Mike Corrigan IBM Corporation
 * 
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 */
#ifndef _HVLPCONFIG_H
#define _HVLPCONFIG_H

//===========================================================================
//
//      This file contains the interface to the LPAR configuration data
//  to determine which resources should be allocated to each partition.
//
//===========================================================================

#include <asm/iSeries/HvCallCfg.h>
#include <asm/iSeries/HvTypes.h>
#include <asm/iSeries/ItLpNaca.h>
#include <asm/iSeries/LparData.h>

//-------------------------------------------------------------------
// Constants
//-------------------------------------------------------------------

extern HvLpIndex HvLpConfig_getLpIndex_outline(void);

//===================================================================
static inline HvLpIndex	HvLpConfig_getLpIndex(void)
{
	return itLpNaca.xLpIndex;
}
//===================================================================
static inline HvLpIndex	HvLpConfig_getPrimaryLpIndex(void)
{
	return itLpNaca.xPrimaryLpIndex;
}
//=================================================================
static inline HvLpIndex	HvLpConfig_getLps(void)
{
	return HvCallCfg_getLps();
}
//=================================================================
static inline HvLpIndexMap	HvLpConfig_getActiveLpMap(void)
{
	return HvCallCfg_getActiveLpMap();
}
//=================================================================
static inline u64		HvLpConfig_getSystemMsMegs(void)
{
	return HvCallCfg_getSystemMsChunks() / HVCHUNKSPERMEG;
}
//=================================================================
static inline u64		HvLpConfig_getSystemMsChunks(void)
{
	return HvCallCfg_getSystemMsChunks();
}
//=================================================================
static inline u64		HvLpConfig_getSystemMsPages(void)
{
	return HvCallCfg_getSystemMsChunks() * HVPAGESPERCHUNK;
}
//================================================================
static inline u64		HvLpConfig_getMsMegs(void)
{
	return HvCallCfg_getMsChunks(HvLpConfig_getLpIndex(),HvCallCfg_Cur) / HVCHUNKSPERMEG;
}
//================================================================
static inline u64		HvLpConfig_getMsChunks(void)
{
	return HvCallCfg_getMsChunks(HvLpConfig_getLpIndex(),HvCallCfg_Cur);
}
//================================================================
static inline u64		HvLpConfig_getMsPages(void)
{
	return HvCallCfg_getMsChunks(HvLpConfig_getLpIndex(),HvCallCfg_Cur) * HVPAGESPERCHUNK;
}
//================================================================
static inline u64		HvLpConfig_getMinMsMegs(void)
{
	return HvCallCfg_getMsChunks(HvLpConfig_getLpIndex(),HvCallCfg_Min) / HVCHUNKSPERMEG;
}
//================================================================
static inline u64		HvLpConfig_getMinMsChunks(void)
{
	return HvCallCfg_getMsChunks(HvLpConfig_getLpIndex(),HvCallCfg_Min);
}
//================================================================
static inline u64		HvLpConfig_getMinMsPages(void)
{
	return HvCallCfg_getMsChunks(HvLpConfig_getLpIndex(),HvCallCfg_Min) * HVPAGESPERCHUNK;
}
//================================================================
static inline u64		HvLpConfig_getMinRuntimeMsMegs(void)
{
	return HvCallCfg_getMinRuntimeMsChunks(HvLpConfig_getLpIndex()) / HVCHUNKSPERMEG;
}
//===============================================================
static inline u64		HvLpConfig_getMinRuntimeMsChunks(void)
{
	return HvCallCfg_getMinRuntimeMsChunks(HvLpConfig_getLpIndex());
}
//===============================================================
static inline u64		HvLpConfig_getMinRuntimeMsPages(void)
{
	return HvCallCfg_getMinRuntimeMsChunks(HvLpConfig_getLpIndex()) * HVPAGESPERCHUNK;
}
//===============================================================
static inline u64		HvLpConfig_getMaxMsMegs(void)
{
	return HvCallCfg_getMsChunks(HvLpConfig_getLpIndex(),HvCallCfg_Max) / HVCHUNKSPERMEG;
}
//===============================================================
static inline u64		HvLpConfig_getMaxMsChunks(void)
{
	return HvCallCfg_getMsChunks(HvLpConfig_getLpIndex(),HvCallCfg_Max);
}
//===============================================================
static inline u64		HvLpConfig_getMaxMsPages(void)
{
	return HvCallCfg_getMsChunks(HvLpConfig_getLpIndex(),HvCallCfg_Max) * HVPAGESPERCHUNK;
}
//===============================================================
static inline u64		HvLpConfig_getInitMsMegs(void)
{
	return HvCallCfg_getMsChunks(HvLpConfig_getLpIndex(),HvCallCfg_Init) / HVCHUNKSPERMEG;
}
//===============================================================
static inline u64		HvLpConfig_getInitMsChunks(void)
{
	return HvCallCfg_getMsChunks(HvLpConfig_getLpIndex(),HvCallCfg_Init);
}
//===============================================================
static inline u64		HvLpConfig_getInitMsPages(void)
{    return HvCallCfg_getMsChunks(HvLpConfig_getLpIndex(),HvCallCfg_Init) * HVPAGESPERCHUNK;
}
//===============================================================
static inline u64		HvLpConfig_getSystemPhysicalProcessors(void)
{
	return HvCallCfg_getSystemPhysicalProcessors();
}
//===============================================================
static inline u64		HvLpConfig_getSystemLogicalProcessors(void)
{
	return HvCallCfg_getSystemPhysicalProcessors() * (/*getPaca()->getSecondaryThreadCount() +*/ 1);
}
//===============================================================
static inline u64		HvLpConfig_getNumProcsInSharedPool(HvLpSharedPoolIndex sPI)
{
	return HvCallCfg_getNumProcsInSharedPool(sPI);
}
//===============================================================
static inline u64		HvLpConfig_getPhysicalProcessors(void)
{
	return HvCallCfg_getPhysicalProcessors(HvLpConfig_getLpIndex(),HvCallCfg_Cur);
}
//===============================================================
static inline u64		HvLpConfig_getLogicalProcessors(void)
{
	return HvCallCfg_getPhysicalProcessors(HvLpConfig_getLpIndex(),HvCallCfg_Cur) * (/*getPaca()->getSecondaryThreadCount() +*/ 1);
}
//===============================================================
static inline HvLpSharedPoolIndex	HvLpConfig_getSharedPoolIndex(void)
{
	return HvCallCfg_getSharedPoolIndex(HvLpConfig_getLpIndex());
}
//===============================================================
static inline u64		HvLpConfig_getSharedProcUnits(void)
{
	return HvCallCfg_getSharedProcUnits(HvLpConfig_getLpIndex(),HvCallCfg_Cur);
}
//===============================================================
static inline u64		HvLpConfig_getMinSharedProcUnits(void)
{
	return HvCallCfg_getSharedProcUnits(HvLpConfig_getLpIndex(),HvCallCfg_Min);
}
//===============================================================
static inline u64		HvLpConfig_getMaxSharedProcUnits(void)
{
	return HvCallCfg_getSharedProcUnits(HvLpConfig_getLpIndex(),HvCallCfg_Max);
}
//===============================================================
static inline u64		HvLpConfig_getMinPhysicalProcessors(void)
{
	return HvCallCfg_getPhysicalProcessors(HvLpConfig_getLpIndex(),HvCallCfg_Min);
}
//===============================================================
static inline u64		HvLpConfig_getMinLogicalProcessors(void)
{
	return HvCallCfg_getPhysicalProcessors(HvLpConfig_getLpIndex(),HvCallCfg_Min) * (/*getPaca()->getSecondaryThreadCount() +*/ 1);
}
//===============================================================
static inline u64		HvLpConfig_getMaxPhysicalProcessors(void)
{
	return HvCallCfg_getPhysicalProcessors(HvLpConfig_getLpIndex(),HvCallCfg_Max);
}
//===============================================================
static inline u64		HvLpConfig_getMaxLogicalProcessors(void)
{
	return HvCallCfg_getPhysicalProcessors(HvLpConfig_getLpIndex(),HvCallCfg_Max) * (/*getPaca()->getSecondaryThreadCount() +*/ 1);
}
//===============================================================
static inline u64		HvLpConfig_getInitPhysicalProcessors(void)
{
	return HvCallCfg_getPhysicalProcessors(HvLpConfig_getLpIndex(),HvCallCfg_Init);
}
//===============================================================
static inline u64		HvLpConfig_getInitLogicalProcessors(void)
{
	return HvCallCfg_getPhysicalProcessors(HvLpConfig_getLpIndex(),HvCallCfg_Init) * (/*getPaca()->getSecondaryThreadCount() +*/ 1);
}
//================================================================
static inline HvLpVirtualLanIndexMap	HvLpConfig_getVirtualLanIndexMap(void)
{
	return HvCallCfg_getVirtualLanIndexMap(HvLpConfig_getLpIndex_outline());
}
//===============================================================
static inline HvLpVirtualLanIndexMap	HvLpConfig_getVirtualLanIndexMapForLp(HvLpIndex lp)
{
	return HvCallCfg_getVirtualLanIndexMap(lp);
}
//================================================================
static inline HvLpIndex	HvLpConfig_getBusOwner(HvBusNumber busNumber)
{
	return HvCallCfg_getBusOwner(busNumber);
}
//===============================================================
static inline int		HvLpConfig_isBusDedicated(HvBusNumber busNumber)
{
	return HvCallCfg_isBusDedicated(busNumber);
}
//================================================================
static inline HvLpIndexMap	HvLpConfig_getBusAllocation(HvBusNumber busNumber)
{
	return HvCallCfg_getBusAllocation(busNumber);
}
//================================================================
// returns the absolute real address of the load area
static inline u64		HvLpConfig_getLoadAddress(void)
{
	return itLpNaca.xLoadAreaAddr & 0x7fffffffffffffff;
}
//================================================================
static inline u64		HvLpConfig_getLoadPages(void)
{
	return itLpNaca.xLoadAreaChunks * HVPAGESPERCHUNK;
}
//================================================================
static inline int		HvLpConfig_isBusOwnedByThisLp(HvBusNumber busNumber)
{
	HvLpIndex busOwner = HvLpConfig_getBusOwner(busNumber);
	return (busOwner == HvLpConfig_getLpIndex());
}
//================================================================
static inline int         HvLpConfig_doLpsCommunicateOnVirtualLan(HvLpIndex lp1, HvLpIndex lp2)
{
	HvLpVirtualLanIndexMap virtualLanIndexMap1 = HvCallCfg_getVirtualLanIndexMap( lp1 );
	HvLpVirtualLanIndexMap virtualLanIndexMap2 = HvCallCfg_getVirtualLanIndexMap( lp2 );
	return ((virtualLanIndexMap1 & virtualLanIndexMap2) != 0);
}
//================================================================
static inline HvLpIndex		HvLpConfig_getHostingLpIndex(HvLpIndex lp)
{
	return HvCallCfg_getHostingLpIndex(lp);
}
//================================================================

#endif /* _HVLPCONFIG_H */