]> git.sur5r.net Git - u-boot/blobdiff - cmd/elf.c
bootvx: x86: Prepare e820 related stuff from the given kernel memory base address
[u-boot] / cmd / elf.c
index ed9625b221fe1d76abf424840e80dc6ab920b0ab..ea09506c6464a7bc8b7f2bc6e77fda22210fdda7 100644 (file)
--- a/cmd/elf.c
+++ b/cmd/elf.c
@@ -16,6 +16,7 @@
 #include <common.h>
 #include <command.h>
 #include <elf.h>
+#include <environment.h>
 #include <net.h>
 #include <vxworks.h>
 #ifdef CONFIG_X86
@@ -148,7 +149,7 @@ int do_bootelf(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
        unsigned long addr; /* Address of the ELF image */
        unsigned long rc; /* Return value from user code */
        char *sload = NULL;
-       const char *ep = getenv("autostart");
+       const char *ep = env_get("autostart");
        int rcode = 0;
 
        /* Consume 'bootelf' */
@@ -208,6 +209,7 @@ int do_bootvx(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
        char build_buf[128]; /* Buffer for building the bootline */
        int ptr = 0;
 #ifdef CONFIG_X86
+       ulong base;
        struct e820info *info;
        struct e820entry *data;
 #endif
@@ -240,13 +242,9 @@ int do_bootvx(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
         * from the VxWorks BSP header files.
         * This will vary from board to board
         */
-#if defined(CONFIG_WALNUT)
-       tmp = (char *)CONFIG_SYS_NVRAM_BASE_ADDR + 0x500;
-       eth_getenv_enetaddr("ethaddr", (uchar *)build_buf);
-       memcpy(tmp, &build_buf[3], 3);
-#elif defined(CONFIG_SYS_VXWORKS_MAC_PTR)
+#if defined(CONFIG_SYS_VXWORKS_MAC_PTR)
        tmp = (char *)CONFIG_SYS_VXWORKS_MAC_PTR;
-       eth_getenv_enetaddr("ethaddr", (uchar *)build_buf);
+       eth_env_get_enetaddr("ethaddr", (uchar *)build_buf);
        memcpy(tmp, build_buf, 6);
 #else
        puts("## Ethernet MAC address not copied to NV RAM\n");
@@ -258,7 +256,7 @@ int do_bootvx(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
         * (LOCAL_MEM_LOCAL_ADRS + BOOT_LINE_OFFSET) as defined by
         * VxWorks BSP. For example, on PowerPC it defaults to 0x4200.
         */
-       tmp = getenv("bootaddr");
+       tmp = env_get("bootaddr");
        if (!tmp) {
                printf("## VxWorks bootline address not specified\n");
        } else {
@@ -269,21 +267,21 @@ int do_bootvx(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
                 * parameter. If it is not defined, we may be able to
                 * construct the info.
                 */
-               bootline = getenv("bootargs");
+               bootline = env_get("bootargs");
                if (bootline) {
                        memcpy((void *)bootaddr, bootline,
                               max(strlen(bootline), (size_t)255));
                        flush_cache(bootaddr, max(strlen(bootline),
                                                  (size_t)255));
                } else {
-                       tmp = getenv("bootdev");
+                       tmp = env_get("bootdev");
                        if (tmp) {
                                strcpy(build_buf, tmp);
                                ptr = strlen(tmp);
                        } else
                                printf("## VxWorks boot device not specified\n");
 
-                       tmp = getenv("bootfile");
+                       tmp = env_get("bootfile");
                        if (tmp)
                                ptr += sprintf(build_buf + ptr,
                                               "host:%s ", tmp);
@@ -295,12 +293,12 @@ int do_bootvx(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
                         * The following parameters are only needed if 'bootdev'
                         * is an ethernet device, otherwise they are optional.
                         */
-                       tmp = getenv("ipaddr");
+                       tmp = env_get("ipaddr");
                        if (tmp) {
                                ptr += sprintf(build_buf + ptr, "e=%s", tmp);
-                               tmp = getenv("netmask");
+                               tmp = env_get("netmask");
                                if (tmp) {
-                                       u32 mask = getenv_ip("netmask").s_addr;
+                                       u32 mask = env_get_ip("netmask").s_addr;
                                        ptr += sprintf(build_buf + ptr,
                                                       ":%08x ", ntohl(mask));
                                } else {
@@ -308,19 +306,19 @@ int do_bootvx(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
                                }
                        }
 
-                       tmp = getenv("serverip");
+                       tmp = env_get("serverip");
                        if (tmp)
                                ptr += sprintf(build_buf + ptr, "h=%s ", tmp);
 
-                       tmp = getenv("gatewayip");
+                       tmp = env_get("gatewayip");
                        if (tmp)
                                ptr += sprintf(build_buf + ptr, "g=%s ", tmp);
 
-                       tmp = getenv("hostname");
+                       tmp = env_get("hostname");
                        if (tmp)
                                ptr += sprintf(build_buf + ptr, "tn=%s ", tmp);
 
-                       tmp = getenv("othbootargs");
+                       tmp = env_get("othbootargs");
                        if (tmp) {
                                strcpy(build_buf + ptr, tmp);
                                ptr += strlen(tmp);
@@ -338,25 +336,18 @@ int do_bootvx(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 
 #ifdef CONFIG_X86
        /*
-        * Since E820 information is critical to the kernel, if we don't
-        * specify these in the environments, use a default one.
+        * Get VxWorks's physical memory base address from environment,
+        * if we don't specify it in the environment, use a default one.
         */
-       tmp = getenv("e820data");
-       if (tmp)
-               data = (struct e820entry *)simple_strtoul(tmp, NULL, 16);
-       else
-               data = (struct e820entry *)VXWORKS_E820_DATA_ADDR;
-       tmp = getenv("e820info");
-       if (tmp)
-               info = (struct e820info *)simple_strtoul(tmp, NULL, 16);
-       else
-               info = (struct e820info *)VXWORKS_E820_INFO_ADDR;
+       base = env_get_hex("vx_phys_mem_base", VXWORKS_PHYS_MEM_BASE);
+       data = (struct e820entry *)(base + E820_DATA_OFFSET);
+       info = (struct e820info *)(base + E820_INFO_OFFSET);
 
        memset(info, 0, sizeof(struct e820info));
        info->sign = E820_SIGNATURE;
        info->entries = install_e820_map(E820MAX, data);
        info->addr = (info->entries - 1) * sizeof(struct e820entry) +
-                    VXWORKS_E820_DATA_ADDR;
+                    E820_DATA_OFFSET;
 #endif
 
        /*
@@ -365,13 +356,18 @@ int do_bootvx(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
         * binary image.
         */
        if (valid_elf_image(addr))
-               addr = load_elf_image_shdr(addr);
+               addr = load_elf_image_phdr(addr);
        else
                puts("## Not an ELF image, assuming binary\n");
 
        printf("## Starting vxWorks at 0x%08lx ...\n", addr);
 
        dcache_disable();
+#if defined(CONFIG_ARM64) && defined(CONFIG_ARMV8_PSCI)
+       armv8_setup_psci();
+       smp_kick_all_cpus();
+#endif
+
 #ifdef CONFIG_X86
        /* VxWorks on x86 uses stack to pass parameters */
        ((asmlinkage void (*)(int))addr)(0);