aboutsummaryrefslogtreecommitdiff
path: root/plat
diff options
context:
space:
mode:
authordanh-arm <dan.handley@arm.com>2014-05-06 17:57:34 +0100
committerdanh-arm <dan.handley@arm.com>2014-05-06 17:57:34 +0100
commite404d7f44a190b82332bb96daffa0c6239732218 (patch)
tree3a9c8494e30f1d7475dbc69edef172a37f036594 /plat
parent408c37682a0233c8c4fa88700b603f0b09d6361f (diff)
parent625de1d4f04b30383354bee944d0a7ca3dba1e67 (diff)
downloadarm-trusted-firmware-e404d7f44a190b82332bb96daffa0c6239732218.tar.gz
Merge pull request #49 from danh-arm/dh/remove-non-const-data
Remove variables from .data section
Diffstat (limited to 'plat')
-rw-r--r--plat/fvp/plat_io_storage.c103
-rw-r--r--plat/fvp/plat_pm.c4
-rw-r--r--plat/fvp/platform.h5
3 files changed, 66 insertions, 46 deletions
diff --git a/plat/fvp/plat_io_storage.c b/plat/fvp/plat_io_storage.c
index 3727d26..aac8a96 100644
--- a/plat/fvp/plat_io_storage.c
+++ b/plat/fvp/plat_io_storage.c
@@ -41,69 +41,91 @@
/* IO devices */
static io_plat_data_t io_data;
-static io_dev_connector_t *sh_dev_con;
-static void *const sh_dev_spec;
-static void *const sh_init_params;
-static io_dev_handle sh_dev_handle;
-static io_dev_connector_t *fip_dev_con;
-static void *const fip_dev_spec;
-static io_dev_handle fip_dev_handle;
-static io_dev_connector_t *memmap_dev_con;
-static void *const memmap_dev_spec;
-static void *const memmap_init_params;
-static io_dev_handle memmap_dev_handle;
-
-static io_block_spec_t fip_block_spec = {
+static const io_dev_connector_t *sh_dev_con;
+static uintptr_t sh_dev_spec;
+static uintptr_t sh_init_params;
+static uintptr_t sh_dev_handle;
+static const io_dev_connector_t *fip_dev_con;
+static uintptr_t fip_dev_spec;
+static uintptr_t fip_dev_handle;
+static const io_dev_connector_t *memmap_dev_con;
+static uintptr_t memmap_dev_spec;
+static uintptr_t memmap_init_params;
+static uintptr_t memmap_dev_handle;
+
+static const io_block_spec_t fip_block_spec = {
.offset = FLASH0_BASE,
.length = FLASH0_SIZE
};
-static io_file_spec_t bl2_file_spec = {
+static const io_file_spec_t bl2_file_spec = {
.path = BL2_IMAGE_NAME,
.mode = FOPEN_MODE_RB
};
-static io_file_spec_t bl31_file_spec = {
+static const io_file_spec_t bl31_file_spec = {
.path = BL31_IMAGE_NAME,
.mode = FOPEN_MODE_RB
};
-static io_file_spec_t bl32_file_spec = {
+static const io_file_spec_t bl32_file_spec = {
.path = BL32_IMAGE_NAME,
.mode = FOPEN_MODE_RB
};
-static io_file_spec_t bl33_file_spec = {
+static const io_file_spec_t bl33_file_spec = {
.path = BL33_IMAGE_NAME,
.mode = FOPEN_MODE_RB
};
-static int open_fip(void *spec);
-static int open_memmap(void *spec);
+static int open_fip(const uintptr_t spec);
+static int open_memmap(const uintptr_t spec);
struct plat_io_policy {
char *image_name;
- io_dev_handle *dev_handle;
- void *image_spec;
- int (*check)(void *spec);
+ uintptr_t *dev_handle;
+ uintptr_t image_spec;
+ int (*check)(const uintptr_t spec);
};
-static struct plat_io_policy policies[] = {
- { FIP_IMAGE_NAME, &memmap_dev_handle, &fip_block_spec, open_memmap },
- { BL2_IMAGE_NAME, &fip_dev_handle, &bl2_file_spec, open_fip },
- { BL31_IMAGE_NAME, &fip_dev_handle, &bl31_file_spec, open_fip },
- { BL32_IMAGE_NAME, &fip_dev_handle, &bl32_file_spec, open_fip },
- { BL33_IMAGE_NAME, &fip_dev_handle, &bl33_file_spec, open_fip },
- {0, 0, 0 }
+static const struct plat_io_policy policies[] = {
+ {
+ FIP_IMAGE_NAME,
+ &memmap_dev_handle,
+ (uintptr_t)&fip_block_spec,
+ open_memmap
+ }, {
+ BL2_IMAGE_NAME,
+ &fip_dev_handle,
+ (uintptr_t)&bl2_file_spec,
+ open_fip
+ }, {
+ BL31_IMAGE_NAME,
+ &fip_dev_handle,
+ (uintptr_t)&bl31_file_spec,
+ open_fip
+ }, {
+ BL32_IMAGE_NAME,
+ &fip_dev_handle,
+ (uintptr_t)&bl32_file_spec,
+ open_fip
+ }, {
+ BL33_IMAGE_NAME,
+ &fip_dev_handle,
+ (uintptr_t)&bl33_file_spec,
+ open_fip
+ }, {
+ 0, 0, 0
+ }
};
-static int open_fip(void *spec)
+static int open_fip(const uintptr_t spec)
{
int result = IO_FAIL;
/* See if a Firmware Image Package is available */
- result = io_dev_init(fip_dev_handle, (void *)FIP_IMAGE_NAME);
+ result = io_dev_init(fip_dev_handle, (uintptr_t)FIP_IMAGE_NAME);
if (result == IO_SUCCESS) {
INFO("Using FIP\n");
/*TODO: Check image defined in spec is present in FIP. */
@@ -112,10 +134,10 @@ static int open_fip(void *spec)
}
-static int open_memmap(void *spec)
+static int open_memmap(const uintptr_t spec)
{
int result = IO_FAIL;
- io_handle local_image_handle;
+ uintptr_t local_image_handle;
result = io_dev_init(memmap_dev_handle, memmap_init_params);
if (result == IO_SUCCESS) {
@@ -129,10 +151,10 @@ static int open_memmap(void *spec)
}
-static int open_semihosting(void *spec)
+static int open_semihosting(const uintptr_t spec)
{
int result = IO_FAIL;
- io_handle local_image_handle;
+ uintptr_t local_image_handle;
/* See if the file exists on semi-hosting.*/
result = io_dev_init(sh_dev_handle, sh_init_params);
@@ -181,11 +203,11 @@ void io_setup (void)
/* Return an IO device handle and specification which can be used to access
* an image. Use this to enforce platform load policy */
-int plat_get_image_source(const char *image_name, io_dev_handle *dev_handle,
- void **image_spec)
+int plat_get_image_source(const char *image_name, uintptr_t *dev_handle,
+ uintptr_t *image_spec)
{
int result = IO_FAIL;
- struct plat_io_policy *policy;
+ const struct plat_io_policy *policy;
if ((image_name != NULL) && (dev_handle != NULL) &&
(image_spec != NULL)) {
@@ -194,8 +216,7 @@ int plat_get_image_source(const char *image_name, io_dev_handle *dev_handle,
if (strcmp(policy->image_name, image_name) == 0) {
result = policy->check(policy->image_spec);
if (result == IO_SUCCESS) {
- *(io_file_spec_t **)image_spec =
- policy->image_spec;
+ *image_spec = policy->image_spec;
*dev_handle = *(policy->dev_handle);
break;
} else {
@@ -203,7 +224,7 @@ int plat_get_image_source(const char *image_name, io_dev_handle *dev_handle,
policy->image_spec);
if (result == IO_SUCCESS) {
*dev_handle = sh_dev_handle;
- *(io_file_spec_t **)image_spec =
+ *image_spec =
policy->image_spec;
}
}
diff --git a/plat/fvp/plat_pm.c b/plat/fvp/plat_pm.c
index c80d315..5430fff 100644
--- a/plat/fvp/plat_pm.c
+++ b/plat/fvp/plat_pm.c
@@ -388,7 +388,7 @@ int fvp_affinst_suspend_finish(unsigned long mpidr,
/*******************************************************************************
* Export the platform handlers to enable psci to invoke them
******************************************************************************/
-static plat_pm_ops_t fvp_plat_pm_ops = {
+static const plat_pm_ops_t fvp_plat_pm_ops = {
fvp_affinst_standby,
fvp_affinst_on,
fvp_affinst_off,
@@ -400,7 +400,7 @@ static plat_pm_ops_t fvp_plat_pm_ops = {
/*******************************************************************************
* Export the platform specific power ops & initialize the fvp power controller
******************************************************************************/
-int platform_setup_pm(plat_pm_ops_t **plat_ops)
+int platform_setup_pm(const plat_pm_ops_t **plat_ops)
{
*plat_ops = &fvp_plat_pm_ops;
return 0;
diff --git a/plat/fvp/platform.h b/plat/fvp/platform.h
index 1ffdc98..1f4e432 100644
--- a/plat/fvp/platform.h
+++ b/plat/fvp/platform.h
@@ -349,7 +349,6 @@ typedef volatile struct mailbox {
******************************************************************************/
struct plat_pm_ops;
struct meminfo;
-struct io_dev_info;
/*******************************************************************************
* Function and variable prototypes
@@ -370,7 +369,7 @@ extern unsigned long warm_boot_entrypoint;
extern void bl1_plat_arch_setup(void);
extern void bl2_plat_arch_setup(void);
extern void bl31_plat_arch_setup(void);
-extern int platform_setup_pm(struct plat_pm_ops **);
+extern int platform_setup_pm(const struct plat_pm_ops **);
extern unsigned int platform_get_core_pos(unsigned long mpidr);
extern void disable_mmu(void);
extern void enable_mmu(void);
@@ -401,7 +400,7 @@ extern unsigned int plat_get_aff_state(unsigned int, unsigned long);
/* Declarations for plat_io_storage.c */
extern void io_setup(void);
extern int plat_get_image_source(const char *image_name,
- struct io_dev_info **dev_handle, void **image_spec);
+ uintptr_t *dev_handle, uintptr_t *image_spec);
/* Declarations for plat_security.c */
extern void plat_security_setup(void);