sb_asm.S revision 205675
1130561Sobrien/*-
277298Sobrien * Copyright (c) 2009 Neelkanth Natu
3218822Sdim * All rights reserved.
438889Sjdp *
533965Sjdp * Redistribution and use in source and binary forms, with or without
6130561Sobrien * modification, are permitted provided that the following conditions
733965Sjdp * are met:
8130561Sobrien * 1. Redistributions of source code must retain the above copyright
9130561Sobrien *    notice, this list of conditions and the following disclaimer.
10130561Sobrien * 2. Redistributions in binary form must reproduce the above copyright
11130561Sobrien *    notice, this list of conditions and the following disclaimer in the
1233965Sjdp *    documentation and/or other materials provided with the distribution.
13130561Sobrien *
14130561Sobrien * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15130561Sobrien * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16130561Sobrien * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1733965Sjdp * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18130561Sobrien * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19130561Sobrien * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20218822Sdim * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21218822Sdim * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2233965Sjdp * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23130561Sobrien * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2433965Sjdp * SUCH DAMAGE.
2533965Sjdp *
2633965Sjdp * $FreeBSD: head/sys/mips/sibyte/sb_asm.S 205675 2010-03-26 07:15:27Z neel $
2733965Sjdp */
2833965Sjdp
2933965Sjdp#include <machine/asm.h>
3033965Sjdp#include <machine/cpuregs.h>
3133965Sjdp
3233965Sjdp.set	mips64
3333965Sjdp.set	noat
3433965Sjdp.set	noreorder
3533965Sjdp
3633965Sjdp#ifdef SMP
3733965Sjdp/*
3833965Sjdp * This function must be implemented in assembly because it is called early
3933965Sjdp * in AP boot without a valid stack.
4033965Sjdp *
4133965Sjdp * This cpu number is available in bits 25 to 27 of the coprocessor 0 PRID
4233965Sjdp * register. This is not documented in the BCM1250 user manual but can be
4333965Sjdp * gleaned from the CFE source code - see sb1250_altcpu.S
4433965Sjdp */
4533965SjdpLEAF(platform_processor_id)
4633965Sjdp	mfc0	v0, MIPS_COP_0_PRID
4733965Sjdp	srl	v0, v0, 25
4833965Sjdp	jr	ra
4933965Sjdp	and	v0, v0, 7
5033965SjdpEND(platform_processor_id)
5133965Sjdp#endif	/* SMP */
5233965Sjdp