diff options
author | Mario Six <mario.six@gdsys.cc> | 2018-08-06 10:23:43 +0200 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2018-09-18 08:12:21 -0600 |
commit | 57370de377340b0fcb81d90a187aa8b8f3494447 (patch) | |
tree | 1eeef92a8013e1708079c73e9db3ef58552aea1e /drivers/cpu | |
parent | 50d188b9557f394b77f87561c71173c060953628 (diff) | |
download | u-boot-57370de377340b0fcb81d90a187aa8b8f3494447.tar.gz |
cpu: Add cpu_probe_all method
Add a method to probe all CPUs of the board.
Signed-off-by: Mario Six <mario.six@gdsys.cc>
Diffstat (limited to 'drivers/cpu')
-rw-r--r-- | drivers/cpu/cpu-uclass.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/drivers/cpu/cpu-uclass.c b/drivers/cpu/cpu-uclass.c index f362eb11e7..457f77b7c8 100644 --- a/drivers/cpu/cpu-uclass.c +++ b/drivers/cpu/cpu-uclass.c @@ -11,6 +11,29 @@ #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); |