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