Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 11 Mar 2019 08:30:29 +0000 (UTC)
From:      Andriy Voskoboinyk <avos@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r345002 - head/sys/dev/iwm
Message-ID:  <201903110830.x2B8UTLr010550@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: avos
Date: Mon Mar 11 08:30:29 2019
New Revision: 345002
URL: https://svnweb.freebsd.org/changeset/base/345002

Log:
  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>
  MFC after:	3 days

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

Modified: head/sys/dev/iwm/if_iwm.c
==============================================================================
--- head/sys/dev/iwm/if_iwm.c	Mon Mar 11 07:18:40 2019	(r345001)
+++ head/sys/dev/iwm/if_iwm.c	Mon Mar 11 08:30:29 2019	(r345002)
@@ -2211,7 +2211,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],
@@ -2271,8 +2272,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: head/sys/dev/iwm/if_iwm_7000.c
==============================================================================
--- head/sys/dev/iwm/if_iwm_7000.c	Mon Mar 11 07:18:40 2019	(r345001)
+++ head/sys/dev/iwm/if_iwm_7000.c	Mon Mar 11 08:30:29 2019	(r345002)
@@ -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: head/sys/dev/iwm/if_iwm_config.h
==============================================================================
--- head/sys/dev/iwm/if_iwm_config.h	Mon Mar 11 07:18:40 2019	(r345001)
+++ head/sys/dev/iwm/if_iwm_config.h	Mon Mar 11 08:30:29 2019	(r345002)
@@ -104,7 +104,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.
@@ -113,6 +126,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;
@@ -122,6 +136,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: head/sys/dev/iwm/if_iwmreg.h
==============================================================================
--- head/sys/dev/iwm/if_iwmreg.h	Mon Mar 11 07:18:40 2019	(r345001)
+++ head/sys/dev/iwm/if_iwmreg.h	Mon Mar 11 08:30:29 2019	(r345002)
@@ -2032,6 +2032,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?201903110830.x2B8UTLr010550>