summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorVikram Kanigiri <vikram.kanigiri@arm.com>2014-04-15 18:08:08 +0100
committerVikram Kanigiri <vikram.kanigiri@arm.com>2014-05-22 16:14:19 +0100
commit4112bfa0c223eda73af1cfe57ca7dc926f767dd8 (patch)
tree652b5cb01c095a39c771209caac10b6332a62929 /common
parent29fb905d5f36a415a170a4bffeadf13b5f084345 (diff)
Populate BL31 input parameters as per new spec
This patch is based on spec published at https://github.com/ARM-software/tf-issues/issues/133 It rearranges the bl31_args struct into bl31_params and bl31_plat_params which provide the information needed for Trusted firmware and platform specific data via x0 and x1 On the FVP platform BL3-1 params and BL3-1 plat params and its constituents are stored at the start of TZDRAM. The information about memory availability and size for BL3-1, BL3-2 and BL3-3 is moved into platform specific data. Change-Id: I8b32057a3d0dd3968ea26c2541a0714177820da9
Diffstat (limited to 'common')
-rw-r--r--common/bl_common.c53
1 files changed, 32 insertions, 21 deletions
diff --git a/common/bl_common.c b/common/bl_common.c
index 4144ae50..a2fa2d6b 100644
--- a/common/bl_common.c
+++ b/common/bl_common.c
@@ -35,6 +35,7 @@
#include <debug.h>
#include <io_storage.h>
#include <platform.h>
+#include <errno.h>
#include <stdio.h>
unsigned long page_align(unsigned long value, unsigned dir)
@@ -229,12 +230,15 @@ unsigned long image_size(const char *image_name)
* Generic function to load an image into the trusted RAM,
* given a name, extents of free memory & whether the image should be loaded at
* the bottom or top of the free memory. It updates the memory layout if the
- * load is successful.
+ * load is successful. It also updates the image information and the entry point
+ * information in the params passed
******************************************************************************/
-unsigned long load_image(meminfo_t *mem_layout,
+int load_image(meminfo_t *mem_layout,
const char *image_name,
unsigned int load_type,
- unsigned long fixed_addr)
+ unsigned long fixed_addr,
+ image_info_t *image_data,
+ entry_point_info_t *entry_point_info)
{
uintptr_t dev_handle;
uintptr_t image_handle;
@@ -248,13 +252,14 @@ unsigned long load_image(meminfo_t *mem_layout,
assert(mem_layout != NULL);
assert(image_name != NULL);
+ assert(image_data->h.version >= VERSION_1);
/* Obtain a reference to the image by querying the platform layer */
io_result = plat_get_image_source(image_name, &dev_handle, &image_spec);
if (io_result != IO_SUCCESS) {
WARN("Failed to obtain reference to image '%s' (%i)\n",
image_name, io_result);
- return 0;
+ return io_result;
}
/* Attempt to access the image */
@@ -262,7 +267,7 @@ unsigned long load_image(meminfo_t *mem_layout,
if (io_result != IO_SUCCESS) {
WARN("Failed to access image '%s' (%i)\n",
image_name, io_result);
- return 0;
+ return io_result;
}
/* Find the size of the image */
@@ -270,7 +275,7 @@ unsigned long load_image(meminfo_t *mem_layout,
if ((io_result != IO_SUCCESS) || (image_size == 0)) {
WARN("Failed to determine the size of the image '%s' file (%i)\n",
image_name, io_result);
- goto fail;
+ goto exit;
}
/* See if we have enough space */
@@ -278,7 +283,7 @@ unsigned long load_image(meminfo_t *mem_layout,
WARN("Cannot load '%s' file: Not enough space.\n",
image_name);
dump_load_info(0, image_size, mem_layout);
- goto fail;
+ goto exit;
}
switch (load_type) {
@@ -297,7 +302,8 @@ unsigned long load_image(meminfo_t *mem_layout,
WARN("Cannot load '%s' file: Not enough space.\n",
image_name);
dump_load_info(image_base, image_size, mem_layout);
- goto fail;
+ io_result = -ENOMEM;
+ goto exit;
}
/* Calculate the amount of extra memory used due to alignment */
@@ -315,10 +321,11 @@ unsigned long load_image(meminfo_t *mem_layout,
/* Page align base address and check whether the image still fits */
if (image_base + image_size >
mem_layout->free_base + mem_layout->free_size) {
- WARN("Cannot load '%s' file: Not enough space.\n",
- image_name);
- dump_load_info(image_base, image_size, mem_layout);
- goto fail;
+ WARN("Cannot load '%s' file: Not enough space.\n",
+ image_name);
+ dump_load_info(image_base, image_size, mem_layout);
+ io_result = -ENOMEM;
+ goto exit;
}
/* Calculate the amount of extra memory used due to alignment */
@@ -383,14 +390,16 @@ unsigned long load_image(meminfo_t *mem_layout,
WARN("Cannot load '%s' file: Not enough space.\n",
image_name);
dump_load_info(image_base, image_size, mem_layout);
- goto fail;
+ io_result = -ENOMEM;
+ goto exit;
}
/* Check whether the fixed load address is page-aligned. */
if (!is_page_aligned(image_base)) {
WARN("Cannot load '%s' file at unaligned address 0x%lx\n",
image_name, fixed_addr);
- goto fail;
+ io_result = -ENOMEM;
+ goto exit;
}
/*
@@ -440,9 +449,14 @@ unsigned long load_image(meminfo_t *mem_layout,
io_result = io_read(image_handle, image_base, image_size, &bytes_read);
if ((io_result != IO_SUCCESS) || (bytes_read < image_size)) {
WARN("Failed to load '%s' file (%i)\n", image_name, io_result);
- goto fail;
+ goto exit;
}
+ image_data->image_base = image_base;
+ image_data->image_size = image_size;
+
+ entry_point_info->pc = image_base;
+
/*
* File has been successfully loaded. Update the free memory
* data structure & flush the contents of the TZRAM so that
@@ -458,15 +472,12 @@ unsigned long load_image(meminfo_t *mem_layout,
mem_layout->free_base += offset + image_size;
exit:
- io_result = io_close(image_handle);
+ io_close(image_handle);
/* Ignore improbable/unrecoverable error in 'close' */
/* TODO: Consider maintaining open device connection from this bootloader stage */
- io_result = io_dev_close(dev_handle);
+ io_dev_close(dev_handle);
/* Ignore improbable/unrecoverable error in 'dev_close' */
- return image_base;
-
-fail: image_base = 0;
- goto exit;
+ return io_result;
}
'/cgit/linux-arm.git/plain/crypto/async_tx?h=wl18xx'>plain -rw-r--r--authenc.c12922logplain -rw-r--r--authencesn.c13937logplain -rw-r--r--blake2b_generic.c6010logplain -rw-r--r--blowfish_common.c15913logplain -rw-r--r--blowfish_generic.c3137logplain -rw-r--r--camellia_generic.c34821logplain -rw-r--r--cast5_generic.c20867logplain -rw-r--r--cast6_generic.c9316logplain -rw-r--r--cast_common.c13223logplain -rw-r--r--cbc.c4269logplain -rw-r--r--ccm.c23704logplain -rw-r--r--chacha20poly1305.c17729logplain -rw-r--r--chacha_generic.c3964logplain -rw-r--r--cipher.c3319logplain -rw-r--r--cmac.c7379logplain -rw-r--r--compress.c921logplain -rw-r--r--compress.h724logplain -rw-r--r--crc32_generic.c2901logplain -rw-r--r--crc32c_generic.c4196logplain -rw-r--r--crc64_rocksoft_generic.c1904logplain -rw-r--r--crct10dif_common.c3728logplain -rw-r--r--crct10dif_generic.c3205logplain -rw-r--r--cryptd.c29886logplain -rw-r--r--crypto_engine.c19812logplain -rw-r--r--crypto_null.c5476logplain -rw-r--r--crypto_user_base.c12268logplain -rw-r--r--crypto_user_stat.c4060logplain -rw-r--r--ctr.c9715logplain -rw-r--r--cts.c11627logplain -rw-r--r--curve25519-generic.c2247logplain -rw-r--r--deflate.c7193logplain -rw-r--r--des_generic.c3356logplain -rw-r--r--dh.c29785logplain -rw-r--r--dh_helper.c3265logplain -rw-r--r--drbg.c61221logplain -rw-r--r--ecb.c6159logplain -rw-r--r--ecc.c43097logplain -rw-r--r--ecc_curve_defs.h3803logplain -rw-r--r--ecdh.c5863logplain -rw-r--r--ecdh_helper.c2016logplain -rw-r--r--ecdsa.c9401logplain -rw-r--r--ecdsasignature.asn1111logplain -rw-r--r--echainiv.c4177logplain -rw-r--r--ecrdsa.c8572logplain -rw-r--r--ecrdsa_defs.h7411logplain -rw-r--r--ecrdsa_params.asn1142logplain -rw-r--r--ecrdsa_pub_key.asn157logplain -rw-r--r--essiv.c18160logplain -rw-r--r--fcrypt.c18415logplain -rw-r--r--fips.c2108logplain -rw-r--r--gcm.c30366logplain -rw-r--r--geniv.c3901logplain -rw-r--r--ghash-generic.c4930logplain -rw-r--r--hash.h1189logplain -rw-r--r--hash_info.c2198logplain -rw-r--r--hctr2.c17010logplain -rw-r--r--hmac.c6778logplain -rw-r--r--internal.h5796logplain -rw-r--r--jitterentropy-kcapi.c11223logplain -rw-r--r--jitterentropy-testing.c7120logplain -rw-r--r--jitterentropy.c26746logplain -rw-r--r--jitterentropy.h1373logplain -rw-r--r--kdf_sp800108.c3748logplain -rw-r--r--keywrap.c9763logplain -rw-r--r--khazad.c53062logplain -rw-r--r--kpp.c4348logplain -rw-r--r--lrw.c10734logplain -rw-r--r--lskcipher.c18041logplain -rw-r--r--lz4.c3378logplain -rw-r--r--lz4hc.c3513logplain -rw-r--r--lzo-rle.c3526logplain -rw-r--r--lzo.c3385logplain -rw-r--r--md4.c6049logplain -rw-r--r--md5.c7559logplain -rw-r--r--michael_mic.c3450logplain -rw-r--r--nhpoly1305.c7952logplain -rw-r--r--pcbc.c4831logplain -rw-r--r--pcrypt.c9447logplain -rw-r--r--poly1305_generic.c3754logplain -rw-r--r--polyval-generic.c6793logplain -rw-r--r--proc.c2710logplain -rw-r--r--ripemd.h655logplain -rw-r--r--rmd160.c12721logplain -rw-r--r--rng.c5669logplain -rw-r--r--rsa-pkcs1pad.c18032logplain -rw-r--r--rsa.c7567logplain -rw-r--r--rsa_helper.c4126logplain -rw-r--r--rsaprivkey.asn1507logplain -rw-r--r--rsapubkey.asn1273logplain -rw-r--r--scatterwalk.c2065logplain -rw-r--r--scompress.c6986logplain -rw-r--r--seed.c17612logplain -rw-r--r--seqiv.c4637logplain -rw-r--r--serpent_generic.c20079logplain -rw-r--r--sha1_generic.c2393logplain -rw-r--r--sha256_generic.c3212logplain -rw-r--r--sha3_generic.c8226logplain -rw-r--r--sha512_generic.c7923logplain -rw-r--r--shash.c11726logplain