Protect against probing AR2425 if HAL doesn't support it
authorproski <proski@0192ed92-7a03-0410-a25b-9323aeb14dbd>
Wed, 30 Jul 2008 21:33:40 +0000 (21:33 +0000)
committerproski <proski@0192ed92-7a03-0410-a25b-9323aeb14dbd>
Wed, 30 Jul 2008 21:33:40 +0000 (21:33 +0000)
AR2424 and AR2425 share the same PCI ID.  Probing AR2425 with HAL that
doesn't support it is problematic.  It causes an unhandled NMI and puts
the device to a non-functional state.  After that, even HAL that
supports AR2425 won't be able to use the device until the system is
rebooted.

Reject AR2425 devices if HAL doesn't positively indicate support for
them.

git-svn-id: http://madwifi-project.org/svn/madwifi/trunk@3825 0192ed92-7a03-0410-a25b-9323aeb14dbd

ath/if_ath_pci.c

index f9ccd1ed6fad70a53c2ee4acf178a3696e7a0b59..2e773782a6d15b53b00dc654dc0525fb5ad593da 100644 (file)
@@ -190,6 +190,25 @@ ath_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
                goto bad1;
        }
 
+/*
+ * Reject new MAC revisions if HAL doesn't support AR2425.  Ideally, it could
+ * be done in the PCI ID table, but AR2424 and AR2425 share the same vendor ID
+ * 168c:001c.
+ */
+#ifndef AH_SUPPORT_2425
+#define AR5K_SREV              0x4020  /* MAC revision */
+#define AR5K_SREV_CUTOFF       0xE0    /* Cutoff revision */
+       {
+               u_int32_t mac_rev = readl(mem + AR5K_SREV);
+               if (mac_rev > AR5K_SREV_CUTOFF)
+               {
+                       printk(KERN_ERR "%s: HAL doesn't support MAC revision "
+                              "0x%02x\n", dev_info, mac_rev);
+                       goto bad2;
+               }
+       }
+#endif
+
        dev = alloc_netdev(sizeof(struct ath_pci_softc), "wifi%d", ether_setup);
        if (dev == NULL) {
                printk(KERN_ERR "%s: no memory for device state\n", dev_info);