summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorMarcus Glocker <mglocker@cvs.openbsd.org>2007-10-04 05:44:44 +0000
committerMarcus Glocker <mglocker@cvs.openbsd.org>2007-10-04 05:44:44 +0000
commit4811aed4f41ba5153af950fbce6ccb0a69f65916 (patch)
treeeb6a4357f36dd5277d4f97b3d39db3f38c2b54fc /sys
parent7f639e3afd4056c4c4d00d733c1b91ce9907006b (diff)
Since we know the firmware load works, merge the single firmware files
together to one single, finally. You need to bump the firmware package to version 1.3! OK jsg@
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/ic/bwi.c52
-rw-r--r--sys/dev/ic/bwivar.h4
2 files changed, 28 insertions, 28 deletions
diff --git a/sys/dev/ic/bwi.c b/sys/dev/ic/bwi.c
index d961de6ad28..11a5256093d 100644
--- a/sys/dev/ic/bwi.c
+++ b/sys/dev/ic/bwi.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bwi.c,v 1.60 2007/10/01 20:48:37 mglocker Exp $ */
+/* $OpenBSD: bwi.c,v 1.61 2007/10/04 05:44:42 mglocker Exp $ */
/*
* Copyright (c) 2007 The DragonFly Project. All rights reserved.
@@ -1607,20 +1607,30 @@ int
bwi_mac_fw_alloc(struct bwi_mac *mac)
{
struct bwi_softc *sc = mac->mac_sc;
+ char *name = "bwi-airforce";
+ size_t offset;
char fwname[64];
int idx, error;
+ error = loadfirmware(name, &mac->mac_fw, &mac->mac_fw_size);
+ if (error != 0) {
+ printf("%s: error %d, could not read firmware %s\n",
+ sc->sc_dev.dv_xname, error, name);
+ return (EIO);
+ }
+
if (mac->mac_ucode == NULL) {
snprintf(fwname, sizeof(fwname), "ucode%d.fw",
mac->mac_rev >= 5 ? 5 : mac->mac_rev);
- error = loadfirmware(fwname, &mac->mac_ucode,
- &mac->mac_ucode_size);
+ error = bwi_get_firmware(fwname, mac->mac_fw, mac->mac_fw_size,
+ &mac->mac_ucode_size, &offset);
if (error != 0) {
printf("%s: error %d, could not read firmware %s!\n",
sc->sc_dev.dv_xname, error, fwname);
return (ENOMEM);
}
+ mac->mac_ucode = (mac->mac_fw + offset);
DPRINTF(1, "%s: loaded firmware file %s\n",
sc->sc_dev.dv_xname, fwname);
@@ -1633,13 +1643,14 @@ bwi_mac_fw_alloc(struct bwi_mac *mac)
snprintf(fwname, sizeof(fwname), "pcm%d.fw",
mac->mac_rev < 5 ? 4 : 5);
- error = loadfirmware(fwname, &mac->mac_pcm,
- &mac->mac_pcm_size);
+ error = bwi_get_firmware(fwname, mac->mac_fw, mac->mac_fw_size,
+ &mac->mac_pcm_size, &offset);
if (error != 0) {
printf("%s: error %d, could not read firmware %s!\n",
sc->sc_dev.dv_xname, error, fwname);
return (ENOMEM);
}
+ mac->mac_pcm = (mac->mac_fw + offset);
DPRINTF(1, "%s: loaded firmware file %s\n",
sc->sc_dev.dv_xname, fwname);
@@ -1662,13 +1673,14 @@ bwi_mac_fw_alloc(struct bwi_mac *mac)
snprintf(fwname, sizeof(fwname), "b0g0initvals%d.fw", idx);
- error = loadfirmware(fwname, &mac->mac_iv,
- &mac->mac_iv_size);
+ error = bwi_get_firmware(fwname, mac->mac_fw, mac->mac_fw_size,
+ &mac->mac_iv_size, &offset);
if (error != 0) {
printf("%s: error %d, could not read firmware %s!\n",
sc->sc_dev.dv_xname, error, fwname);
return (ENOMEM);
}
+ mac->mac_iv = (mac->mac_fw + offset);
DPRINTF(1, "%s: loaded firmware file %s\n",
sc->sc_dev.dv_xname, fwname);
@@ -1693,13 +1705,14 @@ bwi_mac_fw_alloc(struct bwi_mac *mac)
snprintf(fwname, sizeof(fwname), "b0g0bsinitvals%d.fw", idx);
- error = loadfirmware(fwname, &mac->mac_iv_ext,
- &mac->mac_iv_ext_size);
+ error = bwi_get_firmware(fwname, mac->mac_fw, mac->mac_fw_size,
+ &mac->mac_iv_ext_size, &offset);
if (error != 0) {
printf("%s: error %d, could not read firmware %s!\n",
sc->sc_dev.dv_xname, error, fwname);
return (ENOMEM);
}
+ mac->mac_iv_ext = (mac->mac_fw + offset);
DPRINTF(1, "%s: loaded firmware file %s\n",
sc->sc_dev.dv_xname, fwname);
@@ -1715,24 +1728,9 @@ back:
void
bwi_mac_fw_free(struct bwi_mac *mac)
{
- if (mac->mac_ucode != NULL) {
- free(mac->mac_ucode, M_DEVBUF);
- mac->mac_ucode = NULL;
- }
-
- if (mac->mac_pcm != NULL) {
- free(mac->mac_pcm, M_DEVBUF);
- mac->mac_pcm = NULL;
- }
-
- if (mac->mac_iv != NULL) {
- free(mac->mac_iv, M_DEVBUF);
- mac->mac_iv = NULL;
- }
-
- if (mac->mac_iv_ext != NULL) {
- free(mac->mac_iv_ext, M_DEVBUF);
- mac->mac_iv_ext = NULL;
+ if (mac->mac_fw != NULL) {
+ free(mac->mac_fw, M_DEVBUF);
+ mac->mac_fw = NULL;
}
}
diff --git a/sys/dev/ic/bwivar.h b/sys/dev/ic/bwivar.h
index 1f4b0e29a9f..d54cfdeffaf 100644
--- a/sys/dev/ic/bwivar.h
+++ b/sys/dev/ic/bwivar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: bwivar.h,v 1.17 2007/10/01 11:27:11 mglocker Exp $ */
+/* $OpenBSD: bwivar.h,v 1.18 2007/10/04 05:44:43 mglocker Exp $ */
/*
* Copyright (c) 2007 The DragonFly Project. All rights reserved.
@@ -394,6 +394,8 @@ struct bwi_mac {
struct bwi_tpctl mac_tpctl; /* TX power control */
uint32_t mac_flags; /* BWI_MAC_F_ */
+ uint8_t *mac_fw;
+ size_t mac_fw_size;
uint8_t *mac_ucode;
size_t mac_ucode_size;
uint8_t *mac_pcm;