2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
6 * Copyright (C) 2007-2017 Cavium, Inc.
9 #include <asm/regdef.h>
11 #define CVMSEG_BASE -32768
12 #define CVMSEG_SIZE 6912
13 #define SAVE_REG(r) sd $r, CVMSEG_BASE + CVMSEG_SIZE - ((32 - r) * 8)($0)
15 NESTED(octeon_wdt_nmi_stage2, 0, sp)
19 /* Clear Dcache so cvmseg works right. */
21 /* Use K0 to do a read/modify/write of CVMMEMCTL */
23 /* Clear out the size of CVMSEG */
25 /* Set CVMSEG to its largest value */
26 ori k0, k0, 0x1c0 | 54
27 /* Store the CVMMEMCTL value */
30 * Restore K0 from the debug scratch register, it was saved in
31 * the boot-vector code.
36 * Save all registers to the top CVMSEG. This shouldn't
37 * corrupt any state used by the kernel. Also all registers
38 * should have the value right before the NMI.
72 /* Write zero to all CVMSEG locations per Core-15169 */
73 dli a0, CVMSEG_SIZE - (33 * 8)
74 1: sd zero, CVMSEG_BASE(a0)
78 /* Set the stack to begin right below the registers */
79 dli sp, CVMSEG_BASE + CVMSEG_SIZE - (32 * 8)
80 /* Load the address of the third stage handler */
81 dla $25, octeon_wdt_nmi_stage3
82 /* Call the third stage handler */
84 /* a0 is the address of the saved registers */
86 /* Loop forvever if we get here. */
90 END(octeon_wdt_nmi_stage2)