From: Clemens Koller <clemens.koller@anagramm.de>
To: u-boot@lists.denx.de
Subject: [U-Boot-Users] How can I get board information(u-boot saved) from linux kernel
Date: Wed, 15 Jun 2005 15:42:32 +0200 [thread overview]
Message-ID: <42B03048.7080105@anagramm.de> (raw)
In-Reply-To: <20050615030229.99963.qmail@web15101.mail.cnb.yahoo.com>
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
>
prev parent reply other threads:[~2005-06-15 13:42 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-06-15 3:02 [U-Boot-Users] How can I get board information(u-boot saved) from linux kernel jie han
2005-06-15 13:42 ` Clemens Koller [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=42B03048.7080105@anagramm.de \
--to=clemens.koller@anagramm.de \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.