Author: bschmidt
Date: Fri Apr 15 16:50:37 2011
New Revision: 220659
URL: http://svn.freebsd.org/changeset/base/220659

Log:
  Don't timeout when stopping DMA channels.
  
  Obtained from:        OpenBSD

Modified:
  head/sys/dev/iwn/if_iwn.c
  head/sys/dev/iwn/if_iwnreg.h

Modified: head/sys/dev/iwn/if_iwn.c
==============================================================================
--- head/sys/dev/iwn/if_iwn.c   Fri Apr 15 16:44:04 2011        (r220658)
+++ head/sys/dev/iwn/if_iwn.c   Fri Apr 15 16:50:37 2011        (r220659)
@@ -4003,7 +4003,7 @@ iwn4965_get_temperature(struct iwn_softc
                return 0;
 
        /* Sign-extend 23-bit R4 value to 32-bit. */
-       r4 = (r4 << 8) >> 8;
+       r4 = ((r4 & 0xffffff) ^ 0x800000) - 0x800000;
        /* Compute temperature in Kelvin. */
        temp = (259 * (r4 - r2)) / (r3 - r1);
        temp = (temp * 97) / 100 + 8;
@@ -6283,7 +6283,6 @@ static void
 iwn_hw_stop(struct iwn_softc *sc)
 {
        const struct iwn_hal *hal = sc->sc_hal;
-       uint32_t tmp;
        int chnl, qid, ntries;
 
        IWN_WRITE(sc, IWN_RESET, IWN_RESET_NEVO);
@@ -6305,8 +6304,7 @@ iwn_hw_stop(struct iwn_softc *sc)
                for (chnl = 0; chnl < hal->ndmachnls; chnl++) {
                        IWN_WRITE(sc, IWN_FH_TX_CONFIG(chnl), 0);
                        for (ntries = 0; ntries < 200; ntries++) {
-                               tmp = IWN_READ(sc, IWN_FH_TX_STATUS);
-                               if ((tmp & IWN_FH_TX_STATUS_IDLE(chnl)) ==
+                               if (IWN_READ(sc, IWN_FH_TX_STATUS) &
                                    IWN_FH_TX_STATUS_IDLE(chnl))
                                        break;
                                DELAY(10);

Modified: head/sys/dev/iwn/if_iwnreg.h
==============================================================================
--- head/sys/dev/iwn/if_iwnreg.h        Fri Apr 15 16:44:04 2011        
(r220658)
+++ head/sys/dev/iwn/if_iwnreg.h        Fri Apr 15 16:50:37 2011        
(r220659)
@@ -283,8 +283,7 @@
 #define IWN_FH_TX_CHICKEN_SCHED_RETRY  (1 << 1)
 
 /* Possible flags for register IWN_FH_TX_STATUS. */
-#define IWN_FH_TX_STATUS_IDLE(chnl)                                    \
-       (1 << ((chnl) + 24) | 1 << ((chnl) + 16))
+#define IWN_FH_TX_STATUS_IDLE(chnl)    (1 << ((chnl) + 16))
 
 /* Possible flags for register IWN_FH_RX_CONFIG. */
 #define IWN_FH_RX_CONFIG_ENA           (1 << 31)
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to