• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2022 HiSilicon (Shanghai) Technologies CO., LIMITED.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef _LINUX_WATCHDOG_H
17 #define _LINUX_WATCHDOG_H
18 
19 #include <linux/types.h>
20 
21 #ifdef __cplusplus
22 extern "C" {
23 #endif /* __cplusplus */
24 
25 #define hi_wtdg_unused(x) (void)(x)
26 
27 int watchdog_init(void);
28 void watchdog_exit(void);
29 
30 #define    WATCHDOG_IOCTL_BASE    'W'
31 
32 struct watchdog_info {
33     unsigned int options;             /* Options the card/driver supports */
34     unsigned int firmware_version;    /* Firmware version of the card */
35     unsigned char identity[32];       /* 32 bit Identity of the board */
36 };
37 
38 #define WDIOC_GETSUPPORT     _IOR(WATCHDOG_IOCTL_BASE, 0, struct watchdog_info)
39 #define WDIOC_GETSTATUS      _IOR(WATCHDOG_IOCTL_BASE, 1, int)
40 #define WDIOC_GETBOOTSTATUS  _IOR(WATCHDOG_IOCTL_BASE, 2, int)
41 
42 #define WDIOC_SETOPTIONS     _IOWR(WATCHDOG_IOCTL_BASE, 4, int)
43 #define WDIOC_KEEPALIVE      _IO(WATCHDOG_IOCTL_BASE, 5)
44 #define WDIOC_SETTIMEOUT     _IOWR(WATCHDOG_IOCTL_BASE, 6, int)
45 #define WDIOC_GETTIMEOUT     _IOR(WATCHDOG_IOCTL_BASE, 7, int)
46 
47 #define WDIOF_UNKNOWN        (-1)    /* Unknown flag error */
48 #define WDIOS_UNKNOWN        (-1)    /* Unknown status error */
49 
50 #define WDIOF_OVERHEAT       0x0001    /* Reset due to CPU overheat */
51 #define WDIOF_FANFAULT       0x0002    /* Fan failed */
52 #define WDIOF_EXTERN1        0x0004    /* External relay 1 */
53 #define WDIOF_EXTERN2        0x0008    /* External relay 2 */
54 #define WDIOF_POWERUNDER     0x0010    /* Power bad/power fault */
55 #define WDIOF_CARDRESET      0x0020    /* Card previously reset the CPU */
56 #define WDIOF_POWEROVER      0x0040    /* Power over voltage */
57 #define WDIOF_SETTIMEOUT     0x0080    /* Set timeout (in seconds) */
58 #define WDIOF_MAGICCLOSE     0x0100    /* Supports magic close char */
59 #define WDIOF_PRETIMEOUT     0x0200    /* Pretimeout (in seconds), get/set */
60 #define WDIOF_KEEPALIVEPING  0x8000    /* Keep alive ping reply */
61 
62 #define WDIOS_DISABLECARD    0x0001    /* Turn off the watchdog timer */
63 #define WDIOS_ENABLECARD     0x0002    /* Turn on the watchdog timer */
64 #define WDIOS_TEMPPANIC      0x0004    /* Kernel panic on temperature trip */
65 
66 #ifdef __cplusplus
67 }
68 #endif /* __cplusplus */
69 
70 #endif
71