| 1 | |
| 2 | * Copyright 2019 Advanced Micro Devices, Inc.
|
| 3 | *
|
| 4 | * Permission is hereby granted, free of charge, to any person obtaining a
|
| 5 | * copy of this software and associated documentation files (the "Software"),
|
| 6 | * to deal in the Software without restriction, including without limitation
|
| 7 | * the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
| 8 | * and/or sell copies of the Software, and to permit persons to whom the
|
| 9 | * Software is furnished to do so, subject to the following conditions:
|
| 10 | *
|
| 11 | * The above copyright notice and this permission notice shall be included in
|
| 12 | * all copies or substantial portions of the Software.
|
| 13 | *
|
| 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
| 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
| 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
| 17 | * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
| 18 | * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
| 19 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
| 20 | * OTHER DEALINGS IN THE SOFTWARE.
|
| 21 | *
|
| 22 |
|
| 23 |
|
| 24 | #ifndef _TA_SECUREDISPLAY_IF_H
|
| 25 | #define _TA_SECUREDISPLAY_IF_H
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 | |
| 31 | * Secure Display Command ID
|
| 32 |
|
| 33 | enum ta_securedisplay_command {
|
| 34 |
|
| 35 | TA_SECUREDISPLAY_COMMAND__QUERY_TA = 1,
|
| 36 |
|
| 37 | TA_SECUREDISPLAY_COMMAND__SEND_ROI_CRC = 2,
|
| 38 |
|
| 39 | TA_SECUREDISPLAY_COMMAND__SEND_ROI_CRC_V2 = 3,
|
| 40 |
|
| 41 | TA_SECUREDISPLAY_COMMAND__MAX_ID = 0x7FFFFFFF,
|
| 42 | };
|
| 43 |
|
| 44 | |
| 45 | * Secure Display status returns in shared buffer status
|
| 46 |
|
| 47 | enum ta_securedisplay_status {
|
| 48 | TA_SECUREDISPLAY_STATUS__SUCCESS = 0x00,
|
| 49 | TA_SECUREDISPLAY_STATUS__GENERIC_FAILURE = 0x01,
|
| 50 | TA_SECUREDISPLAY_STATUS__INVALID_PARAMETER = 0x02,
|
| 51 | TA_SECUREDISPLAY_STATUS__NULL_POINTER = 0x03,
|
| 52 | TA_SECUREDISPLAY_STATUS__I2C_WRITE_ERROR = 0x04,
|
| 53 | TA_SECUREDISPLAY_STATUS__READ_DIO_SCRATCH_ERROR = 0x05,
|
| 54 | TA_SECUREDISPLAY_STATUS__READ_CRC_ERROR = 0x06,
|
| 55 | TA_SECUREDISPLAY_STATUS__I2C_INIT_ERROR = 0x07,
|
| 56 |
|
| 57 | TA_SECUREDISPLAY_STATUS__MAX = 0x7FFFFFFF,
|
| 58 | };
|
| 59 |
|
| 60 | |
| 61 | * Physical ID number to use for reading corresponding DIO Scratch register for ROI
|
| 62 |
|
| 63 | enum ta_securedisplay_phy_ID {
|
| 64 | TA_SECUREDISPLAY_PHY0 = 0,
|
| 65 | TA_SECUREDISPLAY_PHY1 = 1,
|
| 66 | TA_SECUREDISPLAY_PHY2 = 2,
|
| 67 | TA_SECUREDISPLAY_PHY3 = 3,
|
| 68 | TA_SECUREDISPLAY_MAX_PHY = 4,
|
| 69 | };
|
| 70 |
|
| 71 | |
| 72 | * A predefined specific reteurn value which is 0xAB only used to validate
|
| 73 | * communication to Secure Display TA is functional.
|
| 74 | * This value is used to validate whether TA is responding successfully
|
| 75 |
|
| 76 | enum ta_securedisplay_ta_query_cmd_ret {
|
| 77 |
|
| 78 | TA_SECUREDISPLAY_QUERY_CMD_RET = 0xAB,
|
| 79 | };
|
| 80 |
|
| 81 | |
| 82 | * I2C Buffer size which contains 8 bytes of ROI (X start, X end, Y start, Y end)
|
| 83 | * and 6 bytes of CRC( R,G,B) and 1 byte for physical ID
|
| 84 |
|
| 85 | enum ta_securedisplay_buffer_size {
|
| 86 |
|
| 87 | TA_SECUREDISPLAY_I2C_BUFFER_SIZE = 15,
|
| 88 |
|
| 89 | TA_SECUREDISPLAY_V2_I2C_BUFFER_SIZE = 16,
|
| 90 | };
|
| 91 |
|
| 92 |
|
| 93 |
|
| 94 | |
| 95 | * Input structures
|
| 96 |
|
| 97 |
|
| 98 | |
| 99 | * Physical ID to determine which DIO scratch register should be used to get ROI
|
| 100 |
|
| 101 | struct ta_securedisplay_send_roi_crc_input {
|
| 102 |
|
| 103 | uint32_t phy_id;
|
| 104 | };
|
| 105 |
|
| 106 | struct ta_securedisplay_send_roi_crc_v2_input {
|
| 107 |
|
| 108 | uint32_t phy_id;
|
| 109 |
|
| 110 | uint8_t roi_idx;
|
| 111 | };
|
| 112 |
|
| 113 | |
| 114 | * Input buffer
|
| 115 |
|
| 116 | union ta_securedisplay_cmd_input {
|
| 117 |
|
| 118 | struct ta_securedisplay_send_roi_crc_input send_roi_crc;
|
| 119 |
|
| 120 | struct ta_securedisplay_send_roi_crc_v2_input send_roi_crc_v2;
|
| 121 | uint32_t reserved[4];
|
| 122 | };
|
| 123 |
|
| 124 | |
| 125 | * Output structures
|
| 126 |
|
| 127 |
|
| 128 | |
| 129 | * Output buffer format for query TA whether TA is responding used only for validation purpose
|
| 130 |
|
| 131 | struct ta_securedisplay_query_ta_output {
|
| 132 |
|
| 133 | uint32_t query_cmd_ret;
|
| 134 | };
|
| 135 |
|
| 136 | |
| 137 | * Output buffer format for send ROI CRC command which will pass I2c buffer created inside TA
|
| 138 | * and used to write to I2C used only for validation purpose
|
| 139 |
|
| 140 | struct ta_securedisplay_send_roi_crc_output {
|
| 141 | uint8_t i2c_buf[TA_SECUREDISPLAY_I2C_BUFFER_SIZE];
|
| 142 | uint8_t reserved;
|
| 143 | };
|
| 144 |
|
| 145 | struct ta_securedisplay_send_roi_crc_v2_output {
|
| 146 | uint8_t i2c_buf[TA_SECUREDISPLAY_V2_I2C_BUFFER_SIZE];
|
| 147 | };
|
| 148 |
|
| 149 | |
| 150 | * Output buffer
|
| 151 |
|
| 152 | union ta_securedisplay_cmd_output {
|
| 153 |
|
| 154 | struct ta_securedisplay_query_ta_output query_ta;
|
| 155 |
|
| 156 | struct ta_securedisplay_send_roi_crc_output send_roi_crc;
|
| 157 |
|
| 158 | struct ta_securedisplay_send_roi_crc_v2_output send_roi_crc_v2;
|
| 159 | uint32_t reserved[4];
|
| 160 | };
|
| 161 |
|
| 162 | |
| 163 | * Secure display command which is shared buffer memory
|
| 164 |
|
| 165 | struct ta_securedisplay_cmd {
|
| 166 | uint32_t cmd_id;
|
| 167 | enum ta_securedisplay_status status;
|
| 168 | uint32_t reserved[2];
|
| 169 | union ta_securedisplay_cmd_input securedisplay_in_message;
|
| 170 | union ta_securedisplay_cmd_output securedisplay_out_message;
|
| 171 |
|
| 172 | };
|
| 173 |
|
| 174 | #endif |
| 175 |
|