Module Name: src Committed By: jmcneill Date: Wed Nov 28 19:15:33 UTC 2018
Modified Files: src/sys/external/bsd/ena-com: ena_plat.h Log Message: Avoid kpause while cold To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/sys/external/bsd/ena-com/ena_plat.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/external/bsd/ena-com/ena_plat.h diff -u src/sys/external/bsd/ena-com/ena_plat.h:1.3 src/sys/external/bsd/ena-com/ena_plat.h:1.4 --- src/sys/external/bsd/ena-com/ena_plat.h:1.3 Sat Jun 16 15:00:35 2018 +++ src/sys/external/bsd/ena-com/ena_plat.h Wed Nov 28 19:15:32 2018 @@ -38,7 +38,7 @@ #if 0 __FBSDID("$FreeBSD: head/sys/contrib/ena-com/ena_plat.h 333453 2018-05-10 09:25:51Z mw $"); #endif -__KERNEL_RCSID(0, "$NetBSD: ena_plat.h,v 1.3 2018/06/16 15:00:35 jdolecek Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ena_plat.h,v 1.4 2018/11/28 19:15:32 jmcneill Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -171,7 +171,22 @@ static inline long PTR_ERR(const void *p #define ENA_COM_PERMISSION EPERM #define ENA_COM_TIMER_EXPIRED ETIMEDOUT -#define ENA_MSLEEP(x) kpause("enaw", false, mstohz(x), NULL) +static inline int +ENA_MSLEEP(int x) +{ + if (cold) { + while (x >= 1000000) { + delay(1000000); + x -= 1000000; + } + if (x > 0) + delay(x); + return EWOULDBLOCK; + } else { + return kpause("enaw", false, mstohz(x), NULL); + } +} + #define ENA_UDELAY(x) DELAY(x) #define ENA_GET_SYSTEM_TIMEOUT(timeout_us) \ mstohz(timeout_us * (1000 / 100)) /* XXX assumes 100 ms sleep */