summaryrefslogtreecommitdiffstats
path: root/qemu/roms/u-boot/common/lynxkdi.c
diff options
context:
space:
mode:
authorYang Zhang <yang.z.zhang@intel.com>2015-08-28 09:58:54 +0800
committerYang Zhang <yang.z.zhang@intel.com>2015-09-01 12:44:00 +0800
commite44e3482bdb4d0ebde2d8b41830ac2cdb07948fb (patch)
tree66b09f592c55df2878107a468a91d21506104d3f /qemu/roms/u-boot/common/lynxkdi.c
parent9ca8dbcc65cfc63d6f5ef3312a33184e1d726e00 (diff)
Add qemu 2.4.0
Change-Id: Ic99cbad4b61f8b127b7dc74d04576c0bcbaaf4f5 Signed-off-by: Yang Zhang <yang.z.zhang@intel.com>
Diffstat (limited to 'qemu/roms/u-boot/common/lynxkdi.c')
-rw-r--r--qemu/roms/u-boot/common/lynxkdi.c70
1 files changed, 70 insertions, 0 deletions
diff --git a/qemu/roms/u-boot/common/lynxkdi.c b/qemu/roms/u-boot/common/lynxkdi.c
new file mode 100644
index 000000000..22ad384ef
--- /dev/null
+++ b/qemu/roms/u-boot/common/lynxkdi.c
@@ -0,0 +1,70 @@
+/*
+ * 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>
+#include <net.h>
+
+#include <lynxkdi.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+#if defined(CONFIG_MPC8260) || defined(CONFIG_440EP) || defined(CONFIG_440GR)
+void lynxkdi_boot(image_header_t *hdr)
+{
+ void (*lynxkdi)(void) = (void(*)(void))image_get_ep(hdr);
+ lynxos_bootparms_t *parms = (lynxos_bootparms_t *)0x0020;
+ bd_t *kbd;
+ u32 *psz = (u32 *)(image_get_load(hdr) + 0x0204);
+
+ memset(parms, 0, sizeof(*parms));
+ kbd = gd->bd;
+ parms->clock_ref = kbd->bi_busfreq;
+ parms->dramsz = kbd->bi_memsize;
+ eth_getenv_enetaddr("ethaddr", parms->ethaddr);
+ mtspr(SPRN_SPRG2, 0x0020);
+
+ /* Do a simple check for Bluecat so we can pass the
+ * kernel command line parameters.
+ */
+ /* FIXME: NOT SURE HERE ! */
+ if (le32_to_cpu(*psz) == image_get_data_size(hdr)) {
+ char *args;
+ char *cmdline = (char *)(image_get_load(hdr) + 0x020c);
+ int len;
+
+ printf("Booting Bluecat KDI ...\n");
+ udelay(200*1000); /* Allow serial port to flush */
+ if ((args = getenv("bootargs")) == NULL)
+ args = "";
+ /* Prepend the cmdline */
+ len = strlen(args);
+ if (len && (len + strlen(cmdline) + 2 < (0x0400 - 0x020c))) {
+ memmove(cmdline + strlen(args) + 1, cmdline,
+ strlen(cmdline));
+ strcpy(cmdline, args);
+ cmdline[len] = ' ';
+ }
+ }
+ else {
+ printf("Booting LynxOS KDI ...\n");
+ }
+
+ lynxkdi();
+}
+#else
+#error "Lynx KDI support not implemented for configured CPU"
+#endif