diff options
author | Marcus Glocker <mglocker@cvs.openbsd.org> | 2007-09-16 19:02:38 +0000 |
---|---|---|
committer | Marcus Glocker <mglocker@cvs.openbsd.org> | 2007-09-16 19:02:38 +0000 |
commit | 12e766699706706638a51dfef4e7805b2b19ff77 (patch) | |
tree | ab5842780bbcc4682d8ec290b83dac40dd87c940 | |
parent | a586ad04d0d33919f7cb1de64baf8a1b7eefbe39 (diff) |
Remove obsolete firmware specific bits.
-rw-r--r-- | sys/dev/ic/bwi.c | 180 | ||||
-rw-r--r-- | sys/dev/ic/bwivar.h | 38 |
2 files changed, 7 insertions, 211 deletions
diff --git a/sys/dev/ic/bwi.c b/sys/dev/ic/bwi.c index 28034c2b5be..19a6302df1c 100644 --- a/sys/dev/ic/bwi.c +++ b/sys/dev/ic/bwi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bwi.c,v 1.33 2007/09/16 12:33:26 jsg Exp $ */ +/* $OpenBSD: bwi.c,v 1.34 2007/09/16 19:02:36 mglocker Exp $ */ /* * Copyright (c) 2007 The DragonFly Project. All rights reserved. @@ -142,12 +142,6 @@ void bwi_mac_setup_tpctl(struct bwi_mac *); void bwi_mac_dummy_xmit(struct bwi_mac *); void bwi_mac_init_tpctl_11bg(struct bwi_mac *); void bwi_mac_detach(struct bwi_mac *); -#if 0 -int bwi_fwimage_is_valid(struct bwi_softc *, - const struct fw_image *, uint8_t); -int bwi_mac_fw_alloc(struct bwi_mac *); -void bwi_mac_fw_free(struct bwi_mac *); -#endif int bwi_get_firmware(const char *, const uint8_t *, size_t, size_t *, size_t *); int bwi_mac_fw_load(struct bwi_mac *); @@ -1506,180 +1500,8 @@ bwi_mac_init_tpctl_11bg(struct bwi_mac *mac) void bwi_mac_detach(struct bwi_mac *mac) { - //bwi_mac_fw_free(mac); -} - -#if 0 -int -bwi_fwimage_is_valid(struct bwi_softc *sc, const struct fw_image *fw, - uint8_t fw_type) -{ - const struct bwi_fwhdr *hdr; - struct ifnet *ifp = &sc->sc_ic.ic_if; - - if (fw->fw_imglen < sizeof(*hdr)) { - DPRINTF(1, "%s: invalid firmware (%s): invalid size %u\n", - sc->sc_dev.dv_xname, fw->fw_name, fw->fw_imglen); - return (0); - } - - hdr = (const struct bwi_fwhdr *)fw->fw_image; - - if (fw_type != BWI_FW_T_IV) { - /* - * Don't verify IV's size, it has different meaning - */ - if (betoh32(hdr->fw_size) != fw->fw_imglen - sizeof(*hdr)) { - DPRINTF(1, "%s: invalid firmware (%s): size mismatch, " - "fw %u, real %u\n", - sc->sc_dev.dv_xname, fw->fw_name, - betoh32(hdr->fw_size), - fw->fw_imglen - sizeof(*hdr)); - return (0); - } - } - - if (hdr->fw_type != fw_type) { - DPRINTF(1, "%s: invalid firmware (%s): type mismatch, " - "fw \'%c\', target \'%c\'\n", - fw->fw_name, sc->sc_dev.dv_xname, hdr->fw_type, fw_type); - return (0); - } - - if (hdr->fw_gen != BWI_FW_GEN_1) { - DPRINTF(1, "%s: invalid firmware (%s): wrong generation, " - "fw %d, target %d\n", - sc->sc_dev.dv_xname, fw->fw_name, hdr->fw_gen, - BWI_FW_GEN_1); - return (0); - } - - return (1); -} -#endif - -#if 0 -int -bwi_mac_fw_alloc(struct bwi_mac *mac) -{ - struct bwi_softc *sc = mac->mac_sc; - struct ifnet *ifp = &sc->sc_ic.ic_if; - char fwname[64]; - int idx; - - if (mac->mac_ucode == NULL) { - snprintf(fwname, sizeof(fwname), BWI_FW_UCODE_PATH, - sc->sc_fw_version, - mac->mac_rev >= 5 ? 5 : mac->mac_rev); - - mac->mac_ucode = firmware_image_load(fwname); - if (mac->mac_ucode == NULL) { - DPRINTF(1, "%s: request firmware %s failed\n", - sc->sc_dev.dv_xname, fwname); - return (ENOMEM); - } - - if (!bwi_fwimage_is_valid(sc, mac->mac_ucode, BWI_FW_T_UCODE)) - return EINVAL; - } - - if (mac->mac_pcm == NULL) { - snprintf(fwname, sizeof(fwname), BWI_FW_PCM_PATH, - sc->sc_fw_version, - mac->mac_rev < 5 ? 4 : 5); - - mac->mac_pcm = firmware_image_load(fwname); - if (mac->mac_pcm == NULL) { - DPRINTF(1, "%s: request firmware %s failed\n", - sc->sc_dev.dv_xname, fwname); - return (ENOMEM); - } - - if (!bwi_fwimage_is_valid(sc, mac->mac_pcm, BWI_FW_T_PCM)) - return EINVAL; - } - - if (mac->mac_iv == NULL) { - /* TODO: 11A */ - if (mac->mac_rev == 2 || mac->mac_rev == 4) { - idx = 2; - } else if (mac->mac_rev >= 5 && mac->mac_rev <= 10) { - idx = 5; - } else { - DPRINTF(1, "%s: no suitable IV for MAC rev %d\n", - sc->sc_dev.dv_xname, mac->mac_rev); - return (ENODEV); - } - - snprintf(fwname, sizeof(fwname), BWI_FW_IV_PATH, - sc->sc_fw_version, idx); - - mac->mac_iv = firmware_image_load(fwname); - if (mac->mac_iv == NULL) { - DPRINTF(1, "%s: request firmware %s failed\n", - sc->sc_dev.dv_xname, fwname); - return (ENOMEM); - } - if (!bwi_fwimage_is_valid(sc, mac->mac_iv, BWI_FW_T_IV)) - return EINVAL; - } - - if (mac->mac_iv_ext == NULL) { - /* TODO: 11A */ - if (mac->mac_rev == 2 || mac->mac_rev == 4 || - mac->mac_rev >= 11) { - /* No extended IV */ - goto back; - } else if (mac->mac_rev >= 5 && mac->mac_rev <= 10) { - idx = 5; - } else { - DPRINTF(1, "%s: no suitable ExtIV for MAC rev %d\n", - sc->sc_dev.dv_xname, mac->mac_rev); - return (ENODEV); - } - - snprintf(fwname, sizeof(fwname), BWI_FW_IV_EXT_PATH, - sc->sc_fw_version, idx); - - mac->mac_iv_ext = firmware_image_load(fwname); - if (mac->mac_iv_ext == NULL) { - DPRINTF(1, "%s: request firmware %s failed\n", - sc->sc_dev.dv_xname, fwname); - return (ENOMEM); - } - if (!bwi_fwimage_is_valid(sc, mac->mac_iv_ext, BWI_FW_T_IV)) - return EINVAL; - } -back: - return (0); -} -#endif - -#if 0 -void -bwi_mac_fw_free(struct bwi_mac *mac) -{ - if (mac->mac_ucode != NULL) { - firmware_image_unload(mac->mac_ucode); - mac->mac_ucode = NULL; - } - - if (mac->mac_pcm != NULL) { - firmware_image_unload(mac->mac_pcm); - mac->mac_pcm = NULL; - } - - if (mac->mac_iv != NULL) { - firmware_image_unload(mac->mac_iv); - mac->mac_iv = NULL; - } - if (mac->mac_iv_ext != NULL) { - firmware_image_unload(mac->mac_iv_ext); - mac->mac_iv_ext = NULL; - } } -#endif int bwi_get_firmware(const char *name, const uint8_t *ucode, size_t size_ucode, diff --git a/sys/dev/ic/bwivar.h b/sys/dev/ic/bwivar.h index 7768c5779c6..1ad1dcd826d 100644 --- a/sys/dev/ic/bwivar.h +++ b/sys/dev/ic/bwivar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: bwivar.h,v 1.9 2007/09/15 22:47:14 mglocker Exp $ */ +/* $OpenBSD: bwivar.h,v 1.10 2007/09/16 19:02:37 mglocker Exp $ */ /* * Copyright (c) 2007 The DragonFly Project. All rights reserved. @@ -82,12 +82,6 @@ #define CSR_CLRBITS_2(sc, reg, bits) \ CSR_WRITE_2((sc), (reg), CSR_READ_2((sc), (reg)) & ~(bits)) -struct fwheader { - char filename[64]; - int filesize; - int fileoffset; -}; - struct bwi_desc32 { /* Little endian */ uint32_t ctrl; @@ -227,32 +221,15 @@ struct bwi_txstats_data { int stats_idx; }; -struct bwi_fwhdr { - /* Big endian */ - uint8_t fw_type; /* BWI_FW_T_ */ - uint8_t fw_gen; /* BWI_FW_GEN */ - uint8_t fw_pad[2]; - uint32_t fw_size; -#define fw_iv_cnt fw_size -} __packed; - -#define BWI_FWHDR_SZ sizeof(struct bwi_fwhdr) - -#define BWI_FW_T_UCODE 'u' -#define BWI_FW_T_PCM 'p' -#define BWI_FW_T_IV 'i' - -#define BWI_FW_GEN_1 1 - #define BWI_FW_VERSION3 3 #define BWI_FW_VERSION4 4 #define BWI_FW_VERSION3_REVMAX 0x128 -#define BWI_FW_PATH "bwi/v%d/" -#define BWI_FW_UCODE_PATH BWI_FW_PATH "ucode%d.fw" -#define BWI_FW_PCM_PATH BWI_FW_PATH "pcm%d.fw" -#define BWI_FW_IV_PATH BWI_FW_PATH "b0g0initvals%d.fw" -#define BWI_FW_IV_EXT_PATH BWI_FW_PATH "b0g0bsinitvals%d.fw" +struct fwheader { + char filename[64]; + int filesize; + int fileoffset; +}; struct bwi_fw_iv { /* Big endian */ @@ -261,9 +238,6 @@ struct bwi_fw_iv { uint32_t val; } __packed; -#define BWI_FW_IV_OFS_MASK __BITS(14, 0) -#define BWI_FW_IV_IS_32BIT __BIT(15) - enum bwi_clock_mode { BWI_CLOCK_MODE_SLOW, BWI_CLOCK_MODE_FAST, |