From: stsp Date: Wed, 7 Jul 2021 08:32:00 +0000 (+0000) Subject: Support a new variant of the binding command required by new iwm(4) firmware. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=f28f6a8efbc306420f34cbb12367ce07c065b884;p=openbsd Support a new variant of the binding command required by new iwm(4) firmware. --- diff --git a/sys/dev/pci/if_iwm.c b/sys/dev/pci/if_iwm.c index ac4d3526290..c691f19b0e2 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.336 2021/07/07 08:21:31 stsp Exp $ */ +/* $OpenBSD: if_iwm.c,v 1.337 2021/07/07 08:32:00 stsp Exp $ */ /* * Copyright (c) 2014, 2016 genua gmbh @@ -5676,6 +5676,7 @@ iwm_binding_cmd(struct iwm_softc *sc, struct iwm_node *in, uint32_t action) uint32_t mac_id = IWM_FW_CMD_ID_AND_COLOR(in->in_id, in->in_color); int i, err, active = (sc->sc_flags & IWM_FLAG_BINDING_ACTIVE); uint32_t status; + size_t len; if (action == IWM_FW_CTXT_ACTION_ADD && active) panic("binding already added"); @@ -5696,9 +5697,19 @@ iwm_binding_cmd(struct iwm_softc *sc, struct iwm_node *in, uint32_t action) for (i = 1; i < IWM_MAX_MACS_IN_BINDING; i++) cmd.macs[i] = htole32(IWM_FW_CTXT_INVALID); + if (IEEE80211_IS_CHAN_2GHZ(phyctxt->channel) || + !isset(sc->sc_enabled_capa, IWM_UCODE_TLV_CAPA_CDB_SUPPORT)) + cmd.lmac_id = htole32(IWM_LMAC_24G_INDEX); + else + cmd.lmac_id = htole32(IWM_LMAC_5G_INDEX); + + if (isset(sc->sc_enabled_capa, IWM_UCODE_TLV_CAPA_BINDING_CDB_SUPPORT)) + len = sizeof(cmd); + else + len = sizeof(struct iwm_binding_cmd_v1); status = 0; - err = iwm_send_cmd_pdu_status(sc, IWM_BINDING_CONTEXT_CMD, - sizeof(cmd), &cmd, &status); + err = iwm_send_cmd_pdu_status(sc, IWM_BINDING_CONTEXT_CMD, len, &cmd, + &status); if (err == 0 && status != 0) err = EIO; diff --git a/sys/dev/pci/if_iwmreg.h b/sys/dev/pci/if_iwmreg.h index c396eeca999..dadf372c2c4 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.56 2021/07/07 08:21:31 stsp Exp $ */ +/* $OpenBSD: if_iwmreg.h,v 1.57 2021/07/07 08:32:00 stsp Exp $ */ /****************************************************************************** * @@ -916,6 +916,8 @@ enum msix_ivar_for_cause { #define IWM_UCODE_TLV_CAPA_GSCAN_SUPPORT 31 #define IWM_UCODE_TLV_CAPA_NAN_SUPPORT 34 #define IWM_UCODE_TLV_CAPA_UMAC_UPLOAD 35 +#define IWM_UCODE_TLV_CAPA_BINDING_CDB_SUPPORT 39 +#define IWM_UCODE_TLV_CAPA_CDB_SUPPORT 40 #define IWM_UCODE_TLV_CAPA_DYNAMIC_QUOTA 44 #define IWM_UCODE_TLV_CAPA_ULTRA_HB_CHANNELS 48 #define IWM_UCODE_TLV_CAPA_EXTENDED_DTS_MEASURE 64 @@ -2854,6 +2856,24 @@ struct iwm_time_event_notif { /* Bindings and Time Quota */ +/** + * struct iwm_binding_cmd_v1 - configuring bindings + * ( IWM_BINDING_CONTEXT_CMD = 0x2b ) + * @id_and_color: ID and color of the relevant Binding + * @action: action to perform, one of IWM_FW_CTXT_ACTION_* + * @macs: array of MAC id and colors which belong to the binding + * @phy: PHY id and color which belongs to the binding + * @lmac_id: the lmac id the binding belongs to + */ +struct iwm_binding_cmd_v1 { + /* COMMON_INDEX_HDR_API_S_VER_1 */ + uint32_t id_and_color; + uint32_t action; + /* IWM_BINDING_DATA_API_S_VER_1 */ + uint32_t macs[IWM_MAX_MACS_IN_BINDING]; + uint32_t phy; +} __packed; /* IWM_BINDING_CMD_API_S_VER_1 */ + /** * struct iwm_binding_cmd - configuring bindings * ( IWM_BINDING_CONTEXT_CMD = 0x2b ) @@ -2861,6 +2881,7 @@ struct iwm_time_event_notif { * @action: action to perform, one of IWM_FW_CTXT_ACTION_* * @macs: array of MAC id and colors which belong to the binding * @phy: PHY id and color which belongs to the binding + * @lmac_id: the lmac id the binding belongs to */ struct iwm_binding_cmd { /* COMMON_INDEX_HDR_API_S_VER_1 */ @@ -2869,7 +2890,11 @@ struct iwm_binding_cmd { /* IWM_BINDING_DATA_API_S_VER_1 */ uint32_t macs[IWM_MAX_MACS_IN_BINDING]; uint32_t phy; -} __packed; /* IWM_BINDING_CMD_API_S_VER_1 */ + uint32_t lmac_id; +} __packed; /* IWM_BINDING_CMD_API_S_VER_2 */ + +#define IWM_LMAC_24G_INDEX 0 +#define IWM_LMAC_5G_INDEX 1 /* The maximal number of fragments in the FW's schedule session */ #define IWM_MAX_QUOTA 128