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; }
void bt_do_bug(void *pc) { #ifndef BT_CONFIG_KERNEL_NONE BT_StopSystemTimer(); #endif BT_DisableInterrupts(); BT_kPrint("%p, 0x%08x",pc,*((BT_u32 *)pc)); BT_kPrint("Step 1. DO NOT PANIC!"); BT_kPrint("Step 2. Take a deep breath"); BT_kPrint("Step 3. Read the bad news below:"); BT_kPrint("============================================================="); BT_kPrint("Kernel Panic: Segmentation fault! at %p", pc); BT_kPrint("Lookup the address in your kernel.list file........."); BT_kPrint("============================================================="); BT_kPrint("Step 4. Grab a coffee and know that all will be well!"); while(1); }
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; }