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 #ifndef __SMU11_DRIVER_IF_CYAN_SKILLFISH_H__
24 #define __SMU11_DRIVER_IF_CYAN_SKILLFISH_H__
25 
26 // *** IMPORTANT ***
27 // Always increment the interface version if
28 // any structure is changed in this file
29 #define MP1_DRIVER_IF_VERSION 0x8
30 
31 #define TABLE_BIOS_IF            0 // Called by BIOS
32 #define TABLE_WATERMARKS         1 // Called by Driver; defined here, but not used, for backward compatible
33 #define TABLE_PMSTATUSLOG        3 // Called by Tools for Agm logging
34 #define TABLE_DPMCLOCKS          4 // Called by Driver; defined here, but not used, for backward compatible
35 #define TABLE_MOMENTARY_PM       5 // Called by Tools; defined here, but not used, for backward compatible
36 #define TABLE_SMU_METRICS        6 // Called by Driver
37 #define TABLE_COUNT              7
38 
39 typedef struct SmuMetricsTable_t {
40 	//CPU status
41 	uint16_t CoreFrequency[6];              //[MHz]
42 	uint32_t CorePower[6];                  //[mW]
43 	uint16_t CoreTemperature[6];            //[centi-Celsius]
44 	uint16_t L3Frequency[2];                //[MHz]
45 	uint16_t L3Temperature[2];              //[centi-Celsius]
46 	uint16_t C0Residency[6];                //Percentage
47 
48 	// GFX status
49 	uint16_t GfxclkFrequency;               //[MHz]
50 	uint16_t GfxTemperature;                //[centi-Celsius]
51 
52 	// SOC IP info
53 	uint16_t SocclkFrequency;               //[MHz]
54 	uint16_t VclkFrequency;                 //[MHz]
55 	uint16_t DclkFrequency;                 //[MHz]
56 	uint16_t MemclkFrequency;               //[MHz]
57 
58 	// power, VF info for CPU/GFX telemetry rails, and then socket power total
59 	uint32_t Voltage[2];                    //[mV] indices: VDDCR_VDD, VDDCR_GFX
60 	uint32_t Current[2];                    //[mA] indices: VDDCR_VDD, VDDCR_GFX
61 	uint32_t Power[2];                      //[mW] indices: VDDCR_VDD, VDDCR_GFX
62 	uint32_t CurrentSocketPower;            //[mW]
63 
64 	uint16_t SocTemperature;                //[centi-Celsius]
65 	uint16_t EdgeTemperature;
66 	uint16_t ThrottlerStatus;
67 	uint16_t Spare;
68 
69 } SmuMetricsTable_t;
70 
71 typedef struct SmuMetrics_t {
72 	SmuMetricsTable_t Current;
73 	SmuMetricsTable_t Average;
74 	uint32_t SampleStartTime;
75 	uint32_t SampleStopTime;
76 	uint32_t Accnt;
77 } SmuMetrics_t;
78 
79 #endif
80