PageRenderTime 25ms CodeModel.GetById 14ms RepoModel.GetById 0ms app.codeStats 0ms

/Documentation/hwmon/abituguru-datasheet.rst

https://github.com/kvaneesh/linux
ReStructuredText | 336 lines | 238 code | 98 blank | 0 comment | 0 complexity | 891974a141a24305dfd76af8178d6043 MD5 | raw file
  1. ===============
  2. uGuru datasheet
  3. ===============
  4. First of all, what I know about uGuru is no fact based on any help, hints or
  5. datasheet from Abit. The data I have got on uGuru have I assembled through
  6. my weak knowledge in "backwards engineering".
  7. And just for the record, you may have noticed uGuru isn't a chip developed by
  8. Abit, as they claim it to be. It's really just an microprocessor (uC) created by
  9. Winbond (W83L950D). And no, reading the manual for this specific uC or
  10. mailing Windbond for help won't give any useful data about uGuru, as it is
  11. the program inside the uC that is responding to calls.
  12. Olle Sandberg <ollebull@gmail.com>, 2005-05-25
  13. Original version by Olle Sandberg who did the heavy lifting of the initial
  14. reverse engineering. This version has been almost fully rewritten for clarity
  15. and extended with write support and info on more databanks, the write support
  16. is once again reverse engineered by Olle the additional databanks have been
  17. reverse engineered by me. I would like to express my thanks to Olle, this
  18. document and the Linux driver could not have been written without his efforts.
  19. Note: because of the lack of specs only the sensors part of the uGuru is
  20. described here and not the CPU / RAM / etc voltage & frequency control.
  21. Hans de Goede <j.w.r.degoede@hhs.nl>, 28-01-2006
  22. Detection
  23. =========
  24. As far as known the uGuru is always placed at and using the (ISA) I/O-ports
  25. 0xE0 and 0xE4, so we don't have to scan any port-range, just check what the two
  26. ports are holding for detection. We will refer to 0xE0 as CMD (command-port)
  27. and 0xE4 as DATA because Abit refers to them with these names.
  28. If DATA holds 0x00 or 0x08 and CMD holds 0x00 or 0xAC an uGuru could be
  29. present. We have to check for two different values at data-port, because
  30. after a reboot uGuru will hold 0x00 here, but if the driver is removed and
  31. later on attached again data-port will hold 0x08, more about this later.
  32. After wider testing of the Linux kernel driver some variants of the uGuru have
  33. turned up which will hold 0x00 instead of 0xAC at the CMD port, thus we also
  34. have to test CMD for two different values. On these uGuru's DATA will initially
  35. hold 0x09 and will only hold 0x08 after reading CMD first, so CMD must be read
  36. first!
  37. To be really sure an uGuru is present a test read of one or more register
  38. sets should be done.
  39. Reading / Writing
  40. =================
  41. Addressing
  42. ----------
  43. The uGuru has a number of different addressing levels. The first addressing
  44. level we will call banks. A bank holds data for one or more sensors. The data
  45. in a bank for a sensor is one or more bytes large.
  46. The number of bytes is fixed for a given bank, you should always read or write
  47. that many bytes, reading / writing more will fail, the results when writing
  48. less then the number of bytes for a given bank are undetermined.
  49. See below for all known bank addresses, numbers of sensors in that bank,
  50. number of bytes data per sensor and contents/meaning of those bytes.
  51. Although both this document and the kernel driver have kept the sensor
  52. terminology for the addressing within a bank this is not 100% correct, in
  53. bank 0x24 for example the addressing within the bank selects a PWM output not
  54. a sensor.
  55. Notice that some banks have both a read and a write address this is how the
  56. uGuru determines if a read from or a write to the bank is taking place, thus
  57. when reading you should always use the read address and when writing the
  58. write address. The write address is always one (1) more than the read address.
  59. uGuru ready
  60. -----------
  61. Before you can read from or write to the uGuru you must first put the uGuru
  62. in "ready" mode.
  63. To put the uGuru in ready mode first write 0x00 to DATA and then wait for DATA
  64. to hold 0x09, DATA should read 0x09 within 250 read cycles.
  65. Next CMD _must_ be read and should hold 0xAC, usually CMD will hold 0xAC the
  66. first read but sometimes it takes a while before CMD holds 0xAC and thus it
  67. has to be read a number of times (max 50).
  68. After reading CMD, DATA should hold 0x08 which means that the uGuru is ready
  69. for input. As above DATA will usually hold 0x08 the first read but not always.
  70. This step can be skipped, but it is undetermined what happens if the uGuru has
  71. not yet reported 0x08 at DATA and you proceed with writing a bank address.
  72. Sending bank and sensor addresses to the uGuru
  73. ----------------------------------------------
  74. First the uGuru must be in "ready" mode as described above, DATA should hold
  75. 0x08 indicating that the uGuru wants input, in this case the bank address.
  76. Next write the bank address to DATA. After the bank address has been written
  77. wait for to DATA to hold 0x08 again indicating that it wants / is ready for
  78. more input (max 250 reads).
  79. Once DATA holds 0x08 again write the sensor address to CMD.
  80. Reading
  81. -------
  82. First send the bank and sensor addresses as described above.
  83. Then for each byte of data you want to read wait for DATA to hold 0x01
  84. which indicates that the uGuru is ready to be read (max 250 reads) and once
  85. DATA holds 0x01 read the byte from CMD.
  86. Once all bytes have been read data will hold 0x09, but there is no reason to
  87. test for this. Notice that the number of bytes is bank address dependent see
  88. above and below.
  89. After completing a successful read it is advised to put the uGuru back in
  90. ready mode, so that it is ready for the next read / write cycle. This way
  91. if your program / driver is unloaded and later loaded again the detection
  92. algorithm described above will still work.
  93. Writing
  94. -------
  95. First send the bank and sensor addresses as described above.
  96. Then for each byte of data you want to write wait for DATA to hold 0x00
  97. which indicates that the uGuru is ready to be written (max 250 reads) and
  98. once DATA holds 0x00 write the byte to CMD.
  99. Once all bytes have been written wait for DATA to hold 0x01 (max 250 reads)
  100. don't ask why this is the way it is.
  101. Once DATA holds 0x01 read CMD it should hold 0xAC now.
  102. After completing a successful write it is advised to put the uGuru back in
  103. ready mode, so that it is ready for the next read / write cycle. This way
  104. if your program / driver is unloaded and later loaded again the detection
  105. algorithm described above will still work.
  106. Gotchas
  107. -------
  108. After wider testing of the Linux kernel driver some variants of the uGuru have
  109. turned up which do not hold 0x08 at DATA within 250 reads after writing the
  110. bank address. With these versions this happens quite frequent, using larger
  111. timeouts doesn't help, they just go offline for a second or 2, doing some
  112. internal calibration or whatever. Your code should be prepared to handle
  113. this and in case of no response in this specific case just goto sleep for a
  114. while and then retry.
  115. Address Map
  116. ===========
  117. Bank 0x20 Alarms (R)
  118. --------------------
  119. This bank contains 0 sensors, iow the sensor address is ignored (but must be
  120. written) just use 0. Bank 0x20 contains 3 bytes:
  121. Byte 0:
  122. This byte holds the alarm flags for sensor 0-7 of Sensor Bank1, with bit 0
  123. corresponding to sensor 0, 1 to 1, etc.
  124. Byte 1:
  125. This byte holds the alarm flags for sensor 8-15 of Sensor Bank1, with bit 0
  126. corresponding to sensor 8, 1 to 9, etc.
  127. Byte 2:
  128. This byte holds the alarm flags for sensor 0-5 of Sensor Bank2, with bit 0
  129. corresponding to sensor 0, 1 to 1, etc.
  130. Bank 0x21 Sensor Bank1 Values / Readings (R)
  131. --------------------------------------------
  132. This bank contains 16 sensors, for each sensor it contains 1 byte.
  133. So far the following sensors are known to be available on all motherboards:
  134. - Sensor 0 CPU temp
  135. - Sensor 1 SYS temp
  136. - Sensor 3 CPU core volt
  137. - Sensor 4 DDR volt
  138. - Sensor 10 DDR Vtt volt
  139. - Sensor 15 PWM temp
  140. Byte 0:
  141. This byte holds the reading from the sensor. Sensors in Bank1 can be both
  142. volt and temp sensors, this is motherboard specific. The uGuru however does
  143. seem to know (be programmed with) what kindoff sensor is attached see Sensor
  144. Bank1 Settings description.
  145. Volt sensors use a linear scale, a reading 0 corresponds with 0 volt and a
  146. reading of 255 with 3494 mV. The sensors for higher voltages however are
  147. connected through a division circuit. The currently known division circuits
  148. in use result in ranges of: 0-4361mV, 0-6248mV or 0-14510mV. 3.3 volt sources
  149. use the 0-4361mV range, 5 volt the 0-6248mV and 12 volt the 0-14510mV .
  150. Temp sensors also use a linear scale, a reading of 0 corresponds with 0 degree
  151. Celsius and a reading of 255 with a reading of 255 degrees Celsius.
  152. Bank 0x22 Sensor Bank1 Settings (R) and Bank 0x23 Sensor Bank1 Settings (W)
  153. ---------------------------------------------------------------------------
  154. Those banks contain 16 sensors, for each sensor it contains 3 bytes. Each
  155. set of 3 bytes contains the settings for the sensor with the same sensor
  156. address in Bank 0x21 .
  157. Byte 0:
  158. Alarm behaviour for the selected sensor. A 1 enables the described
  159. behaviour.
  160. Bit 0:
  161. Give an alarm if measured temp is over the warning threshold (RW) [1]_
  162. Bit 1:
  163. Give an alarm if measured volt is over the max threshold (RW) [2]_
  164. Bit 2:
  165. Give an alarm if measured volt is under the min threshold (RW) [2]_
  166. Bit 3:
  167. Beep if alarm (RW)
  168. Bit 4:
  169. 1 if alarm cause measured temp is over the warning threshold (R)
  170. Bit 5:
  171. 1 if alarm cause measured volt is over the max threshold (R)
  172. Bit 6:
  173. 1 if alarm cause measured volt is under the min threshold (R)
  174. Bit 7:
  175. - Volt sensor: Shutdown if alarm persist for more than 4 seconds (RW)
  176. - Temp sensor: Shutdown if temp is over the shutdown threshold (RW)
  177. .. [1] This bit is only honored/used by the uGuru if a temp sensor is connected
  178. .. [2] This bit is only honored/used by the uGuru if a volt sensor is connected
  179. Note with some trickery this can be used to find out what kinda sensor
  180. is detected see the Linux kernel driver for an example with many
  181. comments on how todo this.
  182. Byte 1:
  183. - Temp sensor: warning threshold (scale as bank 0x21)
  184. - Volt sensor: min threshold (scale as bank 0x21)
  185. Byte 2:
  186. - Temp sensor: shutdown threshold (scale as bank 0x21)
  187. - Volt sensor: max threshold (scale as bank 0x21)
  188. Bank 0x24 PWM outputs for FAN's (R) and Bank 0x25 PWM outputs for FAN's (W)
  189. ---------------------------------------------------------------------------
  190. Those banks contain 3 "sensors", for each sensor it contains 5 bytes.
  191. - Sensor 0 usually controls the CPU fan
  192. - Sensor 1 usually controls the NB (or chipset for single chip) fan
  193. - Sensor 2 usually controls the System fan
  194. Byte 0:
  195. Flag 0x80 to enable control, Fan runs at 100% when disabled.
  196. low nibble (temp)sensor address at bank 0x21 used for control.
  197. Byte 1:
  198. 0-255 = 0-12v (linear), specify voltage at which fan will rotate when under
  199. low threshold temp (specified in byte 3)
  200. Byte 2:
  201. 0-255 = 0-12v (linear), specify voltage at which fan will rotate when above
  202. high threshold temp (specified in byte 4)
  203. Byte 3:
  204. Low threshold temp (scale as bank 0x21)
  205. byte 4:
  206. High threshold temp (scale as bank 0x21)
  207. Bank 0x26 Sensors Bank2 Values / Readings (R)
  208. ---------------------------------------------
  209. This bank contains 6 sensors (AFAIK), for each sensor it contains 1 byte.
  210. So far the following sensors are known to be available on all motherboards:
  211. - Sensor 0: CPU fan speed
  212. - Sensor 1: NB (or chipset for single chip) fan speed
  213. - Sensor 2: SYS fan speed
  214. Byte 0:
  215. This byte holds the reading from the sensor. 0-255 = 0-15300 (linear)
  216. Bank 0x27 Sensors Bank2 Settings (R) and Bank 0x28 Sensors Bank2 Settings (W)
  217. -----------------------------------------------------------------------------
  218. Those banks contain 6 sensors (AFAIK), for each sensor it contains 2 bytes.
  219. Byte 0:
  220. Alarm behaviour for the selected sensor. A 1 enables the described behaviour.
  221. Bit 0:
  222. Give an alarm if measured rpm is under the min threshold (RW)
  223. Bit 3:
  224. Beep if alarm (RW)
  225. Bit 7:
  226. Shutdown if alarm persist for more than 4 seconds (RW)
  227. Byte 1:
  228. min threshold (scale as bank 0x26)
  229. Warning for the adventurous
  230. ===========================
  231. A word of caution to those who want to experiment and see if they can figure
  232. the voltage / clock programming out, I tried reading and only reading banks
  233. 0-0x30 with the reading code used for the sensor banks (0x20-0x28) and this
  234. resulted in a _permanent_ reprogramming of the voltages, luckily I had the
  235. sensors part configured so that it would shutdown my system on any out of spec
  236. voltages which probably safed my computer (after a reboot I managed to
  237. immediately enter the bios and reload the defaults). This probably means that
  238. the read/write cycle for the non sensor part is different from the sensor part.