Changeset 3825

Show
Ignore:
Timestamp:
07/30/08 23:33:40 (5 months ago)
Author:
proski
Message:

Protect against probing AR2425 if HAL doesn't support it

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.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • madwifi/trunk/ath/if_ath_pci.c

    r3746 r3825  
    191191        } 
    192192 
     193/* 
     194 * Reject new MAC revisions if HAL doesn't support AR2425.  Ideally, it could 
     195 * be done in the PCI ID table, but AR2424 and AR2425 share the same vendor ID 
     196 * 168c:001c. 
     197 */ 
     198#ifndef AH_SUPPORT_2425 
     199#define AR5K_SREV               0x4020  /* MAC revision */ 
     200#define AR5K_SREV_CUTOFF        0xE0    /* Cutoff revision */ 
     201        { 
     202                u_int32_t mac_rev = readl(mem + AR5K_SREV); 
     203                if (mac_rev > AR5K_SREV_CUTOFF) 
     204                { 
     205                        printk(KERN_ERR "%s: HAL doesn't support MAC revision " 
     206                               "0x%02x\n", dev_info, mac_rev); 
     207                        goto bad2; 
     208                } 
     209        } 
     210#endif 
     211 
    193212        dev = alloc_netdev(sizeof(struct ath_pci_softc), "wifi%d", ether_setup); 
    194213        if (dev == NULL) {