Commit 72f41243 authored by Kalle Valo's avatar Kalle Valo
Browse files

Revert "ath11k: add read variant from SMBIOS for download board data"



This reverts commit 46e46db3. Mark reported
that it breaks QCA6390 hw2.0 on Dell XPS 13 9310:

[    5.537034] ath11k_pci 0000:72:00.0: chip_id 0x0 chip_family 0xb board_id 0xff soc_id 0xffffffff
[    5.537038] ath11k_pci 0000:72:00.0: fw_version 0x101c06cc fw_build_timestamp 2020-06-24 19:50 fw_build_id
[    5.537236] ath11k_pci 0000:72:00.0: failed to fetch board data for bus=pci,qmi-chip-id=0,qmi-board-id=255,variant=DE_1901 from ath11k/QCA6390/hw2.0/board-2.bin
[    5.537255] ath11k_pci 0000:72:00.0: failed to fetch board-2.bin or board.bin from QCA6390/hw2.0
[    5.537257] ath11k_pci 0000:72:00.0: qmi failed to fetch board file: -2
[    5.537258] ath11k_pci 0000:72:00.0: failed to load board data file: -2

So we need to back to the drawing board and implement it so that backwards
compatiblity is not broken.

Reported-by: default avatarMark Herbert <mark.herbert42@gmail.com>
Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20211124094316.9096-1-kvalo@codeaurora.org
parent 09f16f73
Loading
Loading
Loading
Loading
+0 −79
Original line number Diff line number Diff line
@@ -8,9 +8,6 @@
#include <linux/remoteproc.h>
#include <linux/firmware.h>
#include <linux/of.h>
#include <linux/dmi.h>
#include <linux/ctype.h>

#include "core.h"
#include "dp_tx.h"
#include "dp_rx.h"
@@ -387,82 +384,6 @@ int ath11k_core_resume(struct ath11k_base *ab)
}
EXPORT_SYMBOL(ath11k_core_resume);

static void ath11k_core_check_bdfext(const struct dmi_header *hdr, void *data)
{
	struct ath11k_base *ab = data;
	const char *bdf_ext;
	const char *magic = ATH11K_SMBIOS_BDF_EXT_MAGIC;
	u8 bdf_enabled;
	int i;
	size_t len;

	if (ab->qmi.target.bdf_ext[0] != '\0')
		return;

	if (hdr->type != ATH11K_SMBIOS_BDF_EXT_TYPE)
		return;

	if (hdr->length != ATH11K_SMBIOS_BDF_EXT_LENGTH) {
		ath11k_dbg(ab, ATH11K_DBG_BOOT,
			   "wrong smbios bdf ext type length (%d).\n",
			   hdr->length);
		return;
	}

	bdf_enabled = *((u8 *)hdr + ATH11K_SMBIOS_BDF_EXT_OFFSET);
	if (!bdf_enabled) {
		ath11k_dbg(ab, ATH11K_DBG_BOOT, "bdf variant name not found.\n");
		return;
	}

	/* Only one string exists (per spec) */
	bdf_ext = (char *)hdr + hdr->length;

	if (memcmp(bdf_ext, magic, strlen(magic)) != 0) {
		ath11k_dbg(ab, ATH11K_DBG_BOOT,
			   "bdf variant magic does not match.\n");
		return;
	}

	len = strlen(bdf_ext);
	for (i = 0; i < len; i++) {
		if (!isascii(bdf_ext[i]) || !isprint(bdf_ext[i])) {
			ath11k_dbg(ab, ATH11K_DBG_BOOT,
				   "bdf variant name contains non ascii chars.\n");
			return;
		}
	}

	/* Copy extension name without magic prefix */
	if (strscpy(ab->qmi.target.bdf_ext, bdf_ext + strlen(magic),
		    sizeof(ab->qmi.target.bdf_ext)) < 0) {
		ath11k_dbg(ab, ATH11K_DBG_BOOT,
			   "bdf variant string is longer than the buffer can accommodate (variant: %s)\n",
			    bdf_ext);
		return;
	}

	ath11k_dbg(ab, ATH11K_DBG_BOOT,
		   "found and validated bdf variant smbios_type 0x%x bdf %s\n",
		   ATH11K_SMBIOS_BDF_EXT_TYPE, bdf_ext);
}

int ath11k_core_check_smbios(struct ath11k_base *ab)
{
	int ret;

	ab->qmi.target.bdf_ext[0] = '\0';

	ret = dmi_walk(ath11k_core_check_bdfext, ab);
	if (ret)
		return ret;

	if (ab->qmi.target.bdf_ext[0] == '\0')
		return -ENODATA;

	return 0;
}

int ath11k_core_check_dt(struct ath11k_base *ab)
{
	size_t max_len = sizeof(ab->qmi.target.bdf_ext);
+0 −13
Original line number Diff line number Diff line
@@ -938,18 +938,6 @@ struct ath11k_fw_stats_bcn {
	u32 tx_bcn_outage_cnt;
};

/* SMBIOS type containing Board Data File Name Extension */
#define ATH11K_SMBIOS_BDF_EXT_TYPE 0xF8

/* SMBIOS type structure length (excluding strings-set) */
#define ATH11K_SMBIOS_BDF_EXT_LENGTH 0x9

/* Offset pointing to Board Data File Name Extension */
#define ATH11K_SMBIOS_BDF_EXT_OFFSET 0x8

/* The magic used by QCA spec */
#define ATH11K_SMBIOS_BDF_EXT_MAGIC "BDF_"

extern const struct ce_pipe_config ath11k_target_ce_config_wlan_ipq8074[];
extern const struct service_to_pipe ath11k_target_service_to_ce_map_wlan_ipq8074[];
extern const struct service_to_pipe ath11k_target_service_to_ce_map_wlan_ipq6018[];
@@ -971,7 +959,6 @@ int ath11k_core_fetch_bdf(struct ath11k_base *ath11k,
			  struct ath11k_board_data *bd);
void ath11k_core_free_bdf(struct ath11k_base *ab, struct ath11k_board_data *bd);
int ath11k_core_check_dt(struct ath11k_base *ath11k);
int ath11k_core_check_smbios(struct ath11k_base *ab);

void ath11k_core_halt(struct ath11k *ar);
int ath11k_core_resume(struct ath11k_base *ab);
+0 −4
Original line number Diff line number Diff line
@@ -1991,10 +1991,6 @@ static int ath11k_qmi_request_target_cap(struct ath11k_base *ab)
		    ab->qmi.target.fw_build_timestamp,
		    ab->qmi.target.fw_build_id);

	r = ath11k_core_check_smbios(ab);
	if (r)
		ath11k_dbg(ab, ATH11K_DBG_QMI, "SMBIOS bdf variant name not set.\n");

	r = ath11k_core_check_dt(ab);
	if (r)
		ath11k_dbg(ab, ATH11K_DBG_QMI, "DT bdf variant name not set.\n");