162306a36Sopenharmony_ci/*
262306a36Sopenharmony_ci * This file is subject to the terms and conditions of the GNU General Public
362306a36Sopenharmony_ci * License.  See the file "COPYING" in the main directory of this archive
462306a36Sopenharmony_ci * for more details.
562306a36Sopenharmony_ci *
662306a36Sopenharmony_ci * Copyright (C) 2003-2017 Cavium, Inc.
762306a36Sopenharmony_ci */
862306a36Sopenharmony_ci
962306a36Sopenharmony_ci#ifndef __CVMX_BOOT_VECTOR_H__
1062306a36Sopenharmony_ci#define __CVMX_BOOT_VECTOR_H__
1162306a36Sopenharmony_ci
1262306a36Sopenharmony_ci#include <asm/octeon/octeon.h>
1362306a36Sopenharmony_ci
1462306a36Sopenharmony_ci/*
1562306a36Sopenharmony_ci * The boot vector table is made up of an array of 1024 elements of
1662306a36Sopenharmony_ci * struct cvmx_boot_vector_element.  There is one entry for each
1762306a36Sopenharmony_ci * possible MIPS CPUNum, indexed by the CPUNum.
1862306a36Sopenharmony_ci *
1962306a36Sopenharmony_ci * Once cvmx_boot_vector_get() returns a non-NULL value (indicating
2062306a36Sopenharmony_ci * success), NMI to a core will cause execution to transfer to the
2162306a36Sopenharmony_ci * target_ptr location for that core's entry in the vector table.
2262306a36Sopenharmony_ci *
2362306a36Sopenharmony_ci * The struct cvmx_boot_vector_element fields app0, app1, and app2 can
2462306a36Sopenharmony_ci * be used by the application that has set the target_ptr in any
2562306a36Sopenharmony_ci * application specific manner, they are not touched by the vectoring
2662306a36Sopenharmony_ci * code.
2762306a36Sopenharmony_ci *
2862306a36Sopenharmony_ci * The boot vector code clobbers the CP0_DESAVE register, and on
2962306a36Sopenharmony_ci * OCTEON II and later CPUs also clobbers CP0_KScratch2.  All GP
3062306a36Sopenharmony_ci * registers are preserved, except on pre-OCTEON II CPUs, where k1 is
3162306a36Sopenharmony_ci * clobbered.
3262306a36Sopenharmony_ci *
3362306a36Sopenharmony_ci */
3462306a36Sopenharmony_ci
3562306a36Sopenharmony_ci
3662306a36Sopenharmony_ci/*
3762306a36Sopenharmony_ci * Applications install the boot bus code in cvmx-boot-vector.c, which
3862306a36Sopenharmony_ci * uses this magic:
3962306a36Sopenharmony_ci */
4062306a36Sopenharmony_ci#define OCTEON_BOOT_MOVEABLE_MAGIC1 0xdb00110ad358eacdull
4162306a36Sopenharmony_ci
4262306a36Sopenharmony_cistruct cvmx_boot_vector_element {
4362306a36Sopenharmony_ci	/* kseg0 or xkphys address of target code. */
4462306a36Sopenharmony_ci	uint64_t target_ptr;
4562306a36Sopenharmony_ci	/* Three application specific arguments. */
4662306a36Sopenharmony_ci	uint64_t app0;
4762306a36Sopenharmony_ci	uint64_t app1;
4862306a36Sopenharmony_ci	uint64_t app2;
4962306a36Sopenharmony_ci};
5062306a36Sopenharmony_ci
5162306a36Sopenharmony_cistruct cvmx_boot_vector_element *cvmx_boot_vector_get(void);
5262306a36Sopenharmony_ci
5362306a36Sopenharmony_ci#endif /* __CVMX_BOOT_VECTOR_H__ */
54