1 /* SPDX-License-Identifier: GPL-2.0-only */
3 * Copyright (C) 2007-2017 Cavium, Inc.
6 #include <asm/regdef.h>
8 #define CVMSEG_BASE -32768
9 #define CVMSEG_SIZE 6912
10 #define SAVE_REG(r) sd $r, CVMSEG_BASE + CVMSEG_SIZE - ((32 - r) * 8)($0)
12 NESTED(octeon_wdt_nmi_stage2, 0, sp)
16 /* Clear Dcache so cvmseg works right. */
18 /* Use K0 to do a read/modify/write of CVMMEMCTL */
20 /* Clear out the size of CVMSEG */
22 /* Set CVMSEG to its largest value */
23 ori k0, k0, 0x1c0 | 54
24 /* Store the CVMMEMCTL value */
27 * Restore K0 from the debug scratch register, it was saved in
28 * the boot-vector code.
33 * Save all registers to the top CVMSEG. This shouldn't
34 * corrupt any state used by the kernel. Also all registers
35 * should have the value right before the NMI.
69 /* Write zero to all CVMSEG locations per Core-15169 */
70 dli a0, CVMSEG_SIZE - (33 * 8)
71 1: sd zero, CVMSEG_BASE(a0)
75 /* Set the stack to begin right below the registers */
76 dli sp, CVMSEG_BASE + CVMSEG_SIZE - (32 * 8)
77 /* Load the address of the third stage handler */
78 dla $25, octeon_wdt_nmi_stage3
79 /* Call the third stage handler */
81 /* a0 is the address of the saved registers */
83 /* Loop forvever if we get here. */
87 END(octeon_wdt_nmi_stage2)