1 /* 2 * Copyright (C) 2021 HiSilicon (Shanghai) Technologies CO., LIMITED. 3 * 4 * This program is free software; you can redistribute it and/or 5 * modify it under the terms of the GNU General Public License 6 * as published by the Free Software Foundation; either version 2 7 * of the License, or (at your option) any later version. 8 * 9 * This program is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * GNU General Public License for more details. 13 * 14 * You should have received a copy of the GNU General Public License 15 * along with this program; if not, write to the Free Software 16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 17 */ 18 19 #ifndef _LINUX_WATCHDOG_H 20 #define _LINUX_WATCHDOG_H 21 22 #include <linux/types.h> 23 24 #ifdef __cplusplus 25 extern "C"{ 26 #endif /* __cplusplus */ 27 28 #define hi_wtdg_unused(x) (void)(x) 29 30 int watchdog_init(void); 31 void watchdog_exit(void); 32 33 #define WATCHDOG_IOCTL_BASE 'W' 34 35 struct watchdog_info { 36 unsigned int options; /* Options the card/driver supports */ 37 unsigned int firmware_version; /* Firmware version of the card */ 38 unsigned char identity[32]; /* 32 bit Identity of the board */ 39 }; 40 41 #define WDIOC_GETSUPPORT _IOR(WATCHDOG_IOCTL_BASE, 0, struct watchdog_info) 42 #define WDIOC_GETSTATUS _IOR(WATCHDOG_IOCTL_BASE, 1, int) 43 #define WDIOC_GETBOOTSTATUS _IOR(WATCHDOG_IOCTL_BASE, 2, int) 44 45 #define WDIOC_SETOPTIONS _IOWR(WATCHDOG_IOCTL_BASE, 4, int) 46 #define WDIOC_KEEPALIVE _IOR(WATCHDOG_IOCTL_BASE, 5, int) 47 #define WDIOC_SETTIMEOUT _IOWR(WATCHDOG_IOCTL_BASE, 6, int) 48 #define WDIOC_GETTIMEOUT _IOR(WATCHDOG_IOCTL_BASE, 7, int) 49 50 #define WDIOF_UNKNOWN (-1) /* Unknown flag error */ 51 #define WDIOS_UNKNOWN (-1) /* Unknown status error */ 52 53 #define WDIOF_OVERHEAT 0x0001 /* Reset due to CPU overheat */ 54 #define WDIOF_FANFAULT 0x0002 /* Fan failed */ 55 #define WDIOF_EXTERN1 0x0004 /* External relay 1 */ 56 #define WDIOF_EXTERN2 0x0008 /* External relay 2 */ 57 #define WDIOF_POWERUNDER 0x0010 /* Power bad/power fault */ 58 #define WDIOF_CARDRESET 0x0020 /* Card previously reset the CPU */ 59 #define WDIOF_POWEROVER 0x0040 /* Power over voltage */ 60 #define WDIOF_SETTIMEOUT 0x0080 /* Set timeout (in seconds) */ 61 #define WDIOF_MAGICCLOSE 0x0100 /* Supports magic close char */ 62 #define WDIOF_PRETIMEOUT 0x0200 /* Pretimeout (in seconds), get/set */ 63 #define WDIOF_KEEPALIVEPING 0x8000 /* Keep alive ping reply */ 64 65 #define WDIOS_DISABLECARD 0x0001 /* Turn off the watchdog timer */ 66 #define WDIOS_ENABLECARD 0x0002 /* Turn on the watchdog timer */ 67 #define WDIOS_TEMPPANIC 0x0004 /* Kernel panic on temperature trip */ 68 69 #ifdef __cplusplus 70 } 71 #endif /* __cplusplus */ 72 73 #endif 74