Hello Surej,

> /*
>  * Work out if we need multiple CPU support
>  */
> #undef MULTI_CPU
> #undef CPU_NAME
> 
> /*
>  * CPU_NAME - the prefix for CPU related functions
>  */
> 
> # ifdef CONFIG_CPU_ARM7TDMI
> #  ifdef CPU_NAME
> #   undef  MULTI_CPU
> #   define MULTI_CPU
> #  else
> #   define CPU_NAME cpu_arm7tdmi
> #  endif
> # endif
> 
> In the beginning of the header file MULTI_CPU and CPU_NAME has been
> undefined. My question is if they have been undefined, what is the
> significance of the code #ifdef CPU_NAME?

The above looks weird to me as well.



> Also i would like to know
> the significance of __catify_fn.
> 
> /*
>  * Single CPU
>  */
> #ifdef __STDC__
> #define __catify_fn(name,x)    name##x
> #else
> #define __catify_fn(name,x)    name/**/x
> #endif
> #define __cpu_fn(name,x)    __catify_fn(name,x)

This is a simple jugglery such that __catify_fn always results in concatenation 
of name & x (whether the compiler supports standard C preprocessor 
concatenation or not).

> 
> /*
>  * If we are supporting multiple CPUs, then we must use a table of
>  * function pointers for this lot.  Otherwise, we can optimise the
>  * table away.
>  */
> #define cpu_proc_init            __cpu_fn(CPU_NAME,_proc_init)
> 

If you look closely, in case of a single CPU machine, cpu_proc_init is a 
preprocessor will expand directly to that processor's init function. But in 
case of multiprocessor machine, it will expand like this:

#define cpu_proc_init()             processor._proc_init()

The variable "processor" is initialized like this (arch/arm26/kernel/setup.c: 
setup_processor()):

for (list = &__proc_info_begin; list < &__proc_info_end ; list++)
    if ((processor_id & list->cpu_mask) == list->cpu_val)
        break;

/*
 * If processor type is unrecognised, then we
 * can do nothing...
 */
if (list >= &__proc_info_end) {
    printk("CPU configuration botched (ID %08x), unable "
           "to continue.\n", processor_id);
    while (1);
}

processor = *list->proc;

The variables __proc_info_begin & __proc_info_end would be defined in linker 
script.

Thanks,

Rajat

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to [EMAIL PROTECTED]
Please read the FAQ at http://kernelnewbies.org/FAQ

Reply via email to