xref: /OK3568_Linux_fs/kernel/arch/mips/include/asm/octeon/cvmx-boot-vector.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun /*
2*4882a593Smuzhiyun  * This file is subject to the terms and conditions of the GNU General Public
3*4882a593Smuzhiyun  * License.  See the file "COPYING" in the main directory of this archive
4*4882a593Smuzhiyun  * for more details.
5*4882a593Smuzhiyun  *
6*4882a593Smuzhiyun  * Copyright (C) 2003-2017 Cavium, Inc.
7*4882a593Smuzhiyun  */
8*4882a593Smuzhiyun 
9*4882a593Smuzhiyun #ifndef __CVMX_BOOT_VECTOR_H__
10*4882a593Smuzhiyun #define __CVMX_BOOT_VECTOR_H__
11*4882a593Smuzhiyun 
12*4882a593Smuzhiyun #include <asm/octeon/octeon.h>
13*4882a593Smuzhiyun 
14*4882a593Smuzhiyun /*
15*4882a593Smuzhiyun  * The boot vector table is made up of an array of 1024 elements of
16*4882a593Smuzhiyun  * struct cvmx_boot_vector_element.  There is one entry for each
17*4882a593Smuzhiyun  * possible MIPS CPUNum, indexed by the CPUNum.
18*4882a593Smuzhiyun  *
19*4882a593Smuzhiyun  * Once cvmx_boot_vector_get() returns a non-NULL value (indicating
20*4882a593Smuzhiyun  * success), NMI to a core will cause execution to transfer to the
21*4882a593Smuzhiyun  * target_ptr location for that core's entry in the vector table.
22*4882a593Smuzhiyun  *
23*4882a593Smuzhiyun  * The struct cvmx_boot_vector_element fields app0, app1, and app2 can
24*4882a593Smuzhiyun  * be used by the application that has set the target_ptr in any
25*4882a593Smuzhiyun  * application specific manner, they are not touched by the vectoring
26*4882a593Smuzhiyun  * code.
27*4882a593Smuzhiyun  *
28*4882a593Smuzhiyun  * The boot vector code clobbers the CP0_DESAVE register, and on
29*4882a593Smuzhiyun  * OCTEON II and later CPUs also clobbers CP0_KScratch2.  All GP
30*4882a593Smuzhiyun  * registers are preserved, except on pre-OCTEON II CPUs, where k1 is
31*4882a593Smuzhiyun  * clobbered.
32*4882a593Smuzhiyun  *
33*4882a593Smuzhiyun  */
34*4882a593Smuzhiyun 
35*4882a593Smuzhiyun 
36*4882a593Smuzhiyun /*
37*4882a593Smuzhiyun  * Applications install the boot bus code in cvmx-boot-vector.c, which
38*4882a593Smuzhiyun  * uses this magic:
39*4882a593Smuzhiyun  */
40*4882a593Smuzhiyun #define OCTEON_BOOT_MOVEABLE_MAGIC1 0xdb00110ad358eacdull
41*4882a593Smuzhiyun 
42*4882a593Smuzhiyun struct cvmx_boot_vector_element {
43*4882a593Smuzhiyun 	/* kseg0 or xkphys address of target code. */
44*4882a593Smuzhiyun 	uint64_t target_ptr;
45*4882a593Smuzhiyun 	/* Three application specific arguments. */
46*4882a593Smuzhiyun 	uint64_t app0;
47*4882a593Smuzhiyun 	uint64_t app1;
48*4882a593Smuzhiyun 	uint64_t app2;
49*4882a593Smuzhiyun };
50*4882a593Smuzhiyun 
51*4882a593Smuzhiyun struct cvmx_boot_vector_element *cvmx_boot_vector_get(void);
52*4882a593Smuzhiyun 
53*4882a593Smuzhiyun #endif /* __CVMX_BOOT_VECTOR_H__ */
54