1 /*
2  * HvCallCfg.h
3  * Copyright (C) 2001  Mike Corrigan IBM Corporation
4  *
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.
9  *
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.
14  *
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 
20 //=====================================================================================
21 //
22 //	This file contains the "hypervisor call" interface which is used to
23 //	drive the hypervisor from the OS.
24 //
25 //=====================================================================================
26 
27 //-------------------------------------------------------------------
28 // Standard Includes
29 //-------------------------------------------------------------------
30 #ifndef  _HVCALLSC_H
31 #include "HvCallSc.h"
32 #endif
33 
34 #ifndef  _HVTYPES_H
35 #include <asm/iSeries/HvTypes.h>
36 #endif
37 
38 //-------------------------------------------------------------------------------------
39 // Constants
40 //-------------------------------------------------------------------------------------
41 #ifndef _HVCALLCFG_H
42 #define _HVCALLCFG_H
43 
44 enum HvCallCfg_ReqQual
45 {
46 	HvCallCfg_Cur	= 0,
47 	HvCallCfg_Init	= 1,
48 	HvCallCfg_Max	= 2,
49 	HvCallCfg_Min	= 3
50 };
51 
52 #define HvCallCfgGetLps					HvCallCfg +  0
53 #define HvCallCfgGetActiveLpMap				HvCallCfg +  1
54 #define HvCallCfgGetLpVrmIndex				HvCallCfg +  2
55 #define HvCallCfgGetLpMinSupportedPlicVrmIndex		HvCallCfg +  3
56 #define HvCallCfgGetLpMinCompatablePlicVrmIndex		HvCallCfg +  4
57 #define HvCallCfgGetLpVrmName				HvCallCfg +  5
58 #define HvCallCfgGetSystemPhysicalProcessors		HvCallCfg +  6
59 #define HvCallCfgGetPhysicalProcessors			HvCallCfg +  7
60 #define HvCallCfgGetSystemMsChunks			HvCallCfg +  8
61 #define HvCallCfgGetMsChunks				HvCallCfg +  9
62 #define HvCallCfgGetInteractivePercentage		HvCallCfg + 10
63 #define HvCallCfgIsBusDedicated				HvCallCfg + 11
64 #define HvCallCfgGetBusOwner				HvCallCfg + 12
65 #define HvCallCfgGetBusAllocation			HvCallCfg + 13
66 #define HvCallCfgGetBusUnitOwner			HvCallCfg + 14
67 #define HvCallCfgGetBusUnitAllocation			HvCallCfg + 15
68 #define HvCallCfgGetVirtualBusPool			HvCallCfg + 16
69 #define HvCallCfgGetBusUnitInterruptProc		HvCallCfg + 17
70 #define HvCallCfgGetConfiguredBusUnitsForIntProc	HvCallCfg + 18
71 #define HvCallCfgGetRioSanBusPool			HvCallCfg + 19
72 #define HvCallCfgGetSharedPoolIndex			HvCallCfg + 20
73 #define HvCallCfgGetSharedProcUnits			HvCallCfg + 21
74 #define HvCallCfgGetNumProcsInSharedPool		HvCallCfg + 22
75 #define HvCallCfgRouter23				HvCallCfg + 23
76 #define HvCallCfgRouter24				HvCallCfg + 24
77 #define HvCallCfgRouter25				HvCallCfg + 25
78 #define HvCallCfgRouter26				HvCallCfg + 26
79 #define HvCallCfgRouter27				HvCallCfg + 27
80 #define HvCallCfgGetMinRuntimeMsChunks			HvCallCfg + 28
81 #define HvCallCfgSetMinRuntimeMsChunks			HvCallCfg + 29
82 #define HvCallCfgGetVirtualLanIndexMap			HvCallCfg + 30
83 #define HvCallCfgGetLpExecutionMode			HvCallCfg + 31
84 #define HvCallCfgGetHostingLpIndex 			HvCallCfg + 32
85 
86 //====================================================================
HvCallCfg_getLps(void)87 static inline HvLpIndex	HvCallCfg_getLps(void)
88 {
89 	HvLpIndex retVal = HvCall0(HvCallCfgGetLps);
90 	// getPaca()->adjustHmtForNoOfSpinLocksHeld();
91 	return retVal;
92 }
93 //====================================================================
HvCallCfg_isBusDedicated(u64 busIndex)94 static inline int		HvCallCfg_isBusDedicated(u64 busIndex)
95 {
96 	int retVal = HvCall1(HvCallCfgIsBusDedicated,busIndex);
97 	// getPaca()->adjustHmtForNoOfSpinLocksHeld();
98 	return retVal;
99 }
100 //====================================================================
HvCallCfg_getBusOwner(u64 busIndex)101 static inline HvLpIndex	HvCallCfg_getBusOwner(u64 busIndex)
102 {
103 	HvLpIndex retVal = HvCall1(HvCallCfgGetBusOwner,busIndex);
104 	// getPaca()->adjustHmtForNoOfSpinLocksHeld();
105 	return retVal;
106 }
107 //====================================================================
HvCallCfg_getBusAllocation(u64 busIndex)108 static inline HvLpIndexMap	HvCallCfg_getBusAllocation(u64 busIndex)
109 {
110 	HvLpIndexMap retVal = HvCall1(HvCallCfgGetBusAllocation,busIndex);
111 	// getPaca()->adjustHmtForNoOfSpinLocksHeld();
112 	return retVal;
113 }
114 //====================================================================
HvCallCfg_getActiveLpMap(void)115 static inline HvLpIndexMap	HvCallCfg_getActiveLpMap(void)
116 {
117 	HvLpIndexMap retVal = HvCall0(HvCallCfgGetActiveLpMap);
118 	// getPaca()->adjustHmtForNoOfSpinLocksHeld();
119 	return retVal;
120 }
121 //====================================================================
HvCallCfg_getVirtualLanIndexMap(HvLpIndex lp)122 static inline HvLpVirtualLanIndexMap	HvCallCfg_getVirtualLanIndexMap(HvLpIndex lp)
123 {
124 	// This is a new function in V5R1 so calls to this on older
125 	// hypervisors will return -1
126 	u64 retVal = HvCall1(HvCallCfgGetVirtualLanIndexMap, lp);
127 	if(retVal == -1)
128 		retVal = 0;
129 	// getPaca()->adjustHmtForNoOfSpinLocksHeld();
130 	return retVal;
131 }
132 //===================================================================
HvCallCfg_getSystemMsChunks(void)133 static inline u64		HvCallCfg_getSystemMsChunks(void)
134 {
135 	u64 retVal = HvCall0(HvCallCfgGetSystemMsChunks);
136 	// getPaca()->adjustHmtForNoOfSpinLocksHeld();
137 	return retVal;
138 }
139 //===================================================================
HvCallCfg_getMsChunks(HvLpIndex lp,enum HvCallCfg_ReqQual qual)140 static inline u64		HvCallCfg_getMsChunks(HvLpIndex lp,enum HvCallCfg_ReqQual qual)
141 {
142 	u64 retVal = HvCall2(HvCallCfgGetMsChunks,lp,qual);
143 	// getPaca()->adjustHmtForNoOfSpinLocksHeld();
144 	return retVal;
145 }
146 //===================================================================
HvCallCfg_getMinRuntimeMsChunks(HvLpIndex lp)147 static inline u64		HvCallCfg_getMinRuntimeMsChunks(HvLpIndex lp)
148 {
149 	// NOTE: This function was added in v5r1 so older hypervisors will return a -1 value
150 	u64 retVal = HvCall1(HvCallCfgGetMinRuntimeMsChunks,lp);
151 	// getPaca()->adjustHmtForNoOfSpinLocksHeld();
152 	return retVal;
153 }
154 //===================================================================
HvCallCfg_setMinRuntimeMsChunks(u64 chunks)155 static inline u64		HvCallCfg_setMinRuntimeMsChunks(u64 chunks)
156 {
157 	u64 retVal = HvCall1(HvCallCfgSetMinRuntimeMsChunks,chunks);
158 	// getPaca()->adjustHmtForNoOfSpinLocksHeld();
159 	return retVal;
160 }
161 //===================================================================
HvCallCfg_getSystemPhysicalProcessors(void)162 static inline u64		HvCallCfg_getSystemPhysicalProcessors(void)
163 {
164 	u64 retVal = HvCall0(HvCallCfgGetSystemPhysicalProcessors);
165 	// getPaca()->adjustHmtForNoOfSpinLocksHeld();
166 	return retVal;
167 }
168 //===================================================================
HvCallCfg_getPhysicalProcessors(HvLpIndex lp,enum HvCallCfg_ReqQual qual)169 static inline u64		HvCallCfg_getPhysicalProcessors(HvLpIndex lp,enum HvCallCfg_ReqQual qual)
170 {
171 	u64 retVal = HvCall2(HvCallCfgGetPhysicalProcessors,lp,qual);
172 	// getPaca()->adjustHmtForNoOfSpinLocksHeld();
173 	return retVal;
174 }
175 //===================================================================
HvCallCfg_getConfiguredBusUnitsForInterruptProc(HvLpIndex lp,u16 hvLogicalProcIndex)176 static inline u64		HvCallCfg_getConfiguredBusUnitsForInterruptProc(HvLpIndex lp,
177 										u16 hvLogicalProcIndex)
178 {
179 	u64 retVal = HvCall2(HvCallCfgGetConfiguredBusUnitsForIntProc,lp,hvLogicalProcIndex);
180 	// getPaca()->adjustHmtForNoOfSpinLocksHeld();
181 	return retVal;
182 
183 }
184 //==================================================================
HvCallCfg_getSharedPoolIndex(HvLpIndex lp)185 static inline HvLpSharedPoolIndex	HvCallCfg_getSharedPoolIndex(HvLpIndex lp)
186 {
187 	HvLpSharedPoolIndex retVal =
188 		HvCall1(HvCallCfgGetSharedPoolIndex,lp);
189 	// getPaca()->adjustHmtForNoOfSpinLocksHeld();
190 	return retVal;
191 
192 }
193 //==================================================================
HvCallCfg_getSharedProcUnits(HvLpIndex lp,enum HvCallCfg_ReqQual qual)194 static inline u64	HvCallCfg_getSharedProcUnits(HvLpIndex lp,enum HvCallCfg_ReqQual qual)
195 {
196 	u64 retVal = HvCall2(HvCallCfgGetSharedProcUnits,lp,qual);
197 	// getPaca()->adjustHmtForNoOfSpinLocksHeld();
198 	return retVal;
199 
200 }
201 //==================================================================
HvCallCfg_getNumProcsInSharedPool(HvLpSharedPoolIndex sPI)202 static inline u64	HvCallCfg_getNumProcsInSharedPool(HvLpSharedPoolIndex sPI)
203 {
204 	u16 retVal = HvCall1(HvCallCfgGetNumProcsInSharedPool,sPI);
205 	// getPaca()->adjustHmtForNoOfSpinLocksHeld();
206 	return retVal;
207 
208 }
209 //==================================================================
HvCallCfg_getHostingLpIndex(HvLpIndex lp)210 static inline HvLpIndex	HvCallCfg_getHostingLpIndex(HvLpIndex lp)
211 {
212 	u64 retVal = HvCall1(HvCallCfgGetHostingLpIndex,lp);
213 	// getPaca()->adjustHmtForNoOfSpinLocksHeld();
214 	return retVal;
215 
216 }
217 
218 #endif // _HVCALLCFG_H
219 
220