18c2ecf20Sopenharmony_ci/*
28c2ecf20Sopenharmony_ci * This file is subject to the terms and conditions of the GNU General Public
38c2ecf20Sopenharmony_ci * License.  See the file "COPYING" in the main directory of this archive
48c2ecf20Sopenharmony_ci * for more details.
58c2ecf20Sopenharmony_ci *
68c2ecf20Sopenharmony_ci * Copyright (C) 2003-2017 Cavium, Inc.
78c2ecf20Sopenharmony_ci */
88c2ecf20Sopenharmony_ci
98c2ecf20Sopenharmony_ci#ifndef __CVMX_BOOT_VECTOR_H__
108c2ecf20Sopenharmony_ci#define __CVMX_BOOT_VECTOR_H__
118c2ecf20Sopenharmony_ci
128c2ecf20Sopenharmony_ci#include <asm/octeon/octeon.h>
138c2ecf20Sopenharmony_ci
148c2ecf20Sopenharmony_ci/*
158c2ecf20Sopenharmony_ci * The boot vector table is made up of an array of 1024 elements of
168c2ecf20Sopenharmony_ci * struct cvmx_boot_vector_element.  There is one entry for each
178c2ecf20Sopenharmony_ci * possible MIPS CPUNum, indexed by the CPUNum.
188c2ecf20Sopenharmony_ci *
198c2ecf20Sopenharmony_ci * Once cvmx_boot_vector_get() returns a non-NULL value (indicating
208c2ecf20Sopenharmony_ci * success), NMI to a core will cause execution to transfer to the
218c2ecf20Sopenharmony_ci * target_ptr location for that core's entry in the vector table.
228c2ecf20Sopenharmony_ci *
238c2ecf20Sopenharmony_ci * The struct cvmx_boot_vector_element fields app0, app1, and app2 can
248c2ecf20Sopenharmony_ci * be used by the application that has set the target_ptr in any
258c2ecf20Sopenharmony_ci * application specific manner, they are not touched by the vectoring
268c2ecf20Sopenharmony_ci * code.
278c2ecf20Sopenharmony_ci *
288c2ecf20Sopenharmony_ci * The boot vector code clobbers the CP0_DESAVE register, and on
298c2ecf20Sopenharmony_ci * OCTEON II and later CPUs also clobbers CP0_KScratch2.  All GP
308c2ecf20Sopenharmony_ci * registers are preserved, except on pre-OCTEON II CPUs, where k1 is
318c2ecf20Sopenharmony_ci * clobbered.
328c2ecf20Sopenharmony_ci *
338c2ecf20Sopenharmony_ci */
348c2ecf20Sopenharmony_ci
358c2ecf20Sopenharmony_ci
368c2ecf20Sopenharmony_ci/*
378c2ecf20Sopenharmony_ci * Applications install the boot bus code in cvmx-boot-vector.c, which
388c2ecf20Sopenharmony_ci * uses this magic:
398c2ecf20Sopenharmony_ci */
408c2ecf20Sopenharmony_ci#define OCTEON_BOOT_MOVEABLE_MAGIC1 0xdb00110ad358eacdull
418c2ecf20Sopenharmony_ci
428c2ecf20Sopenharmony_cistruct cvmx_boot_vector_element {
438c2ecf20Sopenharmony_ci	/* kseg0 or xkphys address of target code. */
448c2ecf20Sopenharmony_ci	uint64_t target_ptr;
458c2ecf20Sopenharmony_ci	/* Three application specific arguments. */
468c2ecf20Sopenharmony_ci	uint64_t app0;
478c2ecf20Sopenharmony_ci	uint64_t app1;
488c2ecf20Sopenharmony_ci	uint64_t app2;
498c2ecf20Sopenharmony_ci};
508c2ecf20Sopenharmony_ci
518c2ecf20Sopenharmony_cistruct cvmx_boot_vector_element *cvmx_boot_vector_get(void);
528c2ecf20Sopenharmony_ci
538c2ecf20Sopenharmony_ci#endif /* __CVMX_BOOT_VECTOR_H__ */
54