diff options
author | Stefan Sperling <stsp@cvs.openbsd.org> | 2019-11-04 11:59:53 +0000 |
---|---|---|
committer | Stefan Sperling <stsp@cvs.openbsd.org> | 2019-11-04 11:59:53 +0000 |
commit | 4946e9548bd026109e5785b9fe5a08de5abb475c (patch) | |
tree | 26ff5fe86da785afd33a97e2ad10b9e63ee8d9ce /sys/dev/pci | |
parent | ab71acf91c43de99ebd2e86d8466e5d113915b64 (diff) |
Support iwm(4) firmware images with ucode_api flags larger than 32 bits.
ok patrick@
Diffstat (limited to 'sys/dev/pci')
-rw-r--r-- | sys/dev/pci/if_iwm.c | 16 | ||||
-rw-r--r-- | sys/dev/pci/if_iwmreg.h | 37 | ||||
-rw-r--r-- | sys/dev/pci/if_iwmvar.h | 4 |
3 files changed, 39 insertions, 18 deletions
diff --git a/sys/dev/pci/if_iwm.c b/sys/dev/pci/if_iwm.c index e509f6d90a2..e4545518cf4 100644 --- a/sys/dev/pci/if_iwm.c +++ b/sys/dev/pci/if_iwm.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_iwm.c,v 1.269 2019/11/04 11:48:46 stsp Exp $ */ +/* $OpenBSD: if_iwm.c,v 1.270 2019/11/04 11:59:52 stsp Exp $ */ /* * Copyright (c) 2014, 2016 genua gmbh <info@genua.de> @@ -746,16 +746,22 @@ iwm_read_firmware(struct iwm_softc *sc, enum iwm_ucode_type ucode_type) case IWM_UCODE_TLV_API_CHANGES_SET: { struct iwm_ucode_api *api; + int idx, i; if (tlv_len != sizeof(*api)) { err = EINVAL; goto parse_out; } api = (struct iwm_ucode_api *)tlv_data; - /* Flags may exceed 32 bits in future firmware. */ - if (le32toh(api->api_index) > 0) { + idx = le32toh(api->api_index); + if (idx >= howmany(IWM_NUM_UCODE_TLV_API, 32)) { + err = EINVAL; goto parse_out; } - sc->sc_ucode_api = le32toh(api->api_flags); + for (i = 0; i < 32; i++) { + if ((le32toh(api->api_flags) & (1 << i)) == 0) + continue; + setbit(sc->sc_ucode_api, i + (32 * idx)); + } break; } @@ -6389,7 +6395,7 @@ iwm_send_update_mcc_cmd(struct iwm_softc *sc, const char *alpha2) memset(&mcc_cmd, 0, sizeof(mcc_cmd)); mcc_cmd.mcc = htole16(alpha2[0] << 8 | alpha2[1]); - if ((sc->sc_ucode_api & IWM_UCODE_TLV_API_WIFI_MCC_UPDATE) || + if (isset(sc->sc_ucode_api, IWM_UCODE_TLV_API_WIFI_MCC_UPDATE) || isset(sc->sc_enabled_capa, IWM_UCODE_TLV_CAPA_LAR_MULTI_MCC)) mcc_cmd.source_id = IWM_MCC_SOURCE_GET_CURRENT; else diff --git a/sys/dev/pci/if_iwmreg.h b/sys/dev/pci/if_iwmreg.h index 501e81fdfeb..db861752309 100644 --- a/sys/dev/pci/if_iwmreg.h +++ b/sys/dev/pci/if_iwmreg.h @@ -1,4 +1,4 @@ -/* $OpenBSD: if_iwmreg.h,v 1.39 2019/11/04 11:55:46 stsp Exp $ */ +/* $OpenBSD: if_iwmreg.h,v 1.40 2019/11/04 11:59:52 stsp Exp $ */ /****************************************************************************** * @@ -610,21 +610,36 @@ * @IWM_UCODE_TLV_API_WIFI_MCC_UPDATE: ucode supports MCC updates with source. * @IWM_UCODE_TLV_API_WIDE_CMD_HDR: ucode supports wide command header * @IWM_UCODE_TLV_API_LQ_SS_PARAMS: Configure STBC/BFER via LQ CMD ss_params - * @IWM_UCODE_TLV_API_EXT_SCAN_PRIORITY: scan APIs use 8-level priority - * instead of 3. + * @IWM_UCODE_TLV_API_NEW_VERSION: new versioning format * @IWM_UCODE_TLV_API_TX_POWER_CHAIN: TX power API has larger command size * (command version 3) that supports per-chain limits + * @IWM_UCODE_TLV_API_SCAN_TSF_REPORT: Scan start time reported in scan + * iteration complete notification, and the timestamp reported for RX + * received during scan, are reported in TSF of the mac specified in the + * scan request. + * @IWM_UCODE_TLV_API_TKIP_MIC_KEYS: This ucode supports version 2 of + * ADD_MODIFY_STA_KEY_API_S_VER_2. + * @IWM_UCODE_TLV_API_STA_TYPE: This ucode supports station type assignement. + * @IWM_UCODE_TLV_API_EXT_SCAN_PRIORITY: scan APIs use 8-level priority + * instead of 3. + * @IWM_UCODE_TLV_API_NEW_RX_STATS: should new RX STATISTICS API be used * * @IWM_NUM_UCODE_TLV_API: number of bits used */ -#define IWM_UCODE_TLV_API_FRAGMENTED_SCAN (1 << 8) -#define IWM_UCODE_TLV_API_WIFI_MCC_UPDATE (1 << 9) -#define IWM_UCODE_TLV_API_WIDE_CMD_HDR (1 << 14) -#define IWM_UCODE_TLV_API_LQ_SS_PARAMS (1 << 18) -#define IWM_UCODE_TLV_API_EXT_SCAN_PRIORITY (1 << 24) -#define IWM_UCODE_TLV_API_TX_POWER_CHAIN (1 << 27) -#define IWM_UCODE_TLV_API_TKIP_MIC_KEYS (1 << 29) -#define IWM_NUM_UCODE_TLV_API = 32 +#define IWM_UCODE_TLV_API_FRAGMENTED_SCAN 8 +#define IWM_UCODE_TLV_API_WIFI_MCC_UPDATE 9 +#define IWM_UCODE_TLV_API_WIDE_CMD_HDR 14 +#define IWM_UCODE_TLV_API_LQ_SS_PARAMS 18 +#define IWM_UCODE_TLV_API_NEW_VERSION 20 +#define IWM_UCODE_TLV_API_EXT_SCAN_PRIORITY 24 +#define IWM_UCODE_TLV_API_TX_POWER_CHAIN 27 +#define IWM_UCODE_TLV_API_SCAN_TSF_REPORT 28 +#define IWM_UCODE_TLV_API_TKIP_MIC_KEYS 29 +#define IWM_UCODE_TLV_API_STA_TYPE 30 +#define IWM_UCODE_TLV_API_NAN2_VER2 31 +#define IWM_UCODE_TLV_API_ADAPTIVE_DWELL 32 +#define IWM_UCODE_TLV_API_NEW_RX_STATS 35 +#define IWM_NUM_UCODE_TLV_API 128 #define IWM_UCODE_TLV_API_BITS \ "\020\10FRAGMENTED_SCAN\11WIFI_MCC_UPDATE\16WIDE_CMD_HDR\22LQ_SS_PARAMS\30EXT_SCAN_PRIO\33TX_POWER_CHAIN\35TKIP_MIC_KEYS" diff --git a/sys/dev/pci/if_iwmvar.h b/sys/dev/pci/if_iwmvar.h index 0d16f393940..52e718ddcee 100644 --- a/sys/dev/pci/if_iwmvar.h +++ b/sys/dev/pci/if_iwmvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: if_iwmvar.h,v 1.43 2019/11/04 11:29:11 stsp Exp $ */ +/* $OpenBSD: if_iwmvar.h,v 1.44 2019/11/04 11:59:52 stsp Exp $ */ /* * Copyright (c) 2014 genua mbh <info@genua.de> @@ -434,7 +434,7 @@ struct iwm_softc { int sc_capaflags; int sc_capa_max_probe_len; int sc_capa_n_scan_channels; - uint32_t sc_ucode_api; + uint8_t sc_ucode_api[howmany(IWM_NUM_UCODE_TLV_API, NBBY)]; uint8_t sc_enabled_capa[howmany(IWM_NUM_UCODE_TLV_CAPA, NBBY)]; char sc_fw_mcc[3]; |