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/1710c0845e9e
branches:  trunk
changeset: 837319:1710c0845e9e
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 6b9b6da9c870 -r 1710c0845e9e 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