diff options
| author | Kalle Valo <kvalo@qca.qualcomm.com> | 2017-02-21 14:47:06 -0500 |
|---|---|---|
| committer | David S. Miller <davem@davemloft.net> | 2017-02-21 15:59:45 -0500 |
| commit | 005c3490e9db23738d91e02788606c0fe4734723 (patch) | |
| tree | 501aa1ddf9ecfc22082f4648407e9f0602d74808 | |
| parent | e623a9e9dec29ae811d11f83d0074ba254aba374 (diff) | |
Revert "ath10k: Search SMBIOS for OEM board file extension"
This reverts commit f2593cb1b29185d38db706cbcbe22ed538720ae1.
Paul reported that this patch with older board-2.bin ath10k initialisation
fails on Dell XPS 13:
ath10k_pci 0000:3a:00.0: failed to fetch board data for bus=pci,vendor=168c,
device=003e,subsystem-vendor=1a56,subsystem-device=1535,variant=RV_0520 from
ath10k/QCA6174/hw3.0/board-2.bin
The reason is that the older board-2.bin does not have the variant version of
the image name and ath10k does not fallback to the older naming scheme.
Reported-by: Paul Menzel <pmenzel@molgen.mpg.de>
Link: https://bugzilla.kernel.org/show_bug.cgi?id=185621#c9
Fixes: f2593cb1b291 ("ath10k: Search SMBIOS for OEM board file extension")
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
| -rw-r--r-- | drivers/net/wireless/ath/ath10k/core.c | 84 | ||||
| -rw-r--r-- | drivers/net/wireless/ath/ath10k/core.h | 19 |
2 files changed, 3 insertions, 100 deletions
diff --git a/drivers/net/wireless/ath/ath10k/core.c b/drivers/net/wireless/ath/ath10k/core.c index 59729aa8cd82..dd902b43f8f7 100644 --- a/drivers/net/wireless/ath/ath10k/core.c +++ b/drivers/net/wireless/ath/ath10k/core.c | |||
| @@ -18,8 +18,6 @@ | |||
| 18 | #include <linux/module.h> | 18 | #include <linux/module.h> |
| 19 | #include <linux/firmware.h> | 19 | #include <linux/firmware.h> |
| 20 | #include <linux/of.h> | 20 | #include <linux/of.h> |
| 21 | #include <linux/dmi.h> | ||
| 22 | #include <linux/ctype.h> | ||
| 23 | #include <asm/byteorder.h> | 21 | #include <asm/byteorder.h> |
| 24 | 22 | ||
| 25 | #include "core.h" | 23 | #include "core.h" |
| @@ -713,72 +711,6 @@ static int ath10k_core_get_board_id_from_otp(struct ath10k *ar) | |||
| 713 | return 0; | 711 | return 0; |
| 714 | } | 712 | } |
| 715 | 713 | ||
| 716 | static void ath10k_core_check_bdfext(const struct dmi_header *hdr, void *data) | ||
| 717 | { | ||
| 718 | struct ath10k *ar = data; | ||
| 719 | const char *bdf_ext; | ||
| 720 | const char *magic = ATH10K_SMBIOS_BDF_EXT_MAGIC; | ||
| 721 | u8 bdf_enabled; | ||
| 722 | int i; | ||
| 723 | |||
| 724 | if (hdr->type != ATH10K_SMBIOS_BDF_EXT_TYPE) | ||
| 725 | return; | ||
| 726 | |||
| 727 | if (hdr->length != ATH10K_SMBIOS_BDF_EXT_LENGTH) { | ||
| 728 | ath10k_dbg(ar, ATH10K_DBG_BOOT, | ||
| 729 | "wrong smbios bdf ext type length (%d).\n", | ||
| 730 | hdr->length); | ||
| 731 | return; | ||
| 732 | } | ||
| 733 | |||
| 734 | bdf_enabled = *((u8 *)hdr + ATH10K_SMBIOS_BDF_EXT_OFFSET); | ||
| 735 | if (!bdf_enabled) { | ||
| 736 | ath10k_dbg(ar, ATH10K_DBG_BOOT, "bdf variant name not found.\n"); | ||
| 737 | return; | ||
| 738 | } | ||
| 739 | |||
| 740 | /* Only one string exists (per spec) */ | ||
| 741 | bdf_ext = (char *)hdr + hdr->length; | ||
| 742 | |||
| 743 | if (memcmp(bdf_ext, magic, strlen(magic)) != 0) { | ||
| 744 | ath10k_dbg(ar, ATH10K_DBG_BOOT, | ||
| 745 | "bdf variant magic does not match.\n"); | ||
| 746 | return; | ||
| 747 | } | ||
| 748 | |||
| 749 | for (i = 0; i < strlen(bdf_ext); i++) { | ||
| 750 | if (!isascii(bdf_ext[i]) || !isprint(bdf_ext[i])) { | ||
| 751 | ath10k_dbg(ar, ATH10K_DBG_BOOT, | ||
| 752 | "bdf variant name contains non ascii chars.\n"); | ||
| 753 | return; | ||
| 754 | } | ||
| 755 | } | ||
| 756 | |||
| 757 | /* Copy extension name without magic suffix */ | ||
| 758 | if (strscpy(ar->id.bdf_ext, bdf_ext + strlen(magic), | ||
| 759 | sizeof(ar->id.bdf_ext)) < 0) { | ||
| 760 | ath10k_dbg(ar, ATH10K_DBG_BOOT, | ||
| 761 | "bdf variant string is longer than the buffer can accommodate (variant: %s)\n", | ||
| 762 | bdf_ext); | ||
| 763 | return; | ||
| 764 | } | ||
| 765 | |||
| 766 | ath10k_dbg(ar, ATH10K_DBG_BOOT, | ||
| 767 | "found and validated bdf variant smbios_type 0x%x bdf %s\n", | ||
| 768 | ATH10K_SMBIOS_BDF_EXT_TYPE, bdf_ext); | ||
| 769 | } | ||
| 770 | |||
| 771 | static int ath10k_core_check_smbios(struct ath10k *ar) | ||
| 772 | { | ||
| 773 | ar->id.bdf_ext[0] = '\0'; | ||
| 774 | dmi_walk(ath10k_core_check_bdfext, ar); | ||
| 775 | |||
| 776 | if (ar->id.bdf_ext[0] == '\0') | ||
| 777 | return -ENODATA; | ||
| 778 | |||
| 779 | return 0; | ||
| 780 | } | ||
| 781 | |||
| 782 | static int ath10k_download_and_run_otp(struct ath10k *ar) | 714 | static int ath10k_download_and_run_otp(struct ath10k *ar) |
| 783 | { | 715 | { |
| 784 | u32 result, address = ar->hw_params.patch_load_addr; | 716 | u32 result, address = ar->hw_params.patch_load_addr; |
| @@ -1125,9 +1057,6 @@ err: | |||
| 1125 | static int ath10k_core_create_board_name(struct ath10k *ar, char *name, | 1057 | static int ath10k_core_create_board_name(struct ath10k *ar, char *name, |
| 1126 | size_t name_len) | 1058 | size_t name_len) |
| 1127 | { | 1059 | { |
| 1128 | /* strlen(',variant=') + strlen(ar->id.bdf_ext) */ | ||
| 1129 | char variant[9 + ATH10K_SMBIOS_BDF_EXT_STR_LENGTH] = { 0 }; | ||
| 1130 | |||
| 1131 | if (ar->id.bmi_ids_valid) { | 1060 | if (ar->id.bmi_ids_valid) { |
| 1132 | scnprintf(name, name_len, | 1061 | scnprintf(name, name_len, |
| 1133 | "bus=%s,bmi-chip-id=%d,bmi-board-id=%d", | 1062 | "bus=%s,bmi-chip-id=%d,bmi-board-id=%d", |
| @@ -1137,15 +1066,12 @@ static int ath10k_core_create_board_name(struct ath10k *ar, char *name, | |||
| 1137 | goto out; | 1066 | goto out; |
| 1138 | } | 1067 | } |
| 1139 | 1068 | ||
| 1140 | if (ar->id.bdf_ext[0] != '\0') | ||
| 1141 | scnprintf(variant, sizeof(variant), ",variant=%s", | ||
| 1142 | ar->id.bdf_ext); | ||
| 1143 | |||
| 1144 | scnprintf(name, name_len, | 1069 | scnprintf(name, name_len, |
| 1145 | "bus=%s,vendor=%04x,device=%04x,subsystem-vendor=%04x,subsystem-device=%04x%s", | 1070 | "bus=%s,vendor=%04x,device=%04x,subsystem-vendor=%04x,subsystem-device=%04x", |
| 1146 | ath10k_bus_str(ar->hif.bus), | 1071 | ath10k_bus_str(ar->hif.bus), |
| 1147 | ar->id.vendor, ar->id.device, | 1072 | ar->id.vendor, ar->id.device, |
| 1148 | ar->id.subsystem_vendor, ar->id.subsystem_device, variant); | 1073 | ar->id.subsystem_vendor, ar->id.subsystem_device); |
| 1074 | |||
| 1149 | out: | 1075 | out: |
| 1150 | ath10k_dbg(ar, ATH10K_DBG_BOOT, "boot using board name '%s'\n", name); | 1076 | ath10k_dbg(ar, ATH10K_DBG_BOOT, "boot using board name '%s'\n", name); |
| 1151 | 1077 | ||
| @@ -2202,10 +2128,6 @@ static int ath10k_core_probe_fw(struct ath10k *ar) | |||
| 2202 | goto err_free_firmware_files; | 2128 | goto err_free_firmware_files; |
| 2203 | } | 2129 | } |
| 2204 | 2130 | ||
| 2205 | ret = ath10k_core_check_smbios(ar); | ||
| 2206 | if (ret) | ||
| 2207 | ath10k_dbg(ar, ATH10K_DBG_BOOT, "bdf variant name not set.\n"); | ||
| 2208 | |||
| 2209 | ret = ath10k_core_fetch_board_file(ar); | 2131 | ret = ath10k_core_fetch_board_file(ar); |
| 2210 | if (ret) { | 2132 | if (ret) { |
| 2211 | ath10k_err(ar, "failed to fetch board file: %d\n", ret); | 2133 | ath10k_err(ar, "failed to fetch board file: %d\n", ret); |
diff --git a/drivers/net/wireless/ath/ath10k/core.h b/drivers/net/wireless/ath/ath10k/core.h index 88d14be7fcce..757242ef52ac 100644 --- a/drivers/net/wireless/ath/ath10k/core.h +++ b/drivers/net/wireless/ath/ath10k/core.h | |||
| @@ -69,23 +69,6 @@ | |||
| 69 | #define ATH10K_NAPI_BUDGET 64 | 69 | #define ATH10K_NAPI_BUDGET 64 |
| 70 | #define ATH10K_NAPI_QUOTA_LIMIT 60 | 70 | #define ATH10K_NAPI_QUOTA_LIMIT 60 |
| 71 | 71 | ||
| 72 | /* SMBIOS type containing Board Data File Name Extension */ | ||
| 73 | #define ATH10K_SMBIOS_BDF_EXT_TYPE 0xF8 | ||
| 74 | |||
| 75 | /* SMBIOS type structure length (excluding strings-set) */ | ||
| 76 | #define ATH10K_SMBIOS_BDF_EXT_LENGTH 0x9 | ||
| 77 | |||
| 78 | /* Offset pointing to Board Data File Name Extension */ | ||
| 79 | #define ATH10K_SMBIOS_BDF_EXT_OFFSET 0x8 | ||
| 80 | |||
| 81 | /* Board Data File Name Extension string length. | ||
| 82 | * String format: BDF_<Customer ID>_<Extension>\0 | ||
| 83 | */ | ||
| 84 | #define ATH10K_SMBIOS_BDF_EXT_STR_LENGTH 0x20 | ||
| 85 | |||
| 86 | /* The magic used by QCA spec */ | ||
| 87 | #define ATH10K_SMBIOS_BDF_EXT_MAGIC "BDF_" | ||
| 88 | |||
| 89 | struct ath10k; | 72 | struct ath10k; |
| 90 | 73 | ||
| 91 | enum ath10k_bus { | 74 | enum ath10k_bus { |
| @@ -815,8 +798,6 @@ struct ath10k { | |||
| 815 | bool bmi_ids_valid; | 798 | bool bmi_ids_valid; |
| 816 | u8 bmi_board_id; | 799 | u8 bmi_board_id; |
| 817 | u8 bmi_chip_id; | 800 | u8 bmi_chip_id; |
| 818 | |||
| 819 | char bdf_ext[ATH10K_SMBIOS_BDF_EXT_STR_LENGTH]; | ||
| 820 | } id; | 801 | } id; |
| 821 | 802 | ||
| 822 | int fw_api; | 803 | int fw_api; |
