aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/io/io_fip.c
diff options
context:
space:
mode:
authorJuan Castillo <juan.castillo@arm.com>2015-11-02 10:47:01 +0000
committerJuan Castillo <juan.castillo@arm.com>2015-11-02 10:47:01 +0000
commite098e244a25017d8298d63a8bf04e9151b52ac3a (patch)
tree9b6618d8dcdb604e8206b3104b60c71766a629f5 /drivers/io/io_fip.c
parentf57e2db6ef4b86a6af57891a2d7a90266ad6c033 (diff)
downloadplatform_external_arm-trusted-firmware-e098e244a25017d8298d63a8bf04e9151b52ac3a.tar.gz
platform_external_arm-trusted-firmware-e098e244a25017d8298d63a8bf04e9151b52ac3a.tar.bz2
platform_external_arm-trusted-firmware-e098e244a25017d8298d63a8bf04e9151b52ac3a.zip
Remove deprecated IO return definitions
Patch 7e26fe1f deprecates IO specific return definitions in favour of standard errno codes. This patch removes those definitions and its usage from the IO framework, IO drivers and IO platform layer. Following this patch, standard errno codes must be used when checking the return value of an IO function. Change-Id: Id6e0e9d0a7daf15a81ec598cf74de83d5768650f
Diffstat (limited to 'drivers/io/io_fip.c')
-rw-r--r--drivers/io/io_fip.c56
1 files changed, 28 insertions, 28 deletions
diff --git a/drivers/io/io_fip.c b/drivers/io/io_fip.c
index 5a8a294a0..d29142380 100644
--- a/drivers/io/io_fip.c
+++ b/drivers/io/io_fip.c
@@ -134,14 +134,14 @@ static int fip_dev_open(const uintptr_t dev_spec __attribute__((unused)),
assert(dev_info != NULL);
*dev_info = (io_dev_info_t *)&fip_dev_info; /* cast away const */
- return IO_SUCCESS;
+ return 0;
}
/* Do some basic package checks. */
static int fip_dev_init(io_dev_info_t *dev_info, const uintptr_t init_params)
{
- int result = IO_FAIL;
+ int result;
unsigned int image_id = (unsigned int)init_params;
uintptr_t backend_handle;
fip_toc_header_t header;
@@ -150,28 +150,28 @@ static int fip_dev_init(io_dev_info_t *dev_info, const uintptr_t init_params)
/* Obtain a reference to the image by querying the platform layer */
result = plat_get_image_source(image_id, &backend_dev_handle,
&backend_image_spec);
- if (result != IO_SUCCESS) {
+ if (result != 0) {
WARN("Failed to obtain reference to image id=%u (%i)\n",
image_id, result);
- result = IO_FAIL;
+ result = -ENOENT;
goto fip_dev_init_exit;
}
/* Attempt to access the FIP image */
result = io_open(backend_dev_handle, backend_image_spec,
&backend_handle);
- if (result != IO_SUCCESS) {
+ if (result != 0) {
WARN("Failed to access image id=%u (%i)\n", image_id, result);
- result = IO_FAIL;
+ result = -ENOENT;
goto fip_dev_init_exit;
}
result = io_read(backend_handle, (uintptr_t)&header, sizeof(header),
&bytes_read);
- if (result == IO_SUCCESS) {
+ if (result == 0) {
if (!is_valid_header(&header)) {
WARN("Firmware Image Package header check failed.\n");
- result = IO_FAIL;
+ result = -ENOENT;
} else {
VERBOSE("FIP header looks OK.\n");
}
@@ -192,7 +192,7 @@ static int fip_dev_close(io_dev_info_t *dev_info)
backend_dev_handle = (uintptr_t)NULL;
backend_image_spec = (uintptr_t)NULL;
- return IO_SUCCESS;
+ return 0;
}
@@ -200,7 +200,7 @@ static int fip_dev_close(io_dev_info_t *dev_info)
static int fip_file_open(io_dev_info_t *dev_info, const uintptr_t spec,
io_entity_t *entity)
{
- int result = IO_FAIL;
+ int result;
uintptr_t backend_handle;
const io_uuid_spec_t *uuid_spec = (io_uuid_spec_t *)spec;
size_t bytes_read;
@@ -217,23 +217,23 @@ static int fip_file_open(io_dev_info_t *dev_info, const uintptr_t spec,
*/
if (current_file.entry.offset_address != 0) {
WARN("fip_file_open : Only one open file at a time.\n");
- return IO_RESOURCES_EXHAUSTED;
+ return -ENOMEM;
}
/* Attempt to access the FIP image */
result = io_open(backend_dev_handle, backend_image_spec,
&backend_handle);
- if (result != IO_SUCCESS) {
+ if (result != 0) {
WARN("Failed to open Firmware Image Package (%i)\n", result);
- result = IO_FAIL;
+ result = -ENOENT;
goto fip_file_open_exit;
}
/* Seek past the FIP header into the Table of Contents */
result = io_seek(backend_handle, IO_SEEK_SET, sizeof(fip_toc_header_t));
- if (result != IO_SUCCESS) {
+ if (result != 0) {
WARN("fip_file_open: failed to seek\n");
- result = IO_FAIL;
+ result = -ENOENT;
goto fip_file_open_close;
}
@@ -243,7 +243,7 @@ static int fip_file_open(io_dev_info_t *dev_info, const uintptr_t spec,
(uintptr_t)&current_file.entry,
sizeof(current_file.entry),
&bytes_read);
- if (result == IO_SUCCESS) {
+ if (result == 0) {
if (compare_uuids(&current_file.entry.uuid,
&uuid_spec->uuid) == 0) {
found_file = 1;
@@ -265,7 +265,7 @@ static int fip_file_open(io_dev_info_t *dev_info, const uintptr_t spec,
} else {
/* Did not find the file in the FIP. */
current_file.entry.offset_address = 0;
- result = IO_FAIL;
+ result = -ENOENT;
}
fip_file_open_close:
@@ -284,7 +284,7 @@ static int fip_file_len(io_entity_t *entity, size_t *length)
*length = ((file_state_t *)entity->info)->entry.size;
- return IO_SUCCESS;
+ return 0;
}
@@ -292,7 +292,7 @@ static int fip_file_len(io_entity_t *entity, size_t *length)
static int fip_file_read(io_entity_t *entity, uintptr_t buffer, size_t length,
size_t *length_read)
{
- int result = IO_FAIL;
+ int result;
file_state_t *fp;
size_t file_offset;
size_t bytes_read;
@@ -306,9 +306,9 @@ static int fip_file_read(io_entity_t *entity, uintptr_t buffer, size_t length,
/* Open the backend, attempt to access the blob image */
result = io_open(backend_dev_handle, backend_image_spec,
&backend_handle);
- if (result != IO_SUCCESS) {
+ if (result != 0) {
WARN("Failed to open FIP (%i)\n", result);
- result = IO_FAIL;
+ result = -ENOENT;
goto fip_file_read_exit;
}
@@ -317,17 +317,17 @@ static int fip_file_read(io_entity_t *entity, uintptr_t buffer, size_t length,
/* Seek to the position in the FIP where the payload lives */
file_offset = fp->entry.offset_address + fp->file_pos;
result = io_seek(backend_handle, IO_SEEK_SET, file_offset);
- if (result != IO_SUCCESS) {
+ if (result != 0) {
WARN("fip_file_read: failed to seek\n");
- result = IO_FAIL;
+ result = -ENOENT;
goto fip_file_read_close;
}
result = io_read(backend_handle, buffer, length, &bytes_read);
- if (result != IO_SUCCESS) {
+ if (result != 0) {
/* We cannot read our data. Fail. */
WARN("Failed to read payload (%i)\n", result);
- result = IO_FAIL;
+ result = -ENOENT;
goto fip_file_read_close;
} else {
/* Set caller length and new file position. */
@@ -357,7 +357,7 @@ static int fip_file_close(io_entity_t *entity)
/* Clear the Entity info. */
entity->info = 0;
- return IO_SUCCESS;
+ return 0;
}
/* Exported functions */
@@ -365,11 +365,11 @@ static int fip_file_close(io_entity_t *entity)
/* Register the Firmware Image Package driver with the IO abstraction */
int register_io_dev_fip(const io_dev_connector_t **dev_con)
{
- int result = IO_FAIL;
+ int result;
assert(dev_con != NULL);
result = io_register_device(&fip_dev_info);
- if (result == IO_SUCCESS)
+ if (result == 0)
*dev_con = &fip_dev_connector;
return result;