]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
cpu: Add cpu_probe_all method
authorMario Six <mario.six@gdsys.cc>
Mon, 6 Aug 2018 08:23:43 +0000 (10:23 +0200)
committerSimon Glass <sjg@chromium.org>
Tue, 18 Sep 2018 14:12:21 +0000 (08:12 -0600)
Add a method to probe all CPUs of the board.

Signed-off-by: Mario Six <mario.six@gdsys.cc>
drivers/cpu/cpu-uclass.c
include/cpu.h

index f362eb11e7220ab7b9ae370f14a82c64a2e7cff9..457f77b7c89a45f6e4afb24686e895e1e9dcdf1a 100644 (file)
 #include <dm/lists.h>
 #include <dm/root.h>
 
+int cpu_probe_all(void)
+{
+       struct udevice *cpu;
+       int ret;
+
+       ret = uclass_first_device(UCLASS_CPU, &cpu);
+       if (ret) {
+               debug("%s: No CPU found (err = %d)\n", __func__, ret);
+               return ret;
+       }
+
+       while (cpu) {
+               ret = uclass_next_device(&cpu);
+               if (ret) {
+                       debug("%s: Error while probing CPU (err = %d)\n",
+                             __func__, ret);
+                       return ret;
+               }
+       }
+
+       return 0;
+}
+
 int cpu_get_desc(struct udevice *dev, char *buf, int size)
 {
        struct cpu_ops *ops = cpu_get_ops(dev);
index 22467cb9b3a42316ceb79cf030619e2622508009..367c5f46a00f8499f93027653946c15bc75c4033 100644 (file)
@@ -125,4 +125,11 @@ int cpu_get_count(struct udevice *dev);
  */
 int cpu_get_vendor(struct udevice *dev, char *buf, int size);
 
+/**
+ * cpu_probe_all() - Probe all available CPUs
+ *
+ * Return: 0 if OK, -ve on error
+ */
+int cpu_probe_all(void);
+
 #endif