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 /** Secure Display related enumerations */ 28 /**********************************************************/ 29 30 /** @enum ta_securedisplay_command 31 * Secure Display Command ID 32 */ 33 enum ta_securedisplay_command { 34 /* Query whether TA is responding used only for validation purpose */ 35 TA_SECUREDISPLAY_COMMAND__QUERY_TA = 1, 36 /* Send region of Interest and CRC value to I2C */ 37 TA_SECUREDISPLAY_COMMAND__SEND_ROI_CRC = 2, 38 /* Maximum Command ID */ 39 TA_SECUREDISPLAY_COMMAND__MAX_ID = 0x7FFFFFFF, 40 }; 41 42 /** @enum ta_securedisplay_status 43 * Secure Display status returns in shared buffer status 44 */ 45 enum ta_securedisplay_status { 46 TA_SECUREDISPLAY_STATUS__SUCCESS = 0x00, /* Success */ 47 TA_SECUREDISPLAY_STATUS__GENERIC_FAILURE = 0x01, /* Generic Failure */ 48 TA_SECUREDISPLAY_STATUS__INVALID_PARAMETER = 0x02, /* Invalid Parameter */ 49 TA_SECUREDISPLAY_STATUS__NULL_POINTER = 0x03, /* Null Pointer*/ 50 TA_SECUREDISPLAY_STATUS__I2C_WRITE_ERROR = 0x04, /* Fail to Write to I2C */ 51 TA_SECUREDISPLAY_STATUS__READ_DIO_SCRATCH_ERROR = 0x05, /*Fail Read DIO Scratch Register*/ 52 TA_SECUREDISPLAY_STATUS__READ_CRC_ERROR = 0x06, /* Fail to Read CRC*/ 53 54 TA_SECUREDISPLAY_STATUS__MAX = 0x7FFFFFFF,/* Maximum Value for status*/ 55 }; 56 57 /** @enum ta_securedisplay_max_phy 58 * Physical ID number to use for reading corresponding DIO Scratch register for ROI 59 */ 60 enum ta_securedisplay_max_phy { 61 TA_SECUREDISPLAY_PHY0 = 0, 62 TA_SECUREDISPLAY_PHY1 = 1, 63 TA_SECUREDISPLAY_PHY2 = 2, 64 TA_SECUREDISPLAY_PHY3 = 3, 65 TA_SECUREDISPLAY_MAX_PHY = 4, 66 }; 67 68 /** @enum ta_securedisplay_ta_query_cmd_ret 69 * A predefined specific reteurn value which is 0xAB only used to validate 70 * communication to Secure Display TA is functional. 71 * This value is used to validate whether TA is responding successfully 72 */ 73 enum ta_securedisplay_ta_query_cmd_ret { 74 /* This is a value to validate if TA is loaded successfully */ 75 TA_SECUREDISPLAY_QUERY_CMD_RET = 0xAB, 76 }; 77 78 /** @enum ta_securedisplay_buffer_size 79 * I2C Buffer size which contains 8 bytes of ROI (X start, X end, Y start, Y end) 80 * and 6 bytes of CRC( R,G,B) and 1 byte for physical ID 81 */ 82 enum ta_securedisplay_buffer_size { 83 /* 15 bytes = 8 byte (ROI) + 6 byte(CRC) + 1 byte(phy_id) */ 84 TA_SECUREDISPLAY_I2C_BUFFER_SIZE = 15, 85 }; 86 87 /** Input/output structures for Secure Display commands */ 88 /**********************************************************/ 89 /** 90 * Input structures 91 */ 92 93 /** @struct ta_securedisplay_send_roi_crc_input 94 * Physical ID to determine which DIO scratch register should be used to get ROI 95 */ 96 struct ta_securedisplay_send_roi_crc_input { 97 uint32_t phy_id; /* Physical ID */ 98 }; 99 100 /** @union ta_securedisplay_cmd_input 101 * Input buffer 102 */ 103 union ta_securedisplay_cmd_input { 104 /* send ROI and CRC input buffer format */ 105 struct ta_securedisplay_send_roi_crc_input send_roi_crc; 106 uint32_t reserved[4]; 107 }; 108 109 /** 110 * Output structures 111 */ 112 113 /** @struct ta_securedisplay_query_ta_output 114 * Output buffer format for query TA whether TA is responding used only for validation purpose 115 */ 116 struct ta_securedisplay_query_ta_output { 117 /* return value from TA when it is queried for validation purpose only */ 118 uint32_t query_cmd_ret; 119 }; 120 121 /** @struct ta_securedisplay_send_roi_crc_output 122 * Output buffer format for send ROI CRC command which will pass I2c buffer created inside TA 123 * and used to write to I2C used only for validation purpose 124 */ 125 struct ta_securedisplay_send_roi_crc_output { 126 uint8_t i2c_buf[TA_SECUREDISPLAY_I2C_BUFFER_SIZE]; /* I2C buffer */ 127 uint8_t reserved; 128 }; 129 130 /** @union ta_securedisplay_cmd_output 131 * Output buffer 132 */ 133 union ta_securedisplay_cmd_output { 134 /* Query TA output buffer format used only for validation purpose*/ 135 struct ta_securedisplay_query_ta_output query_ta; 136 /* Send ROI CRC output buffer format used only for validation purpose */ 137 struct ta_securedisplay_send_roi_crc_output send_roi_crc; 138 uint32_t reserved[4]; 139 }; 140 141 /** @struct securedisplay_cmd 142 * Secure Display Command which is shared buffer memory 143 */ 144 struct securedisplay_cmd { 145 uint32_t cmd_id; /* +0 Bytes Command ID */ 146 enum ta_securedisplay_status status; /* +4 Bytes Status of Secure Display TA */ 147 uint32_t reserved[2]; /* +8 Bytes Reserved */ 148 union ta_securedisplay_cmd_input securedisplay_in_message; /* +16 Bytes Input Buffer */ 149 union ta_securedisplay_cmd_output securedisplay_out_message;/* +32 Bytes Output Buffer */ 150 /**@note Total 48 Bytes */ 151 }; 152 153 #endif //_TA_SECUREDISPLAY_IF_H 154 155