Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 102777
b: refs/heads/master
c: 6821783
h: refs/heads/master
i:
  102775: 33592f7
v: v3
  • Loading branch information
Michael Buesch authored and John W. Linville committed May 22, 2008
1 parent 5066df1 commit e05cd25
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 12 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: e48b0eeb0ab508021b654a45f332b30cac2163b9
refs/heads/master: 6821783271aaf541504ff8a138184fcc83fa282b
4 changes: 4 additions & 0 deletions trunk/drivers/net/wireless/b43/b43.h
Original file line number Diff line number Diff line change
Expand Up @@ -774,6 +774,10 @@ struct b43_firmware {

/* Set to true, if we are using an opensource firmware. */
bool opensource;
/* Set to true, if the core needs a PCM firmware, but
* we failed to load one. This is always false for
* core rev > 10, as these don't need PCM firmware. */
bool pcm_request_failed;
};

/* Device (802.11 core) initialization status. */
Expand Down
47 changes: 36 additions & 11 deletions trunk/drivers/net/wireless/b43/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1908,7 +1908,8 @@ static void b43_print_fw_helptext(struct b43_wl *wl, bool error)

static int do_request_fw(struct b43_wldev *dev,
const char *name,
struct b43_firmware_file *fw)
struct b43_firmware_file *fw,
bool silent)
{
char path[sizeof(modparam_fwpostfix) + 32];
const struct firmware *blob;
Expand All @@ -1932,9 +1933,15 @@ static int do_request_fw(struct b43_wldev *dev,
"b43%s/%s.fw",
modparam_fwpostfix, name);
err = request_firmware(&blob, path, dev->dev->dev);
if (err) {
b43err(dev->wl, "Firmware file \"%s\" not found "
"or load failed.\n", path);
if (err == -ENOENT) {
if (!silent) {
b43err(dev->wl, "Firmware file \"%s\" not found\n",
path);
}
return err;
} else if (err) {
b43err(dev->wl, "Firmware file \"%s\" request failed (err=%d)\n",
path, err);
return err;
}
if (blob->size < sizeof(struct b43_fw_header))
Expand Down Expand Up @@ -1985,7 +1992,7 @@ static int b43_request_firmware(struct b43_wldev *dev)
filename = "ucode13";
else
goto err_no_ucode;
err = do_request_fw(dev, filename, &fw->ucode);
err = do_request_fw(dev, filename, &fw->ucode, 0);
if (err)
goto err_load;

Expand All @@ -1996,8 +2003,13 @@ static int b43_request_firmware(struct b43_wldev *dev)
filename = NULL;
else
goto err_no_pcm;
err = do_request_fw(dev, filename, &fw->pcm);
if (err)
fw->pcm_request_failed = 0;
err = do_request_fw(dev, filename, &fw->pcm, 1);
if (err == -ENOENT) {
/* We did not find a PCM file? Not fatal, but
* core rev <= 10 must do without hwcrypto then. */
fw->pcm_request_failed = 1;
} else if (err)
goto err_load;

/* Get initvals */
Expand Down Expand Up @@ -2028,7 +2040,7 @@ static int b43_request_firmware(struct b43_wldev *dev)
default:
goto err_no_initvals;
}
err = do_request_fw(dev, filename, &fw->initvals);
err = do_request_fw(dev, filename, &fw->initvals, 0);
if (err)
goto err_load;

Expand Down Expand Up @@ -2062,7 +2074,7 @@ static int b43_request_firmware(struct b43_wldev *dev)
default:
goto err_no_initvals;
}
err = do_request_fw(dev, filename, &fw->initvals_band);
err = do_request_fw(dev, filename, &fw->initvals_band, 0);
if (err)
goto err_load;

Expand Down Expand Up @@ -2186,14 +2198,20 @@ static int b43_upload_microcode(struct b43_wldev *dev)
if (dev->fw.opensource) {
/* Patchlevel info is encoded in the "time" field. */
dev->fw.patch = fwtime;
b43info(dev->wl, "Loading OpenSource firmware version %u.%u\n",
dev->fw.rev, dev->fw.patch);
b43info(dev->wl, "Loading OpenSource firmware version %u.%u%s\n",
dev->fw.rev, dev->fw.patch,
dev->fw.pcm_request_failed ? " (Hardware crypto not supported)" : "");
} else {
b43info(dev->wl, "Loading firmware version %u.%u "
"(20%.2i-%.2i-%.2i %.2i:%.2i:%.2i)\n",
fwrev, fwpatch,
(fwdate >> 12) & 0xF, (fwdate >> 8) & 0xF, fwdate & 0xFF,
(fwtime >> 11) & 0x1F, (fwtime >> 5) & 0x3F, fwtime & 0x1F);
if (dev->fw.pcm_request_failed) {
b43warn(dev->wl, "No \"pcm5.fw\" firmware file found. "
"Hardware accelerated cryptography is disabled.\n");
b43_print_fw_helptext(dev->wl, 0);
}
}

if (b43_is_old_txhdr_format(dev)) {
Expand Down Expand Up @@ -3358,6 +3376,13 @@ static int b43_op_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
if (!dev || b43_status(dev) < B43_STAT_INITIALIZED)
goto out_unlock;

if (dev->fw.pcm_request_failed) {
/* We don't have firmware for the crypto engine.
* Must use software-crypto. */
err = -EOPNOTSUPP;
goto out_unlock;
}

err = -EINVAL;
switch (key->alg) {
case ALG_WEP:
Expand Down

0 comments on commit e05cd25

Please sign in to comment.