diff mbox series

[U-Boot] x86: enable cpu-specific functions for x86_64 target

Message ID 20180525220035.GA61257@intel.com
State Deferred
Delegated to: Bin Meng
Headers show
Series [U-Boot] x86: enable cpu-specific functions for x86_64 target | expand

Commit Message

Ivan Gorinov May 25, 2018, 10 p.m. UTC
Add __weak prefix to the following functions to allow override:
misc_init_r(), checkcpu(), print_cpuinfo().

Signed-off-by: Ivan Gorinov <ivan.gorinov@intel.com>
---
 arch/x86/cpu/x86_64/cpu.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Simon Glass May 27, 2018, 12:53 a.m. UTC | #1
Hi Ivan,

On 25 May 2018 at 16:00, Ivan Gorinov <ivan.gorinov@intel.com> wrote:
> Add __weak prefix to the following functions to allow override:
> misc_init_r(), checkcpu(), print_cpuinfo().
>
> Signed-off-by: Ivan Gorinov <ivan.gorinov@intel.com>
> ---
>  arch/x86/cpu/x86_64/cpu.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/arch/x86/cpu/x86_64/cpu.c b/arch/x86/cpu/x86_64/cpu.c
> index 18b3e94..6f14efc 100644
> --- a/arch/x86/cpu/x86_64/cpu.c
> +++ b/arch/x86/cpu/x86_64/cpu.c
> @@ -59,17 +59,17 @@ int x86_mp_init(void)
>         return 0;
>  }
>
> -int misc_init_r(void)
> +__weak int misc_init_r(void)
>  {
>         return 0;
>  }
>
> -int checkcpu(void)
> +__weak int checkcpu(void)
>  {
>         return 0;
>  }
>
> -int print_cpuinfo(void)
> +__weak int print_cpuinfo(void)
>  {
>         return 0;
>  }
> --
> 2.7.4
>

We should do with with a different CPU driver I think. What exactly is
the problem?

Regards,
Simon
Andy Shevchenko May 28, 2018, 12:01 p.m. UTC | #2
On Sat, 2018-05-26 at 18:53 -0600, Simon Glass wrote:


> We should do with with a different CPU driver I think. What exactly is
> the problem?

+1.

The approach feels wrong. It looks like whatever you are going to add
later needs actually a fully-established folder under arch/x86/cpu
rather than (dirty) hacks here and there.
Ivan Gorinov May 30, 2018, 5:53 p.m. UTC | #3
On Sat, May 26, 2018 at 06:53:40PM -0600, Simon Glass wrote:
> Hi Ivan,
> 
> On 25 May 2018 at 16:00, Ivan Gorinov <ivan.gorinov@intel.com> wrote:
> > Add __weak prefix to the following functions to allow override:
> > misc_init_r(), checkcpu(), print_cpuinfo().
> >
> > Signed-off-by: Ivan Gorinov <ivan.gorinov@intel.com>
> > ---
> >  arch/x86/cpu/x86_64/cpu.c | 6 +++---
> >  1 file changed, 3 insertions(+), 3 deletions(-)
> >
> > diff --git a/arch/x86/cpu/x86_64/cpu.c b/arch/x86/cpu/x86_64/cpu.c
> > index 18b3e94..6f14efc 100644
> > --- a/arch/x86/cpu/x86_64/cpu.c
> > +++ b/arch/x86/cpu/x86_64/cpu.c
> > @@ -59,17 +59,17 @@ int x86_mp_init(void)
> >         return 0;
> >  }
> >
> > -int misc_init_r(void)
> > +__weak int misc_init_r(void)
> >  {
> >         return 0;
> >  }
> >
> > -int checkcpu(void)
> > +__weak int checkcpu(void)
> >  {
> >         return 0;
> >  }
> >
> > -int print_cpuinfo(void)
> > +__weak int print_cpuinfo(void)
> >  {
> >         return 0;
> >  }
> > --
> > 2.7.4
> >
> 
> We should do with with a different CPU driver I think. What exactly is
> the problem?

When I change a Minnowboard configuration (baytrail) to run in 64-bit mode,
there are two conflicting definitions of misc_init_r():

  arch/x86/cpu/x86_64/cpu.c
  board/intel/minnowmax/minnowmax.c

On other CPU models, functions checkcpu() and print_cpuinfo() conflict with
model-specific definitions for Tangier, Ivy Bridge, Broadwell, Quark.
diff mbox series

Patch

diff --git a/arch/x86/cpu/x86_64/cpu.c b/arch/x86/cpu/x86_64/cpu.c
index 18b3e94..6f14efc 100644
--- a/arch/x86/cpu/x86_64/cpu.c
+++ b/arch/x86/cpu/x86_64/cpu.c
@@ -59,17 +59,17 @@  int x86_mp_init(void)
 	return 0;
 }
 
-int misc_init_r(void)
+__weak int misc_init_r(void)
 {
 	return 0;
 }
 
-int checkcpu(void)
+__weak int checkcpu(void)
 {
 	return 0;
 }
 
-int print_cpuinfo(void)
+__weak int print_cpuinfo(void)
 {
 	return 0;
 }