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
629cfd58
Commit
629cfd58
authored
Aug 13, 2020
by
joanna.farley
Committed by
TrustedFirmware Code Review
Aug 13, 2020
Browse files
Merge "qti: Add RNG driver" into integration
parents
acca14b6
905f93c7
Changes
7
Hide whitespace changes
Inline
Side-by-side
plat/qti/common/inc/qti_rng.h
0 → 100644
View file @
629cfd58
/*
* Copyright (c) 2020, The Linux Foundation. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#ifndef QTI_RNG_H
#define QTI_RNG_H
#include <stdinit.h>
int
qti_rng_get_data
(
uint8_t
*
out
,
uint32_t
out_len
);
#endif
/* QTI_RNG_H */
plat/qti/common/src/qti_rng.c
0 → 100644
View file @
629cfd58
/*
* Copyright (c) 2020, The Linux Foundation. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#include <stddef.h>
#include <stdint.h>
#include <lib/mmio.h>
#include <qti_rng_io.h>
int
qti_rng_get_data
(
uint8_t
*
out
,
uint32_t
out_len
)
{
uint32_t
tmp_rndm
=
0
;
uint32_t
bytes_left
=
out_len
;
int
i
=
0
;
if
(
NULL
==
out
||
0
==
out_len
)
{
return
-
1
;
}
/*
* RNG HW initialized at previous boot image.
* RNG clocks are expected to be ON.
*/
do
{
/* There is no data to read */
if
((
mmio_read_32
(
SEC_PRNG_STATUS
)
&
SEC_PRNG_STATUS_DATA_AVAIL_BMSK
)
==
0
)
{
continue
;
}
while
((
tmp_rndm
=
mmio_read_32
(
SEC_PRNG_DATA_OUT
))
==
0
)
{
;
}
for
(
i
=
0
;
i
<
4
;
i
++
)
{
*
out
=
(
uint8_t
)
(
tmp_rndm
>>
(
8
*
i
));
out
++
;
bytes_left
--
;
if
(
bytes_left
==
0
)
{
break
;
}
}
}
while
(
bytes_left
!=
0
);
return
0
;
}
plat/qti/common/src/qti_stack_protector.c
View file @
629cfd58
/*
/*
* Copyright (c) 2018-20
19
, The Linux Foundation. All rights reserved.
* Copyright (c) 2018-20
20
, The Linux Foundation. All rights reserved.
*
*
* SPDX-License-Identifier: BSD-3-Clause
* SPDX-License-Identifier: BSD-3-Clause
*/
*/
...
@@ -9,16 +9,18 @@
...
@@ -9,16 +9,18 @@
#include <platform.h>
#include <platform.h>
#include <platform_def.h>
#include <platform_def.h>
#include <qti_rng.h>
#include <qtiseclib_interface.h>
#include <qtiseclib_interface.h>
u_register_t
plat_get_stack_protector_canary
(
void
)
u_register_t
plat_get_stack_protector_canary
(
void
)
{
{
u_register_t
random
=
0x0
;
u_register_t
random
=
0x0
;
/* get random data , the below API doesn't return random = 0 in success
/*
* case */
* get random data , the below API doesn't return random = 0 on success
qtiseclib_prng_get_data
((
uint8_t
*
)
&
random
,
sizeof
(
random
));
*/
assert
(
0x0
!=
random
);
qti_rng_get_data
((
uint8_t
*
)
&
random
,
sizeof
(
random
));
assert
(
random
!=
0x0
);
return
random
;
return
random
;
}
}
plat/qti/qtiseclib/inc/qtiseclib_interface.h
View file @
629cfd58
...
@@ -63,7 +63,6 @@ void qtiseclib_kryo4_silver_reset_asm(void);
...
@@ -63,7 +63,6 @@ void qtiseclib_kryo4_silver_reset_asm(void);
void
qtiseclib_bl31_platform_setup
(
void
);
void
qtiseclib_bl31_platform_setup
(
void
);
void
qtiseclib_invoke_isr
(
uint32_t
irq
,
void
*
handle
);
void
qtiseclib_invoke_isr
(
uint32_t
irq
,
void
*
handle
);
void
qtiseclib_panic
(
void
);
void
qtiseclib_panic
(
void
);
int
qtiseclib_prng_get_data
(
uint8_t
*
out
,
uint32_t
out_len
);
int
qtiseclib_mem_assign
(
const
memprot_info_t
*
mem_info
,
int
qtiseclib_mem_assign
(
const
memprot_info_t
*
mem_info
,
uint32_t
mem_info_list_cnt
,
uint32_t
mem_info_list_cnt
,
...
...
plat/qti/qtiseclib/src/qtiseclib_interface_stub.c
View file @
629cfd58
...
@@ -67,17 +67,6 @@ void qtiseclib_panic(void)
...
@@ -67,17 +67,6 @@ void qtiseclib_panic(void)
{
{
}
}
int
qtiseclib_prng_get_data
(
uint8_t
*
out
,
uint32_t
out_len
)
{
/* fill dummy data to avoid assert and print
* stub implementation in setup call
*/
for
(
int
i
=
0
;
i
<
out_len
;
i
++
)
{
out
[
i
]
=
0x11
;
}
return
0
;
}
int
int
qtiseclib_mem_assign
(
const
memprot_info_t
*
mem_info
,
qtiseclib_mem_assign
(
const
memprot_info_t
*
mem_info
,
uint32_t
mem_info_list_cnt
,
uint32_t
mem_info_list_cnt
,
...
...
plat/qti/sc7180/inc/qti_rng_io.h
0 → 100644
View file @
629cfd58
/*
* Copyright (c) 2020, The Linux Foundation. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#ifndef QTI_RNG_IO_H
#define QTI_RNG_IO_H
#define SEC_PRNG_STATUS 0x00791004
#define SEC_PRNG_STATUS_DATA_AVAIL_BMSK 0x1
#define SEC_PRNG_DATA_OUT 0x00791000
#endif
/* QTI_RNG_IO_H */
plat/qti/sc7180/platform.mk
View file @
629cfd58
...
@@ -59,6 +59,7 @@ QTI_BL31_SOURCES := $(QTI_PLAT_PATH)/common/src/$(ARCH)/qti_helpers.S \
...
@@ -59,6 +59,7 @@ QTI_BL31_SOURCES := $(QTI_PLAT_PATH)/common/src/$(ARCH)/qti_helpers.S \
$(QTI_PLAT_PATH)
/common/src/qti_syscall.c
\
$(QTI_PLAT_PATH)
/common/src/qti_syscall.c
\
$(QTI_PLAT_PATH)
/common/src/qti_topology.c
\
$(QTI_PLAT_PATH)
/common/src/qti_topology.c
\
$(QTI_PLAT_PATH)
/common/src/qti_pm.c
\
$(QTI_PLAT_PATH)
/common/src/qti_pm.c
\
$(QTI_PLAT_PATH)
/common/src/qti_rng.c
\
$(QTI_PLAT_PATH)
/qtiseclib/src/qtiseclib_cb_interface.c
\
$(QTI_PLAT_PATH)
/qtiseclib/src/qtiseclib_cb_interface.c
\
...
...
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