Path: blob/master/arch/blackfin/mach-bf561/secondary.S
10819 views
/*1* BF561 coreB bootstrap file2*3* Copyright 2007-2009 Analog Devices Inc.4* Philippe Gerum <[email protected]>5*6* Licensed under the GPL-2 or later.7*/89#include <linux/linkage.h>10#include <linux/init.h>11#include <asm/blackfin.h>12#include <asm/asm-offsets.h>13#include <asm/trace.h>1415/*16* This code must come first as CoreB is hardcoded (in hardware)17* to start at the beginning of its L1 instruction memory.18*/19.section .l1.text.head2021/* Lay the initial stack into the L1 scratch area of Core B */22#define INITIAL_STACK (COREB_L1_SCRATCH_START + L1_SCRATCH_LENGTH - 12)2324ENTRY(_coreb_trampoline_start)25/* Set the SYSCFG register */26R0 = 0x36;27SYSCFG = R0; /*Enable Cycle Counter and Nesting Of Interrupts(3rd Bit)*/28R0 = 0;2930/*Clear Out All the data and pointer Registers*/31R1 = R0;32R2 = R0;33R3 = R0;34R4 = R0;35R5 = R0;36R6 = R0;37R7 = R0;3839P0 = R0;40P1 = R0;41P2 = R0;42P3 = R0;43P4 = R0;44P5 = R0;4546LC0 = r0;47LC1 = r0;48L0 = r0;49L1 = r0;50L2 = r0;51L3 = r0;5253/* Clear Out All the DAG Registers*/54B0 = r0;55B1 = r0;56B2 = r0;57B3 = r0;5859I0 = r0;60I1 = r0;61I2 = r0;62I3 = r0;6364M0 = r0;65M1 = r0;66M2 = r0;67M3 = r0;6869trace_buffer_init(p0,r0);7071/* Turn off the icache */72p0.l = LO(IMEM_CONTROL);73p0.h = HI(IMEM_CONTROL);74R1 = [p0];75R0 = ~ENICPLB;76R0 = R0 & R1;7778/* Disabling of CPLBs should be proceeded by a CSYNC */79CSYNC;80[p0] = R0;81SSYNC;8283/* Turn off the dcache */84p0.l = LO(DMEM_CONTROL);85p0.h = HI(DMEM_CONTROL);86R1 = [p0];87R0 = ~ENDCPLB;88R0 = R0 & R1;8990/* Disabling of CPLBs should be proceeded by a CSYNC */91CSYNC;92[p0] = R0;93SSYNC;9495/* in case of double faults, save a few things */96p0.l = _init_retx_coreb;97p0.h = _init_retx_coreb;98R0 = RETX;99[P0] = R0;100101#ifdef CONFIG_DEBUG_DOUBLEFAULT102/* Only save these if we are storing them,103* This happens here, since L1 gets clobbered104* below105*/106GET_PDA(p0, r0);107r7 = [p0 + PDA_DF_RETX];108p1.l = _init_saved_retx_coreb;109p1.h = _init_saved_retx_coreb;110[p1] = r7;111112r7 = [p0 + PDA_DF_DCPLB];113p1.l = _init_saved_dcplb_fault_addr_coreb;114p1.h = _init_saved_dcplb_fault_addr_coreb;115[p1] = r7;116117r7 = [p0 + PDA_DF_ICPLB];118p1.l = _init_saved_icplb_fault_addr_coreb;119p1.h = _init_saved_icplb_fault_addr_coreb;120[p1] = r7;121122r7 = [p0 + PDA_DF_SEQSTAT];123p1.l = _init_saved_seqstat_coreb;124p1.h = _init_saved_seqstat_coreb;125[p1] = r7;126#endif127128/* Initialize stack pointer */129sp.l = lo(INITIAL_STACK);130sp.h = hi(INITIAL_STACK);131fp = sp;132usp = sp;133134/* This section keeps the processor in supervisor mode135* during core B startup. Branches to the idle task.136*/137138/* EVT15 = _real_start */139140p0.l = lo(EVT15);141p0.h = hi(EVT15);142p1.l = _coreb_start;143p1.h = _coreb_start;144[p0] = p1;145csync;146147p0.l = lo(IMASK);148p0.h = hi(IMASK);149p1.l = IMASK_IVG15;150p1.h = 0x0;151[p0] = p1;152csync;153154raise 15;155p0.l = .LWAIT_HERE;156p0.h = .LWAIT_HERE;157reti = p0;158#if defined(ANOMALY_05000281)159nop; nop; nop;160#endif161rti;162163.LWAIT_HERE:164jump .LWAIT_HERE;165ENDPROC(_coreb_trampoline_start)166167#ifdef CONFIG_HOTPLUG_CPU168.section ".text"169ENTRY(_coreb_die)170sp.l = lo(INITIAL_STACK);171sp.h = hi(INITIAL_STACK);172fp = sp;173usp = sp;174175CLI R2;176SSYNC;177IDLE;178STI R2;179180R0 = IWR_DISABLE_ALL;181P0.H = hi(SYSMMR_BASE);182P0.L = lo(SYSMMR_BASE);183[P0 + (SICB_IWR0 - SYSMMR_BASE)] = R0;184[P0 + (SICB_IWR1 - SYSMMR_BASE)] = R0;185SSYNC;186187p0.h = hi(COREB_L1_CODE_START);188p0.l = lo(COREB_L1_CODE_START);189jump (p0);190ENDPROC(_coreb_die)191#endif192193__INIT194ENTRY(_coreb_start)195[--sp] = reti;196197p0.l = lo(WDOGB_CTL);198p0.h = hi(WDOGB_CTL);199r0 = 0xAD6(z);200w[p0] = r0; /* Clear the watchdog. */201ssync;202203/*204* switch to IDLE stack.205*/206p0.l = _secondary_stack;207p0.h = _secondary_stack;208sp = [p0];209usp = sp;210fp = sp;211#ifdef CONFIG_HOTPLUG_CPU212p0.l = _hotplug_coreb;213p0.h = _hotplug_coreb;214r0 = [p0];215cc = BITTST(r0, 0);216if cc jump 3f;217#endif218sp += -12;219call _init_pda220sp += 12;221#ifdef CONFIG_HOTPLUG_CPU2223:223#endif224call _secondary_start_kernel;225.L_exit:226jump.s .L_exit;227ENDPROC(_coreb_start)228229230