sata_nv: Use notifier for completion checks
authorRobert Hancock <hancockr@shaw.ca>
Tue, 20 Feb 2007 01:03:08 +0000 (19:03 -0600)
committerJeff Garzik <jeff@garzik.org>
Wed, 21 Feb 2007 09:58:19 +0000 (04:58 -0500)
The hardware provides us a notifier register that indicates what command
tags have completed. Use this to determine which CPBs to check, rather
than blindly checking all active CPBs. This should provide a minor
performance win, since if the controller has touched some of these
incomplete CPBs, accessing them will likely result in a cache miss.

Signed-off-by: Robert Hancock <hancockr@shaw.ca>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
drivers/ata/sata_nv.c

index 57dace43b3370a7a165ddd3a5f9cc6aa52998a51..745d85686f5e0f41c34c50352149857ffc77af4f 100644 (file)
@@ -854,22 +854,14 @@ static irqreturn_t nv_adma_interrupt(int irq, void *dev_instance)
 
                        if (status & (NV_ADMA_STAT_DONE |
                                      NV_ADMA_STAT_CPBERR)) {
+                               u32 check_commands = notifier | notifier_error;
+                               int pos, error = 0;
                                /** Check CPBs for completed commands */
-
-                               if (ata_tag_valid(ap->active_tag)) {
-                                       /* Non-NCQ command */
-                                       nv_adma_check_cpb(ap, ap->active_tag,
-                                               notifier_error & (1 << ap->active_tag));
-                               } else {
-                                       int pos, error = 0;
-                                       u32 active = ap->sactive;
-
-                                       while ((pos = ffs(active)) && !error) {
-                                               pos--;
-                                               error = nv_adma_check_cpb(ap, pos,
-                                                       notifier_error & (1 << pos) );
-                                               active &= ~(1 << pos );
-                                       }
+                               while ((pos = ffs(check_commands)) && !error) {
+                                       pos--;
+                                       error = nv_adma_check_cpb(ap, pos,
+                                               notifier_error & (1 << pos) );
+                                       check_commands &= ~(1 << pos );
                                }
                        }
                }