Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp731402ybz; Sat, 25 Apr 2020 03:06:14 -0700 (PDT) X-Google-Smtp-Source: APiQypLjueNT3gxJDD7ormb5iFs1/rEBUEQlWyE4FdJAOc2olfNSuXw2iYtd5owFe7MiT38zZv43 X-Received: by 2002:a17:907:2711:: with SMTP id w17mr10950229ejk.116.1587809174329; Sat, 25 Apr 2020 03:06:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587809174; cv=none; d=google.com; s=arc-20160816; b=Gw6pQfPMPOlVgGH8V+8k8y4lQVWBkWbvbsuWXBRnAAHAbztcyCrKGQpsN8X3bQ/UsZ Dh/HX7iqpThODIXHJdyouyFOdrWdVXQmcb7SCGIuZvSRDpmVEszpgoWLpt8IcciA30GW doqwNucNeB/2mCi0N1wkorBmtL0/YlGayEmIh84OzzJxvRGzIssaFHw9WMgRRN6XWNuR rgI26phvbgjAO4ptEUbc4+Vzw/G70PTa/jjM2eKHuIu34lZmwfDao5ezLzhlPEkKSw1g sNmKrqHOunM/l9SMsdsLbdyDPg+hLkV5I2lYu0UbdhMrAtl4yZUv8t1u3VPYWAHDCRQj 6aOA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:subject:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:cc:to:from; bh=2gM7kfV3fepjeAklmwPyKBGUSjdKknZzVJjpWoMy/Is=; b=ZfjA+iR3hWWBaDOPwhKRZ8m7OPDZlW/9gDJ80u/6uXrEoB1iDrRs4CBfMzmgN3oj/z DBTpux2DVhANNWiOBg6jKM+XBnXf/3YcotpZZvZ85a2NiE/YY9gx45SJokb7i4G8q2Zw uCTLErgxMVXAxfMlYA9MyUGRhfpYhwLYAvkmcNOtwhOyXFk2cr4WCHoS9oijOZUJLiED 7BCduoebm/LiAO2W55hinneT8yM9hbIhbzuGHq3mZYIu0FCAtdNfpPbecj8yYEn0E0cm M1znrj1Ao/1a68GcZR5NK4XZpHf/EVyQwWttYuAMYPs4cZogChBYLxsZHQPY9oIPBr8C cUbA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n8si4634452eju.329.2020.04.25.03.05.45; Sat, 25 Apr 2020 03:06:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726284AbgDYKFU (ORCPT + 99 others); Sat, 25 Apr 2020 06:05:20 -0400 Received: from paleale.coelho.fi ([176.9.41.70]:58274 "EHLO farmhouse.coelho.fi" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726359AbgDYKFU (ORCPT ); Sat, 25 Apr 2020 06:05:20 -0400 Received: from 91-156-6-193.elisa-laajakaista.fi ([91.156.6.193] helo=redipa.ger.corp.intel.com) by farmhouse.coelho.fi with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.93) (envelope-from ) id 1jSHgT-000P3t-GZ; Sat, 25 Apr 2020 13:05:18 +0300 From: Luca Coelho To: kvalo@codeaurora.org Cc: linux-wireless@vger.kernel.org Date: Sat, 25 Apr 2020 13:04:59 +0300 Message-Id: X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200425100459.2778317-1-luca@coelho.fi> References: <20200425100459.2778317-1-luca@coelho.fi> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on farmhouse.coelho.fi X-Spam-Level: X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00, TVD_RCVD_IP autolearn=ham autolearn_force=no version=3.4.4 Subject: [PATCH 11/11] iwlwifi: dbg_ini: differentiate ax210 hw with same hw type Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Liad Kaufman There are several "flavors" of HW that have the same HW type, but can be told apart after reading a certain perph register. This is easy to do in runtime, but more complicated to do when looking at the logs offline. To make it easier to tell apart these "flavors" when looking at the dumped dbg info, add these bits to the HW type, allowing simple differentiation. Signed-off-by: Liad Kaufman Signed-off-by: Luca Coelho --- drivers/net/wireless/intel/iwlwifi/fw/dbg.c | 22 ++++++++++++++++++- .../wireless/intel/iwlwifi/fw/error-dump.h | 13 +++++++++-- 2 files changed, 32 insertions(+), 3 deletions(-) diff --git a/drivers/net/wireless/intel/iwlwifi/fw/dbg.c b/drivers/net/wireless/intel/iwlwifi/fw/dbg.c index 2a271aad8106..4d3687cc83a4 100644 --- a/drivers/net/wireless/intel/iwlwifi/fw/dbg.c +++ b/drivers/net/wireless/intel/iwlwifi/fw/dbg.c @@ -1958,6 +1958,7 @@ static u32 iwl_dump_ini_info(struct iwl_fw_runtime *fwrt, struct iwl_fw_ini_dump_cfg_name *cfg_name; u32 size = sizeof(*tlv) + sizeof(*dump); u32 num_of_cfg_names = 0; + u32 hw_type; list_for_each_entry(node, &fwrt->trans->dbg.debug_info_tlv_list, list) { size += sizeof(*cfg_name); @@ -1986,7 +1987,26 @@ static u32 iwl_dump_ini_info(struct iwl_fw_runtime *fwrt, dump->ver_subtype = cpu_to_le32(fwrt->dump.fw_ver.subtype); dump->hw_step = cpu_to_le32(CSR_HW_REV_STEP(fwrt->trans->hw_rev)); - dump->hw_type = cpu_to_le32(CSR_HW_REV_TYPE(fwrt->trans->hw_rev)); + + /* + * Several HWs all have type == 0x42, so we'll override this value + * according to the detected HW + */ + hw_type = CSR_HW_REV_TYPE(fwrt->trans->hw_rev); + if (hw_type == IWL_AX210_HW_TYPE) { + u32 prph_val = iwl_read_prph(fwrt->trans, WFPM_OTP_CFG1_ADDR); + u32 is_jacket = !!(prph_val & WFPM_OTP_CFG1_IS_JACKET_BIT); + u32 is_cdb = !!(prph_val & WFPM_OTP_CFG1_IS_CDB_BIT); + u32 masked_bits = is_jacket | (is_cdb << 1); + + /* + * The HW type depends on certain bits in this case, so add + * these bits to the HW type. We won't have collisions since we + * add these bits after the highest possible bit in the mask. + */ + hw_type |= masked_bits << IWL_AX210_HW_TYPE_ADDITION_SHIFT; + } + dump->hw_type = cpu_to_le32(hw_type); dump->rf_id_flavor = cpu_to_le32(CSR_HW_RFID_FLAVOR(fwrt->trans->hw_rf_id)); diff --git a/drivers/net/wireless/intel/iwlwifi/fw/error-dump.h b/drivers/net/wireless/intel/iwlwifi/fw/error-dump.h index f008e1bbfdf4..72bfc64580ab 100644 --- a/drivers/net/wireless/intel/iwlwifi/fw/error-dump.h +++ b/drivers/net/wireless/intel/iwlwifi/fw/error-dump.h @@ -8,7 +8,7 @@ * Copyright(c) 2014 Intel Corporation. All rights reserved. * Copyright(c) 2014 - 2015 Intel Mobile Communications GmbH * Copyright(c) 2016 - 2017 Intel Deutschland GmbH - * Copyright (C) 2018 - 2019 Intel Corporation + * Copyright (C) 2018 - 2020 Intel Corporation * * This program is free software; you can redistribute it and/or modify * it under the terms of version 2 of the GNU General Public License as @@ -31,7 +31,7 @@ * Copyright(c) 2014 Intel Corporation. All rights reserved. * Copyright(c) 2014 - 2015 Intel Mobile Communications GmbH * Copyright(c) 2016 - 2017 Intel Deutschland GmbH - * Copyright (C) 2018 - 2019 Intel Corporation + * Copyright (C) 2018 - 2020 Intel Corporation * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -394,6 +394,15 @@ struct iwl_fw_ini_dump_cfg_name { u8 cfg_name[IWL_FW_INI_MAX_CFG_NAME]; } __packed; +/* AX210's HW type */ +#define IWL_AX210_HW_TYPE 0x42 +/* How many bits to roll when adding to the HW type of AX210 HW */ +#define IWL_AX210_HW_TYPE_ADDITION_SHIFT 12 +/* This prph is used to tell apart HW_TYPE == 0x42 NICs */ +#define WFPM_OTP_CFG1_ADDR 0xd03098 +#define WFPM_OTP_CFG1_IS_JACKET_BIT BIT(4) +#define WFPM_OTP_CFG1_IS_CDB_BIT BIT(5) + /* struct iwl_fw_ini_dump_info - ini dump information * @version: dump version * @time_point: time point that caused the dump collection -- 2.26.2