^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) /* SPDX-License-Identifier: GPL-2.0 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) #ifndef __UM_DELAY_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) #define __UM_DELAY_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) #include <asm-generic/delay.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) #include <linux/time-internal.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) static inline void um_ndelay(unsigned long nsecs)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) if (time_travel_mode == TT_MODE_INFCPU ||
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) time_travel_mode == TT_MODE_EXTERNAL) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) time_travel_ndelay(nsecs);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) return;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) ndelay(nsecs);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) #undef ndelay
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) #define ndelay(n) um_ndelay(n)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) static inline void um_udelay(unsigned long usecs)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) if (time_travel_mode == TT_MODE_INFCPU ||
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) time_travel_mode == TT_MODE_EXTERNAL) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) time_travel_ndelay(1000 * usecs);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) return;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) udelay(usecs);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) #undef udelay
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) #define udelay(n) um_udelay(n)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) #endif /* __UM_DELAY_H */