mpboot.S revision 204617
1203697Sneel/*- 2203697Sneel * Copyright (c) 2010 Neelkanth Natu 3203697Sneel * All rights reserved. 4203697Sneel * 5203697Sneel * Redistribution and use in source and binary forms, with or without 6203697Sneel * modification, are permitted provided that the following conditions 7203697Sneel * are met: 8203697Sneel * 1. Redistributions of source code must retain the above copyright 9203697Sneel * notice, this list of conditions and the following disclaimer. 10203697Sneel * 2. Redistributions in binary form must reproduce the above copyright 11203697Sneel * notice, this list of conditions and the following disclaimer in the 12203697Sneel * documentation and/or other materials provided with the distribution. 13203697Sneel * 14203697Sneel * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 15203697Sneel * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16203697Sneel * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17203697Sneel * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 18203697Sneel * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19203697Sneel * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20203697Sneel * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21203697Sneel * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22203697Sneel * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23203697Sneel * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24203697Sneel * SUCH DAMAGE. 25203697Sneel * 26203697Sneel * $FreeBSD: head/sys/mips/mips/mpboot.S 204617 2010-03-03 02:46:36Z imp $ 27203697Sneel */ 28203697Sneel 29203697Sneel#include <machine/asm.h> 30203697Sneel#include <machine/cpu.h> 31203697Sneel#include <machine/cpuregs.h> 32203697Sneel 33203697Sneel#include "assym.s" 34203697Sneel 35203697Sneel .text 36203697Sneel .set noat 37203697Sneel .set noreorder 38203697Sneel 39203697SneelGLOBAL(mpentry) 40203697Sneel mtc0 zero, COP_0_STATUS_REG /* disable interrupts */ 41203697Sneel 42203697Sneel mtc0 zero, COP_0_CAUSE_REG /* clear soft interrupts */ 43203697Sneel 44203697Sneel li t0, CFG_K0_CACHED /* make sure kseg0 is cached */ 45203697Sneel mtc0 t0, MIPS_COP_0_CONFIG 46203697Sneel COP0_SYNC 47203697Sneel 48203697Sneel jal platform_processor_id /* get the processor number */ 49203697Sneel nop 50203697Sneel move s0, v0 51203697Sneel 52203697Sneel /* 53203697Sneel * Initialize stack and call machine startup 54203697Sneel */ 55203697Sneel PTR_LA sp, _C_LABEL(pcpu_space) 56204617Simp addiu sp, (NBPG * 2) - CALLFRAME_SIZ 57203697Sneel sll t0, s0, PAGE_SHIFT + 1 58203697Sneel addu sp, sp, t0 59203697Sneel 60203697Sneel /* Zero out old ra and old fp for debugger */ 61204617Simp sw zero, CALLFRAME_SIZ - 4(sp) 62204617Simp sw zero, CALLFRAME_SIZ - 8(sp) 63203697Sneel 64203697Sneel PTR_LA gp, _C_LABEL(_gp) 65203697Sneel 66203697Sneel jal platform_init_ap 67203697Sneel move a0, s0 68203697Sneel 69203697Sneel jal smp_init_secondary 70203697Sneel move a0, s0 71203697Sneel 72203697Sneel PANIC("AP startup failed!") 73