* [PATCH v3 16/17] lpfc: Fix fw download on SLI-4 FC adapters
@ 2016-10-13 22:06 James Smart
2016-10-14 7:52 ` Johannes Thumshirn
2016-10-14 10:44 ` Hannes Reinecke
0 siblings, 2 replies; 3+ messages in thread
From: James Smart @ 2016-10-13 22:06 UTC (permalink / raw)
To: linux-scsi
Fix fw download on SLI-4 FC adapters
Driver performs a quick validation of magic numbers in the fw
download image. Driver needed to be updated for more recent
magic numbers.
Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: James Smart <james.smart@broadcom.com>
---
v3 mods:
code cleanup: parsing image header fields
drivers/scsi/lpfc/lpfc_hw4.h | 3 ++-
drivers/scsi/lpfc/lpfc_init.c | 20 +++++++++++---------
2 files changed, 13 insertions(+), 10 deletions(-)
diff --git a/drivers/scsi/lpfc/lpfc_hw4.h b/drivers/scsi/lpfc/lpfc_hw4.h
index bbdcb5a..5646699 100644
--- a/drivers/scsi/lpfc/lpfc_hw4.h
+++ b/drivers/scsi/lpfc/lpfc_hw4.h
@@ -3996,7 +3996,8 @@ union lpfc_wqe128 {
struct gen_req64_wqe gen_req;
};
-#define LPFC_GROUP_OJECT_MAGIC_NUM 0xfeaa0001
+#define LPFC_GROUP_OJECT_MAGIC_G5 0xfeaa0001
+#define LPFC_GROUP_OJECT_MAGIC_G6 0xfeaa0003
#define LPFC_FILE_TYPE_GROUP 0xf7
#define LPFC_FILE_ID_GROUP 0xa2
struct lpfc_grp_hdr {
diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c
index 53227e5..7be9b8a 100644
--- a/drivers/scsi/lpfc/lpfc_init.c
+++ b/drivers/scsi/lpfc/lpfc_init.c
@@ -10312,6 +10312,7 @@ lpfc_write_firmware(const struct firmware *fw, void *context)
int i, rc = 0;
struct lpfc_dmabuf *dmabuf, *next;
uint32_t offset = 0, temp_offset = 0;
+ uint32_t magic_number, ftype, fid, fsize;
/* It can be null in no-wait mode, sanity check */
if (!fw) {
@@ -10320,18 +10321,19 @@ lpfc_write_firmware(const struct firmware *fw, void *context)
}
image = (struct lpfc_grp_hdr *)fw->data;
+ magic_number = be32_to_cpu(image->magic_number);
+ ftype = bf_get_be32(lpfc_grp_hdr_file_type, image);
+ fid = bf_get_be32(lpfc_grp_hdr_id, image),
+ fsize = be32_to_cpu(image->size);
+
INIT_LIST_HEAD(&dma_buffer_list);
- if ((be32_to_cpu(image->magic_number) != LPFC_GROUP_OJECT_MAGIC_NUM) ||
- (bf_get_be32(lpfc_grp_hdr_file_type, image) !=
- LPFC_FILE_TYPE_GROUP) ||
- (bf_get_be32(lpfc_grp_hdr_id, image) != LPFC_FILE_ID_GROUP) ||
- (be32_to_cpu(image->size) != fw->size)) {
+ if ((magic_number != LPFC_GROUP_OJECT_MAGIC_G5 &&
+ magic_number != LPFC_GROUP_OJECT_MAGIC_G6) ||
+ ftype != LPFC_FILE_TYPE_GROUP || fsize != fw->size) {
lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
"3022 Invalid FW image found. "
- "Magic:%x Type:%x ID:%x\n",
- be32_to_cpu(image->magic_number),
- bf_get_be32(lpfc_grp_hdr_file_type, image),
- bf_get_be32(lpfc_grp_hdr_id, image));
+ "Magic:%x Type:%x ID:%x Size %d %ld\n",
+ magic_number, ftype, fid, fsize, fw->size);
rc = -EINVAL;
goto release_out;
}
--
2.5.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v3 16/17] lpfc: Fix fw download on SLI-4 FC adapters
2016-10-13 22:06 [PATCH v3 16/17] lpfc: Fix fw download on SLI-4 FC adapters James Smart
@ 2016-10-14 7:52 ` Johannes Thumshirn
2016-10-14 10:44 ` Hannes Reinecke
1 sibling, 0 replies; 3+ messages in thread
From: Johannes Thumshirn @ 2016-10-14 7:52 UTC (permalink / raw)
To: James Smart; +Cc: linux-scsi
On Thu, Oct 13, 2016 at 03:06:17PM -0700, James Smart wrote:
>
> Fix fw download on SLI-4 FC adapters
>
> Driver performs a quick validation of magic numbers in the fw
> download image. Driver needed to be updated for more recent
> magic numbers.
>
> Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
> Signed-off-by: James Smart <james.smart@broadcom.com>
> ---
> v3 mods:
> code cleanup: parsing image header fields
Thanks,
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
--
Johannes Thumshirn Storage
jthumshirn@suse.de +49 911 74053 689
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: Felix Imendörffer, Jane Smithard, Graham Norton
HRB 21284 (AG Nürnberg)
Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v3 16/17] lpfc: Fix fw download on SLI-4 FC adapters
2016-10-13 22:06 [PATCH v3 16/17] lpfc: Fix fw download on SLI-4 FC adapters James Smart
2016-10-14 7:52 ` Johannes Thumshirn
@ 2016-10-14 10:44 ` Hannes Reinecke
1 sibling, 0 replies; 3+ messages in thread
From: Hannes Reinecke @ 2016-10-14 10:44 UTC (permalink / raw)
To: James Smart, linux-scsi
On 10/14/2016 12:06 AM, James Smart wrote:
>
> Fix fw download on SLI-4 FC adapters
>
> Driver performs a quick validation of magic numbers in the fw
> download image. Driver needed to be updated for more recent
> magic numbers.
>
> Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
> Signed-off-by: James Smart <james.smart@broadcom.com>
> ---
> v3 mods:
> code cleanup: parsing image header fields
>
> drivers/scsi/lpfc/lpfc_hw4.h | 3 ++-
> drivers/scsi/lpfc/lpfc_init.c | 20 +++++++++++---------
> 2 files changed, 13 insertions(+), 10 deletions(-)
>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Cheers,
Hannes
--
Dr. Hannes Reinecke Teamlead Storage & Networking
hare@suse.de +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton
HRB 21284 (AG Nürnberg)
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-10-14 11:33 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-10-13 22:06 [PATCH v3 16/17] lpfc: Fix fw download on SLI-4 FC adapters James Smart
2016-10-14 7:52 ` Johannes Thumshirn
2016-10-14 10:44 ` Hannes Reinecke
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.