summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRajesh Nyamagoud <nyamagoud@google.com>2020-05-21 11:09:13 -0700
committerRajesh Nyamagoud <nyamagoud@google.com>2020-05-29 16:57:52 -0700
commit1507b0dcb765ec597c4b2be244167b5dc458d048 (patch)
tree4ba592b9b21287943508a78383fa3e53457dded4
parent557b5e2ceff1c08af7ae0f05877b546dd65775e6 (diff)
downloadnxp-1507b0dcb765ec597c4b2be244167b5dc458d048.tar.gz
Support for manifest config JSON in nxp
Bug: 130560272 Change-Id: I55a9bc96c2c36c20df30cd1a123b02940c3a37a8
-rw-r--r--app/hwcrypto/caam.h4
-rw-r--r--app/hwcrypto/hwkey_srv.c2
-rw-r--r--app/hwcrypto/hwkey_srv_provider.c2
-rw-r--r--app/hwcrypto/manifest.c43
-rw-r--r--app/hwcrypto/manifest.json22
-rw-r--r--app/hwcrypto/nxp_hwcrypto_consts.json23
-rw-r--r--app/hwcrypto/nxp_hwcrypto_uuid_consts.json20
-rw-r--r--app/hwcrypto/rules.mk8
-rw-r--r--app/hwcrypto/uuids.h41
-rw-r--r--platform/imx/soc/imx6ul/include/nxp_hwcrypto_memmap_consts.json41
-rw-r--r--platform/imx/soc/imx7d/include/nxp_hwcrypto_memmap_consts.json41
11 files changed, 157 insertions, 90 deletions
diff --git a/app/hwcrypto/caam.h b/app/hwcrypto/caam.h
index a2fc1d7..d819536 100644
--- a/app/hwcrypto/caam.h
+++ b/app/hwcrypto/caam.h
@@ -32,9 +32,7 @@
#include <stdbool.h>
#include <stdint.h>
-#define CAAM_MMIO_ID 8
-#define CAAM_SEC_RAM_MMIO_ID 9
-#define CCM_MMIO_ID 10
+#include <nxp_hwcrypto_consts.h>
#define CAAM_KB_HEADER_LEN 48
#define CAAM_SUCCESS 0
diff --git a/app/hwcrypto/hwkey_srv.c b/app/hwcrypto/hwkey_srv.c
index 8245267..5ee6f60 100644
--- a/app/hwcrypto/hwkey_srv.c
+++ b/app/hwcrypto/hwkey_srv.c
@@ -24,10 +24,10 @@
#include <uapi/err.h>
#include <interface/hwkey/hwkey.h>
+#include <nxp_hwcrypto_uuid_consts.h>
#include "common.h"
#include "hwkey_srv_priv.h"
-#include "uuids.h"
#define TLOG_LVL TLOG_LVL_DEFAULT
#define TLOG_TAG "hwkey_srv"
diff --git a/app/hwcrypto/hwkey_srv_provider.c b/app/hwcrypto/hwkey_srv_provider.c
index 3baab58..8a01468 100644
--- a/app/hwcrypto/hwkey_srv_provider.c
+++ b/app/hwcrypto/hwkey_srv_provider.c
@@ -23,6 +23,7 @@
#include <uapi/err.h>
#include <interface/hwkey/hwkey.h>
+#include <nxp_hwcrypto_uuid_consts.h>
#include <openssl/aes.h>
#include <openssl/cipher.h>
#include <openssl/digest.h>
@@ -33,7 +34,6 @@
#include "common.h"
#include "hwkey_keyslots.h"
#include "hwkey_srv_priv.h"
-#include "uuids.h"
#define TLOG_LVL TLOG_LVL_DEFAULT
#define TLOG_TAG "hwkey_caam"
diff --git a/app/hwcrypto/manifest.c b/app/hwcrypto/manifest.c
deleted file mode 100644
index adfbbaa..0000000
--- a/app/hwcrypto/manifest.c
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright (C) 2016-2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <imx-regs.h>
-#include <stddef.h>
-#include <stdio.h>
-#include <trusty_app_manifest.h>
-
-#include "caam.h"
-#include "uuids.h"
-
-trusty_app_manifest_t TRUSTY_APP_MANIFEST_ATTRS trusty_app_manifest = {
- .uuid = IMX_HWCRYPTO_UUID,
-
- .config_options =
- {
- /* Max HEAP size */
- TRUSTY_APP_CONFIG_MIN_HEAP_SIZE(2 * 4096),
- /* MMIO regions */
- TRUSTY_APP_CONFIG_MAP_MEM(CAAM_MMIO_ID,
- CAAM_PHY_BASE_ADDR,
- CAAM_REG_SIZE),
- TRUSTY_APP_CONFIG_MAP_MEM(CAAM_SEC_RAM_MMIO_ID,
- CAAM_PHY_ARB_BASE_ADDR,
- CAAM_SEC_RAM_SIZE),
- TRUSTY_APP_CONFIG_MAP_MEM(CCM_MMIO_ID,
- CCM_PHY_BASE_ADDR,
- CCM_REG_SIZE),
- },
-};
diff --git a/app/hwcrypto/manifest.json b/app/hwcrypto/manifest.json
new file mode 100644
index 0000000..b99a1ec
--- /dev/null
+++ b/app/hwcrypto/manifest.json
@@ -0,0 +1,22 @@
+{
+ "uuid": "IMX_HWCRYPTO_UUID",
+ "min_heap": 8192,
+ "min_stack": 4096,
+ "mem_map": [
+ {
+ "id": "CAAM_MMIO_ID",
+ "addr": "CAAM_PHY_BASE_ADDR",
+ "size": "CAAM_REG_SIZE"
+ },
+ {
+ "id": "CAAM_SEC_RAM_MMIO_ID",
+ "addr": "CAAM_PHY_ARB_BASE_ADDR",
+ "size": "CAAM_SEC_RAM_SIZE"
+ },
+ {
+ "id": "CCM_MMIO_ID",
+ "addr": "CCM_PHY_BASE_ADDR",
+ "size": "CCM_REG_SIZE"
+ }
+ ]
+}
diff --git a/app/hwcrypto/nxp_hwcrypto_consts.json b/app/hwcrypto/nxp_hwcrypto_consts.json
new file mode 100644
index 0000000..4622ba8
--- /dev/null
+++ b/app/hwcrypto/nxp_hwcrypto_consts.json
@@ -0,0 +1,23 @@
+{
+ "header": "nxp_hwcrypto_consts.h",
+ "constants": [
+ {
+ "name": "CAAM_MMIO_ID",
+ "value": 8,
+ "type": "int",
+ "unsigned": false
+ },
+ {
+ "name": "CAAM_SEC_RAM_MMIO_ID",
+ "value": 9,
+ "type": "int",
+ "unsigned": false
+ },
+ {
+ "name": "CCM_MMIO_ID",
+ "value": 10,
+ "type": "int",
+ "unsigned": false
+ }
+ ]
+}
diff --git a/app/hwcrypto/nxp_hwcrypto_uuid_consts.json b/app/hwcrypto/nxp_hwcrypto_uuid_consts.json
new file mode 100644
index 0000000..1740ef0
--- /dev/null
+++ b/app/hwcrypto/nxp_hwcrypto_uuid_consts.json
@@ -0,0 +1,20 @@
+{
+ "header": "nxp_hwcrypto_uuid_consts.h",
+ "constants":[
+ {
+ "name": "IMX_HWCRYPTO_UUID",
+ "value": "1adaf827-806b-4bcf-bcec-7e7d2f5a0a5c",
+ "type": "uuid"
+ },
+ {
+ "name": "HWCRYPTO_UNITTEST_APP_UUID",
+ "value": "ab742471-d6e6-4806-85f6-0555b024f4da",
+ "type": "uuid"
+ },
+ {
+ "name": "SECURE_STORAGE_SERVER_APP_UUID",
+ "value": "cea8706d-6cb4-49f3-b994-29e0e478bd29",
+ "type": "uuid"
+ }
+ ]
+}
diff --git a/app/hwcrypto/rules.mk b/app/hwcrypto/rules.mk
index e2f38ae..fe738f2 100644
--- a/app/hwcrypto/rules.mk
+++ b/app/hwcrypto/rules.mk
@@ -19,8 +19,14 @@ LOCAL_DIR := $(GET_LOCAL_DIR)
MODULE := $(LOCAL_DIR)
+MANIFEST := $(LOCAL_DIR)/manifest.json
+
+CONSTANTS := \
+ $(LOCAL_DIR)/../../platform/imx/soc/$(PLATFORM_SOC)/include/nxp_hwcrypto_memmap_consts.json \
+ $(LOCAL_DIR)/nxp_hwcrypto_consts.json \
+ $(LOCAL_DIR)/nxp_hwcrypto_uuid_consts.json \
+
MODULE_SRCS := \
- $(LOCAL_DIR)/manifest.c \
$(LOCAL_DIR)/main.c \
$(LOCAL_DIR)/hwrng_srv.c \
$(LOCAL_DIR)/hwkey_srv.c \
diff --git a/app/hwcrypto/uuids.h b/app/hwcrypto/uuids.h
deleted file mode 100644
index b1ef05e..0000000
--- a/app/hwcrypto/uuids.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright (C) 2015-2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#pragma once
-
-/* This App UUID: {1adaf827-806b-4bcf-bcec-7e7d2f5a0a5c} */
-#define IMX_HWCRYPTO_UUID \
- { \
- 0x1adaf827, 0x806b, 0x4bcf, { \
- 0xbc, 0xec, 0x7e, 0x7d, 0x2f, 0x5a, 0x0a, 0x5c \
- } \
- }
-
-/* HWCRYPTO unittest App UUID */
-#define HWCRYPTO_UNITTEST_APP_UUID \
- { \
- 0xab742471, 0xd6e6, 0x4806, { \
- 0x85, 0xf6, 0x05, 0x55, 0xb0, 0x24, 0xf4, 0xda \
- } \
- }
-
-/* Secure Storage Server App UUID */
-#define SECURE_STORAGE_SERVER_APP_UUID \
- { \
- 0xcea8706d, 0x6cb4, 0x49f3, { \
- 0xb9, 0x94, 0x29, 0xe0, 0xe4, 0x78, 0xbd, 0x29 \
- } \
- }
diff --git a/platform/imx/soc/imx6ul/include/nxp_hwcrypto_memmap_consts.json b/platform/imx/soc/imx6ul/include/nxp_hwcrypto_memmap_consts.json
new file mode 100644
index 0000000..ed200c0
--- /dev/null
+++ b/platform/imx/soc/imx6ul/include/nxp_hwcrypto_memmap_consts.json
@@ -0,0 +1,41 @@
+{
+ "header": "nxp_memmap_consts.h",
+ "constants":[
+ {
+ "name": "CAAM_PHY_BASE_ADDR",
+ "value": "0x02140000",
+ "type": "int",
+ "unsigned": false
+ },
+ {
+ "name": "CAAM_REG_SIZE",
+ "value": "0x3C000",
+ "type": "int",
+ "unsigned": false
+ },
+ {
+ "name": "CAAM_PHY_ARB_BASE_ADDR",
+ "value": "0x00100000",
+ "type": "int",
+ "unsigned": false
+ },
+ {
+ "name": "CAAM_SEC_RAM_SIZE",
+ "value": "0x8000",
+ "type": "int",
+ "unsigned": false
+ },
+ {
+ "name": "CCM_PHY_BASE_ADDR",
+ "value": "20C4000",
+ "type": "int",
+ "unsigned": false
+ },
+ {
+ "name": "CCM_REG_SIZE",
+ "value": "0x4000",
+ "type": "int",
+ "unsigned": false
+ }
+ ]
+}
diff --git a/platform/imx/soc/imx7d/include/nxp_hwcrypto_memmap_consts.json b/platform/imx/soc/imx7d/include/nxp_hwcrypto_memmap_consts.json
new file mode 100644
index 0000000..6cd9f02
--- /dev/null
+++ b/platform/imx/soc/imx7d/include/nxp_hwcrypto_memmap_consts.json
@@ -0,0 +1,41 @@
+{
+ "header": "nxp_memmap_consts.h",
+ "constants":[
+ {
+ "name": "CAAM_PHY_BASE_ADDR",
+ "value": "0x30900000",
+ "type": "int",
+ "unsigned": false
+ },
+ {
+ "name": "CAAM_REG_SIZE",
+ "value": "0x40000",
+ "type": "int",
+ "unsigned": false
+ },
+ {
+ "name": "CAAM_PHY_ARB_BASE_ADDR",
+ "value": "0x00100000",
+ "type": "int",
+ "unsigned": false
+ },
+ {
+ "name": "CAAM_SEC_RAM_SIZE",
+ "value": "0x8000",
+ "type": "int",
+ "unsigned": false
+ },
+ {
+ "name": "CCM_PHY_BASE_ADDR",
+ "value": "0x30380000",
+ "type": "int",
+ "unsigned": false
+ },
+ {
+ "name": "CCM_REG_SIZE",
+ "value": "0x10000",
+ "type": "int",
+ "unsigned": false
+ }
+ ]
+}