int arch_bootm(BT_u32 coreID, void *start_addr, void *fdt_addr) { BT_u32 machine_id = 0; BT_ENV_VARIABLE *machid = BT_ShellGetEnv("machid"); if(!machid) { printf("Warning : machine_id was not defined, set ${machid}:\n" "e.g : setenv machid 0xabad1dea\n"); } else { machine_id = strtoul(machid->o.string->s, NULL, 16); } BT_DCacheFlush(); BT_ICacheInvalidate(); BT_DCacheDisable(); if(coreID == BT_GetCoreID()) { BT_StopSystemTimer(); BT_DisableInterrupts(); jump_regs jumpr = (jump_regs) start_addr; jumpr(0, machine_id, (BT_u32) fdt_addr, 0); return -1; // Is this such a good idea? Could be in an indefined state. } else { BT_BootCore(coreID, start_addr, 0, machine_id, (bt_register_t) fdt_addr, 0); // Use the platform BootCore to run the boot_core function. } return 0; }
static int bt_boot(int argc, char **argv) { if(argc != 2 && argc != 4) { bt_printf("Usage: %s {--core [coreID]} [start-address]\n", argv[0]); return -1; } BT_u32 coreID = 0; BT_u32 addr; if(argc == 4) { if(strcmp(argv[1], "--core")) { bt_printf("Invalid argument %s\n", argv[1]); return -1; } coreID = strtol(argv[2], NULL, 10); addr = strtol(argv[3], NULL, 16); } else { addr = strtol(argv[1], NULL, 16); } void *p = (void *) addr; BT_DCacheFlush(); BT_ICacheInvalidate(); BT_DCacheDisable(); if(!coreID) { BT_StopSystemTimer(); BT_DisableInterrupts(); jump jmp = p; jmp(); while(1) { __asm__ (""); } } else { // Must use MACH core boot interface. BT_BootCore(coreID, p); } return 0; }
static int bt_boot_jtag(int argc, char **argv) { if(argc != 3) { bt_printf("Usage: %s --core [coreID]\n", argv[0]); return -1; } BT_u32 coreID = 0; if(strcmp(argv[1], "--core")) { bt_printf("Invalid argument %s\n", argv[1]); return -1; } coreID = strtoul(argv[2], NULL, 10); void *p = (void *) wait_jtag; BT_DCacheFlush(); BT_ICacheInvalidate(); if(!coreID) { BT_StopSystemTimer(); BT_DisableInterrupts(); jump jmp = p; jmp(); while(1) { __asm__ (""); } } else { // Must use MACH core boot interface. BT_BootCore(coreID, p); } return 0; }