summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorMarek Vasut <marex@denx.de>2018-04-15 13:38:49 +0200
committerMarek Vasut <marex@denx.de>2018-05-08 21:08:42 +0200
commit9f0021a50b5a39a01f2ab3095a952a255660eb3f (patch)
tree037b65a7a05165fcfdd9c016abf5012cf0a4c0c0 /tools
parent662abc4fc5cba70bc261039c4579223de3fca2ed (diff)
tools: socfpga: Stop using global struct socfpga_image
The structure is passed around correctly, create local instances where necessary and zap the global struct socfpga_image instance. Signed-off-by: Marek Vasut <marex@denx.de> Cc: Dinh Nguyen <dinguyen@kernel.org> Cc: Chin Liang See <chin.liang.see@intel.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/socfpgaimage.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/tools/socfpgaimage.c b/tools/socfpgaimage.c
index 7f83b50761f..673c53258d7 100644
--- a/tools/socfpgaimage.c
+++ b/tools/socfpgaimage.c
@@ -45,14 +45,14 @@
static uint8_t buffer[PADDED_SIZE];
-static struct socfpga_header {
+struct socfpga_header {
uint32_t validation;
uint8_t version;
uint8_t flags;
uint16_t length_u32;
uint16_t zero;
uint16_t checksum;
-} header;
+};
/*
* The header checksum is just a very simple checksum over
@@ -75,6 +75,8 @@ static uint16_t hdr_checksum(struct socfpga_header *header)
static void build_header(uint8_t *buf, uint8_t version, uint8_t flags,
uint16_t length_bytes)
{
+ struct socfpga_header header;
+
header.validation = cpu_to_le32(VALIDATION_WORD);
header.version = version;
header.flags = flags;
@@ -91,6 +93,8 @@ static void build_header(uint8_t *buf, uint8_t version, uint8_t flags,
*/
static int verify_header(const uint8_t *buf)
{
+ struct socfpga_header header;
+
memcpy(&header, buf, sizeof(header));
if (le32_to_cpu(header.validation) != VALIDATION_WORD)