xref: /openbsd/sys/dev/pci/drm/amd/amdgpu/ta_rap_if.h (revision ad8b1aaf)
1*ad8b1aafSjsg /*
2*ad8b1aafSjsg  * Copyright 2020 Advanced Micro Devices, Inc.
3*ad8b1aafSjsg  *
4*ad8b1aafSjsg  * Permission is hereby granted, free of charge, to any person obtaining a
5*ad8b1aafSjsg  * copy of this software and associated documentation files (the "Software"),
6*ad8b1aafSjsg  * to deal in the Software without restriction, including without limitation
7*ad8b1aafSjsg  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8*ad8b1aafSjsg  * and/or sell copies of the Software, and to permit persons to whom the
9*ad8b1aafSjsg  * Software is furnished to do so, subject to the following conditions:
10*ad8b1aafSjsg  *
11*ad8b1aafSjsg  * The above copyright notice and this permission notice shall be included in
12*ad8b1aafSjsg  * all copies or substantial portions of the Software.
13*ad8b1aafSjsg  *
14*ad8b1aafSjsg  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15*ad8b1aafSjsg  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16*ad8b1aafSjsg  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
17*ad8b1aafSjsg  * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
18*ad8b1aafSjsg  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19*ad8b1aafSjsg  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20*ad8b1aafSjsg  * OTHER DEALINGS IN THE SOFTWARE.
21*ad8b1aafSjsg  *
22*ad8b1aafSjsg  */
23*ad8b1aafSjsg 
24*ad8b1aafSjsg #ifndef _TA_RAP_IF_H
25*ad8b1aafSjsg #define _TA_RAP_IF_H
26*ad8b1aafSjsg 
27*ad8b1aafSjsg /* Responses have bit 31 set */
28*ad8b1aafSjsg #define RSP_ID_MASK (1U << 31)
29*ad8b1aafSjsg #define RSP_ID(cmdId) (((uint32_t)(cmdId)) | RSP_ID_MASK)
30*ad8b1aafSjsg 
31*ad8b1aafSjsg enum ta_rap_status {
32*ad8b1aafSjsg 	TA_RAP_STATUS__SUCCESS                              = 1,
33*ad8b1aafSjsg 	TA_RAP_STATUS__ERROR_GENERIC_FAILURE                = 2,
34*ad8b1aafSjsg 	TA_RAP_STATUS__ERROR_CMD_NOT_SUPPORTED              = 3,
35*ad8b1aafSjsg 	TA_RAP_STATUS__ERROR_INVALID_VALIDATION_METHOD      = 4,
36*ad8b1aafSjsg 	TA_RAP_STATUS__ERROR_NULL_POINTER                   = 5,
37*ad8b1aafSjsg 	TA_RAP_STATUS__ERROR_NOT_INITIALIZED                = 6,
38*ad8b1aafSjsg 	TA_RAP_STATUS__ERROR_VALIDATION_FAILED              = 7,
39*ad8b1aafSjsg 	TA_RAP_STATUS__ERROR_ASIC_NOT_SUPPORTED             = 8,
40*ad8b1aafSjsg 	TA_RAP_STATUS__ERROR_OPERATION_NOT_PERMISSABLE      = 9,
41*ad8b1aafSjsg 	TA_RAP_STATUS__ERROR_ALREADY_INIT                   = 10,
42*ad8b1aafSjsg };
43*ad8b1aafSjsg 
44*ad8b1aafSjsg enum ta_rap_cmd {
45*ad8b1aafSjsg 	TA_CMD_RAP__INITIALIZE              = 1,
46*ad8b1aafSjsg 	TA_CMD_RAP__VALIDATE_L0             = 2,
47*ad8b1aafSjsg };
48*ad8b1aafSjsg 
49*ad8b1aafSjsg enum ta_rap_validation_method {
50*ad8b1aafSjsg 	METHOD_A           = 1,
51*ad8b1aafSjsg };
52*ad8b1aafSjsg 
53*ad8b1aafSjsg struct ta_rap_cmd_input_data {
54*ad8b1aafSjsg 	uint8_t reserved[8];
55*ad8b1aafSjsg };
56*ad8b1aafSjsg 
57*ad8b1aafSjsg struct ta_rap_cmd_output_data {
58*ad8b1aafSjsg 	uint32_t    last_subsection;
59*ad8b1aafSjsg 	uint32_t    num_total_validate;
60*ad8b1aafSjsg 	uint32_t    num_valid;
61*ad8b1aafSjsg 	uint32_t    last_validate_addr;
62*ad8b1aafSjsg 	uint32_t    last_validate_val;
63*ad8b1aafSjsg 	uint32_t    last_validate_val_exptd;
64*ad8b1aafSjsg };
65*ad8b1aafSjsg 
66*ad8b1aafSjsg union ta_rap_cmd_input {
67*ad8b1aafSjsg 	struct ta_rap_cmd_input_data input;
68*ad8b1aafSjsg };
69*ad8b1aafSjsg 
70*ad8b1aafSjsg union ta_rap_cmd_output {
71*ad8b1aafSjsg 	struct ta_rap_cmd_output_data output;
72*ad8b1aafSjsg };
73*ad8b1aafSjsg 
74*ad8b1aafSjsg struct ta_rap_shared_memory {
75*ad8b1aafSjsg 	uint32_t                    cmd_id;
76*ad8b1aafSjsg 	uint32_t                    validation_method_id;
77*ad8b1aafSjsg 	uint32_t                    resp_id;
78*ad8b1aafSjsg 	enum ta_rap_status          rap_status;
79*ad8b1aafSjsg 	union ta_rap_cmd_input      rap_in_message;
80*ad8b1aafSjsg 	union ta_rap_cmd_output     rap_out_message;
81*ad8b1aafSjsg 	uint8_t                     reserved[64];
82*ad8b1aafSjsg };
83*ad8b1aafSjsg 
84*ad8b1aafSjsg #endif  // #define _TA_RAP_IF_H
85