Restricted ITE detection to port 0x2E.
1.1 --- a/Hardware/LPC/LPCIO.cs Sun Aug 15 17:56:57 2010 +0000
1.2 +++ b/Hardware/LPC/LPCIO.cs Tue Aug 17 20:25:27 2010 +0000
1.3 @@ -48,8 +48,8 @@
1.4 private StringBuilder report = new StringBuilder();
1.5
1.6 // I/O Ports
1.7 - private ushort[] REGISTER_PORTS = new ushort[] { 0x2e, 0x4e };
1.8 - private ushort[] VALUE_PORTS = new ushort[] { 0x2f, 0x4f };
1.9 + private ushort[] REGISTER_PORTS = new ushort[] { 0x2E, 0x4E };
1.10 + private ushort[] VALUE_PORTS = new ushort[] { 0x2F, 0x4F };
1.11
1.12 private ushort registerPort;
1.13 private ushort valuePort;
1.14 @@ -76,23 +76,20 @@
1.15 WinRing0.WriteIoPortByte(valuePort, logicalDeviceNumber);
1.16 }
1.17
1.18 - // ITE
1.19 - private const byte IT87_ENVIRONMENT_CONTROLLER_LDN = 0x04;
1.20 - private const byte IT87_CHIP_VERSION_REGISTER = 0x22;
1.21 -
1.22 - private void IT87Enter() {
1.23 - WinRing0.WriteIoPortByte(registerPort, 0x87);
1.24 - WinRing0.WriteIoPortByte(registerPort, 0x01);
1.25 - WinRing0.WriteIoPortByte(registerPort, 0x55);
1.26 - WinRing0.WriteIoPortByte(registerPort, 0x55);
1.27 + private void ReportUnknownChip(string type, int chip) {
1.28 + report.Append("Chip ID: Unknown ");
1.29 + report.Append(type);
1.30 + report.Append(" with ID 0x");
1.31 + report.Append(chip.ToString("X", CultureInfo.InvariantCulture));
1.32 + report.Append(" at 0x");
1.33 + report.Append(registerPort.ToString("X", CultureInfo.InvariantCulture));
1.34 + report.Append("/0x");
1.35 + report.AppendLine(valuePort.ToString("X", CultureInfo.InvariantCulture));
1.36 + report.AppendLine();
1.37 }
1.38
1.39 - private void IT87Exit() {
1.40 - WinRing0.WriteIoPortByte(registerPort, CONFIGURATION_CONTROL_REGISTER);
1.41 - WinRing0.WriteIoPortByte(valuePort, 0x02);
1.42 - }
1.43 + #region Winbond, Fintek
1.44
1.45 - // Winbond, Fintek
1.46 private const byte FINTEK_VENDOR_ID_REGISTER = 0x23;
1.47 private const ushort FINTEK_VENDOR_ID = 0x1934;
1.48
1.49 @@ -107,30 +104,9 @@
1.50 }
1.51
1.52 private void WinbondFintekExit() {
1.53 - WinRing0.WriteIoPortByte(registerPort, 0xAA);
1.54 - }
1.55 -
1.56 - // SMSC
1.57 - private void SMSCEnter() {
1.58 - WinRing0.WriteIoPortByte(registerPort, 0x55);
1.59 - }
1.60 -
1.61 - private void SMSCExit() {
1.62 WinRing0.WriteIoPortByte(registerPort, 0xAA);
1.63 }
1.64
1.65 - private void ReportUnknownChip(string type, int chip) {
1.66 - report.Append("Chip ID: Unknown ");
1.67 - report.Append(type);
1.68 - report.Append(" with ID 0x");
1.69 - report.Append(chip.ToString("X", CultureInfo.InvariantCulture));
1.70 - report.Append(" at 0x");
1.71 - report.Append(registerPort.ToString("X", CultureInfo.InvariantCulture));
1.72 - report.Append("/0x");
1.73 - report.AppendLine(valuePort.ToString("X", CultureInfo.InvariantCulture));
1.74 - report.AppendLine();
1.75 - }
1.76 -
1.77 private bool DetectWinbondFintek() {
1.78 WinbondFintekEnter();
1.79
1.80 @@ -324,7 +300,31 @@
1.81 return false;
1.82 }
1.83
1.84 + #endregion
1.85 +
1.86 + #region ITE
1.87 +
1.88 + private const byte IT87_ENVIRONMENT_CONTROLLER_LDN = 0x04;
1.89 + private const byte IT87_CHIP_VERSION_REGISTER = 0x22;
1.90 +
1.91 + private void IT87Enter() {
1.92 + WinRing0.WriteIoPortByte(registerPort, 0x87);
1.93 + WinRing0.WriteIoPortByte(registerPort, 0x01);
1.94 + WinRing0.WriteIoPortByte(registerPort, 0x55);
1.95 + WinRing0.WriteIoPortByte(registerPort, 0x55);
1.96 + }
1.97 +
1.98 + private void IT87Exit() {
1.99 + WinRing0.WriteIoPortByte(registerPort, CONFIGURATION_CONTROL_REGISTER);
1.100 + WinRing0.WriteIoPortByte(valuePort, 0x02);
1.101 + }
1.102 +
1.103 private bool DetectIT87() {
1.104 +
1.105 + // IT87XX can enter only on port 0x2E
1.106 + if (registerPort != 0x2E)
1.107 + return false;
1.108 +
1.109 IT87Enter();
1.110
1.111 ushort chipID = ReadWord(CHIP_ID_REGISTER);
1.112 @@ -370,6 +370,18 @@
1.113 return false;
1.114 }
1.115
1.116 + #endregion
1.117 +
1.118 + #region SMSC
1.119 +
1.120 + private void SMSCEnter() {
1.121 + WinRing0.WriteIoPortByte(registerPort, 0x55);
1.122 + }
1.123 +
1.124 + private void SMSCExit() {
1.125 + WinRing0.WriteIoPortByte(registerPort, 0xAA);
1.126 + }
1.127 +
1.128 private bool DetectSMSC() {
1.129 SMSCEnter();
1.130
1.131 @@ -392,6 +404,8 @@
1.132 return false;
1.133 }
1.134
1.135 + #endregion
1.136 +
1.137 private void Detect() {
1.138
1.139 for (int i = 0; i < REGISTER_PORTS.Length; i++) {
1.140 @@ -426,9 +440,8 @@
1.141
1.142 public string GetReport() {
1.143 if (report.Length > 0) {
1.144 - report.Insert(0, "LPCIO" + Environment.NewLine +
1.145 - Environment.NewLine);
1.146 - return report.ToString();
1.147 + return "LPCIO" + Environment.NewLine + Environment.NewLine +
1.148 + report.ToString();
1.149 } else
1.150 return null;
1.151 }