svn commit: r343388 - head/sys/dev/iwm

Kyle Evans kevans at FreeBSD.org
Thu Jan 24 03:49:37 UTC 2019


Author: kevans
Date: Thu Jan 24 03:49:35 2019
New Revision: 343388
URL: https://svnweb.freebsd.org/changeset/base/343388

Log:
  iwm - Update alive response handling, add v4 and remove old versions.
  
  Submitted by:	Augustin Cavalier <waddlesplash at gmail.com> (Haiku)
  Obtained from:	DragonFlyBSD (3820e2bf3331ced3541d1811a38c5a5136dfab93)

Modified:
  head/sys/dev/iwm/if_iwm.c
  head/sys/dev/iwm/if_iwmreg.h
  head/sys/dev/iwm/if_iwmvar.h

Modified: head/sys/dev/iwm/if_iwm.c
==============================================================================
--- head/sys/dev/iwm/if_iwm.c	Thu Jan 24 03:49:11 2019	(r343387)
+++ head/sys/dev/iwm/if_iwm.c	Thu Jan 24 03:49:35 2019	(r343388)
@@ -2723,75 +2723,48 @@ static int
 iwm_alive_fn(struct iwm_softc *sc, struct iwm_rx_packet *pkt, void *data)
 {
 	struct iwm_mvm_alive_data *alive_data = data;
-	struct iwm_mvm_alive_resp_ver1 *palive1;
-	struct iwm_mvm_alive_resp_ver2 *palive2;
+	struct iwm_mvm_alive_resp_v3 *palive3;
 	struct iwm_mvm_alive_resp *palive;
+	struct iwm_umac_alive *umac;
+	struct iwm_lmac_alive *lmac1;
+	struct iwm_lmac_alive *lmac2 = NULL;
+	uint16_t status;
 
-	if (iwm_rx_packet_payload_len(pkt) == sizeof(*palive1)) {
-		palive1 = (void *)pkt->data;
-
-		sc->support_umac_log = FALSE;
-                sc->error_event_table =
-                        le32toh(palive1->error_event_table_ptr);
-                sc->log_event_table =
-                        le32toh(palive1->log_event_table_ptr);
-                alive_data->scd_base_addr = le32toh(palive1->scd_base_ptr);
-
-                alive_data->valid = le16toh(palive1->status) ==
-                                    IWM_ALIVE_STATUS_OK;
-                IWM_DPRINTF(sc, IWM_DEBUG_RESET,
-			    "Alive VER1 ucode status 0x%04x revision 0x%01X 0x%01X flags 0x%01X\n",
-			     le16toh(palive1->status), palive1->ver_type,
-                             palive1->ver_subtype, palive1->flags);
-	} else if (iwm_rx_packet_payload_len(pkt) == sizeof(*palive2)) {
-		palive2 = (void *)pkt->data;
-		sc->error_event_table =
-			le32toh(palive2->error_event_table_ptr);
-		sc->log_event_table =
-			le32toh(palive2->log_event_table_ptr);
-		alive_data->scd_base_addr = le32toh(palive2->scd_base_ptr);
-		sc->umac_error_event_table =
-                        le32toh(palive2->error_info_addr);
-
-		alive_data->valid = le16toh(palive2->status) ==
-				    IWM_ALIVE_STATUS_OK;
-		if (sc->umac_error_event_table)
-			sc->support_umac_log = TRUE;
-
-		IWM_DPRINTF(sc, IWM_DEBUG_RESET,
-			    "Alive VER2 ucode status 0x%04x revision 0x%01X 0x%01X flags 0x%01X\n",
-			    le16toh(palive2->status), palive2->ver_type,
-			    palive2->ver_subtype, palive2->flags);
-
-		IWM_DPRINTF(sc, IWM_DEBUG_RESET,
-			    "UMAC version: Major - 0x%x, Minor - 0x%x\n",
-			    palive2->umac_major, palive2->umac_minor);
-	} else if (iwm_rx_packet_payload_len(pkt) == sizeof(*palive)) {
+	if (iwm_rx_packet_payload_len(pkt) == sizeof(*palive)) {
 		palive = (void *)pkt->data;
+		umac = &palive->umac_data;
+		lmac1 = &palive->lmac_data[0];
+		lmac2 = &palive->lmac_data[1];
+		status = le16toh(palive->status);
+	} else {
+		palive3 = (void *)pkt->data;
+		umac = &palive3->umac_data;
+		lmac1 = &palive3->lmac_data;
+		status = le16toh(palive3->status);
+	}
 
-		sc->error_event_table =
-			le32toh(palive->error_event_table_ptr);
-		sc->log_event_table =
-			le32toh(palive->log_event_table_ptr);
-		alive_data->scd_base_addr = le32toh(palive->scd_base_ptr);
-		sc->umac_error_event_table =
-			le32toh(palive->error_info_addr);
+	sc->error_event_table[0] = le32toh(lmac1->error_event_table_ptr);
+	if (lmac2)
+		sc->error_event_table[1] =
+			le32toh(lmac2->error_event_table_ptr);
+	sc->log_event_table = le32toh(lmac1->log_event_table_ptr);
+	sc->umac_error_event_table = le32toh(umac->error_info_addr);
+	alive_data->scd_base_addr = le32toh(lmac1->scd_base_ptr);
+	alive_data->valid = status == IWM_ALIVE_STATUS_OK;
+	if (sc->umac_error_event_table)
+		sc->support_umac_log = TRUE;
 
-		alive_data->valid = le16toh(palive->status) ==
-				    IWM_ALIVE_STATUS_OK;
-		if (sc->umac_error_event_table)
-			sc->support_umac_log = TRUE;
+	IWM_DPRINTF(sc, IWM_DEBUG_FW,
+		    "Alive ucode status 0x%04x revision 0x%01X 0x%01X\n",
+		    status, lmac1->ver_type, lmac1->ver_subtype);
 
-		IWM_DPRINTF(sc, IWM_DEBUG_RESET,
-			    "Alive VER3 ucode status 0x%04x revision 0x%01X 0x%01X flags 0x%01X\n",
-			    le16toh(palive->status), palive->ver_type,
-			    palive->ver_subtype, palive->flags);
+	if (lmac2)
+		IWM_DPRINTF(sc, IWM_DEBUG_FW, "Alive ucode CDB\n");
 
-		IWM_DPRINTF(sc, IWM_DEBUG_RESET,
-			    "UMAC version: Major - 0x%x, Minor - 0x%x\n",
-			    le32toh(palive->umac_major),
-			    le32toh(palive->umac_minor));
-	}
+	IWM_DPRINTF(sc, IWM_DEBUG_FW,
+		    "UMAC version: Major - 0x%x, Minor - 0x%x\n",
+		    le32toh(umac->umac_major),
+		    le32toh(umac->umac_minor));
 
 	return TRUE;
 }
@@ -5052,7 +5025,7 @@ iwm_nic_error(struct iwm_softc *sc)
 	uint32_t base;
 
 	device_printf(sc->sc_dev, "dumping device error log\n");
-	base = sc->error_event_table;
+	base = sc->error_event_table[0];
 	if (base < 0x800000) {
 		device_printf(sc->sc_dev,
 		    "Invalid error log pointer 0x%08x\n", base);

Modified: head/sys/dev/iwm/if_iwmreg.h
==============================================================================
--- head/sys/dev/iwm/if_iwmreg.h	Thu Jan 24 03:49:11 2019	(r343387)
+++ head/sys/dev/iwm/if_iwmreg.h	Thu Jan 24 03:49:35 2019	(r343388)
@@ -2144,43 +2144,15 @@ enum {
 
 #define IWM_ALIVE_FLG_RFKILL	(1 << 0)
 
-struct iwm_mvm_alive_resp_ver1 {
-	uint16_t status;
-	uint16_t flags;
-	uint8_t ucode_minor;
-	uint8_t ucode_major;
-	uint16_t id;
-	uint8_t api_minor;
-	uint8_t api_major;
+struct iwm_lmac_alive {
+	uint32_t ucode_major;
+	uint32_t ucode_minor;
 	uint8_t ver_subtype;
 	uint8_t ver_type;
 	uint8_t mac;
 	uint8_t opt;
-	uint16_t reserved2;
 	uint32_t timestamp;
 	uint32_t error_event_table_ptr;	/* SRAM address for error log */
-	uint32_t log_event_table_ptr;	/* SRAM address for event log */
-	uint32_t cpu_register_ptr;
-	uint32_t dbgm_config_ptr;
-	uint32_t alive_counter_ptr;
-	uint32_t scd_base_ptr;		/* SRAM address for SCD */
-} __packed; /* IWM_ALIVE_RES_API_S_VER_1 */
-
-struct iwm_mvm_alive_resp_ver2 {
-	uint16_t status;
-	uint16_t flags;
-	uint8_t ucode_minor;
-	uint8_t ucode_major;
-	uint16_t id;
-	uint8_t api_minor;
-	uint8_t api_major;
-	uint8_t ver_subtype;
-	uint8_t ver_type;
-	uint8_t mac;
-	uint8_t opt;
-	uint16_t reserved2;
-	uint32_t timestamp;
-	uint32_t error_event_table_ptr;	/* SRAM address for error log */
 	uint32_t log_event_table_ptr;	/* SRAM address for LMAC event log */
 	uint32_t cpu_register_ptr;
 	uint32_t dbgm_config_ptr;
@@ -2188,36 +2160,28 @@ struct iwm_mvm_alive_resp_ver2 {
 	uint32_t scd_base_ptr;		/* SRAM address for SCD */
 	uint32_t st_fwrd_addr;		/* pointer to Store and forward */
 	uint32_t st_fwrd_size;
-	uint8_t umac_minor;		/* UMAC version: minor */
-	uint8_t umac_major;		/* UMAC version: major */
-	uint16_t umac_id;		/* UMAC version: id */
+} __packed; /* UCODE_ALIVE_NTFY_API_S_VER_3 */
+
+struct iwm_umac_alive {
+	uint32_t umac_major;		/* UMAC version: major */
+	uint32_t umac_minor;		/* UMAC version: minor */
 	uint32_t error_info_addr;	/* SRAM address for UMAC error log */
 	uint32_t dbg_print_buff_addr;
-} __packed; /* ALIVE_RES_API_S_VER_2 */
+} __packed; /* UMAC_ALIVE_DATA_API_S_VER_2 */
 
-struct iwm_mvm_alive_resp {
+struct iwm_mvm_alive_resp_v3 {
 	uint16_t status;
 	uint16_t flags;
-	uint32_t ucode_minor;
-	uint32_t ucode_major;
-	uint8_t ver_subtype;
-	uint8_t ver_type;
-	uint8_t mac;
-	uint8_t opt;
-	uint32_t timestamp;
-	uint32_t error_event_table_ptr;	/* SRAM address for error log */
-	uint32_t log_event_table_ptr;	/* SRAM address for LMAC event log */
-	uint32_t cpu_register_ptr;
-	uint32_t dbgm_config_ptr;
-	uint32_t alive_counter_ptr;
-	uint32_t scd_base_ptr;		/* SRAM address for SCD */
-	uint32_t st_fwrd_addr;		/* pointer to Store and forward */
-	uint32_t st_fwrd_size;
-	uint32_t umac_minor;		/* UMAC version: minor */
-	uint32_t umac_major;		/* UMAC version: major */
-	uint32_t error_info_addr;	/* SRAM address for UMAC error log */
-	uint32_t dbg_print_buff_addr;
+	struct iwm_lmac_alive lmac_data;
+	struct iwm_umac_alive umac_data;
 } __packed; /* ALIVE_RES_API_S_VER_3 */
+
+struct iwm_mvm_alive_resp {
+	uint16_t status;
+	uint16_t flags;
+	struct iwm_lmac_alive lmac_data[2];
+	struct iwm_umac_alive umac_data;
+} __packed; /* ALIVE_RES_API_S_VER_4 */
 
 /* Error response/notification */
 enum {

Modified: head/sys/dev/iwm/if_iwmvar.h
==============================================================================
--- head/sys/dev/iwm/if_iwmvar.h	Thu Jan 24 03:49:11 2019	(r343387)
+++ head/sys/dev/iwm/if_iwmvar.h	Thu Jan 24 03:49:35 2019	(r343388)
@@ -538,7 +538,7 @@ struct iwm_softc {
 	int			cmd_hold_nic_awake;
 
 	/* Firmware status */
-	uint32_t		error_event_table;
+	uint32_t		error_event_table[2];
 	uint32_t		log_event_table;
 	uint32_t		umac_error_event_table;
 	int			support_umac_log;


More information about the svn-src-all mailing list