AHCI - Correct prdbc warning.
authorMatthew Dillon <dillon@apollo.backplane.com>
Fri, 19 Jun 2009 16:04:22 +0000 (09:04 -0700)
committerMatthew Dillon <dillon@apollo.backplane.com>
Fri, 19 Jun 2009 16:04:22 +0000 (09:04 -0700)
* This field is only updated by hardware for non-NCQ packets, don't
  spew warnings if it is zero for NCQ packets.

Reported-by: Sepherosa Ziehau <sepherosa@gmail.com>
sys/dev/disk/ahci/ahci.c

index b308ae8..248ce68 100644 (file)
@@ -1575,15 +1575,20 @@ ahci_unload_prdt(struct ahci_ccb *ccb)
 
                bus_dmamap_unload(sc->sc_tag_data, dmap);
 
-               if (ccb->ccb_cmd_hdr->prdbc == 0) {
-                       kprintf("%s: UNLOAD RESID WAS ZERO! tag=%d\n",
-                               ATANAME(ap, xa->at), ccb->ccb_slot);
-               }
-               if (ccb->ccb_xa.flags & ATA_F_NCQ)
+               /*
+                * prdbc is only updated by hardware for non-NCQ commands.
+                */
+               if (ccb->ccb_xa.flags & ATA_F_NCQ) {
                        xa->resid = 0;
-               else
+               } else {
+                       if (ccb->ccb_cmd_hdr->prdbc == 0) {
+                               kprintf("%s: WARNING!  Unload prdbc resid "
+                                       "was zero! tag=%d\n",
+                                       ATANAME(ap, xa->at), ccb->ccb_slot);
+                       }
                        xa->resid = xa->datalen -
                            le32toh(ccb->ccb_cmd_hdr->prdbc);
+               }
        }
 }