Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0+ */ |
Simon Glass | 82a5fa0 | 2013-03-05 14:39:40 +0000 | [diff] [blame] | 2 | /* |
| 3 | * Copyright (c) 2011 The Chromium OS Authors. |
Simon Glass | 82a5fa0 | 2013-03-05 14:39:40 +0000 | [diff] [blame] | 4 | */ |
| 5 | |
Simon Glass | 5b66888 | 2017-03-28 10:27:17 -0600 | [diff] [blame] | 6 | #ifndef __INITCALL_H |
| 7 | #define __INITCALL_H |
| 8 | |
Simon Glass | 6b42d38 | 2023-08-21 21:16:54 -0600 | [diff] [blame] | 9 | #include <asm/types.h> |
| 10 | #include <event.h> |
Jerome Forissier | 1fd58d4 | 2025-04-04 15:50:36 +0200 | [diff] [blame] | 11 | #include <hang.h> |
Simon Glass | 6b42d38 | 2023-08-21 21:16:54 -0600 | [diff] [blame] | 12 | |
| 13 | _Static_assert(EVT_COUNT < 256, "Can only support 256 event types with 8 bits"); |
| 14 | |
Jerome Forissier | 1fd58d4 | 2025-04-04 15:50:36 +0200 | [diff] [blame] | 15 | #define INITCALL(_call) \ |
| 16 | do { \ |
| 17 | if (_call()) { \ |
| 18 | printf("%s(): initcall %s() failed\n", __func__, \ |
| 19 | #_call); \ |
| 20 | hang(); \ |
| 21 | } \ |
| 22 | } while (0) |
| 23 | |
| 24 | #define INITCALL_EVT(_evt) \ |
| 25 | do { \ |
| 26 | if (event_notify_null(_evt)) { \ |
| 27 | printf("%s(): event %d/%s failed\n", __func__, _evt, \ |
| 28 | event_type_name(_evt)) ; \ |
| 29 | hang(); \ |
| 30 | } \ |
| 31 | } while (0) |
| 32 | |
| 33 | #if defined(CONFIG_WATCHDOG) || defined(CONFIG_HW_WATCHDOG) |
| 34 | #define WATCHDOG_INIT() INITCALL(init_func_watchdog_init) |
| 35 | #define WATCHDOG_RESET() INITCALL(init_func_watchdog_reset) |
| 36 | #else |
| 37 | #define WATCHDOG_INIT() |
| 38 | #define WATCHDOG_RESET() |
| 39 | #endif |
| 40 | |
Simon Glass | 5b66888 | 2017-03-28 10:27:17 -0600 | [diff] [blame] | 41 | #endif |