diff options
Diffstat (limited to 'include/asm-powerpc/iseries')
-rw-r--r-- | include/asm-powerpc/iseries/hv_lp_config.h | 138 |
1 files changed, 138 insertions, 0 deletions
diff --git a/include/asm-powerpc/iseries/hv_lp_config.h b/include/asm-powerpc/iseries/hv_lp_config.h new file mode 100644 index 000000000000..9077fc8e3f6c --- /dev/null +++ b/include/asm-powerpc/iseries/hv_lp_config.h | |||
@@ -0,0 +1,138 @@ | |||
1 | /* | ||
2 | * HvLpConfig.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 | #ifndef _HVLPCONFIG_H | ||
20 | #define _HVLPCONFIG_H | ||
21 | |||
22 | /* | ||
23 | * This file contains the interface to the LPAR configuration data | ||
24 | * to determine which resources should be allocated to each partition. | ||
25 | */ | ||
26 | |||
27 | #include <asm/iseries/hv_call_sc.h> | ||
28 | #include <asm/iSeries/HvTypes.h> | ||
29 | #include <asm/iSeries/ItLpNaca.h> | ||
30 | |||
31 | enum { | ||
32 | HvCallCfg_Cur = 0, | ||
33 | HvCallCfg_Init = 1, | ||
34 | HvCallCfg_Max = 2, | ||
35 | HvCallCfg_Min = 3 | ||
36 | }; | ||
37 | |||
38 | #define HvCallCfgGetSystemPhysicalProcessors HvCallCfg + 6 | ||
39 | #define HvCallCfgGetPhysicalProcessors HvCallCfg + 7 | ||
40 | #define HvCallCfgGetMsChunks HvCallCfg + 9 | ||
41 | #define HvCallCfgGetSharedPoolIndex HvCallCfg + 20 | ||
42 | #define HvCallCfgGetSharedProcUnits HvCallCfg + 21 | ||
43 | #define HvCallCfgGetNumProcsInSharedPool HvCallCfg + 22 | ||
44 | #define HvCallCfgGetVirtualLanIndexMap HvCallCfg + 30 | ||
45 | #define HvCallCfgGetHostingLpIndex HvCallCfg + 32 | ||
46 | |||
47 | extern HvLpIndex HvLpConfig_getLpIndex_outline(void); | ||
48 | |||
49 | static inline HvLpIndex HvLpConfig_getLpIndex(void) | ||
50 | { | ||
51 | return itLpNaca.xLpIndex; | ||
52 | } | ||
53 | |||
54 | static inline HvLpIndex HvLpConfig_getPrimaryLpIndex(void) | ||
55 | { | ||
56 | return itLpNaca.xPrimaryLpIndex; | ||
57 | } | ||
58 | |||
59 | static inline u64 HvLpConfig_getMsChunks(void) | ||
60 | { | ||
61 | return HvCall2(HvCallCfgGetMsChunks, HvLpConfig_getLpIndex(), | ||
62 | HvCallCfg_Cur); | ||
63 | } | ||
64 | |||
65 | static inline u64 HvLpConfig_getSystemPhysicalProcessors(void) | ||
66 | { | ||
67 | return HvCall0(HvCallCfgGetSystemPhysicalProcessors); | ||
68 | } | ||
69 | |||
70 | static inline u64 HvLpConfig_getNumProcsInSharedPool(HvLpSharedPoolIndex sPI) | ||
71 | { | ||
72 | return (u16)HvCall1(HvCallCfgGetNumProcsInSharedPool, sPI); | ||
73 | } | ||
74 | |||
75 | static inline u64 HvLpConfig_getPhysicalProcessors(void) | ||
76 | { | ||
77 | return HvCall2(HvCallCfgGetPhysicalProcessors, HvLpConfig_getLpIndex(), | ||
78 | HvCallCfg_Cur); | ||
79 | } | ||
80 | |||
81 | static inline HvLpSharedPoolIndex HvLpConfig_getSharedPoolIndex(void) | ||
82 | { | ||
83 | return HvCall1(HvCallCfgGetSharedPoolIndex, HvLpConfig_getLpIndex()); | ||
84 | } | ||
85 | |||
86 | static inline u64 HvLpConfig_getSharedProcUnits(void) | ||
87 | { | ||
88 | return HvCall2(HvCallCfgGetSharedProcUnits, HvLpConfig_getLpIndex(), | ||
89 | HvCallCfg_Cur); | ||
90 | } | ||
91 | |||
92 | static inline u64 HvLpConfig_getMaxSharedProcUnits(void) | ||
93 | { | ||
94 | return HvCall2(HvCallCfgGetSharedProcUnits, HvLpConfig_getLpIndex(), | ||
95 | HvCallCfg_Max); | ||
96 | } | ||
97 | |||
98 | static inline u64 HvLpConfig_getMaxPhysicalProcessors(void) | ||
99 | { | ||
100 | return HvCall2(HvCallCfgGetPhysicalProcessors, HvLpConfig_getLpIndex(), | ||
101 | HvCallCfg_Max); | ||
102 | } | ||
103 | |||
104 | static inline HvLpVirtualLanIndexMap HvLpConfig_getVirtualLanIndexMapForLp( | ||
105 | HvLpIndex lp) | ||
106 | { | ||
107 | /* | ||
108 | * This is a new function in V5R1 so calls to this on older | ||
109 | * hypervisors will return -1 | ||
110 | */ | ||
111 | u64 retVal = HvCall1(HvCallCfgGetVirtualLanIndexMap, lp); | ||
112 | if (retVal == -1) | ||
113 | retVal = 0; | ||
114 | return retVal; | ||
115 | } | ||
116 | |||
117 | static inline HvLpVirtualLanIndexMap HvLpConfig_getVirtualLanIndexMap(void) | ||
118 | { | ||
119 | return HvLpConfig_getVirtualLanIndexMapForLp( | ||
120 | HvLpConfig_getLpIndex_outline()); | ||
121 | } | ||
122 | |||
123 | static inline int HvLpConfig_doLpsCommunicateOnVirtualLan(HvLpIndex lp1, | ||
124 | HvLpIndex lp2) | ||
125 | { | ||
126 | HvLpVirtualLanIndexMap virtualLanIndexMap1 = | ||
127 | HvLpConfig_getVirtualLanIndexMapForLp(lp1); | ||
128 | HvLpVirtualLanIndexMap virtualLanIndexMap2 = | ||
129 | HvLpConfig_getVirtualLanIndexMapForLp(lp2); | ||
130 | return ((virtualLanIndexMap1 & virtualLanIndexMap2) != 0); | ||
131 | } | ||
132 | |||
133 | static inline HvLpIndex HvLpConfig_getHostingLpIndex(HvLpIndex lp) | ||
134 | { | ||
135 | return HvCall1(HvCallCfgGetHostingLpIndex, lp); | ||
136 | } | ||
137 | |||
138 | #endif /* _HVLPCONFIG_H */ | ||