Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 15 Mar 2019 07:34:06 +0000 (UTC)
From:      Andriy Voskoboinyk <avos@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org
Subject:   svn commit: r345172 - stable/12/sys/dev/iwm
Message-ID:  <201903150734.x2F7Y6Ov051042@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: avos
Date: Fri Mar 15 07:34:06 2019
New Revision: 345172
URL: https://svnweb.freebsd.org/changeset/base/345172

Log:
  MFC r345002:
  iwm(4): use correct channel list source for Intel 3168
  
  Intel 3168 uses another EEPROM section to store channel flags;
  port missing bits from iwlwifi to make it work.
  
  PR:		230750, 236235
  Tested by:	Bert JW Regeer <xistence@0x58.com>

Modified:
  stable/12/sys/dev/iwm/if_iwm.c
  stable/12/sys/dev/iwm/if_iwm_7000.c
  stable/12/sys/dev/iwm/if_iwm_config.h
  stable/12/sys/dev/iwm/if_iwmreg.h
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/dev/iwm/if_iwm.c
==============================================================================
--- stable/12/sys/dev/iwm/if_iwm.c	Fri Mar 15 02:11:28 2019	(r345171)
+++ stable/12/sys/dev/iwm/if_iwm.c	Fri Mar 15 07:34:06 2019	(r345172)
@@ -2237,7 +2237,8 @@ iwm_parse_nvm_data(struct iwm_softc *sc,
 	}
 
 	if (sc->cfg->device_family == IWM_DEVICE_FAMILY_7000) {
-		memcpy(data->nvm_ch_flags, &nvm_sw[IWM_NVM_CHANNELS],
+		memcpy(data->nvm_ch_flags, sc->cfg->nvm_type == IWM_NVM_SDP ?
+		    &regulatory[0] : &nvm_sw[IWM_NVM_CHANNELS],
 		    IWM_NUM_CHANNELS * sizeof(uint16_t));
 	} else {
 		memcpy(data->nvm_ch_flags, &regulatory[IWM_NVM_CHANNELS_8000],
@@ -2297,8 +2298,9 @@ iwm_parse_nvm_sections(struct iwm_softc *sc, struct iw
 	sw = (const uint16_t *)sections[IWM_NVM_SECTION_TYPE_SW].data;
 	calib = (const uint16_t *)
 	    sections[IWM_NVM_SECTION_TYPE_CALIBRATION].data;
-	regulatory = (const uint16_t *)
-	    sections[IWM_NVM_SECTION_TYPE_REGULATORY].data;
+	regulatory = sc->cfg->nvm_type == IWM_NVM_SDP ?
+	    (const uint16_t *)sections[IWM_NVM_SECTION_TYPE_REGULATORY_SDP].data :
+	    (const uint16_t *)sections[IWM_NVM_SECTION_TYPE_REGULATORY].data;
 	mac_override = (const uint16_t *)
 	    sections[IWM_NVM_SECTION_TYPE_MAC_OVERRIDE].data;
 	phy_sku = (const uint16_t *)sections[IWM_NVM_SECTION_TYPE_PHY_SKU].data;

Modified: stable/12/sys/dev/iwm/if_iwm_7000.c
==============================================================================
--- stable/12/sys/dev/iwm/if_iwm_7000.c	Fri Mar 15 02:11:28 2019	(r345171)
+++ stable/12/sys/dev/iwm/if_iwm_7000.c	Fri Mar 15 07:34:06 2019	(r345172)
@@ -119,6 +119,7 @@ const struct iwm_cfg iwm3168_cfg = {
 	.fw_name = IWM3168_FW,
 	IWM_DEVICE_7000_COMMON,
 	.host_interrupt_operation_mode = 0,
+	.nvm_type = IWM_NVM_SDP,
 };
 
 const struct iwm_cfg iwm7265_cfg = {

Modified: stable/12/sys/dev/iwm/if_iwm_config.h
==============================================================================
--- stable/12/sys/dev/iwm/if_iwm_config.h	Fri Mar 15 02:11:28 2019	(r345171)
+++ stable/12/sys/dev/iwm/if_iwm_config.h	Fri Mar 15 07:34:06 2019	(r345172)
@@ -102,7 +102,20 @@ static inline uint8_t num_of_ant(uint8_t mask)
 #define IWM_OTP_LOW_IMAGE_SIZE_FAMILY_8000	(32 * 512 * sizeof(uint16_t)) /* 32 KB */
 #define IWM_OTP_LOW_IMAGE_SIZE_FAMILY_9000	IWM_OTP_LOW_IMAGE_SIZE_FAMILY_8000
 
+
 /**
+ * enum iwl_nvm_type - nvm formats
+ * @IWM_NVM: the regular format
+ * @IWM_NVM_EXT: extended NVM format
+ * @IWM_NVM_SDP: NVM format used by 3168 series
+ */
+enum iwm_nvm_type {
+	IWM_NVM,
+	IWM_NVM_EXT,
+	IWM_NVM_SDP,
+};
+
+/**
  * struct iwm_cfg
  * @name: Official name of the device
  * @fw_name: Firmware filename.
@@ -111,6 +124,7 @@ static inline uint8_t num_of_ant(uint8_t mask)
  * @nvm_hw_section_num: the ID of the HW NVM section
  * @apmg_wake_up_wa: should the MAC access REQ be asserted when a command
  *      is in flight. This is due to a HW bug in 7260, 3160 and 7265.
+ * @nvm_type: see &enum iwl_nvm_type
  */
 struct iwm_cfg {
 	const char *name;
@@ -120,6 +134,7 @@ struct iwm_cfg {
         int host_interrupt_operation_mode;
         uint8_t nvm_hw_section_num;
         int apmg_wake_up_wa;
+        enum iwm_nvm_type nvm_type;
 };
 
 /*

Modified: stable/12/sys/dev/iwm/if_iwmreg.h
==============================================================================
--- stable/12/sys/dev/iwm/if_iwmreg.h	Fri Mar 15 02:11:28 2019	(r345171)
+++ stable/12/sys/dev/iwm/if_iwmreg.h	Fri Mar 15 07:34:06 2019	(r345172)
@@ -1992,6 +1992,7 @@ enum {
 	IWM_NVM_SECTION_TYPE_REGULATORY = 3,
 	IWM_NVM_SECTION_TYPE_CALIBRATION = 4,
 	IWM_NVM_SECTION_TYPE_PRODUCTION = 5,
+	IWM_NVM_SECTION_TYPE_REGULATORY_SDP = 8,
 	IWM_NVM_SECTION_TYPE_MAC_OVERRIDE = 11,
 	IWM_NVM_SECTION_TYPE_PHY_SKU = 12,
 	IWM_NVM_MAX_NUM_SECTIONS = 13,



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201903150734.x2F7Y6Ov051042>