From: Stefan Roese <sr@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 2/5] 74xx_7xx: CPCI750: Add loadpci command
Date: Thu, 4 Jun 2009 13:35:36 +0200 [thread overview]
Message-ID: <1244115339-19862-2-git-send-email-sr@denx.de> (raw)
In-Reply-To: <1244115339-19862-1-git-send-email-sr@denx.de>
This command is used to load/boot an OS-image which is transferred from
the CPCI host to the CPCI target/adapter.
Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Reinhard Arlt <reinhard.arlt@esd-electronics.com>
---
board/esd/cpci750/cpci750.c | 76 +++++++++++++++++++++++++++++++++++++++++++
1 files changed, 76 insertions(+), 0 deletions(-)
diff --git a/board/esd/cpci750/cpci750.c b/board/esd/cpci750/cpci750.c
index 4826633..3473504 100644
--- a/board/esd/cpci750/cpci750.c
+++ b/board/esd/cpci750/cpci750.c
@@ -122,6 +122,9 @@ static char show_config_tab[][15] = {{"PCI0DLL_2 "}, /* 31 */
extern flash_info_t flash_info[];
+extern int do_bootm (cmd_tbl_t *, int, int, char *[]);
+extern int do_bootvx (cmd_tbl_t *, int, int, char *[]);
+
/* ------------------------------------------------------------------------- */
/* this is the current GT register space location */
@@ -538,6 +541,79 @@ int display_mem_map (void)
return (0);
}
+/*
+ * Command loadpci: wait for signal from host and boot image.
+ */
+int do_loadpci(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
+{
+ volatile unsigned int *ptr;
+ int count = 0;
+ int count2 = 0;
+ int status;
+ char addr[16];
+ char str[] = "\\|/-";
+ char *local_args[2];
+
+ /*
+ * Mark sync address
+ */
+ ptr = 0;
+ ptr[0] = 0xffffffff;
+ ptr[1] = 0xffffffff;
+ puts("\nWaiting for image from pci host -");
+
+ /*
+ * Wait for host to write the start address
+ */
+ while (*ptr == 0xffffffff) {
+ count++;
+ if (!(count % 100)) {
+ count2++;
+ putc(0x08); /* backspace */
+ putc(str[count2 % 4]);
+ }
+
+ /* Abort if ctrl-c was pressed */
+ if (ctrlc()) {
+ puts("\nAbort\n");
+ return 0;
+ }
+
+ udelay(1000);
+ }
+
+ sprintf(addr, "%08x", *ptr);
+ printf("\nBooting Image at addr 0x%s ...\n", addr);
+ setenv("loadaddr", addr);
+
+ switch (ptr[1] == 0) {
+ case 0:
+ /*
+ * Boot image via bootm
+ */
+ local_args[0] = argv[0];
+ local_args[1] = NULL;
+ status = do_bootm (cmdtp, 0, 1, local_args);
+ break;
+ case 1:
+ /*
+ * Boot image via bootvx
+ */
+ local_args[0] = argv[0];
+ local_args[1] = NULL;
+ status = do_bootvx (cmdtp, 0, 1, local_args);
+ break;
+ }
+
+ return 0;
+}
+
+U_BOOT_CMD(
+ loadpci, 1, 1, do_loadpci,
+ "loadpci - Wait for pci-image and boot it\n",
+ NULL
+ );
+
/* DRAM check routines copied from gw8260 */
#if defined (CONFIG_SYS_DRAM_TEST)
--
1.6.2.5
next prev parent reply other threads:[~2009-06-04 11:35 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-06-04 11:35 [U-Boot] [PATCH 1/5] 74xx_7xx: CPCI750: Add commandline editing/history Stefan Roese
2009-06-04 11:35 ` Stefan Roese [this message]
2009-06-04 17:40 ` [U-Boot] [PATCH 2/5] 74xx_7xx: CPCI750: Add loadpci command Matthias Fuchs
2009-06-05 3:39 ` Stefan Roese
2009-06-05 10:54 ` Matthias Fuchs
2009-06-12 12:53 ` Wolfgang Denk
2009-06-04 11:35 ` [U-Boot] [PATCH 3/5] 74xx_7xx: CPCI750: Minor coding style cleanup of cpci750.c Stefan Roese
2009-06-12 12:54 ` Wolfgang Denk
2009-06-04 11:35 ` [U-Boot] [PATCH 4/5] 74xx_7xx: CPCI750: Enable access to PCI function > 0 Stefan Roese
2009-06-04 17:43 ` Matthias Fuchs
2009-06-04 11:35 ` [U-Boot] [PATCH 5/5] 74xx_7xx: CPCI750: Add CPCI adapter/target support Stefan Roese
2009-06-12 12:56 ` Wolfgang Denk
2009-06-12 12:52 ` [U-Boot] [PATCH 1/5] 74xx_7xx: CPCI750: Add commandline editing/history Wolfgang Denk
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=1244115339-19862-2-git-send-email-sr@denx.de \
--to=sr@denx.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox