Added ISA bus mutex support to the super IO detection.
1.1 --- a/Hardware/LPC/F718XX.cs Wed Aug 04 20:27:05 2010 +0000
1.2 +++ b/Hardware/LPC/F718XX.cs Thu Aug 05 18:06:18 2010 +0000
1.3 @@ -88,7 +88,7 @@
1.4 r.Append("Base Adress: 0x"); r.AppendLine(address.ToString("X4"));
1.5 r.AppendLine();
1.6
1.7 - if (!WinRing0.WaitIsaBusMutex())
1.8 + if (!WinRing0.WaitIsaBusMutex(100))
1.9 return r.ToString();
1.10
1.11 r.AppendLine("Hardware Monitor Registers");
1.12 @@ -111,7 +111,7 @@
1.13 }
1.14
1.15 public void Update() {
1.16 - if (!WinRing0.WaitIsaBusMutex())
1.17 + if (!WinRing0.WaitIsaBusMutex(10))
1.18 return;
1.19
1.20 for (int i = 0; i < voltages.Length; i++) {
2.1 --- a/Hardware/LPC/IT87XX.cs Wed Aug 04 20:27:05 2010 +0000
2.2 +++ b/Hardware/LPC/IT87XX.cs Thu Aug 05 18:06:18 2010 +0000
2.3 @@ -119,7 +119,7 @@
2.4 r.Append("Base Address: 0x"); r.AppendLine(address.ToString("X4"));
2.5 r.AppendLine();
2.6
2.7 - if (!WinRing0.WaitIsaBusMutex())
2.8 + if (!WinRing0.WaitIsaBusMutex(100))
2.9 return r.ToString();
2.10
2.11 r.AppendLine("Environment Controller Registers");
2.12 @@ -147,7 +147,7 @@
2.13 }
2.14
2.15 public void Update() {
2.16 - if (!WinRing0.WaitIsaBusMutex())
2.17 + if (!WinRing0.WaitIsaBusMutex(10))
2.18 return;
2.19
2.20 for (int i = 0; i < voltages.Length; i++) {
3.1 --- a/Hardware/LPC/LPCIO.cs Wed Aug 04 20:27:05 2010 +0000
3.2 +++ b/Hardware/LPC/LPCIO.cs Thu Aug 05 18:06:18 2010 +0000
3.3 @@ -120,9 +120,7 @@
3.4 WinRing0.WriteIoPortByte(registerPort, 0xAA);
3.5 }
3.6
3.7 - public LPCIO() {
3.8 - if (!WinRing0.IsAvailable)
3.9 - return;
3.10 + private void Detect() {
3.11
3.12 for (int i = 0; i < REGISTER_PORTS.Length; i++) {
3.13 registerPort = REGISTER_PORTS[i];
3.14 @@ -145,35 +143,35 @@
3.15 case 0x41:
3.16 chip = Chip.F71882;
3.17 logicalDeviceNumber = FINTEK_HARDWARE_MONITOR_LDN;
3.18 - break;
3.19 + break;
3.20 } break;
3.21 case 0x06:
3.22 - switch (revision) {
3.23 + switch (revision) {
3.24 case 0x01:
3.25 chip = Chip.F71862;
3.26 logicalDeviceNumber = FINTEK_HARDWARE_MONITOR_LDN;
3.27 - break;
3.28 + break;
3.29 } break;
3.30 case 0x07:
3.31 switch (revision) {
3.32 case 0x23:
3.33 chip = Chip.F71889F;
3.34 logicalDeviceNumber = FINTEK_HARDWARE_MONITOR_LDN;
3.35 - break;
3.36 + break;
3.37 } break;
3.38 case 0x08:
3.39 switch (revision) {
3.40 case 0x14:
3.41 chip = Chip.F71869;
3.42 logicalDeviceNumber = FINTEK_HARDWARE_MONITOR_LDN;
3.43 - break;
3.44 + break;
3.45 } break;
3.46 case 0x09:
3.47 switch (revision) {
3.48 case 0x09:
3.49 chip = Chip.F71889ED;
3.50 logicalDeviceNumber = FINTEK_HARDWARE_MONITOR_LDN;
3.51 - break;
3.52 + break;
3.53 } break;
3.54 case 0x52:
3.55 switch (revision) {
3.56 @@ -182,7 +180,7 @@
3.57 case 0x41:
3.58 chip = Chip.W83627HF;
3.59 logicalDeviceNumber = WINBOND_HARDWARE_MONITOR_LDN;
3.60 - break;
3.61 + break;
3.62 } break;
3.63 case 0x82:
3.64 switch (revision & 0xF0) {
3.65 @@ -208,10 +206,10 @@
3.66 } break;
3.67 case 0xA0:
3.68 switch (revision & 0xF0) {
3.69 - case 0x20:
3.70 + case 0x20:
3.71 chip = Chip.W83627DHG;
3.72 - logicalDeviceNumber = WINBOND_HARDWARE_MONITOR_LDN;
3.73 - break;
3.74 + logicalDeviceNumber = WINBOND_HARDWARE_MONITOR_LDN;
3.75 + break;
3.76 } break;
3.77 case 0xA5:
3.78 switch (revision & 0xF0) {
3.79 @@ -225,7 +223,7 @@
3.80 case 0x70:
3.81 chip = Chip.W83627DHGP;
3.82 logicalDeviceNumber = WINBOND_HARDWARE_MONITOR_LDN;
3.83 - break;
3.84 + break;
3.85 } break;
3.86 case 0xB3:
3.87 switch (revision & 0xF0) {
3.88 @@ -233,20 +231,20 @@
3.89 chip = Chip.W83667HGB;
3.90 logicalDeviceNumber = WINBOND_HARDWARE_MONITOR_LDN;
3.91 break;
3.92 - } break;
3.93 + } break;
3.94 }
3.95 if (chip == Chip.Unknown) {
3.96 if (id != 0 && id != 0xff) {
3.97 WinbondFintekExit();
3.98
3.99 - report.Append("Chip ID: Unknown Winbond / Fintek with ID 0x");
3.100 + report.Append("Chip ID: Unknown Winbond / Fintek with ID 0x");
3.101 report.AppendLine(((id << 8) | revision).ToString("X"));
3.102 report.AppendLine();
3.103 }
3.104 } else {
3.105
3.106 Select(logicalDeviceNumber);
3.107 - ushort address = ReadWord(BASE_ADDRESS_REGISTER);
3.108 + ushort address = ReadWord(BASE_ADDRESS_REGISTER);
3.109 Thread.Sleep(1);
3.110 ushort verify = ReadWord(BASE_ADDRESS_REGISTER);
3.111
3.112 @@ -254,10 +252,10 @@
3.113
3.114 WinbondFintekExit();
3.115
3.116 - if (address != verify) {
3.117 - report.Append("Chip ID: 0x");
3.118 + if (address != verify) {
3.119 + report.Append("Chip ID: 0x");
3.120 report.AppendLine(chip.ToString("X"));
3.121 - report.Append("Chip revision: 0x");
3.122 + report.Append("Chip revision: 0x");
3.123 report.AppendLine(revision.ToString("X"));
3.124 report.AppendLine("Error: Address verification failed");
3.125 report.AppendLine();
3.126 @@ -268,7 +266,7 @@
3.127 if ((address & 0x07) == 0x05)
3.128 address &= 0xFFF8;
3.129
3.130 - if (address < 0x100 || (address & 0xF007) != 0) {
3.131 + if (address < 0x100 || (address & 0xF007) != 0) {
3.132 report.Append("Chip ID: 0x");
3.133 report.AppendLine(chip.ToString("X"));
3.134 report.Append("Chip revision: 0x");
3.135 @@ -310,7 +308,7 @@
3.136 break;
3.137 default: break;
3.138 }
3.139 -
3.140 +
3.141 return;
3.142 }
3.143
3.144 @@ -322,7 +320,7 @@
3.145 case 0x8716: chip = Chip.IT8716F; break;
3.146 case 0x8718: chip = Chip.IT8718F; break;
3.147 case 0x8720: chip = Chip.IT8720F; break;
3.148 - case 0x8726: chip = Chip.IT8726F; break;
3.149 + case 0x8726: chip = Chip.IT8726F; break;
3.150 default: chip = Chip.Unknown; break;
3.151 }
3.152 if (chip == Chip.Unknown) {
3.153 @@ -333,7 +331,7 @@
3.154 report.AppendLine(chipID.ToString("X"));
3.155 report.AppendLine();
3.156 }
3.157 - } else {
3.158 + } else {
3.159 Select(IT87_ENVIRONMENT_CONTROLLER_LDN);
3.160 ushort address = ReadWord(BASE_ADDRESS_REGISTER);
3.161 Thread.Sleep(1);
3.162 @@ -345,14 +343,14 @@
3.163
3.164 if (address != verify || address < 0x100 || (address & 0xF007) != 0) {
3.165 report.Append("Chip ID: 0x");
3.166 - report.AppendLine(chip.ToString("X"));
3.167 + report.AppendLine(chip.ToString("X"));
3.168 report.Append("Error: Invalid address 0x");
3.169 report.AppendLine(address.ToString("X"));
3.170 report.AppendLine();
3.171 return;
3.172 }
3.173
3.174 - superIOs.Add(new IT87XX(chip, address, version));
3.175 + superIOs.Add(new IT87XX(chip, address, version));
3.176
3.177 return;
3.178 }
3.179 @@ -376,7 +374,19 @@
3.180
3.181 return;
3.182 }
3.183 - }
3.184 + }
3.185 + }
3.186 +
3.187 + public LPCIO() {
3.188 + if (!WinRing0.IsAvailable)
3.189 + return;
3.190 +
3.191 + if (!WinRing0.WaitIsaBusMutex(100))
3.192 + return;
3.193 +
3.194 + Detect();
3.195 +
3.196 + WinRing0.ReleaseIsaBusMutex();
3.197 }
3.198
3.199 public ISuperIO[] SuperIO {
4.1 --- a/Hardware/LPC/W836XX.cs Wed Aug 04 20:27:05 2010 +0000
4.2 +++ b/Hardware/LPC/W836XX.cs Thu Aug 05 18:06:18 2010 +0000
4.3 @@ -194,7 +194,7 @@
4.4 public float?[] Fans { get { return fans; } }
4.5
4.6 public void Update() {
4.7 - if (!WinRing0.WaitIsaBusMutex())
4.8 + if (!WinRing0.WaitIsaBusMutex(10))
4.9 return;
4.10
4.11 for (int i = 0; i < voltages.Length; i++) {
4.12 @@ -295,7 +295,7 @@
4.13 r.Append("Base Adress: 0x"); r.AppendLine(address.ToString("X4"));
4.14 r.AppendLine();
4.15
4.16 - if (!WinRing0.WaitIsaBusMutex())
4.17 + if (!WinRing0.WaitIsaBusMutex(100))
4.18 return r.ToString();
4.19
4.20 r.AppendLine("Hardware Monitor Registers");
5.1 --- a/Hardware/WinRing0.cs Wed Aug 04 20:27:05 2010 +0000
5.2 +++ b/Hardware/WinRing0.cs Thu Aug 05 18:06:18 2010 +0000
5.3 @@ -162,9 +162,9 @@
5.4 get { return available; }
5.5 }
5.6
5.7 - public static bool WaitIsaBusMutex() {
5.8 + public static bool WaitIsaBusMutex(int millisecondsTimeout) {
5.9 try {
5.10 - return isaBusMutex.WaitOne(10);
5.11 + return isaBusMutex.WaitOne(millisecondsTimeout);
5.12 } catch { return false; }
5.13 }
5.14