Back to home page

OSCL-LXR

 
 

    


0001 /*
0002  * Copyright 2019 Advanced Micro Devices, Inc.
0003  *
0004  * Permission is hereby granted, free of charge, to any person obtaining a
0005  * copy of this software and associated documentation files (the "Software"),
0006  * to deal in the Software without restriction, including without limitation
0007  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
0008  * and/or sell copies of the Software, and to permit persons to whom the
0009  * Software is furnished to do so, subject to the following conditions:
0010  *
0011  * The above copyright notice and this permission notice shall be included in
0012  * all copies or substantial portions of the Software.
0013  *
0014  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
0015  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
0016  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
0017  * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
0018  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
0019  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
0020  * OTHER DEALINGS IN THE SOFTWARE.
0021  *
0022  */
0023 
0024 #ifndef _TA_SECUREDISPLAY_IF_H
0025 #define _TA_SECUREDISPLAY_IF_H
0026 
0027 /** Secure Display related enumerations */
0028 /**********************************************************/
0029 
0030 /** @enum ta_securedisplay_command
0031  *    Secure Display Command ID
0032  */
0033 enum ta_securedisplay_command {
0034     /* Query whether TA is responding used only for validation purpose */
0035     TA_SECUREDISPLAY_COMMAND__QUERY_TA              = 1,
0036     /* Send region of Interest and CRC value to I2C */
0037     TA_SECUREDISPLAY_COMMAND__SEND_ROI_CRC          = 2,
0038     /* Maximum Command ID */
0039     TA_SECUREDISPLAY_COMMAND__MAX_ID                = 0x7FFFFFFF,
0040 };
0041 
0042 /** @enum ta_securedisplay_status
0043  *    Secure Display status returns in shared buffer status
0044  */
0045 enum ta_securedisplay_status {
0046     TA_SECUREDISPLAY_STATUS__SUCCESS                 = 0x00,         /* Success */
0047     TA_SECUREDISPLAY_STATUS__GENERIC_FAILURE         = 0x01,         /* Generic Failure */
0048     TA_SECUREDISPLAY_STATUS__INVALID_PARAMETER       = 0x02,         /* Invalid Parameter */
0049     TA_SECUREDISPLAY_STATUS__NULL_POINTER            = 0x03,         /* Null Pointer*/
0050     TA_SECUREDISPLAY_STATUS__I2C_WRITE_ERROR         = 0x04,         /* Fail to Write to I2C */
0051     TA_SECUREDISPLAY_STATUS__READ_DIO_SCRATCH_ERROR  = 0x05, /*Fail Read DIO Scratch Register*/
0052     TA_SECUREDISPLAY_STATUS__READ_CRC_ERROR          = 0x06,         /* Fail to Read CRC*/
0053     TA_SECUREDISPLAY_STATUS__I2C_INIT_ERROR          = 0x07,     /* Failed to initialize I2C */
0054 
0055     TA_SECUREDISPLAY_STATUS__MAX                     = 0x7FFFFFFF,/* Maximum Value for status*/
0056 };
0057 
0058 /** @enum ta_securedisplay_max_phy
0059  *    Physical ID number to use for reading corresponding DIO Scratch register for ROI
0060  */
0061 enum  ta_securedisplay_max_phy {
0062     TA_SECUREDISPLAY_PHY0                           = 0,
0063     TA_SECUREDISPLAY_PHY1                           = 1,
0064     TA_SECUREDISPLAY_PHY2                           = 2,
0065     TA_SECUREDISPLAY_PHY3                           = 3,
0066     TA_SECUREDISPLAY_MAX_PHY                        = 4,
0067 };
0068 
0069 /** @enum ta_securedisplay_ta_query_cmd_ret
0070  *    A predefined specific reteurn value which is 0xAB only used to validate
0071  *    communication to Secure Display TA is functional.
0072  *    This value is used to validate whether TA is responding successfully
0073  */
0074 enum ta_securedisplay_ta_query_cmd_ret {
0075     /* This is a value to validate if TA is loaded successfully */
0076     TA_SECUREDISPLAY_QUERY_CMD_RET                 = 0xAB,
0077 };
0078 
0079 /** @enum ta_securedisplay_buffer_size
0080  *    I2C Buffer size which contains 8 bytes of ROI  (X start, X end, Y start, Y end)
0081  *    and 6 bytes of CRC( R,G,B) and 1  byte for physical ID
0082  */
0083 enum ta_securedisplay_buffer_size {
0084     /* 15 bytes = 8 byte (ROI) + 6 byte(CRC) + 1 byte(phy_id) */
0085     TA_SECUREDISPLAY_I2C_BUFFER_SIZE                = 15,
0086 };
0087 
0088 /** Input/output structures for Secure Display commands */
0089 /**********************************************************/
0090 /**
0091  * Input structures
0092  */
0093 
0094 /** @struct ta_securedisplay_send_roi_crc_input
0095  *    Physical ID to determine which DIO scratch register should be used to get ROI
0096  */
0097 struct ta_securedisplay_send_roi_crc_input {
0098     uint32_t  phy_id;  /* Physical ID */
0099 };
0100 
0101 /** @union ta_securedisplay_cmd_input
0102  *    Input buffer
0103  */
0104 union ta_securedisplay_cmd_input {
0105     /* send ROI and CRC input buffer format */
0106     struct ta_securedisplay_send_roi_crc_input        send_roi_crc;
0107     uint32_t                                          reserved[4];
0108 };
0109 
0110 /**
0111  * Output structures
0112  */
0113 
0114 /** @struct ta_securedisplay_query_ta_output
0115  *  Output buffer format for query TA whether TA is responding used only for validation purpose
0116  */
0117 struct ta_securedisplay_query_ta_output {
0118     /* return value from TA when it is queried for validation purpose only */
0119     uint32_t  query_cmd_ret;
0120 };
0121 
0122 /** @struct ta_securedisplay_send_roi_crc_output
0123  *  Output buffer format for send ROI CRC command which will pass I2c buffer created inside TA
0124  *  and used to write to I2C used only for validation purpose
0125  */
0126 struct ta_securedisplay_send_roi_crc_output {
0127     uint8_t  i2c_buf[TA_SECUREDISPLAY_I2C_BUFFER_SIZE];  /* I2C buffer */
0128     uint8_t  reserved;
0129 };
0130 
0131 /** @union ta_securedisplay_cmd_output
0132  *    Output buffer
0133  */
0134 union ta_securedisplay_cmd_output {
0135     /* Query TA output buffer format used only for validation purpose*/
0136     struct ta_securedisplay_query_ta_output            query_ta;
0137     /* Send ROI CRC output buffer format used only for validation purpose */
0138     struct ta_securedisplay_send_roi_crc_output        send_roi_crc;
0139     uint32_t                                           reserved[4];
0140 };
0141 
0142 /** @struct securedisplay_cmd
0143  *    Secure Display Command which is shared buffer memory
0144  */
0145 struct securedisplay_cmd {
0146     uint32_t                             cmd_id;                    /* +0  Bytes Command ID */
0147     enum ta_securedisplay_status         status;     /* +4  Bytes Status of Secure Display TA */
0148     uint32_t                             reserved[2];               /* +8  Bytes Reserved */
0149     union ta_securedisplay_cmd_input     securedisplay_in_message;  /* +16 Bytes Input Buffer */
0150     union ta_securedisplay_cmd_output    securedisplay_out_message;/* +32 Bytes Output Buffer */
0151     /**@note Total 48 Bytes */
0152 };
0153 
0154 #endif   //_TA_SECUREDISPLAY_IF_H
0155