1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
|
// SPDX-License-Identifier: GPL-2.0+
/*
* Copyright (C) 2020 Stefan Roese <sr@denx.de>
*/
#include <command.h>
#include <config.h>
#include <cpu_func.h>
#include <dm.h>
#include <elf.h>
#include <env.h>
#include <asm/global_data.h>
#include <asm/io.h>
#include <linux/compat.h>
#include <linux/ctype.h>
#include <linux/delay.h>
#include <linux/io.h>
#include <mach/cvmx-coremask.h>
#include <mach/cvmx-bootinfo.h>
#include <mach/cvmx-bootmem.h>
#include <mach/cvmx-regs.h>
#include <mach/cvmx-fuse.h>
#include <mach/octeon-model.h>
#include <mach/octeon-feature.h>
#include <mach/bootoct_cmd.h>
#include <mach/cvmx-ciu-defs.h>
DECLARE_GLOBAL_DATA_PTR;
/* ToDo: Revisit these settings */
#define OCTEON_RESERVED_LOW_MEM_SIZE (512 * 1024)
#define OCTEON_RESERVED_LOW_BOOT_MEM_SIZE (1024 * 1024)
#define BOOTLOADER_BOOTMEM_DESC_SPACE (1024 * 1024)
/* Default stack and heap sizes, in bytes */
#define DEFAULT_STACK_SIZE (1 * 1024 * 1024)
#define DEFAULT_HEAP_SIZE (3 * 1024 * 1024)
/**
* NOTE: This must duplicate octeon_boot_descriptor_t in the toolchain
* octeon-app-init.h file.
*/
enum {
/* If set, core should do app-wide init, only one core per app will have
* this flag set.
*/
BOOT_FLAG_INIT_CORE = 1,
OCTEON_BL_FLAG_DEBUG = 1 << 1,
OCTEON_BL_FLAG_NO_MAGIC = 1 << 2,
/* If set, use uart1 for console */
OCTEON_BL_FLAG_CONSOLE_UART1 = 1 << 3,
OCTEON_BL_FLAG_CONSOLE_PCI = 1 << 4, /* If set, use PCI console */
/* Call exit on break on serial port */
OCTEON_BL_FLAG_BREAK = 1 << 5,
/*
* Be sure to update OCTEON_APP_INIT_H_VERSION when new fields are added
* and to conditionalize the new flag's usage based on the version.
*/
} octeon_boot_descriptor_flag;
/**
* NOTE: This must duplicate octeon_boot_descriptor_t in the toolchain
* octeon-app-init.h file.
*/
#ifndef OCTEON_CURRENT_DESC_VERSION
# define OCTEON_CURRENT_DESC_VERSION 7
#endif
/**
* NOTE: This must duplicate octeon_boot_descriptor_t in the toolchain
* octeon-app-init.h file.
*/
/* Version 7 changes: Change names of deprecated fields */
#ifndef OCTEON_ARGV_MAX_ARGS
# define OCTEON_ARGV_MAX_ARGS 64
#endif
/**
* NOTE: This must duplicate octeon_boot_descriptor_t in the toolchain
* octeon-app-init.h file.
*/
#ifndef OCTEON_SERIAL_LEN
# define OCTEON_SERIAL_LEN 20
#endif
/**
* Bootloader structure used to pass info to Octeon executive startup code.
* NOTE: all fields are deprecated except for:
* * desc_version
* * desc_size,
* * heap_base
* * heap_end
* * eclock_hz
* * flags
* * argc
* * argv
* * cvmx_desc_vaddr
* * debugger_flags_base_addr
*
* All other fields have been moved to the cvmx_descriptor, and the new
* fields should be added there. They are left as placeholders in this
* structure for binary compatibility.
*
* NOTE: This structure must match what is in the toolchain octeon-app-init.h
* file.
*/
struct octeon_boot_descriptor {
/* Start of block referenced by assembly code - do not change! */
u32 desc_version;
u32 desc_size;
u64 stack_top;
u64 heap_base;
u64 heap_end;
u64 deprecated17;
u64 deprecated16;
/* End of block referenced by assembly code - do not change! */
u32 deprecated18;
u32 deprecated15;
u32 deprecated14;
u32 argc; /* argc for main() */
u32 argv[OCTEON_ARGV_MAX_ARGS]; /* argv for main() */
u32 flags; /* Flags for application */
u32 core_mask; /* Coremask running this image */
u32 dram_size; /* DEPRECATED, DRAM size in megabyes. Used up to SDK 1.8.1 */
u32 phy_mem_desc_addr;
u32 debugger_flags_base_addr; /* used to pass flags from app to debugger. */
u32 eclock_hz; /* CPU clock speed, in hz. */
u32 deprecated10;
u32 deprecated9;
u16 deprecated8;
u8 deprecated7;
u8 deprecated6;
u16 deprecated5;
u8 deprecated4;
u8 deprecated3;
char deprecated2[OCTEON_SERIAL_LEN];
u8 deprecated1[6];
u8 deprecated0;
u64 cvmx_desc_vaddr; /* Address of cvmx descriptor */
};
static struct octeon_boot_descriptor boot_desc[CVMX_MIPS_MAX_CORES];
static struct cvmx_bootinfo cvmx_bootinfo_array[CVMX_MIPS_MAX_CORES];
/**
* Programs the boot bus moveable region
* @param base base address to place the boot bus moveable region
* (bits [31:7])
* @param region_num Selects which region, 0 or 1 for node 0,
* 2 or 3 for node 1
* @param enable Set true to enable, false to disable
* @param data Pointer to data to put in the region, up to
* 16 dwords.
* @param num_words Number of data dwords (up to 32)
*
* Return: 0 for success, -1 on error
*/
static int octeon_set_moveable_region(u32 base, int region_num,
bool enable, const u64 *data,
unsigned int num_words)
{
int node = region_num >> 1;
u64 val;
int i;
u8 node_mask = 0x01; /* ToDo: Currently only one node is supported */
debug("%s(0x%x, %d, %d, %p, %u)\n", __func__, base, region_num, enable,
data, num_words);
if (num_words > 32) {
printf("%s: Too many words (%d) for region %d\n", __func__,
num_words, region_num);
return -1;
}
if (base & 0x7f) {
printf("%s: Error: base address 0x%x must be 128 byte aligned\n",
__func__, base);
return -1;
}
if (region_num > (node_mask > 1 ? 3 : 1)) {
printf("%s: Region number %d out of range\n",
__func__, region_num);
return -1;
}
if (!data && num_words > 0) {
printf("%s: Error: NULL data\n", __func__);
return -1;
}
region_num &= 1;
val = MIO_BOOT_LOC_CFG_EN |
FIELD_PREP(MIO_BOOT_LOC_CFG_BASE, base >> 7);
debug("%s: Setting MIO_BOOT_LOC_CFG(%d) on node %d to 0x%llx\n",
__func__, region_num, node, val);
csr_wr(CVMX_MIO_BOOT_LOC_CFGX(region_num & 1), val);
val = FIELD_PREP(MIO_BOOT_LOC_ADR_ADR, (region_num ? 0x80 : 0x00) >> 3);
debug("%s: Setting MIO_BOOT_LOC_ADR start to 0x%llx\n", __func__, val);
csr_wr(CVMX_MIO_BOOT_LOC_ADR, val);
for (i = 0; i < num_words; i++) {
debug(" 0x%02llx: 0x%016llx\n",
csr_rd(CVMX_MIO_BOOT_LOC_ADR), data[i]);
csr_wr(CVMX_MIO_BOOT_LOC_DAT, data[i]);
}
return 0;
}
/**
* Parse comma separated numbers into an array
*
* @param[out] values values read for each node
* @param[in] str string to parse
* @param base 0 for auto, otherwise 8, 10 or 16 for the number base
*
* Return: number of values read.
*/
static int octeon_parse_nodes(u64 values[CVMX_MAX_NODES],
const char *str, int base)
{
int node = 0;
char *sep;
do {
debug("Parsing node %d: \"%s\"\n", node, str);
values[node] = simple_strtoull(str, &sep, base);
debug(" node %d: 0x%llx\n", node, values[node]);
str = sep + 1;
} while (++node < CVMX_MAX_NODES && *sep == ',');
debug("%s: returning %d\n", __func__, node);
return node;
}
/**
* Parse command line arguments
*
* @param argc number of arguments
* @param[in] argv array of argument strings
* @param cmd command type
* @param[out] boot_args parsed values
*
* Return: number of arguments parsed
*/
int octeon_parse_bootopts(int argc, char *const argv[],
enum octeon_boot_cmd_type cmd,
struct octeon_boot_args *boot_args)
{
u64 node_values[CVMX_MAX_NODES];
int arg, j;
int num_values;
int node;
u8 node_mask = 0x01; /* ToDo: Currently only one node is supported */
debug("%s(%d, %p, %d, %p)\n", __func__, argc, argv, cmd, boot_args);
memset(boot_args, 0, sizeof(*boot_args));
boot_args->stack_size = DEFAULT_STACK_SIZE;
boot_args->heap_size = DEFAULT_HEAP_SIZE;
boot_args->node_mask = 0;
for (arg = 0; arg < argc; arg++) {
debug(" argv[%d]: %s\n", arg, argv[arg]);
if (cmd == BOOTOCT && !strncmp(argv[arg], "stack=", 6)) {
boot_args->stack_size = simple_strtoul(argv[arg] + 6,
NULL, 0);
} else if (cmd == BOOTOCT && !strncmp(argv[arg], "heap=", 5)) {
boot_args->heap_size = simple_strtoul(argv[arg] + 5,
NULL, 0);
} else if (!strncmp(argv[arg], "debug", 5)) {
puts("setting debug flag!\n");
boot_args->boot_flags |= OCTEON_BL_FLAG_DEBUG;
} else if (cmd == BOOTOCT && !strncmp(argv[arg], "break", 5)) {
puts("setting break flag!\n");
boot_args->boot_flags |= OCTEON_BL_FLAG_BREAK;
} else if (!strncmp(argv[arg], "forceboot", 9)) {
boot_args->forceboot = true;
} else if (!strncmp(argv[arg], "nodemask=", 9)) {
boot_args->node_mask = hextoul(argv[arg] + 9, NULL);
} else if (!strncmp(argv[arg], "numcores=", 9)) {
memset(node_values, 0, sizeof(node_values));
num_values = octeon_parse_nodes(node_values,
argv[arg] + 9, 0);
for (j = 0; j < num_values; j++)
boot_args->num_cores[j] = node_values[j];
boot_args->num_cores_set = true;
} else if (!strncmp(argv[arg], "skipcores=", 10)) {
memset(node_values, 0, sizeof(node_values));
num_values = octeon_parse_nodes(node_values,
argv[arg] + 10, 0);
for (j = 0; j < num_values; j++)
boot_args->num_skipped[j] = node_values[j];
boot_args->num_skipped_set = true;
} else if (!strncmp(argv[arg], "console_uart=", 13)) {
boot_args->console_uart = simple_strtoul(argv[arg] + 13,
NULL, 0);
if (boot_args->console_uart == 1) {
boot_args->boot_flags |=
OCTEON_BL_FLAG_CONSOLE_UART1;
} else if (!boot_args->console_uart) {
boot_args->boot_flags &=
~OCTEON_BL_FLAG_CONSOLE_UART1;
}
} else if (!strncmp(argv[arg], "coremask=", 9)) {
memset(node_values, 0, sizeof(node_values));
num_values = octeon_parse_nodes(node_values,
argv[arg] + 9, 16);
for (j = 0; j < num_values; j++)
cvmx_coremask_set64_node(&boot_args->coremask,
j, node_values[j]);
boot_args->coremask_set = true;
} else if (cmd == BOOTOCTLINUX &&
!strncmp(argv[arg], "namedblock=", 11)) {
boot_args->named_block = argv[arg] + 11;
} else if (!strncmp(argv[arg], "endbootargs", 11)) {
boot_args->endbootargs = 1;
arg++;
if (argc >= arg && cmd != BOOTOCTLINUX)
boot_args->app_name = argv[arg];
break;
} else {
debug(" Unknown argument \"%s\"\n", argv[arg]);
}
}
if (boot_args->coremask_set && boot_args->num_cores_set) {
puts("Warning: both coremask and numcores are set, using coremask.\n");
} else if (!boot_args->coremask_set && !boot_args->num_cores_set) {
cvmx_coremask_set_core(&boot_args->coremask, 0);
boot_args->coremask_set = true;
} else if ((!boot_args->coremask_set) && boot_args->num_cores_set) {
cvmx_coremask_for_each_node(node, node_mask)
cvmx_coremask_set64_node(&boot_args->coremask, node,
((1ull << boot_args->num_cores[node]) - 1) <<
boot_args->num_skipped[node]);
boot_args->coremask_set = true;
}
/* Update the node mask based on the coremask or the number of cores */
for (j = 0; j < CVMX_MAX_NODES; j++) {
if (cvmx_coremask_get64_node(&boot_args->coremask, j))
boot_args->node_mask |= 1 << j;
}
debug("%s: return %d\n", __func__, arg);
return arg;
}
int do_bootoctlinux(struct cmd_tbl *cmdtp, int flag, int argc,
char *const argv[])
{
typedef void __noreturn (*kernel_entry_t)(int, ulong, ulong, ulong);
kernel_entry_t kernel;
struct octeon_boot_args boot_args;
int arg_start = 1;
int arg_count;
u64 addr = 0; /* Address of the ELF image */
int arg0;
u64 arg1;
u64 arg2;
u64 arg3;
int ret;
struct cvmx_coremask core_mask;
struct cvmx_coremask coremask_to_run;
struct cvmx_coremask avail_coremask;
int first_core;
int core;
const u64 *nmi_code;
int num_dwords;
u8 node_mask = 0x01;
int i;
cvmx_coremask_clear_all(&core_mask);
cvmx_coremask_clear_all(&coremask_to_run);
if (argc >= 2 && (isxdigit(argv[1][0]) && (isxdigit(argv[1][1]) ||
argv[1][1] == 'x' ||
argv[1][1] == 'X' ||
argv[1][1] == '\0'))) {
addr = hextoul(argv[1], NULL);
if (!addr)
addr = CONFIG_SYS_LOAD_ADDR;
arg_start++;
}
if (addr == 0)
addr = CONFIG_SYS_LOAD_ADDR;
debug("%s: arg start: %d\n", __func__, arg_start);
arg_count = octeon_parse_bootopts(argc - arg_start, argv + arg_start,
BOOTOCTLINUX, &boot_args);
debug("%s:\n"
" named block: %s\n"
" node mask: 0x%x\n"
" stack size: 0x%x\n"
" heap size: 0x%x\n"
" boot flags: 0x%x\n"
" force boot: %s\n"
" coremask set: %s\n"
" num cores set: %s\n"
" num skipped set: %s\n"
" endbootargs: %s\n",
__func__,
boot_args.named_block ? boot_args.named_block : "none",
boot_args.node_mask,
boot_args.stack_size,
boot_args.heap_size,
boot_args.boot_flags,
boot_args.forceboot ? "true" : "false",
boot_args.coremask_set ? "true" : "false",
boot_args.num_cores_set ? "true" : "false",
boot_args.num_skipped_set ? "true" : "false",
boot_args.endbootargs ? "true" : "false");
debug(" num cores: ");
for (i = 0; i < CVMX_MAX_NODES; i++)
debug("%s%d", i > 0 ? ", " : "", boot_args.num_cores[i]);
debug("\n num skipped: ");
for (i = 0; i < CVMX_MAX_NODES; i++) {
debug("%s%d", i > 0 ? ", " : "", boot_args.num_skipped[i]);
debug("\n coremask:\n");
cvmx_coremask_dprint(&boot_args.coremask);
}
if (boot_args.endbootargs) {
debug("endbootargs set, adjusting argc from %d to %d, arg_count: %d, arg_start: %d\n",
argc, argc - (arg_count + arg_start), arg_count,
arg_start);
argc -= (arg_count + arg_start);
argv += (arg_count + arg_start);
}
/*
* numcores specification overrides a coremask on the same command line
*/
cvmx_coremask_copy(&core_mask, &boot_args.coremask);
/*
* Remove cores from coremask based on environment variable stored in
* flash
*/
if (validate_coremask(&core_mask) != 0) {
puts("Invalid coremask.\n");
return 1;
} else if (cvmx_coremask_is_empty(&core_mask)) {
puts("Coremask is empty after coremask_override mask. Nothing to do.\n");
return 0;
}
if (cvmx_coremask_intersects(&core_mask, &coremask_to_run)) {
puts("ERROR: Can't load code on core twice! Provided coremask:\n");
cvmx_coremask_print(&core_mask);
puts("overlaps previously loaded coremask:\n");
cvmx_coremask_print(&coremask_to_run);
return -1;
}
debug("Setting up boot descriptor block with core mask:\n");
cvmx_coremask_dprint(&core_mask);
/*
* Add coremask to global mask of cores that have been set up and are
* runable
*/
cvmx_coremask_or(&coremask_to_run, &coremask_to_run, &core_mask);
/*
* Load kernel ELF image, or try binary if ELF is not detected.
* This way the much smaller vmlinux.bin can also be started but
* has to be loaded at the correct address (ep as parameter).
*/
if (!valid_elf_image(addr))
printf("Booting binary image instead (vmlinux.bin)...\n");
else
addr = load_elf_image_shdr(addr);
/* Set kernel entry point */
kernel = (kernel_entry_t)addr;
/* Init bootmem list for Linux kernel booting */
if (!cvmx_bootmem_phy_mem_list_init(
gd->ram_size, OCTEON_RESERVED_LOW_MEM_SIZE,
(void *)CKSEG0ADDR(BOOTLOADER_BOOTMEM_DESC_SPACE))) {
printf("FATAL: Error initializing free memory list\n");
return 0;
}
first_core = cvmx_coremask_get_first_core(&coremask_to_run);
cvmx_coremask_for_each_core(core, &coremask_to_run) {
debug("%s: Activating core %d\n", __func__, core);
cvmx_bootinfo_array[core].core_mask =
cvmx_coremask_get32(&coremask_to_run);
cvmx_coremask_copy(&cvmx_bootinfo_array[core].ext_core_mask,
&coremask_to_run);
if (core == first_core)
cvmx_bootinfo_array[core].flags |= BOOT_FLAG_INIT_CORE;
cvmx_bootinfo_array[core].dram_size = gd->ram_size /
(1024 * 1024);
cvmx_bootinfo_array[core].dclock_hz = gd->mem_clk * 1000000;
cvmx_bootinfo_array[core].eclock_hz = gd->cpu_clk;
cvmx_bootinfo_array[core].led_display_base_addr = 0;
cvmx_bootinfo_array[core].phy_mem_desc_addr =
((u32)(u64)__cvmx_bootmem_internal_get_desc_ptr()) &
0x7ffffff;
cvmx_bootinfo_array[core].major_version = CVMX_BOOTINFO_MAJ_VER;
cvmx_bootinfo_array[core].minor_version = CVMX_BOOTINFO_MIN_VER;
cvmx_bootinfo_array[core].fdt_addr = virt_to_phys(gd->fdt_blob);
boot_desc[core].dram_size = gd->ram_size / (1024 * 1024);
boot_desc[core].cvmx_desc_vaddr =
virt_to_phys(&cvmx_bootinfo_array[core]);
boot_desc[core].desc_version = OCTEON_CURRENT_DESC_VERSION;
boot_desc[core].desc_size = sizeof(boot_desc[0]);
boot_desc[core].flags = cvmx_bootinfo_array[core].flags;
boot_desc[core].eclock_hz = cvmx_bootinfo_array[core].eclock_hz;
boot_desc[core].argc = argc;
for (i = 0; i < argc; i++)
boot_desc[core].argv[i] = (u32)virt_to_phys(argv[i]);
}
core = 0;
arg0 = argc;
arg1 = (u64)argv;
arg2 = 0x1; /* Core 0 sets init core for Linux */
arg3 = XKPHYS | virt_to_phys(&boot_desc[core]);
debug("## Transferring control to Linux (at address %p) ...\n", kernel);
/*
* Flush cache before jumping to application. Let's flush the
* whole SDRAM area, since we don't know the size of the image
* that was loaded.
*/
flush_cache(gd->ram_base, gd->ram_top - gd->ram_base);
/* Take all cores out of reset */
csr_wr(CVMX_CIU_PP_RST, 0);
sync();
/* Wait a short while for the other cores... */
mdelay(100);
/* Install boot code into moveable bus for NMI (other cores) */
nmi_code = (const u64 *)nmi_bootvector;
num_dwords = (((u64)&nmi_handler_para[0] - (u64)nmi_code) + 7) / 8;
ret = octeon_set_moveable_region(0x1fc00000, 0, true, nmi_code,
num_dwords);
if (ret) {
printf("Error installing NMI handler for SMP core startup\n");
return 0;
}
/* Write NMI handler parameters for Linux kernel booting */
nmi_handler_para[0] = (u64)kernel;
nmi_handler_para[1] = arg0;
nmi_handler_para[2] = arg1;
nmi_handler_para[3] = 0; /* Don't set init core for secondary cores */
nmi_handler_para[4] = arg3;
sync();
/* Wait a short while for the other cores... */
mdelay(100);
/*
* Cores have already been taken out of reset to conserve power.
* We need to send a NMI to get the cores out of their wait loop
*/
octeon_get_available_coremask(&avail_coremask);
debug("Available coremask:\n");
cvmx_coremask_dprint(&avail_coremask);
debug("Starting coremask:\n");
cvmx_coremask_dprint(&coremask_to_run);
debug("Sending NMIs to other cores\n");
if (octeon_has_feature(OCTEON_FEATURE_CIU3)) {
u64 avail_cm;
int node;
cvmx_coremask_for_each_node(node, node_mask) {
avail_cm = cvmx_coremask_get64_node(&avail_coremask,
node);
if (avail_cm != 0) {
debug("Sending NMI to node %d, coremask=0x%llx, CIU3_NMI=0x%llx\n",
node, avail_cm,
(node > 0 ? -1ull : -2ull) & avail_cm);
csr_wr(CVMX_CIU3_NMI,
(node > 0 ? -1ull : -2ull) & avail_cm);
}
}
} else {
csr_wr(CVMX_CIU_NMI,
-2ull & cvmx_coremask_get64(&avail_coremask));
}
debug("Done sending NMIs\n");
/* Wait a short while for the other cores... */
mdelay(100);
/*
* pass address parameter as argv[0] (aka command name),
* and all remaining args
* a0 = argc
* a1 = argv (32 bit physical addresses, not pointers)
* a2 = init core
* a3 = boot descriptor address
* a4/t0 = entry point (only used by assembly stub)
*/
kernel(arg0, arg1, arg2, arg3);
return 0;
}
U_BOOT_CMD(bootoctlinux, 32, 0, do_bootoctlinux,
"Boot from a linux ELF image in memory",
"elf_address [coremask=mask_to_run | numcores=core_cnt_to_run] "
"[forceboot] [skipcores=core_cnt_to_skip] [namedblock=name] [endbootargs] [app_args ...]\n"
"elf_address - address of ELF image to load. If 0, default load address\n"
" is used.\n"
"coremask - mask of cores to run on. Anded with coremask_override\n"
" environment variable to ensure only working cores are used\n"
"numcores - number of cores to run on. Runs on specified number of cores,\n"
" taking into account the coremask_override.\n"
"skipcores - only meaningful with numcores. Skips this many cores\n"
" (starting from 0) when loading the numcores cores.\n"
" For example, setting skipcores to 1 will skip core 0\n"
" and load the application starting at the next available core.\n"
"forceboot - if set, boots application even if core 0 is not in mask\n"
"namedblock - specifies a named block to load the kernel\n"
"endbootargs - if set, bootloader does not process any further arguments and\n"
" only passes the arguments that follow to the kernel.\n"
" If not set, the kernel gets the entire commnad line as\n"
" arguments.\n" "\n");
|