2003-07-27 08:21:01 +08:00
|
|
|
/*
|
|
|
|
* Copyright (c) Orbacom Systems, Inc <www.orbacom.com>
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms are freely
|
|
|
|
* permitted provided that the above copyright notice and this
|
|
|
|
* paragraph and the following disclaimer are duplicated in all
|
|
|
|
* such forms.
|
|
|
|
*
|
|
|
|
* This software is provided "AS IS" and without any express or
|
|
|
|
* implied warranties, including, without limitation, the implied
|
|
|
|
* warranties of merchantability and fitness for a particular
|
|
|
|
* purpose.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <common.h>
|
|
|
|
#include <asm/processor.h>
|
|
|
|
#include <image.h>
|
2009-03-29 03:16:16 +08:00
|
|
|
#include <net.h>
|
2003-07-27 08:21:01 +08:00
|
|
|
|
|
|
|
#include <lynxkdi.h>
|
|
|
|
|
2006-04-01 00:32:53 +08:00
|
|
|
DECLARE_GLOBAL_DATA_PTR;
|
|
|
|
|
2005-08-08 18:42:22 +08:00
|
|
|
#if defined(CONFIG_MPC8260) || defined(CONFIG_440EP) || defined(CONFIG_440GR)
|
2011-10-18 19:11:49 +08:00
|
|
|
void lynxkdi_boot(image_header_t *hdr)
|
2003-07-27 08:21:01 +08:00
|
|
|
{
|
2011-10-18 19:11:49 +08:00
|
|
|
void (*lynxkdi)(void) = (void(*)(void))image_get_ep(hdr);
|
2003-07-27 08:21:01 +08:00
|
|
|
lynxos_bootparms_t *parms = (lynxos_bootparms_t *)0x0020;
|
|
|
|
bd_t *kbd;
|
2011-10-18 19:11:49 +08:00
|
|
|
u32 *psz = (u32 *)(image_get_load(hdr) + 0x0204);
|
2003-07-27 08:21:01 +08:00
|
|
|
|
2011-10-18 19:11:49 +08:00
|
|
|
memset(parms, 0, sizeof(*parms));
|
2003-07-27 08:21:01 +08:00
|
|
|
kbd = gd->bd;
|
|
|
|
parms->clock_ref = kbd->bi_busfreq;
|
|
|
|
parms->dramsz = kbd->bi_memsize;
|
2009-02-12 07:54:07 +08:00
|
|
|
eth_getenv_enetaddr("ethaddr", parms->ethaddr);
|
2011-10-18 19:11:49 +08:00
|
|
|
mtspr(SPRN_SPRG2, 0x0020);
|
2003-07-27 08:21:01 +08:00
|
|
|
|
|
|
|
/* Do a simple check for Bluecat so we can pass the
|
|
|
|
* kernel command line parameters.
|
|
|
|
*/
|
2011-10-18 19:11:49 +08:00
|
|
|
/* FIXME: NOT SURE HERE ! */
|
|
|
|
if (le32_to_cpu(*psz) == image_get_data_size(hdr)) {
|
2008-01-09 01:17:10 +08:00
|
|
|
char *args;
|
2011-10-18 19:11:49 +08:00
|
|
|
char *cmdline = (char *)(image_get_load(hdr) + 0x020c);
|
2008-01-09 01:17:10 +08:00
|
|
|
int len;
|
2003-07-27 08:21:01 +08:00
|
|
|
|
2011-10-18 19:11:49 +08:00
|
|
|
printf("Booting Bluecat KDI ...\n");
|
|
|
|
udelay(200*1000); /* Allow serial port to flush */
|
|
|
|
if ((args = getenv("bootargs")) == NULL)
|
2008-01-09 01:17:10 +08:00
|
|
|
args = "";
|
|
|
|
/* Prepend the cmdline */
|
2011-10-18 19:11:49 +08:00
|
|
|
len = strlen(args);
|
|
|
|
if (len && (len + strlen(cmdline) + 2 < (0x0400 - 0x020c))) {
|
|
|
|
memmove(cmdline + strlen(args) + 1, cmdline,
|
|
|
|
strlen(cmdline));
|
|
|
|
strcpy(cmdline, args);
|
2008-01-09 01:17:10 +08:00
|
|
|
cmdline[len] = ' ';
|
|
|
|
}
|
2003-07-27 08:21:01 +08:00
|
|
|
}
|
|
|
|
else {
|
2011-10-18 19:11:49 +08:00
|
|
|
printf("Booting LynxOS KDI ...\n");
|
2003-07-27 08:21:01 +08:00
|
|
|
}
|
|
|
|
|
2011-10-18 19:11:49 +08:00
|
|
|
lynxkdi();
|
2003-07-27 08:21:01 +08:00
|
|
|
}
|
|
|
|
#else
|
|
|
|
#error "Lynx KDI support not implemented for configured CPU"
|
|
|
|
#endif
|