iwlwifi: mvm: read and parse SKU ID if available
authorLuca Coelho <luciano.coelho@intel.com>
Thu, 8 Oct 2020 15:09:38 +0000 (18:09 +0300)
committerKalle Valo <kvalo@codeaurora.org>
Thu, 8 Oct 2020 17:09:26 +0000 (20:09 +0300)
In v5 of the ALIVE notification, we may receive the SKU ID of the
device in use.  Read and store it locally for future access.  This
will be needed to find the correct PNVM (platform NVM) to pass to the
firmware.

Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/iwlwifi.20201008180656.798744ad514e.Ibb0d88586a34acc904bf319974d791faafb7a905@changeid
drivers/net/wireless/intel/iwlwifi/iwl-trans.h
drivers/net/wireless/intel/iwlwifi/mvm/fw.c

index 45a9df0d42ed4dd4f1158939228c3aeaa9c80d2f..caae7b5aa9e629dc3a61919d0ef80bf9fe78316c 100644 (file)
@@ -995,6 +995,7 @@ struct iwl_trans {
        u32 hw_rf_id;
        u32 hw_id;
        char hw_id_str[52];
+       u32 sku_id[3];
 
        u8 rx_mpdu_cmd, rx_mpdu_cmd_hdr_size;
 
index 1c966586c8a8767a1f5e084962e00a33172ba74a..fda86c5820494bdf1f475274091b8edee3c8c925 100644 (file)
@@ -216,10 +216,29 @@ static bool iwl_alive_fn(struct iwl_notif_wait_data *notif_wait,
        u16 status;
        u32 lmac_error_event_table, umac_error_table;
 
-       /* we don't use the SKU ID from v5 yet, so handle it as v4 */
+       /*
+        * For v5 and above, we can check the version, for older
+        * versions we need to check the size.
+        */
        if (iwl_fw_lookup_notif_ver(mvm->fw, LEGACY_GROUP,
-                                   UCODE_ALIVE_NTFY, 0) == 5 ||
-           iwl_rx_packet_payload_len(pkt) == sizeof(struct iwl_alive_ntf_v4)) {
+                                   UCODE_ALIVE_NTFY, 0) == 5) {
+               struct iwl_alive_ntf_v5 *palive;
+
+               palive = (void *)pkt->data;
+               umac = &palive->umac_data;
+               lmac1 = &palive->lmac_data[0];
+               lmac2 = &palive->lmac_data[1];
+               status = le16_to_cpu(palive->status);
+
+               mvm->trans->sku_id[0] = le32_to_cpu(palive->sku_id.data[0]);
+               mvm->trans->sku_id[1] = le32_to_cpu(palive->sku_id.data[1]);
+               mvm->trans->sku_id[2] = le32_to_cpu(palive->sku_id.data[2]);
+
+               IWL_DEBUG_FW(mvm, "Got sku_id: 0x0%x 0x0%x 0x0%x\n",
+                            mvm->trans->sku_id[0],
+                            mvm->trans->sku_id[1],
+                            mvm->trans->sku_id[2]);
+       } else if (iwl_rx_packet_payload_len(pkt) == sizeof(struct iwl_alive_ntf_v4)) {
                struct iwl_alive_ntf_v4 *palive;
 
                palive = (void *)pkt->data;