]> bbs.cooldavid.org Git - net-next-2.6.git/blame - include/asm-ppc64/iSeries/HvLpConfig.h
[PATCH] ppc64 iSeries: header file white space cleanups
[net-next-2.6.git] / include / asm-ppc64 / iSeries / HvLpConfig.h
CommitLineData
1da177e4
LT
1/*
2 * HvLpConfig.h
3 * Copyright (C) 2001 Mike Corrigan IBM Corporation
45dc76aa 4 *
1da177e4
LT
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
45dc76aa 9 *
1da177e4
LT
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
45dc76aa 14 *
1da177e4
LT
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */
19#ifndef _HVLPCONFIG_H
20#define _HVLPCONFIG_H
21
45dc76aa
SR
22/*
23 * This file contains the interface to the LPAR configuration data
24 * to determine which resources should be allocated to each partition.
25 */
1da177e4
LT
26
27#include <asm/iSeries/HvCallCfg.h>
28#include <asm/iSeries/HvTypes.h>
29#include <asm/iSeries/ItLpNaca.h>
30#include <asm/iSeries/LparData.h>
31
1da177e4
LT
32extern HvLpIndex HvLpConfig_getLpIndex_outline(void);
33
1da177e4
LT
34static inline HvLpIndex HvLpConfig_getLpIndex(void)
35{
36 return itLpNaca.xLpIndex;
37}
45dc76aa 38
1da177e4
LT
39static inline HvLpIndex HvLpConfig_getPrimaryLpIndex(void)
40{
41 return itLpNaca.xPrimaryLpIndex;
42}
45dc76aa 43
1da177e4
LT
44static inline HvLpIndex HvLpConfig_getLps(void)
45{
46 return HvCallCfg_getLps();
47}
45dc76aa
SR
48
49static inline HvLpIndexMap HvLpConfig_getActiveLpMap(void)
1da177e4
LT
50{
51 return HvCallCfg_getActiveLpMap();
52}
45dc76aa
SR
53
54static inline u64 HvLpConfig_getSystemMsMegs(void)
1da177e4
LT
55{
56 return HvCallCfg_getSystemMsChunks() / HVCHUNKSPERMEG;
57}
45dc76aa
SR
58
59static inline u64 HvLpConfig_getSystemMsChunks(void)
1da177e4
LT
60{
61 return HvCallCfg_getSystemMsChunks();
62}
45dc76aa
SR
63
64static inline u64 HvLpConfig_getSystemMsPages(void)
1da177e4
LT
65{
66 return HvCallCfg_getSystemMsChunks() * HVPAGESPERCHUNK;
67}
45dc76aa
SR
68
69static inline u64 HvLpConfig_getMsMegs(void)
1da177e4 70{
45dc76aa
SR
71 return HvCallCfg_getMsChunks(HvLpConfig_getLpIndex(), HvCallCfg_Cur)
72 / HVCHUNKSPERMEG;
1da177e4 73}
45dc76aa
SR
74
75static inline u64 HvLpConfig_getMsChunks(void)
1da177e4 76{
45dc76aa 77 return HvCallCfg_getMsChunks(HvLpConfig_getLpIndex(), HvCallCfg_Cur);
1da177e4 78}
45dc76aa
SR
79
80static inline u64 HvLpConfig_getMsPages(void)
1da177e4 81{
45dc76aa
SR
82 return HvCallCfg_getMsChunks(HvLpConfig_getLpIndex(), HvCallCfg_Cur)
83 * HVPAGESPERCHUNK;
1da177e4 84}
45dc76aa
SR
85
86static inline u64 HvLpConfig_getMinMsMegs(void)
1da177e4 87{
45dc76aa
SR
88 return HvCallCfg_getMsChunks(HvLpConfig_getLpIndex(), HvCallCfg_Min)
89 / HVCHUNKSPERMEG;
1da177e4 90}
45dc76aa
SR
91
92static inline u64 HvLpConfig_getMinMsChunks(void)
1da177e4 93{
45dc76aa 94 return HvCallCfg_getMsChunks(HvLpConfig_getLpIndex(), HvCallCfg_Min);
1da177e4 95}
45dc76aa
SR
96
97static inline u64 HvLpConfig_getMinMsPages(void)
1da177e4 98{
45dc76aa
SR
99 return HvCallCfg_getMsChunks(HvLpConfig_getLpIndex(), HvCallCfg_Min)
100 * HVPAGESPERCHUNK;
1da177e4 101}
45dc76aa
SR
102
103static inline u64 HvLpConfig_getMinRuntimeMsMegs(void)
1da177e4 104{
45dc76aa
SR
105 return HvCallCfg_getMinRuntimeMsChunks(HvLpConfig_getLpIndex())
106 / HVCHUNKSPERMEG;
1da177e4 107}
45dc76aa
SR
108
109static inline u64 HvLpConfig_getMinRuntimeMsChunks(void)
1da177e4
LT
110{
111 return HvCallCfg_getMinRuntimeMsChunks(HvLpConfig_getLpIndex());
112}
45dc76aa
SR
113
114static inline u64 HvLpConfig_getMinRuntimeMsPages(void)
1da177e4 115{
45dc76aa
SR
116 return HvCallCfg_getMinRuntimeMsChunks(HvLpConfig_getLpIndex())
117 * HVPAGESPERCHUNK;
1da177e4 118}
45dc76aa
SR
119
120static inline u64 HvLpConfig_getMaxMsMegs(void)
1da177e4 121{
45dc76aa
SR
122 return HvCallCfg_getMsChunks(HvLpConfig_getLpIndex(), HvCallCfg_Max)
123 / HVCHUNKSPERMEG;
1da177e4 124}
45dc76aa
SR
125
126static inline u64 HvLpConfig_getMaxMsChunks(void)
1da177e4 127{
45dc76aa 128 return HvCallCfg_getMsChunks(HvLpConfig_getLpIndex(), HvCallCfg_Max);
1da177e4 129}
45dc76aa
SR
130
131static inline u64 HvLpConfig_getMaxMsPages(void)
1da177e4 132{
45dc76aa
SR
133 return HvCallCfg_getMsChunks(HvLpConfig_getLpIndex(), HvCallCfg_Max)
134 * HVPAGESPERCHUNK;
1da177e4 135}
45dc76aa
SR
136
137static inline u64 HvLpConfig_getInitMsMegs(void)
1da177e4 138{
45dc76aa
SR
139 return HvCallCfg_getMsChunks(HvLpConfig_getLpIndex(), HvCallCfg_Init)
140 / HVCHUNKSPERMEG;
1da177e4 141}
45dc76aa
SR
142
143static inline u64 HvLpConfig_getInitMsChunks(void)
1da177e4 144{
45dc76aa 145 return HvCallCfg_getMsChunks(HvLpConfig_getLpIndex(), HvCallCfg_Init);
1da177e4 146}
45dc76aa
SR
147
148static inline u64 HvLpConfig_getInitMsPages(void)
149{
150 return HvCallCfg_getMsChunks(HvLpConfig_getLpIndex(), HvCallCfg_Init)
151 * HVPAGESPERCHUNK;
1da177e4 152}
45dc76aa
SR
153
154static inline u64 HvLpConfig_getSystemPhysicalProcessors(void)
1da177e4
LT
155{
156 return HvCallCfg_getSystemPhysicalProcessors();
157}
45dc76aa
SR
158
159static inline u64 HvLpConfig_getSystemLogicalProcessors(void)
1da177e4 160{
45dc76aa
SR
161 return HvCallCfg_getSystemPhysicalProcessors()
162 * (/*getPaca()->getSecondaryThreadCount() +*/ 1);
1da177e4 163}
45dc76aa
SR
164
165static inline u64 HvLpConfig_getNumProcsInSharedPool(HvLpSharedPoolIndex sPI)
1da177e4
LT
166{
167 return HvCallCfg_getNumProcsInSharedPool(sPI);
168}
45dc76aa
SR
169
170static inline u64 HvLpConfig_getPhysicalProcessors(void)
1da177e4 171{
45dc76aa
SR
172 return HvCallCfg_getPhysicalProcessors(HvLpConfig_getLpIndex(),
173 HvCallCfg_Cur);
1da177e4 174}
45dc76aa
SR
175
176static inline u64 HvLpConfig_getLogicalProcessors(void)
1da177e4 177{
45dc76aa
SR
178 return HvCallCfg_getPhysicalProcessors(HvLpConfig_getLpIndex(),
179 HvCallCfg_Cur)
180 * (/*getPaca()->getSecondaryThreadCount() +*/ 1);
1da177e4 181}
45dc76aa
SR
182
183static inline HvLpSharedPoolIndex HvLpConfig_getSharedPoolIndex(void)
1da177e4
LT
184{
185 return HvCallCfg_getSharedPoolIndex(HvLpConfig_getLpIndex());
186}
45dc76aa
SR
187
188static inline u64 HvLpConfig_getSharedProcUnits(void)
1da177e4 189{
45dc76aa
SR
190 return HvCallCfg_getSharedProcUnits(HvLpConfig_getLpIndex(),
191 HvCallCfg_Cur);
1da177e4 192}
45dc76aa
SR
193
194static inline u64 HvLpConfig_getMinSharedProcUnits(void)
1da177e4 195{
45dc76aa
SR
196 return HvCallCfg_getSharedProcUnits(HvLpConfig_getLpIndex(),
197 HvCallCfg_Min);
1da177e4 198}
45dc76aa
SR
199
200static inline u64 HvLpConfig_getMaxSharedProcUnits(void)
1da177e4 201{
45dc76aa
SR
202 return HvCallCfg_getSharedProcUnits(HvLpConfig_getLpIndex(),
203 HvCallCfg_Max);
1da177e4 204}
45dc76aa
SR
205
206static inline u64 HvLpConfig_getMinPhysicalProcessors(void)
1da177e4 207{
45dc76aa
SR
208 return HvCallCfg_getPhysicalProcessors(HvLpConfig_getLpIndex(),
209 HvCallCfg_Min);
1da177e4 210}
45dc76aa
SR
211
212static inline u64 HvLpConfig_getMinLogicalProcessors(void)
1da177e4 213{
45dc76aa
SR
214 return HvCallCfg_getPhysicalProcessors(HvLpConfig_getLpIndex(),
215 HvCallCfg_Min)
216 * (/*getPaca()->getSecondaryThreadCount() +*/ 1);
1da177e4 217}
45dc76aa
SR
218
219static inline u64 HvLpConfig_getMaxPhysicalProcessors(void)
1da177e4 220{
45dc76aa
SR
221 return HvCallCfg_getPhysicalProcessors(HvLpConfig_getLpIndex(),
222 HvCallCfg_Max);
1da177e4 223}
45dc76aa
SR
224
225static inline u64 HvLpConfig_getMaxLogicalProcessors(void)
1da177e4 226{
45dc76aa
SR
227 return HvCallCfg_getPhysicalProcessors(HvLpConfig_getLpIndex(),
228 HvCallCfg_Max)
229 * (/*getPaca()->getSecondaryThreadCount() +*/ 1);
1da177e4 230}
45dc76aa
SR
231
232static inline u64 HvLpConfig_getInitPhysicalProcessors(void)
1da177e4 233{
45dc76aa
SR
234 return HvCallCfg_getPhysicalProcessors(HvLpConfig_getLpIndex(),
235 HvCallCfg_Init);
1da177e4 236}
45dc76aa
SR
237
238static inline u64 HvLpConfig_getInitLogicalProcessors(void)
1da177e4 239{
45dc76aa
SR
240 return HvCallCfg_getPhysicalProcessors(HvLpConfig_getLpIndex(),
241 HvCallCfg_Init)
242 * (/*getPaca()->getSecondaryThreadCount() +*/ 1);
1da177e4 243}
45dc76aa
SR
244
245static inline HvLpVirtualLanIndexMap HvLpConfig_getVirtualLanIndexMap(void)
1da177e4
LT
246{
247 return HvCallCfg_getVirtualLanIndexMap(HvLpConfig_getLpIndex_outline());
248}
45dc76aa
SR
249
250static inline HvLpVirtualLanIndexMap HvLpConfig_getVirtualLanIndexMapForLp(
251 HvLpIndex lp)
1da177e4
LT
252{
253 return HvCallCfg_getVirtualLanIndexMap(lp);
254}
45dc76aa
SR
255
256static inline HvLpIndex HvLpConfig_getBusOwner(HvBusNumber busNumber)
1da177e4
LT
257{
258 return HvCallCfg_getBusOwner(busNumber);
259}
45dc76aa
SR
260
261static inline int HvLpConfig_isBusDedicated(HvBusNumber busNumber)
1da177e4
LT
262{
263 return HvCallCfg_isBusDedicated(busNumber);
264}
45dc76aa
SR
265
266static inline HvLpIndexMap HvLpConfig_getBusAllocation(HvBusNumber busNumber)
1da177e4
LT
267{
268 return HvCallCfg_getBusAllocation(busNumber);
269}
45dc76aa
SR
270
271/* returns the absolute real address of the load area */
272static inline u64 HvLpConfig_getLoadAddress(void)
1da177e4
LT
273{
274 return itLpNaca.xLoadAreaAddr & 0x7fffffffffffffff;
275}
45dc76aa
SR
276
277static inline u64 HvLpConfig_getLoadPages(void)
1da177e4
LT
278{
279 return itLpNaca.xLoadAreaChunks * HVPAGESPERCHUNK;
280}
45dc76aa
SR
281
282static inline int HvLpConfig_isBusOwnedByThisLp(HvBusNumber busNumber)
1da177e4
LT
283{
284 HvLpIndex busOwner = HvLpConfig_getBusOwner(busNumber);
285 return (busOwner == HvLpConfig_getLpIndex());
286}
45dc76aa
SR
287
288static inline int HvLpConfig_doLpsCommunicateOnVirtualLan(HvLpIndex lp1,
289 HvLpIndex lp2)
1da177e4 290{
45dc76aa
SR
291 HvLpVirtualLanIndexMap virtualLanIndexMap1 =
292 HvCallCfg_getVirtualLanIndexMap(lp1);
293 HvLpVirtualLanIndexMap virtualLanIndexMap2 =
294 HvCallCfg_getVirtualLanIndexMap(lp2);
1da177e4
LT
295 return ((virtualLanIndexMap1 & virtualLanIndexMap2) != 0);
296}
45dc76aa
SR
297
298static inline HvLpIndex HvLpConfig_getHostingLpIndex(HvLpIndex lp)
1da177e4
LT
299{
300 return HvCallCfg_getHostingLpIndex(lp);
301}
1da177e4
LT
302
303#endif /* _HVLPCONFIG_H */