|
| 1 | +// SPDX-License-Identifier: BSD-2-Clause |
| 2 | +/* |
| 3 | + * Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. |
| 4 | + */ |
| 5 | + |
| 6 | +#include <pas_policy.h> |
| 7 | +#include <tee_api_types.h> |
| 8 | +#include <util.h> |
| 9 | + |
| 10 | +#define PAS_ID_QDSP6 1 |
| 11 | +#define PAS_ID_WPSS 6 |
| 12 | +#define PAS_ID_VENUS 9 |
| 13 | +#define PAS_ID_TURING 18 |
| 14 | +#define PAS_ID_TURING1 30 |
| 15 | +#define PAS_ID_CAMERA 33 |
| 16 | +#define PAS_ID_GPDSP0 39 |
| 17 | +#define PAS_ID_GPDSP1 40 |
| 18 | + |
| 19 | +#define SECBOOT_ADSP_SW_TYPE 0x04 |
| 20 | +#define SECBOOT_WCNSS_SW_TYPE 0x0D |
| 21 | +#define SECBOOT_VIDEO_SW_TYPE 0x0E |
| 22 | +#define SECBOOT_CDSP_SW_TYPE 0x17 |
| 23 | +#define SECBOOT_CAMERA_FW_SW_TYPE 0x34 |
| 24 | +#define SECBOOT_CDSP1_SW_TYPE 0x44 |
| 25 | +#define SECBOOT_GPDSP0_SW_TYPE 0x58 |
| 26 | +#define SECBOOT_GPDSP1_SW_TYPE 0x5A |
| 27 | + |
| 28 | +static const struct { |
| 29 | + uint32_t pas_id; |
| 30 | + uint32_t swid; |
| 31 | +} pas_swid_map[] = { |
| 32 | + { PAS_ID_QDSP6, SECBOOT_ADSP_SW_TYPE }, |
| 33 | + { PAS_ID_WPSS, SECBOOT_WCNSS_SW_TYPE }, |
| 34 | + { PAS_ID_VENUS, SECBOOT_VIDEO_SW_TYPE }, |
| 35 | + { PAS_ID_TURING, SECBOOT_CDSP_SW_TYPE }, |
| 36 | + { PAS_ID_TURING1, SECBOOT_CDSP1_SW_TYPE }, |
| 37 | + { PAS_ID_CAMERA, SECBOOT_CAMERA_FW_SW_TYPE }, |
| 38 | + { PAS_ID_GPDSP0, SECBOOT_GPDSP0_SW_TYPE }, |
| 39 | + { PAS_ID_GPDSP1, SECBOOT_GPDSP1_SW_TYPE }, |
| 40 | +}; |
| 41 | + |
| 42 | +TEE_Result pas_policy_expected_swid(uint32_t pas_id, uint32_t *swid) |
| 43 | +{ |
| 44 | + size_t i = 0; |
| 45 | + |
| 46 | + if (!swid) |
| 47 | + return TEE_ERROR_BAD_PARAMETERS; |
| 48 | + |
| 49 | + for (i = 0; i < ARRAY_SIZE(pas_swid_map); i++) { |
| 50 | + if (pas_swid_map[i].pas_id == pas_id) { |
| 51 | + *swid = pas_swid_map[i].swid; |
| 52 | + return TEE_SUCCESS; |
| 53 | + } |
| 54 | + } |
| 55 | + |
| 56 | + return TEE_ERROR_NOT_SUPPORTED; |
| 57 | +} |
0 commit comments