File: [local] / prex-old / boot / avr32 / ngw100 / bootinfo.c (download)
Revision 1.2, Tue Jul 15 22:56:23 2008 UTC (16 years, 1 month ago) by nbrk
Branch: MAIN
CVS Tags: HEAD Changes since 1.1: +19 -3 lines
try to fetch start and size of onboard physical memory from u-boot instead of
hardcoding it here
|
/*
* $Id: bootinfo.c,v 1.2 2008/07/15 22:56:23 nbrk Exp $
*/
/*-
* Copyright (c) 2005, Kohsuke Ohtani
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the author nor the names of any co-contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include <boot.h>
#include <platform.h>
#include <uboot.h>
/*
* Setup boot information.
*/
void
setup_bootinfo(struct boot_info **bpp)
{
struct boot_info *bp;
struct uboot_cframe *ucfp;
bp = (struct boot_info *)BOOT_INFO;
memset(bp, 0, BOOT_INFO_SIZE);
bp->archive = (u_long)ARCHIVE_START;
/* video? huh. */
bp->video.text_x = 0;
bp->video.text_y = 0;
/*
* Try to ask first stage bootloader about physical memory.
*/
printk("setup_bootinfo: fetching boot_params @0x%x", BOOT_PARAMS);
ucfp = uboot_map(BOOT_PARAMS);
if (ucfp != NULL) {
bp->main_mem.start = ucfp->ucf_memstart;
bp->main_mem.size = ucfp->ucf_memsize;
} else {
/* use defaults */
bp->main_mem.start = 0x10000000;
bp->main_mem.size = 0x02000000; /* 32MB */
}
printk("setup_bootinfo: main memory start=%x size=%x (using %s values)\n",
(int)boot_info->main_mem.start,
(int)boot_info->main_mem.size,
ucfp == NULL ? "default" : "u-boot");
*bpp = bp;
}