1f1df57d02a0f83e764b4dc9187f58665d70f190eVarun Wadekar/* 2f1df57d02a0f83e764b4dc9187f58665d70f190eVarun Wadekar * Copyright (c) 2010, NVIDIA Corporation. 3f1df57d02a0f83e764b4dc9187f58665d70f190eVarun Wadekar * 4f1df57d02a0f83e764b4dc9187f58665d70f190eVarun Wadekar * This program is free software; you can redistribute it and/or modify 5f1df57d02a0f83e764b4dc9187f58665d70f190eVarun Wadekar * it under the terms of the GNU General Public License as published by 6f1df57d02a0f83e764b4dc9187f58665d70f190eVarun Wadekar * the Free Software Foundation; either version 2 of the License, or 7f1df57d02a0f83e764b4dc9187f58665d70f190eVarun Wadekar * (at your option) any later version. 8f1df57d02a0f83e764b4dc9187f58665d70f190eVarun Wadekar * 9f1df57d02a0f83e764b4dc9187f58665d70f190eVarun Wadekar * This program is distributed in the hope that it will be useful, but WITHOUT 10f1df57d02a0f83e764b4dc9187f58665d70f190eVarun Wadekar * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11f1df57d02a0f83e764b4dc9187f58665d70f190eVarun Wadekar * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 12f1df57d02a0f83e764b4dc9187f58665d70f190eVarun Wadekar * more details. 13f1df57d02a0f83e764b4dc9187f58665d70f190eVarun Wadekar * 14f1df57d02a0f83e764b4dc9187f58665d70f190eVarun Wadekar * You should have received a copy of the GNU General Public License along 15f1df57d02a0f83e764b4dc9187f58665d70f190eVarun Wadekar * with this program; if not, write to the Free Software Foundation, Inc., 16f1df57d02a0f83e764b4dc9187f58665d70f190eVarun Wadekar * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 17f1df57d02a0f83e764b4dc9187f58665d70f190eVarun Wadekar */ 18f1df57d02a0f83e764b4dc9187f58665d70f190eVarun Wadekar 19f1df57d02a0f83e764b4dc9187f58665d70f190eVarun Wadekar#ifndef __CRYPTODEV_TEGRA_AES_H 20f1df57d02a0f83e764b4dc9187f58665d70f190eVarun Wadekar#define __CRYPTODEV_TEGRA_AES_H 21f1df57d02a0f83e764b4dc9187f58665d70f190eVarun Wadekar 22f1df57d02a0f83e764b4dc9187f58665d70f190eVarun Wadekar#define TEGRA_AES_ICMDQUE_WR 0x1000 23f1df57d02a0f83e764b4dc9187f58665d70f190eVarun Wadekar#define TEGRA_AES_CMDQUE_CONTROL 0x1008 24f1df57d02a0f83e764b4dc9187f58665d70f190eVarun Wadekar#define TEGRA_AES_INTR_STATUS 0x1018 25f1df57d02a0f83e764b4dc9187f58665d70f190eVarun Wadekar#define TEGRA_AES_INT_ENB 0x1040 26f1df57d02a0f83e764b4dc9187f58665d70f190eVarun Wadekar#define TEGRA_AES_CONFIG 0x1044 27f1df57d02a0f83e764b4dc9187f58665d70f190eVarun Wadekar#define TEGRA_AES_IRAM_ACCESS_CFG 0x10A0 28f1df57d02a0f83e764b4dc9187f58665d70f190eVarun Wadekar#define TEGRA_AES_SECURE_DEST_ADDR 0x1100 29f1df57d02a0f83e764b4dc9187f58665d70f190eVarun Wadekar#define TEGRA_AES_SECURE_INPUT_SELECT 0x1104 30f1df57d02a0f83e764b4dc9187f58665d70f190eVarun Wadekar#define TEGRA_AES_SECURE_CONFIG 0x1108 31f1df57d02a0f83e764b4dc9187f58665d70f190eVarun Wadekar#define TEGRA_AES_SECURE_CONFIG_EXT 0x110C 32f1df57d02a0f83e764b4dc9187f58665d70f190eVarun Wadekar#define TEGRA_AES_SECURE_SECURITY 0x1110 33f1df57d02a0f83e764b4dc9187f58665d70f190eVarun Wadekar#define TEGRA_AES_SECURE_HASH_RESULT0 0x1120 34f1df57d02a0f83e764b4dc9187f58665d70f190eVarun Wadekar#define TEGRA_AES_SECURE_HASH_RESULT1 0x1124 35f1df57d02a0f83e764b4dc9187f58665d70f190eVarun Wadekar#define TEGRA_AES_SECURE_HASH_RESULT2 0x1128 36f1df57d02a0f83e764b4dc9187f58665d70f190eVarun Wadekar#define TEGRA_AES_SECURE_HASH_RESULT3 0x112C 37f1df57d02a0f83e764b4dc9187f58665d70f190eVarun Wadekar#define TEGRA_AES_SECURE_SEC_SEL0 0x1140 38f1df57d02a0f83e764b4dc9187f58665d70f190eVarun Wadekar#define TEGRA_AES_SECURE_SEC_SEL1 0x1144 39f1df57d02a0f83e764b4dc9187f58665d70f190eVarun Wadekar#define TEGRA_AES_SECURE_SEC_SEL2 0x1148 40f1df57d02a0f83e764b4dc9187f58665d70f190eVarun Wadekar#define TEGRA_AES_SECURE_SEC_SEL3 0x114C 41f1df57d02a0f83e764b4dc9187f58665d70f190eVarun Wadekar#define TEGRA_AES_SECURE_SEC_SEL4 0x1150 42f1df57d02a0f83e764b4dc9187f58665d70f190eVarun Wadekar#define TEGRA_AES_SECURE_SEC_SEL5 0x1154 43f1df57d02a0f83e764b4dc9187f58665d70f190eVarun Wadekar#define TEGRA_AES_SECURE_SEC_SEL6 0x1158 44f1df57d02a0f83e764b4dc9187f58665d70f190eVarun Wadekar#define TEGRA_AES_SECURE_SEC_SEL7 0x115C 45f1df57d02a0f83e764b4dc9187f58665d70f190eVarun Wadekar 46f1df57d02a0f83e764b4dc9187f58665d70f190eVarun Wadekar/* interrupt status reg masks and shifts */ 47f1df57d02a0f83e764b4dc9187f58665d70f190eVarun Wadekar#define TEGRA_AES_ENGINE_BUSY_FIELD BIT(0) 48f1df57d02a0f83e764b4dc9187f58665d70f190eVarun Wadekar#define TEGRA_AES_ICQ_EMPTY_FIELD BIT(3) 49f1df57d02a0f83e764b4dc9187f58665d70f190eVarun Wadekar#define TEGRA_AES_DMA_BUSY_FIELD BIT(23) 50f1df57d02a0f83e764b4dc9187f58665d70f190eVarun Wadekar 51f1df57d02a0f83e764b4dc9187f58665d70f190eVarun Wadekar/* secure select reg masks and shifts */ 52f1df57d02a0f83e764b4dc9187f58665d70f190eVarun Wadekar#define TEGRA_AES_SECURE_SEL0_KEYREAD_ENB0_FIELD BIT(0) 53f1df57d02a0f83e764b4dc9187f58665d70f190eVarun Wadekar 54f1df57d02a0f83e764b4dc9187f58665d70f190eVarun Wadekar/* secure config ext masks and shifts */ 55f1df57d02a0f83e764b4dc9187f58665d70f190eVarun Wadekar#define TEGRA_AES_SECURE_KEY_SCH_DIS_FIELD BIT(15) 56f1df57d02a0f83e764b4dc9187f58665d70f190eVarun Wadekar 57f1df57d02a0f83e764b4dc9187f58665d70f190eVarun Wadekar/* secure config masks and shifts */ 58f1df57d02a0f83e764b4dc9187f58665d70f190eVarun Wadekar#define TEGRA_AES_SECURE_KEY_INDEX_SHIFT 20 59f1df57d02a0f83e764b4dc9187f58665d70f190eVarun Wadekar#define TEGRA_AES_SECURE_KEY_INDEX_FIELD (0x1F << TEGRA_AES_SECURE_KEY_INDEX_SHIFT) 60f1df57d02a0f83e764b4dc9187f58665d70f190eVarun Wadekar#define TEGRA_AES_SECURE_BLOCK_CNT_SHIFT 0 61f1df57d02a0f83e764b4dc9187f58665d70f190eVarun Wadekar#define TEGRA_AES_SECURE_BLOCK_CNT_FIELD (0xFFFFF << TEGRA_AES_SECURE_BLOCK_CNT_SHIFT) 62f1df57d02a0f83e764b4dc9187f58665d70f190eVarun Wadekar 63f1df57d02a0f83e764b4dc9187f58665d70f190eVarun Wadekar/* stream interface select masks and shifts */ 64f1df57d02a0f83e764b4dc9187f58665d70f190eVarun Wadekar#define TEGRA_AES_CMDQ_CTRL_UCMDQEN_FIELD BIT(0) 65f1df57d02a0f83e764b4dc9187f58665d70f190eVarun Wadekar#define TEGRA_AES_CMDQ_CTRL_ICMDQEN_FIELD BIT(1) 66f1df57d02a0f83e764b4dc9187f58665d70f190eVarun Wadekar#define TEGRA_AES_CMDQ_CTRL_SRC_STM_SEL_FIELD BIT(4) 67f1df57d02a0f83e764b4dc9187f58665d70f190eVarun Wadekar#define TEGRA_AES_CMDQ_CTRL_DST_STM_SEL_FIELD BIT(5) 68f1df57d02a0f83e764b4dc9187f58665d70f190eVarun Wadekar 69f1df57d02a0f83e764b4dc9187f58665d70f190eVarun Wadekar/* config register masks and shifts */ 70f1df57d02a0f83e764b4dc9187f58665d70f190eVarun Wadekar#define TEGRA_AES_CONFIG_ENDIAN_ENB_FIELD BIT(10) 71f1df57d02a0f83e764b4dc9187f58665d70f190eVarun Wadekar#define TEGRA_AES_CONFIG_MODE_SEL_SHIFT 0 72f1df57d02a0f83e764b4dc9187f58665d70f190eVarun Wadekar#define TEGRA_AES_CONFIG_MODE_SEL_FIELD (0x1F << TEGRA_AES_CONFIG_MODE_SEL_SHIFT) 73f1df57d02a0f83e764b4dc9187f58665d70f190eVarun Wadekar 74f1df57d02a0f83e764b4dc9187f58665d70f190eVarun Wadekar/* extended config */ 75f1df57d02a0f83e764b4dc9187f58665d70f190eVarun Wadekar#define TEGRA_AES_SECURE_OFFSET_CNT_SHIFT 24 76f1df57d02a0f83e764b4dc9187f58665d70f190eVarun Wadekar#define TEGRA_AES_SECURE_OFFSET_CNT_FIELD (0xFF << TEGRA_AES_SECURE_OFFSET_CNT_SHIFT) 77f1df57d02a0f83e764b4dc9187f58665d70f190eVarun Wadekar#define TEGRA_AES_SECURE_KEYSCHED_GEN_FIELD BIT(15) 78f1df57d02a0f83e764b4dc9187f58665d70f190eVarun Wadekar 79f1df57d02a0f83e764b4dc9187f58665d70f190eVarun Wadekar/* init vector select */ 80f1df57d02a0f83e764b4dc9187f58665d70f190eVarun Wadekar#define TEGRA_AES_SECURE_IV_SELECT_SHIFT 10 81f1df57d02a0f83e764b4dc9187f58665d70f190eVarun Wadekar#define TEGRA_AES_SECURE_IV_SELECT_FIELD BIT(10) 82f1df57d02a0f83e764b4dc9187f58665d70f190eVarun Wadekar 83f1df57d02a0f83e764b4dc9187f58665d70f190eVarun Wadekar/* secure engine input */ 84f1df57d02a0f83e764b4dc9187f58665d70f190eVarun Wadekar#define TEGRA_AES_SECURE_INPUT_ALG_SEL_SHIFT 28 85f1df57d02a0f83e764b4dc9187f58665d70f190eVarun Wadekar#define TEGRA_AES_SECURE_INPUT_ALG_SEL_FIELD (0xF << TEGRA_AES_SECURE_INPUT_ALG_SEL_SHIFT) 86f1df57d02a0f83e764b4dc9187f58665d70f190eVarun Wadekar#define TEGRA_AES_SECURE_INPUT_KEY_LEN_SHIFT 16 87f1df57d02a0f83e764b4dc9187f58665d70f190eVarun Wadekar#define TEGRA_AES_SECURE_INPUT_KEY_LEN_FIELD (0xFFF << TEGRA_AES_SECURE_INPUT_KEY_LEN_SHIFT) 88f1df57d02a0f83e764b4dc9187f58665d70f190eVarun Wadekar#define TEGRA_AES_SECURE_RNG_ENB_FIELD BIT(11) 89f1df57d02a0f83e764b4dc9187f58665d70f190eVarun Wadekar#define TEGRA_AES_SECURE_CORE_SEL_SHIFT 9 90f1df57d02a0f83e764b4dc9187f58665d70f190eVarun Wadekar#define TEGRA_AES_SECURE_CORE_SEL_FIELD BIT(9) 91f1df57d02a0f83e764b4dc9187f58665d70f190eVarun Wadekar#define TEGRA_AES_SECURE_VCTRAM_SEL_SHIFT 7 92f1df57d02a0f83e764b4dc9187f58665d70f190eVarun Wadekar#define TEGRA_AES_SECURE_VCTRAM_SEL_FIELD (0x3 << TEGRA_AES_SECURE_VCTRAM_SEL_SHIFT) 93f1df57d02a0f83e764b4dc9187f58665d70f190eVarun Wadekar#define TEGRA_AES_SECURE_INPUT_SEL_SHIFT 5 94f1df57d02a0f83e764b4dc9187f58665d70f190eVarun Wadekar#define TEGRA_AES_SECURE_INPUT_SEL_FIELD (0x3 << TEGRA_AES_SECURE_INPUT_SEL_SHIFT) 95f1df57d02a0f83e764b4dc9187f58665d70f190eVarun Wadekar#define TEGRA_AES_SECURE_XOR_POS_SHIFT 3 96f1df57d02a0f83e764b4dc9187f58665d70f190eVarun Wadekar#define TEGRA_AES_SECURE_XOR_POS_FIELD (0x3 << TEGRA_AES_SECURE_XOR_POS_SHIFT) 97f1df57d02a0f83e764b4dc9187f58665d70f190eVarun Wadekar#define TEGRA_AES_SECURE_HASH_ENB_FIELD BIT(2) 98f1df57d02a0f83e764b4dc9187f58665d70f190eVarun Wadekar#define TEGRA_AES_SECURE_ON_THE_FLY_FIELD BIT(0) 99f1df57d02a0f83e764b4dc9187f58665d70f190eVarun Wadekar 100f1df57d02a0f83e764b4dc9187f58665d70f190eVarun Wadekar/* interrupt error mask */ 101f1df57d02a0f83e764b4dc9187f58665d70f190eVarun Wadekar#define TEGRA_AES_INT_ERROR_MASK 0xFFF000 102f1df57d02a0f83e764b4dc9187f58665d70f190eVarun Wadekar 103f1df57d02a0f83e764b4dc9187f58665d70f190eVarun Wadekar#endif 104