linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ath11k:  Support loading ELF board files.
@ 2020-08-26 23:20 greearb
  2020-09-16 14:21 ` Kalle Valo
  0 siblings, 1 reply; 2+ messages in thread
From: greearb @ 2020-08-26 23:20 UTC (permalink / raw)
  To: ath11k; +Cc: linux-wireless, Ben Greear

From: Ben Greear <greearb@candelatech.com>

The QCA6390 board I have, model 8291M-PR comes with an ELF board
file.  To get this to at least somewhat work, I renamed bdwlan.e04
to 'board.bin' and then added this patch to check for .ELF as
starting bytes of the board file.  If that is found, use type
ELF.  After this the driver loads.

Signed-off-by: Ben Greear <greearb@candelatech.com>
---

This is on top of recent kvallo ath tree.

 drivers/net/wireless/ath/ath11k/qmi.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath11k/qmi.c b/drivers/net/wireless/ath/ath11k/qmi.c
index 91134510364c..f87f1d1564f4 100644
--- a/drivers/net/wireless/ath/ath11k/qmi.c
+++ b/drivers/net/wireless/ath/ath11k/qmi.c
@@ -1992,6 +1992,7 @@ static int ath11k_qmi_load_bdf_qmi(struct ath11k_base *ab)
 	struct qmi_txn txn = {};
 	int ret;
 	const u8 *temp;
+	int bdf_type = ATH11K_QMI_BDF_TYPE_BIN;
 
 	req = kzalloc(sizeof(*req), GFP_KERNEL);
 	if (!req)
@@ -2008,6 +2009,15 @@ static int ath11k_qmi_load_bdf_qmi(struct ath11k_base *ab)
 	temp = bd.data;
 	remaining = bd.len;
 
+	if (bd.len >= 4) {
+		char* edata = (char*)(temp);
+		if (edata[1] == 'E' &&
+		    edata[2] == 'L' &&
+		    edata[3] == 'F') {
+			bdf_type = ATH11K_QMI_BDF_TYPE_ELF;
+		}
+	}
+
 	while (remaining) {
 		req->valid = 1;
 		req->file_id_valid = 1;
@@ -2017,7 +2027,7 @@ static int ath11k_qmi_load_bdf_qmi(struct ath11k_base *ab)
 		req->seg_id_valid = 1;
 		req->data_valid = 1;
 		req->data_len = ATH11K_QMI_MAX_BDF_FILE_NAME_SIZE;
-		req->bdf_type = ATH11K_QMI_BDF_TYPE_BIN;
+		req->bdf_type = bdf_type;
 		req->bdf_type_valid = 1;
 		req->end_valid = 1;
 		req->end = 0;
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] ath11k:  Support loading ELF board files.
  2020-08-26 23:20 [PATCH] ath11k: Support loading ELF board files greearb
@ 2020-09-16 14:21 ` Kalle Valo
  0 siblings, 0 replies; 2+ messages in thread
From: Kalle Valo @ 2020-09-16 14:21 UTC (permalink / raw)
  To: greearb; +Cc: ath11k, linux-wireless

greearb@candelatech.com writes:

> From: Ben Greear <greearb@candelatech.com>
>
> The QCA6390 board I have, model 8291M-PR comes with an ELF board
> file.  To get this to at least somewhat work, I renamed bdwlan.e04
> to 'board.bin' and then added this patch to check for .ELF as
> starting bytes of the board file.  If that is found, use type
> ELF.  After this the driver loads.
>
> Signed-off-by: Ben Greear <greearb@candelatech.com>
> ---
>
> This is on top of recent kvallo ath tree.
>
>  drivers/net/wireless/ath/ath11k/qmi.c | 12 +++++++++++-
>  1 file changed, 11 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/wireless/ath/ath11k/qmi.c b/drivers/net/wireless/ath/ath11k/qmi.c
> index 91134510364c..f87f1d1564f4 100644
> --- a/drivers/net/wireless/ath/ath11k/qmi.c
> +++ b/drivers/net/wireless/ath/ath11k/qmi.c
> @@ -1992,6 +1992,7 @@ static int ath11k_qmi_load_bdf_qmi(struct ath11k_base *ab)
>  	struct qmi_txn txn = {};
>  	int ret;
>  	const u8 *temp;
> +	int bdf_type = ATH11K_QMI_BDF_TYPE_BIN;
>  
>  	req = kzalloc(sizeof(*req), GFP_KERNEL);
>  	if (!req)
> @@ -2008,6 +2009,15 @@ static int ath11k_qmi_load_bdf_qmi(struct ath11k_base *ab)
>  	temp = bd.data;
>  	remaining = bd.len;
>  
> +	if (bd.len >= 4) {
> +		char* edata = (char*)(temp);
> +		if (edata[1] == 'E' &&
> +		    edata[2] == 'L' &&
> +		    edata[3] == 'F') {
> +			bdf_type = ATH11K_QMI_BDF_TYPE_ELF;
> +		}
> +	}

Thanks, looks good. Expect that the ELF magic check can be simplified to:

strncmp(edata, ELFMAG, SELFMAG)

But I can send v2, I'll soon send some more QCA6390 patches and I'll
include this to the set.

-- 
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-09-16 18:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-26 23:20 [PATCH] ath11k: Support loading ELF board files greearb
2020-09-16 14:21 ` Kalle Valo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).