Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/external/bsd/ena-com Avoid kpause while cold



details:   https://anonhg.NetBSD.org/src/rev/4beaf6a4d1e2
branches:  trunk
changeset: 446249:4beaf6a4d1e2
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Wed Nov 28 19:15:32 2018 +0000

description:
Avoid kpause while cold

diffstat:

 sys/external/bsd/ena-com/ena_plat.h |  19 +++++++++++++++++--
 1 files changed, 17 insertions(+), 2 deletions(-)

diffs (36 lines):

diff -r 1c8eef4f2af3 -r 4beaf6a4d1e2 sys/external/bsd/ena-com/ena_plat.h
--- a/sys/external/bsd/ena-com/ena_plat.h       Wed Nov 28 19:13:15 2018 +0000
+++ b/sys/external/bsd/ena-com/ena_plat.h       Wed Nov 28 19:15:32 2018 +0000
@@ -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 @@
 #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 */



Home | Main Index | Thread Index | Old Index