Bo Lv | 72d0e90 | 2023-01-02 14:27:34 +0000 | [diff] [blame] | 1 | /* 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 | |
| 22 | typedef enum { |
| 23 | NOCS_UNDEFINE = 0, |
| 24 | NOCS_S905C2_TYPE1, |
| 25 | LAST_NOCS_TYPE |
| 26 | } nocs_chip_type; |
| 27 | |
| 28 | typedef enum { |
| 29 | SEB_NO_ERROR = 0, |
| 30 | SEB_ERROR, |
| 31 | SEB_UNSUPPORT, |
| 32 | LAST_SEB_STATUS |
| 33 | } nocs_seb_status; |
| 34 | |
| 35 | typedef enum { |
| 36 | NOCS_SCS_DISABLE = 0, |
| 37 | NOCS_SCS_ENABLE, |
| 38 | } nocs_scs_status; |
| 39 | |
| 40 | typedef 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 | |
| 46 | nocs_seb_status get_nocs_inf(nocs_chip_type *chip_type, nocs_scs_status *scs_status); |
| 47 | nocs_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__ */ |