aboutsummaryrefslogtreecommitdiff
path: root/platform/linux-generic/include/odp_sysinfo_internal.h
blob: 81bfd045fd090fb50ea9b0e4627bb7624d148779 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
/* Copyright (c) 2013-2018, Linaro Limited
 * All rights reserved.
 *
 * SPDX-License-Identifier:     BSD-3-Clause
 */

#ifndef ODP_SYSINFO_INTERNAL_H_
#define ODP_SYSINFO_INTERNAL_H_

#ifdef __cplusplus
extern "C" {
#endif

#include <odp_global_data.h>
#include <odp_debug_internal.h>
#include <inttypes.h>
#include <string.h>

int _odp_cpuinfo_parser(FILE *file, system_info_t *sysinfo);
uint64_t odp_cpu_hz_current(int id);
uint64_t odp_cpu_arch_hz_current(int id);
void _odp_sys_info_print_arch(void);

static inline int _odp_dummy_cpuinfo(system_info_t *sysinfo)
{
	uint64_t cpu_hz_max = sysinfo->default_cpu_hz_max;
	int i;

	sysinfo->cpu_arch = ODP_CPU_ARCH_UNKNOWN;

	ODP_DBG("Warning: use dummy values for freq and model string\n");
	for (i = 0; i < CONFIG_NUM_CPU_IDS; i++) {
		ODP_PRINT("WARN: cpu[%i] uses default max frequency of "
			  "%" PRIu64 " Hz from config file\n", i, cpu_hz_max);
		sysinfo->cpu_hz_max[i] = cpu_hz_max;
		strcpy(sysinfo->model_str[i], "UNKNOWN");
	}

	return 0;
}

#ifdef __cplusplus
}
#endif

#endif