ARM: 9148/1: handle CONFIG_CPU_ENDIAN_BE32 in arch/arm/kernel/head.S
[platform/kernel/linux-rpi.git] / drivers / gpu / drm / amd / pm / swsmu / smu11 / cyan_skillfish_ppt.c
1 /*
2  * Copyright 2021 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 #define SWSMU_CODE_LAYER_L2
25
26 #include "amdgpu.h"
27 #include "amdgpu_smu.h"
28 #include "smu_v11_0.h"
29 #include "smu11_driver_if_cyan_skillfish.h"
30 #include "cyan_skillfish_ppt.h"
31 #include "smu_v11_8_ppsmc.h"
32 #include "smu_v11_8_pmfw.h"
33 #include "smu_cmn.h"
34 #include "soc15_common.h"
35
36 /*
37  * DO NOT use these for err/warn/info/debug messages.
38  * Use dev_err, dev_warn, dev_info and dev_dbg instead.
39  * They are more MGPU friendly.
40  */
41
42 #undef pr_err
43 #undef pr_warn
44 #undef pr_info
45 #undef pr_debug
46
47 static struct cmn2asic_msg_mapping cyan_skillfish_message_map[SMU_MSG_MAX_COUNT] = {
48         MSG_MAP(TestMessage,                    PPSMC_MSG_TestMessage,                  0),
49         MSG_MAP(GetSmuVersion,                  PPSMC_MSG_GetSmuVersion,                0),
50         MSG_MAP(GetDriverIfVersion,             PPSMC_MSG_GetDriverIfVersion,           0),
51         MSG_MAP(SetDriverDramAddrHigh,          PPSMC_MSG_SetDriverTableDramAddrHigh,   0),
52         MSG_MAP(SetDriverDramAddrLow,           PPSMC_MSG_SetDriverTableDramAddrLow,    0),
53         MSG_MAP(TransferTableSmu2Dram,          PPSMC_MSG_TransferTableSmu2Dram,        0),
54         MSG_MAP(TransferTableDram2Smu,          PPSMC_MSG_TransferTableDram2Smu,        0),
55 };
56
57 static const struct pptable_funcs cyan_skillfish_ppt_funcs = {
58
59         .check_fw_status = smu_v11_0_check_fw_status,
60         .check_fw_version = smu_v11_0_check_fw_version,
61         .init_power = smu_v11_0_init_power,
62         .fini_power = smu_v11_0_fini_power,
63         .register_irq_handler = smu_v11_0_register_irq_handler,
64         .notify_memory_pool_location = smu_v11_0_notify_memory_pool_location,
65         .send_smc_msg_with_param = smu_cmn_send_smc_msg_with_param,
66         .send_smc_msg = smu_cmn_send_smc_msg,
67         .set_driver_table_location = smu_v11_0_set_driver_table_location,
68         .interrupt_work = smu_v11_0_interrupt_work,
69 };
70
71 void cyan_skillfish_set_ppt_funcs(struct smu_context *smu)
72 {
73         smu->ppt_funcs = &cyan_skillfish_ppt_funcs;
74         smu->message_map = cyan_skillfish_message_map;
75         smu->is_apu = true;
76 }