summaryrefslogtreecommitdiff
path: root/include/drivers
diff options
context:
space:
mode:
authorDan Handley <dan.handley@arm.com>2014-04-10 15:37:22 +0100
committerDan Handley <dan.handley@arm.com>2014-05-06 13:57:48 +0100
commitfb037bfb7cbf7b404c069b4ebac5a10059d948b1 (patch)
tree7039b044f48574085b3d3c6a2e7c20d41a87da20 /include/drivers
parentc5945735a9705675201d2799654348425f28f551 (diff)
Always use named structs in header files
Add tag names to all unnamed structs in header files. This allows forward declaration of structs, which is necessary to reduce header file nesting (to be implemented in a subsequent commit). Also change the typedef names across the codebase to use the _t suffix to be more conformant with the Linux coding style. The coding style actually prefers us not to use typedefs at all but this is considered a step too far for Trusted Firmware. Also change the IO framework structs defintions to use typedef'd structs to be consistent with the rest of the codebase. Change-Id: I722b2c86fc0d92e4da3b15e5cab20373dd26786f
Diffstat (limited to 'include/drivers')
-rw-r--r--include/drivers/arm/tzc400.h25
-rw-r--r--include/drivers/io_driver.h48
2 files changed, 36 insertions, 37 deletions
diff --git a/include/drivers/arm/tzc400.h b/include/drivers/arm/tzc400.h
index 7eaafd2e..7ac82ae6 100644
--- a/include/drivers/arm/tzc400.h
+++ b/include/drivers/arm/tzc400.h
@@ -165,23 +165,23 @@
* TZC_ACTION_ERR_INT - Raise interrupt, raise exception -> sync
* external data abort
*/
-enum tzc_action {
+typedef enum {
TZC_ACTION_NONE = 0,
TZC_ACTION_ERR = 1,
TZC_ACTION_INT = 2,
TZC_ACTION_ERR_INT = (TZC_ACTION_ERR | TZC_ACTION_INT)
-};
+} tzc_action_t;
/*
* Controls secure access to a region. If not enabled secure access is not
* allowed to region.
*/
-enum tzc_region_attributes {
+typedef enum {
TZC_REGION_S_NONE = 0,
TZC_REGION_S_RD = 1,
TZC_REGION_S_WR = 2,
TZC_REGION_S_RDWR = (TZC_REGION_S_RD | TZC_REGION_S_WR)
-};
+} tzc_region_attributes_t;
/*
* Implementation defined values used to validate inputs later.
@@ -189,22 +189,21 @@ enum tzc_region_attributes {
* Regions : max of 9 ; 0 to 8
* Address width : Values between 32 to 64
*/
-struct tzc_instance {
+typedef struct tzc_instance {
uint64_t base;
uint32_t aid_width;
uint8_t addr_width;
uint8_t num_filters;
uint8_t num_regions;
-};
+} tzc_instance_t ;
-void tzc_init(struct tzc_instance *controller);
-void tzc_configure_region(const struct tzc_instance *controller, uint32_t filters,
+void tzc_init(tzc_instance_t *controller);
+void tzc_configure_region(const tzc_instance_t *controller, uint32_t filters,
uint8_t region, uint64_t region_base, uint64_t region_top,
- enum tzc_region_attributes sec_attr, uint32_t ns_device_access);
-void tzc_enable_filters(const struct tzc_instance *controller);
-void tzc_disable_filters(const struct tzc_instance *controller);
-void tzc_set_action(const struct tzc_instance *controller,
- enum tzc_action action);
+ tzc_region_attributes_t sec_attr, uint32_t ns_device_access);
+void tzc_enable_filters(const tzc_instance_t *controller);
+void tzc_disable_filters(const tzc_instance_t *controller);
+void tzc_set_action(const tzc_instance_t *controller, tzc_action_t action);
#endif /*__ASSEMBLY__*/
diff --git a/include/drivers/io_driver.h b/include/drivers/io_driver.h
index 5e3d1327..cade5e70 100644
--- a/include/drivers/io_driver.h
+++ b/include/drivers/io_driver.h
@@ -36,58 +36,58 @@
/* Generic IO entity structure,representing an accessible IO construct on the
* device, such as a file */
-struct io_entity {
+typedef struct io_entity {
io_dev_handle dev_handle;
uintptr_t info;
-};
+} io_entity_t;
/* Device info structure, providing device-specific functions and a means of
* adding driver-specific state */
-struct io_dev_info {
+typedef struct io_dev_info {
struct io_dev_funcs *funcs;
uintptr_t info;
-};
+} io_dev_info_t;
/* Structure used to create a connection to a type of device */
-struct io_dev_connector {
+typedef struct io_dev_connector {
/* dev_open opens a connection to a particular device driver */
- int (*dev_open)(void *spec, struct io_dev_info **dev_info);
-};
+ int (*dev_open)(void *spec, io_dev_info_t **dev_info);
+} io_dev_connector_t;
/* Structure to hold device driver function pointers */
-struct io_dev_funcs {
- io_type (*type)(void);
- int (*open)(struct io_dev_info *dev_info, const void *spec,
- struct io_entity *entity);
- int (*seek)(struct io_entity *entity, int mode, ssize_t offset);
- int (*size)(struct io_entity *entity, size_t *length);
- int (*read)(struct io_entity *entity, void *buffer, size_t length,
+typedef struct io_dev_funcs {
+ io_type_t (*type)(void);
+ int (*open)(io_dev_info_t *dev_info, const void *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,
size_t *length_read);
- int (*write)(struct io_entity *entity, const void *buffer,
+ int (*write)(io_entity_t *entity, const void *buffer,
size_t length, size_t *length_written);
- int (*close)(struct io_entity *entity);
- int (*dev_init)(struct io_dev_info *dev_info, const void *init_params);
- int (*dev_close)(struct io_dev_info *dev_info);
-};
+ int (*close)(io_entity_t *entity);
+ int (*dev_init)(io_dev_info_t *dev_info, const void *init_params);
+ int (*dev_close)(io_dev_info_t *dev_info);
+} io_dev_funcs_t;
/* IO platform data - used to track devices registered for a specific
* platform */
-struct io_plat_data {
- struct io_dev_info *devices[MAX_IO_DEVICES];
+typedef struct io_plat_data {
+ io_dev_info_t *devices[MAX_IO_DEVICES];
unsigned int dev_count;
-};
+} io_plat_data_t;
/* Operations intended to be performed during platform initialisation */
/* Initialise the IO layer */
-void io_init(struct io_plat_data *data);
+void io_init(io_plat_data_t *data);
/* Register a device driver */
-int io_register_device(struct io_dev_info *dev_info);
+int io_register_device(io_dev_info_t *dev_info);
#endif /* __IO_DRIVER_H__ */