1 // Copyright 2021 The Chromium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef COMPONENTS_POWER_METRICS_SMC_INTERNAL_TYPES_MAC_H_
6 #define COMPONENTS_POWER_METRICS_SMC_INTERNAL_TYPES_MAC_H_
8 #import <Foundation/Foundation.h>
11 // List of known SMC key identifiers.
13 // This is a good reference: https://logi.wiki/index.php/SMC_Sensor_Codes
14 // Additional keys can be discovered with
15 // https://github.com/theopolis/smc-fuzzer
16 enum class SMCKeyIdentifier : uint32_t {
17 TotalPower = 'PSTR', // Power: System Total Rail (watts)
18 CPUPower = 'PCPC', // Power: CPU Package CPU (watts)
19 iGPUPower = 'PCPG', // Power: CPU Package GPU (watts)
20 GPU0Power = 'PG0R', // Power: GPU 0 Rail (watts)
21 GPU1Power = 'PG1R', // Power: GPU 1 Rail (watts)
22 CPUTemperature = 'TC0F', // Temperature: CPU Die PECI (Celsius)
25 // Types from PowerManagement/pmconfigd/PrivateLib.c
26 // (https://opensource.apple.com/source/PowerManagement/PowerManagement-494.1.2/pmconfigd/PrivateLib.c.auto.html)
31 unsigned char reserved;
32 unsigned short release;
35 struct SMCPLimitData {
43 enum class SMCDataType : uint32_t {
44 flt = 'flt ', // Floating point
45 sp78 = 'sp78', // Fixed point: SIIIIIIIFFFFFFFF
46 sp87 = 'sp87', // Fixed point: SIIIIIIIIFFFFFFF
47 spa5 = 'spa5', // Fixed point: SIIIIIIIIIIFFFFF
50 struct SMCKeyInfoData {
53 uint8_t dataAttributes;
56 struct SMCParamStruct {
59 SMCPLimitData pLimitData;
60 SMCKeyInfoData keyInfo;
69 kSMCUserClientOpen = 0,
70 kSMCUserClientClose = 1,
71 kSMCHandleYPCEvent = 2,
75 kSMCGetKeyFromIndex = 8,
79 #endif // COMPONENTS_POWER_METRICS_SMC_INTERNAL_TYPES_MAC_H_