1 /* 2 * SPDX-License-Identifier: BSD-2-Clause 3 * 4 * Copyright (c) 2025 The FreeBSD Foundation 5 * 6 * This software was developed by Aymeric Wibo <obiwac@freebsd.org> 7 * under sponsorship from the FreeBSD Foundation. 8 */ 9 #ifndef _AMDSMU_REG_H_ 10 #define _AMDSMU_REG_H_ 11 12 #include <sys/types.h> 13 14 /* 15 * TODO These are in common with amdtemp; should we find a way to factor these 16 * out? Also, there are way more of these. I couldn't find a centralized place 17 * which lists them though. 18 */ 19 #define PCI_DEVICEID_AMD_REMBRANDT_ROOT 0x14B5 20 #define PCI_DEVICEID_AMD_PHOENIX_ROOT 0x14E8 21 #define PCI_DEVICEID_AMD_STRIX_POINT_ROOT 0x14A4 22 23 #define SMU_INDEX_ADDRESS 0xB8 24 #define SMU_INDEX_DATA 0xBC 25 26 #define SMU_PHYSBASE_ADDR_LO 0x13B102E8 27 #define SMU_PHYSBASE_ADDR_HI 0x13B102EC 28 29 #define SMU_MEM_SIZE 0x1000 30 #define SMU_REG_SPACE_OFF 0x10000 31 32 #define SMU_REG_MESSAGE 0x538 33 #define SMU_REG_RESPONSE 0x980 34 #define SMU_REG_ARGUMENT 0x9BC 35 #define SMU_REG_IDLEMASK 0xD14 36 37 enum amdsmu_res { 38 SMU_RES_WAIT = 0x00, 39 SMU_RES_OK = 0x01, 40 SMU_RES_REJECT_BUSY = 0xFC, 41 SMU_RES_REJECT_PREREQ = 0xFD, 42 SMU_RES_UNKNOWN = 0xFE, 43 SMU_RES_FAILED = 0xFF, 44 }; 45 46 enum amdsmu_msg { 47 SMU_MSG_GETSMUVERSION = 0x02, 48 SMU_MSG_LOG_GETDRAM_ADDR_HI = 0x04, 49 SMU_MSG_LOG_GETDRAM_ADDR_LO = 0x05, 50 SMU_MSG_LOG_START = 0x06, 51 SMU_MSG_LOG_RESET = 0x07, 52 SMU_MSG_LOG_DUMP_DATA = 0x08, 53 SMU_MSG_GET_SUP_CONSTRAINTS = 0x09, 54 }; 55 56 /* XXX Copied from Linux struct smu_metrics. */ 57 struct amdsmu_metrics { 58 uint32_t table_version; 59 uint32_t hint_count; 60 uint32_t s0i3_last_entry_status; 61 uint32_t time_last_in_s0i2; 62 uint64_t time_last_entering_s0i3; 63 uint64_t total_time_entering_s0i3; 64 uint64_t time_last_resuming; 65 uint64_t total_time_resuming; 66 uint64_t time_last_in_s0i3; 67 uint64_t total_time_in_s0i3; 68 uint64_t time_last_in_sw_drips; 69 uint64_t total_time_in_sw_drips; 70 /* 71 * This is how long each IP block was active for (us), i.e., blocking 72 * entry to S0i3. In Linux, these are called "timecondition_notmet_*". 73 * 74 * XXX Total active time for IP blocks seems to be buggy and reporting 75 * garbage (at least on Phoenix), so it's disabled for now. The last 76 * active time for the USB4_0 IP block also seems to be buggy. 77 */ 78 uint64_t ip_block_last_active_time[32]; 79 #ifdef IP_BLOCK_TOTAL_ACTIVE_TIME 80 uint64_t ip_block_total_active_time[32]; 81 #endif 82 } __attribute__((packed)); 83 84 #endif /* _AMDSMU_REG_H_ */ 85