| From 029d606b432a02ff3389f0d8a4496d4db82bdf11 Mon Sep 17 00:00:00 2001 |
| From: Sasha Levin <sashal@kernel.org> |
| Date: Wed, 31 Jan 2024 10:24:34 +0200 |
| Subject: wifi: iwlwifi: read BIOS PNVM only for non-Intel SKU |
| |
| From: Miri Korenblit <miriam.rachel.korenblit@intel.com> |
| |
| [ Upstream commit c868a189ecfe8cc0b3173c2eaa7f0b659326c151 ] |
| |
| The driver is supposed to read the PNVM from BIOS only for non-Intel |
| SKUs. For Intel SKUs the OEM ID will be 0. |
| Read BIOS PNVM only when a non-Intel SKU is indicated. |
| |
| Fixes: b99e32cbfdf6 ("wifi: iwlwifi: Take loading and setting of pnvm image out of parsing part") |
| Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com> |
| Reviewed-by: Gregory Greenman <gregory.greenman@intel.com> |
| Link: https://msgid.link/20240131091413.3625cf1223d3.Ieffda5f506713b1c979388dd7a0e1c1a0145cfca@changeid |
| Signed-off-by: Johannes Berg <johannes.berg@intel.com> |
| Signed-off-by: Sasha Levin <sashal@kernel.org> |
| --- |
| drivers/net/wireless/intel/iwlwifi/fw/pnvm.c | 30 ++++++++++++-------- |
| 1 file changed, 18 insertions(+), 12 deletions(-) |
| |
| diff --git a/drivers/net/wireless/intel/iwlwifi/fw/pnvm.c b/drivers/net/wireless/intel/iwlwifi/fw/pnvm.c |
| index 650e4bde9c17b..56ee0ceed78ab 100644 |
| --- a/drivers/net/wireless/intel/iwlwifi/fw/pnvm.c |
| +++ b/drivers/net/wireless/intel/iwlwifi/fw/pnvm.c |
| @@ -255,21 +255,27 @@ static u8 *iwl_get_pnvm_image(struct iwl_trans *trans_p, size_t *len) |
| struct pnvm_sku_package *package; |
| u8 *image = NULL; |
| |
| - /* First attempt to get the PNVM from BIOS */ |
| - package = iwl_uefi_get_pnvm(trans_p, len); |
| - if (!IS_ERR_OR_NULL(package)) { |
| - if (*len >= sizeof(*package)) { |
| - /* we need only the data */ |
| - *len -= sizeof(*package); |
| - image = kmemdup(package->data, *len, GFP_KERNEL); |
| + /* Get PNVM from BIOS for non-Intel SKU */ |
| + if (trans_p->sku_id[2]) { |
| + package = iwl_uefi_get_pnvm(trans_p, len); |
| + if (!IS_ERR_OR_NULL(package)) { |
| + if (*len >= sizeof(*package)) { |
| + /* we need only the data */ |
| + *len -= sizeof(*package); |
| + image = kmemdup(package->data, |
| + *len, GFP_KERNEL); |
| + } |
| + /* |
| + * free package regardless of whether kmemdup |
| + * succeeded |
| + */ |
| + kfree(package); |
| + if (image) |
| + return image; |
| } |
| - /* free package regardless of whether kmemdup succeeded */ |
| - kfree(package); |
| - if (image) |
| - return image; |
| } |
| |
| - /* If it's not available, try from the filesystem */ |
| + /* If it's not available, or for Intel SKU, try from the filesystem */ |
| if (iwl_pnvm_get_from_fs(trans_p, &image, len)) |
| return NULL; |
| return image; |
| -- |
| 2.43.0 |
| |