Changed initmac() so it will survive if cmd_initialize succeeds, but other

initializations fail.  This happens if we have a valid primary, but not a
valid secondary.
This commit is contained in:
mark 2000-02-02 20:28:34 +00:00
parent 3ad353ccf4
commit 41cc3881cc
1 changed files with 26 additions and 10 deletions

View File

@ -619,16 +619,30 @@ int prism2sta_initmac(wlandevice_t *wlandev)
/* call initialize */
result = hfa384x_cmd_initialize(hw);
if (result != 0) goto failed;
if (result != 0) {
WLAN_LOG_ERROR0("Initialize command failed.\n");
goto failed;
}
/* make sure interrupts are disabled and any layabout events cleared */
outw( 0, HFA384x_INTEN(hw->iobase));
outw( 0xffff, HFA384x_EVACK(hw->iobase));
/* Read the PDA */
result = hfa384x_drvr_readpda(hw, priv->pda, HFA384x_PDA_LEN_MAX);
if ( result != 0) {
WLAN_LOG_DEBUG0(2,"drvr_readpda() failed\n");
goto failed;
}
/* Allocate tx and notify FIDs */
/* First, tx */
result = hfa384x_cmd_allocate(hw, PRISM2_TXBUF_MAX);
if (result != 0) goto failed;
if (result != 0) {
WLAN_LOG_ERROR0("Allocate(tx) command failed.\n");
goto failed;
}
i = 0;
do {
reg = hfa384x2host_16(inw(HFA384x_EVSTAT(hw->iobase)));
@ -636,6 +650,7 @@ int prism2sta_initmac(wlandevice_t *wlandev)
i++;
} while ( !HFA384x_INTEN_ISALLOC(reg) && i < 50); /* 50 is timeout */
if ( i >= 50 ) {
WLAN_LOG_ERROR0("Timed out waiting for evalloc(tx).\n");
result = -ETIMEDOUT;
goto failed;
}
@ -647,7 +662,10 @@ int prism2sta_initmac(wlandevice_t *wlandev)
/* Now, the info frame fid */
result = hfa384x_cmd_allocate(hw, PRISM2_INFOBUF_MAX);
if (result != 0) goto failed;
if (result != 0) {
goto failed;
WLAN_LOG_ERROR0("Allocate(tx) command failed.\n");
}
i = 0;
do {
reg = hfa384x2host_16(inw(HFA384x_EVSTAT(hw->iobase)));
@ -655,6 +673,7 @@ int prism2sta_initmac(wlandevice_t *wlandev)
i++;
} while ( !HFA384x_INTEN_ISALLOC(reg) && i < 50); /* 50 is timeout */
if ( i >= 50 ) {
WLAN_LOG_ERROR0("Timed out waiting for evalloc(info).\n");
result = -ETIMEDOUT;
goto failed;
}
@ -896,7 +915,10 @@ int prism2sta_initmac(wlandevice_t *wlandev)
HFA384x_RID_CNFOWNMACADDR,
wlandev->netdev->dev_addr,
WLAN_ADDR_LEN);
if ( result != 0 ) goto failed;
if ( result != 0 ) {
WLAN_LOG_ERROR0("Failed to retrieve mac address\n");
goto failed;
}
/* Set the rate control */
rate_control = BIT0 | BIT1 | BIT2 | BIT3;
@ -909,12 +931,6 @@ int prism2sta_initmac(wlandevice_t *wlandev)
/* TODO: Set any internally managed config items */
/* Read the PDA */
if ( (result = hfa384x_drvr_readpda(hw, priv->pda, HFA384x_PDA_LEN_MAX)) != 0) {
WLAN_LOG_DEBUG1(2,"drvr_readpda() failed, result=%d\n", result);
goto done;
}
/* Set swsupport regs to magic # for card presence detection */
outw( PRISM2STA_MAGIC, HFA384x_SWSUPPORT0(hw->iobase));