From 554b288efbf7770365612e99c00f225e9dfce496 Mon Sep 17 00:00:00 2001 From: osy <50960678+osy@users.noreply.github.com> Date: Sun, 28 Mar 2021 14:08:36 -0700 Subject: [PATCH] Implement ECDevicesNUC resource generation with SMC support closes #56 --- Changelog.md | 2 +- Sensors/SMCSuperIO/DeviceGenerator/main.mm | 189 +- Sensors/SMCSuperIO/Devices.cpp | 1575 +++++++++++++++-- Sensors/SMCSuperIO/Devices.hpp | 1 + Sensors/SMCSuperIO/ECDevice.cpp | 2 +- Sensors/SMCSuperIO/ECDevice.hpp | 18 +- Sensors/SMCSuperIO/ECDeviceNUC.cpp | 173 +- Sensors/SMCSuperIO/ECDeviceNUC.hpp | 57 +- .../Resources/NucEcGenerationV1.plist | 117 ++ .../Resources/NucEcGenerationV2.plist | 83 + .../Resources/NucEcGenerationV3.plist | 103 ++ .../Resources/NucEcGenerationV4.plist | 103 ++ .../Resources/NucEcGenerationV5.plist | 97 + .../Resources/NucEcGenerationV6.plist | 103 ++ .../Resources/NucEcGenerationV7.plist | 103 ++ .../Resources/NucEcGenerationV8.plist | 99 ++ .../Resources/NucEcGenerationV9.plist | 127 ++ .../Resources/NucEcGenerationVA.plist | 175 ++ .../Resources/NucEcGenerationVB.plist | 121 ++ Sensors/SMCSuperIO/SuperIODevice.cpp | 14 + Sensors/SMCSuperIO/SuperIODevice.hpp | 32 + 21 files changed, 2970 insertions(+), 324 deletions(-) create mode 100644 Sensors/SMCSuperIO/Resources/NucEcGenerationV1.plist create mode 100644 Sensors/SMCSuperIO/Resources/NucEcGenerationV2.plist create mode 100644 Sensors/SMCSuperIO/Resources/NucEcGenerationV3.plist create mode 100644 Sensors/SMCSuperIO/Resources/NucEcGenerationV4.plist create mode 100644 Sensors/SMCSuperIO/Resources/NucEcGenerationV5.plist create mode 100644 Sensors/SMCSuperIO/Resources/NucEcGenerationV6.plist create mode 100644 Sensors/SMCSuperIO/Resources/NucEcGenerationV7.plist create mode 100644 Sensors/SMCSuperIO/Resources/NucEcGenerationV8.plist create mode 100644 Sensors/SMCSuperIO/Resources/NucEcGenerationV9.plist create mode 100644 Sensors/SMCSuperIO/Resources/NucEcGenerationVA.plist create mode 100644 Sensors/SMCSuperIO/Resources/NucEcGenerationVB.plist diff --git a/Changelog.md b/Changelog.md index 86944c7..fe91235 100644 --- a/Changelog.md +++ b/Changelog.md @@ -7,7 +7,7 @@ VirtualSMC Changelog - Added SuperIO device activation when it is disabled on probe - Added support for Nuvoton NCT6796D-E (0xD42A) - Added support for ITE IT8987 (requires DEBUG firmware, not available for public) -- Added Intel NUC FAN monitoring (requires manual configuration via `ec-device`, see `EmbeddedControllers.md`) +- Added Intel NUC monitoring (requires manual configuration via `ec-device`, see `EmbeddedControllers.md`) #### v1.2.1 - Fix version publishing for VirtualSMC and plugins diff --git a/Sensors/SMCSuperIO/DeviceGenerator/main.mm b/Sensors/SMCSuperIO/DeviceGenerator/main.mm index 3753c0d..668ee4a 100644 --- a/Sensors/SMCSuperIO/DeviceGenerator/main.mm +++ b/Sensors/SMCSuperIO/DeviceGenerator/main.mm @@ -25,7 +25,8 @@ #include \"NuvotonDevice.hpp\"\n\ #include \"FintekDevice.hpp\"\n\ #include \"ITEDevice.hpp\"\n\ -#include \"WinbondDevice.hpp\"\n\n" +#include \"WinbondDevice.hpp\"\n\ +#include \"ECDeviceNUC.hpp\"\n\n" }; static void appendFile(NSString *file, NSString *data) { @@ -39,25 +40,56 @@ static void appendFile(NSString *file, NSString *data) { static constexpr uint8_t WinbondHardwareMonitorLDN = 0x0B; static constexpr uint8_t FintekITEHardwareMonitorLDN = 0x04; -static NSString *generateSensor(NSArray *sensors, NSString *sensorReading, NSString *sensorKind, NSString *valueType) { +static NSString *generateSensorRead(NSArray *sensors, NSString *sensorReading, NSString *sensorKind, NSString *valueType) { if (!sensors) { return @""; } NSString *capitalizedSensorKind = [sensorKind capitalizedString]; NSMutableString *sensorsContents = [NSMutableString stringWithCapacity: 1024]; - [sensorsContents appendString:@"public:\n"]; - // uint8_t getTachometerCount() - [sensorsContents appendFormat: @"\tuint8_t get%@Count() override {\n\t\treturn %lu;\n\t}\n\n", capitalizedSensorKind, [sensors count]]; - + NSMutableString *inlineReading = [NSMutableString stringWithCapacity: 1024]; + BOOL hasInlineReading = NO; + [inlineReading appendString:@"\t\tswitch (index) {\n"]; + for (int i = 0; i < sensors.count; i++) { + NSDictionary *sensor = sensors[i]; + NSString *readValue = sensor[@"ReadValue"]; + if (readValue) { + [inlineReading appendFormat:@"\t\t\tcase %d: return %@;\n", i, readValue]; + hasInlineReading = YES; + } + } + [inlineReading appendFormat:@"\t\t\tdefault: break;\n\t\t}\n"]; // uint16_t updateTachometer(uint8_t index) if (!sensorReading) { sensorReading = [NSString stringWithFormat:@"%@Read", sensorKind]; } - [sensorsContents appendFormat: @"\t%@ update%@(uint8_t index) override {\n\t\treturn %@(index);\n\t}\n\n", valueType, capitalizedSensorKind, sensorReading]; - - // const char* getTachometerName(uint8_t index); - [sensorsContents appendFormat: @"\tconst char* get%@Name(uint8_t index) override {\n\t\tif (index < get%@Count()) {\n\t\t\treturn %@Names[index];\n\t\t}\n\t\treturn nullptr;\n\t}\n\n", capitalizedSensorKind, capitalizedSensorKind, sensorKind]; + [sensorsContents appendFormat: @"\t%@ update%@(uint8_t index) override {\n%@\t\treturn %@(index);\n\t}\n\n", valueType, capitalizedSensorKind, hasInlineReading ? inlineReading : @"", sensorReading]; + + return sensorsContents; +} +static NSString *generateSensorNames(NSArray *sensors, NSString *sensorKind) { + if (!sensors) { + return @""; + } + NSString *capitalizedSensorKind = [sensorKind capitalizedString]; + NSMutableString *sensorsContents = [NSMutableString stringWithCapacity: 1024]; + NSMutableString *inlineNames = [NSMutableString stringWithCapacity: 1024]; + BOOL hasInlineNames = NO; + [sensorsContents appendFormat: @"\tconst char* get%@Name(uint8_t index) override {\n", capitalizedSensorKind]; + [inlineNames appendString:@"\t\tswitch (index) {\n"]; + for (int i = 0; i < sensors.count; i++) { + NSDictionary *sensor = sensors[i]; + NSString *nameValue = sensor[@"NameValue"]; + if (nameValue) { + [inlineNames appendFormat:@"\t\t\tcase %d: return %@;\n", i, nameValue]; + hasInlineNames = YES; + } + } + [inlineNames appendString:@"\t\t\tdefault: break;\n\t\t}\n"]; + if (hasInlineNames) { + [sensorsContents appendString:inlineNames]; + } + uint32_t index = 0; NSMutableString *sensorNames = [NSMutableString stringWithFormat:@"private:\n\tconst char* %@Names[%lu] = {\n", sensorKind, [sensors count]]; for (NSDictionary *sensor in sensors) { @@ -69,14 +101,83 @@ static void appendFile(NSString *file, NSString *data) { } if ([sensors count] == index) { [sensorNames appendString: @"\t};\n"]; + [sensorsContents appendFormat: @"\t\tif (index < get%@Count()) {\n\t\t\treturn %@Names[index];\n\t\t}\n\t\treturn nullptr;\n\t}\n\n", capitalizedSensorKind, sensorKind]; [sensorsContents appendString: sensorNames]; } else { - SYSLOG("Not all names for tachometers provided in the descriptor."); + [sensorsContents appendString: @"\t\treturn nullptr;\n\t}\n\n"]; + } + return sensorsContents; +} + +static NSString *generateSensors(NSArray *sensors, NSString *sensorReading, NSString *sensorKind, NSString *valueType) { + if (!sensors) { + return @""; } + NSString *capitalizedSensorKind = [sensorKind capitalizedString]; + NSMutableString *sensorsContents = [NSMutableString stringWithCapacity: 1024]; + [sensorsContents appendString:@"public:\n"]; + // uint8_t getTachometerCount() + [sensorsContents appendFormat: @"\tuint8_t get%@Count() override {\n\t\treturn %lu;\n\t}\n\n", capitalizedSensorKind, [sensors count]]; + // uint16_t updateTachometer() + [sensorsContents appendString:generateSensorRead(sensors, sensorReading, sensorKind, valueType)]; + + // const char* getTachometerName(uint8_t index); + [sensorsContents appendString:generateSensorNames(sensors, sensorKind)]; return sensorsContents; } +static NSString *generateSensorSmcKeys(NSArray *sensors, NSString *sensorKind) { + if (!sensors) { + return @""; + } + NSString *capitalizedSensorKind = [sensorKind capitalizedString]; + NSMutableString *sensorsContents = [NSMutableString stringWithCapacity: 1024]; + BOOL hasSmcKey = NO; + [sensorsContents appendString:@"protected:\n"]; + [sensorsContents appendFormat:@"\tvoid setup%@Keys(VirtualSMCAPI::Plugin &vsmcPlugin) override {\n", capitalizedSensorKind]; + for (int i = 0; i < sensors.count; i++) { + NSDictionary *sensor = sensors[i]; + NSString *smcKey = sensor[@"SmcKey"]; + NSString *smcKeyType = sensor[@"SmcKeyType"]; + if (!smcKeyType) { + smcKeyType = @"SmcKeyTypeFloat"; + } + if (smcKey) { + NSString *valueFunc = @""; + BOOL hasKeyTypeArg = NO; + if ([smcKeyType isEqualToString:@"SmcKeyTypeFloat"]) { + valueFunc = @"valueWithFlt"; + } else if ([smcKeyType isEqualToString:@"SmcKeyTypeFlag"]) { + valueFunc = @"valueWithFlag"; + } else if ([smcKeyType hasPrefix:@"SmcKeyTypeUint"]) { + NSString *bitWidth = [smcKeyType substringFromIndex:14]; + valueFunc = [@"valueWithUint" stringByAppendingString:bitWidth]; + } else if ([smcKeyType hasPrefix:@"SmcKeyTypeSint"]) { + NSString *bitWidth = [smcKeyType substringFromIndex:14]; + valueFunc = [@"valueWithSint" stringByAppendingString:bitWidth]; + } else if ([smcKeyType hasPrefix:@"SmcKeyTypeFp"]) { + valueFunc = @"valueWithFp"; + hasKeyTypeArg = YES; + } else if ([smcKeyType hasPrefix:@"SmcKeyTypeSp"]) { + valueFunc = @"valueWithSp"; + hasKeyTypeArg = YES; + } else { + SYSLOG("Unsupported SMC key type: %s, skipping.", smcKeyType.UTF8String); + continue; + } + [sensorsContents appendFormat:@"\t\tVirtualSMCAPI::addKey(%@, vsmcPlugin.data, VirtualSMCAPI::%@(0, %@%@ new %@Key(getSmcSuperIO(), this, %d)));\n", smcKey, valueFunc, hasKeyTypeArg ? smcKeyType : @"", hasKeyTypeArg ? @"," : @"", capitalizedSensorKind, i]; + hasSmcKey = YES; + } + } + [sensorsContents appendString:@"\t}\n"]; + if (hasSmcKey) { + return sensorsContents; + } else { + return @""; + } +} + static NSString *processDevice(NSDictionary *deviceDict, NSString *deviceClassName, NSMutableString *factoryMethodContents, uint32_t index) { NSString *deviceNamespace = nil; uint8_t defaultLdn = 0xFF; @@ -97,6 +198,8 @@ static void appendFile(NSString *file, NSString *data) { deviceNamespace = @"ITE"; if (![deviceDict objectForKey:@"UsesEC"]) defaultLdn = FintekITEHardwareMonitorLDN; + } else if ([deviceClassName hasPrefix:@"ECDevice"]) { + deviceNamespace = @"EC"; } else { SYSLOG("Unknown BaseClassName specified: %s, skipping the descriptor.", [deviceNamespace UTF8String]); return @""; @@ -126,37 +229,53 @@ static void appendFile(NSString *file, NSString *data) { return @""; } // tachometers - [baseClassContents appendString: generateSensor([sensors objectForKey:@"Tachometer"], [sensors objectForKey:@"TachometerReading"], @"tachometer", @"uint16_t")]; + [baseClassContents appendString: generateSensors([sensors objectForKey:@"Tachometer"], [sensors objectForKey:@"TachometerReading"], @"tachometer", @"uint16_t")]; // voltages - [baseClassContents appendString: generateSensor([sensors objectForKey:@"Voltage"], [sensors objectForKey:@"VoltageReading"], @"voltage", @"float")]; + [baseClassContents appendString: generateSensors([sensors objectForKey:@"Voltage"], [sensors objectForKey:@"VoltageReading"], @"voltage", @"float")]; + [baseClassContents appendString: generateSensorSmcKeys([sensors objectForKey:@"Voltage"], @"voltage")]; + // temperatures + [baseClassContents appendString: generateSensors([sensors objectForKey:@"Temperature"], [sensors objectForKey:@"TemperatureReading"], @"temperature", @"float")]; + [baseClassContents appendString: generateSensorSmcKeys([sensors objectForKey:@"Temperature"], @"temperature")]; [baseClassContents appendString: @"\n};\n\n"]; for (NSDictionary *compDevice in compatibleDevices) { - NSNumber *deviceID = [compDevice objectForKey: @"DeviceID"]; - if (deviceID == nil) { - SYSLOG("No DeviceID key specified for the compatible device, skipping this entry."); - continue; - } - auto classContents = [NSMutableString stringWithFormat:@"class Device_0x%04X final : public %@ {\npublic:\n", [deviceID intValue], deviceGeneratedClassName]; - // factory method - NSNumber *deviceIdMask = [compDevice objectForKey: @"DeviceIDMask"]; - NSString *deviceIdTest; - if (deviceIdMask != nil) { - deviceIdTest = [NSString stringWithFormat: @"(deviceId & 0x%04X)", [deviceIdMask intValue]]; + NSMutableString *classContents = nil; + if ([deviceClassName hasPrefix:@"ECDevice"]) { + NSString *matchName = compDevice[@"MatchName"]; + if (!matchName) { + SYSLOG("No DisplayName or MatchName specified for the compatible device, skipping this entry."); + continue; + } + classContents = [NSMutableString stringWithFormat:@"class Device_%@ final : public %@ {\npublic:\n", matchName, deviceGeneratedClassName]; + [classContents appendFormat: @"\tstatic SuperIODevice *createDevice(const char *name) {\n\t\tif (strcmp(name, \"%@\") == 0)\n\t\t\treturn new Device_%@();\n\t\treturn nullptr;\n\t}\n\n", matchName, matchName]; + [factoryMethodContents appendFormat: @"\tdevice = Device_%@::createDevice(name);\n\tif (device) return device;\n", matchName]; } else { - deviceIdTest = @"deviceId"; + NSNumber *deviceID = [compDevice objectForKey: @"DeviceID"]; + if (deviceID == nil) { + SYSLOG("No DeviceID key specified for the compatible device, skipping this entry."); + continue; + } + classContents = [NSMutableString stringWithFormat:@"class Device_0x%04X final : public %@ {\npublic:\n", [deviceID intValue], deviceGeneratedClassName]; + // factory method + NSNumber *deviceIdMask = [compDevice objectForKey: @"DeviceIDMask"]; + NSString *deviceIdTest; + if (deviceIdMask != nil) { + deviceIdTest = [NSString stringWithFormat: @"(deviceId & 0x%04X)", [deviceIdMask intValue]]; + } else { + deviceIdTest = @"deviceId"; + } + [classContents appendFormat: @"\tstatic SuperIODevice *createDevice(uint16_t deviceId) {\n\t\tif (%@ == 0x%04X)\n\t\t\treturn new Device_0x%04X();\n\t\treturn nullptr;\n\t}\n\n", deviceIdTest, [deviceID intValue], [deviceID intValue]]; + // uint8_t getLdn() + NSNumber *ldn = [compDevice objectForKey: @"LDN"]; // optional key + [classContents appendFormat: @"\tuint8_t getLdn() override {\n\t\treturn 0x%02X;\n\t}\n\n", ldn != nil ? [ldn intValue] : defaultLdn]; + [factoryMethodContents appendFormat: @"\tdevice = Device_0x%04X::createDevice(deviceId);\n\tif (device) return device;\n", [deviceID intValue]]; } - [classContents appendFormat: @"\tstatic SuperIODevice *createDevice(uint16_t deviceId) {\n\t\tif (%@ == 0x%04X)\n\t\t\treturn new Device_0x%04X();\n\t\treturn nullptr;\n\t}\n\n", deviceIdTest, [deviceID intValue], [deviceID intValue]]; - // uint8_t getLdn() - NSNumber *ldn = [compDevice objectForKey: @"LDN"]; // optional key - [classContents appendFormat: @"\tuint8_t getLdn() override {\n\t\treturn 0x%02X;\n\t}\n\n", ldn != nil ? [ldn intValue] : defaultLdn]; // const char* getModelName() NSString *displayName = [compDevice objectForKey: @"DisplayName"]; if (!displayName) { displayName = @""; } [classContents appendFormat: @"\tconst char* getModelName() override {\n\t\treturn \"%@\";\n\t}\n\n", displayName]; - [factoryMethodContents appendFormat: @"\tdevice = Device_0x%04X::createDevice(deviceId);\n\tif (device) return device;\n", [deviceID intValue]]; [classContents appendString: @"};\n\n"]; [baseClassContents appendString: classContents]; } @@ -198,6 +317,7 @@ int main(int argc, const char * argv[]) { // Device factory NSMutableString *factoryMethodContentsGeneric = [NSMutableString stringWithString: @"SuperIODevice *createDevice(uint16_t deviceId) {\n\tSuperIODevice *device;\n"]; NSMutableString *factoryMethodContentsITE = [NSMutableString stringWithString: @"SuperIODevice *createDeviceITE(uint16_t deviceId) {\n\tSuperIODevice *device;\n"]; + NSMutableString *factoryMethodContentsEC = [NSMutableString stringWithString: @"SuperIODevice *createDeviceEC(const char *name) {\n\tSuperIODevice *device;\n"]; uint32_t i = 0; for (NSDictionary *deviceDict in files) { @@ -207,12 +327,19 @@ int main(int argc, const char * argv[]) { SYSLOG("No BaseClassName key specified, skipping the descriptor."); continue; } - NSMutableString *factoryMethodContents = [deviceClassName hasPrefix:@"ITE"] ? factoryMethodContentsITE : factoryMethodContentsGeneric; + NSMutableString *factoryMethodContents = factoryMethodContentsGeneric; + if ([deviceClassName hasPrefix:@"ITE"]) { + factoryMethodContents = factoryMethodContentsITE; + } else if ([deviceClassName hasPrefix:@"ECDevice"]) { + factoryMethodContents = factoryMethodContentsEC; + } auto fileContents = processDevice(deviceDict, deviceClassName, factoryMethodContents, i++); appendFile(outputCpp, fileContents); } [factoryMethodContentsGeneric appendString: @"\treturn nullptr;\n}\n"]; [factoryMethodContentsITE appendString: @"\treturn nullptr;\n}\n"]; + [factoryMethodContentsEC appendString: @"\treturn nullptr;\n}\n"]; appendFile(outputCpp, factoryMethodContentsGeneric); appendFile(outputCpp, factoryMethodContentsITE); + appendFile(outputCpp, factoryMethodContentsEC); } diff --git a/Sensors/SMCSuperIO/Devices.cpp b/Sensors/SMCSuperIO/Devices.cpp index 30b6b59..0b83c25 100644 --- a/Sensors/SMCSuperIO/Devices.cpp +++ b/Sensors/SMCSuperIO/Devices.cpp @@ -13,8 +13,120 @@ #include "FintekDevice.hpp" #include "ITEDevice.hpp" #include "WinbondDevice.hpp" +#include "ECDeviceNUC.hpp" -class GeneratedNuvotonDevice_0 : public Nuvoton::NuvotonDevice { +class GeneratedECDevice_0 : public EC::ECDeviceNUC { +public: + uint8_t getTachometerCount() override { + return 3; + } + + uint16_t updateTachometer(uint8_t index) override { + switch (index) { + case 0: return readBigWordMMIO(EC::B_NUC_EC_V9_FAN1_U16); + case 1: return readBigWordMMIO(EC::B_NUC_EC_V9_FAN2_U16); + case 2: return readBigWordMMIO(EC::B_NUC_EC_V9_FAN3_U16); + default: break; + } + return tachometerRead(index); + } + + const char* getTachometerName(uint8_t index) override { + switch (index) { + case 0: return getTachometerNameForType(readBigWordMMIOCached(EC::B_NUC_EC_V9_FAN1_TYPE_U8)); + case 1: return getTachometerNameForType(readBigWordMMIOCached(EC::B_NUC_EC_V9_FAN2_TYPE_U8)); + case 2: return getTachometerNameForType(readBigWordMMIOCached(EC::B_NUC_EC_V9_FAN3_TYPE_U8)); + default: break; + } + return nullptr; + } + +public: + uint8_t getVoltageCount() override { + return 5; + } + + float updateVoltage(uint8_t index) override { + switch (index) { + case 0: return (float)readBigWordMMIO(EC::B_NUC_EC_V9_VOLTAGE1_U16) / 1000; + case 1: return (float)readBigWordMMIO(EC::B_NUC_EC_V9_VOLTAGE2_U16) / 1000; + case 2: return (float)readBigWordMMIO(EC::B_NUC_EC_V9_VOLTAGE3_U16) / 1000; + case 3: return (float)readBigWordMMIO(EC::B_NUC_EC_V9_VOLTAGE4_U16) / 1000; + case 4: return (float)readBigWordMMIO(EC::B_NUC_EC_V9_VOLTAGE5_U16) / 1000; + default: break; + } + return voltageRead(index); + } + + const char* getVoltageName(uint8_t index) override { + switch (index) { + case 0: return getVoltageNameForType(readBigWordMMIOCached(EC::B_NUC_EC_V9_VOLTAGE1_TYPE_U8)); + case 1: return getVoltageNameForType(readBigWordMMIOCached(EC::B_NUC_EC_V9_VOLTAGE2_TYPE_U8)); + case 2: return getVoltageNameForType(readBigWordMMIOCached(EC::B_NUC_EC_V9_VOLTAGE3_TYPE_U8)); + case 3: return getVoltageNameForType(readBigWordMMIOCached(EC::B_NUC_EC_V9_VOLTAGE4_TYPE_U8)); + case 4: return getVoltageNameForType(readBigWordMMIOCached(EC::B_NUC_EC_V9_VOLTAGE5_TYPE_U8)); + default: break; + } + return nullptr; + } + +protected: + void setupVoltageKeys(VirtualSMCAPI::Plugin &vsmcPlugin) override { + VirtualSMCAPI::addKey(getVoltageSMCKeyForType(readBigWordMMIOCached(EC::B_NUC_EC_V9_VOLTAGE1_TYPE_U8)), vsmcPlugin.data, VirtualSMCAPI::valueWithFlt(0, new VoltageKey(getSmcSuperIO(), this, 0))); + VirtualSMCAPI::addKey(getVoltageSMCKeyForType(readBigWordMMIOCached(EC::B_NUC_EC_V9_VOLTAGE2_TYPE_U8)), vsmcPlugin.data, VirtualSMCAPI::valueWithFlt(0, new VoltageKey(getSmcSuperIO(), this, 1))); + VirtualSMCAPI::addKey(getVoltageSMCKeyForType(readBigWordMMIOCached(EC::B_NUC_EC_V9_VOLTAGE3_TYPE_U8)), vsmcPlugin.data, VirtualSMCAPI::valueWithFlt(0, new VoltageKey(getSmcSuperIO(), this, 2))); + VirtualSMCAPI::addKey(getVoltageSMCKeyForType(readBigWordMMIOCached(EC::B_NUC_EC_V9_VOLTAGE4_TYPE_U8)), vsmcPlugin.data, VirtualSMCAPI::valueWithFlt(0, new VoltageKey(getSmcSuperIO(), this, 3))); + VirtualSMCAPI::addKey(getVoltageSMCKeyForType(readBigWordMMIOCached(EC::B_NUC_EC_V9_VOLTAGE5_TYPE_U8)), vsmcPlugin.data, VirtualSMCAPI::valueWithFlt(0, new VoltageKey(getSmcSuperIO(), this, 4))); + } +public: + uint8_t getTemperatureCount() override { + return 3; + } + + float updateTemperature(uint8_t index) override { + switch (index) { + case 0: return (float)readBigWordMMIO(EC::B_NUC_EC_V9_TEMP1_U8) / 1000; + case 1: return (float)readBigWordMMIO(EC::B_NUC_EC_V9_TEMP2_U8) / 1000; + case 2: return (float)readBigWordMMIO(EC::B_NUC_EC_V9_TEMP3_U8) / 1000; + default: break; + } + return temperatureRead(index); + } + + const char* getTemperatureName(uint8_t index) override { + switch (index) { + case 0: return getTemperatureNameForType(readBigWordMMIOCached(EC::B_NUC_EC_V9_TEMP1_TYPE_U8)); + case 1: return getTemperatureNameForType(readBigWordMMIOCached(EC::B_NUC_EC_V9_TEMP2_TYPE_U8)); + case 2: return getTemperatureNameForType(readBigWordMMIOCached(EC::B_NUC_EC_V9_TEMP3_TYPE_U8)); + default: break; + } + return nullptr; + } + +protected: + void setupTemperatureKeys(VirtualSMCAPI::Plugin &vsmcPlugin) override { + VirtualSMCAPI::addKey(getTemperatureSMCKeyForType(readBigWordMMIOCached(EC::B_NUC_EC_V9_TEMP1_TYPE_U8)), vsmcPlugin.data, VirtualSMCAPI::valueWithSp(0, SmcKeyTypeSp78, new TemperatureKey(getSmcSuperIO(), this, 0))); + VirtualSMCAPI::addKey(getTemperatureSMCKeyForType(readBigWordMMIOCached(EC::B_NUC_EC_V9_TEMP2_TYPE_U8)), vsmcPlugin.data, VirtualSMCAPI::valueWithSp(0, SmcKeyTypeSp78, new TemperatureKey(getSmcSuperIO(), this, 1))); + VirtualSMCAPI::addKey(getTemperatureSMCKeyForType(readBigWordMMIOCached(EC::B_NUC_EC_V9_TEMP3_TYPE_U8)), vsmcPlugin.data, VirtualSMCAPI::valueWithSp(0, SmcKeyTypeSp78, new TemperatureKey(getSmcSuperIO(), this, 2))); + } + +}; + +class Device_Intel_EC_V9 final : public GeneratedECDevice_0 { +public: + static SuperIODevice *createDevice(const char *name) { + if (strcmp(name, "Intel_EC_V9") == 0) + return new Device_Intel_EC_V9(); + return nullptr; + } + + const char* getModelName() override { + return "Intel NUC Embedded Controller"; + } + +}; + +class GeneratedNuvotonDevice_1 : public Nuvoton::NuvotonDevice { public: uint8_t getTachometerCount() override { return 3; @@ -69,7 +181,7 @@ class GeneratedNuvotonDevice_0 : public Nuvoton::NuvotonDevice { }; -class Device_0xB470 final : public GeneratedNuvotonDevice_0 { +class Device_0xB470 final : public GeneratedNuvotonDevice_1 { public: static SuperIODevice *createDevice(uint16_t deviceId) { if ((deviceId & 0xFFF0) == 0xB470) @@ -87,7 +199,7 @@ class Device_0xB470 final : public GeneratedNuvotonDevice_0 { }; -class GeneratedFintekDevice_1 : public Fintek::FintekDevice { +class GeneratedFintekDevice_2 : public Fintek::FintekDevice { public: uint8_t getTachometerCount() override { return 3; @@ -141,7 +253,7 @@ class GeneratedFintekDevice_1 : public Fintek::FintekDevice { }; -class Device_0x0901 final : public GeneratedFintekDevice_1 { +class Device_0x0901 final : public GeneratedFintekDevice_2 { public: static SuperIODevice *createDevice(uint16_t deviceId) { if (deviceId == 0x0901) @@ -159,7 +271,7 @@ class Device_0x0901 final : public GeneratedFintekDevice_1 { }; -class GeneratedWinbondDevice_2 : public Winbond::WinbondDevice { +class GeneratedWinbondDevice_3 : public Winbond::WinbondDevice { public: uint8_t getTachometerCount() override { return 3; @@ -211,7 +323,7 @@ class GeneratedWinbondDevice_2 : public Winbond::WinbondDevice { }; -class Device_0x5217 final : public GeneratedWinbondDevice_2 { +class Device_0x5217 final : public GeneratedWinbondDevice_3 { public: static SuperIODevice *createDevice(uint16_t deviceId) { if (deviceId == 0x5217) @@ -229,7 +341,7 @@ class Device_0x5217 final : public GeneratedWinbondDevice_2 { }; -class Device_0x523A final : public GeneratedWinbondDevice_2 { +class Device_0x523A final : public GeneratedWinbondDevice_3 { public: static SuperIODevice *createDevice(uint16_t deviceId) { if (deviceId == 0x523A) @@ -247,7 +359,7 @@ class Device_0x523A final : public GeneratedWinbondDevice_2 { }; -class Device_0x5241 final : public GeneratedWinbondDevice_2 { +class Device_0x5241 final : public GeneratedWinbondDevice_3 { public: static SuperIODevice *createDevice(uint16_t deviceId) { if (deviceId == 0x5241) @@ -265,7 +377,7 @@ class Device_0x5241 final : public GeneratedWinbondDevice_2 { }; -class Device_0x8280 final : public GeneratedWinbondDevice_2 { +class Device_0x8280 final : public GeneratedWinbondDevice_3 { public: static SuperIODevice *createDevice(uint16_t deviceId) { if ((deviceId & 0xFFF0) == 0x8280) @@ -283,7 +395,7 @@ class Device_0x8280 final : public GeneratedWinbondDevice_2 { }; -class Device_0x8541 final : public GeneratedWinbondDevice_2 { +class Device_0x8541 final : public GeneratedWinbondDevice_3 { public: static SuperIODevice *createDevice(uint16_t deviceId) { if (deviceId == 0x8541) @@ -301,7 +413,126 @@ class Device_0x8541 final : public GeneratedWinbondDevice_2 { }; -class GeneratedITEDevice_3 : public ITE::ITEDevice { +class GeneratedECDevice_4 : public EC::ECDeviceNUC { +public: + uint8_t getTachometerCount() override { + return 1; + } + + uint16_t updateTachometer(uint8_t index) override { + switch (index) { + case 0: return readBigWordMMIO(EC::B_NUC_EC_VB_FAN_U16); + default: break; + } + return tachometerRead(index); + } + + const char* getTachometerName(uint8_t index) override { + if (index < getTachometerCount()) { + return tachometerNames[index]; + } + return nullptr; + } + +private: + const char* tachometerNames[1] = { + "FAN", + }; +public: + uint8_t getVoltageCount() override { + return 5; + } + + float updateVoltage(uint8_t index) override { + switch (index) { + case 0: return (float)readBigWordMMIO(EC::B_NUC_EC_VB_CPU_CORE_U16) / 1000; + case 1: return (float)readBigWordMMIO(EC::B_NUC_EC_VB_DIMM_U16) / 1000; + case 2: return (float)readBigWordMMIO(EC::B_NUC_EC_VB_DC_IN_U16) / 1000; + case 3: return (float)readBigWordMMIO(EC::B_NUC_EC_VB_GPU_CORE_U16) / 1000; + case 4: return (float)readBigWordMMIO(EC::B_NUC_EC_VB_DC_IN_ALT_U16) / 1000; + default: break; + } + return voltageRead(index); + } + + const char* getVoltageName(uint8_t index) override { + if (index < getVoltageCount()) { + return voltageNames[index]; + } + return nullptr; + } + +private: + const char* voltageNames[5] = { + "CPUVCORE", + "VDIMM", + "VIN", + "VGPU", + "VINALT", + }; +protected: + void setupVoltageKeys(VirtualSMCAPI::Plugin &vsmcPlugin) override { + VirtualSMCAPI::addKey(KeyVM0R(0), vsmcPlugin.data, VirtualSMCAPI::valueWithFlt(0, new VoltageKey(getSmcSuperIO(), this, 1))); + VirtualSMCAPI::addKey(KeyVD0R(0), vsmcPlugin.data, VirtualSMCAPI::valueWithFlt(0, new VoltageKey(getSmcSuperIO(), this, 2))); + } +public: + uint8_t getTemperatureCount() override { + return 6; + } + + float updateTemperature(uint8_t index) override { + switch (index) { + case 0: return readBigWordMMIO(EC::B_NUC_EC_VB_CPU_TEMP_U8); + case 1: return readBigWordMMIO(EC::B_NUC_EC_VB_GPU_TEMP_U8); + case 2: return readBigWordMMIO(EC::B_NUC_EC_VB_PCH_TEMP_U8); + case 3: return readBigWordMMIO(EC::B_NUC_EC_VB_CPU_VR_TEMP_U8); + case 4: return readBigWordMMIO(EC::B_NUC_EC_VB_GPU_VR_U8); + case 5: return readBigWordMMIO(EC::B_NUC_EC_VB_MOTHERBOARD_TEMP_U8); + default: break; + } + return temperatureRead(index); + } + + const char* getTemperatureName(uint8_t index) override { + if (index < getTemperatureCount()) { + return temperatureNames[index]; + } + return nullptr; + } + +private: + const char* temperatureNames[6] = { + "TCPU", + "TGPU", + "TPCH", + "TVRMCPU", + "TVRMGPU", + "TMLB", + }; +protected: + void setupTemperatureKeys(VirtualSMCAPI::Plugin &vsmcPlugin) override { + VirtualSMCAPI::addKey(KeyTC0P(0), vsmcPlugin.data, VirtualSMCAPI::valueWithSp(0, SmcKeyTypeSp78, new TemperatureKey(getSmcSuperIO(), this, 0))); + VirtualSMCAPI::addKey(KeyTG0P(0), vsmcPlugin.data, VirtualSMCAPI::valueWithSp(0, SmcKeyTypeSp78, new TemperatureKey(getSmcSuperIO(), this, 1))); + VirtualSMCAPI::addKey(KeyTP0P(0), vsmcPlugin.data, VirtualSMCAPI::valueWithSp(0, SmcKeyTypeSp78, new TemperatureKey(getSmcSuperIO(), this, 2))); + } + +}; + +class Device_Intel_EC_VB final : public GeneratedECDevice_4 { +public: + static SuperIODevice *createDevice(const char *name) { + if (strcmp(name, "Intel_EC_VB") == 0) + return new Device_Intel_EC_VB(); + return nullptr; + } + + const char* getModelName() override { + return "Intel NUC Embedded Controller"; + } + +}; + +class GeneratedITEDevice_5 : public ITE::ITEDevice { public: uint8_t getTachometerCount() override { return 3; @@ -355,7 +586,7 @@ class GeneratedITEDevice_3 : public ITE::ITEDevice { }; -class Device_0x8705 final : public GeneratedITEDevice_3 { +class Device_0x8705 final : public GeneratedITEDevice_5 { public: static SuperIODevice *createDevice(uint16_t deviceId) { if (deviceId == 0x8705) @@ -373,7 +604,7 @@ class Device_0x8705 final : public GeneratedITEDevice_3 { }; -class Device_0x8712 final : public GeneratedITEDevice_3 { +class Device_0x8712 final : public GeneratedITEDevice_5 { public: static SuperIODevice *createDevice(uint16_t deviceId) { if (deviceId == 0x8712) @@ -391,7 +622,7 @@ class Device_0x8712 final : public GeneratedITEDevice_3 { }; -class GeneratedITEDevice_4 : public ITE::ITEDevice { +class GeneratedITEDevice_6 : public ITE::ITEDevice { public: uint8_t getTachometerCount() override { return 5; @@ -447,7 +678,7 @@ class GeneratedITEDevice_4 : public ITE::ITEDevice { }; -class Device_0x8721 final : public GeneratedITEDevice_4 { +class Device_0x8721 final : public GeneratedITEDevice_6 { public: static SuperIODevice *createDevice(uint16_t deviceId) { if (deviceId == 0x8721) @@ -465,7 +696,7 @@ class Device_0x8721 final : public GeneratedITEDevice_4 { }; -class Device_0x8726 final : public GeneratedITEDevice_4 { +class Device_0x8726 final : public GeneratedITEDevice_6 { public: static SuperIODevice *createDevice(uint16_t deviceId) { if (deviceId == 0x8726) @@ -483,7 +714,7 @@ class Device_0x8726 final : public GeneratedITEDevice_4 { }; -class Device_0x8620 final : public GeneratedITEDevice_4 { +class Device_0x8620 final : public GeneratedITEDevice_6 { public: static SuperIODevice *createDevice(uint16_t deviceId) { if (deviceId == 0x8620) @@ -501,7 +732,7 @@ class Device_0x8620 final : public GeneratedITEDevice_4 { }; -class Device_0x8628 final : public GeneratedITEDevice_4 { +class Device_0x8628 final : public GeneratedITEDevice_6 { public: static SuperIODevice *createDevice(uint16_t deviceId) { if (deviceId == 0x8628) @@ -519,7 +750,7 @@ class Device_0x8628 final : public GeneratedITEDevice_4 { }; -class Device_0x8686 final : public GeneratedITEDevice_4 { +class Device_0x8686 final : public GeneratedITEDevice_6 { public: static SuperIODevice *createDevice(uint16_t deviceId) { if (deviceId == 0x8686) @@ -537,7 +768,7 @@ class Device_0x8686 final : public GeneratedITEDevice_4 { }; -class Device_0x8728 final : public GeneratedITEDevice_4 { +class Device_0x8728 final : public GeneratedITEDevice_6 { public: static SuperIODevice *createDevice(uint16_t deviceId) { if (deviceId == 0x8728) @@ -555,7 +786,7 @@ class Device_0x8728 final : public GeneratedITEDevice_4 { }; -class Device_0x8752 final : public GeneratedITEDevice_4 { +class Device_0x8752 final : public GeneratedITEDevice_6 { public: static SuperIODevice *createDevice(uint16_t deviceId) { if (deviceId == 0x8752) @@ -573,7 +804,7 @@ class Device_0x8752 final : public GeneratedITEDevice_4 { }; -class Device_0x8771 final : public GeneratedITEDevice_4 { +class Device_0x8771 final : public GeneratedITEDevice_6 { public: static SuperIODevice *createDevice(uint16_t deviceId) { if (deviceId == 0x8771) @@ -591,7 +822,7 @@ class Device_0x8771 final : public GeneratedITEDevice_4 { }; -class Device_0x8772 final : public GeneratedITEDevice_4 { +class Device_0x8772 final : public GeneratedITEDevice_6 { public: static SuperIODevice *createDevice(uint16_t deviceId) { if (deviceId == 0x8772) @@ -609,7 +840,7 @@ class Device_0x8772 final : public GeneratedITEDevice_4 { }; -class Device_0x8792 final : public GeneratedITEDevice_4 { +class Device_0x8792 final : public GeneratedITEDevice_6 { public: static SuperIODevice *createDevice(uint16_t deviceId) { if (deviceId == 0x8792) @@ -627,7 +858,7 @@ class Device_0x8792 final : public GeneratedITEDevice_4 { }; -class Device_0x8688 final : public GeneratedITEDevice_4 { +class Device_0x8688 final : public GeneratedITEDevice_6 { public: static SuperIODevice *createDevice(uint16_t deviceId) { if (deviceId == 0x8688) @@ -645,7 +876,7 @@ class Device_0x8688 final : public GeneratedITEDevice_4 { }; -class Device_0x8795 final : public GeneratedITEDevice_4 { +class Device_0x8795 final : public GeneratedITEDevice_6 { public: static SuperIODevice *createDevice(uint16_t deviceId) { if (deviceId == 0x8795) @@ -663,7 +894,7 @@ class Device_0x8795 final : public GeneratedITEDevice_4 { }; -class Device_0x8665 final : public GeneratedITEDevice_4 { +class Device_0x8665 final : public GeneratedITEDevice_6 { public: static SuperIODevice *createDevice(uint16_t deviceId) { if (deviceId == 0x8665) @@ -681,7 +912,7 @@ class Device_0x8665 final : public GeneratedITEDevice_4 { }; -class Device_0x8613 final : public GeneratedITEDevice_4 { +class Device_0x8613 final : public GeneratedITEDevice_6 { public: static SuperIODevice *createDevice(uint16_t deviceId) { if (deviceId == 0x8613) @@ -699,7 +930,119 @@ class Device_0x8613 final : public GeneratedITEDevice_4 { }; -class GeneratedNuvotonDevice_5 : public Nuvoton::NuvotonDevice { +class GeneratedECDevice_7 : public EC::ECDeviceNUC { +public: + uint8_t getTachometerCount() override { + return 1; + } + + uint16_t updateTachometer(uint8_t index) override { + switch (index) { + case 0: return readBigWordMMIO(EC::B_NUC_EC_V8_CPU_FAN_U16); + default: break; + } + return tachometerRead(index); + } + + const char* getTachometerName(uint8_t index) override { + if (index < getTachometerCount()) { + return tachometerNames[index]; + } + return nullptr; + } + +private: + const char* tachometerNames[1] = { + "FAN", + }; +public: + uint8_t getVoltageCount() override { + return 4; + } + + float updateVoltage(uint8_t index) override { + switch (index) { + case 0: return (float)readBigWordMMIO(EC::B_NUC_EC_V8_VCORE_U16) / 1000; + case 1: return (float)readBigWordMMIO(EC::B_NUC_EC_V8_VDIMM_U16) / 1000; + case 2: return (float)readBigWordMMIO(EC::B_NUC_EC_V8_VCCIO_U16) / 1000; + case 3: return (float)readBigWordMMIO(EC::B_NUC_EC_V8_V5VSB_U16) / 1000; + default: break; + } + return voltageRead(index); + } + + const char* getVoltageName(uint8_t index) override { + if (index < getVoltageCount()) { + return voltageNames[index]; + } + return nullptr; + } + +private: + const char* voltageNames[4] = { + "CPUVCORE", + "VDIMM", + "VIO", + "VDD5", + }; +protected: + void setupVoltageKeys(VirtualSMCAPI::Plugin &vsmcPlugin) override { + VirtualSMCAPI::addKey(KeyVM0R(0), vsmcPlugin.data, VirtualSMCAPI::valueWithFlt(0, new VoltageKey(getSmcSuperIO(), this, 1))); + VirtualSMCAPI::addKey(KeyV50R(0), vsmcPlugin.data, VirtualSMCAPI::valueWithFlt(0, new VoltageKey(getSmcSuperIO(), this, 3))); + } +public: + uint8_t getTemperatureCount() override { + return 4; + } + + float updateTemperature(uint8_t index) override { + switch (index) { + case 0: return readBigWordMMIO(EC::B_NUC_EC_V8_DIMM_TEMP_U8); + case 1: return readBigWordMMIO(EC::B_NUC_EC_V8_DIMM_TEMP_U8); + case 2: return readBigWordMMIO(EC::B_NUC_EC_V8_VR_TEMP_U8); + case 3: return readBigWordMMIO(EC::B_NUC_EC_V8_MOTHERBOARD_TEMP_U8); + default: break; + } + return temperatureRead(index); + } + + const char* getTemperatureName(uint8_t index) override { + if (index < getTemperatureCount()) { + return temperatureNames[index]; + } + return nullptr; + } + +private: + const char* temperatureNames[4] = { + "TPCH", + "TDIMM", + "TVRM", + "TMLB", + }; +protected: + void setupTemperatureKeys(VirtualSMCAPI::Plugin &vsmcPlugin) override { + VirtualSMCAPI::addKey(KeyTP0P(0), vsmcPlugin.data, VirtualSMCAPI::valueWithSp(0, SmcKeyTypeSp78, new TemperatureKey(getSmcSuperIO(), this, 0))); + VirtualSMCAPI::addKey(KeyTM0P(0), vsmcPlugin.data, VirtualSMCAPI::valueWithSp(0, SmcKeyTypeSp78, new TemperatureKey(getSmcSuperIO(), this, 1))); + } + +}; + +class Device_Intel_EC_V8 final : public GeneratedECDevice_7 { +public: + static SuperIODevice *createDevice(const char *name) { + if (strcmp(name, "Intel_EC_V8") == 0) + return new Device_Intel_EC_V8(); + return nullptr; + } + + const char* getModelName() override { + return "Intel NUC Embedded Controller"; + } + +}; + +class GeneratedNuvotonDevice_8 : public Nuvoton::NuvotonDevice { public: uint8_t getTachometerCount() override { return 5; @@ -761,7 +1104,7 @@ class GeneratedNuvotonDevice_5 : public Nuvoton::NuvotonDevice { }; -class Device_0xC560 final : public GeneratedNuvotonDevice_5 { +class Device_0xC560 final : public GeneratedNuvotonDevice_8 { public: static SuperIODevice *createDevice(uint16_t deviceId) { if ((deviceId & 0xFFF0) == 0xC560) @@ -779,7 +1122,7 @@ class Device_0xC560 final : public GeneratedNuvotonDevice_5 { }; -class GeneratedITEDevice_6 : public ITE::ITEDevice { +class GeneratedITEDevice_9 : public ITE::ITEDevice { public: uint8_t getTachometerCount() override { return 2; @@ -823,7 +1166,7 @@ class GeneratedITEDevice_6 : public ITE::ITEDevice { }; -class Device_0x8987 final : public GeneratedITEDevice_6 { +class Device_0x8987 final : public GeneratedITEDevice_9 { public: static SuperIODevice *createDevice(uint16_t deviceId) { if (deviceId == 0x8987) @@ -841,7 +1184,7 @@ class Device_0x8987 final : public GeneratedITEDevice_6 { }; -class GeneratedNuvotonDevice_7 : public Nuvoton::NuvotonDevice { +class GeneratedNuvotonDevice_10 : public Nuvoton::NuvotonDevice { void onPowerOn() override { onPowerOn679xx(); } @@ -910,7 +1253,7 @@ class GeneratedNuvotonDevice_7 : public Nuvoton::NuvotonDevice { }; -class Device_0xD423 final : public GeneratedNuvotonDevice_7 { +class Device_0xD423 final : public GeneratedNuvotonDevice_10 { public: static SuperIODevice *createDevice(uint16_t deviceId) { if (deviceId == 0xD423) @@ -928,7 +1271,7 @@ class Device_0xD423 final : public GeneratedNuvotonDevice_7 { }; -class Device_0xD451 final : public GeneratedNuvotonDevice_7 { +class Device_0xD451 final : public GeneratedNuvotonDevice_10 { public: static SuperIODevice *createDevice(uint16_t deviceId) { if (deviceId == 0xD451) @@ -946,7 +1289,7 @@ class Device_0xD451 final : public GeneratedNuvotonDevice_7 { }; -class Device_0xD428 final : public GeneratedNuvotonDevice_7 { +class Device_0xD428 final : public GeneratedNuvotonDevice_10 { public: static SuperIODevice *createDevice(uint16_t deviceId) { if (deviceId == 0xD428) @@ -964,7 +1307,7 @@ class Device_0xD428 final : public GeneratedNuvotonDevice_7 { }; -class Device_0xD42A final : public GeneratedNuvotonDevice_7 { +class Device_0xD42A final : public GeneratedNuvotonDevice_10 { public: static SuperIODevice *createDevice(uint16_t deviceId) { if (deviceId == 0xD42A) @@ -982,7 +1325,7 @@ class Device_0xD42A final : public GeneratedNuvotonDevice_7 { }; -class Device_0xD42B final : public GeneratedNuvotonDevice_7 { +class Device_0xD42B final : public GeneratedNuvotonDevice_10 { public: static SuperIODevice *createDevice(uint16_t deviceId) { if (deviceId == 0xD42B) @@ -1000,117 +1343,347 @@ class Device_0xD42B final : public GeneratedNuvotonDevice_7 { }; -class GeneratedWinbondDevice_8 : public Winbond::WinbondDevice { +class GeneratedECDevice_11 : public EC::ECDeviceNUC { public: uint8_t getTachometerCount() override { - return 5; + return 6; } uint16_t updateTachometer(uint8_t index) override { + switch (index) { + case 0: return readBigWordMMIO(EC::B_NUC_EC_VA_FAN1_U16); + case 1: return readBigWordMMIO(EC::B_NUC_EC_VA_FAN2_U16); + case 2: return readBigWordMMIO(EC::B_NUC_EC_VA_FAN3_U16); + case 3: return readBigWordMMIO(EC::B_NUC_EC_VA_FAN4_U16); + case 4: return readBigWordMMIO(EC::B_NUC_EC_VA_FAN5_U16); + case 5: return readBigWordMMIO(EC::B_NUC_EC_VA_FAN6_U16); + default: break; + } return tachometerRead(index); } const char* getTachometerName(uint8_t index) override { - if (index < getTachometerCount()) { - return tachometerNames[index]; + switch (index) { + case 0: return getTachometerNameForType(readBigWordMMIOCached(EC::B_NUC_EC_VA_FAN1_TYPE_U8)); + case 1: return getTachometerNameForType(readBigWordMMIOCached(EC::B_NUC_EC_VA_FAN2_TYPE_U8)); + case 2: return getTachometerNameForType(readBigWordMMIOCached(EC::B_NUC_EC_VA_FAN3_TYPE_U8)); + case 3: return getTachometerNameForType(readBigWordMMIOCached(EC::B_NUC_EC_VA_FAN4_TYPE_U8)); + case 4: return getTachometerNameForType(readBigWordMMIOCached(EC::B_NUC_EC_VA_FAN5_TYPE_U8)); + case 5: return getTachometerNameForType(readBigWordMMIOCached(EC::B_NUC_EC_VA_FAN6_TYPE_U8)); + default: break; } return nullptr; } -private: - const char* tachometerNames[5] = { - "SYSFAN", - "CPUFAN0", - "AUXFAN0", - "CPUFAN1", - "AUXFAN1", - }; public: uint8_t getVoltageCount() override { - return 9; + return 6; } float updateVoltage(uint8_t index) override { + switch (index) { + case 0: return (float)readBigWordMMIO(EC::B_NUC_EC_VA_VOLTAGE1_U16) / 1000; + case 1: return (float)readBigWordMMIO(EC::B_NUC_EC_VA_VOLTAGE2_U16) / 1000; + case 2: return (float)readBigWordMMIO(EC::B_NUC_EC_VA_VOLTAGE3_U16) / 1000; + case 3: return (float)readBigWordMMIO(EC::B_NUC_EC_VA_VOLTAGE4_U16) / 1000; + case 4: return (float)readBigWordMMIO(EC::B_NUC_EC_VA_VOLTAGE5_U16) / 1000; + case 5: return (float)readBigWordMMIO(EC::B_NUC_EC_VA_VOLTAGE6_U16) / 1000; + default: break; + } return voltageRead(index); } const char* getVoltageName(uint8_t index) override { - if (index < getVoltageCount()) { - return voltageNames[index]; + switch (index) { + case 0: return getVoltageNameForType(readBigWordMMIOCached(EC::B_NUC_EC_VA_VOLTAGE1_TYPE_U8)); + case 1: return getVoltageNameForType(readBigWordMMIOCached(EC::B_NUC_EC_VA_VOLTAGE2_TYPE_U8)); + case 2: return getVoltageNameForType(readBigWordMMIOCached(EC::B_NUC_EC_VA_VOLTAGE3_TYPE_U8)); + case 3: return getVoltageNameForType(readBigWordMMIOCached(EC::B_NUC_EC_VA_VOLTAGE4_TYPE_U8)); + case 4: return getVoltageNameForType(readBigWordMMIOCached(EC::B_NUC_EC_VA_VOLTAGE5_TYPE_U8)); + case 5: return getVoltageNameForType(readBigWordMMIOCached(EC::B_NUC_EC_VA_VOLTAGE6_TYPE_U8)); + default: break; } return nullptr; } -private: - const char* voltageNames[9] = { - "CPUVCORE", - "VIN0", - "AVCC", - "3VCC", - "VIN1", - "VIN2", - "VIN3", - "VSB", - "VBAT", - }; - -}; - -class Device_0xA020 final : public GeneratedWinbondDevice_8 { +protected: + void setupVoltageKeys(VirtualSMCAPI::Plugin &vsmcPlugin) override { + VirtualSMCAPI::addKey(getVoltageSMCKeyForType(readBigWordMMIOCached(EC::B_NUC_EC_VA_VOLTAGE1_TYPE_U8)), vsmcPlugin.data, VirtualSMCAPI::valueWithFlt(0, new VoltageKey(getSmcSuperIO(), this, 0))); + VirtualSMCAPI::addKey(getVoltageSMCKeyForType(readBigWordMMIOCached(EC::B_NUC_EC_VA_VOLTAGE2_TYPE_U8)), vsmcPlugin.data, VirtualSMCAPI::valueWithFlt(0, new VoltageKey(getSmcSuperIO(), this, 1))); + VirtualSMCAPI::addKey(getVoltageSMCKeyForType(readBigWordMMIOCached(EC::B_NUC_EC_VA_VOLTAGE3_TYPE_U8)), vsmcPlugin.data, VirtualSMCAPI::valueWithFlt(0, new VoltageKey(getSmcSuperIO(), this, 2))); + VirtualSMCAPI::addKey(getVoltageSMCKeyForType(readBigWordMMIOCached(EC::B_NUC_EC_VA_VOLTAGE4_TYPE_U8)), vsmcPlugin.data, VirtualSMCAPI::valueWithFlt(0, new VoltageKey(getSmcSuperIO(), this, 3))); + VirtualSMCAPI::addKey(getVoltageSMCKeyForType(readBigWordMMIOCached(EC::B_NUC_EC_VA_VOLTAGE5_TYPE_U8)), vsmcPlugin.data, VirtualSMCAPI::valueWithFlt(0, new VoltageKey(getSmcSuperIO(), this, 4))); + VirtualSMCAPI::addKey(getVoltageSMCKeyForType(readBigWordMMIOCached(EC::B_NUC_EC_VA_VOLTAGE6_TYPE_U8)), vsmcPlugin.data, VirtualSMCAPI::valueWithFlt(0, new VoltageKey(getSmcSuperIO(), this, 5))); + } public: - static SuperIODevice *createDevice(uint16_t deviceId) { - if ((deviceId & 0xFFF0) == 0xA020) - return new Device_0xA020(); - return nullptr; + uint8_t getTemperatureCount() override { + return 5; } - uint8_t getLdn() override { - return 0x0B; + float updateTemperature(uint8_t index) override { + switch (index) { + case 0: return (float)readBigWordMMIO(EC::B_NUC_EC_VA_TEMP1_U8) / 1000; + case 1: return (float)readBigWordMMIO(EC::B_NUC_EC_VA_TEMP2_U8) / 1000; + case 2: return (float)readBigWordMMIO(EC::B_NUC_EC_VA_TEMP3_U8) / 1000; + case 3: return (float)readBigWordMMIO(EC::B_NUC_EC_VA_TEMP4_U8) / 1000; + case 4: return (float)readBigWordMMIO(EC::B_NUC_EC_VA_TEMP5_U8) / 1000; + default: break; + } + return temperatureRead(index); } - const char* getModelName() override { - return "Winbond W83627DHG"; + const char* getTemperatureName(uint8_t index) override { + switch (index) { + case 0: return getTemperatureNameForType(readBigWordMMIOCached(EC::B_NUC_EC_VA_TEMP1_TYPE_U8)); + case 1: return getTemperatureNameForType(readBigWordMMIOCached(EC::B_NUC_EC_VA_TEMP2_TYPE_U8)); + case 2: return getTemperatureNameForType(readBigWordMMIOCached(EC::B_NUC_EC_VA_TEMP3_TYPE_U8)); + case 3: return getTemperatureNameForType(readBigWordMMIOCached(EC::B_NUC_EC_VA_TEMP4_TYPE_U8)); + case 4: return getTemperatureNameForType(readBigWordMMIOCached(EC::B_NUC_EC_VA_TEMP5_TYPE_U8)); + default: break; + } + return nullptr; + } + +protected: + void setupTemperatureKeys(VirtualSMCAPI::Plugin &vsmcPlugin) override { + VirtualSMCAPI::addKey(getTemperatureSMCKeyForType(readBigWordMMIOCached(EC::B_NUC_EC_VA_TEMP1_TYPE_U8)), vsmcPlugin.data, VirtualSMCAPI::valueWithSp(0, SmcKeyTypeSp78, new TemperatureKey(getSmcSuperIO(), this, 0))); + VirtualSMCAPI::addKey(getTemperatureSMCKeyForType(readBigWordMMIOCached(EC::B_NUC_EC_VA_TEMP2_TYPE_U8)), vsmcPlugin.data, VirtualSMCAPI::valueWithSp(0, SmcKeyTypeSp78, new TemperatureKey(getSmcSuperIO(), this, 1))); + VirtualSMCAPI::addKey(getTemperatureSMCKeyForType(readBigWordMMIOCached(EC::B_NUC_EC_VA_TEMP3_TYPE_U8)), vsmcPlugin.data, VirtualSMCAPI::valueWithSp(0, SmcKeyTypeSp78, new TemperatureKey(getSmcSuperIO(), this, 2))); + VirtualSMCAPI::addKey(getTemperatureSMCKeyForType(readBigWordMMIOCached(EC::B_NUC_EC_VA_TEMP4_TYPE_U8)), vsmcPlugin.data, VirtualSMCAPI::valueWithSp(0, SmcKeyTypeSp78, new TemperatureKey(getSmcSuperIO(), this, 3))); + VirtualSMCAPI::addKey(getTemperatureSMCKeyForType(readBigWordMMIOCached(EC::B_NUC_EC_VA_TEMP5_TYPE_U8)), vsmcPlugin.data, VirtualSMCAPI::valueWithSp(0, SmcKeyTypeSp78, new TemperatureKey(getSmcSuperIO(), this, 4))); } }; -class Device_0x8860 final : public GeneratedWinbondDevice_8 { +class Device_Intel_EC_VA final : public GeneratedECDevice_11 { public: - static SuperIODevice *createDevice(uint16_t deviceId) { - if ((deviceId & 0xFFF0) == 0x8860) - return new Device_0x8860(); + static SuperIODevice *createDevice(const char *name) { + if (strcmp(name, "Intel_EC_VA") == 0) + return new Device_Intel_EC_VA(); return nullptr; } - uint8_t getLdn() override { - return 0x0B; - } - const char* getModelName() override { - return "Winbond W83627EHG"; + return "Intel NUC Embedded Controller"; } }; -class Device_0xB070 final : public GeneratedWinbondDevice_8 { +class GeneratedECDevice_12 : public EC::ECDeviceNUC { public: - static SuperIODevice *createDevice(uint16_t deviceId) { - if ((deviceId & 0xFFF0) == 0xB070) - return new Device_0xB070(); - return nullptr; + uint8_t getTachometerCount() override { + return 1; } - uint8_t getLdn() override { - return 0x0B; + uint16_t updateTachometer(uint8_t index) override { + switch (index) { + case 0: return readBigWordMMIO(EC::B_NUC_EC_V2_CPU_FAN_U16); + default: break; + } + return tachometerRead(index); } - const char* getModelName() override { - return "Winbond W83627DHGP"; - } + const char* getTachometerName(uint8_t index) override { + if (index < getTachometerCount()) { + return tachometerNames[index]; + } + return nullptr; + } + +private: + const char* tachometerNames[1] = { + "FAN", + }; +public: + uint8_t getVoltageCount() override { + return 4; + } + + float updateVoltage(uint8_t index) override { + switch (index) { + case 0: return (float)readBigWordMMIO(EC::B_NUC_EC_V2_CPU1_INPUT_U16) / 1000; + case 1: return (float)readBigWordMMIO(EC::B_NUC_EC_V2_SDRAM_U16) / 1000; + case 2: return (float)readBigWordMMIO(EC::B_NUC_EC_V2_V33_U16) / 1000; + case 3: return (float)readBigWordMMIO(EC::B_NUC_EC_V2_V5_U16) / 1000; + default: break; + } + return voltageRead(index); + } + + const char* getVoltageName(uint8_t index) override { + if (index < getVoltageCount()) { + return voltageNames[index]; + } + return nullptr; + } + +private: + const char* voltageNames[4] = { + "CPUVCORE", + "VDRAM", + "VDD33", + "VDD5", + }; +protected: + void setupVoltageKeys(VirtualSMCAPI::Plugin &vsmcPlugin) override { + VirtualSMCAPI::addKey(KeyVM0R(0), vsmcPlugin.data, VirtualSMCAPI::valueWithFlt(0, new VoltageKey(getSmcSuperIO(), this, 1))); + VirtualSMCAPI::addKey(KeyVR3R, vsmcPlugin.data, VirtualSMCAPI::valueWithFlt(0, new VoltageKey(getSmcSuperIO(), this, 2))); + VirtualSMCAPI::addKey(KeyV50R(0), vsmcPlugin.data, VirtualSMCAPI::valueWithFlt(0, new VoltageKey(getSmcSuperIO(), this, 3))); + } +public: + uint8_t getTemperatureCount() override { + return 2; + } + + float updateTemperature(uint8_t index) override { + switch (index) { + case 0: return readBigWordMMIO(EC::B_NUC_EC_V2_VR_TEMP_U8); + case 1: return readBigWordMMIO(EC::B_NUC_EC_V2_MOTHERBOARD_TEMP_U8); + default: break; + } + return temperatureRead(index); + } + + const char* getTemperatureName(uint8_t index) override { + if (index < getTemperatureCount()) { + return temperatureNames[index]; + } + return nullptr; + } + +private: + const char* temperatureNames[2] = { + "TVR", + "TMLB", + }; + +}; + +class Device_Intel_EC_V2 final : public GeneratedECDevice_12 { +public: + static SuperIODevice *createDevice(const char *name) { + if (strcmp(name, "Intel_EC_V2") == 0) + return new Device_Intel_EC_V2(); + return nullptr; + } + + const char* getModelName() override { + return "Intel NUC Embedded Controller"; + } + +}; + +class GeneratedWinbondDevice_13 : public Winbond::WinbondDevice { +public: + uint8_t getTachometerCount() override { + return 5; + } + + uint16_t updateTachometer(uint8_t index) override { + return tachometerRead(index); + } + + const char* getTachometerName(uint8_t index) override { + if (index < getTachometerCount()) { + return tachometerNames[index]; + } + return nullptr; + } + +private: + const char* tachometerNames[5] = { + "SYSFAN", + "CPUFAN0", + "AUXFAN0", + "CPUFAN1", + "AUXFAN1", + }; +public: + uint8_t getVoltageCount() override { + return 9; + } + + float updateVoltage(uint8_t index) override { + return voltageRead(index); + } + + const char* getVoltageName(uint8_t index) override { + if (index < getVoltageCount()) { + return voltageNames[index]; + } + return nullptr; + } + +private: + const char* voltageNames[9] = { + "CPUVCORE", + "VIN0", + "AVCC", + "3VCC", + "VIN1", + "VIN2", + "VIN3", + "VSB", + "VBAT", + }; + +}; + +class Device_0xA020 final : public GeneratedWinbondDevice_13 { +public: + static SuperIODevice *createDevice(uint16_t deviceId) { + if ((deviceId & 0xFFF0) == 0xA020) + return new Device_0xA020(); + return nullptr; + } + + uint8_t getLdn() override { + return 0x0B; + } + + const char* getModelName() override { + return "Winbond W83627DHG"; + } + +}; + +class Device_0x8860 final : public GeneratedWinbondDevice_13 { +public: + static SuperIODevice *createDevice(uint16_t deviceId) { + if ((deviceId & 0xFFF0) == 0x8860) + return new Device_0x8860(); + return nullptr; + } + + uint8_t getLdn() override { + return 0x0B; + } + + const char* getModelName() override { + return "Winbond W83627EHG"; + } + +}; + +class Device_0xB070 final : public GeneratedWinbondDevice_13 { +public: + static SuperIODevice *createDevice(uint16_t deviceId) { + if ((deviceId & 0xFFF0) == 0xB070) + return new Device_0xB070(); + return nullptr; + } + + uint8_t getLdn() override { + return 0x0B; + } + + const char* getModelName() override { + return "Winbond W83627DHGP"; + } }; -class Device_0xA510 final : public GeneratedWinbondDevice_8 { +class Device_0xA510 final : public GeneratedWinbondDevice_13 { public: static SuperIODevice *createDevice(uint16_t deviceId) { if ((deviceId & 0xFFF0) == 0xA510) @@ -1128,7 +1701,7 @@ class Device_0xA510 final : public GeneratedWinbondDevice_8 { }; -class Device_0xB350 final : public GeneratedWinbondDevice_8 { +class Device_0xB350 final : public GeneratedWinbondDevice_13 { public: static SuperIODevice *createDevice(uint16_t deviceId) { if ((deviceId & 0xFFF0) == 0xB350) @@ -1146,7 +1719,7 @@ class Device_0xB350 final : public GeneratedWinbondDevice_8 { }; -class GeneratedFintekDevice_9 : public Fintek::FintekDevice { +class GeneratedFintekDevice_14 : public Fintek::FintekDevice { public: uint8_t getTachometerCount() override { return 3; @@ -1200,7 +1773,7 @@ class GeneratedFintekDevice_9 : public Fintek::FintekDevice { }; -class Device_0x0601 final : public GeneratedFintekDevice_9 { +class Device_0x0601 final : public GeneratedFintekDevice_14 { public: static SuperIODevice *createDevice(uint16_t deviceId) { if (deviceId == 0x0601) @@ -1218,7 +1791,7 @@ class Device_0x0601 final : public GeneratedFintekDevice_9 { }; -class Device_0x1106 final : public GeneratedFintekDevice_9 { +class Device_0x1106 final : public GeneratedFintekDevice_14 { public: static SuperIODevice *createDevice(uint16_t deviceId) { if (deviceId == 0x1106) @@ -1236,7 +1809,7 @@ class Device_0x1106 final : public GeneratedFintekDevice_9 { }; -class Device_0x0814 final : public GeneratedFintekDevice_9 { +class Device_0x0814 final : public GeneratedFintekDevice_14 { public: static SuperIODevice *createDevice(uint16_t deviceId) { if (deviceId == 0x0814) @@ -1254,7 +1827,7 @@ class Device_0x0814 final : public GeneratedFintekDevice_9 { }; -class Device_0x1007 final : public GeneratedFintekDevice_9 { +class Device_0x1007 final : public GeneratedFintekDevice_14 { public: static SuperIODevice *createDevice(uint16_t deviceId) { if (deviceId == 0x1007) @@ -1272,7 +1845,7 @@ class Device_0x1007 final : public GeneratedFintekDevice_9 { }; -class Device_0x1005 final : public GeneratedFintekDevice_9 { +class Device_0x1005 final : public GeneratedFintekDevice_14 { public: static SuperIODevice *createDevice(uint16_t deviceId) { if (deviceId == 0x1005) @@ -1290,7 +1863,7 @@ class Device_0x1005 final : public GeneratedFintekDevice_9 { }; -class Device_0x0909 final : public GeneratedFintekDevice_9 { +class Device_0x0909 final : public GeneratedFintekDevice_14 { public: static SuperIODevice *createDevice(uint16_t deviceId) { if (deviceId == 0x0909) @@ -1308,7 +1881,7 @@ class Device_0x0909 final : public GeneratedFintekDevice_9 { }; -class Device_0x0723 final : public GeneratedFintekDevice_9 { +class Device_0x0723 final : public GeneratedFintekDevice_14 { public: static SuperIODevice *createDevice(uint16_t deviceId) { if (deviceId == 0x0723) @@ -1326,7 +1899,120 @@ class Device_0x0723 final : public GeneratedFintekDevice_9 { }; -class GeneratedITEDevice_10 : public ITE::ITEDevice { +class GeneratedECDevice_15 : public EC::ECDeviceNUC { +public: + uint8_t getTachometerCount() override { + return 1; + } + + uint16_t updateTachometer(uint8_t index) override { + switch (index) { + case 0: return readBigWordMMIO(EC::B_NUC_EC_V4_FAN_U16); + default: break; + } + return tachometerRead(index); + } + + const char* getTachometerName(uint8_t index) override { + if (index < getTachometerCount()) { + return tachometerNames[index]; + } + return nullptr; + } + +private: + const char* tachometerNames[1] = { + "FAN", + }; +public: + uint8_t getVoltageCount() override { + return 3; + } + + float updateVoltage(uint8_t index) override { + switch (index) { + case 0: return (float)readBigWordMMIO(EC::B_NUC_EC_V4_CPU_CORE_U16) / 1000; + case 1: return (float)readBigWordMMIO(EC::B_NUC_EC_V4_DIMM_U16) / 1000; + case 2: return (float)readBigWordMMIO(EC::B_NUC_EC_V4_DC_IN_U16) / 1000; + default: break; + } + return voltageRead(index); + } + + const char* getVoltageName(uint8_t index) override { + if (index < getVoltageCount()) { + return voltageNames[index]; + } + return nullptr; + } + +private: + const char* voltageNames[3] = { + "CPUVCORE", + "VDIMM", + "VIN", + }; +protected: + void setupVoltageKeys(VirtualSMCAPI::Plugin &vsmcPlugin) override { + VirtualSMCAPI::addKey(KeyVM0R(0), vsmcPlugin.data, VirtualSMCAPI::valueWithFlt(0, new VoltageKey(getSmcSuperIO(), this, 1))); + VirtualSMCAPI::addKey(KeyVD0R(0), vsmcPlugin.data, VirtualSMCAPI::valueWithFlt(0, new VoltageKey(getSmcSuperIO(), this, 2))); + } +public: + uint8_t getTemperatureCount() override { + return 5; + } + + float updateTemperature(uint8_t index) override { + switch (index) { + case 0: return readBigWordMMIO(EC::B_NUC_EC_V4_CPU_TEMP_U8); + case 1: return readBigWordMMIO(EC::B_NUC_EC_V4_GPU_TEMP_U8); + case 2: return readBigWordMMIO(EC::B_NUC_EC_V4_PCH_TEMP_U8); + case 3: return readBigWordMMIO(EC::B_NUC_EC_V4_CPU_VR_TEMP_U8); + case 4: return readBigWordMMIO(EC::B_NUC_EC_V4_MOTHERBOARD_TEMP_U8); + default: break; + } + return temperatureRead(index); + } + + const char* getTemperatureName(uint8_t index) override { + if (index < getTemperatureCount()) { + return temperatureNames[index]; + } + return nullptr; + } + +private: + const char* temperatureNames[5] = { + "TCPU", + "TGPU", + "TPCH", + "TVRMCPU", + "TMLB", + }; +protected: + void setupTemperatureKeys(VirtualSMCAPI::Plugin &vsmcPlugin) override { + VirtualSMCAPI::addKey(KeyTC0P(0), vsmcPlugin.data, VirtualSMCAPI::valueWithSp(0, SmcKeyTypeSp78, new TemperatureKey(getSmcSuperIO(), this, 0))); + VirtualSMCAPI::addKey(KeyTG0P(0), vsmcPlugin.data, VirtualSMCAPI::valueWithSp(0, SmcKeyTypeSp78, new TemperatureKey(getSmcSuperIO(), this, 1))); + VirtualSMCAPI::addKey(KeyTP0P(0), vsmcPlugin.data, VirtualSMCAPI::valueWithSp(0, SmcKeyTypeSp78, new TemperatureKey(getSmcSuperIO(), this, 2))); + } + +}; + +class Device_Intel_EC_V4 final : public GeneratedECDevice_15 { +public: + static SuperIODevice *createDevice(const char *name) { + if (strcmp(name, "Intel_EC_V4") == 0) + return new Device_Intel_EC_V4(); + return nullptr; + } + + const char* getModelName() override { + return "Intel NUC Embedded Controller"; + } + +}; + +class GeneratedITEDevice_16 : public ITE::ITEDevice { public: uint8_t getTachometerCount() override { return 5; @@ -1382,7 +2068,7 @@ class GeneratedITEDevice_10 : public ITE::ITEDevice { }; -class Device_0x8716 final : public GeneratedITEDevice_10 { +class Device_0x8716 final : public GeneratedITEDevice_16 { public: static SuperIODevice *createDevice(uint16_t deviceId) { if (deviceId == 0x8716) @@ -1400,7 +2086,7 @@ class Device_0x8716 final : public GeneratedITEDevice_10 { }; -class Device_0x8718 final : public GeneratedITEDevice_10 { +class Device_0x8718 final : public GeneratedITEDevice_16 { public: static SuperIODevice *createDevice(uint16_t deviceId) { if (deviceId == 0x8718) @@ -1418,7 +2104,7 @@ class Device_0x8718 final : public GeneratedITEDevice_10 { }; -class Device_0x8720 final : public GeneratedITEDevice_10 { +class Device_0x8720 final : public GeneratedITEDevice_16 { public: static SuperIODevice *createDevice(uint16_t deviceId) { if (deviceId == 0x8720) @@ -1436,13 +2122,203 @@ class Device_0x8720 final : public GeneratedITEDevice_10 { }; -class GeneratedFintekDevice_11 : public Fintek::FintekDevice { +class GeneratedFintekDevice_17 : public Fintek::FintekDevice { +public: + uint8_t getTachometerCount() override { + return 4; + } + + uint16_t updateTachometer(uint8_t index) override { + return tachometerRead(index); + } + + const char* getTachometerName(uint8_t index) override { + if (index < getTachometerCount()) { + return tachometerNames[index]; + } + return nullptr; + } + +private: + const char* tachometerNames[4] = { + "FAN1", + "FAN2", + "FAN3", + "FAN4", + }; +public: + uint8_t getVoltageCount() override { + return 9; + } + + float updateVoltage(uint8_t index) override { + return voltageRead(index); + } + + const char* getVoltageName(uint8_t index) override { + if (index < getVoltageCount()) { + return voltageNames[index]; + } + return nullptr; + } + +private: + const char* voltageNames[9] = { + "VCC3V", + "Vcore", + "V2", + "V3", + "V4", + "V5", + "V6", + "VSB3V", + "VBAT", + }; + +}; + +class Device_0x0541 final : public GeneratedFintekDevice_17 { +public: + static SuperIODevice *createDevice(uint16_t deviceId) { + if (deviceId == 0x0541) + return new Device_0x0541(); + return nullptr; + } + + uint8_t getLdn() override { + return 0x04; + } + + const char* getModelName() override { + return "Fintek F71882"; + } + +}; + +class GeneratedECDevice_18 : public EC::ECDeviceNUC { +public: + uint8_t getTachometerCount() override { + return 1; + } + + uint16_t updateTachometer(uint8_t index) override { + switch (index) { + case 0: return readBigWordMMIO(EC::B_NUC_EC_V6_FAN_U16); + default: break; + } + return tachometerRead(index); + } + + const char* getTachometerName(uint8_t index) override { + if (index < getTachometerCount()) { + return tachometerNames[index]; + } + return nullptr; + } + +private: + const char* tachometerNames[1] = { + "FAN", + }; +public: + uint8_t getVoltageCount() override { + return 3; + } + + float updateVoltage(uint8_t index) override { + switch (index) { + case 0: return (float)readBigWordMMIO(EC::B_NUC_EC_V6_CPU_CORE_U16) / 1000; + case 1: return (float)readBigWordMMIO(EC::B_NUC_EC_V6_DIMM_U16) / 1000; + case 2: return (float)readBigWordMMIO(EC::B_NUC_EC_V6_DC_IN_U16) / 1000; + default: break; + } + return voltageRead(index); + } + + const char* getVoltageName(uint8_t index) override { + if (index < getVoltageCount()) { + return voltageNames[index]; + } + return nullptr; + } + +private: + const char* voltageNames[3] = { + "CPUVCORE", + "VDIMM", + "VIN", + }; +protected: + void setupVoltageKeys(VirtualSMCAPI::Plugin &vsmcPlugin) override { + VirtualSMCAPI::addKey(KeyVM0R(0), vsmcPlugin.data, VirtualSMCAPI::valueWithFlt(0, new VoltageKey(getSmcSuperIO(), this, 1))); + VirtualSMCAPI::addKey(KeyVD0R(0), vsmcPlugin.data, VirtualSMCAPI::valueWithFlt(0, new VoltageKey(getSmcSuperIO(), this, 2))); + } +public: + uint8_t getTemperatureCount() override { + return 5; + } + + float updateTemperature(uint8_t index) override { + switch (index) { + case 0: return readBigWordMMIO(EC::B_NUC_EC_V6_CPU_TEMP_U8); + case 1: return readBigWordMMIO(EC::B_NUC_EC_V6_GPU_TEMP_U8); + case 2: return readBigWordMMIO(EC::B_NUC_EC_V6_PCH_TEMP_U8); + case 3: return readBigWordMMIO(EC::B_NUC_EC_V6_CPU_VR_TEMP_U8); + case 4: return readBigWordMMIO(EC::B_NUC_EC_V6_MOTHERBOARD_TEMP_U8); + default: break; + } + return temperatureRead(index); + } + + const char* getTemperatureName(uint8_t index) override { + if (index < getTemperatureCount()) { + return temperatureNames[index]; + } + return nullptr; + } + +private: + const char* temperatureNames[5] = { + "TCPU", + "TGPU", + "TPCH", + "TVRMCPU", + "TMLB", + }; +protected: + void setupTemperatureKeys(VirtualSMCAPI::Plugin &vsmcPlugin) override { + VirtualSMCAPI::addKey(KeyTC0P(0), vsmcPlugin.data, VirtualSMCAPI::valueWithSp(0, SmcKeyTypeSp78, new TemperatureKey(getSmcSuperIO(), this, 0))); + VirtualSMCAPI::addKey(KeyTG0P(0), vsmcPlugin.data, VirtualSMCAPI::valueWithSp(0, SmcKeyTypeSp78, new TemperatureKey(getSmcSuperIO(), this, 1))); + VirtualSMCAPI::addKey(KeyTP0P(0), vsmcPlugin.data, VirtualSMCAPI::valueWithSp(0, SmcKeyTypeSp78, new TemperatureKey(getSmcSuperIO(), this, 2))); + } + +}; + +class Device_Intel_EC_V6 final : public GeneratedECDevice_18 { +public: + static SuperIODevice *createDevice(const char *name) { + if (strcmp(name, "Intel_EC_V6") == 0) + return new Device_Intel_EC_V6(); + return nullptr; + } + + const char* getModelName() override { + return "Intel NUC Embedded Controller"; + } + +}; + +class GeneratedECDevice_19 : public EC::ECDeviceNUC { public: uint8_t getTachometerCount() override { - return 4; + return 1; } uint16_t updateTachometer(uint8_t index) override { + switch (index) { + case 0: return readBigWordMMIO(EC::B_NUC_EC_V1_SLOT_FAN_U16); + default: break; + } return tachometerRead(index); } @@ -1454,18 +2330,23 @@ class GeneratedFintekDevice_11 : public Fintek::FintekDevice { } private: - const char* tachometerNames[4] = { - "FAN1", - "FAN2", - "FAN3", - "FAN4", + const char* tachometerNames[1] = { + "FAN", }; public: uint8_t getVoltageCount() override { - return 9; + return 5; } float updateVoltage(uint8_t index) override { + switch (index) { + case 0: return (float)readBigWordMMIO(EC::B_NUC_EC_V1_VCORE_U16) / 1000; + case 1: return (float)readBigWordMMIO(EC::B_NUC_EC_V1_VDIMM_U16) / 1000; + case 2: return (float)readBigWordMMIO(EC::B_NUC_EC_V1_VIN_U16) / 1000; + case 3: return (float)readBigWordMMIO(EC::B_NUC_EC_V1_VCC3_U16) / 1000; + case 4: return (float)readBigWordMMIO(EC::B_NUC_EC_V1_VCCIO_U16) / 1000; + default: break; + } return voltageRead(index); } @@ -1477,39 +2358,74 @@ class GeneratedFintekDevice_11 : public Fintek::FintekDevice { } private: - const char* voltageNames[9] = { - "VCC3V", - "Vcore", - "V2", - "V3", - "V4", - "V5", - "V6", - "VSB3V", - "VBAT", + const char* voltageNames[5] = { + "CPUVCORE", + "VDIMM", + "VIN", + "VDD33", + "VIO", }; +protected: + void setupVoltageKeys(VirtualSMCAPI::Plugin &vsmcPlugin) override { + VirtualSMCAPI::addKey(KeyVM0R(0), vsmcPlugin.data, VirtualSMCAPI::valueWithFlt(0, new VoltageKey(getSmcSuperIO(), this, 1))); + VirtualSMCAPI::addKey(KeyVD0R(0), vsmcPlugin.data, VirtualSMCAPI::valueWithFlt(0, new VoltageKey(getSmcSuperIO(), this, 2))); + VirtualSMCAPI::addKey(KeyVR3R, vsmcPlugin.data, VirtualSMCAPI::valueWithFlt(0, new VoltageKey(getSmcSuperIO(), this, 3))); + } +public: + uint8_t getTemperatureCount() override { + return 4; + } -}; + float updateTemperature(uint8_t index) override { + switch (index) { + case 0: return readBigWordMMIO(EC::B_NUC_EC_V1_CPU_TEMP_U8); + case 1: return readBigWordMMIO(EC::B_NUC_EC_V1_PCH_TEMP_U8); + case 2: return readBigWordMMIO(EC::B_NUC_EC_V1_DIMM_TEMP_U8); + case 3: return readBigWordMMIO(EC::B_NUC_EC_V1_HDD_TEMP_U8); + default: break; + } + return temperatureRead(index); + } -class Device_0x0541 final : public GeneratedFintekDevice_11 { -public: - static SuperIODevice *createDevice(uint16_t deviceId) { - if (deviceId == 0x0541) - return new Device_0x0541(); + const char* getTemperatureName(uint8_t index) override { + if (index < getTemperatureCount()) { + return temperatureNames[index]; + } return nullptr; } - uint8_t getLdn() override { - return 0x04; +private: + const char* temperatureNames[4] = { + "TCPU", + "TPCH", + "TDIMM", + "THHD", + }; +protected: + void setupTemperatureKeys(VirtualSMCAPI::Plugin &vsmcPlugin) override { + VirtualSMCAPI::addKey(KeyTC0P(0), vsmcPlugin.data, VirtualSMCAPI::valueWithSp(0, SmcKeyTypeSp78, new TemperatureKey(getSmcSuperIO(), this, 0))); + VirtualSMCAPI::addKey(KeyTP0P(0), vsmcPlugin.data, VirtualSMCAPI::valueWithSp(0, SmcKeyTypeSp78, new TemperatureKey(getSmcSuperIO(), this, 1))); + VirtualSMCAPI::addKey(KeyTM0P(0), vsmcPlugin.data, VirtualSMCAPI::valueWithSp(0, SmcKeyTypeSp78, new TemperatureKey(getSmcSuperIO(), this, 2))); + VirtualSMCAPI::addKey(KeyTH0P(0), vsmcPlugin.data, VirtualSMCAPI::valueWithSp(0, SmcKeyTypeSp78, new TemperatureKey(getSmcSuperIO(), this, 3))); + } + +}; + +class Device_Intel_EC_V1 final : public GeneratedECDevice_19 { +public: + static SuperIODevice *createDevice(const char *name) { + if (strcmp(name, "Intel_EC_V1") == 0) + return new Device_Intel_EC_V1(); + return nullptr; } const char* getModelName() override { - return "Fintek F71882"; + return "Intel NUC Embedded Controller"; } }; -class GeneratedNuvotonDevice_12 : public Nuvoton::NuvotonDevice { +class GeneratedNuvotonDevice_20 : public Nuvoton::NuvotonDevice { public: uint8_t getTachometerCount() override { return 5; @@ -1566,7 +2482,7 @@ class GeneratedNuvotonDevice_12 : public Nuvoton::NuvotonDevice { }; -class Device_0xC330 final : public GeneratedNuvotonDevice_12 { +class Device_0xC330 final : public GeneratedNuvotonDevice_20 { public: static SuperIODevice *createDevice(uint16_t deviceId) { if ((deviceId & 0xFFF0) == 0xC330) @@ -1584,7 +2500,120 @@ class Device_0xC330 final : public GeneratedNuvotonDevice_12 { }; -class GeneratedNuvotonDevice_13 : public Nuvoton::NuvotonDevice { +class GeneratedECDevice_21 : public EC::ECDeviceNUC { +public: + uint8_t getTachometerCount() override { + return 1; + } + + uint16_t updateTachometer(uint8_t index) override { + switch (index) { + case 0: return readBigWordMMIO(EC::B_NUC_EC_V3_CPU_FAN_U16); + default: break; + } + return tachometerRead(index); + } + + const char* getTachometerName(uint8_t index) override { + if (index < getTachometerCount()) { + return tachometerNames[index]; + } + return nullptr; + } + +private: + const char* tachometerNames[1] = { + "FAN", + }; +public: + uint8_t getVoltageCount() override { + return 4; + } + + float updateVoltage(uint8_t index) override { + switch (index) { + case 0: return (float)readBigWordMMIO(EC::B_NUC_EC_V3_CPU1_INPUT_U16) / 1000; + case 1: return (float)readBigWordMMIO(EC::B_NUC_EC_V3_SDRAM_U16) / 1000; + case 2: return (float)readBigWordMMIO(EC::B_NUC_EC_V3_V33_U16) / 1000; + case 3: return (float)readBigWordMMIO(EC::B_NUC_EC_V3_CPU_IO_U16) / 1000; + default: break; + } + return voltageRead(index); + } + + const char* getVoltageName(uint8_t index) override { + if (index < getVoltageCount()) { + return voltageNames[index]; + } + return nullptr; + } + +private: + const char* voltageNames[4] = { + "CPUVCORE", + "VDRAM", + "VDD33", + "VIO", + }; +protected: + void setupVoltageKeys(VirtualSMCAPI::Plugin &vsmcPlugin) override { + VirtualSMCAPI::addKey(KeyVM0R(0), vsmcPlugin.data, VirtualSMCAPI::valueWithFlt(0, new VoltageKey(getSmcSuperIO(), this, 1))); + VirtualSMCAPI::addKey(KeyVR3R, vsmcPlugin.data, VirtualSMCAPI::valueWithFlt(0, new VoltageKey(getSmcSuperIO(), this, 2))); + } +public: + uint8_t getTemperatureCount() override { + return 4; + } + + float updateTemperature(uint8_t index) override { + switch (index) { + case 0: return readBigWordMMIO(EC::B_NUC_EC_V3_CPU_TEMP_U8); + case 1: return readBigWordMMIO(EC::B_NUC_EC_V3_PCH_TEMP_U8); + case 2: return readBigWordMMIO(EC::B_NUC_EC_V3_MEMORY_TEMP_U8); + case 3: return readBigWordMMIO(EC::B_NUC_EC_V3_MOTHERBOARD_TEMP_U8); + default: break; + } + return temperatureRead(index); + } + + const char* getTemperatureName(uint8_t index) override { + if (index < getTemperatureCount()) { + return temperatureNames[index]; + } + return nullptr; + } + +private: + const char* temperatureNames[4] = { + "TCPU", + "TPCH", + "TDRAM", + "TMLB", + }; +protected: + void setupTemperatureKeys(VirtualSMCAPI::Plugin &vsmcPlugin) override { + VirtualSMCAPI::addKey(KeyTC0P(0), vsmcPlugin.data, VirtualSMCAPI::valueWithSp(0, SmcKeyTypeSp78, new TemperatureKey(getSmcSuperIO(), this, 0))); + VirtualSMCAPI::addKey(KeyTP0P(0), vsmcPlugin.data, VirtualSMCAPI::valueWithSp(0, SmcKeyTypeSp78, new TemperatureKey(getSmcSuperIO(), this, 1))); + VirtualSMCAPI::addKey(KeyTM0P(0), vsmcPlugin.data, VirtualSMCAPI::valueWithSp(0, SmcKeyTypeSp78, new TemperatureKey(getSmcSuperIO(), this, 2))); + } + +}; + +class Device_Intel_EC_V3 final : public GeneratedECDevice_21 { +public: + static SuperIODevice *createDevice(const char *name) { + if (strcmp(name, "Intel_EC_V3") == 0) + return new Device_Intel_EC_V3(); + return nullptr; + } + + const char* getModelName() override { + return "Intel NUC Embedded Controller"; + } + +}; + +class GeneratedNuvotonDevice_22 : public Nuvoton::NuvotonDevice { void onPowerOn() override { onPowerOn679xx(); } @@ -1651,7 +2680,7 @@ class GeneratedNuvotonDevice_13 : public Nuvoton::NuvotonDevice { }; -class Device_0xC803 final : public GeneratedNuvotonDevice_13 { +class Device_0xC803 final : public GeneratedNuvotonDevice_22 { public: static SuperIODevice *createDevice(uint16_t deviceId) { if (deviceId == 0xC803) @@ -1669,7 +2698,7 @@ class Device_0xC803 final : public GeneratedNuvotonDevice_13 { }; -class Device_0xC911 final : public GeneratedNuvotonDevice_13 { +class Device_0xC911 final : public GeneratedNuvotonDevice_22 { public: static SuperIODevice *createDevice(uint16_t deviceId) { if (deviceId == 0xC911) @@ -1687,7 +2716,7 @@ class Device_0xC911 final : public GeneratedNuvotonDevice_13 { }; -class Device_0xD121 final : public GeneratedNuvotonDevice_13 { +class Device_0xD121 final : public GeneratedNuvotonDevice_22 { public: static SuperIODevice *createDevice(uint16_t deviceId) { if (deviceId == 0xD121) @@ -1705,7 +2734,7 @@ class Device_0xD121 final : public GeneratedNuvotonDevice_13 { }; -class Device_0xD352 final : public GeneratedNuvotonDevice_13 { +class Device_0xD352 final : public GeneratedNuvotonDevice_22 { public: static SuperIODevice *createDevice(uint16_t deviceId) { if (deviceId == 0xD352) @@ -1723,7 +2752,7 @@ class Device_0xD352 final : public GeneratedNuvotonDevice_13 { }; -class GeneratedFintekDevice_14 : public Fintek::FintekDevice { +class GeneratedFintekDevice_23 : public Fintek::FintekDevice { public: uint8_t getTachometerCount() override { return 4; @@ -1769,7 +2798,7 @@ class GeneratedFintekDevice_14 : public Fintek::FintekDevice { }; -class Device_0x0507 final : public GeneratedFintekDevice_14 { +class Device_0x0507 final : public GeneratedFintekDevice_23 { public: static SuperIODevice *createDevice(uint16_t deviceId) { if (deviceId == 0x0507) @@ -1787,7 +2816,231 @@ class Device_0x0507 final : public GeneratedFintekDevice_14 { }; -class GeneratedWinbondDevice_15 : public Winbond::WinbondDevice { +class GeneratedECDevice_24 : public EC::ECDeviceNUC { +public: + uint8_t getTachometerCount() override { + return 1; + } + + uint16_t updateTachometer(uint8_t index) override { + switch (index) { + case 0: return readBigWordMMIO(EC::B_NUC_EC_V7_CPU_FAN_U16); + default: break; + } + return tachometerRead(index); + } + + const char* getTachometerName(uint8_t index) override { + if (index < getTachometerCount()) { + return tachometerNames[index]; + } + return nullptr; + } + +private: + const char* tachometerNames[1] = { + "FAN", + }; +public: + uint8_t getVoltageCount() override { + return 5; + } + + float updateVoltage(uint8_t index) override { + switch (index) { + case 0: return (float)readBigWordMMIO(EC::B_NUC_EC_V7_VCORE_U16) / 1000; + case 1: return (float)readBigWordMMIO(EC::B_NUC_EC_V7_VDIMM_U16) / 1000; + case 2: return (float)readBigWordMMIO(EC::B_NUC_EC_V7_VIN_U16) / 1000; + case 3: return (float)readBigWordMMIO(EC::B_NUC_EC_V7_V33_U16) / 1000; + case 4: return (float)readBigWordMMIO(EC::B_NUC_EC_V7_V5_VCC_U16) / 1000; + default: break; + } + return voltageRead(index); + } + + const char* getVoltageName(uint8_t index) override { + if (index < getVoltageCount()) { + return voltageNames[index]; + } + return nullptr; + } + +private: + const char* voltageNames[5] = { + "CPUVCORE", + "VDIMM", + "VIN", + "VDD33", + "VDD5", + }; +protected: + void setupVoltageKeys(VirtualSMCAPI::Plugin &vsmcPlugin) override { + VirtualSMCAPI::addKey(KeyVM0R(0), vsmcPlugin.data, VirtualSMCAPI::valueWithFlt(0, new VoltageKey(getSmcSuperIO(), this, 1))); + VirtualSMCAPI::addKey(KeyVD0R(0), vsmcPlugin.data, VirtualSMCAPI::valueWithFlt(0, new VoltageKey(getSmcSuperIO(), this, 2))); + VirtualSMCAPI::addKey(KeyVR3R, vsmcPlugin.data, VirtualSMCAPI::valueWithFlt(0, new VoltageKey(getSmcSuperIO(), this, 3))); + VirtualSMCAPI::addKey(KeyV50R(0), vsmcPlugin.data, VirtualSMCAPI::valueWithFlt(0, new VoltageKey(getSmcSuperIO(), this, 4))); + } +public: + uint8_t getTemperatureCount() override { + return 3; + } + + float updateTemperature(uint8_t index) override { + switch (index) { + case 0: return readBigWordMMIO(EC::B_NUC_EC_V7_DIMM_TEMP_U8); + case 1: return readBigWordMMIO(EC::B_NUC_EC_V7_VR_TEMP_U8); + case 2: return readBigWordMMIO(EC::B_NUC_EC_V7_MOTHERBOARD_TEMP_U8); + default: break; + } + return temperatureRead(index); + } + + const char* getTemperatureName(uint8_t index) override { + if (index < getTemperatureCount()) { + return temperatureNames[index]; + } + return nullptr; + } + +private: + const char* temperatureNames[3] = { + "TDIMM", + "TVRM", + "TMLB", + }; +protected: + void setupTemperatureKeys(VirtualSMCAPI::Plugin &vsmcPlugin) override { + VirtualSMCAPI::addKey(KeyTM0P(0), vsmcPlugin.data, VirtualSMCAPI::valueWithSp(0, SmcKeyTypeSp78, new TemperatureKey(getSmcSuperIO(), this, 0))); + } + +}; + +class Device_Intel_EC_V7 final : public GeneratedECDevice_24 { +public: + static SuperIODevice *createDevice(const char *name) { + if (strcmp(name, "Intel_EC_V7") == 0) + return new Device_Intel_EC_V7(); + return nullptr; + } + + const char* getModelName() override { + return "Intel NUC Embedded Controller"; + } + +}; + +class GeneratedECDevice_25 : public EC::ECDeviceNUC { +public: + uint8_t getTachometerCount() override { + return 2; + } + + uint16_t updateTachometer(uint8_t index) override { + switch (index) { + case 0: return readBigWordMMIO(EC::B_NUC_EC_V5_FAN1_U16); + case 1: return readBigWordMMIO(EC::B_NUC_EC_V5_FAN2_U16); + default: break; + } + return tachometerRead(index); + } + + const char* getTachometerName(uint8_t index) override { + if (index < getTachometerCount()) { + return tachometerNames[index]; + } + return nullptr; + } + +private: + const char* tachometerNames[2] = { + "FANCPU", + "FANEXT", + }; +public: + uint8_t getVoltageCount() override { + return 3; + } + + float updateVoltage(uint8_t index) override { + switch (index) { + case 0: return (float)readBigWordMMIO(EC::B_NUC_EC_V5_CPU_U16) / 1000; + case 1: return (float)readBigWordMMIO(EC::B_NUC_EC_V5_DIMM_U16) / 1000; + case 2: return (float)readBigWordMMIO(EC::B_NUC_EC_V5_DC_IN_U16) / 1000; + default: break; + } + return voltageRead(index); + } + + const char* getVoltageName(uint8_t index) override { + if (index < getVoltageCount()) { + return voltageNames[index]; + } + return nullptr; + } + +private: + const char* voltageNames[3] = { + "CPUVCORE", + "VDIMM", + "VIN", + }; +protected: + void setupVoltageKeys(VirtualSMCAPI::Plugin &vsmcPlugin) override { + VirtualSMCAPI::addKey(KeyVM0R(0), vsmcPlugin.data, VirtualSMCAPI::valueWithFlt(0, new VoltageKey(getSmcSuperIO(), this, 1))); + VirtualSMCAPI::addKey(KeyVD0R(0), vsmcPlugin.data, VirtualSMCAPI::valueWithFlt(0, new VoltageKey(getSmcSuperIO(), this, 2))); + } +public: + uint8_t getTemperatureCount() override { + return 3; + } + + float updateTemperature(uint8_t index) override { + switch (index) { + case 0: return readBigWordMMIO(EC::B_NUC_EC_V5_CPU_TEMP_U8); + case 1: return readBigWordMMIO(EC::B_NUC_EC_V5_PCH_TEMP_U8); + case 2: return readBigWordMMIO(EC::B_NUC_EC_V5_MEMORY_TEMP_U8); + default: break; + } + return temperatureRead(index); + } + + const char* getTemperatureName(uint8_t index) override { + if (index < getTemperatureCount()) { + return temperatureNames[index]; + } + return nullptr; + } + +private: + const char* temperatureNames[3] = { + "TCPU", + "TPCH", + "TDIMM", + }; +protected: + void setupTemperatureKeys(VirtualSMCAPI::Plugin &vsmcPlugin) override { + VirtualSMCAPI::addKey(KeyTC0P(0), vsmcPlugin.data, VirtualSMCAPI::valueWithSp(0, SmcKeyTypeSp78, new TemperatureKey(getSmcSuperIO(), this, 0))); + VirtualSMCAPI::addKey(KeyTP0P(0), vsmcPlugin.data, VirtualSMCAPI::valueWithSp(0, SmcKeyTypeSp78, new TemperatureKey(getSmcSuperIO(), this, 1))); + VirtualSMCAPI::addKey(KeyTM0P(0), vsmcPlugin.data, VirtualSMCAPI::valueWithSp(0, SmcKeyTypeSp78, new TemperatureKey(getSmcSuperIO(), this, 2))); + } + +}; + +class Device_Intel_EC_V5 final : public GeneratedECDevice_25 { +public: + static SuperIODevice *createDevice(const char *name) { + if (strcmp(name, "Intel_EC_V5") == 0) + return new Device_Intel_EC_V5(); + return nullptr; + } + + const char* getModelName() override { + return "Intel NUC Embedded Controller"; + } + +}; + +class GeneratedWinbondDevice_26 : public Winbond::WinbondDevice { public: uint8_t getTachometerCount() override { return 5; @@ -1844,7 +3097,7 @@ class GeneratedWinbondDevice_15 : public Winbond::WinbondDevice { }; -class Device_0x8850 final : public GeneratedWinbondDevice_15 { +class Device_0x8850 final : public GeneratedWinbondDevice_26 { public: static SuperIODevice *createDevice(uint16_t deviceId) { if ((deviceId & 0xFFF0) == 0x8850) @@ -1976,3 +3229,29 @@ SuperIODevice *createDeviceITE(uint16_t deviceId) { if (device) return device; return nullptr; } +SuperIODevice *createDeviceEC(const char *name) { + SuperIODevice *device; + device = Device_Intel_EC_V9::createDevice(name); + if (device) return device; + device = Device_Intel_EC_VB::createDevice(name); + if (device) return device; + device = Device_Intel_EC_V8::createDevice(name); + if (device) return device; + device = Device_Intel_EC_VA::createDevice(name); + if (device) return device; + device = Device_Intel_EC_V2::createDevice(name); + if (device) return device; + device = Device_Intel_EC_V4::createDevice(name); + if (device) return device; + device = Device_Intel_EC_V6::createDevice(name); + if (device) return device; + device = Device_Intel_EC_V1::createDevice(name); + if (device) return device; + device = Device_Intel_EC_V3::createDevice(name); + if (device) return device; + device = Device_Intel_EC_V7::createDevice(name); + if (device) return device; + device = Device_Intel_EC_V5::createDevice(name); + if (device) return device; + return nullptr; +} diff --git a/Sensors/SMCSuperIO/Devices.hpp b/Sensors/SMCSuperIO/Devices.hpp index 31980e5..57edbd0 100644 --- a/Sensors/SMCSuperIO/Devices.hpp +++ b/Sensors/SMCSuperIO/Devices.hpp @@ -12,5 +12,6 @@ SuperIODevice *createDevice(uint16_t deviceId); SuperIODevice *createDeviceITE(uint16_t deviceId); +SuperIODevice *createDeviceEC(const char *name); #endif /* Devices_hpp */ diff --git a/Sensors/SMCSuperIO/ECDevice.cpp b/Sensors/SMCSuperIO/ECDevice.cpp index ee0abd1..8b79b7a 100644 --- a/Sensors/SMCSuperIO/ECDevice.cpp +++ b/Sensors/SMCSuperIO/ECDevice.cpp @@ -159,7 +159,7 @@ namespace EC { } DBGLOG("ssio", "ECDevice probing device %s", name); - ECDevice *detectedDevice = ECDeviceNUC::detect(sio, name); + ECDevice *detectedDevice = static_cast(createDeviceEC(name)); #ifdef DEBUG bool debug = false; diff --git a/Sensors/SMCSuperIO/ECDevice.hpp b/Sensors/SMCSuperIO/ECDevice.hpp index 60f8df2..6cabe68 100644 --- a/Sensors/SMCSuperIO/ECDevice.hpp +++ b/Sensors/SMCSuperIO/ECDevice.hpp @@ -89,6 +89,19 @@ namespace EC { return true; return supportsPMIO && setupPMIO(); } + + /** + * Subclasses to implement key setup + */ + virtual void setupVoltageKeys(VirtualSMCAPI::Plugin &vsmcPlugin) {} + virtual void setupTemperatureKeys(VirtualSMCAPI::Plugin &vsmcPlugin) {} + + /** + * Default read values + */ + virtual float tachometerRead(uint8_t index) { return 0; } + virtual float voltageRead(uint8_t index) { return 0; } + virtual float temperatureRead(uint8_t index) { return 0; } public: /** @@ -112,7 +125,10 @@ namespace EC { /** * Extra non-standard keys for plugins. */ - virtual void setupExtraKeys(VirtualSMCAPI::Plugin &vsmcPlugin) {} + virtual void setupExtraKeys(VirtualSMCAPI::Plugin &vsmcPlugin) { + setupVoltageKeys(vsmcPlugin); + setupTemperatureKeys(vsmcPlugin); + } /** * Ctor diff --git a/Sensors/SMCSuperIO/ECDeviceNUC.cpp b/Sensors/SMCSuperIO/ECDeviceNUC.cpp index b963359..58fddc2 100644 --- a/Sensors/SMCSuperIO/ECDeviceNUC.cpp +++ b/Sensors/SMCSuperIO/ECDeviceNUC.cpp @@ -9,124 +9,91 @@ namespace EC { - const char* ECDeviceNUC::getModelName() { - return "Intel NUC Embedded Controller"; - } - - uint8_t ECDeviceNUC::getTachometerCount() { - switch (nucGeneration) { - case NucEcGenerationV5: - return 2; - case NucEcGenerationV9: - return 3; - case NucEcGenerationVA: - return 6; - default: - return 1; - } - } - - uint16_t ECDeviceNUC::updateTachometer(uint8_t index) { - switch (nucGeneration) { - case NucEcGenerationV1: - return readBigWordMMIO(B_NUC_EC_V1_SLOT_FAN_U16); - case NucEcGenerationV2: - return readBigWordMMIO(B_NUC_EC_V2_CPU_FAN_U16); - case NucEcGenerationV3: - return readBigWordMMIO(B_NUC_EC_V3_CPU_FAN_U16); - case NucEcGenerationV4: - return readBigWordMMIO(B_NUC_EC_V4_FAN_U16); - case NucEcGenerationV5: - return index == 0 ? readBigWordMMIO(B_NUC_EC_V5_FAN1_U16) : readBigWordMMIO(B_NUC_EC_V5_FAN2_U16); - case NucEcGenerationV6: - return readBigWordMMIO(B_NUC_EC_V6_FAN_U16); - case NucEcGenerationV7: - return readBigWordMMIO(B_NUC_EC_V7_CPU_FAN_U16); - case NucEcGenerationV8: - return readBigWordMMIO(B_NUC_EC_V8_CPU_FAN_U16); - case NucEcGenerationV9: - if (index == 0) return readBigWordMMIO(B_NUC_EC_V9_FAN1_U16); - if (index == 1) return readBigWordMMIO(B_NUC_EC_V9_FAN2_U16); - if (index == 2) return readBigWordMMIO(B_NUC_EC_V9_FAN3_U16); - return 0; - case NucEcGenerationVA: - if (index == 0) return readBigWordMMIO(B_NUC_EC_VA_FAN1_U16); - if (index == 1) return readBigWordMMIO(B_NUC_EC_VA_FAN2_U16); - if (index == 2) return readBigWordMMIO(B_NUC_EC_VA_FAN3_U16); - if (index == 3) return readBigWordMMIO(B_NUC_EC_VA_FAN4_U16); - if (index == 4) return readBigWordMMIO(B_NUC_EC_VA_FAN5_U16); - if (index == 5) return readBigWordMMIO(B_NUC_EC_VA_FAN6_U16); - return 0; - case NucEcGenerationVB: - return readBigWordMMIO(B_NUC_EC_VB_FAN_U16); - default: - return 0; + uint16_t ECDeviceNUC::readBigWordMMIOCached(uint32_t addr) { + for (int i = 0; i < MmioCacheSize; i++) { + uint16_t key = cachedMmio[i] >> 16; + if (key == (uint16_t)addr) { + return cachedMmio[i] & 0xFFFF; + } } + uint16_t value = readBigWordMMIO(addr); + int last = (cachedMmioLast + 1) % MmioCacheSize; + cachedMmio[last] = ((addr & 0xFFFF) << 16) | value; + cachedMmioLast = last; + return value; } - const char *ECDeviceNUC::getTachometerName(uint8_t index) { - // TODO: Better names. - if (getTachometerCount() == 1) return "FAN"; - switch (index) { - case 0: return "FAN1"; - case 1: return "FAN2"; - case 2: return "FAN3"; - case 3: return "FAN4"; - case 4: return "FAN5"; - case 5: return "FAN6"; + const char *ECDeviceNUC::getTachometerNameForType(uint16_t type){ + switch (type) { + case B_NUC_EC_FAN_TYPE_CPU: return "FANCPU"; + case B_NUC_EC_FAN_TYPE_DGPU: return "FANGPU"; + case B_NUC_EC_FAN_TYPE_SYSTEM_FAN1: return "FANSYS1"; + case B_NUC_EC_FAN_TYPE_SYSTEM_FAN2: return "FANSYS2"; + case B_NUC_EC_FAN_TYPE_COOLER_PUMP: return "FANCOOLERPUMP"; + case B_NUC_EC_FAN_TYPE_THERMAL_FAN: return "FANTHERMAL"; default: return "FAN"; } } - uint8_t ECDeviceNUC::getVoltageCount() { - // TODO: Implement. - return 0; - } - - float ECDeviceNUC::updateVoltage(uint8_t index) { - // TODO: Implement. - return 0; - } - - const char *ECDeviceNUC::getVoltageName(uint8_t index) { - return ""; - } - - uint8_t ECDeviceNUC::getTemperatureCount() { - // TODO: Implement. - return 0; - } - - float ECDeviceNUC::updateTemperature(uint8_t index) { - // TODO: Implement. - return 0; + const char *ECDeviceNUC::getVoltageNameForType(uint16_t type) { + switch (type) { + case B_NUC_EC_VOLTAGE_TYPE_CPU_VCCIN: return "CPUVCORE"; + case B_NUC_EC_VOLTAGE_TYPE_CPU_IO: return "VIO"; + case B_NUC_EC_VOLTAGE_TYPE_33V_VSB: return "VSB33"; + case B_NUC_EC_VOLTAGE_TYPE_33V: return "VDD33"; + case B_NUC_EC_VOLTAGE_TYPE_5V_VSB: return "VSB5"; + case B_NUC_EC_VOLTAGE_TYPE_5V: return "VDD5"; + case B_NUC_EC_VOLTAGE_TYPE_DIMM: return "VDIMM"; + case B_NUC_EC_VOLTAGE_TYPE_DC_IN: return "VIN"; + default: return "VOLTAGE"; + } } - const char *ECDeviceNUC::getTemperatureName(uint8_t index) { - return ""; + const char *ECDeviceNUC::getTemperatureNameForType(uint16_t type) { + switch (type) { + case B_NUC_EC_TEMP_TYPE_INTERNAL_AMBIENT: return "TAMBIENT"; + case B_NUC_EC_TEMP_TYPE_CPU_VRM: return "TVRMCPU"; + case B_NUC_EC_TEMP_TYPE_DGPU_VRM: return "TVRMGPU"; + case B_NUC_EC_TEMP_TYPE_SSD_M2_SLOT_1: return "TSSD1"; + case B_NUC_EC_TEMP_TYPE_MEMORY: return "TDIMM"; + case B_NUC_EC_TEMP_TYPE_FAN_AIR_VENT: return "TVENT"; + case B_NUC_EC_TEMP_TYPE_SSD_M2_SLOT_2: return "TSSD2"; + case B_NUC_EC_TEMP_TYPE_SSD_M2_SLOT_3: return "TSSD3"; + case B_NUC_EC_TEMP_TYPE_SSD_M2_SLOT_4: return "TSSD4"; + default: return "TEMPERATURE"; + } } - void ECDeviceNUC::setupExtraKeys(VirtualSMCAPI::Plugin &vsmcPlugin) { - // TODO: Provide various keys for temperatures and voltages here. + SMC_KEY ECDeviceNUC::getTachometerSMCKeyForType(uint16_t type, int index) { + return KeyF0Ac(index); } - ECDevice* ECDeviceNUC::detect(SMCSuperIO* sio, const char *name) { - if (strncmp(name, "Intel_EC_V", strlen("Intel_EC_V")) != 0 || name[strlen("Intel_EC_VX")] != '\0') { - return nullptr; + SMC_KEY ECDeviceNUC::getVoltageSMCKeyForType(uint16_t type, int index) { + switch (type) { + case B_NUC_EC_VOLTAGE_TYPE_CPU_VCCIN: return KeyInvalid; // don't override SMCProcessor value + case B_NUC_EC_VOLTAGE_TYPE_CPU_IO: return KeyInvalid; // don't override SMCProcessor value + case B_NUC_EC_VOLTAGE_TYPE_33V_VSB: return KeyVR3R; + case B_NUC_EC_VOLTAGE_TYPE_33V: return KeyVR3R; + case B_NUC_EC_VOLTAGE_TYPE_5V_VSB: return KeyV50R(index); + case B_NUC_EC_VOLTAGE_TYPE_5V: return KeyV50R(index); + case B_NUC_EC_VOLTAGE_TYPE_DIMM: return KeyVM0R(index); + case B_NUC_EC_VOLTAGE_TYPE_DC_IN: return KeyVD0R(index); + default: return KeyInvalid; } + } - uint32_t gen = 0; - char genChar = name[strlen("Intel_EC_V")]; - if (genChar >= '1' && genChar <= '9') { - gen = (genChar - '1') + NucEcGenerationV1; - } else if (genChar >= 'A' && genChar <= 'B') { - gen = (genChar - 'A') + NucEcGenerationVA; - } else { - SYSLOG("ssio", "unknown NUC EC generation %c", gen); - return nullptr; + SMC_KEY ECDeviceNUC::getTemperatureSMCKeyForType(uint16_t type, int index) { + switch (type) { + case B_NUC_EC_TEMP_TYPE_INTERNAL_AMBIENT: return KeyTH0P(index); + case B_NUC_EC_TEMP_TYPE_CPU_VRM: return KeyTC0P(index); + case B_NUC_EC_TEMP_TYPE_DGPU_VRM: return KeyTG0P(index); + case B_NUC_EC_TEMP_TYPE_SSD_M2_SLOT_1: return KeyTH0P(0); + case B_NUC_EC_TEMP_TYPE_MEMORY: return KeyTM0P(index); + case B_NUC_EC_TEMP_TYPE_FAN_AIR_VENT: return KeyTV0P(index); + case B_NUC_EC_TEMP_TYPE_SSD_M2_SLOT_2: return KeyTH0P(1); + case B_NUC_EC_TEMP_TYPE_SSD_M2_SLOT_3: return KeyTH0P(2); + case B_NUC_EC_TEMP_TYPE_SSD_M2_SLOT_4: return KeyTH0P(3); + default: return KeyInvalid; } - - DBGLOG("ssio", "initialising NUC EC %d", gen); - return new ECDeviceNUC(gen); } } diff --git a/Sensors/SMCSuperIO/ECDeviceNUC.hpp b/Sensors/SMCSuperIO/ECDeviceNUC.hpp index 62d8436..aa98435 100644 --- a/Sensors/SMCSuperIO/ECDeviceNUC.hpp +++ b/Sensors/SMCSuperIO/ECDeviceNUC.hpp @@ -60,7 +60,7 @@ namespace EC { // Intel EC V2 - AYAPLCEL static constexpr uint32_t B_NUC_EC_V2_VR_TEMP_U8 = 0x504; - static constexpr uint32_t B_NUC_EC_V1_MOTHERBOARD_TEMP_U8 = 0x505; + static constexpr uint32_t B_NUC_EC_V2_MOTHERBOARD_TEMP_U8 = 0x505; static constexpr uint32_t B_NUC_EC_V2_CPU_FAN_U16 = 0x508; @@ -236,50 +236,29 @@ namespace EC { static constexpr uint32_t B_NUC_EC_VB_DC_IN_ALT_U16 = 0x440; // Bug? class ECDeviceNUC : public ECDevice { - enum { - NucEcGenerationV1, - NucEcGenerationV2, - NucEcGenerationV3, - NucEcGenerationV4, - NucEcGenerationV5, - NucEcGenerationV6, - NucEcGenerationV7, - NucEcGenerationV8, - NucEcGenerationV9, - NucEcGenerationVA, - NucEcGenerationVB, - }; - - uint32_t nucGeneration {0}; - - public: - const char* getModelName() override; - - uint8_t getTachometerCount() override; - uint16_t updateTachometer(uint8_t index) override; - const char* getTachometerName(uint8_t index) override; - - uint8_t getVoltageCount() override; - float updateVoltage(uint8_t index) override; - const char* getVoltageName(uint8_t index) override; - - uint8_t getTemperatureCount() override; - float updateTemperature(uint8_t index) override; - const char *getTemperatureName(uint8_t index) override; - - void setupExtraKeys(VirtualSMCAPI::Plugin &vsmcPlugin) override; + static constexpr int MmioCacheSize = 32; + uint32_t cachedMmio[MmioCacheSize] {}; + int cachedMmioLast {0}; + protected: /** - * Ctor + * Cached MMIO read for type fields. */ - ECDeviceNUC(uint32_t gen) : nucGeneration(gen) { - supportsMMIO = true; - } + uint16_t readBigWordMMIOCached(uint32_t addr); /** - * Device factory + * Decode name from type fields */ - static ECDevice* detect(SMCSuperIO* sio, const char *name); + const char *getTachometerNameForType(uint16_t type); + const char *getVoltageNameForType(uint16_t type); + const char *getTemperatureNameForType(uint16_t type); + + /** + * Decode SMC key from type fields + */ + SMC_KEY getTachometerSMCKeyForType(uint16_t type, int index = 0); + SMC_KEY getVoltageSMCKeyForType(uint16_t type, int index = 0); + SMC_KEY getTemperatureSMCKeyForType(uint16_t type, int index = 0); }; } diff --git a/Sensors/SMCSuperIO/Resources/NucEcGenerationV1.plist b/Sensors/SMCSuperIO/Resources/NucEcGenerationV1.plist new file mode 100644 index 0000000..96afc05 --- /dev/null +++ b/Sensors/SMCSuperIO/Resources/NucEcGenerationV1.plist @@ -0,0 +1,117 @@ + + + + + BaseClassName + ECDeviceNUC + CompatibleDevices + + + DisplayName + Intel NUC Embedded Controller + MatchName + Intel_EC_V1 + + + Sensors + + Tachometer + + + Name + FAN + ReadValue + readBigWordMMIO(EC::B_NUC_EC_V1_SLOT_FAN_U16) + + + Voltage + + + Name + CPUVCORE + ReadValue + (float)readBigWordMMIO(EC::B_NUC_EC_V1_VCORE_U16) / 1000 + + + Name + VDIMM + SmcKey + KeyVM0R(0) + SmcKeyType + SmcKeyTypeFloat + ReadValue + (float)readBigWordMMIO(EC::B_NUC_EC_V1_VDIMM_U16) / 1000 + + + Name + VIN + SmcKey + KeyVD0R(0) + SmcKeyType + SmcKeyTypeFloat + ReadValue + (float)readBigWordMMIO(EC::B_NUC_EC_V1_VIN_U16) / 1000 + + + Name + VDD33 + SmcKey + KeyVR3R + SmcKeyType + SmcKeyTypeFloat + ReadValue + (float)readBigWordMMIO(EC::B_NUC_EC_V1_VCC3_U16) / 1000 + + + Name + VIO + ReadValue + (float)readBigWordMMIO(EC::B_NUC_EC_V1_VCCIO_U16) / 1000 + + + Temperature + + + Name + TCPU + SmcKey + KeyTC0P(0) + SmcKeyType + SmcKeyTypeSp78 + ReadValue + readBigWordMMIO(EC::B_NUC_EC_V1_CPU_TEMP_U8) + + + Name + TPCH + SmcKey + KeyTP0P(0) + SmcKeyType + SmcKeyTypeSp78 + ReadValue + readBigWordMMIO(EC::B_NUC_EC_V1_PCH_TEMP_U8) + + + Name + TDIMM + SmcKey + KeyTM0P(0) + SmcKeyType + SmcKeyTypeSp78 + ReadValue + readBigWordMMIO(EC::B_NUC_EC_V1_DIMM_TEMP_U8) + + + Name + THHD + SmcKey + KeyTH0P(0) + SmcKeyType + SmcKeyTypeSp78 + ReadValue + readBigWordMMIO(EC::B_NUC_EC_V1_HDD_TEMP_U8) + + + + + diff --git a/Sensors/SMCSuperIO/Resources/NucEcGenerationV2.plist b/Sensors/SMCSuperIO/Resources/NucEcGenerationV2.plist new file mode 100644 index 0000000..28021d4 --- /dev/null +++ b/Sensors/SMCSuperIO/Resources/NucEcGenerationV2.plist @@ -0,0 +1,83 @@ + + + + + BaseClassName + ECDeviceNUC + CompatibleDevices + + + DisplayName + Intel NUC Embedded Controller + MatchName + Intel_EC_V2 + + + Sensors + + Tachometer + + + Name + FAN + ReadValue + readBigWordMMIO(EC::B_NUC_EC_V2_CPU_FAN_U16) + + + Voltage + + + Name + CPUVCORE + ReadValue + (float)readBigWordMMIO(EC::B_NUC_EC_V2_CPU1_INPUT_U16) / 1000 + + + Name + VDRAM + SmcKey + KeyVM0R(0) + SmcKeyType + SmcKeyTypeFloat + ReadValue + (float)readBigWordMMIO(EC::B_NUC_EC_V2_SDRAM_U16) / 1000 + + + Name + VDD33 + SmcKey + KeyVR3R + SmcKeyType + SmcKeyTypeFloat + ReadValue + (float)readBigWordMMIO(EC::B_NUC_EC_V2_V33_U16) / 1000 + + + Name + VDD5 + SmcKey + KeyV50R(0) + SmcKeyType + SmcKeyTypeFloat + ReadValue + (float)readBigWordMMIO(EC::B_NUC_EC_V2_V5_U16) / 1000 + + + Temperature + + + Name + TVR + ReadValue + readBigWordMMIO(EC::B_NUC_EC_V2_VR_TEMP_U8) + + + Name + TMLB + ReadValue + readBigWordMMIO(EC::B_NUC_EC_V2_MOTHERBOARD_TEMP_U8) + + + + + diff --git a/Sensors/SMCSuperIO/Resources/NucEcGenerationV3.plist b/Sensors/SMCSuperIO/Resources/NucEcGenerationV3.plist new file mode 100644 index 0000000..c3dcab9 --- /dev/null +++ b/Sensors/SMCSuperIO/Resources/NucEcGenerationV3.plist @@ -0,0 +1,103 @@ + + + + + BaseClassName + ECDeviceNUC + CompatibleDevices + + + DisplayName + Intel NUC Embedded Controller + MatchName + Intel_EC_V3 + + + Sensors + + Tachometer + + + Name + FAN + ReadValue + readBigWordMMIO(EC::B_NUC_EC_V3_CPU_FAN_U16) + + + Voltage + + + Name + CPUVCORE + ReadValue + (float)readBigWordMMIO(EC::B_NUC_EC_V3_CPU1_INPUT_U16) / 1000 + + + Name + VDRAM + SmcKey + KeyVM0R(0) + SmcKeyType + SmcKeyTypeFloat + ReadValue + (float)readBigWordMMIO(EC::B_NUC_EC_V3_SDRAM_U16) / 1000 + + + Name + VDD33 + SmcKey + KeyVR3R + SmcKeyType + SmcKeyTypeFloat + ReadValue + (float)readBigWordMMIO(EC::B_NUC_EC_V3_V33_U16) / 1000 + + + Name + VIO + ReadValue + (float)readBigWordMMIO(EC::B_NUC_EC_V3_CPU_IO_U16) / 1000 + + + Temperature + + + Name + TCPU + SmcKey + KeyTC0P(0) + SmcKeyType + SmcKeyTypeSp78 + ReadValue + readBigWordMMIO(EC::B_NUC_EC_V3_CPU_TEMP_U8) + + + Name + TPCH + SmcKey + KeyTP0P(0) + SmcKeyType + SmcKeyTypeSp78 + ReadValue + readBigWordMMIO(EC::B_NUC_EC_V3_PCH_TEMP_U8) + + + Name + TDRAM + SmcKey + KeyTM0P(0) + SmcKeyType + SmcKeyTypeSp78 + ReadValue + readBigWordMMIO(EC::B_NUC_EC_V3_MEMORY_TEMP_U8) + + + Name + TMLB + ReadValue + readBigWordMMIO(EC::B_NUC_EC_V3_MOTHERBOARD_TEMP_U8) + + + + + diff --git a/Sensors/SMCSuperIO/Resources/NucEcGenerationV4.plist b/Sensors/SMCSuperIO/Resources/NucEcGenerationV4.plist new file mode 100644 index 0000000..b45e153 --- /dev/null +++ b/Sensors/SMCSuperIO/Resources/NucEcGenerationV4.plist @@ -0,0 +1,103 @@ + + + + + BaseClassName + ECDeviceNUC + CompatibleDevices + + + DisplayName + Intel NUC Embedded Controller + MatchName + Intel_EC_V4 + + + Sensors + + Tachometer + + + Name + FAN + ReadValue + readBigWordMMIO(EC::B_NUC_EC_V4_FAN_U16) + + + Voltage + + + Name + CPUVCORE + ReadValue + (float)readBigWordMMIO(EC::B_NUC_EC_V4_CPU_CORE_U16) / 1000 + + + Name + VDIMM + SmcKey + KeyVM0R(0) + SmcKeyType + SmcKeyTypeFloat + ReadValue + (float)readBigWordMMIO(EC::B_NUC_EC_V4_DIMM_U16) / 1000 + + + Name + VIN + SmcKey + KeyVD0R(0) + SmcKeyType + SmcKeyTypeFloat + ReadValue + (float)readBigWordMMIO(EC::B_NUC_EC_V4_DC_IN_U16) / 1000 + + + Temperature + + + Name + TCPU + SmcKey + KeyTC0P(0) + SmcKeyType + SmcKeyTypeSp78 + ReadValue + readBigWordMMIO(EC::B_NUC_EC_V4_CPU_TEMP_U8) + + + Name + TGPU + SmcKey + KeyTG0P(0) + SmcKeyType + SmcKeyTypeSp78 + ReadValue + readBigWordMMIO(EC::B_NUC_EC_V4_GPU_TEMP_U8) + + + Name + TPCH + SmcKey + KeyTP0P(0) + SmcKeyType + SmcKeyTypeSp78 + ReadValue + readBigWordMMIO(EC::B_NUC_EC_V4_PCH_TEMP_U8) + + + Name + TVRMCPU + ReadValue + readBigWordMMIO(EC::B_NUC_EC_V4_CPU_VR_TEMP_U8) + + + Name + TMLB + ReadValue + readBigWordMMIO(EC::B_NUC_EC_V4_MOTHERBOARD_TEMP_U8) + + + + + diff --git a/Sensors/SMCSuperIO/Resources/NucEcGenerationV5.plist b/Sensors/SMCSuperIO/Resources/NucEcGenerationV5.plist new file mode 100644 index 0000000..6313bc3 --- /dev/null +++ b/Sensors/SMCSuperIO/Resources/NucEcGenerationV5.plist @@ -0,0 +1,97 @@ + + + + + BaseClassName + ECDeviceNUC + CompatibleDevices + + + DisplayName + Intel NUC Embedded Controller + MatchName + Intel_EC_V5 + + + Sensors + + Tachometer + + + Name + FANCPU + ReadValue + readBigWordMMIO(EC::B_NUC_EC_V5_FAN1_U16) + + + Name + FANEXT + ReadValue + readBigWordMMIO(EC::B_NUC_EC_V5_FAN2_U16) + + + Voltage + + + Name + CPUVCORE + ReadValue + (float)readBigWordMMIO(EC::B_NUC_EC_V5_CPU_U16) / 1000 + + + Name + VDIMM + SmcKey + KeyVM0R(0) + SmcKeyType + SmcKeyTypeFloat + ReadValue + (float)readBigWordMMIO(EC::B_NUC_EC_V5_DIMM_U16) / 1000 + + + Name + VIN + SmcKey + KeyVD0R(0) + SmcKeyType + SmcKeyTypeFloat + ReadValue + (float)readBigWordMMIO(EC::B_NUC_EC_V5_DC_IN_U16) / 1000 + + + Temperature + + + Name + TCPU + SmcKey + KeyTC0P(0) + SmcKeyType + SmcKeyTypeSp78 + ReadValue + readBigWordMMIO(EC::B_NUC_EC_V5_CPU_TEMP_U8) + + + Name + TPCH + SmcKey + KeyTP0P(0) + SmcKeyType + SmcKeyTypeSp78 + ReadValue + readBigWordMMIO(EC::B_NUC_EC_V5_PCH_TEMP_U8) + + + Name + TDIMM + SmcKey + KeyTM0P(0) + SmcKeyType + SmcKeyTypeSp78 + ReadValue + readBigWordMMIO(EC::B_NUC_EC_V5_MEMORY_TEMP_U8) + + + + + diff --git a/Sensors/SMCSuperIO/Resources/NucEcGenerationV6.plist b/Sensors/SMCSuperIO/Resources/NucEcGenerationV6.plist new file mode 100644 index 0000000..2883f9a --- /dev/null +++ b/Sensors/SMCSuperIO/Resources/NucEcGenerationV6.plist @@ -0,0 +1,103 @@ + + + + + BaseClassName + ECDeviceNUC + CompatibleDevices + + + DisplayName + Intel NUC Embedded Controller + MatchName + Intel_EC_V6 + + + Sensors + + Tachometer + + + Name + FAN + ReadValue + readBigWordMMIO(EC::B_NUC_EC_V6_FAN_U16) + + + Voltage + + + Name + CPUVCORE + ReadValue + (float)readBigWordMMIO(EC::B_NUC_EC_V6_CPU_CORE_U16) / 1000 + + + Name + VDIMM + SmcKey + KeyVM0R(0) + SmcKeyType + SmcKeyTypeFloat + ReadValue + (float)readBigWordMMIO(EC::B_NUC_EC_V6_DIMM_U16) / 1000 + + + Name + VIN + SmcKey + KeyVD0R(0) + SmcKeyType + SmcKeyTypeFloat + ReadValue + (float)readBigWordMMIO(EC::B_NUC_EC_V6_DC_IN_U16) / 1000 + + + Temperature + + + Name + TCPU + SmcKey + KeyTC0P(0) + SmcKeyType + SmcKeyTypeSp78 + ReadValue + readBigWordMMIO(EC::B_NUC_EC_V6_CPU_TEMP_U8) + + + Name + TGPU + SmcKey + KeyTG0P(0) + SmcKeyType + SmcKeyTypeSp78 + ReadValue + readBigWordMMIO(EC::B_NUC_EC_V6_GPU_TEMP_U8) + + + Name + TPCH + SmcKey + KeyTP0P(0) + SmcKeyType + SmcKeyTypeSp78 + ReadValue + readBigWordMMIO(EC::B_NUC_EC_V6_PCH_TEMP_U8) + + + Name + TVRMCPU + ReadValue + readBigWordMMIO(EC::B_NUC_EC_V6_CPU_VR_TEMP_U8) + + + Name + TMLB + ReadValue + readBigWordMMIO(EC::B_NUC_EC_V6_MOTHERBOARD_TEMP_U8) + + + + + diff --git a/Sensors/SMCSuperIO/Resources/NucEcGenerationV7.plist b/Sensors/SMCSuperIO/Resources/NucEcGenerationV7.plist new file mode 100644 index 0000000..01d3341 --- /dev/null +++ b/Sensors/SMCSuperIO/Resources/NucEcGenerationV7.plist @@ -0,0 +1,103 @@ + + + + + BaseClassName + ECDeviceNUC + CompatibleDevices + + + DisplayName + Intel NUC Embedded Controller + MatchName + Intel_EC_V7 + + + Sensors + + Tachometer + + + Name + FAN + ReadValue + readBigWordMMIO(EC::B_NUC_EC_V7_CPU_FAN_U16) + + + Voltage + + + Name + CPUVCORE + ReadValue + (float)readBigWordMMIO(EC::B_NUC_EC_V7_VCORE_U16) / 1000 + + + Name + VDIMM + SmcKey + KeyVM0R(0) + SmcKeyType + SmcKeyTypeFloat + ReadValue + (float)readBigWordMMIO(EC::B_NUC_EC_V7_VDIMM_U16) / 1000 + + + Name + VIN + SmcKey + KeyVD0R(0) + SmcKeyType + SmcKeyTypeFloat + ReadValue + (float)readBigWordMMIO(EC::B_NUC_EC_V7_VIN_U16) / 1000 + + + Name + VDD33 + SmcKey + KeyVR3R + SmcKeyType + SmcKeyTypeFloat + ReadValue + (float)readBigWordMMIO(EC::B_NUC_EC_V7_V33_U16) / 1000 + + + Name + VDD5 + SmcKey + KeyV50R(0) + SmcKeyType + SmcKeyTypeFloat + ReadValue + (float)readBigWordMMIO(EC::B_NUC_EC_V7_V5_VCC_U16) / 1000 + + + Temperature + + + Name + TDIMM + SmcKey + KeyTM0P(0) + SmcKeyType + SmcKeyTypeSp78 + ReadValue + readBigWordMMIO(EC::B_NUC_EC_V7_DIMM_TEMP_U8) + + + Name + TVRM + ReadValue + readBigWordMMIO(EC::B_NUC_EC_V7_VR_TEMP_U8) + + + Name + TMLB + ReadValue + readBigWordMMIO(EC::B_NUC_EC_V7_MOTHERBOARD_TEMP_U8) + + + + + diff --git a/Sensors/SMCSuperIO/Resources/NucEcGenerationV8.plist b/Sensors/SMCSuperIO/Resources/NucEcGenerationV8.plist new file mode 100644 index 0000000..7f44017 --- /dev/null +++ b/Sensors/SMCSuperIO/Resources/NucEcGenerationV8.plist @@ -0,0 +1,99 @@ + + + + + BaseClassName + ECDeviceNUC + CompatibleDevices + + + DisplayName + Intel NUC Embedded Controller + MatchName + Intel_EC_V8 + + + Sensors + + Tachometer + + + Name + FAN + ReadValue + readBigWordMMIO(EC::B_NUC_EC_V8_CPU_FAN_U16) + + + Voltage + + + Name + CPUVCORE + ReadValue + (float)readBigWordMMIO(EC::B_NUC_EC_V8_VCORE_U16) / 1000 + + + Name + VDIMM + SmcKey + KeyVM0R(0) + SmcKeyType + SmcKeyTypeFloat + ReadValue + (float)readBigWordMMIO(EC::B_NUC_EC_V8_VDIMM_U16) / 1000 + + + Name + VIO + ReadValue + (float)readBigWordMMIO(EC::B_NUC_EC_V8_VCCIO_U16) / 1000 + + + Name + VDD5 + SmcKey + KeyV50R(0) + SmcKeyType + SmcKeyTypeFloat + ReadValue + (float)readBigWordMMIO(EC::B_NUC_EC_V8_V5VSB_U16) / 1000 + + + Temperature + + + Name + TPCH + SmcKey + KeyTP0P(0) + SmcKeyType + SmcKeyTypeSp78 + ReadValue + readBigWordMMIO(EC::B_NUC_EC_V8_DIMM_TEMP_U8) + + + Name + TDIMM + SmcKey + KeyTM0P(0) + SmcKeyType + SmcKeyTypeSp78 + ReadValue + readBigWordMMIO(EC::B_NUC_EC_V8_DIMM_TEMP_U8) + + + Name + TVRM + ReadValue + readBigWordMMIO(EC::B_NUC_EC_V8_VR_TEMP_U8) + + + Name + TMLB + ReadValue + readBigWordMMIO(EC::B_NUC_EC_V8_MOTHERBOARD_TEMP_U8) + + + + + diff --git a/Sensors/SMCSuperIO/Resources/NucEcGenerationV9.plist b/Sensors/SMCSuperIO/Resources/NucEcGenerationV9.plist new file mode 100644 index 0000000..73178e6 --- /dev/null +++ b/Sensors/SMCSuperIO/Resources/NucEcGenerationV9.plist @@ -0,0 +1,127 @@ + + + + + BaseClassName + ECDeviceNUC + CompatibleDevices + + + DisplayName + Intel NUC Embedded Controller + MatchName + Intel_EC_V9 + + + Sensors + + Tachometer + + + NameValue + getTachometerNameForType(readBigWordMMIOCached(EC::B_NUC_EC_V9_FAN1_TYPE_U8)) + ReadValue + readBigWordMMIO(EC::B_NUC_EC_V9_FAN1_U16) + + + NameValue + getTachometerNameForType(readBigWordMMIOCached(EC::B_NUC_EC_V9_FAN2_TYPE_U8)) + ReadValue + readBigWordMMIO(EC::B_NUC_EC_V9_FAN2_U16) + + + NameValue + getTachometerNameForType(readBigWordMMIOCached(EC::B_NUC_EC_V9_FAN3_TYPE_U8)) + ReadValue + readBigWordMMIO(EC::B_NUC_EC_V9_FAN3_U16) + + + Voltage + + + NameValue + getVoltageNameForType(readBigWordMMIOCached(EC::B_NUC_EC_V9_VOLTAGE1_TYPE_U8)) + ReadValue + (float)readBigWordMMIO(EC::B_NUC_EC_V9_VOLTAGE1_U16) / 1000 + SmcKey + getVoltageSMCKeyForType(readBigWordMMIOCached(EC::B_NUC_EC_V9_VOLTAGE1_TYPE_U8)) + SmcKeyType + SmcKeyTypeFloat + + + NameValue + getVoltageNameForType(readBigWordMMIOCached(EC::B_NUC_EC_V9_VOLTAGE2_TYPE_U8)) + ReadValue + (float)readBigWordMMIO(EC::B_NUC_EC_V9_VOLTAGE2_U16) / 1000 + SmcKey + getVoltageSMCKeyForType(readBigWordMMIOCached(EC::B_NUC_EC_V9_VOLTAGE2_TYPE_U8)) + SmcKeyType + SmcKeyTypeFloat + + + NameValue + getVoltageNameForType(readBigWordMMIOCached(EC::B_NUC_EC_V9_VOLTAGE3_TYPE_U8)) + ReadValue + (float)readBigWordMMIO(EC::B_NUC_EC_V9_VOLTAGE3_U16) / 1000 + SmcKey + getVoltageSMCKeyForType(readBigWordMMIOCached(EC::B_NUC_EC_V9_VOLTAGE3_TYPE_U8)) + SmcKeyType + SmcKeyTypeFloat + + + NameValue + getVoltageNameForType(readBigWordMMIOCached(EC::B_NUC_EC_V9_VOLTAGE4_TYPE_U8)) + ReadValue + (float)readBigWordMMIO(EC::B_NUC_EC_V9_VOLTAGE4_U16) / 1000 + SmcKey + getVoltageSMCKeyForType(readBigWordMMIOCached(EC::B_NUC_EC_V9_VOLTAGE4_TYPE_U8)) + SmcKeyType + SmcKeyTypeFloat + + + NameValue + getVoltageNameForType(readBigWordMMIOCached(EC::B_NUC_EC_V9_VOLTAGE5_TYPE_U8)) + ReadValue + (float)readBigWordMMIO(EC::B_NUC_EC_V9_VOLTAGE5_U16) / 1000 + SmcKey + getVoltageSMCKeyForType(readBigWordMMIOCached(EC::B_NUC_EC_V9_VOLTAGE5_TYPE_U8)) + SmcKeyType + SmcKeyTypeFloat + + + Temperature + + + NameValue + getTemperatureNameForType(readBigWordMMIOCached(EC::B_NUC_EC_V9_TEMP1_TYPE_U8)) + ReadValue + (float)readBigWordMMIO(EC::B_NUC_EC_V9_TEMP1_U8) / 1000 + SmcKey + getTemperatureSMCKeyForType(readBigWordMMIOCached(EC::B_NUC_EC_V9_TEMP1_TYPE_U8)) + SmcKeyType + SmcKeyTypeSp78 + + + NameValue + getTemperatureNameForType(readBigWordMMIOCached(EC::B_NUC_EC_V9_TEMP2_TYPE_U8)) + ReadValue + (float)readBigWordMMIO(EC::B_NUC_EC_V9_TEMP2_U8) / 1000 + SmcKey + getTemperatureSMCKeyForType(readBigWordMMIOCached(EC::B_NUC_EC_V9_TEMP2_TYPE_U8)) + SmcKeyType + SmcKeyTypeSp78 + + + NameValue + getTemperatureNameForType(readBigWordMMIOCached(EC::B_NUC_EC_V9_TEMP3_TYPE_U8)) + ReadValue + (float)readBigWordMMIO(EC::B_NUC_EC_V9_TEMP3_U8) / 1000 + SmcKey + getTemperatureSMCKeyForType(readBigWordMMIOCached(EC::B_NUC_EC_V9_TEMP3_TYPE_U8)) + SmcKeyType + SmcKeyTypeSp78 + + + + + diff --git a/Sensors/SMCSuperIO/Resources/NucEcGenerationVA.plist b/Sensors/SMCSuperIO/Resources/NucEcGenerationVA.plist new file mode 100644 index 0000000..335562e --- /dev/null +++ b/Sensors/SMCSuperIO/Resources/NucEcGenerationVA.plist @@ -0,0 +1,175 @@ + + + + + BaseClassName + ECDeviceNUC + CompatibleDevices + + + DisplayName + Intel NUC Embedded Controller + MatchName + Intel_EC_VA + + + Sensors + + Tachometer + + + NameValue + getTachometerNameForType(readBigWordMMIOCached(EC::B_NUC_EC_VA_FAN1_TYPE_U8)) + ReadValue + readBigWordMMIO(EC::B_NUC_EC_VA_FAN1_U16) + + + NameValue + getTachometerNameForType(readBigWordMMIOCached(EC::B_NUC_EC_VA_FAN2_TYPE_U8)) + ReadValue + readBigWordMMIO(EC::B_NUC_EC_VA_FAN2_U16) + + + NameValue + getTachometerNameForType(readBigWordMMIOCached(EC::B_NUC_EC_VA_FAN3_TYPE_U8)) + ReadValue + readBigWordMMIO(EC::B_NUC_EC_VA_FAN3_U16) + + + NameValue + getTachometerNameForType(readBigWordMMIOCached(EC::B_NUC_EC_VA_FAN4_TYPE_U8)) + ReadValue + readBigWordMMIO(EC::B_NUC_EC_VA_FAN4_U16) + + + NameValue + getTachometerNameForType(readBigWordMMIOCached(EC::B_NUC_EC_VA_FAN5_TYPE_U8)) + ReadValue + readBigWordMMIO(EC::B_NUC_EC_VA_FAN5_U16) + + + NameValue + getTachometerNameForType(readBigWordMMIOCached(EC::B_NUC_EC_VA_FAN6_TYPE_U8)) + ReadValue + readBigWordMMIO(EC::B_NUC_EC_VA_FAN6_U16) + + + Voltage + + + NameValue + getVoltageNameForType(readBigWordMMIOCached(EC::B_NUC_EC_VA_VOLTAGE1_TYPE_U8)) + ReadValue + (float)readBigWordMMIO(EC::B_NUC_EC_VA_VOLTAGE1_U16) / 1000 + SmcKey + getVoltageSMCKeyForType(readBigWordMMIOCached(EC::B_NUC_EC_VA_VOLTAGE1_TYPE_U8)) + SmcKeyType + SmcKeyTypeFloat + + + NameValue + getVoltageNameForType(readBigWordMMIOCached(EC::B_NUC_EC_VA_VOLTAGE2_TYPE_U8)) + ReadValue + (float)readBigWordMMIO(EC::B_NUC_EC_VA_VOLTAGE2_U16) / 1000 + SmcKey + getVoltageSMCKeyForType(readBigWordMMIOCached(EC::B_NUC_EC_VA_VOLTAGE2_TYPE_U8)) + SmcKeyType + SmcKeyTypeFloat + + + NameValue + getVoltageNameForType(readBigWordMMIOCached(EC::B_NUC_EC_VA_VOLTAGE3_TYPE_U8)) + ReadValue + (float)readBigWordMMIO(EC::B_NUC_EC_VA_VOLTAGE3_U16) / 1000 + SmcKey + getVoltageSMCKeyForType(readBigWordMMIOCached(EC::B_NUC_EC_VA_VOLTAGE3_TYPE_U8)) + SmcKeyType + SmcKeyTypeFloat + + + NameValue + getVoltageNameForType(readBigWordMMIOCached(EC::B_NUC_EC_VA_VOLTAGE4_TYPE_U8)) + ReadValue + (float)readBigWordMMIO(EC::B_NUC_EC_VA_VOLTAGE4_U16) / 1000 + SmcKey + getVoltageSMCKeyForType(readBigWordMMIOCached(EC::B_NUC_EC_VA_VOLTAGE4_TYPE_U8)) + SmcKeyType + SmcKeyTypeFloat + + + NameValue + getVoltageNameForType(readBigWordMMIOCached(EC::B_NUC_EC_VA_VOLTAGE5_TYPE_U8)) + ReadValue + (float)readBigWordMMIO(EC::B_NUC_EC_VA_VOLTAGE5_U16) / 1000 + SmcKey + getVoltageSMCKeyForType(readBigWordMMIOCached(EC::B_NUC_EC_VA_VOLTAGE5_TYPE_U8)) + SmcKeyType + SmcKeyTypeFloat + + + NameValue + getVoltageNameForType(readBigWordMMIOCached(EC::B_NUC_EC_VA_VOLTAGE6_TYPE_U8)) + ReadValue + (float)readBigWordMMIO(EC::B_NUC_EC_VA_VOLTAGE6_U16) / 1000 + SmcKey + getVoltageSMCKeyForType(readBigWordMMIOCached(EC::B_NUC_EC_VA_VOLTAGE6_TYPE_U8)) + SmcKeyType + SmcKeyTypeFloat + + + Temperature + + + NameValue + getTemperatureNameForType(readBigWordMMIOCached(EC::B_NUC_EC_VA_TEMP1_TYPE_U8)) + ReadValue + (float)readBigWordMMIO(EC::B_NUC_EC_VA_TEMP1_U8) / 1000 + SmcKey + getTemperatureSMCKeyForType(readBigWordMMIOCached(EC::B_NUC_EC_VA_TEMP1_TYPE_U8)) + SmcKeyType + SmcKeyTypeSp78 + + + NameValue + getTemperatureNameForType(readBigWordMMIOCached(EC::B_NUC_EC_VA_TEMP2_TYPE_U8)) + ReadValue + (float)readBigWordMMIO(EC::B_NUC_EC_VA_TEMP2_U8) / 1000 + SmcKey + getTemperatureSMCKeyForType(readBigWordMMIOCached(EC::B_NUC_EC_VA_TEMP2_TYPE_U8)) + SmcKeyType + SmcKeyTypeSp78 + + + NameValue + getTemperatureNameForType(readBigWordMMIOCached(EC::B_NUC_EC_VA_TEMP3_TYPE_U8)) + ReadValue + (float)readBigWordMMIO(EC::B_NUC_EC_VA_TEMP3_U8) / 1000 + SmcKey + getTemperatureSMCKeyForType(readBigWordMMIOCached(EC::B_NUC_EC_VA_TEMP3_TYPE_U8)) + SmcKeyType + SmcKeyTypeSp78 + + + NameValue + getTemperatureNameForType(readBigWordMMIOCached(EC::B_NUC_EC_VA_TEMP4_TYPE_U8)) + ReadValue + (float)readBigWordMMIO(EC::B_NUC_EC_VA_TEMP4_U8) / 1000 + SmcKey + getTemperatureSMCKeyForType(readBigWordMMIOCached(EC::B_NUC_EC_VA_TEMP4_TYPE_U8)) + SmcKeyType + SmcKeyTypeSp78 + + + NameValue + getTemperatureNameForType(readBigWordMMIOCached(EC::B_NUC_EC_VA_TEMP5_TYPE_U8)) + ReadValue + (float)readBigWordMMIO(EC::B_NUC_EC_VA_TEMP5_U8) / 1000 + SmcKey + getTemperatureSMCKeyForType(readBigWordMMIOCached(EC::B_NUC_EC_VA_TEMP5_TYPE_U8)) + SmcKeyType + SmcKeyTypeSp78 + + + + + diff --git a/Sensors/SMCSuperIO/Resources/NucEcGenerationVB.plist b/Sensors/SMCSuperIO/Resources/NucEcGenerationVB.plist new file mode 100644 index 0000000..778f6ac --- /dev/null +++ b/Sensors/SMCSuperIO/Resources/NucEcGenerationVB.plist @@ -0,0 +1,121 @@ + + + + + BaseClassName + ECDeviceNUC + CompatibleDevices + + + DisplayName + Intel NUC Embedded Controller + MatchName + Intel_EC_VB + + + Sensors + + Tachometer + + + Name + FAN + ReadValue + readBigWordMMIO(EC::B_NUC_EC_VB_FAN_U16) + + + Voltage + + + Name + CPUVCORE + ReadValue + (float)readBigWordMMIO(EC::B_NUC_EC_VB_CPU_CORE_U16) / 1000 + + + Name + VDIMM + SmcKey + KeyVM0R(0) + SmcKeyType + SmcKeyTypeFloat + ReadValue + (float)readBigWordMMIO(EC::B_NUC_EC_VB_DIMM_U16) / 1000 + + + Name + VIN + SmcKey + KeyVD0R(0) + SmcKeyType + SmcKeyTypeFloat + ReadValue + (float)readBigWordMMIO(EC::B_NUC_EC_VB_DC_IN_U16) / 1000 + + + Name + VGPU + ReadValue + (float)readBigWordMMIO(EC::B_NUC_EC_VB_GPU_CORE_U16) / 1000 + + + Name + VINALT + ReadValue + (float)readBigWordMMIO(EC::B_NUC_EC_VB_DC_IN_ALT_U16) / 1000 + + + Temperature + + + Name + TCPU + SmcKey + KeyTC0P(0) + SmcKeyType + SmcKeyTypeSp78 + ReadValue + readBigWordMMIO(EC::B_NUC_EC_VB_CPU_TEMP_U8) + + + Name + TGPU + SmcKey + KeyTG0P(0) + SmcKeyType + SmcKeyTypeSp78 + ReadValue + readBigWordMMIO(EC::B_NUC_EC_VB_GPU_TEMP_U8) + + + Name + TPCH + SmcKey + KeyTP0P(0) + SmcKeyType + SmcKeyTypeSp78 + ReadValue + readBigWordMMIO(EC::B_NUC_EC_VB_PCH_TEMP_U8) + + + Name + TVRMCPU + ReadValue + readBigWordMMIO(EC::B_NUC_EC_VB_CPU_VR_TEMP_U8) + + + Name + TVRMGPU + ReadValue + readBigWordMMIO(EC::B_NUC_EC_VB_GPU_VR_U8) + + + Name + TMLB + ReadValue + readBigWordMMIO(EC::B_NUC_EC_VB_MOTHERBOARD_TEMP_U8) + + + + + diff --git a/Sensors/SMCSuperIO/SuperIODevice.cpp b/Sensors/SMCSuperIO/SuperIODevice.cpp index e326232..f04fcd9 100644 --- a/Sensors/SMCSuperIO/SuperIODevice.cpp +++ b/Sensors/SMCSuperIO/SuperIODevice.cpp @@ -62,3 +62,17 @@ SMC_RESULT TachometerKey::readAccess() { *reinterpret_cast(data) = VirtualSMCAPI::encodeIntFp(SmcKeyTypeFpe2, val); return SmcSuccess; } + +SMC_RESULT VoltageKey::readAccess() { + double val = device->getVoltageValue(index); + const_cast(sio)->quickReschedule(); + *reinterpret_cast(data) = VirtualSMCAPI::encodeFlt(val); + return SmcSuccess; +} + +SMC_RESULT TemperatureKey::readAccess() { + double val = device->getTemperatureValue(index); + const_cast(sio)->quickReschedule(); + *reinterpret_cast(data) = VirtualSMCAPI::encodeIntSp(SmcKeyTypeSp78, val); + return SmcSuccess; +} diff --git a/Sensors/SMCSuperIO/SuperIODevice.hpp b/Sensors/SMCSuperIO/SuperIODevice.hpp index 141c3a5..f970d15 100644 --- a/Sensors/SMCSuperIO/SuperIODevice.hpp +++ b/Sensors/SMCSuperIO/SuperIODevice.hpp @@ -77,6 +77,18 @@ class SuperIODevice */ static constexpr SMC_KEY KeyFNum = SMC_MAKE_IDENTIFIER('F','N','u','m'); static constexpr SMC_KEY KeyF0Ac(size_t i) { return SMC_MAKE_IDENTIFIER('F', KeyIndexes[i],'A', 'c'); } + static constexpr SMC_KEY KeyVM0R(size_t i) { return SMC_MAKE_IDENTIFIER('V','M',KeyIndexes[i],'R'); } + static constexpr SMC_KEY KeyVD0R(size_t i) { return SMC_MAKE_IDENTIFIER('V','D',KeyIndexes[i],'R'); } + static constexpr SMC_KEY KeyV50R(size_t i) { return SMC_MAKE_IDENTIFIER('V','5',KeyIndexes[i],'R'); } + static constexpr SMC_KEY KeyVR3R = SMC_MAKE_IDENTIFIER('V','5','3','R'); + static constexpr SMC_KEY KeyTC0P(size_t i) { return SMC_MAKE_IDENTIFIER('T','C',KeyIndexes[i],'P'); } + static constexpr SMC_KEY KeyTP0P(size_t i) { return SMC_MAKE_IDENTIFIER('T','P',KeyIndexes[i],'P'); } + static constexpr SMC_KEY KeyTM0P(size_t i) { return SMC_MAKE_IDENTIFIER('T','M',KeyIndexes[i],'P'); } + static constexpr SMC_KEY KeyTG0P(size_t i) { return SMC_MAKE_IDENTIFIER('T','G',KeyIndexes[i],'P'); } + static constexpr SMC_KEY KeyTH0P(size_t i) { return SMC_MAKE_IDENTIFIER('T','H',KeyIndexes[i],'P'); } + static constexpr SMC_KEY KeyTA0P(size_t i) { return SMC_MAKE_IDENTIFIER('T','A',KeyIndexes[i],'P'); } + static constexpr SMC_KEY KeyTV0P(size_t i) { return SMC_MAKE_IDENTIFIER('T','V',KeyIndexes[i],'P'); } + static constexpr SMC_KEY KeyInvalid = SMC_MAKE_IDENTIFIER('X','X','X','X'); /** * Constructor @@ -264,4 +276,24 @@ class TachometerKey : public VirtualSMCValue { TachometerKey(const SMCSuperIO *sio, SuperIODevice *device, uint8_t index) : sio(sio), index(index), device(device) {} }; +class VoltageKey : public VirtualSMCValue { +protected: + const SMCSuperIO *sio; + uint8_t index; + SuperIODevice *device; + SMC_RESULT readAccess() override; +public: + VoltageKey(const SMCSuperIO *sio, SuperIODevice *device, uint8_t index) : sio(sio), index(index), device(device) {} +}; + +class TemperatureKey : public VirtualSMCValue { +protected: + const SMCSuperIO *sio; + uint8_t index; + SuperIODevice *device; + SMC_RESULT readAccess() override; +public: + TemperatureKey(const SMCSuperIO *sio, SuperIODevice *device, uint8_t index) : sio(sio), index(index), device(device) {} +}; + #endif // _SUPERIODEVICE_HPP