summaryrefslogtreecommitdiff
path: root/include/drivers
diff options
context:
space:
mode:
authorDan Handley <dan.handley@arm.com>2014-04-23 13:47:06 +0100
committerDan Handley <dan.handley@arm.com>2014-05-06 17:55:38 +0100
commit625de1d4f04b30383354bee944d0a7ca3dba1e67 (patch)
tree3a9c8494e30f1d7475dbc69edef172a37f036594 /include/drivers
parent408c37682a0233c8c4fa88700b603f0b09d6361f (diff)
Remove variables from .data section
Update code base to remove variables from the .data section, mainly by using const static data where possible and adding the const specifier as required. Most changes are to the IO subsystem, including the framework APIs. The FVP power management code is also affected. Delay initialization of the global static variable, next_image_type in bl31_main.c, until it is realy needed. Doing this moves the variable from the .data to the .bss section. Also review the IO interface for inconsistencies, using uintptr_t where possible instead of void *. Remove the io_handle and io_dev_handle typedefs, which were unnecessary, replacing instances with uintptr_t. Fixes ARM-software/tf-issues#107. Change-Id: I085a62197c82410b566e4698e5590063563ed304
Diffstat (limited to 'include/drivers')
-rw-r--r--include/drivers/io_driver.h18
-rw-r--r--include/drivers/io_fip.h2
-rw-r--r--include/drivers/io_memmap.h2
-rw-r--r--include/drivers/io_semihosting.h2
4 files changed, 12 insertions, 12 deletions
diff --git a/include/drivers/io_driver.h b/include/drivers/io_driver.h
index cc01d3b2..f34c71d5 100644
--- a/include/drivers/io_driver.h
+++ b/include/drivers/io_driver.h
@@ -39,7 +39,7 @@
/* Generic IO entity structure,representing an accessible IO construct on the
* device, such as a file */
typedef struct io_entity {
- io_dev_handle dev_handle;
+ struct io_dev_info *dev_handle;
uintptr_t info;
} io_entity_t;
@@ -47,7 +47,7 @@ typedef struct io_entity {
/* Device info structure, providing device-specific functions and a means of
* adding driver-specific state */
typedef struct io_dev_info {
- struct io_dev_funcs *funcs;
+ const struct io_dev_funcs *funcs;
uintptr_t info;
} io_dev_info_t;
@@ -55,23 +55,23 @@ typedef struct io_dev_info {
/* Structure used to create a connection to a type of device */
typedef struct io_dev_connector {
/* dev_open opens a connection to a particular device driver */
- int (*dev_open)(void *spec, io_dev_info_t **dev_info);
+ int (*dev_open)(const uintptr_t dev_spec, io_dev_info_t **dev_info);
} io_dev_connector_t;
/* Structure to hold device driver function pointers */
typedef struct io_dev_funcs {
io_type_t (*type)(void);
- int (*open)(io_dev_info_t *dev_info, const void *spec,
+ int (*open)(io_dev_info_t *dev_info, const uintptr_t spec,
io_entity_t *entity);
int (*seek)(io_entity_t *entity, int mode, ssize_t offset);
int (*size)(io_entity_t *entity, size_t *length);
- int (*read)(io_entity_t *entity, void *buffer, size_t length,
+ int (*read)(io_entity_t *entity, uintptr_t buffer, size_t length,
size_t *length_read);
- int (*write)(io_entity_t *entity, const void *buffer,
+ int (*write)(io_entity_t *entity, const uintptr_t buffer,
size_t length, size_t *length_written);
int (*close)(io_entity_t *entity);
- int (*dev_init)(io_dev_info_t *dev_info, const void *init_params);
+ int (*dev_init)(io_dev_info_t *dev_info, const uintptr_t init_params);
int (*dev_close)(io_dev_info_t *dev_info);
} io_dev_funcs_t;
@@ -79,7 +79,7 @@ typedef struct io_dev_funcs {
/* IO platform data - used to track devices registered for a specific
* platform */
typedef struct io_plat_data {
- io_dev_info_t *devices[MAX_IO_DEVICES];
+ const io_dev_info_t *devices[MAX_IO_DEVICES];
unsigned int dev_count;
} io_plat_data_t;
@@ -90,6 +90,6 @@ typedef struct io_plat_data {
void io_init(io_plat_data_t *data);
/* Register a device driver */
-int io_register_device(io_dev_info_t *dev_info);
+int io_register_device(const io_dev_info_t *dev_info);
#endif /* __IO_DRIVER_H__ */
diff --git a/include/drivers/io_fip.h b/include/drivers/io_fip.h
index 212570d8..90b2fd0b 100644
--- a/include/drivers/io_fip.h
+++ b/include/drivers/io_fip.h
@@ -33,6 +33,6 @@
struct io_dev_connector;
-int register_io_dev_fip(struct io_dev_connector **dev_con);
+int register_io_dev_fip(const struct io_dev_connector **dev_con);
#endif /* __IO_FIP_H__ */
diff --git a/include/drivers/io_memmap.h b/include/drivers/io_memmap.h
index 0e59ecbd..7ee60fe3 100644
--- a/include/drivers/io_memmap.h
+++ b/include/drivers/io_memmap.h
@@ -33,6 +33,6 @@
struct io_dev_connector;
-int register_io_dev_memmap(struct io_dev_connector **dev_con);
+int register_io_dev_memmap(const struct io_dev_connector **dev_con);
#endif /* __IO_MEMMAP_H__ */
diff --git a/include/drivers/io_semihosting.h b/include/drivers/io_semihosting.h
index eab290a7..8902a6f0 100644
--- a/include/drivers/io_semihosting.h
+++ b/include/drivers/io_semihosting.h
@@ -33,6 +33,6 @@
struct io_dev_connector;
-int register_io_dev_sh(struct io_dev_connector **dev_con);
+int register_io_dev_sh(const struct io_dev_connector **dev_con);
#endif /* __IO_SH_H__ */