PAPI 7.1.0.0
Loading...
Searching...
No Matches
powerpc_cpu_utils.c File Reference
Include dependency graph for powerpc_cpu_utils.c:

Go to the source code of this file.

Macros

#define SPRN_PVR   0x11F /* Processor Version Register */
 
#define PVR_PROCESSOR_SHIFT   16
 

Functions

static unsigned int mfpvr (void)
 
static int get_cache_info (CPU_attr_e attr, int level, int *value)
 
int powerpc_cpu_init (void)
 
int powerpc_cpu_finalize (void)
 
int powerpc_cpu_get_vendor (char *vendor)
 
int powerpc_cpu_get_name (char *name)
 
int powerpc_cpu_get_attribute (CPU_attr_e attr, int *value)
 
int powerpc_cpu_get_attribute_at (CPU_attr_e attr, int loc, int *value)
 

Variables

_sysdetect_cache_level_info_t ppc970_cache_info []
 
_sysdetect_cache_level_info_t power5_cache_info []
 
_sysdetect_cache_level_info_t power6_cache_info []
 
_sysdetect_cache_level_info_t power7_cache_info []
 
_sysdetect_cache_level_info_t power8_cache_info []
 
_sysdetect_cache_level_info_t power9_cache_info []
 
_sysdetect_cache_level_info_t power10_cache_info []
 

Macro Definition Documentation

◆ PVR_PROCESSOR_SHIFT

#define PVR_PROCESSOR_SHIFT   16

Definition at line 167 of file powerpc_cpu_utils.c.

◆ SPRN_PVR

#define SPRN_PVR   0x11F /* Processor Version Register */

Definition at line 166 of file powerpc_cpu_utils.c.

Function Documentation

◆ get_cache_info()

int get_cache_info ( CPU_attr_e  attr,
int  level,
int value 
)
static

Definition at line 237 of file powerpc_cpu_utils.c.

238{
239 unsigned int pvr = mfpvr() >> PVR_PROCESSOR_SHIFT;
240 static _sysdetect_cache_level_info_t *clevel_ptr;
241
242 if (clevel_ptr) {
243 return cpu_get_cache_info(attr, level, clevel_ptr, value);
244 }
245
246 switch(pvr) {
247 case 0x39: /* PPC970 */
248 case 0x3C: /* PPC970FX */
249 case 0x44: /* PPC970MP */
250 case 0x45: /* PPC970GX */
251 clevel_ptr = ppc970_cache_info;
252 break;
253 case 0x3A: /* POWER5 */
254 case 0x3B: /* POWER5+ */
255 clevel_ptr = power5_cache_info;
256 break;
257 case 0x3E: /* POWER6 */
258 clevel_ptr = power6_cache_info;
259 break;
260 case 0x3F: /* POWER7 */
261 clevel_ptr = power7_cache_info;
262 break;
263 case 0x4b: /* POWER8 */
264 clevel_ptr = power8_cache_info;
265 break;
266 case 0x4e: /* POWER9 */
267 clevel_ptr = power9_cache_info;
268 break;
269 case 0x80: /* POWER10 */
270 clevel_ptr = power10_cache_info;
271 break;
272 default:
273 return CPU_ERROR;
274 }
275
276 return cpu_get_cache_info(attr, level, clevel_ptr, value);
277}
int cpu_get_cache_info(CPU_attr_e attr, int level, _sysdetect_cache_level_info_t *clevel_ptr, int *value)
Definition: cpu_utils.c:94
#define CPU_ERROR
Definition: cpu_utils.h:5
_sysdetect_cache_level_info_t power6_cache_info[]
_sysdetect_cache_level_info_t power5_cache_info[]
_sysdetect_cache_level_info_t power9_cache_info[]
_sysdetect_cache_level_info_t power8_cache_info[]
_sysdetect_cache_level_info_t power7_cache_info[]
_sysdetect_cache_level_info_t ppc970_cache_info[]
_sysdetect_cache_level_info_t power10_cache_info[]
static unsigned int mfpvr(void)
#define PVR_PROCESSOR_SHIFT
Here is the call graph for this function:
Here is the caller graph for this function:

◆ mfpvr()

unsigned int mfpvr ( void  )
static

Definition at line 280 of file powerpc_cpu_utils.c.

281{
282 unsigned long pvr;
283 __asm__ ("mfspr %0,%1"
284 : "=r" (pvr)
285 : "i" (SPRN_PVR));
286 return pvr;
287}
#define SPRN_PVR
Here is the caller graph for this function:

◆ powerpc_cpu_finalize()

int powerpc_cpu_finalize ( void  )

Definition at line 179 of file powerpc_cpu_utils.c.

180{
181 return CPU_SUCCESS;
182}
#define CPU_SUCCESS
Definition: cpu_utils.h:4

◆ powerpc_cpu_get_attribute()

int powerpc_cpu_get_attribute ( CPU_attr_e  attr,
int value 
)

Definition at line 197 of file powerpc_cpu_utils.c.

198{
199 return os_cpu_get_attribute(attr, value);
200}
int os_cpu_get_attribute(CPU_attr_e attr, int *value)
Definition: os_cpu_utils.c:30
Here is the call graph for this function:
Here is the caller graph for this function:

◆ powerpc_cpu_get_attribute_at()

int powerpc_cpu_get_attribute_at ( CPU_attr_e  attr,
int  loc,
int value 
)

Definition at line 203 of file powerpc_cpu_utils.c.

204{
205 int status = CPU_SUCCESS;
206
207 switch(attr) {
223 status = get_cache_info(attr, loc, value);
224 break;
227 status = os_cpu_get_attribute_at(attr, loc, value);
228 break;
229 default:
230 status = CPU_ERROR;
231 }
232
233 return status;
234}
@ CPU_ATTR__CACHE_INST_TOT_SIZE
Definition: cpu_utils.h:21
@ CPU_ATTR__HWTHREAD_NUMA_AFFINITY
Definition: cpu_utils.h:34
@ CPU_ATTR__CACHE_UNIF_TOT_SIZE
Definition: cpu_utils.h:29
@ CPU_ATTR__CACHE_DATA_ASSOCIATIVITY
Definition: cpu_utils.h:28
@ CPU_ATTR__CACHE_INST_LINE_SIZE
Definition: cpu_utils.h:22
@ CPU_ATTR__NUMA_MEM_SIZE
Definition: cpu_utils.h:36
@ CPU_ATTR__CACHE_UNIF_LINE_SIZE
Definition: cpu_utils.h:30
@ CPU_ATTR__CACHE_DATA_NUM_LINES
Definition: cpu_utils.h:27
@ CPU_ATTR__CACHE_UNIF_ASSOCIATIVITY
Definition: cpu_utils.h:32
@ CPU_ATTR__CACHE_INST_PRESENT
Definition: cpu_utils.h:18
@ CPU_ATTR__CACHE_DATA_PRESENT
Definition: cpu_utils.h:19
@ CPU_ATTR__CACHE_DATA_LINE_SIZE
Definition: cpu_utils.h:26
@ CPU_ATTR__CACHE_INST_ASSOCIATIVITY
Definition: cpu_utils.h:24
@ CPU_ATTR__CACHE_INST_NUM_LINES
Definition: cpu_utils.h:23
@ CPU_ATTR__CACHE_UNIF_NUM_LINES
Definition: cpu_utils.h:31
@ CPU_ATTR__CACHE_DATA_TOT_SIZE
Definition: cpu_utils.h:25
@ CPU_ATTR__CACHE_UNIF_PRESENT
Definition: cpu_utils.h:20
int os_cpu_get_attribute_at(CPU_attr_e attr, int loc, int *value)
Definition: os_cpu_utils.c:42
static int get_cache_info(CPU_attr_e attr, int level, int *value)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ powerpc_cpu_get_name()

int powerpc_cpu_get_name ( char *  name)

Definition at line 191 of file powerpc_cpu_utils.c.

192{
193 return os_cpu_get_name(name);
194}
int os_cpu_get_name(char *name)
Definition: os_cpu_utils.c:18
const char * name
Definition: rocs.c:225
Here is the call graph for this function:
Here is the caller graph for this function:

◆ powerpc_cpu_get_vendor()

int powerpc_cpu_get_vendor ( char *  vendor)

Definition at line 185 of file powerpc_cpu_utils.c.

186{
187 return os_cpu_get_vendor(vendor);
188}
int os_cpu_get_vendor(char *vendor)
Definition: os_cpu_utils.c:6
Here is the call graph for this function:
Here is the caller graph for this function:

◆ powerpc_cpu_init()

int powerpc_cpu_init ( void  )

Definition at line 173 of file powerpc_cpu_utils.c.

174{
175 return CPU_SUCCESS;
176}

Variable Documentation

◆ power10_cache_info

_sysdetect_cache_level_info_t power10_cache_info[]
Initial value:
= {
{
2,
{
{PAPI_MH_TYPE_INST, 49152, 128, 384, 6},
{PAPI_MH_TYPE_DATA, 32768, 128, 256, 8}
}
},
{
1,
{
{PAPI_MH_TYPE_UNIFIED, 1048576, 128, 8192, 8},
{PAPI_MH_TYPE_EMPTY, -1, -1, -1, -1}
}
},
{
1,
{
{PAPI_MH_TYPE_UNIFIED, 4194304, 128, 32768, 16},
{PAPI_MH_TYPE_EMPTY, -1, -1, -1, -1}
}
},
}
#define PAPI_MH_TYPE_DATA
Definition: papi.h:720
#define PAPI_MH_TYPE_INST
Definition: papi.h:719
#define PAPI_MH_TYPE_EMPTY
Definition: papi.h:718
#define PAPI_MH_TYPE_UNIFIED
Definition: papi.h:723

Definition at line 142 of file powerpc_cpu_utils.c.

◆ power5_cache_info

_sysdetect_cache_level_info_t power5_cache_info[]
Initial value:
= {
{
2,
{
{PAPI_MH_TYPE_INST, 65536, 128, 512, 2},
{PAPI_MH_TYPE_DATA, 32768, 128, 256, 4}
}
},
{
1,
{
{PAPI_MH_TYPE_UNIFIED, 1966080, 128, 15360, 10},
{PAPI_MH_TYPE_EMPTY, -1, -1, -1, -1}
}
},
{
1,
{
{PAPI_MH_TYPE_UNIFIED, 37748736, 256, 147456, 12},
{PAPI_MH_TYPE_EMPTY, -1, -1, -1, -1}
}
},
}

Definition at line 22 of file powerpc_cpu_utils.c.

◆ power6_cache_info

_sysdetect_cache_level_info_t power6_cache_info[]
Initial value:
= {
{
2,
{
{PAPI_MH_TYPE_INST, 65536, 128, 512, 4},
{PAPI_MH_TYPE_DATA, 65536, 128, 512, 8}
}
},
{
1,
{
{PAPI_MH_TYPE_UNIFIED, 4194304, 128, 16384, 8},
{PAPI_MH_TYPE_EMPTY, -1, -1, -1, -1}
}
},
{
1,
{
{PAPI_MH_TYPE_UNIFIED, 33554432, 128, 262144, 16},
{PAPI_MH_TYPE_EMPTY, -1, -1, -1, -1}
}
},
}

Definition at line 46 of file powerpc_cpu_utils.c.

◆ power7_cache_info

_sysdetect_cache_level_info_t power7_cache_info[]
Initial value:
= {
{
2,
{
{PAPI_MH_TYPE_INST, 32768, 128, 64, 4},
{PAPI_MH_TYPE_DATA, 32768, 128, 32, 8}
}
},
{
1,
{
{PAPI_MH_TYPE_UNIFIED, 524288, 128, 256, 8},
{PAPI_MH_TYPE_EMPTY, -1, -1, -1, -1}
}
},
{
1,
{
{PAPI_MH_TYPE_UNIFIED, 4194304, 128, 4096, 8},
{PAPI_MH_TYPE_EMPTY, -1, -1, -1, -1}
}
},
}

Definition at line 70 of file powerpc_cpu_utils.c.

◆ power8_cache_info

_sysdetect_cache_level_info_t power8_cache_info[]
Initial value:
= {
{
2,
{
{PAPI_MH_TYPE_INST, 32768, 128, 64, 8},
{PAPI_MH_TYPE_DATA, 65536, 128, 512, 8}
}
},
{
1,
{
{PAPI_MH_TYPE_UNIFIED, 262144, 128, 256, 8},
{PAPI_MH_TYPE_EMPTY, -1, -1, -1, -1}
}
},
{
1,
{
{PAPI_MH_TYPE_UNIFIED, 8388608, 128, 65536, 8},
{PAPI_MH_TYPE_EMPTY, -1, -1, -1, -1}
}
},
}

Definition at line 94 of file powerpc_cpu_utils.c.

◆ power9_cache_info

_sysdetect_cache_level_info_t power9_cache_info[]
Initial value:
= {
{
2,
{
{PAPI_MH_TYPE_INST, 32768, 128, 256, 8},
{PAPI_MH_TYPE_DATA, 32768, 128, 256, 8}
}
},
{
1,
{
{PAPI_MH_TYPE_UNIFIED, 524288, 128, 4096, 8},
{PAPI_MH_TYPE_EMPTY, -1, -1, -1, -1}
}
},
{
1,
{
{PAPI_MH_TYPE_UNIFIED, 10485760, 128, 81920, 20},
{PAPI_MH_TYPE_EMPTY, -1, -1, -1, -1}
}
},
}

Definition at line 118 of file powerpc_cpu_utils.c.

◆ ppc970_cache_info

_sysdetect_cache_level_info_t ppc970_cache_info[]
Initial value:
= {
{
2,
{
{PAPI_MH_TYPE_INST, 65536, 128, 512, 1},
{PAPI_MH_TYPE_DATA, 32768, 128, 256, 2}
}
},
{
1,
{
{PAPI_MH_TYPE_UNIFIED, 524288, 128, 4096, 8},
{PAPI_MH_TYPE_EMPTY, -1, -1, -1, -1}
}
},
}

Definition at line 5 of file powerpc_cpu_utils.c.