diff options
| author | Anuj Gangwar <anujg@nvidia.com> | 2018-11-22 22:55:19 -0500 |
|---|---|---|
| committer | mobile promotions <svcmobile_promotions@nvidia.com> | 2019-05-07 14:48:49 -0400 |
| commit | 065e0fc7cd11c8cc2d5a2be35e0e3e68cfae6427 (patch) | |
| tree | 8401e82c937fd9de1f4ab3bbbe57518e5a94243f /include/linux | |
| parent | 524b0e580ae235ba89738418b4a623825bccae3d (diff) | |
include: uapi: move linux user-interface headers
Move the linux tegra_cpc user-interface headers from
include/linux/ to include/uapi/linux/
Change the path for above headers in the dependent files.
Bug 2062672
Change-Id: I674909f3188a746f3283b2e92296d9c18a2e767c
Signed-off-by: Anuj Gangwar <anujg@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1956560
(cherry picked from commit 1373b074d8a76869e143337caeba5d42d213e43f)
Reviewed-on: https://git-master.nvidia.com/r/2109985
Reviewed-by: Bibek Basu <bbasu@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/tegra_cpc.h | 173 |
1 files changed, 0 insertions, 173 deletions
diff --git a/include/linux/tegra_cpc.h b/include/linux/tegra_cpc.h deleted file mode 100644 index 84668c595..000000000 --- a/include/linux/tegra_cpc.h +++ /dev/null | |||
| @@ -1,173 +0,0 @@ | |||
| 1 | /* | ||
| 2 | * tegra_cpc.c - Access CPC storage blocks through i2c bus | ||
| 3 | * | ||
| 4 | * Copyright (c) 2014-2016, NVIDIA CORPORATION. All rights reserved. | ||
| 5 | * | ||
| 6 | * This software is licensed under the terms of the GNU General Public | ||
| 7 | * License version 2, as published by the Free Software Foundation, and | ||
| 8 | * may be copied, distributed, and modified under those terms. | ||
| 9 | * | ||
| 10 | * This program is distributed in the hope that it will be useful, | ||
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 13 | * GNU General Public License for more details. | ||
| 14 | */ | ||
| 15 | |||
| 16 | #ifndef _TEGRA_CPC_H | ||
| 17 | #define _TEGRA_CPC_H | ||
| 18 | |||
| 19 | #include <linux/ioctl.h> | ||
| 20 | #include <linux/types.h> | ||
| 21 | |||
| 22 | enum req_resp_t { | ||
| 23 | CPC_READ_M_COUNT = 0x2, | ||
| 24 | CPC_WRITE_FRAME, | ||
| 25 | CPC_READ_FRAME, | ||
| 26 | CPC_GET_RESULT = 0x5, | ||
| 27 | CPC_GET_VERSION = 0x6, | ||
| 28 | }; | ||
| 29 | |||
| 30 | enum result_t { | ||
| 31 | CPC_RESULT_OK = 0x0, | ||
| 32 | CPC_RESULT_GENERAL_FAILURE, | ||
| 33 | CPC_RESULT_AUTH_FAILURE, | ||
| 34 | CPC_RESULT_COUNTER_FAILURE, | ||
| 35 | CPC_RESULT_ADDR_FAILURE, | ||
| 36 | CPC_RESULT_WRITE_FAILURE = 0x5, | ||
| 37 | CPC_RESULT_READ_FAILURE, | ||
| 38 | CPC_RESULT_UNKNOWN_REQUEST, | ||
| 39 | CPC_RESULT_KEY_PROG_SEQ_FAILURE, | ||
| 40 | CPC_RESULT_KEY_PROG_PG_CORRUPT, | ||
| 41 | CPC_RESULT_KEY_PROG_DONE_PRIOR = 0xA, | ||
| 42 | CPC_RESULT_DATA_LENGTH_MISMATCH, | ||
| 43 | CPC_RESULT_UNEXPECTED_CONDITION, | ||
| 44 | CPC_RESULT_CONTROLLER_BUSY | ||
| 45 | }; | ||
| 46 | |||
| 47 | #define CPC_MAX_DATA_SIZE 48 | ||
| 48 | #define CPC_KEY_SIZE 32 | ||
| 49 | #define CPC_HMAC_SIZE 32 | ||
| 50 | #define CPC_DERIVATION_SIZE 28 | ||
| 51 | #define CPC_NONCE_SIZE 4 | ||
| 52 | #define CPC_COUNTER_SIZE 4 | ||
| 53 | #define CPC_MAJOR_VER_SIZE 3 | ||
| 54 | #define CPC_MINOR_VER_SIZE 1 | ||
| 55 | |||
| 56 | /* | ||
| 57 | * CPC field description | ||
| 58 | * | ||
| 59 | * req is a command ID | ||
| 60 | * result is the status as returned by uC. If the communication to uC was | ||
| 61 | * not successful, this value will be set by the host | ||
| 62 | * len is the byte indicating how many bytes in data are valid data | ||
| 63 | * For read, this tells the kernel what is the expected size of | ||
| 64 | * data which will be returned by uC | ||
| 65 | * For write, this tells the kernel how many bytes in the data | ||
| 66 | * field are valid data. | ||
| 67 | * The range of this is 0 < n && n <= CPC_MAX_DATA_SIZE | ||
| 68 | * nonce is the counter which will be used for HMAC calculation. It is | ||
| 69 | * also used to correlate the response to the request. Host | ||
| 70 | * uses this value to match the response and the request | ||
| 71 | * write_counter | ||
| 72 | * The counter which indicates how many successful commits have | ||
| 73 | * been made by uC for the life time of uC | ||
| 74 | * data is the field which the client of uC could use to send / receive | ||
| 75 | * data which will be stored permanently by uC. | ||
| 76 | * derivation_value | ||
| 77 | * This field should be used to pass the unique data during | ||
| 78 | * read counter, which will be used for encryption later by | ||
| 79 | * both parties | ||
| 80 | * HMAC is the field which the client of uC could use to authenticate | ||
| 81 | * packets sent to and received from uC. If this field does not | ||
| 82 | * match uC's expectation, the packet will be rejected. | ||
| 83 | * HMAC is sent last tegra=>uC | ||
| 84 | * HMAC is sent first uC=>tegra | ||
| 85 | */ | ||
| 86 | |||
| 87 | /* | ||
| 88 | * Structs used for serialization and deserialization. The implementation is | ||
| 89 | * order sensitive. Any change to the struct would require a change to | ||
| 90 | * oneshot serialization / deserialization | ||
| 91 | * | ||
| 92 | * Notation: "Used for *" applies to all fields below until the end of struct | ||
| 93 | */ | ||
| 94 | |||
| 95 | struct tegra_cpc_read_counter_data { | ||
| 96 | /* Used for request */ | ||
| 97 | __u8 nonce[CPC_NONCE_SIZE]; | ||
| 98 | |||
| 99 | /* Used for response */ | ||
| 100 | __u8 write_counter[CPC_COUNTER_SIZE]; | ||
| 101 | /* Used for request */ | ||
| 102 | __u8 derivation_value[CPC_DERIVATION_SIZE]; | ||
| 103 | /* Used for response */ | ||
| 104 | __u8 hmac[CPC_HMAC_SIZE]; | ||
| 105 | } __packed; | ||
| 106 | |||
| 107 | struct tegra_cpc_write_frame_data { | ||
| 108 | /* Used for request */ | ||
| 109 | __u8 length; | ||
| 110 | __u8 nonce[CPC_NONCE_SIZE]; | ||
| 111 | __u8 write_counter[CPC_COUNTER_SIZE]; | ||
| 112 | __u8 data[CPC_MAX_DATA_SIZE]; | ||
| 113 | __u8 hmac[CPC_HMAC_SIZE]; | ||
| 114 | } __packed; | ||
| 115 | |||
| 116 | struct tegra_cpc_read_frame_data { | ||
| 117 | /* Used for request */ | ||
| 118 | __u8 length; | ||
| 119 | __u8 nonce[CPC_NONCE_SIZE]; | ||
| 120 | |||
| 121 | /* Not used by kernel or uC as of now */ | ||
| 122 | __u8 write_counter[CPC_COUNTER_SIZE]; | ||
| 123 | |||
| 124 | /* Used for response */ | ||
| 125 | __u8 data[CPC_MAX_DATA_SIZE]; | ||
| 126 | __u8 hmac[CPC_HMAC_SIZE]; | ||
| 127 | } __packed; | ||
| 128 | |||
| 129 | struct tegra_cpc_get_version_data { | ||
| 130 | /* Used for request */ | ||
| 131 | __u8 nonce[CPC_NONCE_SIZE]; | ||
| 132 | |||
| 133 | /* Used for response */ | ||
| 134 | __u8 minor_ver[CPC_MINOR_VER_SIZE]; | ||
| 135 | __u8 major_ver[CPC_MAJOR_VER_SIZE]; | ||
| 136 | } __packed; | ||
| 137 | |||
| 138 | union tegra_cpc_cmd_data { | ||
| 139 | struct tegra_cpc_read_counter_data read_counter; | ||
| 140 | struct tegra_cpc_read_frame_data read_frame; | ||
| 141 | struct tegra_cpc_write_frame_data write_frame; | ||
| 142 | struct tegra_cpc_get_version_data get_version; | ||
| 143 | }; | ||
| 144 | |||
| 145 | struct tegra_cpc_frame { | ||
| 146 | /* Used for request */ | ||
| 147 | __u8 req; | ||
| 148 | |||
| 149 | /* Used for both request and response */ | ||
| 150 | union tegra_cpc_cmd_data cmd_data; | ||
| 151 | |||
| 152 | /* Used for response of GET_STATUS */ | ||
| 153 | __u8 hmac[CPC_HMAC_SIZE]; | ||
| 154 | __u8 result; | ||
| 155 | __u8 nonce[CPC_NONCE_SIZE]; | ||
| 156 | } __packed; | ||
| 157 | |||
| 158 | #define CPC_CMD_FIELD_SIZE(target_type, field) \ | ||
| 159 | sizeof(((struct target_type *) 0)->field) | ||
| 160 | |||
| 161 | #define CPC_FIELD_SIZE(field) \ | ||
| 162 | CPC_CMD_FIELD_SIZE(struct tegra_cpc_frame, field) | ||
| 163 | |||
| 164 | #define NVCPC_IOC_MAGIC 'C' | ||
| 165 | |||
| 166 | /* | ||
| 167 | * Returns 0 if a communication with uC was successful, regardless of operation | ||
| 168 | * pass or fail. | ||
| 169 | */ | ||
| 170 | #define NVCPC_IOCTL_DO_IO _IOWR(NVCPC_IOC_MAGIC, 2, \ | ||
| 171 | struct tegra_cpc_frame) | ||
| 172 | |||
| 173 | #endif | ||
