[U-Boot-Users] How can I get board information(u-boot saved) from linux kernel

Clemens Koller clemens.koller at anagramm.de
Wed Jun 15 15:42:32 CEST 2005


Hi, jie!

Well, almost off-topic as you asked in the u-boot-list
But just browse the source: checkout some platform code for i.e.

"bd_t" and "__res"

Depending on your platform, it's picked up in the platform-setup file. i.e.:
in arch/ppc/syslib/ppc4xx_setup.c lines:

218 /*
219  * Input(s):
220  *   r3 - Optional pointer to a board information structure.
221  *   r4 - Optional pointer to the physical starting address of the init RAM
222  *        disk.
223  *   r5 - Optional pointer to the physical ending address of the init RAM
224  *        disk.
225  *   r6 - Optional pointer to the physical starting address of any kernel
226  *        command-line parameters.
227  *   r7 - Optional pointer to the physical ending address of any kernel
228  *        command-line parameters.
229  */
230 void __init
231 ppc4xx_init(unsigned long r3, unsigned long r4, unsigned long r5,
232             unsigned long r6, unsigned long r7)
233 {
234         parse_bootinfo(find_bootinfo());
235 
236         /*
237          * If we were passed in a board information, copy it into the
238          * residual data area.
239          */
240         if (r3)
241                 __res = *(bd_t *)(r3 + KERNELBASE);
and so on...

-------------------------------
To use it in your code try something like:
#include <linux/init.h>
#include <asm/io.h>
#include <asm/mpc85xx.h>

...
        bd_t *binfo=(bd_t *) __res;

        DBG("Size of BoardInfo structure: %i\n",sizeof(bd_t));

        DBG("CPU Frequency:      %luMHz\n",binfo->bi_intfreq/1000000);
        DBG("DRAM start:         %0lX\n",binfo->bi_memstart);
        DBG("DRAM size (bytes):  %0lX\n",binfo->bi_memsize);
        DBG("FLASH start:        %0lX\n",binfo->bi_flashstart);
        DBG("FLASH size (bytes): %0lX\n",binfo->bi_flashsize);
        DBG("FLASH offset:       %0lX\n",binfo->bi_flashoffset);
        DBG("SRAM start:         %0lX\n",binfo->bi_sramstart);
        DBG("SRAM size (bytes):  %0lX\n",binfo->bi_sramsize);
        DBG("IMMR base:          %0lX\n",binfo->bi_immr_base);

        DBG("PVR                 %0X\n",mfspr(PVR));
        DBG("SVR                 %0X\n",mfspr(SVR));

------------------------

But you might consider using the new OpenFirmware structure
to acces bios/boot information on ppc and friends... checkout
the lastest OF Patches for that.

Greets,

Clemens Koller
_______________________________
R&D Imaging Devices
Anagramm GmbH
Rupert-Mayer-Str. 45/1
81379 Muenchen
Germany

http://www.anagramm.de
Phone: +49-89-741518-50
Fax: +49-89-741518-19




jie han wrote:
> I am new to U-Boot, I checked
> file:\include\asm\u-boot.h,it's defined struct
> bd_info,this struct store board information passed to
> linux kernel.How can I get this struct from linux
> kernel? 
> If anyone knows of a way to get U-Boot saved board
> information from linux kernel,give me a hint,thanks
> advance.
> 
> Sincerely,
> 
> Jie
> 
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection around 
> http://mail.yahoo.com 
> 
> 
> -------------------------------------------------------
> SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
> from IBM. Find simple to follow Roadmaps, straightforward articles,
> informative Webcasts and more! Get everything you need to get up to
> speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
> _______________________________________________
> U-Boot-Users mailing list
> U-Boot-Users at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/u-boot-users
> 




More information about the U-Boot mailing list