Merge tag 'mac80211-for-davem-2016-06-09' of git://git.kernel.org/pub/scm/linux/kerne...
[cascardo/linux.git] / drivers / gpu / drm / amd / powerplay / smumgr / polaris10_smumgr.h
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 #ifndef _POLARIS10_SMUMANAGER_H
25 #define _POLARIS10_SMUMANAGER_H
26
27 #include <polaris10_ppsmc.h>
28 #include <pp_endian.h>
29
30 struct polaris10_avfs {
31         enum AVFS_BTC_STATUS avfs_btc_status;
32         uint32_t           avfs_btc_param;
33 };
34
35 struct polaris10_buffer_entry {
36         uint32_t data_size;
37         uint32_t mc_addr_low;
38         uint32_t mc_addr_high;
39         void *kaddr;
40         unsigned long  handle;
41 };
42
43 struct polaris10_smumgr {
44         uint8_t *header;
45         uint8_t *mec_image;
46         struct polaris10_buffer_entry smu_buffer;
47         struct polaris10_buffer_entry header_buffer;
48         uint32_t soft_regs_start;
49         uint8_t *read_rrm_straps;
50         uint32_t read_drm_straps_mc_address_high;
51         uint32_t read_drm_straps_mc_address_low;
52         uint32_t acpi_optimization;
53         bool post_initial_boot;
54         uint8_t protected_mode;
55         uint8_t security_hard_key;
56         struct polaris10_avfs  avfs;
57 };
58
59
60 int polaris10_smum_init(struct pp_smumgr *smumgr);
61
62 int polaris10_read_smc_sram_dword(struct pp_smumgr *smumgr, uint32_t smc_addr, uint32_t *value, uint32_t limit);
63 int polaris10_write_smc_sram_dword(struct pp_smumgr *smumgr, uint32_t smc_addr, uint32_t value, uint32_t limit);
64 int polaris10_copy_bytes_to_smc(struct pp_smumgr *smumgr, uint32_t smc_start_address,
65                                 const uint8_t *src, uint32_t byte_count, uint32_t limit);
66
67 #endif
68