Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
adam.huang
Arm Trusted Firmware
Commits
e404d7f4
Commit
e404d7f4
authored
May 06, 2014
by
danh-arm
Browse files
Merge pull request #49 from danh-arm/dh/remove-non-const-data
Remove variables from .data section
parents
408c3768
625de1d4
Changes
18
Hide whitespace changes
Inline
Side-by-side
bl31/bl31_main.c
View file @
e404d7f4
...
...
@@ -50,7 +50,7 @@ static int32_t (*bl32_init)(meminfo_t *);
* Variable to indicate whether next image to execute after BL31 is BL33
* (non-secure & default) or BL32 (secure).
******************************************************************************/
static
uint32_t
next_image_type
=
NON_SECURE
;
static
uint32_t
next_image_type
;
/*******************************************************************************
* Simple function to initialise all BL31 helper libraries.
...
...
@@ -100,6 +100,7 @@ void bl31_main(void)
assert
(
cm_get_context
(
mpidr
,
NON_SECURE
));
cm_set_next_eret_context
(
NON_SECURE
);
write_vbar_el3
((
uint64_t
)
runtime_exceptions
);
next_image_type
=
NON_SECURE
;
/*
* All the cold boot actions on the primary cpu are done. We now need to
...
...
common/bl_common.c
View file @
e404d7f4
...
...
@@ -251,9 +251,9 @@ static void dump_load_info(unsigned long image_load_addr,
/* Generic function to return the size of an image */
unsigned
long
image_size
(
const
char
*
image_name
)
{
io_dev_handle
dev_handle
;
io_handle
image_handle
;
void
*
image_spec
;
uintptr_t
dev_handle
;
uintptr_t
image_handle
;
uintptr_t
image_spec
;
size_t
image_size
=
0
;
int
io_result
=
IO_FAIL
;
...
...
@@ -303,9 +303,9 @@ unsigned long load_image(meminfo_t *mem_layout,
unsigned
int
load_type
,
unsigned
long
fixed_addr
)
{
io_dev_handle
dev_handle
;
io_handle
image_handle
;
void
*
image_spec
;
uintptr_t
dev_handle
;
uintptr_t
image_handle
;
uintptr_t
image_spec
;
unsigned
long
temp_image_base
=
0
;
unsigned
long
image_base
=
0
;
long
offset
=
0
;
...
...
@@ -504,7 +504,7 @@ unsigned long load_image(meminfo_t *mem_layout,
/* We have enough space so load the image now */
/* TODO: Consider whether to try to recover/retry a partially successful read */
io_result
=
io_read
(
image_handle
,
(
void
*
)
image_base
,
image_size
,
&
bytes_read
);
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
;
...
...
drivers/io/io_fip.c
View file @
e404d7f4
...
...
@@ -62,7 +62,7 @@ typedef struct {
fip_toc_entry_t
entry
;
}
file_state_t
;
static
plat_fip_name_uuid_t
name_uuid
[]
=
{
static
const
plat_fip_name_uuid_t
name_uuid
[]
=
{
{
BL2_IMAGE_NAME
,
UUID_TRUSTED_BOOT_FIRMWARE_BL2
},
{
BL31_IMAGE_NAME
,
UUID_EL3_RUNTIME_FIRMWARE_BL31
},
{
BL32_IMAGE_NAME
,
UUID_SECURE_PAYLOAD_BL32
},
...
...
@@ -71,19 +71,19 @@ static plat_fip_name_uuid_t name_uuid[] = {
static
const
uuid_t
uuid_null
=
{
0
};
static
file_state_t
current_file
=
{
0
};
static
io_dev_handle
backend_dev_handle
;
static
void
*
backend_image_spec
;
static
uintptr_t
backend_dev_handle
;
static
uintptr_t
backend_image_spec
;
/* Firmware Image Package driver functions */
static
int
fip_dev_open
(
void
*
spec
,
io_dev_info_t
**
dev_info
);
static
int
fip_file_open
(
io_dev_info_t
*
dev_info
,
const
void
*
spec
,
static
int
fip_dev_open
(
const
uintptr_t
dev_
spec
,
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
);
static
int
fip_file_len
(
io_entity_t
*
entity
,
size_t
*
length
);
static
int
fip_file_read
(
io_entity_t
*
entity
,
void
*
buffer
,
size_t
length
,
static
int
fip_file_read
(
io_entity_t
*
entity
,
uintptr_t
buffer
,
size_t
length
,
size_t
*
length_read
);
static
int
fip_file_close
(
io_entity_t
*
entity
);
static
int
fip_dev_init
(
io_dev_info_t
*
dev_info
,
const
void
*
init_params
);
static
int
fip_dev_init
(
io_dev_info_t
*
dev_info
,
const
uintptr_t
init_params
);
static
int
fip_dev_close
(
io_dev_info_t
*
dev_info
);
...
...
@@ -135,12 +135,12 @@ io_type_t device_type_fip(void)
}
static
struc
t
io_dev_connector
fip_dev_connector
=
{
static
cons
t
io_dev_connector
_t
fip_dev_connector
=
{
.
dev_open
=
fip_dev_open
};
static
struc
t
io_dev_funcs
fip_dev_funcs
=
{
static
cons
t
io_dev_funcs
_t
fip_dev_funcs
=
{
.
type
=
device_type_fip
,
.
open
=
fip_file_open
,
.
seek
=
NULL
,
...
...
@@ -153,29 +153,30 @@ static struct io_dev_funcs fip_dev_funcs = {
};
static
struct
io_dev_info
fip_dev_info
=
{
/* No state associated with this device so structure can be const */
static
const
io_dev_info_t
fip_dev_info
=
{
.
funcs
=
&
fip_dev_funcs
,
.
info
=
(
uintptr_t
)
NULL
};
/* Open a connection to the FIP device */
static
int
fip_dev_open
(
void
*
spec
__attribute__
((
unused
)),
static
int
fip_dev_open
(
const
uintptr_t
dev_
spec
__attribute__
((
unused
)),
io_dev_info_t
**
dev_info
)
{
assert
(
dev_info
!=
NULL
);
*
dev_info
=
&
fip_dev_info
;
*
dev_info
=
(
io_dev_info_t
*
)
&
fip_dev_info
;
/* cast away const */
return
IO_SUCCESS
;
}
/* Do some basic package checks. */
static
int
fip_dev_init
(
io_dev_info_t
*
dev_info
,
const
void
*
init_params
)
static
int
fip_dev_init
(
io_dev_info_t
*
dev_info
,
const
uintptr_t
init_params
)
{
int
result
=
IO_FAIL
;
char
*
image_name
=
(
char
*
)
init_params
;
io_handle
backend_handle
;
uintptr_t
backend_handle
;
fip_toc_header_t
header
;
size_t
bytes_read
;
...
...
@@ -198,7 +199,8 @@ static int fip_dev_init(io_dev_info_t *dev_info, const void *init_params)
goto
fip_dev_init_exit
;
}
result
=
io_read
(
backend_handle
,
&
header
,
sizeof
(
header
),
&
bytes_read
);
result
=
io_read
(
backend_handle
,
(
uintptr_t
)
&
header
,
sizeof
(
header
),
&
bytes_read
);
if
(
result
==
IO_SUCCESS
)
{
if
(
!
is_valid_header
(
&
header
))
{
WARN
(
"Firmware Image Package header check failed.
\n
"
);
...
...
@@ -220,19 +222,19 @@ static int fip_dev_close(io_dev_info_t *dev_info)
/* TODO: Consider tracking open files and cleaning them up here */
/* Clear the backend. */
backend_dev_handle
=
NULL
;
backend_image_spec
=
NULL
;
backend_dev_handle
=
(
uintptr_t
)
NULL
;
backend_image_spec
=
(
uintptr_t
)
NULL
;
return
IO_SUCCESS
;
}
/* Open a file for access from package. */
static
int
fip_file_open
(
io_dev_info_t
*
dev_info
,
const
void
*
spec
,
static
int
fip_file_open
(
io_dev_info_t
*
dev_info
,
const
uintptr_t
spec
,
io_entity_t
*
entity
)
{
int
result
=
IO_FAIL
;
io_handle
backend_handle
;
uintptr_t
backend_handle
;
uuid_t
file_uuid
;
const
io_file_spec_t
*
file_spec
=
(
io_file_spec_t
*
)
spec
;
size_t
bytes_read
;
...
...
@@ -273,7 +275,8 @@ static int fip_file_open(io_dev_info_t *dev_info, const void *spec,
found_file
=
0
;
do
{
result
=
io_read
(
backend_handle
,
&
current_file
.
entry
,
result
=
io_read
(
backend_handle
,
(
uintptr_t
)
&
current_file
.
entry
,
sizeof
(
current_file
.
entry
),
&
bytes_read
);
if
(
result
==
IO_SUCCESS
)
{
...
...
@@ -322,19 +325,19 @@ static int fip_file_len(io_entity_t *entity, size_t *length)
/* Read data from a file in package */
static
int
fip_file_read
(
io_entity_t
*
entity
,
void
*
buffer
,
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
;
file_state_t
*
fp
;
size_t
file_offset
;
size_t
bytes_read
;
io_handle
backend_handle
;
uintptr_t
backend_handle
;
assert
(
entity
!=
NULL
);
assert
(
buffer
!=
NULL
);
assert
(
buffer
!=
(
uintptr_t
)
NULL
);
assert
(
length_read
!=
NULL
);
assert
(
(
void
*
)
entity
->
info
!=
NULL
);
assert
(
entity
->
info
!=
(
uintptr_t
)
NULL
);
/* Open the backend, attempt to access the blob image */
result
=
io_open
(
backend_dev_handle
,
backend_image_spec
,
...
...
@@ -396,7 +399,7 @@ static int fip_file_close(io_entity_t *entity)
/* Exported functions */
/* Register the Firmware Image Package driver with the IO abstraction */
int
register_io_dev_fip
(
io_dev_connector_t
**
dev_con
)
int
register_io_dev_fip
(
const
io_dev_connector_t
**
dev_con
)
{
int
result
=
IO_FAIL
;
assert
(
dev_con
!=
NULL
);
...
...
drivers/io/io_memmap.c
View file @
e404d7f4
...
...
@@ -42,9 +42,9 @@ typedef struct {
/* Use the 'in_use' flag as any value for base and file_pos could be
* valid.
*/
int
in_use
;
size
_t
base
;
size_t
file_pos
;
int
in_use
;
uintptr
_t
base
;
size_t
file_pos
;
}
file_state_t
;
static
file_state_t
current_file
=
{
0
};
...
...
@@ -56,25 +56,25 @@ io_type_t device_type_memmap(void)
}
/* Memmap device functions */
static
int
memmap_dev_open
(
void
*
spec
,
io_dev_info_t
**
dev_info
);
static
int
memmap_block_open
(
io_dev_info_t
*
dev_info
,
const
void
*
spec
,
static
int
memmap_dev_open
(
const
uintptr_t
dev_
spec
,
io_dev_info_t
**
dev_info
);
static
int
memmap_block_open
(
io_dev_info_t
*
dev_info
,
const
uintptr_t
spec
,
io_entity_t
*
entity
);
static
int
memmap_block_seek
(
io_entity_t
*
entity
,
int
mode
,
ssize_t
offset
);
static
int
memmap_block_read
(
io_entity_t
*
entity
,
void
*
buffer
,
static
int
memmap_block_read
(
io_entity_t
*
entity
,
uintptr_t
buffer
,
size_t
length
,
size_t
*
length_read
);
static
int
memmap_block_write
(
io_entity_t
*
entity
,
const
void
*
buffer
,
static
int
memmap_block_write
(
io_entity_t
*
entity
,
const
uintptr_t
buffer
,
size_t
length
,
size_t
*
length_written
);
static
int
memmap_block_close
(
io_entity_t
*
entity
);
static
int
memmap_dev_close
(
io_dev_info_t
*
dev_info
);
static
struc
t
io_dev_connector
memmap_dev_connector
=
{
static
cons
t
io_dev_connector
_t
memmap_dev_connector
=
{
.
dev_open
=
memmap_dev_open
};
static
struc
t
io_dev_funcs
memmap_dev_funcs
=
{
static
cons
t
io_dev_funcs
_t
memmap_dev_funcs
=
{
.
type
=
device_type_memmap
,
.
open
=
memmap_block_open
,
.
seek
=
memmap_block_seek
,
...
...
@@ -87,18 +87,19 @@ static struct io_dev_funcs memmap_dev_funcs = {
};
static
struct
io_dev_info
memmap_dev_info
=
{
/* No state associated with this device so structure can be const */
static
const
io_dev_info_t
memmap_dev_info
=
{
.
funcs
=
&
memmap_dev_funcs
,
.
info
=
(
uintptr_t
)
NULL
};
/* Open a connection to the memmap device */
static
int
memmap_dev_open
(
void
*
spec
__attribute__
((
unused
)),
static
int
memmap_dev_open
(
const
uintptr_t
dev_
spec
__attribute__
((
unused
)),
io_dev_info_t
**
dev_info
)
{
assert
(
dev_info
!=
NULL
);
*
dev_info
=
&
memmap_dev_info
;
*
dev_info
=
(
io_dev_info_t
*
)
&
memmap_dev_info
;
/* cast away const */
return
IO_SUCCESS
;
}
...
...
@@ -116,7 +117,7 @@ static int memmap_dev_close(io_dev_info_t *dev_info)
/* Open a file on the memmap device */
/* TODO: Can we do any sensible limit checks on requested memory */
static
int
memmap_block_open
(
io_dev_info_t
*
dev_info
,
const
void
*
spec
,
static
int
memmap_block_open
(
io_dev_info_t
*
dev_info
,
const
uintptr_t
spec
,
io_entity_t
*
entity
)
{
int
result
=
IO_FAIL
;
...
...
@@ -166,18 +167,18 @@ static int memmap_block_seek(io_entity_t *entity, int mode, ssize_t offset)
/* Read data from a file on the memmap device */
static
int
memmap_block_read
(
io_entity_t
*
entity
,
void
*
buffer
,
static
int
memmap_block_read
(
io_entity_t
*
entity
,
uintptr_t
buffer
,
size_t
length
,
size_t
*
length_read
)
{
file_state_t
*
fp
;
assert
(
entity
!=
NULL
);
assert
(
buffer
!=
NULL
);
assert
(
buffer
!=
(
uintptr_t
)
NULL
);
assert
(
length_read
!=
NULL
);
fp
=
(
file_state_t
*
)
entity
->
info
;
memcpy
(
buffer
,
(
void
*
)(
fp
->
base
+
fp
->
file_pos
),
length
);
memcpy
(
(
void
*
)
buffer
,
(
void
*
)(
fp
->
base
+
fp
->
file_pos
),
length
);
*
length_read
=
length
;
/* advance the file 'cursor' for incremental reads */
...
...
@@ -188,18 +189,18 @@ static int memmap_block_read(io_entity_t *entity, void *buffer,
/* Write data to a file on the memmap device */
static
int
memmap_block_write
(
io_entity_t
*
entity
,
const
void
*
buffer
,
static
int
memmap_block_write
(
io_entity_t
*
entity
,
const
uintptr_t
buffer
,
size_t
length
,
size_t
*
length_written
)
{
file_state_t
*
fp
;
assert
(
entity
!=
NULL
);
assert
(
buffer
!=
NULL
);
assert
(
buffer
!=
(
uintptr_t
)
NULL
);
assert
(
length_written
!=
NULL
);
fp
=
(
file_state_t
*
)
entity
->
info
;
memcpy
((
void
*
)(
fp
->
base
+
fp
->
file_pos
),
buffer
,
length
);
memcpy
((
void
*
)(
fp
->
base
+
fp
->
file_pos
),
(
void
*
)
buffer
,
length
);
*
length_written
=
length
;
...
...
@@ -227,7 +228,7 @@ static int memmap_block_close(io_entity_t *entity)
/* Exported functions */
/* Register the memmap driver with the IO abstraction */
int
register_io_dev_memmap
(
io_dev_connector_t
**
dev_con
)
int
register_io_dev_memmap
(
const
io_dev_connector_t
**
dev_con
)
{
int
result
=
IO_FAIL
;
assert
(
dev_con
!=
NULL
);
...
...
drivers/io/io_semihosting.c
View file @
e404d7f4
...
...
@@ -44,23 +44,23 @@ static io_type_t device_type_sh(void)
/* Semi-hosting functions, device info and handle */
static
int
sh_dev_open
(
void
*
spec
,
io_dev_info_t
**
dev_info
);
static
int
sh_file_open
(
io_dev_info_t
*
dev_info
,
const
void
*
spec
,
static
int
sh_dev_open
(
const
uintptr_t
dev_
spec
,
io_dev_info_t
**
dev_info
);
static
int
sh_file_open
(
io_dev_info_t
*
dev_info
,
const
uintptr_t
spec
,
io_entity_t
*
entity
);
static
int
sh_file_seek
(
io_entity_t
*
entity
,
int
mode
,
ssize_t
offset
);
static
int
sh_file_len
(
io_entity_t
*
entity
,
size_t
*
length
);
static
int
sh_file_read
(
io_entity_t
*
entity
,
void
*
buffer
,
size_t
length
,
static
int
sh_file_read
(
io_entity_t
*
entity
,
uintptr_t
buffer
,
size_t
length
,
size_t
*
length_read
);
static
int
sh_file_write
(
io_entity_t
*
entity
,
const
void
*
buffer
,
static
int
sh_file_write
(
io_entity_t
*
entity
,
const
uintptr_t
buffer
,
size_t
length
,
size_t
*
length_written
);
static
int
sh_file_close
(
io_entity_t
*
entity
);
static
struc
t
io_dev_connector
sh_dev_connector
=
{
static
cons
t
io_dev_connector
_t
sh_dev_connector
=
{
.
dev_open
=
sh_dev_open
};
static
struc
t
io_dev_funcs
sh_dev_funcs
=
{
static
cons
t
io_dev_funcs
_t
sh_dev_funcs
=
{
.
type
=
device_type_sh
,
.
open
=
sh_file_open
,
.
seek
=
sh_file_seek
,
...
...
@@ -73,29 +73,31 @@ static struct io_dev_funcs sh_dev_funcs = {
};
static
struct
io_dev_info
sh_dev_info
=
{
/* No state associated with this device so structure can be const */
static
const
io_dev_info_t
sh_dev_info
=
{
.
funcs
=
&
sh_dev_funcs
,
.
info
=
(
uintptr_t
)
NULL
};
/* Open a connection to the semi-hosting device */
static
int
sh_dev_open
(
void
*
spec
__unused
,
io_dev_info_t
**
dev_info
)
static
int
sh_dev_open
(
const
uintptr_t
dev_spec
__unused
,
io_dev_info_t
**
dev_info
)
{
int
result
=
IO_SUCCESS
;
assert
(
dev_info
!=
NULL
);
*
dev_info
=
&
sh_dev_info
;
*
dev_info
=
(
io_dev_info_t
*
)
&
sh_dev_info
;
/* cast away const */
return
result
;
}
/* Open a file on the semi-hosting device */
static
int
sh_file_open
(
io_dev_info_t
*
dev_info
__attribute__
((
unused
)),
const
void
*
spec
,
io_entity_t
*
entity
)
const
uintptr_t
spec
,
io_entity_t
*
entity
)
{
int
result
=
IO_FAIL
;
long
sh_result
=
-
1
;
const
io_file_spec_t
*
file_spec
=
(
io_file_spec_t
*
)
spec
;
const
io_file_spec_t
*
file_spec
=
(
const
io_file_spec_t
*
)
spec
;
assert
(
file_spec
!=
NULL
);
assert
(
entity
!=
NULL
);
...
...
@@ -151,7 +153,7 @@ static int sh_file_len(io_entity_t *entity, size_t *length)
/* Read data from a file on the semi-hosting device */
static
int
sh_file_read
(
io_entity_t
*
entity
,
void
*
buffer
,
size_t
length
,
static
int
sh_file_read
(
io_entity_t
*
entity
,
uintptr_t
buffer
,
size_t
length
,
size_t
*
length_read
)
{
int
result
=
IO_FAIL
;
...
...
@@ -160,7 +162,7 @@ static int sh_file_read(io_entity_t *entity, void *buffer, size_t length,
long
file_handle
;
assert
(
entity
!=
NULL
);
assert
(
buffer
!=
NULL
);
assert
(
buffer
!=
(
uintptr_t
)
NULL
);
assert
(
length_read
!=
NULL
);
file_handle
=
(
long
)
entity
->
info
;
...
...
@@ -178,7 +180,7 @@ static int sh_file_read(io_entity_t *entity, void *buffer, size_t length,
/* Write data to a file on the semi-hosting device */
static
int
sh_file_write
(
io_entity_t
*
entity
,
const
void
*
buffer
,
static
int
sh_file_write
(
io_entity_t
*
entity
,
const
uintptr_t
buffer
,
size_t
length
,
size_t
*
length_written
)
{
int
result
=
IO_FAIL
;
...
...
@@ -187,7 +189,7 @@ static int sh_file_write(io_entity_t *entity, const void *buffer,
size_t
bytes
=
length
;
assert
(
entity
!=
NULL
);
assert
(
buffer
!=
NULL
);
assert
(
buffer
!=
(
uintptr_t
)
NULL
);
assert
(
length_written
!=
NULL
);
file_handle
=
(
long
)
entity
->
info
;
...
...
@@ -226,7 +228,7 @@ static int sh_file_close(io_entity_t *entity)
/* Exported functions */
/* Register the semi-hosting driver with the IO abstraction */
int
register_io_dev_sh
(
io_dev_connector_t
**
dev_con
)
int
register_io_dev_sh
(
const
io_dev_connector_t
**
dev_con
)
{
int
result
=
IO_FAIL
;
assert
(
dev_con
!=
NULL
);
...
...
include/drivers/io_driver.h
View file @
e404d7f4
...
...
@@ -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__ */
include/drivers/io_fip.h
View file @
e404d7f4
...
...
@@ -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__ */
include/drivers/io_memmap.h
View file @
e404d7f4
...
...
@@ -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__ */
include/drivers/io_semihosting.h
View file @
e404d7f4
...
...
@@ -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__ */
include/lib/io_storage.h
View file @
e404d7f4
...
...
@@ -31,6 +31,7 @@
#ifndef __IO_H__
#define __IO_H__
#include <stdint.h>
#include <stdio.h>
/* For ssize_t */
...
...
@@ -58,13 +59,6 @@ typedef enum {
/* Connector type, providing a means of identifying a device to open */
struct
io_dev_connector
;
/* Device handle, providing a client with access to a specific device */
typedef
struct
io_dev_info
*
io_dev_handle
;
/* IO handle, providing a client with access to a specific source of data from
* a device */
typedef
struct
io_entity
*
io_handle
;
/* File specification - used to refer to data on a device supporting file-like
* entities */
...
...
@@ -77,7 +71,7 @@ typedef struct io_file_spec {
/* Block specification - used to refer to data on a device supporting
* block-like entities */
typedef
struct
io_block_spec
{
unsigned
long
offset
;
size_t
offset
;
size_t
length
;
}
io_block_spec_t
;
...
...
@@ -96,33 +90,35 @@ typedef struct io_block_spec {
/* Open a connection to a device */
int
io_dev_open
(
struct
io_dev_connector
*
dev_con
,
void
*
dev_spec
,
io_dev_handle
*
dev_handle
);
int
io_dev_open
(
const
struct
io_dev_connector
*
dev_con
,
const
uintptr_t
dev_spec
,
uintptr_t
*
dev_handle
);
/* Initialise a device explicitly - to permit lazy initialisation or
* re-initialisation */
int
io_dev_init
(
io_dev_handle
dev_handle
,
const
void
*
init_params
);
int
io_dev_init
(
uintptr_t
dev_handle
,
const
uintptr_t
init_params
);
/* TODO: Consider whether an explicit "shutdown" API should be included */
/* Close a connection to a device */
int
io_dev_close
(
io_dev_handle
dev_handle
);
int
io_dev_close
(
uintptr_t
dev_handle
);
/* Synchronous operations */
int
io_open
(
io_dev_handle
dev_handle
,
const
void
*
spec
,
io_handle
*
handle
);
int
io_open
(
uintptr_t
dev_handle
,
const
uintptr_t
spec
,
uintptr_t
*
handle
);
int
io_seek
(
io_handle
handle
,
io_seek_mode_t
mode
,
ssize_t
offset
);
int
io_seek
(
uintptr_t
handle
,
io_seek_mode_t
mode
,
ssize_t
offset
);
int
io_size
(
io_handle
handle
,
size_t
*
length
);
int
io_size
(
uintptr_t
handle
,
size_t
*
length
);
int
io_read
(
io_handle
handle
,
void
*
buffer
,
size_t
length
,
size_t
*
length_read
);
int
io_read
(
uintptr_t
handle
,
uintptr_t
buffer
,
size_t
length
,
size_t
*
length_read
);
int
io_write
(
io_handle
handle
,
const
void
*
buffer
,
size_t
length
,
int
io_write
(
uintptr_t
handle
,
const
uintptr_t
buffer
,
size_t
length
,
size_t
*
length_written
);
int
io_close
(
io_handle
handle
);
int
io_close
(
uintptr_t
handle
);
#endif
/* __IO_H__ */
include/lib/semihosting.h
View file @
e404d7f4
...
...
@@ -31,6 +31,7 @@
#ifndef __SEMIHOSTING_H__
#define __SEMIHOSTING_H__
#include <stdint.h>
#include <stdio.h>
/* For ssize_t */
...
...
@@ -63,17 +64,17 @@
long
semihosting_connection_supported
(
void
);
long
semihosting_file_open
(
const
char
*
file_name
,
size_t
mode
);
long
semihosting_file_seek
(
long
file_handle
,
ssize_t
offset
);
long
semihosting_file_read
(
long
file_handle
,
size_t
*
length
,
void
*
buffer
);
long
semihosting_file_read
(
long
file_handle
,
size_t
*
length
,
uintptr_t
buffer
);
long
semihosting_file_write
(
long
file_handle
,
size_t
*
length
,
const
void
*
buffer
);
const
uintptr_t
buffer
);
long
semihosting_file_close
(
long
file_handle
);
long
semihosting_file_length
(
long
file_handle
);
long
semihosting_system
(
char
*
command_line
);
long
semihosting_get_flen
(
const
char
*
file_name
);
long
semihosting_download_file
(
const
char
*
file_name
,
size_t
buf_size
,
void
*
buf
);
uintptr_t
buf
);
void
semihosting_write_char
(
char
character
);
void
semihosting_write_string
(
char
*
string
);
char
semihosting_read_char
(
void
);
...
...
lib/io_storage.c
View file @
e404d7f4
...
...
@@ -64,9 +64,9 @@ static int is_valid_dev_connector(const io_dev_connector_t *dev_con)
/* Return a boolean value indicating whether a device handle is valid */
static
int
is_valid_dev
(
io_dev_handle
handle
)
static
int
is_valid_dev
(
const
uintptr_t
dev_
handle
)
{
const
io_dev_info_t
*
dev
=
handle
;
const
io_dev_info_t
*
dev
=
(
io_dev_info_t
*
)
dev_
handle
;
int
result
=
(
dev
!=
NULL
)
&&
(
dev
->
funcs
!=
NULL
)
&&
(
dev
->
funcs
->
type
!=
NULL
)
&&
(
dev
->
funcs
->
type
()
<
IO_TYPE_MAX
);
...
...
@@ -75,10 +75,11 @@ static int is_valid_dev(io_dev_handle handle)
/* Return a boolean value indicating whether an IO entity is valid */
static
int
is_valid_entity
(
io_handle
handle
)
static
int
is_valid_entity
(
const
uintptr_t
handle
)
{
const
io_entity_t
*
entity
=
handle
;
int
result
=
(
entity
!=
NULL
)
&&
(
is_valid_dev
(
entity
->
dev_handle
));
const
io_entity_t
*
entity
=
(
io_entity_t
*
)
handle
;
int
result
=
(
entity
!=
NULL
)
&&
(
is_valid_dev
((
uintptr_t
)
entity
->
dev_handle
));
return
result
;
}
...
...
@@ -93,7 +94,7 @@ static int is_valid_seek_mode(io_seek_mode_t mode)
/* Open a connection to a specific device */
static
int
dev_open
(
const
io_dev_connector_t
*
dev_con
,
void
*
dev_spec
,
static
int
dev_open
(
const
io_dev_connector_t
*
dev_con
,
const
uintptr_t
dev_spec
,
io_dev_info_t
**
dev_info
)
{
int
result
=
IO_FAIL
;
...
...
@@ -106,15 +107,15 @@ static int dev_open(const io_dev_connector_t *dev_con, void *dev_spec,
/* Set a handle to track an entity */
static
void
set_handle
(
io_handle
*
handle
,
io_entity_t
*
entity
)
static
void
set_handle
(
uintptr_t
*
handle
,
io_entity_t
*
entity
)
{
assert
(
handle
!=
NULL
);
*
handle
=
entity
;
*
handle
=
(
uintptr_t
)
entity
;
}
/* Locate an entity in the pool, specified by address */
static
int
find_first_entity
(
struc
t
io_entity
*
entity
,
unsigned
int
*
index_out
)
static
int
find_first_entity
(
cons
t
io_entity
_t
*
entity
,
unsigned
int
*
index_out
)
{
int
result
=
IO_FAIL
;
for
(
int
index
=
0
;
index
<
MAX_IO_HANDLES
;
++
index
)
{
...
...
@@ -129,7 +130,7 @@ static int find_first_entity(struct io_entity *entity, unsigned int *index_out)
/* Allocate an entity from the pool and return a pointer to it */
static
int
allocate_entity
(
struct
io_entity
**
entity
)
static
int
allocate_entity
(
io_entity
_t
**
entity
)
{
int
result
=
IO_FAIL
;
assert
(
entity
!=
NULL
);
...
...
@@ -148,7 +149,7 @@ static int allocate_entity(struct io_entity **entity)
/* Release an entity back to the pool */
static
int
free_entity
(
struc
t
io_entity
*
entity
)
static
int
free_entity
(
cons
t
io_entity
_t
*
entity
)
{
int
result
=
IO_FAIL
;
unsigned
int
index
=
0
;
...
...
@@ -168,7 +169,7 @@ static int free_entity(struct io_entity *entity)
/* Initialise the IO layer */
void
io_init
(
struct
io_plat_data
*
data
)
void
io_init
(
io_plat_data
_t
*
data
)
{
assert
(
data
!=
NULL
);
platform_data
=
data
;
...
...
@@ -176,7 +177,7 @@ void io_init(struct io_plat_data *data)
/* Register a device driver */
int
io_register_device
(
struc
t
io_dev_info
*
dev_info
)
int
io_register_device
(
cons
t
io_dev_info
_t
*
dev_info
)
{
int
result
=
IO_FAIL
;
assert
(
dev_info
!=
NULL
);
...
...
@@ -197,26 +198,26 @@ int io_register_device(struct io_dev_info *dev_info)
/* Open a connection to an IO device */
int
io_dev_open
(
struc
t
io_dev_connector
*
dev_con
,
void
*
dev_spec
,
io_dev_handle
*
handle
)
int
io_dev_open
(
cons
t
io_dev_connector
_t
*
dev_con
,
const
uintptr_t
dev_spec
,
uintptr_t
*
handle
)
{
int
result
=
IO_FAIL
;
assert
(
handle
!=
NULL
);
result
=
dev_open
(
dev_con
,
dev_spec
,
handle
);
result
=
dev_open
(
dev_con
,
dev_spec
,
(
io_dev_info_t
**
)
handle
);
return
result
;
}
/* Initialise an IO device explicitly - to permit lazy initialisation or
* re-initialisation */
int
io_dev_init
(
struct
io_dev_info
*
dev_handle
,
const
void
*
init_params
)
int
io_dev_init
(
uintptr_t
dev_handle
,
const
uintptr_t
init_params
)
{
int
result
=
IO_FAIL
;
assert
(
dev_handle
!=
NULL
);
assert
(
dev_handle
!=
(
uintptr_t
)
NULL
);
assert
(
is_valid_dev
(
dev_handle
));
io_dev_info_t
*
dev
=
dev_handle
;
io_dev_info_t
*
dev
=
(
io_dev_info_t
*
)
dev_handle
;
if
(
dev
->
funcs
->
dev_init
!=
NULL
)
{
result
=
dev
->
funcs
->
dev_init
(
dev
,
init_params
);
...
...
@@ -231,13 +232,13 @@ int io_dev_init(struct io_dev_info *dev_handle, const void *init_params)
/* TODO: Consider whether an explicit "shutdown" API should be included */
/* Close a connection to a device */
int
io_dev_close
(
io_dev_handle
dev_handle
)
int
io_dev_close
(
uintptr_t
dev_handle
)
{
int
result
=
IO_FAIL
;
assert
(
dev_handle
!=
NULL
);
assert
(
dev_handle
!=
(
uintptr_t
)
NULL
);
assert
(
is_valid_dev
(
dev_handle
));
io_dev_info_t
*
dev
=
dev_handle
;
io_dev_info_t
*
dev
=
(
io_dev_info_t
*
)
dev_handle
;
if
(
dev
->
funcs
->
dev_close
!=
NULL
)
{
result
=
dev
->
funcs
->
dev_close
(
dev
);
...
...
@@ -254,13 +255,13 @@ int io_dev_close(io_dev_handle dev_handle)
/* Open an IO entity */
int
io_open
(
io_dev_handle
dev_handle
,
const
void
*
spec
,
io_handle
*
handle
)
int
io_open
(
uintptr_t
dev_handle
,
const
uintptr_t
spec
,
uintptr_t
*
handle
)
{
int
result
=
IO_FAIL
;
assert
((
spec
!=
NULL
)
&&
(
handle
!=
NULL
));
assert
((
spec
!=
(
uintptr_t
)
NULL
)
&&
(
handle
!=
NULL
));
assert
(
is_valid_dev
(
dev_handle
));
io_dev_info_t
*
dev
=
dev_handle
;
io_dev_info_t
*
dev
=
(
io_dev_info_t
*
)
dev_handle
;
io_entity_t
*
entity
;
result
=
allocate_entity
(
&
entity
);
...
...
@@ -270,7 +271,7 @@ int io_open(io_dev_handle dev_handle, const void *spec, io_handle *handle)
result
=
dev
->
funcs
->
open
(
dev
,
spec
,
entity
);
if
(
result
==
IO_SUCCESS
)
{
entity
->
dev_handle
=
dev
_handle
;
entity
->
dev_handle
=
dev
;
set_handle
(
handle
,
entity
);
}
else
free_entity
(
entity
);
...
...
@@ -280,12 +281,12 @@ int io_open(io_dev_handle dev_handle, const void *spec, io_handle *handle)
/* Seek to a specific position in an IO entity */
int
io_seek
(
io_handle
handle
,
io_seek_mode_t
mode
,
ssize_t
offset
)
int
io_seek
(
uintptr_t
handle
,
io_seek_mode_t
mode
,
ssize_t
offset
)
{
int
result
=
IO_FAIL
;
assert
(
is_valid_entity
(
handle
)
&&
is_valid_seek_mode
(
mode
));
io_entity_t
*
entity
=
handle
;
io_entity_t
*
entity
=
(
io_entity_t
*
)
handle
;
io_dev_info_t
*
dev
=
entity
->
dev_handle
;
...
...
@@ -299,12 +300,12 @@ int io_seek(io_handle handle, io_seek_mode_t mode, ssize_t offset)
/* Determine the length of an IO entity */
int
io_size
(
io_handle
handle
,
size_t
*
length
)
int
io_size
(
uintptr_t
handle
,
size_t
*
length
)
{
int
result
=
IO_FAIL
;
assert
(
is_valid_entity
(
handle
)
&&
(
length
!=
NULL
));
io_entity_t
*
entity
=
handle
;
io_entity_t
*
entity
=
(
io_entity_t
*
)
handle
;
io_dev_info_t
*
dev
=
entity
->
dev_handle
;
...
...
@@ -318,12 +319,15 @@ int io_size(io_handle handle, size_t *length)
/* Read data from an IO entity */
int
io_read
(
io_handle
handle
,
void
*
buffer
,
size_t
length
,
size_t
*
length_read
)
int
io_read
(
uintptr_t
handle
,
uintptr_t
buffer
,
size_t
length
,
size_t
*
length_read
)
{
int
result
=
IO_FAIL
;
assert
(
is_valid_entity
(
handle
)
&&
(
buffer
!=
NULL
));
assert
(
is_valid_entity
(
handle
)
&&
(
buffer
!=
(
uintptr_t
)
NULL
));
io_entity_t
*
entity
=
handle
;
io_entity_t
*
entity
=
(
io_entity_t
*
)
handle
;
io_dev_info_t
*
dev
=
entity
->
dev_handle
;
...
...
@@ -337,13 +341,15 @@ int io_read(io_handle handle, void *buffer, size_t length, size_t *length_read)
/* Write data to an IO entity */
int
io_write
(
io_handle
handle
,
const
void
*
buffer
,
size_t
length
,
int
io_write
(
uintptr_t
handle
,
const
uintptr_t
buffer
,
size_t
length
,
size_t
*
length_written
)
{
int
result
=
IO_FAIL
;
assert
(
is_valid_entity
(
handle
)
&&
(
buffer
!=
NULL
));
assert
(
is_valid_entity
(
handle
)
&&
(
buffer
!=
(
uintptr_t
)
NULL
));
io_entity_t
*
entity
=
handle
;
io_entity_t
*
entity
=
(
io_entity_t
*
)
handle
;
io_dev_info_t
*
dev
=
entity
->
dev_handle
;
...
...
@@ -358,12 +364,12 @@ int io_write(io_handle handle, const void *buffer, size_t length,
/* Close an IO entity */
int
io_close
(
io_handle
handle
)
int
io_close
(
uintptr_t
handle
)
{
int
result
=
IO_FAIL
;
assert
(
is_valid_entity
(
handle
));
io_entity_t
*
entity
=
handle
;
io_entity_t
*
entity
=
(
io_entity_t
*
)
handle
;
io_dev_info_t
*
dev
=
entity
->
dev_handle
;
...
...
lib/semihosting/semihosting.c
View file @
e404d7f4
...
...
@@ -48,7 +48,7 @@ typedef struct {
typedef
struct
{
long
handle
;
void
*
buffer
;
uintptr_t
buffer
;
size_t
length
;
}
smh_file_read_write_block_t
;
...
...
@@ -96,12 +96,12 @@ long semihosting_file_seek(long file_handle, ssize_t offset)
return
result
;
}
long
semihosting_file_read
(
long
file_handle
,
size_t
*
length
,
void
*
buffer
)
long
semihosting_file_read
(
long
file_handle
,
size_t
*
length
,
uintptr_t
buffer
)
{
smh_file_read_write_block_t
read_block
;
long
result
=
-
EINVAL
;
if
((
length
==
NULL
)
||
(
buffer
==
NULL
))
if
((
length
==
NULL
)
||
(
buffer
==
(
uintptr_t
)
NULL
))
return
result
;
read_block
.
handle
=
file_handle
;
...
...
@@ -122,15 +122,15 @@ long semihosting_file_read(long file_handle, size_t *length, void *buffer)
long
semihosting_file_write
(
long
file_handle
,
size_t
*
length
,
const
void
*
buffer
)
const
uintptr_t
buffer
)
{
smh_file_read_write_block_t
write_block
;
if
((
length
==
NULL
)
||
(
buffer
==
NULL
))
if
((
length
==
NULL
)
||
(
buffer
==
(
uintptr_t
)
NULL
))
return
-
EINVAL
;
write_block
.
handle
=
file_handle
;
write_block
.
buffer
=
(
void
*
)
buffer
;
write_block
.
buffer
=
(
uintptr_t
)
buffer
;
/* cast away const */
write_block
.
length
=
*
length
;
*
length
=
semihosting_call
(
SEMIHOSTING_SYS_WRITE
,
...
...
@@ -196,7 +196,7 @@ long semihosting_get_flen(const char *file_name)
long
semihosting_download_file
(
const
char
*
file_name
,
size_t
buf_size
,
void
*
buf
)
uintptr_t
buf
)
{
long
ret
=
-
EINVAL
;
size_t
length
;
...
...
plat/fvp/plat_io_storage.c
View file @
e404d7f4
...
...
@@ -41,69 +41,91 @@
/* IO devices */
static
io_plat_data_t
io_data
;
static
io_dev_connector_t
*
sh_dev_con
;
static
void
*
cons
t
sh_dev_spec
;
static
void
*
cons
t
sh_init_params
;
static
io_dev_handle
sh_dev_handle
;
static
io_dev_connector_t
*
fip_dev_con
;
static
void
*
cons
t
fip_dev_spec
;
static
io_dev_handle
fip_dev_handle
;
static
io_dev_connector_t
*
memmap_dev_con
;
static
void
*
cons
t
memmap_dev_spec
;
static
void
*
cons
t
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
;
}
}
...
...
plat/fvp/plat_pm.c
View file @
e404d7f4
...
...
@@ -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
;
...
...
plat/fvp/platform.h
View file @
e404d7f4
...
...
@@ -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
);
...
...
services/std_svc/psci/psci_common.c
View file @
e404d7f4
...
...
@@ -74,7 +74,7 @@ aff_limits_node_t psci_aff_limits[MPIDR_MAX_AFFLVL + 1];
/*******************************************************************************
* Pointer to functions exported by the platform to complete power mgmt. ops
******************************************************************************/
plat_pm_ops_t
*
psci_plat_pm_ops
;
const
plat_pm_ops_t
*
psci_plat_pm_ops
;
/*******************************************************************************
* Routine to return the maximum affinity level to traverse to after a cpu has
...
...
services/std_svc/psci/psci_private.h
View file @
e404d7f4
...
...
@@ -88,7 +88,7 @@ extern suspend_context_t psci_suspend_context[PSCI_NUM_AFFS];
extern
ns_entry_info_t
psci_ns_entry_info
[
PSCI_NUM_AFFS
];
extern
unsigned
int
psci_ns_einfo_idx
;
extern
aff_limits_node_t
psci_aff_limits
[
MPIDR_MAX_AFFLVL
+
1
];
extern
plat_pm_ops_t
*
psci_plat_pm_ops
;
extern
const
plat_pm_ops_t
*
psci_plat_pm_ops
;
extern
aff_map_node_t
psci_aff_map
[
PSCI_NUM_AFFS
];
extern
afflvl_power_on_finisher_t
psci_afflvl_off_finish_handlers
[];
extern
afflvl_power_on_finisher_t
psci_afflvl_sus_finish_handlers
[];
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment