private bool DetectWinbondFintek(LPCPort port) { port.WinbondNuvotonFintekEnter(); byte logicalDeviceNumber = 0; var id = port.ReadByte(CHIP_ID_REGISTER); var revision = port.ReadByte(CHIP_REVISION_REGISTER); var chip = Chip.Unknown; switch (id) { case 0x05: switch (revision) { case 0x07: chip = Chip.F71858; logicalDeviceNumber = F71858_HARDWARE_MONITOR_LDN; break; case 0x41: chip = Chip.F71882; logicalDeviceNumber = FINTEK_HARDWARE_MONITOR_LDN; break; } break; case 0x06: switch (revision) { case 0x01: chip = Chip.F71862; logicalDeviceNumber = FINTEK_HARDWARE_MONITOR_LDN; break; } break; case 0x07: switch (revision) { case 0x23: chip = Chip.F71889F; logicalDeviceNumber = FINTEK_HARDWARE_MONITOR_LDN; break; } break; case 0x08: switch (revision) { case 0x14: chip = Chip.F71869; logicalDeviceNumber = FINTEK_HARDWARE_MONITOR_LDN; break; } break; case 0x09: switch (revision) { case 0x01: chip = Chip.F71808E; logicalDeviceNumber = FINTEK_HARDWARE_MONITOR_LDN; break; case 0x09: chip = Chip.F71889ED; logicalDeviceNumber = FINTEK_HARDWARE_MONITOR_LDN; break; } break; case 0x10: switch (revision) { case 0x05: chip = Chip.F71889AD; logicalDeviceNumber = FINTEK_HARDWARE_MONITOR_LDN; break; case 0x07: chip = Chip.F71869A; logicalDeviceNumber = FINTEK_HARDWARE_MONITOR_LDN; break; } break; case 0x11: switch (revision) { case 0x06: chip = Chip.F71878AD; logicalDeviceNumber = FINTEK_HARDWARE_MONITOR_LDN; break; } break; case 0x52: switch (revision) { case 0x17: case 0x3A: case 0x41: chip = Chip.W83627HF; logicalDeviceNumber = WINBOND_NUVOTON_HARDWARE_MONITOR_LDN; break; } break; case 0x82: switch (revision & 0xF0) { case 0x80: chip = Chip.W83627THF; logicalDeviceNumber = WINBOND_NUVOTON_HARDWARE_MONITOR_LDN; break; } break; case 0x85: switch (revision) { case 0x41: chip = Chip.W83687THF; logicalDeviceNumber = WINBOND_NUVOTON_HARDWARE_MONITOR_LDN; break; } break; case 0x88: switch (revision & 0xF0) { case 0x50: case 0x60: chip = Chip.W83627EHF; logicalDeviceNumber = WINBOND_NUVOTON_HARDWARE_MONITOR_LDN; break; } break; case 0xA0: switch (revision & 0xF0) { case 0x20: chip = Chip.W83627DHG; logicalDeviceNumber = WINBOND_NUVOTON_HARDWARE_MONITOR_LDN; break; } break; case 0xA5: switch (revision & 0xF0) { case 0x10: chip = Chip.W83667HG; logicalDeviceNumber = WINBOND_NUVOTON_HARDWARE_MONITOR_LDN; break; } break; case 0xB0: switch (revision & 0xF0) { case 0x70: chip = Chip.W83627DHGP; logicalDeviceNumber = WINBOND_NUVOTON_HARDWARE_MONITOR_LDN; break; } break; case 0xB3: switch (revision & 0xF0) { case 0x50: chip = Chip.W83667HGB; logicalDeviceNumber = WINBOND_NUVOTON_HARDWARE_MONITOR_LDN; break; } break; case 0xB4: switch (revision & 0xF0) { case 0x70: chip = Chip.NCT6771F; logicalDeviceNumber = WINBOND_NUVOTON_HARDWARE_MONITOR_LDN; break; } break; case 0xC3: switch (revision & 0xF0) { case 0x30: chip = Chip.NCT6776F; logicalDeviceNumber = WINBOND_NUVOTON_HARDWARE_MONITOR_LDN; break; } break; case 0xC4: switch (revision & 0xF0) { case 0x50: chip = Chip.NCT610X; logicalDeviceNumber = WINBOND_NUVOTON_HARDWARE_MONITOR_LDN; break; } break; case 0xC5: switch (revision & 0xF0) { case 0x60: chip = Chip.NCT6779D; logicalDeviceNumber = WINBOND_NUVOTON_HARDWARE_MONITOR_LDN; break; } break; case 0xC8: switch (revision) { case 0x03: chip = Chip.NCT6791D; logicalDeviceNumber = WINBOND_NUVOTON_HARDWARE_MONITOR_LDN; break; } break; case 0xC9: switch (revision) { case 0x11: chip = Chip.NCT6792D; logicalDeviceNumber = WINBOND_NUVOTON_HARDWARE_MONITOR_LDN; break; } break; case 0xD1: switch (revision) { case 0x21: chip = Chip.NCT6793D; logicalDeviceNumber = WINBOND_NUVOTON_HARDWARE_MONITOR_LDN; break; } break; case 0xD3: switch (revision) { case 0x52: chip = Chip.NCT6795D; logicalDeviceNumber = WINBOND_NUVOTON_HARDWARE_MONITOR_LDN; break; } break; case 0xD4: switch (revision) { case 0x23: chip = Chip.NCT6796D; logicalDeviceNumber = WINBOND_NUVOTON_HARDWARE_MONITOR_LDN; break; } break; } if (chip == Chip.Unknown) { if (id != 0 && id != 0xff) { port.WinbondNuvotonFintekExit(); } } else { port.Select(logicalDeviceNumber); var address = port.ReadWord(BASE_ADDRESS_REGISTER); Thread.Sleep(1); var verify = port.ReadWord(BASE_ADDRESS_REGISTER); var vendorID = port.ReadWord(FINTEK_VENDOR_ID_REGISTER); // disable the hardware monitor i/o space lock on NCT679*D chips if (address == verify && (chip == Chip.NCT6791D || chip == Chip.NCT6796D || chip == Chip.NCT6793D || chip == Chip.NCT6795D)) { port.NuvotonDisableIOSpaceLock(); } port.WinbondNuvotonFintekExit(); if (address != verify) { return(false); } // some Fintek chips have address register offset 0x05 added already if ((address & 0x07) == 0x05) { address &= 0xFFF8; } if (address < 0x100 || (address & 0xF007) != 0) { return(false); } switch (chip) { case Chip.W83627DHG: case Chip.W83627DHGP: case Chip.W83627EHF: case Chip.W83627HF: case Chip.W83627THF: case Chip.W83667HG: case Chip.W83667HGB: case Chip.W83687THF: superIOs.Add(new W836XX(chip, revision, address)); break; case Chip.NCT610X: case Chip.NCT6771F: case Chip.NCT6776F: case Chip.NCT6779D: case Chip.NCT6791D: case Chip.NCT6792D: case Chip.NCT6793D: case Chip.NCT6795D: case Chip.NCT6796D: superIOs.Add(new NCT677X(chip, revision, address, port)); break; case Chip.F71858: case Chip.F71862: case Chip.F71869: case Chip.F71878AD: case Chip.F71869A: case Chip.F71882: case Chip.F71889AD: case Chip.F71889ED: case Chip.F71889F: case Chip.F71808E: if (vendorID != FINTEK_VENDOR_ID) { return(false); } superIOs.Add(new F718XX(chip, address)); break; } return(true); } return(false); }
private bool DetectIT87(LPCPort port) { // IT87XX can enter only on port 0x2E if (port.RegisterPort != 0x2E) { return(false); } port.IT87Enter(); var chipID = port.ReadWord(CHIP_ID_REGISTER); Chip chip; switch (chipID) { case 0x8620: chip = Chip.IT8620E; break; case 0x8628: chip = Chip.IT8628E; break; case 0x8665: chip = Chip.IT8665E; break; case 0x8686: chip = Chip.IT8686E; break; case 0x8705: chip = Chip.IT8705F; break; case 0x8712: chip = Chip.IT8712F; break; case 0x8716: chip = Chip.IT8716F; break; case 0x8718: chip = Chip.IT8718F; break; case 0x8720: chip = Chip.IT8720F; break; case 0x8721: chip = Chip.IT8721F; break; case 0x8726: chip = Chip.IT8726F; break; case 0x8728: chip = Chip.IT8728F; break; case 0x8771: chip = Chip.IT8771E; break; case 0x8772: chip = Chip.IT8772E; break; default: chip = Chip.Unknown; break; } if (chip == Chip.Unknown) { if (chipID != 0 && chipID != 0xffff) { port.IT87Exit(); } } else { port.Select(IT87_ENVIRONMENT_CONTROLLER_LDN); var address = port.ReadWord(BASE_ADDRESS_REGISTER); Thread.Sleep(1); var verify = port.ReadWord(BASE_ADDRESS_REGISTER); var version = (byte)(port.ReadByte(IT87_CHIP_VERSION_REGISTER) & 0x0F); ushort gpioAddress; ushort gpioVerify; if (chip == Chip.IT8705F) { port.Select(IT8705_GPIO_LDN); gpioAddress = port.ReadWord(BASE_ADDRESS_REGISTER); Thread.Sleep(1); gpioVerify = port.ReadWord(BASE_ADDRESS_REGISTER); } else { port.Select(IT87XX_GPIO_LDN); gpioAddress = port.ReadWord(BASE_ADDRESS_REGISTER + 2); Thread.Sleep(1); gpioVerify = port.ReadWord(BASE_ADDRESS_REGISTER + 2); } port.IT87Exit(); if (address != verify || address < 0x100 || (address & 0xF007) != 0) { return(false); } if (gpioAddress != gpioVerify || gpioAddress < 0x100 || (gpioAddress & 0xF007) != 0) { return(false); } superIOs.Add(new IT87XX(chip, address, gpioAddress, version)); return(true); } return(false); }
public NCT677X(Chip chip, byte revision, ushort port, LPCPort lpcPort) { Chip = chip; this.revision = revision; this.port = port; this.lpcPort = lpcPort; if (chip == Chip.NCT610X) { VENDOR_ID_HIGH_REGISTER = 0x80FE; VENDOR_ID_LOW_REGISTER = 0x00FE; FAN_PWM_OUT_REG = new ushort[] { 0x04A, 0x04B, 0x04C }; FAN_PWM_COMMAND_REG = new ushort[] { 0x119, 0x129, 0x139 }; FAN_CONTROL_MODE_REG = new ushort[] { 0x113, 0x123, 0x133 }; vBatMonitorControlRegister = 0x0318; } else { VENDOR_ID_HIGH_REGISTER = 0x804F; VENDOR_ID_LOW_REGISTER = 0x004F; FAN_PWM_OUT_REG = new ushort[] { 0x001, 0x003, 0x011, 0x013, 0x015, 0x017 }; FAN_PWM_COMMAND_REG = new ushort[] { 0x109, 0x209, 0x309, 0x809, 0x909, 0xA09 }; FAN_CONTROL_MODE_REG = new ushort[] { 0x102, 0x202, 0x302, 0x802, 0x902, 0xA02 }; vBatMonitorControlRegister = 0x005D; } isNuvotonVendor = IsNuvotonVendor(); if (!isNuvotonVendor) { return; } switch (chip) { case Chip.NCT6771F: case Chip.NCT6776F: if (chip == Chip.NCT6771F) { Fans = new float?[4]; // min value RPM value with 16-bit fan counter minFanRPM = (int)(1.35e6 / 0xFFFF); temperaturesSource = new[] { (byte)SourceNCT6771F.PECI_0, (byte)SourceNCT6771F.CPUTIN, (byte)SourceNCT6771F.AUXTIN, (byte)SourceNCT6771F.SYSTIN }; } else { Fans = new float?[5]; // min value RPM value with 13-bit fan counter minFanRPM = (int)(1.35e6 / 0x1FFF); temperaturesSource = new[] { (byte)SourceNCT6776F.PECI_0, (byte)SourceNCT6776F.CPUTIN, (byte)SourceNCT6776F.AUXTIN, (byte)SourceNCT6776F.SYSTIN }; } fanRpmBaseRegister = 0x656; Controls = new float?[3]; Voltages = new float?[9]; voltageRegisters = new ushort[] { 0x020, 0x021, 0x022, 0x023, 0x024, 0x025, 0x026, 0x550, 0x551 }; voltageVBatRegister = 0x551; Temperatures = new float?[4]; temperatureRegister = new ushort[] { 0x027, 0x073, 0x075, 0x077, 0x150, 0x250, 0x62B, 0x62C, 0x62D }; temperatureHalfRegister = new ushort[] { 0, 0x074, 0x076, 0x078, 0x151, 0x251, 0x62E, 0x62E, 0x62E }; temperatureHalfBit = new[] { -1, 7, 7, 7, 7, 7, 0, 1, 2 }; temperatureSourceRegister = new ushort[] { 0x621, 0x100, 0x200, 0x300, 0x622, 0x623, 0x624, 0x625, 0x626 }; alternateTemperatureRegister = new ushort?[] { null, null, null, null }; break; case Chip.NCT6779D: case Chip.NCT6791D: case Chip.NCT6792D: case Chip.NCT6793D: case Chip.NCT6795D: case Chip.NCT6796D: if (chip == Chip.NCT6779D) { Fans = new float?[5]; Controls = new float?[5]; } else { Fans = new float?[6]; Controls = new float?[6]; } fanRpmBaseRegister = 0x4C0; // min value RPM value with 13-bit fan counter minFanRPM = (int)(1.35e6 / 0x1FFF); Voltages = new float?[15]; voltageRegisters = new ushort[] { 0x480, 0x481, 0x482, 0x483, 0x484, 0x485, 0x486, 0x487, 0x488, 0x489, 0x48A, 0x48B, 0x48C, 0x48D, 0x48E }; voltageVBatRegister = 0x488; Temperatures = new float?[7]; temperaturesSource = new[] { (byte)SourceNCT67XXD.PECI_0, (byte)SourceNCT67XXD.CPUTIN, (byte)SourceNCT67XXD.SYSTIN, (byte)SourceNCT67XXD.AUXTIN0, (byte)SourceNCT67XXD.AUXTIN1, (byte)SourceNCT67XXD.AUXTIN2, (byte)SourceNCT67XXD.AUXTIN3 }; temperatureRegister = new ushort[] { 0x027, 0x073, 0x075, 0x077, 0x079, 0x07B, 0x150 }; temperatureHalfRegister = new ushort[] { 0, 0x074, 0x076, 0x078, 0x07A, 0x07C, 0x151 }; temperatureHalfBit = new[] { -1, 7, 7, 7, 7, 7, 7 }; temperatureSourceRegister = new ushort[] { 0x621, 0x100, 0x200, 0x300, 0x800, 0x900, 0x622 }; alternateTemperatureRegister = new ushort?[] { null, 0x491, 0x490, 0x492, 0x493, 0x494, 0x495 }; break; case Chip.NCT610X: Fans = new float?[3]; Controls = new float?[3]; fanRpmBaseRegister = 0x030; // min value RPM value with 13-bit fan counter minFanRPM = (int)(1.35e6 / 0x1FFF); Voltages = new float?[9]; voltageRegisters = new ushort[] { 0x300, 0x301, 0x302, 0x303, 0x304, 0x305, 0x307, 0x308, 0x309 }; voltageVBatRegister = 0x308; Temperatures = new float?[4]; temperaturesSource = new[] { (byte)SourceNCT610X.PECI_0, (byte)SourceNCT610X.SYSTIN, (byte)SourceNCT610X.CPUTIN, (byte)SourceNCT610X.AUXTIN }; temperatureRegister = new ushort[] { 0x027, 0x018, 0x019, 0x01A }; temperatureHalfRegister = new ushort[] { 0, 0x01B, 0x11B, 0x21B }; temperatureHalfBit = new[] { -1, 7, 7, 7 }; temperatureSourceRegister = new ushort[] { 0x621, 0x100, 0x200, 0x300 }; alternateTemperatureRegister = new ushort?[] { null, 0x018, 0x019, 0x01A }; break; } }