blob: aa0560fe4ae0692dd613a48d4a7c493d00c5cb5a [file] [log] [blame]
Bo Lv72d0e902023-01-02 14:27:34 +00001/* SPDX-License-Identifier: (GPL-2.0+ OR MIT) */
2/*
3 * Copyright (c) 2019 Amlogic, Inc. All rights reserved.
4 */
5
6#ifndef __NOCS_SEB_H__
7#define __NOCS_SEB_H__
8
9#define CA_NOCS_MODE 0x05
10#define CA_NOCS_SCS 0X0C00
11#define CA_NOCS_MODE_REG 0xfe440070
12#define CA_NOCS_SCS_STATUS 0xfe440040
13#define MAX_SKIP_NUM 0x05
14
15/*S905C2 TYPE1*/
16#define CMP_OFFSET_TYPE1 0x3f840
17#define CMP_SIZE 72
18#define INFO_OFFSET 0x3f884
19#define REPLACE_INFO_OFFSET 0x3f800
20#define REPLACE_INFO_SIZE 512
21
22typedef enum {
23 NOCS_UNDEFINE = 0,
24 NOCS_S905C2_TYPE1,
25 LAST_NOCS_TYPE
26} nocs_chip_type;
27
28typedef enum {
29 SEB_NO_ERROR = 0,
30 SEB_ERROR,
31 SEB_UNSUPPORT,
32 LAST_SEB_STATUS
33} nocs_seb_status;
34
35typedef enum {
36 NOCS_SCS_DISABLE = 0,
37 NOCS_SCS_ENABLE,
38} nocs_scs_status;
39
40typedef struct {
41 unsigned int area_num;
42 unsigned int offset[MAX_SKIP_NUM];
43 unsigned int size[MAX_SKIP_NUM];
44} nocs_boot_replace;
45
46nocs_seb_status get_nocs_inf(nocs_chip_type *chip_type, nocs_scs_status *scs_status);
47nocs_seb_status nocs_secure_boot_modify(nocs_chip_type chip_type,
48 unsigned char *flash_boot, unsigned int flash_boot_size,
49 unsigned char *update_boot, unsigned int update_boot_size,
50 nocs_boot_replace *nocs_replace);
51#endif /* __NOCS_SEB_H__ */