Skip to content

Commit f2c306c

Browse files
Zhiqiang-Houfabioestevam
authored andcommitted
cpu: add release_core callback
Add a new callback release_core to the cpu_ops, which is used to release a CPU core to run baremetal or RTOS application on a SoC with multiple CPU cores. Signed-off-by: Hou Zhiqiang <Zhiqiang.Hou@nxp.com> Reviewed-by: Simon Glass <sjg@chromium.org>
1 parent 3cdcdce commit f2c306c

2 files changed

Lines changed: 25 additions & 0 deletions

File tree

drivers/cpu/cpu-uclass.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,16 @@ int cpu_get_vendor(const struct udevice *dev, char *buf, int size)
104104
return ops->get_vendor(dev, buf, size);
105105
}
106106

107+
int cpu_release_core(const struct udevice *dev, phys_addr_t addr)
108+
{
109+
struct cpu_ops *ops = cpu_get_ops(dev);
110+
111+
if (!ops->release_core)
112+
return -ENOSYS;
113+
114+
return ops->release_core(dev, addr);
115+
}
116+
107117
U_BOOT_DRIVER(cpu_bus) = {
108118
.name = "cpu_bus",
109119
.id = UCLASS_SIMPLE_BUS,

include/cpu.h

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,15 @@ struct cpu_ops {
102102
* if not.
103103
*/
104104
int (*is_current)(struct udevice *dev);
105+
106+
/**
107+
* release_core() - Relase a CPU core to the given address to run application
108+
*
109+
* @dev: Device to check (UCLASS_CPU)
110+
* @addr: Address to relese the CPU core
111+
* @return 0 if OK, -ve on error
112+
*/
113+
int (*release_core)(const struct udevice *dev, phys_addr_t addr);
105114
};
106115

107116
#define cpu_get_ops(dev) ((struct cpu_ops *)(dev)->driver->ops)
@@ -164,4 +173,10 @@ int cpu_is_current(struct udevice *cpu);
164173
*/
165174
struct udevice *cpu_get_current_dev(void);
166175

176+
/**
177+
* cpu_release_core() - Relase a CPU core to the given address to run application
178+
*
179+
* @return 0 if OK, -ve on error
180+
*/
181+
int cpu_release_core(const struct udevice *dev, phys_addr_t addr);
167182
#endif

0 commit comments

Comments
 (0)