Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 880d8d8

Browse files
jellesels-armjforissier
authored andcommittedNov 9, 2020
core: create embedded_ts
Create an embedded ts struct which will encapsulate both early_ta's and embedded SPs. Signed-off-by: Jelle Sels <jelle.sels@arm.com> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org> Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org> Acked-by: Jerome Forissier <jerome@forissier.org>
1 parent 6cb0281 commit 880d8d8

File tree

4 files changed

+37
-20
lines changed

4 files changed

+37
-20
lines changed
 
+2-9
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
/* SPDX-License-Identifier: BSD-2-Clause */
22
/*
33
* Copyright (c) 2017, 2020, Linaro Limited
4+
* Copyright (c) 2020, Arm Limited.
45
*/
56
#ifndef KERNEL_EARLY_TA_H
67
#define KERNEL_EARLY_TA_H
@@ -9,16 +10,8 @@
910
#include <stdint.h>
1011
#include <tee_api_types.h>
1112

12-
struct early_ta {
13-
uint32_t flags;
14-
TEE_UUID uuid;
15-
uint32_t size;
16-
uint32_t uncompressed_size; /* 0: not compressed */
17-
const uint8_t *ta; /* @size bytes */
18-
};
19-
2013
#define for_each_early_ta(_ta) \
21-
SCATTERED_ARRAY_FOREACH(_ta, early_tas, struct early_ta)
14+
SCATTERED_ARRAY_FOREACH(_ta, early_tas, struct embedded_ts)
2215

2316
#endif /* KERNEL_EARLY_TA_H */
2417

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
/* SPDX-License-Identifier: BSD-2-Clause */
2+
/*
3+
* Copyright (c) 2017, Linaro Limited
4+
* Copyright (c) 2020, Arm Limited.
5+
*/
6+
#ifndef KERNEL_EMBEDDED_TS_H
7+
#define KERNEL_EMBEDDED_TS_H
8+
9+
#include <compiler.h>
10+
#include <kernel/linker.h>
11+
#include <stdint.h>
12+
#include <tee_api_types.h>
13+
#include <util.h>
14+
15+
struct embedded_ts {
16+
uint32_t flags;
17+
TEE_UUID uuid;
18+
uint32_t size;
19+
uint32_t uncompressed_size; /* 0: not compressed */
20+
const uint8_t *ts; /* @size bytes */
21+
};
22+
23+
#endif /* KERNEL_EMBEDDED_TS_H */
24+

‎core/arch/arm/kernel/early_ta.c

+10-10
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,14 @@
1616
#include <zlib.h>
1717

1818
struct ts_store_handle {
19-
const struct early_ta *early_ta;
19+
const struct embedded_ts *early_ta;
2020
size_t offs;
2121
z_stream strm;
2222
};
2323

24-
static const struct early_ta *find_early_ta(const TEE_UUID *uuid)
24+
static const struct embedded_ts *find_early_ta(const TEE_UUID *uuid)
2525
{
26-
const struct early_ta *ta;
26+
const struct embedded_ts *ta = NULL;
2727

2828
for_each_early_ta(ta)
2929
if (!memcmp(&ta->uuid, uuid, sizeof(*uuid)))
@@ -44,11 +44,11 @@ static void zfree(void *opaque __unused, void *address)
4444
}
4545

4646
static bool decompression_init(z_stream *strm,
47-
const struct early_ta *ta)
47+
const struct embedded_ts *ta)
4848
{
4949
int st;
5050

51-
strm->next_in = ta->ta;
51+
strm->next_in = ta->ts;
5252
strm->avail_in = ta->size;
5353
strm->zalloc = zalloc;
5454
strm->zfree = zfree;
@@ -64,9 +64,9 @@ static bool decompression_init(z_stream *strm,
6464
static TEE_Result early_ta_open(const TEE_UUID *uuid,
6565
struct ts_store_handle **h)
6666
{
67-
struct ts_store_handle *handle;
68-
const struct early_ta *ta;
69-
bool st;
67+
struct ts_store_handle *handle = NULL;
68+
const struct embedded_ts *ta = NULL;
69+
bool st = Z_OK;
7070

7171
ta = find_early_ta(uuid);
7272
if (!ta)
@@ -92,7 +92,7 @@ static TEE_Result early_ta_open(const TEE_UUID *uuid,
9292
static TEE_Result early_ta_get_size(const struct ts_store_handle *h,
9393
size_t *size)
9494
{
95-
const struct early_ta *ta = h->early_ta;
95+
const struct embedded_ts *ta = h->early_ta;
9696

9797
if (ta->uncompressed_size)
9898
*size = ta->uncompressed_size;
@@ -236,7 +236,7 @@ REGISTER_TA_STORE(2) = {
236236

237237
static TEE_Result early_ta_init(void)
238238
{
239-
const struct early_ta *ta;
239+
const struct embedded_ts *ta = NULL;
240240
char __maybe_unused msg[60] = { '\0', };
241241

242242
for_each_early_ta(ta) {

‎core/pta/device.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ static TEE_Result get_devices(uint32_t types,
4242
uint32_t rflags)
4343
{
4444
const struct pseudo_ta_head *ta = NULL;
45-
const struct early_ta *eta = NULL;
45+
const struct embedded_ts *eta = NULL;
4646
void *buf = NULL;
4747
uint32_t blen = 0;
4848
uint32_t pos = 0;

0 commit comments

Comments
 (0)
Failed to load comments.