diff mbox series

[V2,2/9] cpu: sandbox: support is_current

Message ID 20200501134418.7319-2-peng.fan@nxp.com
State Superseded
Headers show
Series [V2,1/9] uclass: cpu: Add new API to get udevice for current CPU | expand

Commit Message

Peng Fan May 1, 2020, 1:44 p.m. UTC
Support querying whether U-Boot is running on current cpu

Signed-off-by: Peng Fan <peng.fan at nxp.com>
---

V2:
 New

 drivers/cpu/cpu_sandbox.c | 9 +++++++++
 1 file changed, 9 insertions(+)

Comments

Simon Glass May 3, 2020, 2:26 a.m. UTC | #1
On Fri, 1 May 2020 at 07:22, Peng Fan <peng.fan at nxp.com> wrote:
>
> Support querying whether U-Boot is running on current cpu
>
> Signed-off-by: Peng Fan <peng.fan at nxp.com>
> ---
>
> V2:
>  New
>
>  drivers/cpu/cpu_sandbox.c | 9 +++++++++
>  1 file changed, 9 insertions(+)

Reviewed-by: Simon Glass <sjg at chromium.org>
diff mbox series

Patch

diff --git a/drivers/cpu/cpu_sandbox.c b/drivers/cpu/cpu_sandbox.c
index 05b384f6a4..30a12e5a53 100644
--- a/drivers/cpu/cpu_sandbox.c
+++ b/drivers/cpu/cpu_sandbox.c
@@ -36,11 +36,20 @@  int cpu_sandbox_get_vendor(struct udevice *dev, char *buf, int size)
 	return 0;
 }
 
+int cpu_sandbox_is_current(struct udevice *dev)
+{
+	if (!strcmp(dev->name, "cpu-test1"))
+		return 1;
+
+	return 0;
+}
+
 static const struct cpu_ops cpu_sandbox_ops = {
 	.get_desc = cpu_sandbox_get_desc,
 	.get_info = cpu_sandbox_get_info,
 	.get_count = cpu_sandbox_get_count,
 	.get_vendor = cpu_sandbox_get_vendor,
+	.is_current = cpu_sandbox_is_current,
 };
 
 int cpu_sandbox_probe(struct udevice *dev)