summaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2020-01-26 22:06:27 -0700
committerSimon Glass <sjg@chromium.org>2020-07-20 11:37:47 -0600
commitf07e58b878fc18bd69d2c19075f0fb8d7d35da00 (patch)
treeca468b413f8eee4677bc83c4adf1c118956eacb2 /arch
parent3b9a87321cf5f40ad4c8dac535f94b0cbde19ce2 (diff)
downloadu-boot-f07e58b878fc18bd69d2c19075f0fb8d7d35da00.tar.gz
u-boot-f07e58b878fc18bd69d2c19075f0fb8d7d35da00.tar.xz
u-boot-f07e58b878fc18bd69d2c19075f0fb8d7d35da00.zip
cpu: Convert the methods to use a const udevice *
These functions should not modify the device. Convert them to const so that callers don't need to cast if they have a const udevice *. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'arch')
-rw-r--r--arch/nios2/cpu/cpu.c8
-rw-r--r--arch/x86/cpu/apollolake/cpu.c2
-rw-r--r--arch/x86/cpu/baytrail/cpu.c4
-rw-r--r--arch/x86/cpu/broadwell/cpu_full.c4
-rw-r--r--arch/x86/cpu/cpu_x86.c6
-rw-r--r--arch/x86/cpu/ivybridge/model_206ax.c5
-rw-r--r--arch/x86/cpu/qemu/cpu.c4
-rw-r--r--arch/x86/include/asm/cpu_x86.h6
8 files changed, 21 insertions, 18 deletions
diff --git a/arch/nios2/cpu/cpu.c b/arch/nios2/cpu/cpu.c
index 7f5e731a0f..e7ca9882fc 100644
--- a/arch/nios2/cpu/cpu.c
+++ b/arch/nios2/cpu/cpu.c
@@ -79,7 +79,8 @@ int arch_cpu_init_dm(void)
return 0;
}
-static int altera_nios2_get_desc(struct udevice *dev, char *buf, int size)
+static int altera_nios2_get_desc(const struct udevice *dev, char *buf,
+ int size)
{
const char *cpu_name = "Nios-II";
@@ -90,7 +91,8 @@ static int altera_nios2_get_desc(struct udevice *dev, char *buf, int size)
return 0;
}
-static int altera_nios2_get_info(struct udevice *dev, struct cpu_info *info)
+static int altera_nios2_get_info(const struct udevice *dev,
+ struct cpu_info *info)
{
info->cpu_freq = gd->cpu_clk;
info->features = (1 << CPU_FEAT_L1_CACHE) |
@@ -99,7 +101,7 @@ static int altera_nios2_get_info(struct udevice *dev, struct cpu_info *info)
return 0;
}
-static int altera_nios2_get_count(struct udevice *dev)
+static int altera_nios2_get_count(const struct udevice *dev)
{
return 1;
}
diff --git a/arch/x86/cpu/apollolake/cpu.c b/arch/x86/cpu/apollolake/cpu.c
index aa7a3dbd63..0a6d2ad7a4 100644
--- a/arch/x86/cpu/apollolake/cpu.c
+++ b/arch/x86/cpu/apollolake/cpu.c
@@ -9,7 +9,7 @@
#include <asm/cpu_common.h>
#include <asm/cpu_x86.h>
-static int apl_get_info(struct udevice *dev, struct cpu_info *info)
+static int apl_get_info(const struct udevice *dev, struct cpu_info *info)
{
return cpu_intel_get_info(info, INTEL_BCLK_MHZ);
}
diff --git a/arch/x86/cpu/baytrail/cpu.c b/arch/x86/cpu/baytrail/cpu.c
index 18e48ffa53..309a50a116 100644
--- a/arch/x86/cpu/baytrail/cpu.c
+++ b/arch/x86/cpu/baytrail/cpu.c
@@ -150,7 +150,7 @@ static unsigned long tsc_freq(void)
return bclk * ((platform_info.lo >> 8) & 0xff);
}
-static int baytrail_get_info(struct udevice *dev, struct cpu_info *info)
+static int baytrail_get_info(const struct udevice *dev, struct cpu_info *info)
{
info->cpu_freq = tsc_freq();
info->features = 1 << CPU_FEAT_L1_CACHE | 1 << CPU_FEAT_MMU;
@@ -158,7 +158,7 @@ static int baytrail_get_info(struct udevice *dev, struct cpu_info *info)
return 0;
}
-static int baytrail_get_count(struct udevice *dev)
+static int baytrail_get_count(const struct udevice *dev)
{
int ecx = 0;
diff --git a/arch/x86/cpu/broadwell/cpu_full.c b/arch/x86/cpu/broadwell/cpu_full.c
index 64a1cd414f..706f68f63d 100644
--- a/arch/x86/cpu/broadwell/cpu_full.c
+++ b/arch/x86/cpu/broadwell/cpu_full.c
@@ -626,12 +626,12 @@ void cpu_set_power_limits(int power_limit_1_time)
}
}
-static int broadwell_get_info(struct udevice *dev, struct cpu_info *info)
+static int broadwell_get_info(const struct udevice *dev, struct cpu_info *info)
{
return cpu_intel_get_info(info, INTEL_BCLK_MHZ);
}
-static int broadwell_get_count(struct udevice *dev)
+static int broadwell_get_count(const struct udevice *dev)
{
return 4;
}
diff --git a/arch/x86/cpu/cpu_x86.c b/arch/x86/cpu/cpu_x86.c
index 3f2ba0881e..7e83051646 100644
--- a/arch/x86/cpu/cpu_x86.c
+++ b/arch/x86/cpu/cpu_x86.c
@@ -26,7 +26,7 @@ int cpu_x86_bind(struct udevice *dev)
return 0;
}
-int cpu_x86_get_vendor(struct udevice *dev, char *buf, int size)
+int cpu_x86_get_vendor(const struct udevice *dev, char *buf, int size)
{
const char *vendor = cpu_vendor_name(gd->arch.x86_vendor);
@@ -38,7 +38,7 @@ int cpu_x86_get_vendor(struct udevice *dev, char *buf, int size)
return 0;
}
-int cpu_x86_get_desc(struct udevice *dev, char *buf, int size)
+int cpu_x86_get_desc(const struct udevice *dev, char *buf, int size)
{
char *ptr;
@@ -52,7 +52,7 @@ int cpu_x86_get_desc(struct udevice *dev, char *buf, int size)
return 0;
}
-int cpu_x86_get_count(struct udevice *dev)
+int cpu_x86_get_count(const struct udevice *dev)
{
int node, cpu;
int num = 0;
diff --git a/arch/x86/cpu/ivybridge/model_206ax.c b/arch/x86/cpu/ivybridge/model_206ax.c
index 5954a24873..55f7cc2b2e 100644
--- a/arch/x86/cpu/ivybridge/model_206ax.c
+++ b/arch/x86/cpu/ivybridge/model_206ax.c
@@ -410,14 +410,15 @@ static int model_206ax_init(struct udevice *dev)
return 0;
}
-static int model_206ax_get_info(struct udevice *dev, struct cpu_info *info)
+static int model_206ax_get_info(const struct udevice *dev,
+ struct cpu_info *info)
{
return cpu_intel_get_info(info, INTEL_BCLK_MHZ);
return 0;
}
-static int model_206ax_get_count(struct udevice *dev)
+static int model_206ax_get_count(const struct udevice *dev)
{
return 4;
}
diff --git a/arch/x86/cpu/qemu/cpu.c b/arch/x86/cpu/qemu/cpu.c
index f40fb4d087..9ce86b379c 100644
--- a/arch/x86/cpu/qemu/cpu.c
+++ b/arch/x86/cpu/qemu/cpu.c
@@ -10,7 +10,7 @@
#include <qfw.h>
#include <asm/cpu.h>
-int cpu_qemu_get_desc(struct udevice *dev, char *buf, int size)
+int cpu_qemu_get_desc(const struct udevice *dev, char *buf, int size)
{
if (size < CPU_MAX_NAME_LEN)
return -ENOSPC;
@@ -20,7 +20,7 @@ int cpu_qemu_get_desc(struct udevice *dev, char *buf, int size)
return 0;
}
-static int cpu_qemu_get_count(struct udevice *dev)
+static int cpu_qemu_get_count(const struct udevice *dev)
{
return qemu_fwcfg_online_cpus();
}
diff --git a/arch/x86/include/asm/cpu_x86.h b/arch/x86/include/asm/cpu_x86.h
index ae8f4dcd5d..4fd5f03fdc 100644
--- a/arch/x86/include/asm/cpu_x86.h
+++ b/arch/x86/include/asm/cpu_x86.h
@@ -28,7 +28,7 @@ int cpu_x86_bind(struct udevice *dev);
* @size: Size of string space
* @return: 0 if OK, -ENOSPC if buffer is too small, other -ve on error
*/
-int cpu_x86_get_desc(struct udevice *dev, char *buf, int size);
+int cpu_x86_get_desc(const struct udevice *dev, char *buf, int size);
/**
* cpu_x86_get_count() - Get the number of cores for an x86 CPU
@@ -40,7 +40,7 @@ int cpu_x86_get_desc(struct udevice *dev, char *buf, int size);
* @return: Number of cores if successful,
* -ENOENT if not "/cpus" entry is found in the device tree
*/
-int cpu_x86_get_count(struct udevice *dev);
+int cpu_x86_get_count(const struct udevice *dev);
/**
* cpu_x86_get_vendor() - Get a vendor string for an x86 CPU
@@ -53,6 +53,6 @@ int cpu_x86_get_count(struct udevice *dev);
* @size: Size of string space
* @return: 0 if OK, -ENOSPC if buffer is too small, other -ve on error
*/
-int cpu_x86_get_vendor(struct udevice *dev, char *buf, int size);
+int cpu_x86_get_vendor(const struct udevice *dev, char *buf, int size);
#endif /* _ASM_CPU_X86_H */