3 * Copyright (C) 2001 Mike Corrigan IBM Corporation
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.
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.
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
20 //===========================================================================
22 // This file contains the interface to the LPAR configuration data
23 // to determine which resources should be allocated to each partition.
25 //===========================================================================
28 #include "HvCallCfg.h"
32 #include <asm/iSeries/HvTypes.h>
36 #include <asm/iSeries/ItLpNaca.h>
40 #include <asm/iSeries/LparData.h>
46 //-------------------------------------------------------------------
48 //-------------------------------------------------------------------
50 extern HvLpIndex HvLpConfig_getLpIndex_outline(void);
52 //===================================================================
53 static inline HvLpIndex HvLpConfig_getLpIndex(void)
55 return itLpNaca.xLpIndex;
57 //===================================================================
58 static inline HvLpIndex HvLpConfig_getPrimaryLpIndex(void)
60 return itLpNaca.xPrimaryLpIndex;
62 //=================================================================
63 static inline HvLpIndex HvLpConfig_getLps(void)
65 return HvCallCfg_getLps();
67 //=================================================================
68 static inline HvLpIndexMap HvLpConfig_getActiveLpMap(void)
70 return HvCallCfg_getActiveLpMap();
72 //=================================================================
73 static inline u64 HvLpConfig_getSystemMsMegs(void)
75 return HvCallCfg_getSystemMsChunks() / HVCHUNKSPERMEG;
77 //=================================================================
78 static inline u64 HvLpConfig_getSystemMsChunks(void)
80 return HvCallCfg_getSystemMsChunks();
82 //=================================================================
83 static inline u64 HvLpConfig_getSystemMsPages(void)
85 return HvCallCfg_getSystemMsChunks() * HVPAGESPERCHUNK;
87 //================================================================
88 static inline u64 HvLpConfig_getMsMegs(void)
90 return HvCallCfg_getMsChunks(HvLpConfig_getLpIndex(),HvCallCfg_Cur) / HVCHUNKSPERMEG;
92 //================================================================
93 static inline u64 HvLpConfig_getMsChunks(void)
95 return HvCallCfg_getMsChunks(HvLpConfig_getLpIndex(),HvCallCfg_Cur);
97 //================================================================
98 static inline u64 HvLpConfig_getMsPages(void)
100 return HvCallCfg_getMsChunks(HvLpConfig_getLpIndex(),HvCallCfg_Cur) * HVPAGESPERCHUNK;
102 //================================================================
103 static inline u64 HvLpConfig_getMinMsMegs(void)
105 return HvCallCfg_getMsChunks(HvLpConfig_getLpIndex(),HvCallCfg_Min) / HVCHUNKSPERMEG;
107 //================================================================
108 static inline u64 HvLpConfig_getMinMsChunks(void)
110 return HvCallCfg_getMsChunks(HvLpConfig_getLpIndex(),HvCallCfg_Min);
112 //================================================================
113 static inline u64 HvLpConfig_getMinMsPages(void)
115 return HvCallCfg_getMsChunks(HvLpConfig_getLpIndex(),HvCallCfg_Min) * HVPAGESPERCHUNK;
117 //================================================================
118 static inline u64 HvLpConfig_getMinRuntimeMsMegs(void)
120 return HvCallCfg_getMinRuntimeMsChunks(HvLpConfig_getLpIndex()) / HVCHUNKSPERMEG;
122 //===============================================================
123 static inline u64 HvLpConfig_getMinRuntimeMsChunks(void)
125 return HvCallCfg_getMinRuntimeMsChunks(HvLpConfig_getLpIndex());
127 //===============================================================
128 static inline u64 HvLpConfig_getMinRuntimeMsPages(void)
130 return HvCallCfg_getMinRuntimeMsChunks(HvLpConfig_getLpIndex()) * HVPAGESPERCHUNK;
132 //===============================================================
133 static inline u64 HvLpConfig_getMaxMsMegs(void)
135 return HvCallCfg_getMsChunks(HvLpConfig_getLpIndex(),HvCallCfg_Max) / HVCHUNKSPERMEG;
137 //===============================================================
138 static inline u64 HvLpConfig_getMaxMsChunks(void)
140 return HvCallCfg_getMsChunks(HvLpConfig_getLpIndex(),HvCallCfg_Max);
142 //===============================================================
143 static inline u64 HvLpConfig_getMaxMsPages(void)
145 return HvCallCfg_getMsChunks(HvLpConfig_getLpIndex(),HvCallCfg_Max) * HVPAGESPERCHUNK;
147 //===============================================================
148 static inline u64 HvLpConfig_getInitMsMegs(void)
150 return HvCallCfg_getMsChunks(HvLpConfig_getLpIndex(),HvCallCfg_Init) / HVCHUNKSPERMEG;
152 //===============================================================
153 static inline u64 HvLpConfig_getInitMsChunks(void)
155 return HvCallCfg_getMsChunks(HvLpConfig_getLpIndex(),HvCallCfg_Init);
157 //===============================================================
158 static inline u64 HvLpConfig_getInitMsPages(void)
159 { return HvCallCfg_getMsChunks(HvLpConfig_getLpIndex(),HvCallCfg_Init) * HVPAGESPERCHUNK;
161 //===============================================================
162 static inline u64 HvLpConfig_getSystemPhysicalProcessors(void)
164 return HvCallCfg_getSystemPhysicalProcessors();
166 //===============================================================
167 static inline u64 HvLpConfig_getSystemLogicalProcessors(void)
169 return HvCallCfg_getSystemPhysicalProcessors() * (/*getPaca()->getSecondaryThreadCount() +*/ 1);
171 //===============================================================
172 static inline u64 HvLpConfig_getNumProcsInSharedPool(HvLpSharedPoolIndex sPI)
174 return HvCallCfg_getNumProcsInSharedPool(sPI);
176 //===============================================================
177 static inline u64 HvLpConfig_getPhysicalProcessors(void)
179 return HvCallCfg_getPhysicalProcessors(HvLpConfig_getLpIndex(),HvCallCfg_Cur);
181 //===============================================================
182 static inline u64 HvLpConfig_getLogicalProcessors(void)
184 return HvCallCfg_getPhysicalProcessors(HvLpConfig_getLpIndex(),HvCallCfg_Cur) * (/*getPaca()->getSecondaryThreadCount() +*/ 1);
186 //===============================================================
187 static inline HvLpSharedPoolIndex HvLpConfig_getSharedPoolIndex(void)
189 return HvCallCfg_getSharedPoolIndex(HvLpConfig_getLpIndex());
191 //===============================================================
192 static inline u64 HvLpConfig_getSharedProcUnits(void)
194 return HvCallCfg_getSharedProcUnits(HvLpConfig_getLpIndex(),HvCallCfg_Cur);
196 //===============================================================
197 static inline u64 HvLpConfig_getMinSharedProcUnits(void)
199 return HvCallCfg_getSharedProcUnits(HvLpConfig_getLpIndex(),HvCallCfg_Min);
201 //===============================================================
202 static inline u64 HvLpConfig_getMaxSharedProcUnits(void)
204 return HvCallCfg_getSharedProcUnits(HvLpConfig_getLpIndex(),HvCallCfg_Max);
206 //===============================================================
207 static inline u64 HvLpConfig_getMinPhysicalProcessors(void)
209 return HvCallCfg_getPhysicalProcessors(HvLpConfig_getLpIndex(),HvCallCfg_Min);
211 //===============================================================
212 static inline u64 HvLpConfig_getMinLogicalProcessors(void)
214 return HvCallCfg_getPhysicalProcessors(HvLpConfig_getLpIndex(),HvCallCfg_Min) * (/*getPaca()->getSecondaryThreadCount() +*/ 1);
216 //===============================================================
217 static inline u64 HvLpConfig_getMaxPhysicalProcessors(void)
219 return HvCallCfg_getPhysicalProcessors(HvLpConfig_getLpIndex(),HvCallCfg_Max);
221 //===============================================================
222 static inline u64 HvLpConfig_getMaxLogicalProcessors(void)
224 return HvCallCfg_getPhysicalProcessors(HvLpConfig_getLpIndex(),HvCallCfg_Max) * (/*getPaca()->getSecondaryThreadCount() +*/ 1);
226 //===============================================================
227 static inline u64 HvLpConfig_getInitPhysicalProcessors(void)
229 return HvCallCfg_getPhysicalProcessors(HvLpConfig_getLpIndex(),HvCallCfg_Init);
231 //===============================================================
232 static inline u64 HvLpConfig_getInitLogicalProcessors(void)
234 return HvCallCfg_getPhysicalProcessors(HvLpConfig_getLpIndex(),HvCallCfg_Init) * (/*getPaca()->getSecondaryThreadCount() +*/ 1);
236 //================================================================
237 static inline HvLpVirtualLanIndexMap HvLpConfig_getVirtualLanIndexMap(void)
239 return HvCallCfg_getVirtualLanIndexMap(HvLpConfig_getLpIndex_outline());
241 //===============================================================
242 static inline HvLpVirtualLanIndexMap HvLpConfig_getVirtualLanIndexMapForLp(HvLpIndex lp)
244 return HvCallCfg_getVirtualLanIndexMap(lp);
246 //================================================================
247 static inline HvLpIndex HvLpConfig_getBusOwner(HvBusNumber busNumber)
249 return HvCallCfg_getBusOwner(busNumber);
251 //===============================================================
252 static inline int HvLpConfig_isBusDedicated(HvBusNumber busNumber)
254 return HvCallCfg_isBusDedicated(busNumber);
256 //================================================================
257 static inline HvLpIndexMap HvLpConfig_getBusAllocation(HvBusNumber busNumber)
259 return HvCallCfg_getBusAllocation(busNumber);
261 //================================================================
262 // returns the absolute real address of the load area
263 static inline u64 HvLpConfig_getLoadAddress(void)
265 return itLpNaca.xLoadAreaAddr & 0x7fffffffffffffff;
267 //================================================================
268 static inline u64 HvLpConfig_getLoadPages(void)
270 return itLpNaca.xLoadAreaChunks * HVPAGESPERCHUNK;
272 //================================================================
273 static inline int HvLpConfig_isBusOwnedByThisLp(HvBusNumber busNumber)
275 HvLpIndex busOwner = HvLpConfig_getBusOwner(busNumber);
276 return (busOwner == HvLpConfig_getLpIndex());
278 //================================================================
279 static inline int HvLpConfig_doLpsCommunicateOnVirtualLan(HvLpIndex lp1, HvLpIndex lp2)
281 HvLpVirtualLanIndexMap virtualLanIndexMap1 = HvCallCfg_getVirtualLanIndexMap( lp1 );
282 HvLpVirtualLanIndexMap virtualLanIndexMap2 = HvCallCfg_getVirtualLanIndexMap( lp2 );
283 return ((virtualLanIndexMap1 & virtualLanIndexMap2) != 0);
285 //================================================================
286 static inline HvLpIndex HvLpConfig_getHostingLpIndex(HvLpIndex lp)
288 return HvCallCfg_getHostingLpIndex(lp);
290 //================================================================
292 #endif // _HVLPCONFIG_H