.. | .. |
---|
134 | 134 | flush_dcache_all(); |
---|
135 | 135 | |
---|
136 | 136 | /* fixup: ramdisk/fdt/entry depend on U-Boot */ |
---|
137 | | - *entry = env_get_ulong("kernel_addr_r", 16, 0); |
---|
| 137 | + *entry = (u32)images.ep; |
---|
138 | 138 | |
---|
139 | 139 | return 0; |
---|
140 | 140 | } |
---|
.. | .. |
---|
206 | 206 | return 0; |
---|
207 | 207 | } |
---|
208 | 208 | |
---|
| 209 | +__weak int fit_standalone_release(char *id, uintptr_t entry_point) |
---|
| 210 | +{ |
---|
| 211 | + return 0; |
---|
| 212 | +} |
---|
| 213 | + |
---|
| 214 | +static int standalone_handler(const char *id, u32 entry_point, int data_size) |
---|
| 215 | +{ |
---|
| 216 | + int ret; |
---|
| 217 | + |
---|
| 218 | + if (!sysmem_alloc_base_by_name(id, |
---|
| 219 | + (phys_addr_t)entry_point, data_size)) |
---|
| 220 | + return -ENXIO; |
---|
| 221 | + |
---|
| 222 | + printf("Handle standalone: '%s' at 0x%08x ...", id, entry_point); |
---|
| 223 | + |
---|
| 224 | + ret = fit_standalone_release((char *)id, entry_point); |
---|
| 225 | + if (ret) { |
---|
| 226 | + printf("failed, ret=%d\n", ret); |
---|
| 227 | + return ret; |
---|
| 228 | + } |
---|
| 229 | + printf("OK\n"); |
---|
| 230 | + |
---|
| 231 | + return 0; |
---|
| 232 | +} |
---|
| 233 | + |
---|
209 | 234 | static int brought_up_amp(void *fit, int noffset, |
---|
210 | 235 | boot_cpu_t *bootcpu, int is_linux) |
---|
211 | 236 | { |
---|
.. | .. |
---|
217 | 242 | int boot_on; |
---|
218 | 243 | int data_size; |
---|
219 | 244 | int i, ret; |
---|
220 | | - u8 arch = -ENODATA; |
---|
| 245 | + u8 type = -ENODATA; |
---|
| 246 | + u8 arch = -ENODATA; |
---|
221 | 247 | |
---|
222 | 248 | desc = fdt_getprop(fit, noffset, "description", NULL); |
---|
223 | 249 | cpu = fit_get_u32_default(fit, noffset, "cpu", -ENODATA); |
---|
224 | 250 | hyp = fit_get_u32_default(fit, noffset, "hyp", 0); |
---|
225 | 251 | thumb = fit_get_u32_default(fit, noffset, "thumb", 0); |
---|
226 | | - load = fit_get_u32_default(fit, noffset, "load", -ENODATA); |
---|
| 252 | + entry = load = fit_get_u32_default(fit, noffset, "load", -ENODATA); |
---|
227 | 253 | us = fit_get_u32_default(fit, noffset, "udelay", 0); |
---|
228 | 254 | boot_on = fit_get_u32_default(fit, noffset, "boot-on", 1); |
---|
229 | 255 | fit_image_get_arch(fit, noffset, &arch); |
---|
| 256 | + fit_image_get_type(fit, noffset, &type); |
---|
230 | 257 | fit_image_get_data_size(fit, noffset, &data_size); |
---|
231 | 258 | memset(&args, 0, sizeof(args)); |
---|
232 | 259 | |
---|
233 | | - if (!desc || cpu == -ENODATA || arch == -ENODATA || |
---|
| 260 | + /* standalone is simple, just handle it and then exit. Allow failure */ |
---|
| 261 | + if (type == IH_TYPE_STANDALONE) { |
---|
| 262 | + if (!desc || load == -ENODATA) { |
---|
| 263 | + AMP_E("standalone: \"desc\" or \"load\" property missing!\n"); |
---|
| 264 | + goto exit; |
---|
| 265 | + } |
---|
| 266 | + standalone_handler(desc, load, data_size); |
---|
| 267 | + goto exit; |
---|
| 268 | + } |
---|
| 269 | + |
---|
| 270 | + if (!desc || cpu == -ENODATA || arch == -ENODATA || type == -ENODATA || |
---|
234 | 271 | (load == -ENODATA && !is_linux)) { |
---|
235 | 272 | AMP_E("Property missing!\n"); |
---|
236 | 273 | return -EINVAL; |
---|
237 | 274 | } |
---|
238 | 275 | aarch64 = (arch == IH_ARCH_ARM) ? 0 : 1; |
---|
239 | 276 | pe_state = PE_STATE(aarch64, hyp, thumb, 0); |
---|
240 | | - entry = load; |
---|
241 | 277 | |
---|
242 | 278 | #ifdef DEBUG |
---|
243 | 279 | AMP_I(" desc: %s\n", desc); |
---|
.. | .. |
---|
245 | 281 | AMP_I(" aarch64: %d\n", aarch64); |
---|
246 | 282 | AMP_I(" hyp: %d\n", hyp); |
---|
247 | 283 | AMP_I(" thumb: %d\n", thumb); |
---|
248 | | - AMP_I(" entry: 0x%08x\n", entry); |
---|
| 284 | + AMP_I(" load: 0x%08x\n", load); |
---|
249 | 285 | AMP_I(" pe_state: 0x%08x\n", pe_state); |
---|
250 | 286 | AMP_I(" linux-os: %d\n\n", is_linux); |
---|
251 | 287 | #endif |
---|
.. | .. |
---|
294 | 330 | ret = smc_cpu_on(cpu, pe_state, entry, &args, is_linux); |
---|
295 | 331 | if (ret) |
---|
296 | 332 | return ret; |
---|
297 | | - |
---|
| 333 | +exit: |
---|
298 | 334 | if (us) |
---|
299 | 335 | udelay(us); |
---|
300 | 336 | |
---|
.. | .. |
---|
336 | 372 | |
---|
337 | 373 | /* === only boot cpu can reach here === */ |
---|
338 | 374 | |
---|
339 | | - if (!g_bootcpu.linux_os) { |
---|
| 375 | + if (!g_bootcpu.linux_os && g_bootcpu.entry) { |
---|
340 | 376 | flush_dcache_all(); |
---|
341 | 377 | AMP_I("Brought up cpu[%x, self] with state 0x%x, entry 0x%08x ...", |
---|
342 | 378 | (u32)read_mpidr() & 0x0fff, g_bootcpu.state, g_bootcpu.entry); |
---|