diff options
author | Stefan Sperling <stsp@cvs.openbsd.org> | 2019-10-28 18:02:59 +0000 |
---|---|---|
committer | Stefan Sperling <stsp@cvs.openbsd.org> | 2019-10-28 18:02:59 +0000 |
commit | edb424858984ea5073e321ac54f19998e11dbc2f (patch) | |
tree | fafd9d11b2759e7b8ce256511e4d500402b6ec4e /sys | |
parent | 2b619a67956b253599510f9ecbe9db54d5b7bcb9 (diff) |
Get rid of version 1 of iwm's time event firmware API.
All supported firmware versions support IWM_UCODE_TLV_FLAGS_TIME_EVENT_API_V2.
Rename struct iwm_time_event_cmd_v2 to iwm_time_event_cmd, and remove helper
functions for converting from V2 API structs to V1 versions.
Patch by Imre Vadasz
ok patrick@
Diffstat (limited to 'sys')
-rw-r--r-- | sys/dev/pci/if_iwm.c | 69 | ||||
-rw-r--r-- | sys/dev/pci/if_iwmreg.h | 56 |
2 files changed, 11 insertions, 114 deletions
diff --git a/sys/dev/pci/if_iwm.c b/sys/dev/pci/if_iwm.c index 5e055e45b40..9f9907e4541 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.262 2019/10/28 18:00:14 stsp Exp $ */ +/* $OpenBSD: if_iwm.c,v 1.263 2019/10/28 18:02:58 stsp Exp $ */ /* * Copyright (c) 2014, 2016 genua gmbh <info@genua.de> @@ -310,10 +310,6 @@ int iwm_send_phy_db_cmd(struct iwm_softc *, uint16_t, uint16_t, void *); int iwm_phy_db_send_all_channel_groups(struct iwm_softc *, uint16_t, uint8_t); int iwm_send_phy_db_data(struct iwm_softc *); -void iwm_te_v2_to_v1(const struct iwm_time_event_cmd_v2 *, - struct iwm_time_event_cmd_v1 *); -int iwm_send_time_event_cmd(struct iwm_softc *, - const struct iwm_time_event_cmd_v2 *); void iwm_protect_session(struct iwm_softc *, struct iwm_node *, uint32_t, uint32_t); void iwm_unprotect_session(struct iwm_softc *, struct iwm_node *); @@ -2187,57 +2183,10 @@ iwm_send_phy_db_data(struct iwm_softc *sc) #define IWM_ROC_TE_TYPE_NORMAL IWM_TE_P2P_DEVICE_DISCOVERABLE #define IWM_ROC_TE_TYPE_MGMT_TX IWM_TE_P2P_CLIENT_ASSOC -/* used to convert from time event API v2 to v1 */ -#define IWM_TE_V2_DEP_POLICY_MSK (IWM_TE_V2_DEP_OTHER | IWM_TE_V2_DEP_TSF |\ - IWM_TE_V2_EVENT_SOCIOPATHIC) -static inline uint16_t -iwm_te_v2_get_notify(uint16_t policy) -{ - return le16toh(policy) & IWM_TE_V2_NOTIF_MSK; -} - -static inline uint16_t -iwm_te_v2_get_dep_policy(uint16_t policy) -{ - return (le16toh(policy) & IWM_TE_V2_DEP_POLICY_MSK) >> - IWM_TE_V2_PLACEMENT_POS; -} - -static inline uint16_t -iwm_te_v2_get_absence(uint16_t policy) -{ - return (le16toh(policy) & IWM_TE_V2_ABSENCE) >> IWM_TE_V2_ABSENCE_POS; -} - -void -iwm_te_v2_to_v1(const struct iwm_time_event_cmd_v2 *cmd_v2, - struct iwm_time_event_cmd_v1 *cmd_v1) -{ - cmd_v1->id_and_color = cmd_v2->id_and_color; - cmd_v1->action = cmd_v2->action; - cmd_v1->id = cmd_v2->id; - cmd_v1->apply_time = cmd_v2->apply_time; - cmd_v1->max_delay = cmd_v2->max_delay; - cmd_v1->depends_on = cmd_v2->depends_on; - cmd_v1->interval = cmd_v2->interval; - cmd_v1->duration = cmd_v2->duration; - if (cmd_v2->repeat == IWM_TE_V2_REPEAT_ENDLESS) - cmd_v1->repeat = htole32(IWM_TE_V1_REPEAT_ENDLESS); - else - cmd_v1->repeat = htole32(cmd_v2->repeat); - cmd_v1->max_frags = htole32(cmd_v2->max_frags); - cmd_v1->interval_reciprocal = 0; /* unused */ - - cmd_v1->dep_policy = htole32(iwm_te_v2_get_dep_policy(cmd_v2->policy)); - cmd_v1->is_present = htole32(!iwm_te_v2_get_absence(cmd_v2->policy)); - cmd_v1->notify = htole32(iwm_te_v2_get_notify(cmd_v2->policy)); -} - int iwm_send_time_event_cmd(struct iwm_softc *sc, - const struct iwm_time_event_cmd_v2 *cmd) + const struct iwm_time_event_cmd *cmd) { - struct iwm_time_event_cmd_v1 cmd_v1; struct iwm_rx_packet *pkt; struct iwm_time_event_resp *resp; struct iwm_host_cmd hcmd = { @@ -2248,14 +2197,8 @@ iwm_send_time_event_cmd(struct iwm_softc *sc, uint32_t resp_len; int err; - if (sc->sc_capaflags & IWM_UCODE_TLV_FLAGS_TIME_EVENT_API_V2) { - hcmd.data[0] = cmd; - hcmd.len[0] = sizeof(*cmd); - } else { - iwm_te_v2_to_v1(cmd, &cmd_v1); - hcmd.data[0] = &cmd_v1; - hcmd.len[0] = sizeof(cmd_v1); - } + hcmd.data[0] = cmd; + hcmd.len[0] = sizeof(*cmd); err = iwm_send_cmd(sc, &hcmd); if (err) return err; @@ -2286,7 +2229,7 @@ void iwm_protect_session(struct iwm_softc *sc, struct iwm_node *in, uint32_t duration, uint32_t max_delay) { - struct iwm_time_event_cmd_v2 time_cmd; + struct iwm_time_event_cmd time_cmd; /* Do nothing if a time event is already scheduled. */ if (sc->sc_flags & IWM_FLAG_TE_ACTIVE) @@ -2321,7 +2264,7 @@ iwm_protect_session(struct iwm_softc *sc, struct iwm_node *in, void iwm_unprotect_session(struct iwm_softc *sc, struct iwm_node *in) { - struct iwm_time_event_cmd_v2 time_cmd; + struct iwm_time_event_cmd time_cmd; /* Do nothing if the time event has already ended. */ if ((sc->sc_flags & IWM_FLAG_TE_ACTIVE) == 0) diff --git a/sys/dev/pci/if_iwmreg.h b/sys/dev/pci/if_iwmreg.h index 87aa3f590ee..db46a73253c 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.34 2019/10/28 18:00:14 stsp Exp $ */ +/* $OpenBSD: if_iwmreg.h,v 1.35 2019/10/28 18:02:58 stsp Exp $ */ /****************************************************************************** * @@ -565,7 +565,6 @@ * @IWM_UCODE_TLV_FLAGS_UAPSD: This uCode image supports uAPSD * @IWM_UCODE_TLV_FLAGS_SHORT_BL: 16 entries of black list instead of 64 in scan * offload profile config command. - * @IWM_UCODE_TLV_FLAGS_TIME_EVENT_API_V2: using the new time event API. * @IWM_UCODE_TLV_FLAGS_D3_6_IPV6_ADDRS: D3 image supports up to six * (rather than two) IPv6 addresses * @IWM_UCODE_TLV_FLAGS_NO_BASIC_SSID: not sending a probe with the SSID element @@ -587,7 +586,6 @@ #define IWM_UCODE_TLV_FLAGS_P2P (1 << 3) #define IWM_UCODE_TLV_FLAGS_DW_BC_TABLE (1 << 4) #define IWM_UCODE_TLV_FLAGS_SHORT_BL (1 << 7) -#define IWM_UCODE_TLV_FLAGS_TIME_EVENT_API_V2 (1 << 9) #define IWM_UCODE_TLV_FLAGS_D3_6_IPV6_ADDRS (1 << 10) #define IWM_UCODE_TLV_FLAGS_NO_BASIC_SSID (1 << 12) #define IWM_UCODE_TLV_FLAGS_NEW_NSOFFL_SMALL (1 << 15) @@ -2360,51 +2358,7 @@ struct iwm_error_resp { /* IWM_MAC_EVENT_ACTION_API_E_VER_2 */ -/** - * struct iwm_time_event_cmd_api_v1 - configuring Time Events - * with struct IWM_MAC_TIME_EVENT_DATA_API_S_VER_1 (see also - * with version 2. determined by IWM_UCODE_TLV_FLAGS) - * ( IWM_TIME_EVENT_CMD = 0x29 ) - * @id_and_color: ID and color of the relevant MAC - * @action: action to perform, one of IWM_FW_CTXT_ACTION_* - * @id: this field has two meanings, depending on the action: - * If the action is ADD, then it means the type of event to add. - * For all other actions it is the unique event ID assigned when the - * event was added by the FW. - * @apply_time: When to start the Time Event (in GP2) - * @max_delay: maximum delay to event's start (apply time), in TU - * @depends_on: the unique ID of the event we depend on (if any) - * @interval: interval between repetitions, in TU - * @interval_reciprocal: 2^32 / interval - * @duration: duration of event in TU - * @repeat: how many repetitions to do, can be IWM_TE_REPEAT_ENDLESS - * @dep_policy: one of IWM_TE_V1_INDEPENDENT, IWM_TE_V1_DEP_OTHER, IWM_TE_V1_DEP_TSF - * and IWM_TE_V1_EVENT_SOCIOPATHIC - * @is_present: 0 or 1, are we present or absent during the Time Event - * @max_frags: maximal number of fragments the Time Event can be divided to - * @notify: notifications using IWM_TE_V1_NOTIF_* (whom to notify when) - */ -struct iwm_time_event_cmd_v1 { - /* COMMON_INDEX_HDR_API_S_VER_1 */ - uint32_t id_and_color; - uint32_t action; - uint32_t id; - /* IWM_MAC_TIME_EVENT_DATA_API_S_VER_1 */ - uint32_t apply_time; - uint32_t max_delay; - uint32_t dep_policy; - uint32_t depends_on; - uint32_t is_present; - uint32_t max_frags; - uint32_t interval; - uint32_t interval_reciprocal; - uint32_t duration; - uint32_t repeat; - uint32_t notify; -} __packed; /* IWM_MAC_TIME_EVENT_CMD_API_S_VER_1 */ - - -/* Time event - defines for command API v2 */ +/* Time event - defines for command API */ /** * DOC: Time Events - what is it? @@ -2470,7 +2424,7 @@ struct iwm_time_event_cmd_v1 { #define IWM_TE_V2_PLACEMENT_POS 12 #define IWM_TE_V2_ABSENCE_POS 15 -/* Time event policy values (for time event cmd api v2) +/* Time event policy values * A notification (both event and fragment) includes a status indicating weather * the FW was able to schedule the event or not. For fragment start/end * notification the status is always success. There is no start/end fragment @@ -2515,7 +2469,7 @@ struct iwm_time_event_cmd_v1 { #define IWM_TE_V2_ABSENCE (1 << IWM_TE_V2_ABSENCE_POS) /** - * struct iwm_time_event_cmd_api_v2 - configuring Time Events + * struct iwm_time_event_cmd_api - configuring Time Events * with struct IWM_MAC_TIME_EVENT_DATA_API_S_VER_2 (see also * with version 1. determined by IWM_UCODE_TLV_FLAGS) * ( IWM_TIME_EVENT_CMD = 0x29 ) @@ -2538,7 +2492,7 @@ struct iwm_time_event_cmd_v1 { * IWM_TE_EVENT_SOCIOPATHIC * using IWM_TE_ABSENCE and using IWM_TE_NOTIF_* */ -struct iwm_time_event_cmd_v2 { +struct iwm_time_event_cmd { /* COMMON_INDEX_HDR_API_S_VER_1 */ uint32_t id_and_color; uint32_t action; |