diff options
author | Rex Zhu <Rex.Zhu@amd.com> | 2018-02-27 05:28:54 -0500 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2018-03-05 15:38:57 -0500 |
commit | 6848d73e889bb29cfede51df8c1d0496c9787454 (patch) | |
tree | f2491bfde0fea7a333dcde13c9f573136be1ee57 /drivers/gpu/drm | |
parent | e1deba285156fb4023bb48f22068de5b60e34e15 (diff) |
drm/amd/pp: Remove the wrap functions for acpi in powerplay
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm')
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c | 212 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/include/cgs_common.h | 44 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/powerplay/hwmgr/Makefile | 2 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/powerplay/hwmgr/pp_acpi.c | 114 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/powerplay/inc/pp_acpi.h | 26 |
5 files changed, 1 insertions, 397 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c index 9d6e1b08e148..795be958cf5e 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c | |||
@@ -24,7 +24,6 @@ | |||
24 | #include <linux/list.h> | 24 | #include <linux/list.h> |
25 | #include <linux/slab.h> | 25 | #include <linux/slab.h> |
26 | #include <linux/pci.h> | 26 | #include <linux/pci.h> |
27 | #include <linux/acpi.h> | ||
28 | #include <drm/drmP.h> | 27 | #include <drm/drmP.h> |
29 | #include <linux/firmware.h> | 28 | #include <linux/firmware.h> |
30 | #include <drm/amdgpu_drm.h> | 29 | #include <drm/amdgpu_drm.h> |
@@ -964,216 +963,6 @@ static int amdgpu_cgs_notify_dpm_enabled(struct cgs_device *cgs_device, bool ena | |||
964 | return 0; | 963 | return 0; |
965 | } | 964 | } |
966 | 965 | ||
967 | /** \brief evaluate acpi namespace object, handle or pathname must be valid | ||
968 | * \param cgs_device | ||
969 | * \param info input/output arguments for the control method | ||
970 | * \return status | ||
971 | */ | ||
972 | |||
973 | #if defined(CONFIG_ACPI) | ||
974 | static int amdgpu_cgs_acpi_eval_object(struct cgs_device *cgs_device, | ||
975 | struct cgs_acpi_method_info *info) | ||
976 | { | ||
977 | CGS_FUNC_ADEV; | ||
978 | acpi_handle handle; | ||
979 | struct acpi_object_list input; | ||
980 | struct acpi_buffer output = { ACPI_ALLOCATE_BUFFER, NULL }; | ||
981 | union acpi_object *params, *obj; | ||
982 | uint8_t name[5] = {'\0'}; | ||
983 | struct cgs_acpi_method_argument *argument; | ||
984 | uint32_t i, count; | ||
985 | acpi_status status; | ||
986 | int result; | ||
987 | |||
988 | handle = ACPI_HANDLE(&adev->pdev->dev); | ||
989 | if (!handle) | ||
990 | return -ENODEV; | ||
991 | |||
992 | memset(&input, 0, sizeof(struct acpi_object_list)); | ||
993 | |||
994 | /* validate input info */ | ||
995 | if (info->size != sizeof(struct cgs_acpi_method_info)) | ||
996 | return -EINVAL; | ||
997 | |||
998 | input.count = info->input_count; | ||
999 | if (info->input_count > 0) { | ||
1000 | if (info->pinput_argument == NULL) | ||
1001 | return -EINVAL; | ||
1002 | argument = info->pinput_argument; | ||
1003 | for (i = 0; i < info->input_count; i++) { | ||
1004 | if (((argument->type == ACPI_TYPE_STRING) || | ||
1005 | (argument->type == ACPI_TYPE_BUFFER)) && | ||
1006 | (argument->pointer == NULL)) | ||
1007 | return -EINVAL; | ||
1008 | argument++; | ||
1009 | } | ||
1010 | } | ||
1011 | |||
1012 | if (info->output_count > 0) { | ||
1013 | if (info->poutput_argument == NULL) | ||
1014 | return -EINVAL; | ||
1015 | argument = info->poutput_argument; | ||
1016 | for (i = 0; i < info->output_count; i++) { | ||
1017 | if (((argument->type == ACPI_TYPE_STRING) || | ||
1018 | (argument->type == ACPI_TYPE_BUFFER)) | ||
1019 | && (argument->pointer == NULL)) | ||
1020 | return -EINVAL; | ||
1021 | argument++; | ||
1022 | } | ||
1023 | } | ||
1024 | |||
1025 | /* The path name passed to acpi_evaluate_object should be null terminated */ | ||
1026 | if ((info->field & CGS_ACPI_FIELD_METHOD_NAME) != 0) { | ||
1027 | strncpy(name, (char *)&(info->name), sizeof(uint32_t)); | ||
1028 | name[4] = '\0'; | ||
1029 | } | ||
1030 | |||
1031 | /* parse input parameters */ | ||
1032 | if (input.count > 0) { | ||
1033 | input.pointer = params = | ||
1034 | kzalloc(sizeof(union acpi_object) * input.count, GFP_KERNEL); | ||
1035 | if (params == NULL) | ||
1036 | return -EINVAL; | ||
1037 | |||
1038 | argument = info->pinput_argument; | ||
1039 | |||
1040 | for (i = 0; i < input.count; i++) { | ||
1041 | params->type = argument->type; | ||
1042 | switch (params->type) { | ||
1043 | case ACPI_TYPE_INTEGER: | ||
1044 | params->integer.value = argument->value; | ||
1045 | break; | ||
1046 | case ACPI_TYPE_STRING: | ||
1047 | params->string.length = argument->data_length; | ||
1048 | params->string.pointer = argument->pointer; | ||
1049 | break; | ||
1050 | case ACPI_TYPE_BUFFER: | ||
1051 | params->buffer.length = argument->data_length; | ||
1052 | params->buffer.pointer = argument->pointer; | ||
1053 | break; | ||
1054 | default: | ||
1055 | break; | ||
1056 | } | ||
1057 | params++; | ||
1058 | argument++; | ||
1059 | } | ||
1060 | } | ||
1061 | |||
1062 | /* parse output info */ | ||
1063 | count = info->output_count; | ||
1064 | argument = info->poutput_argument; | ||
1065 | |||
1066 | /* evaluate the acpi method */ | ||
1067 | status = acpi_evaluate_object(handle, name, &input, &output); | ||
1068 | |||
1069 | if (ACPI_FAILURE(status)) { | ||
1070 | result = -EIO; | ||
1071 | goto free_input; | ||
1072 | } | ||
1073 | |||
1074 | /* return the output info */ | ||
1075 | obj = output.pointer; | ||
1076 | |||
1077 | if (count > 1) { | ||
1078 | if ((obj->type != ACPI_TYPE_PACKAGE) || | ||
1079 | (obj->package.count != count)) { | ||
1080 | result = -EIO; | ||
1081 | goto free_obj; | ||
1082 | } | ||
1083 | params = obj->package.elements; | ||
1084 | } else | ||
1085 | params = obj; | ||
1086 | |||
1087 | if (params == NULL) { | ||
1088 | result = -EIO; | ||
1089 | goto free_obj; | ||
1090 | } | ||
1091 | |||
1092 | for (i = 0; i < count; i++) { | ||
1093 | if (argument->type != params->type) { | ||
1094 | result = -EIO; | ||
1095 | goto free_obj; | ||
1096 | } | ||
1097 | switch (params->type) { | ||
1098 | case ACPI_TYPE_INTEGER: | ||
1099 | argument->value = params->integer.value; | ||
1100 | break; | ||
1101 | case ACPI_TYPE_STRING: | ||
1102 | if ((params->string.length != argument->data_length) || | ||
1103 | (params->string.pointer == NULL)) { | ||
1104 | result = -EIO; | ||
1105 | goto free_obj; | ||
1106 | } | ||
1107 | strncpy(argument->pointer, | ||
1108 | params->string.pointer, | ||
1109 | params->string.length); | ||
1110 | break; | ||
1111 | case ACPI_TYPE_BUFFER: | ||
1112 | if (params->buffer.pointer == NULL) { | ||
1113 | result = -EIO; | ||
1114 | goto free_obj; | ||
1115 | } | ||
1116 | memcpy(argument->pointer, | ||
1117 | params->buffer.pointer, | ||
1118 | argument->data_length); | ||
1119 | break; | ||
1120 | default: | ||
1121 | break; | ||
1122 | } | ||
1123 | argument++; | ||
1124 | params++; | ||
1125 | } | ||
1126 | |||
1127 | result = 0; | ||
1128 | free_obj: | ||
1129 | kfree(obj); | ||
1130 | free_input: | ||
1131 | kfree((void *)input.pointer); | ||
1132 | return result; | ||
1133 | } | ||
1134 | #else | ||
1135 | static int amdgpu_cgs_acpi_eval_object(struct cgs_device *cgs_device, | ||
1136 | struct cgs_acpi_method_info *info) | ||
1137 | { | ||
1138 | return -EIO; | ||
1139 | } | ||
1140 | #endif | ||
1141 | |||
1142 | static int amdgpu_cgs_call_acpi_method(struct cgs_device *cgs_device, | ||
1143 | uint32_t acpi_method, | ||
1144 | uint32_t acpi_function, | ||
1145 | void *pinput, void *poutput, | ||
1146 | uint32_t output_count, | ||
1147 | uint32_t input_size, | ||
1148 | uint32_t output_size) | ||
1149 | { | ||
1150 | struct cgs_acpi_method_argument acpi_input[2] = { {0}, {0} }; | ||
1151 | struct cgs_acpi_method_argument acpi_output = {0}; | ||
1152 | struct cgs_acpi_method_info info = {0}; | ||
1153 | |||
1154 | acpi_input[0].type = CGS_ACPI_TYPE_INTEGER; | ||
1155 | acpi_input[0].data_length = sizeof(uint32_t); | ||
1156 | acpi_input[0].value = acpi_function; | ||
1157 | |||
1158 | acpi_input[1].type = CGS_ACPI_TYPE_BUFFER; | ||
1159 | acpi_input[1].data_length = input_size; | ||
1160 | acpi_input[1].pointer = pinput; | ||
1161 | |||
1162 | acpi_output.type = CGS_ACPI_TYPE_BUFFER; | ||
1163 | acpi_output.data_length = output_size; | ||
1164 | acpi_output.pointer = poutput; | ||
1165 | |||
1166 | info.size = sizeof(struct cgs_acpi_method_info); | ||
1167 | info.field = CGS_ACPI_FIELD_METHOD_NAME | CGS_ACPI_FIELD_INPUT_ARGUMENT_COUNT; | ||
1168 | info.input_count = 2; | ||
1169 | info.name = acpi_method; | ||
1170 | info.pinput_argument = acpi_input; | ||
1171 | info.output_count = output_count; | ||
1172 | info.poutput_argument = &acpi_output; | ||
1173 | |||
1174 | return amdgpu_cgs_acpi_eval_object(cgs_device, &info); | ||
1175 | } | ||
1176 | |||
1177 | static int amdgpu_cgs_set_temperature_range(struct cgs_device *cgs_device, | 966 | static int amdgpu_cgs_set_temperature_range(struct cgs_device *cgs_device, |
1178 | int min_temperature, | 967 | int min_temperature, |
1179 | int max_temperature) | 968 | int max_temperature) |
@@ -1207,7 +996,6 @@ static const struct cgs_ops amdgpu_cgs_ops = { | |||
1207 | .set_clockgating_state = amdgpu_cgs_set_clockgating_state, | 996 | .set_clockgating_state = amdgpu_cgs_set_clockgating_state, |
1208 | .get_active_displays_info = amdgpu_cgs_get_active_displays_info, | 997 | .get_active_displays_info = amdgpu_cgs_get_active_displays_info, |
1209 | .notify_dpm_enabled = amdgpu_cgs_notify_dpm_enabled, | 998 | .notify_dpm_enabled = amdgpu_cgs_notify_dpm_enabled, |
1210 | .call_acpi_method = amdgpu_cgs_call_acpi_method, | ||
1211 | .query_system_info = amdgpu_cgs_query_system_info, | 999 | .query_system_info = amdgpu_cgs_query_system_info, |
1212 | .is_virtualization_enabled = amdgpu_cgs_is_virtualization_enabled, | 1000 | .is_virtualization_enabled = amdgpu_cgs_is_virtualization_enabled, |
1213 | .enter_safe_mode = amdgpu_cgs_enter_safe_mode, | 1001 | .enter_safe_mode = amdgpu_cgs_enter_safe_mode, |
diff --git a/drivers/gpu/drm/amd/include/cgs_common.h b/drivers/gpu/drm/amd/include/cgs_common.h index e5b4823d8ec1..851168b7b173 100644 --- a/drivers/gpu/drm/amd/include/cgs_common.h +++ b/drivers/gpu/drm/amd/include/cgs_common.h | |||
@@ -157,38 +157,6 @@ struct cgs_display_info { | |||
157 | 157 | ||
158 | typedef unsigned long cgs_handle_t; | 158 | typedef unsigned long cgs_handle_t; |
159 | 159 | ||
160 | #define CGS_ACPI_METHOD_ATCS 0x53435441 | ||
161 | #define CGS_ACPI_METHOD_ATIF 0x46495441 | ||
162 | #define CGS_ACPI_METHOD_ATPX 0x58505441 | ||
163 | #define CGS_ACPI_FIELD_METHOD_NAME 0x00000001 | ||
164 | #define CGS_ACPI_FIELD_INPUT_ARGUMENT_COUNT 0x00000002 | ||
165 | #define CGS_ACPI_MAX_BUFFER_SIZE 256 | ||
166 | #define CGS_ACPI_TYPE_ANY 0x00 | ||
167 | #define CGS_ACPI_TYPE_INTEGER 0x01 | ||
168 | #define CGS_ACPI_TYPE_STRING 0x02 | ||
169 | #define CGS_ACPI_TYPE_BUFFER 0x03 | ||
170 | #define CGS_ACPI_TYPE_PACKAGE 0x04 | ||
171 | |||
172 | struct cgs_acpi_method_argument { | ||
173 | uint32_t type; | ||
174 | uint32_t data_length; | ||
175 | union{ | ||
176 | uint32_t value; | ||
177 | void *pointer; | ||
178 | }; | ||
179 | }; | ||
180 | |||
181 | struct cgs_acpi_method_info { | ||
182 | uint32_t size; | ||
183 | uint32_t field; | ||
184 | uint32_t input_count; | ||
185 | uint32_t name; | ||
186 | struct cgs_acpi_method_argument *pinput_argument; | ||
187 | uint32_t output_count; | ||
188 | struct cgs_acpi_method_argument *poutput_argument; | ||
189 | uint32_t padding[9]; | ||
190 | }; | ||
191 | |||
192 | /** | 160 | /** |
193 | * cgs_alloc_gpu_mem() - Allocate GPU memory | 161 | * cgs_alloc_gpu_mem() - Allocate GPU memory |
194 | * @cgs_device: opaque device handle | 162 | * @cgs_device: opaque device handle |
@@ -407,14 +375,6 @@ typedef int(*cgs_get_active_displays_info)( | |||
407 | 375 | ||
408 | typedef int (*cgs_notify_dpm_enabled)(struct cgs_device *cgs_device, bool enabled); | 376 | typedef int (*cgs_notify_dpm_enabled)(struct cgs_device *cgs_device, bool enabled); |
409 | 377 | ||
410 | typedef int (*cgs_call_acpi_method)(struct cgs_device *cgs_device, | ||
411 | uint32_t acpi_method, | ||
412 | uint32_t acpi_function, | ||
413 | void *pinput, void *poutput, | ||
414 | uint32_t output_count, | ||
415 | uint32_t input_size, | ||
416 | uint32_t output_size); | ||
417 | |||
418 | typedef int (*cgs_query_system_info)(struct cgs_device *cgs_device, | 378 | typedef int (*cgs_query_system_info)(struct cgs_device *cgs_device, |
419 | struct cgs_system_info *sys_info); | 379 | struct cgs_system_info *sys_info); |
420 | 380 | ||
@@ -456,8 +416,6 @@ struct cgs_ops { | |||
456 | cgs_get_active_displays_info get_active_displays_info; | 416 | cgs_get_active_displays_info get_active_displays_info; |
457 | /* notify dpm enabled */ | 417 | /* notify dpm enabled */ |
458 | cgs_notify_dpm_enabled notify_dpm_enabled; | 418 | cgs_notify_dpm_enabled notify_dpm_enabled; |
459 | /* ACPI */ | ||
460 | cgs_call_acpi_method call_acpi_method; | ||
461 | /* get system info */ | 419 | /* get system info */ |
462 | cgs_query_system_info query_system_info; | 420 | cgs_query_system_info query_system_info; |
463 | cgs_is_virtualization_enabled_t is_virtualization_enabled; | 421 | cgs_is_virtualization_enabled_t is_virtualization_enabled; |
@@ -525,8 +483,6 @@ struct cgs_device | |||
525 | #define cgs_get_active_displays_info(dev, info) \ | 483 | #define cgs_get_active_displays_info(dev, info) \ |
526 | CGS_CALL(get_active_displays_info, dev, info) | 484 | CGS_CALL(get_active_displays_info, dev, info) |
527 | 485 | ||
528 | #define cgs_call_acpi_method(dev, acpi_method, acpi_function, pintput, poutput, output_count, input_size, output_size) \ | ||
529 | CGS_CALL(call_acpi_method, dev, acpi_method, acpi_function, pintput, poutput, output_count, input_size, output_size) | ||
530 | #define cgs_query_system_info(dev, sys_info) \ | 486 | #define cgs_query_system_info(dev, sys_info) \ |
531 | CGS_CALL(query_system_info, dev, sys_info) | 487 | CGS_CALL(query_system_info, dev, sys_info) |
532 | #define cgs_get_pci_resource(cgs_device, resource_type, size, offset, \ | 488 | #define cgs_get_pci_resource(cgs_device, resource_type, size, offset, \ |
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/Makefile b/drivers/gpu/drm/amd/powerplay/hwmgr/Makefile index a212c27f2e17..e8c5a4f84324 100644 --- a/drivers/gpu/drm/amd/powerplay/hwmgr/Makefile +++ b/drivers/gpu/drm/amd/powerplay/hwmgr/Makefile | |||
@@ -24,7 +24,7 @@ | |||
24 | # It provides the hardware management services for the driver. | 24 | # It provides the hardware management services for the driver. |
25 | 25 | ||
26 | HARDWARE_MGR = hwmgr.o processpptables.o \ | 26 | HARDWARE_MGR = hwmgr.o processpptables.o \ |
27 | hardwaremanager.o pp_acpi.o cz_hwmgr.o \ | 27 | hardwaremanager.o cz_hwmgr.o \ |
28 | cz_clockpowergating.o pppcielanes.o\ | 28 | cz_clockpowergating.o pppcielanes.o\ |
29 | process_pptables_v1_0.o ppatomctrl.o ppatomfwctrl.o \ | 29 | process_pptables_v1_0.o ppatomctrl.o ppatomfwctrl.o \ |
30 | smu7_hwmgr.o smu7_powertune.o smu7_thermal.o \ | 30 | smu7_hwmgr.o smu7_powertune.o smu7_thermal.o \ |
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/pp_acpi.c b/drivers/gpu/drm/amd/powerplay/hwmgr/pp_acpi.c deleted file mode 100644 index f6b4dd96c0ec..000000000000 --- a/drivers/gpu/drm/amd/powerplay/hwmgr/pp_acpi.c +++ /dev/null | |||
@@ -1,114 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright 2016 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 | #include <linux/delay.h> | ||
25 | #include <linux/errno.h> | ||
26 | #include "hwmgr.h" | ||
27 | #include "amd_acpi.h" | ||
28 | #include "pp_acpi.h" | ||
29 | |||
30 | bool acpi_atcs_functions_supported(void *device, uint32_t index) | ||
31 | { | ||
32 | int32_t result; | ||
33 | struct atcs_verify_interface output_buf = {0}; | ||
34 | |||
35 | int32_t temp_buffer = 1; | ||
36 | |||
37 | result = cgs_call_acpi_method(device, CGS_ACPI_METHOD_ATCS, | ||
38 | ATCS_FUNCTION_VERIFY_INTERFACE, | ||
39 | &temp_buffer, | ||
40 | &output_buf, | ||
41 | 1, | ||
42 | sizeof(temp_buffer), | ||
43 | sizeof(output_buf)); | ||
44 | |||
45 | return result == 0 ? (output_buf.function_bits & (1 << (index - 1))) != 0 : false; | ||
46 | } | ||
47 | |||
48 | bool acpi_atcs_notify_pcie_device_ready(void *device) | ||
49 | { | ||
50 | int32_t temp_buffer = 1; | ||
51 | |||
52 | return cgs_call_acpi_method(device, CGS_ACPI_METHOD_ATCS, | ||
53 | ATCS_FUNCTION_PCIE_DEVICE_READY_NOTIFICATION, | ||
54 | &temp_buffer, | ||
55 | NULL, | ||
56 | 0, | ||
57 | sizeof(temp_buffer), | ||
58 | 0); | ||
59 | } | ||
60 | |||
61 | |||
62 | int acpi_pcie_perf_request(void *device, uint8_t perf_req, bool advertise) | ||
63 | { | ||
64 | struct atcs_pref_req_input atcs_input; | ||
65 | struct atcs_pref_req_output atcs_output; | ||
66 | u32 retry = 3; | ||
67 | int result; | ||
68 | struct cgs_system_info info = {0}; | ||
69 | |||
70 | if (acpi_atcs_notify_pcie_device_ready(device)) | ||
71 | return -EINVAL; | ||
72 | |||
73 | info.size = sizeof(struct cgs_system_info); | ||
74 | info.info_id = CGS_SYSTEM_INFO_ADAPTER_BDF_ID; | ||
75 | result = cgs_query_system_info(device, &info); | ||
76 | if (result != 0) | ||
77 | return -EINVAL; | ||
78 | atcs_input.client_id = (uint16_t)info.value; | ||
79 | atcs_input.size = sizeof(struct atcs_pref_req_input); | ||
80 | atcs_input.valid_flags_mask = ATCS_VALID_FLAGS_MASK; | ||
81 | atcs_input.flags = ATCS_WAIT_FOR_COMPLETION; | ||
82 | if (advertise) | ||
83 | atcs_input.flags |= ATCS_ADVERTISE_CAPS; | ||
84 | atcs_input.req_type = ATCS_PCIE_LINK_SPEED; | ||
85 | atcs_input.perf_req = perf_req; | ||
86 | |||
87 | atcs_output.size = sizeof(struct atcs_pref_req_input); | ||
88 | |||
89 | while (retry--) { | ||
90 | result = cgs_call_acpi_method(device, | ||
91 | CGS_ACPI_METHOD_ATCS, | ||
92 | ATCS_FUNCTION_PCIE_PERFORMANCE_REQUEST, | ||
93 | &atcs_input, | ||
94 | &atcs_output, | ||
95 | 1, | ||
96 | sizeof(atcs_input), | ||
97 | sizeof(atcs_output)); | ||
98 | if (result != 0) | ||
99 | return -EIO; | ||
100 | |||
101 | switch (atcs_output.ret_val) { | ||
102 | case ATCS_REQUEST_REFUSED: | ||
103 | default: | ||
104 | return -EINVAL; | ||
105 | case ATCS_REQUEST_COMPLETE: | ||
106 | return 0; | ||
107 | case ATCS_REQUEST_IN_PROGRESS: | ||
108 | udelay(10); | ||
109 | break; | ||
110 | } | ||
111 | } | ||
112 | |||
113 | return 0; | ||
114 | } | ||
diff --git a/drivers/gpu/drm/amd/powerplay/inc/pp_acpi.h b/drivers/gpu/drm/amd/powerplay/inc/pp_acpi.h deleted file mode 100644 index 8fe8ba9434ff..000000000000 --- a/drivers/gpu/drm/amd/powerplay/inc/pp_acpi.h +++ /dev/null | |||
@@ -1,26 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright 2015 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 | bool acpi_atcs_functions_supported(void *device, uint32_t index); | ||
25 | int acpi_pcie_perf_request(void *device, uint8_t perf_req, bool advertise); | ||
26 | bool acpi_atcs_notify_pcie_device_ready(void *device); | ||