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_KRACKAN_POINT_ROOT 0x1122 20 #define PCI_DEVICEID_AMD_CEZANNE_ROOT 0x1630 21 #define PCI_DEVICEID_AMD_REMBRANDT_ROOT 0x14B5 22 #define PCI_DEVICEID_AMD_PHOENIX_ROOT 0x14E8 23 #define PCI_DEVICEID_AMD_STRIX_POINT_ROOT 0x14A4 24 25 #define SMU_INDEX_ADDRESS 0xB8 26 #define SMU_INDEX_DATA 0xBC 27 28 #define SMU_PHYSBASE_ADDR_LO 0x13B102E8 29 #define SMU_PHYSBASE_ADDR_HI 0x13B102EC 30 31 #define SMU_MEM_SIZE 0x1000 32 33 #define SMU_REG_SPACE_OFF 0x10000 34 35 #define SMU_REG_RESPONSE 0x980 36 #define SMU_REG_ARGUMENT 0x9BC 37 38 #define SMU_REG_IDLEMASK_CEZANNE 0x94 39 #define SMU_REG_IDLEMASK_PHOENIX 0xD14 40 #define SMU_REG_IDLEMASK_KRACKAN 0xF14 41 42 #define SMU_REG_MSG_CEZANNE 0x538 43 #define SMU_REG_MSG_KRACKAN 0x938 44 45 enum amdsmu_res { 46 SMU_RES_WAIT = 0x00, 47 SMU_RES_OK = 0x01, 48 SMU_RES_REJECT_BUSY = 0xFC, 49 SMU_RES_REJECT_PREREQ = 0xFD, 50 SMU_RES_UNKNOWN = 0xFE, 51 SMU_RES_FAILED = 0xFF, 52 }; 53 54 enum amdsmu_msg { 55 SMU_MSG_GETSMUVERSION = 0x02, 56 SMU_MSG_SLEEP_HINT = 0x03, 57 SMU_MSG_LOG_GETDRAM_ADDR_HI = 0x04, 58 SMU_MSG_LOG_GETDRAM_ADDR_LO = 0x05, 59 SMU_MSG_LOG_START = 0x06, 60 SMU_MSG_LOG_RESET = 0x07, 61 SMU_MSG_LOG_DUMP_DATA = 0x08, 62 SMU_MSG_GET_SUP_CONSTRAINTS = 0x09, 63 }; 64 65 /* XXX Copied from Linux struct smu_metrics. */ 66 struct amdsmu_metrics { 67 uint32_t table_version; 68 uint32_t hint_count; 69 uint32_t s0i3_last_entry_status; 70 uint32_t time_last_in_s0i2; 71 uint64_t time_last_entering_s0i3; 72 uint64_t total_time_entering_s0i3; 73 uint64_t time_last_resuming; 74 uint64_t total_time_resuming; 75 uint64_t time_last_in_s0i3; 76 uint64_t total_time_in_s0i3; 77 uint64_t time_last_in_sw_drips; 78 uint64_t total_time_in_sw_drips; 79 /* 80 * This is how long each IP block was active for (us), i.e., blocking 81 * entry to S0i3. In Linux, these are called "timecondition_notmet_*". 82 * 83 * XXX Total active time for IP blocks seems to be buggy and reporting 84 * garbage (at least on Phoenix), so it's disabled for now. The last 85 * active time for the USB4_0 IP block also seems to be buggy. 86 */ 87 uint64_t ip_block_last_active_time[32]; 88 #ifdef IP_BLOCK_TOTAL_ACTIVE_TIME 89 uint64_t ip_block_total_active_time[32]; 90 #endif 91 } __attribute__((packed)); 92 93 #endif /* _AMDSMU_REG_H_ */ 94