]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
firewire: fw-ohci: add self ID error check
authorStefan Richter <stefanr@s5r6.in-berlin.de>
Wed, 19 Mar 2008 20:40:32 +0000 (21:40 +0100)
committerStefan Richter <stefanr@s5r6.in-berlin.de>
Fri, 18 Apr 2008 15:55:33 +0000 (17:55 +0200)
Discard self ID buffer contents if
  - the selfIDError flag is set,
  - any of the self ID packets has bit errors.

Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Signed-off-by: Jarod Wilson <jwilson@redhat.com>
drivers/firewire/fw-ohci.c
drivers/firewire/fw-ohci.h

index 92ff38f82d962621664e6d9bdd174ac6288d22d6..1f6f15f0dce2063ce4bc6ed548d2f091fba4cf6c 100644 (file)
@@ -1019,20 +1019,26 @@ static void bus_reset_tasklet(unsigned long data)
        ohci->node_id = reg & (OHCI1394_NodeID_busNumber |
                               OHCI1394_NodeID_nodeNumber);
 
+       reg = reg_read(ohci, OHCI1394_SelfIDCount);
+       if (reg & OHCI1394_SelfIDCount_selfIDError) {
+               fw_notify("inconsistent self IDs\n");
+               return;
+       }
        /*
         * The count in the SelfIDCount register is the number of
         * bytes in the self ID receive buffer.  Since we also receive
         * the inverted quadlets and a header quadlet, we shift one
         * bit extra to get the actual number of self IDs.
         */
-
-       self_id_count = (reg_read(ohci, OHCI1394_SelfIDCount) >> 3) & 0x3ff;
+       self_id_count = (reg >> 3) & 0x3ff;
        generation = (cond_le32_to_cpu(ohci->self_id_cpu[0]) >> 16) & 0xff;
        rmb();
 
        for (i = 1, j = 0; j < self_id_count; i += 2, j++) {
-               if (ohci->self_id_cpu[i] != ~ohci->self_id_cpu[i + 1])
-                       fw_error("inconsistent self IDs\n");
+               if (ohci->self_id_cpu[i] != ~ohci->self_id_cpu[i + 1]) {
+                       fw_notify("inconsistent self IDs\n");
+                       return;
+               }
                ohci->self_id_buffer[j] =
                                cond_le32_to_cpu(ohci->self_id_cpu[i]);
        }
index dec4f04e6b245c2a89d4c8c986f55d5e6dae987e..5754c6e9d595da7ba283e81c63fd8b25dfa451d5 100644 (file)
@@ -30,6 +30,7 @@
 #define  OHCI1394_HCControl_softReset          0x00010000
 #define OHCI1394_SelfIDBuffer                 0x064
 #define OHCI1394_SelfIDCount                  0x068
+#define  OHCI1394_SelfIDCount_selfIDError      0x80000000
 #define OHCI1394_IRMultiChanMaskHiSet         0x070
 #define OHCI1394_IRMultiChanMaskHiClear       0x074
 #define OHCI1394_IRMultiChanMaskLoSet         0x078