summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorYatharth Kochar <yatharth.kochar@arm.com>2015-08-17 17:57:31 +0100
committerYatharth Kochar <yatharth.kochar@arm.com>2015-12-08 18:06:49 +0000
commit40389968d8d3cfabb7b5067fbc625d63b8e7dae5 (patch)
tree9ea7d21545b8fd92a7b607eece061382278f7225 /drivers
parentdeac644b60e69d842067661c05e3e223f94d4dae (diff)
FWU: Add support for FIP Image framework in TFTF.
This patch modifies the FIP framework code taken from ATF code and adapt it for TFTF for the usage of FWU images. Following are the major changes: * image_loader.c : Provides definitions for load_image(), load_partial_image(), image_size(), image_offset() functions. * fwu_nvm_accessors.c: Provides definitions for fwu_nvm_read(), fwu_nvm_write() and fwu_fip_update() functions. * firmware_image_package.h : Contains UUID's for all the supported FWU images. Change-Id: Ib619ae89ce2a109621f98d53b360bd2991575e24
Diffstat (limited to 'drivers')
-rw-r--r--drivers/io/io_fip.c26
1 files changed, 6 insertions, 20 deletions
diff --git a/drivers/io/io_fip.c b/drivers/io/io_fip.c
index 5a8a294..22e2686 100644
--- a/drivers/io/io_fip.c
+++ b/drivers/io/io_fip.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, ARM Limited and Contributors. All rights reserved.
+ * Copyright (c) 2014-2015, ARM Limited and Contributors. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@@ -29,10 +29,10 @@
*/
#include <assert.h>
-#include <bl_common.h>
#include <debug.h>
#include <errno.h>
#include <firmware_image_package.h>
+#include <image_loader.h>
#include <io_driver.h>
#include <io_fip.h>
#include <io_storage.h>
@@ -41,14 +41,8 @@
#include <stdint.h>
#include <string.h>
#include <uuid.h>
+#include <uuid_utils.h>
-/* Useful for printing UUIDs when debugging.*/
-#define PRINT_UUID2(x) \
- "%08x-%04hx-%04hx-%02hhx%02hhx-%02hhx%02hhx%02hhx%02hhx%02hhx%02hhx", \
- x.time_low, x.time_mid, x.time_hi_and_version, \
- x.clock_seq_hi_and_reserved, x.clock_seq_low, \
- x.node[0], x.node[1], x.node[2], x.node[3], \
- x.node[4], x.node[5]
typedef struct {
/* Put file_pos above the struct to allow {0} on static init.
@@ -59,7 +53,6 @@ typedef struct {
fip_toc_entry_t entry;
} file_state_t;
-static const uuid_t uuid_null = {0};
static file_state_t current_file = {0};
static uintptr_t backend_dev_handle;
static uintptr_t backend_image_spec;
@@ -77,13 +70,6 @@ static int fip_dev_init(io_dev_info_t *dev_info, const uintptr_t init_params);
static int fip_dev_close(io_dev_info_t *dev_info);
-/* Return 0 for equal uuids. */
-static inline int compare_uuids(const uuid_t *uuid1, const uuid_t *uuid2)
-{
- return memcmp(uuid1, uuid2, sizeof(uuid_t));
-}
-
-
/* TODO: We could check version numbers or do a package checksum? */
static inline int is_valid_header(fip_toc_header_t *header)
{
@@ -244,8 +230,8 @@ static int fip_file_open(io_dev_info_t *dev_info, const uintptr_t spec,
sizeof(current_file.entry),
&bytes_read);
if (result == IO_SUCCESS) {
- if (compare_uuids(&current_file.entry.uuid,
- &uuid_spec->uuid) == 0) {
+ if (uuid_equal(&current_file.entry.uuid,
+ &uuid_spec->uuid)) {
found_file = 1;
break;
}
@@ -253,7 +239,7 @@ static int fip_file_open(io_dev_info_t *dev_info, const uintptr_t spec,
WARN("Failed to read FIP (%i)\n", result);
goto fip_file_open_close;
}
- } while (compare_uuids(&current_file.entry.uuid, &uuid_null) != 0);
+ } while (!is_uuid_null(&current_file.entry.uuid));
if (found_file == 1) {
/* All fine. Update entity info with file state and return. Set