blob: 5ae62579339b4f6b2067b259ff3701f16a8228d6 [file] [log] [blame]
Olivier Deprez5ac897f2020-01-09 10:45:52 +01001/*
2 * Copyright (c) 2017-2020, ARM Limited and Contributors. All rights reserved.
Jeetesh Burman50cd1062018-07-19 13:07:23 +05303 * Copyright (c) 2017-2020, NVIDIA CORPORATION. All rights reserved.
Marvin Hsu21eea972017-04-11 11:00:48 +08004 *
5 * SPDX-License-Identifier: BSD-3-Clause
6 */
7
8#ifndef SECURITY_ENGINE_H
9#define SECURITY_ENGINE_H
10
11/*******************************************************************************
12 * Structure definition
13 ******************************************************************************/
14
15/* Security Engine Linked List */
16struct tegra_se_ll {
17 /* DMA buffer address */
18 uint32_t addr;
19 /* Data length in DMA buffer */
20 uint32_t data_len;
21};
22
23#define SE_LL_MAX_BUFFER_NUM 4
24typedef struct tegra_se_io_lst {
25 volatile uint32_t last_buff_num;
26 volatile struct tegra_se_ll buffer[SE_LL_MAX_BUFFER_NUM];
27} tegra_se_io_lst_t __attribute__((aligned(4)));
28
29/* SE device structure */
30typedef struct tegra_se_dev {
31 /* Security Engine ID */
32 const int se_num;
33 /* SE base address */
34 const uint64_t se_base;
35 /* SE context size in AES blocks */
36 const uint32_t ctx_size_blks;
37 /* pointer to source linked list buffer */
38 tegra_se_io_lst_t *src_ll_buf;
39 /* pointer to destination linked list buffer */
40 tegra_se_io_lst_t *dst_ll_buf;
Marvin Hsu40d3a672017-04-11 11:00:48 +080041 /* LP context buffer pointer */
42 uint32_t *ctx_save_buf;
Marvin Hsu21eea972017-04-11 11:00:48 +080043} tegra_se_dev_t;
44
Marvin Hsu40d3a672017-04-11 11:00:48 +080045/* PKA1 device structure */
46typedef struct tegra_pka_dev {
47 /* PKA1 base address */
48 uint64_t pka_base;
49} tegra_pka_dev_t;
50
Marvin Hsu21eea972017-04-11 11:00:48 +080051/*******************************************************************************
52 * Public interface
53 ******************************************************************************/
54void tegra_se_init(void);
55int tegra_se_suspend(void);
56void tegra_se_resume(void);
57int tegra_se_save_tzram(void);
Jeetesh Burman50cd1062018-07-19 13:07:23 +053058int32_t tegra_se_save_sha256_hash(uint64_t bl31_base, uint32_t src_len_inbyte);
Marvin Hsu21eea972017-04-11 11:00:48 +080059
60#endif /* SECURITY_ENGINE_H */