diff --git a/src/prism2/driver/hfa384x.c b/src/prism2/driver/hfa384x.c index bab7397..862c058 100644 --- a/src/prism2/driver/hfa384x.c +++ b/src/prism2/driver/hfa384x.c @@ -202,10 +202,16 @@ int hfa384x_drvr_getconfig(hfa384x_t *hw, UINT16 rid, void *buf, UINT16 len) hfa384x_rec_t rec; DBFENTER; result = hfa384x_cmd_access( hw, 0, rid); - if ( result ) goto fail; + if ( result ) { + WLAN_LOG_DEBUG0(3,"Call to hfa384x_cmd_access failed\n"); + goto fail; + } result = hfa384x_copy_from_bap( hw, hw->bap, rid, 0, &rec, sizeof(rec)); - if ( result ) goto fail; + if ( result ) { + WLAN_LOG_DEBUG0(3,"Call to hfa384x_copy_from_bap failed\n"); + goto fail; + } /* Validate the record length */ if ( ((hfa384x2host_16(rec.reclen)-1)*2) != len ) { /* note body len calculation in bytes */ @@ -322,11 +328,17 @@ int hfa384x_drvr_setconfig(hfa384x_t *hw, UINT16 rid, void *buf, UINT16 len) rec.reclen = host2hfa384x_16((len/2) + 1); /* note conversion to words, +1 for rid field */ /* write the record header */ result = hfa384x_copy_to_bap( hw, hw->bap, rid, 0, &rec, sizeof(rec)); - if (result) goto fail; + if ( result ) { + WLAN_LOG_DEBUG0(3,"Failure writing record header\n"); + goto fail; + } /* write the record data (if there is any) */ if ( len > 0 ) { result = hfa384x_copy_to_bap( hw, hw->bap, rid, sizeof(rec), buf, len); - if (result) goto fail; + if ( result ) { + WLAN_LOG_DEBUG0(3,"Failure writing record data\n"); + goto fail; + } } result = hfa384x_cmd_access( hw, 1, rid); fail: @@ -442,6 +454,7 @@ int hfa384x_drvr_readpda(hfa384x_t *hw, void *buf, UINT len) DBFENTER; /* Check for aux available */ result = hfa384x_cmd_aux_enable(hw); + WLAN_LOG_DEBUG1(1,"aux_enable() exit. result=%d\n", result); if ( result ) { WLAN_LOG_DEBUG1(1,"aux_enable() failed. result=%d\n", result); goto failed; @@ -458,11 +471,13 @@ int hfa384x_drvr_readpda(hfa384x_t *hw, void *buf, UINT len) pdrcode = hfa384x2host_16(pda[currpdr+1]); /* Test the record length */ if ( pdrlen > HFA384x_PDR_LEN_MAX || pdrlen == 0) { + WLAN_LOG_DEBUG1(3,"pdrlen invalid=%d\n", pdrlen); pdaok = 0; break; } /* Test the code */ if ( !hfa384x_isgood_pdrcode(pdrcode) ) { + WLAN_LOG_DEBUG1(3,"pdrcode invalid=%d\n", pdrcode); pdaok = 0; break; } @@ -483,6 +498,10 @@ int hfa384x_drvr_readpda(hfa384x_t *hw, void *buf, UINT len) } result = pdaok ? 0 : -ENODATA; + if ( result ) { + WLAN_LOG_DEBUG0(3,"Failure: pda is not okay\n"); + } + hfa384x_cmd_aux_disable(hw); failed: DBFEXIT; @@ -1914,7 +1933,7 @@ int hfa384x_docmd_wait( hfa384x_t *hw, UINT16 cmd, UINT16 parm0, UINT16 parm1, U time_before( jiffies, timeout) ) { reg = wlan_inw_le16_to_cpu(HFA384x_CMD(hw->iobase)); } - if (!HFA384x_CMD_ISBUSY(hfa384x2host_16(reg))) { + if (!HFA384x_CMD_ISBUSY(reg)) { /* busy bit clear, write command */ wlan_outw_cpu_to_le16(parm0, HFA384x_PARAM0(hw->iobase)); wlan_outw_cpu_to_le16(parm1, HFA384x_PARAM1(hw->iobase)); @@ -1940,7 +1959,7 @@ int hfa384x_docmd_wait( hfa384x_t *hw, UINT16 cmd, UINT16 parm0, UINT16 parm1, U udelay(10); reg = wlan_inw_le16_to_cpu(HFA384x_EVSTAT(hw->iobase)); } - if ( HFA384x_EVSTAT_ISCMD(hfa384x2host_16(reg)) ) { + if ( HFA384x_EVSTAT_ISCMD(reg) ) { result = 0; hw->status = wlan_inw_le16_to_cpu(HFA384x_STATUS(hw->iobase)); hw->resp0 = wlan_inw_le16_to_cpu(HFA384x_RESP0(hw->iobase)); diff --git a/src/prism2/driver/prism2sta.c b/src/prism2/driver/prism2sta.c index 6031099..9d1f9ab 100644 --- a/src/prism2/driver/prism2sta.c +++ b/src/prism2/driver/prism2sta.c @@ -757,6 +757,13 @@ int prism2sta_initmac(wlandevice_t *wlandev) WLAN_LOG_ERROR0("Failed to retrieve NICIDENTITY\n"); goto failed; } + + /* get all the nic id fields in host byte order */ + priv->ident_nic.id = hfa384x2host_16(priv->ident_nic.id); + priv->ident_nic.variant = hfa384x2host_16(priv->ident_nic.variant); + priv->ident_nic.major = hfa384x2host_16(priv->ident_nic.major); + priv->ident_nic.minor = hfa384x2host_16(priv->ident_nic.minor); + WLAN_LOG_INFO4( "ident: nic h/w: id=0x%02x %d.%d.%d\n", priv->ident_nic.id, priv->ident_nic.major, priv->ident_nic.minor, priv->ident_nic.variant); @@ -768,6 +775,13 @@ int prism2sta_initmac(wlandevice_t *wlandev) WLAN_LOG_ERROR0("Failed to retrieve PRIIDENTITY\n"); goto failed; } + + /* get all the private fw id fields in host byte order */ + priv->ident_pri_fw.id = hfa384x2host_16(priv->ident_pri_fw.id); + priv->ident_pri_fw.variant = hfa384x2host_16(priv->ident_pri_fw.variant); + priv->ident_pri_fw.major = hfa384x2host_16(priv->ident_pri_fw.major); + priv->ident_pri_fw.minor = hfa384x2host_16(priv->ident_pri_fw.minor); + WLAN_LOG_INFO4( "ident: pri f/w: id=0x%02x %d.%d.%d\n", priv->ident_pri_fw.id, priv->ident_pri_fw.major, priv->ident_pri_fw.minor, priv->ident_pri_fw.variant); @@ -779,6 +793,13 @@ int prism2sta_initmac(wlandevice_t *wlandev) WLAN_LOG_ERROR0("Failed to retrieve STAIDENTITY\n"); goto failed; } + + /* get all the station fw id fields in host byte order */ + priv->ident_sta_fw.id = hfa384x2host_16(priv->ident_sta_fw.id); + priv->ident_sta_fw.variant = hfa384x2host_16(priv->ident_sta_fw.variant); + priv->ident_sta_fw.major = hfa384x2host_16(priv->ident_sta_fw.major); + priv->ident_sta_fw.minor = hfa384x2host_16(priv->ident_sta_fw.minor); + if ( priv->ident_sta_fw.id == 0x1f ) { WLAN_LOG_INFO4( "ident: sta f/w: id=0x%02x %d.%d.%d\n", @@ -798,6 +819,15 @@ int prism2sta_initmac(wlandevice_t *wlandev) WLAN_LOG_ERROR0("Failed to retrieve MFISUPRANGE\n"); goto failed; } + + /* get all the Compatibility range, modem interface supplier + fields in byte order */ + priv->cap_sup_mfi.role = hfa384x2host_16(priv->cap_sup_mfi.role); + priv->cap_sup_mfi.id = hfa384x2host_16(priv->cap_sup_mfi.id); + priv->cap_sup_mfi.variant = hfa384x2host_16(priv->cap_sup_mfi.variant); + priv->cap_sup_mfi.bottom = hfa384x2host_16(priv->cap_sup_mfi.bottom); + priv->cap_sup_mfi.top = hfa384x2host_16(priv->cap_sup_mfi.top); + WLAN_LOG_INFO5( "MFI:SUP:role=0x%02x:id=0x%02x:var=0x%02x:b/t=%d/%d\n", priv->cap_sup_mfi.role, priv->cap_sup_mfi.id, @@ -811,6 +841,15 @@ int prism2sta_initmac(wlandevice_t *wlandev) WLAN_LOG_ERROR0("Failed to retrieve CFISUPRANGE\n"); goto failed; } + + /* get all the Compatibility range, controller interface supplier + fields in byte order */ + priv->cap_sup_cfi.role = hfa384x2host_16(priv->cap_sup_cfi.role); + priv->cap_sup_cfi.id = hfa384x2host_16(priv->cap_sup_cfi.id); + priv->cap_sup_cfi.variant = hfa384x2host_16(priv->cap_sup_cfi.variant); + priv->cap_sup_cfi.bottom = hfa384x2host_16(priv->cap_sup_cfi.bottom); + priv->cap_sup_cfi.top = hfa384x2host_16(priv->cap_sup_cfi.top); + WLAN_LOG_INFO5( "CFI:SUP:role=0x%02x:id=0x%02x:var=0x%02x:b/t=%d/%d\n", priv->cap_sup_cfi.role, priv->cap_sup_cfi.id, @@ -824,6 +863,15 @@ int prism2sta_initmac(wlandevice_t *wlandev) WLAN_LOG_ERROR0("Failed to retrieve PRISUPRANGE\n"); goto failed; } + + /* get all the Compatibility range, primary firmware supplier + fields in byte order */ + priv->cap_sup_pri.role = hfa384x2host_16(priv->cap_sup_pri.role); + priv->cap_sup_pri.id = hfa384x2host_16(priv->cap_sup_pri.id); + priv->cap_sup_pri.variant = hfa384x2host_16(priv->cap_sup_pri.variant); + priv->cap_sup_pri.bottom = hfa384x2host_16(priv->cap_sup_pri.bottom); + priv->cap_sup_pri.top = hfa384x2host_16(priv->cap_sup_pri.top); + WLAN_LOG_INFO5( "PRI:SUP:role=0x%02x:id=0x%02x:var=0x%02x:b/t=%d/%d\n", priv->cap_sup_pri.role, priv->cap_sup_pri.id, @@ -837,6 +885,15 @@ int prism2sta_initmac(wlandevice_t *wlandev) WLAN_LOG_ERROR0("Failed to retrieve STASUPRANGE\n"); goto failed; } + + /* get all the Compatibility range, station firmware supplier + fields in byte order */ + priv->cap_sup_sta.role = hfa384x2host_16(priv->cap_sup_sta.role); + priv->cap_sup_sta.id = hfa384x2host_16(priv->cap_sup_sta.id); + priv->cap_sup_sta.variant = hfa384x2host_16(priv->cap_sup_sta.variant); + priv->cap_sup_sta.bottom = hfa384x2host_16(priv->cap_sup_sta.bottom); + priv->cap_sup_sta.top = hfa384x2host_16(priv->cap_sup_sta.top); + if ( priv->cap_sup_sta.id == 0x04 ) { WLAN_LOG_INFO5( "STA:SUP:role=0x%02x:id=0x%02x:var=0x%02x:b/t=%d/%d\n", @@ -858,6 +915,15 @@ int prism2sta_initmac(wlandevice_t *wlandev) WLAN_LOG_ERROR0("Failed to retrieve PRI_CFIACTRANGES\n"); goto failed; } + + /* get all the Compatibility range, primary f/w actor, CFI supplier + fields in byte order */ + priv->cap_act_pri_cfi.role = hfa384x2host_16(priv->cap_act_pri_cfi.role); + priv->cap_act_pri_cfi.id = hfa384x2host_16(priv->cap_act_pri_cfi.id); + priv->cap_act_pri_cfi.variant = hfa384x2host_16(priv->cap_act_pri_cfi.variant); + priv->cap_act_pri_cfi.bottom = hfa384x2host_16(priv->cap_act_pri_cfi.bottom); + priv->cap_act_pri_cfi.top = hfa384x2host_16(priv->cap_act_pri_cfi.top); + WLAN_LOG_INFO5( "PRI-CFI:ACT:role=0x%02x:id=0x%02x:var=0x%02x:b/t=%d/%d\n", priv->cap_act_pri_cfi.role, priv->cap_act_pri_cfi.id, @@ -871,6 +937,15 @@ int prism2sta_initmac(wlandevice_t *wlandev) WLAN_LOG_ERROR0("Failed to retrieve STA_CFIACTRANGES\n"); goto failed; } + + /* get all the Compatibility range, station f/w actor, CFI supplier + fields in byte order */ + priv->cap_act_sta_cfi.role = hfa384x2host_16(priv->cap_act_sta_cfi.role); + priv->cap_act_sta_cfi.id = hfa384x2host_16(priv->cap_act_sta_cfi.id); + priv->cap_act_sta_cfi.variant = hfa384x2host_16(priv->cap_act_sta_cfi.variant); + priv->cap_act_sta_cfi.bottom = hfa384x2host_16(priv->cap_act_sta_cfi.bottom); + priv->cap_act_sta_cfi.top = hfa384x2host_16(priv->cap_act_sta_cfi.top); + WLAN_LOG_INFO5( "STA-CFI:ACT:role=0x%02x:id=0x%02x:var=0x%02x:b/t=%d/%d\n", priv->cap_act_sta_cfi.role, priv->cap_act_sta_cfi.id, @@ -884,6 +959,15 @@ int prism2sta_initmac(wlandevice_t *wlandev) WLAN_LOG_ERROR0("Failed to retrieve STA_MFIACTRANGES\n"); goto failed; } + + /* get all the Compatibility range, station f/w actor, MFI supplier + fields in byte order */ + priv->cap_act_sta_mfi.role = hfa384x2host_16(priv->cap_act_sta_mfi.role); + priv->cap_act_sta_mfi.id = hfa384x2host_16(priv->cap_act_sta_mfi.id); + priv->cap_act_sta_mfi.variant = hfa384x2host_16(priv->cap_act_sta_mfi.variant); + priv->cap_act_sta_mfi.bottom = hfa384x2host_16(priv->cap_act_sta_mfi.bottom); + priv->cap_act_sta_mfi.top = hfa384x2host_16(priv->cap_act_sta_mfi.top); + WLAN_LOG_INFO5( "STA-MFI:ACT:role=0x%02x:id=0x%02x:var=0x%02x:b/t=%d/%d\n", priv->cap_act_sta_mfi.role, priv->cap_act_sta_mfi.id, @@ -901,6 +985,9 @@ int prism2sta_initmac(wlandevice_t *wlandev) printk("%02x ", snum[i]); } printk("\n"); + } else { + WLAN_LOG_ERROR0("Failed to retrieve Prism2 Card SN\n"); + goto failed; } /* Collect the MAC address */ @@ -918,7 +1005,10 @@ int prism2sta_initmac(wlandevice_t *wlandev) /* TODO: Set any internally managed config items */ /* Set swsupport regs to magic # for card presence detection */ +/* JFM: Changed wlan_outw( PRISM2STA_MAGIC, HFA384x_SWSUPPORT0(hw->iobase)); +*/ + wlan_outw_cpu_to_le16( PRISM2STA_MAGIC, HFA384x_SWSUPPORT0(hw->iobase)); goto done; failed: @@ -1250,7 +1340,10 @@ void prism2sta_interrupt IRQ(int irq, void *dev_id, struct pt_regs *regs) DBFENTER; /* Check swsupport reg magic # for card presence */ +/* JFM changed reg = wlan_inw( HFA384x_SWSUPPORT0(hw->iobase)); +*/ + reg = wlan_inw_le16_to_cpu(HFA384x_SWSUPPORT0(hw->iobase)); if ( reg != PRISM2STA_MAGIC) { WLAN_LOG_DEBUG1(2, "irq=%d, no magic. Card removed?.\n", irq); return; @@ -1307,7 +1400,10 @@ void prism2sta_interrupt IRQ(int irq, void *dev_id, struct pt_regs *regs) udelay(20); /* Check swsupport reg magic # for card presence */ - reg = wlan_inw( HFA384x_SWSUPPORT0(hw->iobase)); +/* JFM changed + reg = wlan_inw( HFA384x_SWSUPPORT0(hw->iobase)); +*/ + reg = wlan_inw_le16_to_cpu(HFA384x_SWSUPPORT0(hw->iobase)); if ( reg != PRISM2STA_MAGIC) { WLAN_LOG_DEBUG1(2, "irq=%d, no magic. Card removed?.\n", irq); return; @@ -1480,7 +1576,7 @@ void prism2sta_int_txexc(wlandevice_t *wlandev) fid, sizeof(status), result); goto failed; } - WLAN_LOG_DEBUG1(3, "TxExc status=0x%x.\n", status); + WLAN_LOG_DEBUG1(3, "TxExc status=0x%x.\n", hfa384x2host_16(status)); failed: DBFEXIT; return;