Discussion:
who fill the structure "machine_desc"
Ray Zhao
2005-08-15 20:58:13 UTC
Permalink
Hi, there

There is a function named "void __init setup_arch(char **cmdline_p)"
in the file arch/arm/kernel/setup.c.

void __init setup_arch(char **cmdline_p)
{
struct tag *tags = (struct tag *)&init_tags;
struct machine_desc *mdesc;
char *from = default_command_line;

setup_processor();
mdesc = setup_machine(machine_arch_type);
....................
The function setup_machine() called lookup_machine_type() in Head.S
eventually. The return type is a structure machine_desc. What I can
not understand here is that who fill the structure? The
lookup_machine_type just check the memory r5 point to and compare with
r1 to check if it is the right machine, and then return the memory
address. This memory address will be cast to the machine_desc pointer.
But who fill that memory? The linker? If it is the linker, where are
this information presented in the source code so that I can control
it?
I need to make it clear because in my board and linux, I found out the
field mdesc->param_offset is zero, so my kernel do not go to check the
parameters come from the Bootloader, and use the default tags which is
useless. How could I make mdesc->param_offset to be the value of the
0xa0000100? I tried to give the value just before it check the
mdesc->param_offset, the kernel works great and get the parameters
right. But it is too ugly to directly set up the value here...

Please help ..

Ray
--
---------------------------------------------------------------
Everything that has a beginning has an end.

-------------------------------------------------------------------
List admin: http://lists.arm.linux.org.uk/mailman/listinfo/linux-arm-kernel
FAQ: http://www.arm.linux.org.uk/mailinglists/faq.php
Etiquette: http://www.arm.linux.org.uk/mailinglists/etiquette.php
Dimitry Andric
2005-08-15 21:36:54 UTC
Permalink
Post by Ray Zhao
eventually. The return type is a structure machine_desc. What I can
not understand here is that who fill the structure?
You, by providing a mach-xxx.c or board-xxx.c file somewhere, which
has a definition similar to the following example, copy/pasted from
arch/arm/mach-s3c2410/mach-bast.c:

MACHINE_START(BAST, "Simtec-BAST")
MAINTAINER("Ben Dooks <***@simtec.co.uk>")
BOOT_MEM(S3C2410_SDRAM_PA, S3C2410_PA_UART, (u32)S3C24XX_VA_UART)
BOOT_PARAMS(S3C2410_SDRAM_PA + 0x100)
MAPIO(bast_map_io)
INITIRQ(bast_init_irq)
.init_machine = bast_init_machine,
.timer = &s3c24xx_timer,
MACHINE_END

These macros are defined in include/asm-arm/mach/arch.h.
Ray Zhao
2005-08-16 02:10:56 UTC
Permalink
That's exactly what I am looking for. Thanks soooooooooooooo much.

ray
Post by Dimitry Andric
Post by Ray Zhao
eventually. The return type is a structure machine_desc. What I can
not understand here is that who fill the structure?
You, by providing a mach-xxx.c or board-xxx.c file somewhere, which
has a definition similar to the following example, copy/pasted from
MACHINE_START(BAST, "Simtec-BAST")
BOOT_MEM(S3C2410_SDRAM_PA, S3C2410_PA_UART, (u32)S3C24XX_VA_UART)
BOOT_PARAMS(S3C2410_SDRAM_PA + 0x100)
MAPIO(bast_map_io)
INITIRQ(bast_init_irq)
.init_machine = bast_init_machine,
.timer = &s3c24xx_timer,
MACHINE_END
These macros are defined in include/asm-arm/mach/arch.h.
--
---------------------------------------------------------------
Everything that has a beginning has an end.

-------------------------------------------------------------------
List admin: http://lists.arm.linux.org.uk/mailman/listinfo/linux-arm-kernel
FAQ: http://www.arm.linux.org.uk/mailinglists/faq.php
Etiquette: http://www.arm.linux.org.uk/mailinglists/etiquette.php
Loading...