Tom Rini | 89789eb | 2020-01-29 11:03:34 -0500 | [diff] [blame] | 1 | // SPDX-License-Identifier: BSD-2-Clause |
wdenk | 458ded3 | 2002-09-20 10:59:08 +0000 | [diff] [blame] | 2 | /* |
| 3 | * Copyright (c) 2001 William L. Pitts |
| 4 | * All rights reserved. |
wdenk | 458ded3 | 2002-09-20 10:59:08 +0000 | [diff] [blame] | 5 | */ |
| 6 | |
| 7 | #include <common.h> |
| 8 | #include <command.h> |
Simon Glass | 62270f4 | 2019-11-14 12:57:35 -0700 | [diff] [blame] | 9 | #include <cpu_func.h> |
wdenk | 458ded3 | 2002-09-20 10:59:08 +0000 | [diff] [blame] | 10 | #include <elf.h> |
Simon Glass | cdbff9f | 2019-08-01 09:46:50 -0600 | [diff] [blame] | 11 | #include <env.h> |
Simon Glass | 8e8ccfe | 2019-12-28 10:45:03 -0700 | [diff] [blame] | 12 | #include <image.h> |
Bin Meng | ebca3df | 2015-10-07 20:19:13 -0700 | [diff] [blame] | 13 | #include <net.h> |
Niklaus Giger | 29a4c24 | 2008-11-03 22:15:34 +0100 | [diff] [blame] | 14 | #include <vxworks.h> |
Bin Meng | b90ff0f | 2015-10-07 20:19:18 -0700 | [diff] [blame] | 15 | #ifdef CONFIG_X86 |
Bin Meng | 447ae4f | 2018-04-11 22:02:19 -0700 | [diff] [blame] | 16 | #include <vbe.h> |
Bin Meng | b90ff0f | 2015-10-07 20:19:18 -0700 | [diff] [blame] | 17 | #include <asm/e820.h> |
Bin Meng | 9aa1280 | 2015-10-07 20:19:19 -0700 | [diff] [blame] | 18 | #include <linux/linkage.h> |
Bin Meng | b90ff0f | 2015-10-07 20:19:18 -0700 | [diff] [blame] | 19 | #endif |
wdenk | 458ded3 | 2002-09-20 10:59:08 +0000 | [diff] [blame] | 20 | |
Mike Frysinger | 017e9b7 | 2008-04-13 19:42:18 -0400 | [diff] [blame] | 21 | /* Allow ports to override the default behavior */ |
Jeroen Hofstee | 553d8c3 | 2014-10-08 22:57:31 +0200 | [diff] [blame] | 22 | static unsigned long do_bootelf_exec(ulong (*entry)(int, char * const[]), |
Bin Meng | ebca3df | 2015-10-07 20:19:13 -0700 | [diff] [blame] | 23 | int argc, char * const argv[]) |
Mike Frysinger | 1f1d88d | 2008-01-29 18:21:05 -0500 | [diff] [blame] | 24 | { |
Mike Frysinger | 017e9b7 | 2008-04-13 19:42:18 -0400 | [diff] [blame] | 25 | unsigned long ret; |
| 26 | |
Mike Frysinger | 1f1d88d | 2008-01-29 18:21:05 -0500 | [diff] [blame] | 27 | /* |
Mike Frysinger | 017e9b7 | 2008-04-13 19:42:18 -0400 | [diff] [blame] | 28 | * pass address parameter as argv[0] (aka command name), |
| 29 | * and all remaining args |
| 30 | */ |
Daniel Schwierzeck | 62e03d3 | 2012-09-16 06:55:05 +0000 | [diff] [blame] | 31 | ret = entry(argc, argv); |
Mike Frysinger | 1f1d88d | 2008-01-29 18:21:05 -0500 | [diff] [blame] | 32 | |
Mike Frysinger | 017e9b7 | 2008-04-13 19:42:18 -0400 | [diff] [blame] | 33 | return ret; |
| 34 | } |
wdenk | 458ded3 | 2002-09-20 10:59:08 +0000 | [diff] [blame] | 35 | |
Bin Meng | ebca3df | 2015-10-07 20:19:13 -0700 | [diff] [blame] | 36 | /* Interpreter command to boot an arbitrary ELF image from memory */ |
Daniel Schwierzeck | 62e03d3 | 2012-09-16 06:55:05 +0000 | [diff] [blame] | 37 | int do_bootelf(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) |
wdenk | 458ded3 | 2002-09-20 10:59:08 +0000 | [diff] [blame] | 38 | { |
Bin Meng | ebca3df | 2015-10-07 20:19:13 -0700 | [diff] [blame] | 39 | unsigned long addr; /* Address of the ELF image */ |
| 40 | unsigned long rc; /* Return value from user code */ |
Tom Rini | be1b867 | 2017-05-18 17:03:07 -0400 | [diff] [blame] | 41 | char *sload = NULL; |
Simon Glass | 00caae6 | 2017-08-03 12:22:12 -0600 | [diff] [blame] | 42 | const char *ep = env_get("autostart"); |
wdenk | 458ded3 | 2002-09-20 10:59:08 +0000 | [diff] [blame] | 43 | int rcode = 0; |
| 44 | |
Tom Rini | be1b867 | 2017-05-18 17:03:07 -0400 | [diff] [blame] | 45 | /* Consume 'bootelf' */ |
| 46 | argc--; argv++; |
Mike Frysinger | f44a928 | 2010-10-02 15:44:53 -0400 | [diff] [blame] | 47 | |
Tom Rini | be1b867 | 2017-05-18 17:03:07 -0400 | [diff] [blame] | 48 | /* Check for flag. */ |
| 49 | if (argc >= 1 && (argv[0][0] == '-' && \ |
| 50 | (argv[0][1] == 'p' || argv[0][1] == 's'))) { |
| 51 | sload = argv[0]; |
| 52 | /* Consume flag. */ |
| 53 | argc--; argv++; |
| 54 | } |
| 55 | /* Check for address. */ |
| 56 | if (argc >= 1 && strict_strtoul(argv[0], 16, &addr) != -EINVAL) { |
| 57 | /* Consume address */ |
| 58 | argc--; argv++; |
| 59 | } else |
Simon Glass | bb872dd | 2019-12-28 10:45:02 -0700 | [diff] [blame] | 60 | addr = image_load_addr; |
wdenk | 458ded3 | 2002-09-20 10:59:08 +0000 | [diff] [blame] | 61 | |
Daniel Schwierzeck | 62e03d3 | 2012-09-16 06:55:05 +0000 | [diff] [blame] | 62 | if (!valid_elf_image(addr)) |
wdenk | 458ded3 | 2002-09-20 10:59:08 +0000 | [diff] [blame] | 63 | return 1; |
| 64 | |
Mike Frysinger | f44a928 | 2010-10-02 15:44:53 -0400 | [diff] [blame] | 65 | if (sload && sload[1] == 'p') |
| 66 | addr = load_elf_image_phdr(addr); |
| 67 | else |
| 68 | addr = load_elf_image_shdr(addr); |
wdenk | 458ded3 | 2002-09-20 10:59:08 +0000 | [diff] [blame] | 69 | |
Siva Durga Prasad Paladugu | 44c8fd3 | 2015-03-09 12:46:47 +0100 | [diff] [blame] | 70 | if (ep && !strcmp(ep, "no")) |
| 71 | return rcode; |
| 72 | |
Daniel Schwierzeck | 62e03d3 | 2012-09-16 06:55:05 +0000 | [diff] [blame] | 73 | printf("## Starting application at 0x%08lx ...\n", addr); |
wdenk | 458ded3 | 2002-09-20 10:59:08 +0000 | [diff] [blame] | 74 | |
wdenk | 458ded3 | 2002-09-20 10:59:08 +0000 | [diff] [blame] | 75 | /* |
| 76 | * pass address parameter as argv[0] (aka command name), |
| 77 | * and all remaining args |
| 78 | */ |
Tom Rini | be1b867 | 2017-05-18 17:03:07 -0400 | [diff] [blame] | 79 | rc = do_bootelf_exec((void *)addr, argc, argv); |
wdenk | 458ded3 | 2002-09-20 10:59:08 +0000 | [diff] [blame] | 80 | if (rc != 0) |
| 81 | rcode = 1; |
| 82 | |
Daniel Schwierzeck | 62e03d3 | 2012-09-16 06:55:05 +0000 | [diff] [blame] | 83 | printf("## Application terminated, rc = 0x%lx\n", rc); |
Bin Meng | ebca3df | 2015-10-07 20:19:13 -0700 | [diff] [blame] | 84 | |
wdenk | 458ded3 | 2002-09-20 10:59:08 +0000 | [diff] [blame] | 85 | return rcode; |
| 86 | } |
| 87 | |
Bin Meng | ebca3df | 2015-10-07 20:19:13 -0700 | [diff] [blame] | 88 | /* |
wdenk | 458ded3 | 2002-09-20 10:59:08 +0000 | [diff] [blame] | 89 | * Interpreter command to boot VxWorks from a memory image. The image can |
| 90 | * be either an ELF image or a raw binary. Will attempt to setup the |
| 91 | * bootline and other parameters correctly. |
Bin Meng | ebca3df | 2015-10-07 20:19:13 -0700 | [diff] [blame] | 92 | */ |
Daniel Schwierzeck | 62e03d3 | 2012-09-16 06:55:05 +0000 | [diff] [blame] | 93 | int do_bootvx(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) |
wdenk | 458ded3 | 2002-09-20 10:59:08 +0000 | [diff] [blame] | 94 | { |
Bin Meng | ebca3df | 2015-10-07 20:19:13 -0700 | [diff] [blame] | 95 | unsigned long addr; /* Address of image */ |
Bin Meng | 79c584e | 2018-04-11 22:02:22 -0700 | [diff] [blame] | 96 | unsigned long bootaddr = 0; /* Address to put the bootline */ |
Bin Meng | ebca3df | 2015-10-07 20:19:13 -0700 | [diff] [blame] | 97 | char *bootline; /* Text of the bootline */ |
| 98 | char *tmp; /* Temporary char pointer */ |
| 99 | char build_buf[128]; /* Buffer for building the bootline */ |
Bin Meng | 7f0c3c5 | 2015-10-07 20:19:15 -0700 | [diff] [blame] | 100 | int ptr = 0; |
Bin Meng | b90ff0f | 2015-10-07 20:19:18 -0700 | [diff] [blame] | 101 | #ifdef CONFIG_X86 |
Bin Meng | 2902be8 | 2018-04-11 22:02:07 -0700 | [diff] [blame] | 102 | ulong base; |
Bin Meng | fa5e91f | 2018-04-11 22:02:09 -0700 | [diff] [blame] | 103 | struct e820_info *info; |
Bin Meng | 4551992 | 2018-04-11 22:02:11 -0700 | [diff] [blame] | 104 | struct e820_entry *data; |
Bin Meng | 447ae4f | 2018-04-11 22:02:19 -0700 | [diff] [blame] | 105 | struct efi_gop_info *gop; |
| 106 | struct vesa_mode_info *vesa = &mode_info.vesa; |
Bin Meng | b90ff0f | 2015-10-07 20:19:18 -0700 | [diff] [blame] | 107 | #endif |
wdenk | 458ded3 | 2002-09-20 10:59:08 +0000 | [diff] [blame] | 108 | |
Bin Meng | ebca3df | 2015-10-07 20:19:13 -0700 | [diff] [blame] | 109 | /* |
wdenk | 458ded3 | 2002-09-20 10:59:08 +0000 | [diff] [blame] | 110 | * Check the loadaddr variable. |
| 111 | * If we don't know where the image is then we're done. |
| 112 | */ |
Stany MARCEL | 07a1a0c | 2013-11-27 14:48:43 +0100 | [diff] [blame] | 113 | if (argc < 2) |
Simon Glass | bb872dd | 2019-12-28 10:45:02 -0700 | [diff] [blame] | 114 | addr = image_load_addr; |
Stefan Roese | 1bdd468 | 2006-11-29 12:53:15 +0100 | [diff] [blame] | 115 | else |
Stany MARCEL | 07a1a0c | 2013-11-27 14:48:43 +0100 | [diff] [blame] | 116 | addr = simple_strtoul(argv[1], NULL, 16); |
wdenk | 458ded3 | 2002-09-20 10:59:08 +0000 | [diff] [blame] | 117 | |
Jon Loeliger | baa26db | 2007-07-08 17:51:39 -0500 | [diff] [blame] | 118 | #if defined(CONFIG_CMD_NET) |
Daniel Schwierzeck | 62e03d3 | 2012-09-16 06:55:05 +0000 | [diff] [blame] | 119 | /* |
Bin Meng | ebca3df | 2015-10-07 20:19:13 -0700 | [diff] [blame] | 120 | * Check to see if we need to tftp the image ourselves |
| 121 | * before starting |
Daniel Schwierzeck | 62e03d3 | 2012-09-16 06:55:05 +0000 | [diff] [blame] | 122 | */ |
Stany MARCEL | 07a1a0c | 2013-11-27 14:48:43 +0100 | [diff] [blame] | 123 | if ((argc == 2) && (strcmp(argv[1], "tftp") == 0)) { |
Joe Hershberger | bc0571f | 2015-04-08 01:41:21 -0500 | [diff] [blame] | 124 | if (net_loop(TFTPGET) <= 0) |
wdenk | 458ded3 | 2002-09-20 10:59:08 +0000 | [diff] [blame] | 125 | return 1; |
Daniel Schwierzeck | 62e03d3 | 2012-09-16 06:55:05 +0000 | [diff] [blame] | 126 | printf("Automatic boot of VxWorks image at address 0x%08lx ...\n", |
| 127 | addr); |
wdenk | 458ded3 | 2002-09-20 10:59:08 +0000 | [diff] [blame] | 128 | } |
| 129 | #endif |
| 130 | |
Bin Meng | ebca3df | 2015-10-07 20:19:13 -0700 | [diff] [blame] | 131 | /* |
| 132 | * This should equate to |
| 133 | * NV_RAM_ADRS + NV_BOOT_OFFSET + NV_ENET_OFFSET |
wdenk | 458ded3 | 2002-09-20 10:59:08 +0000 | [diff] [blame] | 134 | * from the VxWorks BSP header files. |
| 135 | * This will vary from board to board |
| 136 | */ |
Tuomas Tynkkynen | 8996975 | 2018-01-21 18:16:42 +0200 | [diff] [blame] | 137 | #if defined(CONFIG_SYS_VXWORKS_MAC_PTR) |
Bin Meng | ebca3df | 2015-10-07 20:19:13 -0700 | [diff] [blame] | 138 | tmp = (char *)CONFIG_SYS_VXWORKS_MAC_PTR; |
Simon Glass | 35affd7 | 2017-08-03 12:22:14 -0600 | [diff] [blame] | 139 | eth_env_get_enetaddr("ethaddr", (uchar *)build_buf); |
Mike Frysinger | 62c93d9 | 2009-02-11 18:51:43 -0500 | [diff] [blame] | 140 | memcpy(tmp, build_buf, 6); |
wdenk | 458ded3 | 2002-09-20 10:59:08 +0000 | [diff] [blame] | 141 | #else |
Daniel Schwierzeck | 62e03d3 | 2012-09-16 06:55:05 +0000 | [diff] [blame] | 142 | puts("## Ethernet MAC address not copied to NV RAM\n"); |
wdenk | 458ded3 | 2002-09-20 10:59:08 +0000 | [diff] [blame] | 143 | #endif |
| 144 | |
Bin Meng | 79c584e | 2018-04-11 22:02:22 -0700 | [diff] [blame] | 145 | #ifdef CONFIG_X86 |
| 146 | /* |
| 147 | * Get VxWorks's physical memory base address from environment, |
| 148 | * if we don't specify it in the environment, use a default one. |
| 149 | */ |
| 150 | base = env_get_hex("vx_phys_mem_base", VXWORKS_PHYS_MEM_BASE); |
| 151 | data = (struct e820_entry *)(base + E820_DATA_OFFSET); |
| 152 | info = (struct e820_info *)(base + E820_INFO_OFFSET); |
| 153 | |
| 154 | memset(info, 0, sizeof(struct e820_info)); |
| 155 | info->sign = E820_SIGNATURE; |
| 156 | info->entries = install_e820_map(E820MAX, data); |
| 157 | info->addr = (info->entries - 1) * sizeof(struct e820_entry) + |
| 158 | E820_DATA_OFFSET; |
| 159 | |
| 160 | /* |
| 161 | * Explicitly clear the bootloader image size otherwise if memory |
| 162 | * at this offset happens to contain some garbage data, the final |
| 163 | * available memory size for the kernel is insane. |
| 164 | */ |
| 165 | *(u32 *)(base + BOOT_IMAGE_SIZE_OFFSET) = 0; |
| 166 | |
| 167 | /* |
| 168 | * Prepare compatible framebuffer information block. |
| 169 | * The VESA mode has to be 32-bit RGBA. |
| 170 | */ |
| 171 | if (vesa->x_resolution && vesa->y_resolution) { |
| 172 | gop = (struct efi_gop_info *)(base + EFI_GOP_INFO_OFFSET); |
| 173 | gop->magic = EFI_GOP_INFO_MAGIC; |
| 174 | gop->info.version = 0; |
| 175 | gop->info.width = vesa->x_resolution; |
| 176 | gop->info.height = vesa->y_resolution; |
| 177 | gop->info.pixel_format = EFI_GOT_RGBA8; |
| 178 | gop->info.pixels_per_scanline = vesa->bytes_per_scanline / 4; |
| 179 | gop->fb_base = vesa->phys_base_ptr; |
| 180 | gop->fb_size = vesa->bytes_per_scanline * vesa->y_resolution; |
| 181 | } |
| 182 | #endif |
| 183 | |
wdenk | 8bde7f7 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 184 | /* |
| 185 | * Use bootaddr to find the location in memory that VxWorks |
Bin Meng | 9e98b7e | 2015-10-07 20:19:17 -0700 | [diff] [blame] | 186 | * will look for the bootline string. The default value is |
| 187 | * (LOCAL_MEM_LOCAL_ADRS + BOOT_LINE_OFFSET) as defined by |
| 188 | * VxWorks BSP. For example, on PowerPC it defaults to 0x4200. |
wdenk | 458ded3 | 2002-09-20 10:59:08 +0000 | [diff] [blame] | 189 | */ |
Simon Glass | 00caae6 | 2017-08-03 12:22:12 -0600 | [diff] [blame] | 190 | tmp = env_get("bootaddr"); |
Bin Meng | 9e98b7e | 2015-10-07 20:19:17 -0700 | [diff] [blame] | 191 | if (!tmp) { |
Bin Meng | 79c584e | 2018-04-11 22:02:22 -0700 | [diff] [blame] | 192 | #ifdef CONFIG_X86 |
| 193 | bootaddr = base + X86_BOOT_LINE_OFFSET; |
| 194 | #else |
Bin Meng | 9e98b7e | 2015-10-07 20:19:17 -0700 | [diff] [blame] | 195 | printf("## VxWorks bootline address not specified\n"); |
Bin Meng | ced71a2 | 2018-04-11 22:02:21 -0700 | [diff] [blame] | 196 | return 1; |
Bin Meng | 79c584e | 2018-04-11 22:02:22 -0700 | [diff] [blame] | 197 | #endif |
Bin Meng | ced71a2 | 2018-04-11 22:02:21 -0700 | [diff] [blame] | 198 | } |
wdenk | 458ded3 | 2002-09-20 10:59:08 +0000 | [diff] [blame] | 199 | |
Bin Meng | 79c584e | 2018-04-11 22:02:22 -0700 | [diff] [blame] | 200 | if (!bootaddr) |
| 201 | bootaddr = simple_strtoul(tmp, NULL, 16); |
wdenk | 458ded3 | 2002-09-20 10:59:08 +0000 | [diff] [blame] | 202 | |
Bin Meng | ced71a2 | 2018-04-11 22:02:21 -0700 | [diff] [blame] | 203 | /* |
| 204 | * Check to see if the bootline is defined in the 'bootargs' parameter. |
| 205 | * If it is not defined, we may be able to construct the info. |
| 206 | */ |
| 207 | bootline = env_get("bootargs"); |
| 208 | if (!bootline) { |
| 209 | tmp = env_get("bootdev"); |
| 210 | if (tmp) { |
| 211 | strcpy(build_buf, tmp); |
| 212 | ptr = strlen(tmp); |
| 213 | } else { |
| 214 | printf("## VxWorks boot device not specified\n"); |
Bin Meng | a4092db | 2015-10-07 20:19:16 -0700 | [diff] [blame] | 215 | } |
Niklaus Giger | 29a4c24 | 2008-11-03 22:15:34 +0100 | [diff] [blame] | 216 | |
Bin Meng | ced71a2 | 2018-04-11 22:02:21 -0700 | [diff] [blame] | 217 | tmp = env_get("bootfile"); |
| 218 | if (tmp) |
| 219 | ptr += sprintf(build_buf + ptr, "host:%s ", tmp); |
| 220 | else |
| 221 | ptr += sprintf(build_buf + ptr, "host:vxWorks "); |
| 222 | |
| 223 | /* |
| 224 | * The following parameters are only needed if 'bootdev' |
| 225 | * is an ethernet device, otherwise they are optional. |
| 226 | */ |
| 227 | tmp = env_get("ipaddr"); |
| 228 | if (tmp) { |
| 229 | ptr += sprintf(build_buf + ptr, "e=%s", tmp); |
| 230 | tmp = env_get("netmask"); |
| 231 | if (tmp) { |
| 232 | u32 mask = env_get_ip("netmask").s_addr; |
| 233 | ptr += sprintf(build_buf + ptr, |
| 234 | ":%08x ", ntohl(mask)); |
| 235 | } else { |
| 236 | ptr += sprintf(build_buf + ptr, " "); |
| 237 | } |
| 238 | } |
| 239 | |
| 240 | tmp = env_get("serverip"); |
| 241 | if (tmp) |
| 242 | ptr += sprintf(build_buf + ptr, "h=%s ", tmp); |
| 243 | |
| 244 | tmp = env_get("gatewayip"); |
| 245 | if (tmp) |
| 246 | ptr += sprintf(build_buf + ptr, "g=%s ", tmp); |
| 247 | |
| 248 | tmp = env_get("hostname"); |
| 249 | if (tmp) |
| 250 | ptr += sprintf(build_buf + ptr, "tn=%s ", tmp); |
| 251 | |
| 252 | tmp = env_get("othbootargs"); |
| 253 | if (tmp) { |
| 254 | strcpy(build_buf + ptr, tmp); |
| 255 | ptr += strlen(tmp); |
| 256 | } |
| 257 | |
| 258 | bootline = build_buf; |
wdenk | 458ded3 | 2002-09-20 10:59:08 +0000 | [diff] [blame] | 259 | } |
| 260 | |
Bin Meng | ced71a2 | 2018-04-11 22:02:21 -0700 | [diff] [blame] | 261 | memcpy((void *)bootaddr, bootline, max(strlen(bootline), (size_t)255)); |
| 262 | flush_cache(bootaddr, max(strlen(bootline), (size_t)255)); |
| 263 | printf("## Using bootline (@ 0x%lx): %s\n", bootaddr, (char *)bootaddr); |
| 264 | |
wdenk | 8bde7f7 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 265 | /* |
| 266 | * If the data at the load address is an elf image, then |
| 267 | * treat it like an elf image. Otherwise, assume that it is a |
Bin Meng | ebca3df | 2015-10-07 20:19:13 -0700 | [diff] [blame] | 268 | * binary image. |
wdenk | 458ded3 | 2002-09-20 10:59:08 +0000 | [diff] [blame] | 269 | */ |
Bin Meng | ebca3df | 2015-10-07 20:19:13 -0700 | [diff] [blame] | 270 | if (valid_elf_image(addr)) |
Christian Gmeiner | 476c2fc | 2018-03-20 14:18:25 +0100 | [diff] [blame] | 271 | addr = load_elf_image_phdr(addr); |
Bin Meng | ebca3df | 2015-10-07 20:19:13 -0700 | [diff] [blame] | 272 | else |
Daniel Schwierzeck | 62e03d3 | 2012-09-16 06:55:05 +0000 | [diff] [blame] | 273 | puts("## Not an ELF image, assuming binary\n"); |
wdenk | 458ded3 | 2002-09-20 10:59:08 +0000 | [diff] [blame] | 274 | |
Daniel Schwierzeck | 62e03d3 | 2012-09-16 06:55:05 +0000 | [diff] [blame] | 275 | printf("## Starting vxWorks at 0x%08lx ...\n", addr); |
wdenk | 458ded3 | 2002-09-20 10:59:08 +0000 | [diff] [blame] | 276 | |
Reinhard Arlt | 6eee21d | 2011-11-18 09:06:52 +0000 | [diff] [blame] | 277 | dcache_disable(); |
Vasyl Vavrychuk | 3194daa | 2018-04-10 12:36:36 +0300 | [diff] [blame] | 278 | #if defined(CONFIG_ARM64) && defined(CONFIG_ARMV8_PSCI) |
| 279 | armv8_setup_psci(); |
| 280 | smp_kick_all_cpus(); |
| 281 | #endif |
| 282 | |
Bin Meng | 9aa1280 | 2015-10-07 20:19:19 -0700 | [diff] [blame] | 283 | #ifdef CONFIG_X86 |
| 284 | /* VxWorks on x86 uses stack to pass parameters */ |
| 285 | ((asmlinkage void (*)(int))addr)(0); |
| 286 | #else |
Bin Meng | ebca3df | 2015-10-07 20:19:13 -0700 | [diff] [blame] | 287 | ((void (*)(int))addr)(0); |
Bin Meng | 9aa1280 | 2015-10-07 20:19:19 -0700 | [diff] [blame] | 288 | #endif |
wdenk | 458ded3 | 2002-09-20 10:59:08 +0000 | [diff] [blame] | 289 | |
Daniel Schwierzeck | 62e03d3 | 2012-09-16 06:55:05 +0000 | [diff] [blame] | 290 | puts("## vxWorks terminated\n"); |
Bin Meng | ebca3df | 2015-10-07 20:19:13 -0700 | [diff] [blame] | 291 | |
wdenk | 458ded3 | 2002-09-20 10:59:08 +0000 | [diff] [blame] | 292 | return 1; |
| 293 | } |
| 294 | |
wdenk | 0d49839 | 2003-07-01 21:06:45 +0000 | [diff] [blame] | 295 | U_BOOT_CMD( |
Tom Rini | be1b867 | 2017-05-18 17:03:07 -0400 | [diff] [blame] | 296 | bootelf, CONFIG_SYS_MAXARGS, 0, do_bootelf, |
Peter Tyser | 2fb2604 | 2009-01-27 18:03:12 -0600 | [diff] [blame] | 297 | "Boot from an ELF image in memory", |
Mike Frysinger | f44a928 | 2010-10-02 15:44:53 -0400 | [diff] [blame] | 298 | "[-p|-s] [address]\n" |
| 299 | "\t- load ELF image at [address] via program headers (-p)\n" |
| 300 | "\t or via section headers (-s)" |
wdenk | 8bde7f7 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 301 | ); |
| 302 | |
wdenk | 0d49839 | 2003-07-01 21:06:45 +0000 | [diff] [blame] | 303 | U_BOOT_CMD( |
Bin Meng | ebca3df | 2015-10-07 20:19:13 -0700 | [diff] [blame] | 304 | bootvx, 2, 0, do_bootvx, |
Peter Tyser | 2fb2604 | 2009-01-27 18:03:12 -0600 | [diff] [blame] | 305 | "Boot vxWorks from an ELF image", |
Wolfgang Denk | a89c33d | 2009-05-24 17:06:54 +0200 | [diff] [blame] | 306 | " [address] - load address of vxWorks ELF image." |
wdenk | 8bde7f7 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 307 | ); |