blob: fbd9418a2f8b9dbd0007f89bcc877097c1c6312a (
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
|
/* SPDX-License-Identifier: GPL-2.0+ */
/*
* Copyright (C) 2022, Ovidiu Panait <ovpanait@gmail.com>
*/
#ifndef __ASM_MICROBLAZE_CPUINFO_H
#define __ASM_MICROBLAZE_CPUINFO_H
#include <linux/types.h>
/**
* struct microblaze_cpuinfo - CPU info for microblaze processor core.
*
* @icache_size: Size of instruction cache memory in bytes.
* @icache_line_length: Instruction cache line length in bytes.
* @dcache_size: Size of data cache memory in bytes.
* @dcache_line_length: Data cache line length in bytes.
* @use_mmu: MMU support flag.
* @cpu_freq: Cpu clock frequency in Hz.
* @addr_size: Address bus width in bits.
* @ver_code: Cpu version code.
* @fpga_code: FPGA family version code.
*/
struct microblaze_cpuinfo {
u32 icache_size;
u32 icache_line_length;
u32 dcache_size;
u32 dcache_line_length;
#if IS_ENABLED(CONFIG_CPU_MICROBLAZE)
u32 use_mmu;
u32 cpu_freq;
u32 addr_size;
u32 ver_code;
u32 fpga_code;
#endif /* CONFIG_CPU_MICROBLAZE */
};
/**
* struct microblaze_version_data - Maps a hex version code to a cpu/fpga name.
*/
struct microblaze_version_map {
const char *string;
const u32 code;
};
/**
* microblaze_lookup_cpu_version_code() - Get hex version code for the
* specified cpu name string.
*
* This function searches the cpu_ver_lookup[] array for the hex version code
* associated with a specific CPU name. The version code is returned if a match
* is found, otherwise 0.
*
* @string: cpu name string
*
* Return: >0 if the entry is found, 0 otherwise.
*/
const u32 microblaze_lookup_cpu_version_code(const char *string);
/**
* microblaze_lookup_fpga_family_code() - Get hex version code for the
* specified fpga family name.
*
* This function searches the family_string_lookup[] array for the hex version
* code associated with a specific fpga family name. The version code is
* returned if a match is found, otherwise 0.
*
* @string: fpga family name string
*
* Return: >0 if the entry is found, 0 otherwise.
*/
const u32 microblaze_lookup_fpga_family_code(const char *string);
/**
* microblaze_lookup_cpu_version_string() - Get cpu name for the specified cpu
* version code.
*
* This function searches the cpu_ver_lookup[] array for the cpu name string
* associated with a specific version code. The cpu name is returned if a match
* is found, otherwise "(unknown)".
*
* @code: cpu version code
*
* Return: Pointer to the cpu name if the entry is found, otherwise "(unknown)".
*/
const char *microblaze_lookup_cpu_version_string(const u32 code);
/**
* microblaze_lookup_fpga_family_string() - Get fpga family name for the
* specified version code.
*
* This function searches the family_string_lookup[] array for the fpga family
* name string associated with a specific version code. The fpga family name is
* returned if a match is found, otherwise "(unknown)".
*
* @code: fpga family version code
*
* Return: Pointer to the fpga family name if the entry is found, otherwise
* "(unknown)".
*/
const char *microblaze_lookup_fpga_family_string(const u32 code);
/**
* microblaze_early_cpuinfo_init() - Initialize cpuinfo with default values.
*
* Initializes the global data cpuinfo structure with default values (cache
* size, cache line size, etc.). It is called very early in the boot process
* (start.S codepath right before the first cache flush call) to ensure that
* cache related operations are properly handled.
*/
void microblaze_early_cpuinfo_init(void);
#endif /* __ASM_MICROBLAZE_CPUINFO_H */
|