From 166c3984e6b1271c2e31ff0528ad65aadc913860 Mon Sep 17 00:00:00 2001 From: Bin Meng Date: Fri, 12 Jun 2015 14:52:18 +0800 Subject: dm: cpu: Fix undefined ENOSYS build error Include otherwise ENOSYS is undefined. Signed-off-by: Bin Meng Acked-by: Simon Glass --- drivers/cpu/cpu-uclass.c | 1 + 1 file changed, 1 insertion(+) (limited to 'drivers/cpu') diff --git a/drivers/cpu/cpu-uclass.c b/drivers/cpu/cpu-uclass.c index ab18ee2ea93..aa0267ca03e 100644 --- a/drivers/cpu/cpu-uclass.c +++ b/drivers/cpu/cpu-uclass.c @@ -8,6 +8,7 @@ #include #include #include +#include #include #include -- cgit v1.2.3 From cb5cbfd503d38bfe963ebd52da958563c636709d Mon Sep 17 00:00:00 2001 From: Bin Meng Date: Fri, 12 Jun 2015 14:52:19 +0800 Subject: dm: cpu: Test against cpu_ops->get_info in cpu_get_info() In cpu_get_info() it wrongly tests against cpu_ops->get_desc to see if it is NULL. It should test against cpu_ops->get_info. Signed-off-by: Bin Meng --- drivers/cpu/cpu-uclass.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/cpu') diff --git a/drivers/cpu/cpu-uclass.c b/drivers/cpu/cpu-uclass.c index aa0267ca03e..d6be9d4dcf5 100644 --- a/drivers/cpu/cpu-uclass.c +++ b/drivers/cpu/cpu-uclass.c @@ -26,7 +26,7 @@ int cpu_get_info(struct udevice *dev, struct cpu_info *info) { struct cpu_ops *ops = cpu_get_ops(dev); - if (!ops->get_desc) + if (!ops->get_info) return -ENOSYS; return ops->get_info(dev, info); -- cgit v1.2.3 From 780bfdd3c72a058ba24cda0df66ca75f0a7d8b18 Mon Sep 17 00:00:00 2001 From: Bin Meng Date: Wed, 17 Jun 2015 11:15:34 +0800 Subject: dm: cpu: Add a new get_count method to cpu uclass Introduce a new method 'get_count' in the UCLASS_CPU ops to get the number of CPUs in the system. Signed-off-by: Bin Meng Acked-by: Simon Glass --- drivers/cpu/cpu-uclass.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'drivers/cpu') diff --git a/drivers/cpu/cpu-uclass.c b/drivers/cpu/cpu-uclass.c index d6be9d4dcf5..a2814a8dcf5 100644 --- a/drivers/cpu/cpu-uclass.c +++ b/drivers/cpu/cpu-uclass.c @@ -32,6 +32,16 @@ int cpu_get_info(struct udevice *dev, struct cpu_info *info) return ops->get_info(dev, info); } +int cpu_get_count(struct udevice *dev) +{ + struct cpu_ops *ops = cpu_get_ops(dev); + + if (!ops->get_count) + return -ENOSYS; + + return ops->get_count(dev); +} + U_BOOT_DRIVER(cpu_bus) = { .name = "cpu_bus", .id = UCLASS_SIMPLE_BUS, -- cgit v1.2.3 From 6e6f4ce4f82501e35301322872152fe28846d743 Mon Sep 17 00:00:00 2001 From: Bin Meng Date: Wed, 17 Jun 2015 11:15:36 +0800 Subject: x86: Move MP initialization codes into a common place Most of the MP initialization codes in arch/x86/cpu/baytrail/cpu.c is common to all x86 processors, except detect_num_cpus() which varies from cpu to cpu. Move these to arch/x86/cpu/cpu.c and implement the new 'get_count' method for baytrail and cpu_x86 drivers. Now we call cpu_get_count() in mp_init() to get the number of CPUs. Signed-off-by: Bin Meng Acked-by: Simon Glass --- drivers/cpu/cpu-uclass.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'drivers/cpu') diff --git a/drivers/cpu/cpu-uclass.c b/drivers/cpu/cpu-uclass.c index a2814a8dcf5..7660f99ef59 100644 --- a/drivers/cpu/cpu-uclass.c +++ b/drivers/cpu/cpu-uclass.c @@ -12,6 +12,8 @@ #include #include +DECLARE_GLOBAL_DATA_PTR; + int cpu_get_desc(struct udevice *dev, char *buf, int size) { struct cpu_ops *ops = cpu_get_ops(dev); -- cgit v1.2.3