Skip to contentSkip to conversation

vxworks: Add CONFIG_VXWORKS_PREBOOT

PATCH New Niklaus Giger 2 participants 2 messages Sep 23, 2009 – Oct 18, 2009

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 vxworks: Add CONFIG_VXWORKS_PREBOOT

The option CONFIG_VXWORKS_PREBOOT allows a board specific vxworks_preboot to be run just before jumping into the vxWorks images. This can be used to alter a register which is used differently by U-boot and vxWorks.

The patch defines a weak function which may be overridden by a board specific version. vxworks_preboot should return 0 to indicated that everything worked fine. The error code is checked and the vxWorks image will not be loaded in case of errors.

---
 board/netstal/mcu25/mcu25.c |    8 ++++++++
 common/cmd_elf.c            |   11 +++++++++++
 include/vxworks.h           |    2 ++
 3 files changed, 21 insertions(+), 0 deletions(-)
board/netstal/mcu25/mcu25.c +8 -0
index 9054282..d64194d 100644
@@ -53,6 +53,7 @@ DECLARE_GLOBAL_DATA_PTR;
  */
 #define CPC0_CR0_VALUE	0x0007F03C
 #define CPC0_CR1_VALUE	0x00004051
+#define CPCO_CR1_USE_EXTERNAL  0x00804051
 
 int board_early_init_f (void)
 {
@@ -161,6 +162,13 @@ int misc_init_r(void)
 	return 0;
 }
 
+int vxworks_preboot(void) {
+	if (sys_install_requested()) {
+		mtdcr(CPC0_CR1, CPCO_CR1_USE_EXTERNAL);
+	}
+	return 0;
+}
+
 phys_size_t initdram(int board_type)
 {
 	unsigned int dram_size = 64*1024*1024;
common/cmd_elf.c +11 -0
index 63f6fe7..c8eb88a 100644
@@ -53,6 +53,11 @@ unsigned long do_bootelf_exec (ulong (*entry)(int, char *[]), int argc, char *ar
 	return ret;
 }
 
+__attribute__((weak)) int vxworks_preboot(void)
+{
+	return 0;
+}
+
 /* ======================================================================
  * Interpreter command to boot an arbitrary ELF image from memory.
  * ====================================================================== */
@@ -100,6 +105,7 @@ int do_bootvx (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 	char *bootline;			/* Text of the bootline        */
 	char *tmp;			/* Temporary char pointer      */
 	char build_buf[128];		/* Buffer for building the bootline */
+	int  rc;			/* Checking vxworks_preboot */
 
 	/* ---------------------------------------------------
 	 *
@@ -211,6 +217,11 @@ int do_bootvx (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 
 	printf ("## Using bootline (@ 0x%lx): %s\n", bootaddr,
 			(char *) bootaddr);
+	rc = vxworks_preboot();
+	if (rc != 0) {
+		printf ("## vxworks_preboot failed with %d\n", rc);
+		return 1;
+	}
 	printf ("## Starting vxWorks at 0x%08lx ...\n", addr);
 
 	((void (*)(void)) addr) ();
include/vxworks.h +2 -0
index 1633904..2edbf8e 100644
@@ -50,4 +50,6 @@ int do_bootvx(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]);
 #define CONFIG_SYS_VXWORKS_SERVERNAME	"srv"
 #endif
 
+int vxworks_preboot(void);
+
 #endif
Signature · 1 line
1.6.3.3
#1 lore raw

PATCH v2 1/1 vxworks: Add CONFIG_VXWORKS_PREBOOT

Dear Niklaus Giger,

Quoted 10 lines · In message <[email protected]> you…

The option CONFIG_VXWORKS_PREBOOT allows a board specific vxworks_preboot to be run just before jumping into the vxWorks images. This can be used to alter a register which is used differently by U-boot and vxWorks.

The patch defines a weak function which may be overridden by a board specific version. vxworks_preboot should return 0 to indicated that everything worked fine. The error code is checked and the vxWorks image will not be loaded in case of errors.

Quoted 6 lines
---
 board/netstal/mcu25/mcu25.c |    8 ++++++++
 common/cmd_elf.c            |   11 +++++++++++
 include/vxworks.h           |    2 ++
 3 files changed, 21 insertions(+), 0 deletions(-)

Please add a few words to the README that document the new CONFIG_VXWORKS_PREBOOT option. Then resubmit. Thanks.

Best regards,

Wolfgang Denk

Signature · 4 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
panic: can't find /