Skip to contentSkip to conversation

bnx2x: Separated FW from the source.

PATCH In review Eilon Greenstein 1 participant 1 message Apr 22, 2009

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 2/4 bnx2x: Separated FW from the source.

Quoted 1 line

From now on FW will be downloaded from the binary file using request_firmware.

There will be different files for every supported chip. Currently 57710 (e1) and 57711 (e1h).

File names have the following format: bnx2x-<chip version>-<FW version>.fw. ihex versions of current FW files are submitted in the next patch.

Each binary file has a header in the following format:

struct bnx2x_fw_file_section {
	__be32 len;
	__be32 offset;
}
struct bnx2x_fw_file_hdr {
	struct bnx2x_fw_file_section init_ops;
	struct bnx2x_fw_file_section init_ops_offsets;
	struct bnx2x_fw_file_section init_data;
	struct bnx2x_fw_file_section tsem_int_table_data;
	struct bnx2x_fw_file_section tsem_pram_data;
	struct bnx2x_fw_file_section usem_int_table_data;
	struct bnx2x_fw_file_section usem_pram_data;
	struct bnx2x_fw_file_section csem_int_table_data;
	struct bnx2x_fw_file_section csem_pram_data;
	struct bnx2x_fw_file_section xsem_int_table_data;
	struct bnx2x_fw_file_section xsem_pram_data;
	struct bnx2x_fw_file_section fw_version;
}

Each bnx2x_fw_file_section contains the length and the offset of the appropriate section in the binary file. Values are stored in the big endian format.

Data types of arrays:

init_data __be32
init_ops_offsets __be16
XXsem_pram_data u8
XXsem_int_table_data u8

init_ops             struct raw_op {
                          u8   op;
			__be24 offset;
                        __be32 data;
		     }

fw_version u8

Quoted 1 line

From now boundaries of a specific initialization stage are stored in

init_ops_offsets array instead of being defined by separate macroes. The index in init_ops_offsets is calculated by BLOCK_OPS_IDX macro:

#define BLOCK_OPS_IDX(block, stage, end) \
       (2*(((block)*STAGE_IDX_MAX) + (stage)) + (end))

Security:

In addition to sanity check of array boundaries bnx2x will check a FW version. Additional checks might be added in the future.

---
 drivers/net/Kconfig             |    1 +
 drivers/net/bnx2x.h             |   15 +
 drivers/net/bnx2x_fw_file_hdr.h |   37 +++
 drivers/net/bnx2x_init.h        |  605 +++++----------------------------------
 drivers/net/bnx2x_init_ops.h    |  442 ++++++++++++++++++++++++++++
 drivers/net/bnx2x_main.c        |  345 ++++++++++++++++++----
 firmware/Makefile               |    1 +
 firmware/WHENCE                 |   20 ++
 8 files changed, 867 insertions(+), 599 deletions(-)
 create mode 100644 drivers/net/bnx2x_fw_file_hdr.h
 create mode 100644 drivers/net/bnx2x_init_ops.h
drivers/net/Kconfig +1 -0
index 214a92d..6265b71 100644
@@ -2668,6 +2668,7 @@ config TEHUTI
 config BNX2X
 	tristate "Broadcom NetXtremeII 10Gb support"
 	depends on PCI
+	select FW_LOADER
 	select ZLIB_INFLATE
 	select LIBCRC32C
 	help
drivers/net/bnx2x.h +15 -0
index a329bee..c44e5b8 100644
@@ -965,6 +965,21 @@ struct bnx2x {
 	int			gunzip_outlen;
 #define FW_BUF_SIZE			0x8000
 
+	struct raw_op          *init_ops;
+	/* Init blocks offsets inside init_ops */
+	u16                    *init_ops_offsets;
+	/* Data blob - has 32 bit granularity */
+	u32                    *init_data; 
+	/* Zipped PRAM blobs - raw data */
+	const u8               *tsem_int_table_data;
+	const u8               *tsem_pram_data;
+	const u8               *usem_int_table_data;
+	const u8               *usem_pram_data;
+	const u8               *xsem_int_table_data;
+	const u8               *xsem_pram_data;
+	const u8               *csem_int_table_data;
+	const u8               *csem_pram_data;
+        const struct firmware  *firmware;
 };
 
 
drivers/net/bnx2x_fw_file_hdr.h new file +37 -0
new file mode 100644
index 0000000..3f5ee5d
@@ -0,0 +1,37 @@
+/* bnx2x_fw_file_hdr.h: FW binary file header structure.
+ *
+ * Copyright (c) 2007-2009 Broadcom Corporation
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation.
+ *
+ * Maintained by: Eilon Greenstein <[email protected]>
+ * Written by: Vladislav Zolotarov <[email protected]>
+ * Based on the original idea of John Wright <[email protected]>.
+ */
+
+#ifndef BNX2X_INIT_FILE_HDR_H
+#define BNX2X_INIT_FILE_HDR_H
+
+struct bnx2x_fw_file_section {
+	__be32 len;
+	__be32 offset;
+};
+
+struct bnx2x_fw_file_hdr {
+	struct bnx2x_fw_file_section init_ops;
+	struct bnx2x_fw_file_section init_ops_offsets;
+	struct bnx2x_fw_file_section init_data;
+	struct bnx2x_fw_file_section tsem_int_table_data;
+	struct bnx2x_fw_file_section tsem_pram_data;
+	struct bnx2x_fw_file_section usem_int_table_data;
+	struct bnx2x_fw_file_section usem_pram_data;
+	struct bnx2x_fw_file_section csem_int_table_data;
+	struct bnx2x_fw_file_section csem_pram_data;
+	struct bnx2x_fw_file_section xsem_int_table_data;
+	struct bnx2x_fw_file_section xsem_pram_data;
+	struct bnx2x_fw_file_section fw_version;
+};
+
+#endif /* BNX2X_INIT_FILE_HDR_H */
drivers/net/bnx2x_init.h +69 -536

643 lines not on this page · raw message

drivers/net/bnx2x_init_ops.h new file +442 -0

442 lines not on this page · raw message

drivers/net/bnx2x_main.c +282 -63

594 lines not on this page · raw message

firmware/Makefile +1 -0
index 142c17a..e7fb402 100644
@@ -32,6 +32,7 @@ fw-shipped-$(CONFIG_ADAPTEC_STARFIRE) += adaptec/starfire_rx.bin \
 					 adaptec/starfire_tx.bin
 fw-shipped-$(CONFIG_ATARI_DSP56K) += dsp56k/bootstrap.bin
 fw-shipped-$(CONFIG_ATM_AMBASSADOR) += atmsar11.fw
+fw-shipped-$(CONFIG_BNX2X) += bnx2x-e1-4.8.53.0.fw bnx2x-e1h-4.8.53.0.fw
 fw-shipped-$(CONFIG_BNX2) += bnx2/bnx2-mips-09-4.6.17.fw \
 			     bnx2/bnx2-rv2p-09-4.6.15.fw \
 			     bnx2/bnx2-mips-06-4.6.16.fw \
firmware/WHENCE +20 -0
index 10f61c9..7f99da8 100644
@@ -608,6 +608,26 @@ Found in hex form in kernel source.
 
 --------------------------------------------------------------------------
 
+Driver: bnx2x: Broadcom Everest
+
+File: bnx2x-e1-4.8.53.0.fw.ihex
+File: bnx2x-e1h-4.8.53.0.fw.ihex
+
+License:
+  Copyright (c) 2007-2009 Broadcom Corporation
+ 
+  This file contains firmware data derived from proprietary unpublished
+  source code, Copyright (c) 2007-2009 Broadcom Corporation.
+ 
+  Permission is hereby granted for the distribution of this firmware data
+  in hexadecimal or equivalent format, provided this copyright notice is
+  accompanying it.
+ 
+
+Found in hex form in kernel source.
+
+--------------------------------------------------------------------------
+
 Driver: BNX2 - Broadcom NetXtremeII
 
 File: bnx2/bnx2-mips-06-4.6.16.fw
Signature · 1 line
1.6.1.3