longhaul.h 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353
  1. /*
  2. * longhaul.h
  3. * (C) 2003 Dave Jones.
  4. *
  5. * Licensed under the terms of the GNU GPL License version 2.
  6. *
  7. * VIA-specific information
  8. */
  9. union msr_bcr2 {
  10. struct {
  11. unsigned Reseved:19, // 18:0
  12. ESOFTBF:1, // 19
  13. Reserved2:3, // 22:20
  14. CLOCKMUL:4, // 26:23
  15. Reserved3:5; // 31:27
  16. } bits;
  17. unsigned long val;
  18. };
  19. union msr_longhaul {
  20. struct {
  21. unsigned RevisionID:4, // 3:0
  22. RevisionKey:4, // 7:4
  23. EnableSoftBusRatio:1, // 8
  24. EnableSoftVID:1, // 9
  25. EnableSoftBSEL:1, // 10
  26. Reserved:3, // 11:13
  27. SoftBusRatio4:1, // 14
  28. VRMRev:1, // 15
  29. SoftBusRatio:4, // 19:16
  30. SoftVID:5, // 24:20
  31. Reserved2:3, // 27:25
  32. SoftBSEL:2, // 29:28
  33. Reserved3:2, // 31:30
  34. MaxMHzBR:4, // 35:32
  35. MaximumVID:5, // 40:36
  36. MaxMHzFSB:2, // 42:41
  37. MaxMHzBR4:1, // 43
  38. Reserved4:4, // 47:44
  39. MinMHzBR:4, // 51:48
  40. MinimumVID:5, // 56:52
  41. MinMHzFSB:2, // 58:57
  42. MinMHzBR4:1, // 59
  43. Reserved5:4; // 63:60
  44. } bits;
  45. unsigned long long val;
  46. };
  47. /*
  48. * Clock ratio tables. Div/Mod by 10 to get ratio.
  49. * The eblcr values specify the ratio read from the CPU.
  50. * The mults values specify what to write to the CPU.
  51. */
  52. /*
  53. * VIA C3 Samuel 1 & Samuel 2 (stepping 0)
  54. */
  55. static const int samuel1_mults[16] = {
  56. -1, /* 0000 -> RESERVED */
  57. 30, /* 0001 -> 3.0x */
  58. 40, /* 0010 -> 4.0x */
  59. -1, /* 0011 -> RESERVED */
  60. -1, /* 0100 -> RESERVED */
  61. 35, /* 0101 -> 3.5x */
  62. 45, /* 0110 -> 4.5x */
  63. 55, /* 0111 -> 5.5x */
  64. 60, /* 1000 -> 6.0x */
  65. 70, /* 1001 -> 7.0x */
  66. 80, /* 1010 -> 8.0x */
  67. 50, /* 1011 -> 5.0x */
  68. 65, /* 1100 -> 6.5x */
  69. 75, /* 1101 -> 7.5x */
  70. -1, /* 1110 -> RESERVED */
  71. -1, /* 1111 -> RESERVED */
  72. };
  73. static const int samuel1_eblcr[16] = {
  74. 50, /* 0000 -> RESERVED */
  75. 30, /* 0001 -> 3.0x */
  76. 40, /* 0010 -> 4.0x */
  77. -1, /* 0011 -> RESERVED */
  78. 55, /* 0100 -> 5.5x */
  79. 35, /* 0101 -> 3.5x */
  80. 45, /* 0110 -> 4.5x */
  81. -1, /* 0111 -> RESERVED */
  82. -1, /* 1000 -> RESERVED */
  83. 70, /* 1001 -> 7.0x */
  84. 80, /* 1010 -> 8.0x */
  85. 60, /* 1011 -> 6.0x */
  86. -1, /* 1100 -> RESERVED */
  87. 75, /* 1101 -> 7.5x */
  88. -1, /* 1110 -> RESERVED */
  89. 65, /* 1111 -> 6.5x */
  90. };
  91. /*
  92. * VIA C3 Samuel2 Stepping 1->15
  93. */
  94. static const int samuel2_eblcr[16] = {
  95. 50, /* 0000 -> 5.0x */
  96. 30, /* 0001 -> 3.0x */
  97. 40, /* 0010 -> 4.0x */
  98. 100, /* 0011 -> 10.0x */
  99. 55, /* 0100 -> 5.5x */
  100. 35, /* 0101 -> 3.5x */
  101. 45, /* 0110 -> 4.5x */
  102. 110, /* 0111 -> 11.0x */
  103. 90, /* 1000 -> 9.0x */
  104. 70, /* 1001 -> 7.0x */
  105. 80, /* 1010 -> 8.0x */
  106. 60, /* 1011 -> 6.0x */
  107. 120, /* 1100 -> 12.0x */
  108. 75, /* 1101 -> 7.5x */
  109. 130, /* 1110 -> 13.0x */
  110. 65, /* 1111 -> 6.5x */
  111. };
  112. /*
  113. * VIA C3 Ezra
  114. */
  115. static const int ezra_mults[16] = {
  116. 100, /* 0000 -> 10.0x */
  117. 30, /* 0001 -> 3.0x */
  118. 40, /* 0010 -> 4.0x */
  119. 90, /* 0011 -> 9.0x */
  120. 95, /* 0100 -> 9.5x */
  121. 35, /* 0101 -> 3.5x */
  122. 45, /* 0110 -> 4.5x */
  123. 55, /* 0111 -> 5.5x */
  124. 60, /* 1000 -> 6.0x */
  125. 70, /* 1001 -> 7.0x */
  126. 80, /* 1010 -> 8.0x */
  127. 50, /* 1011 -> 5.0x */
  128. 65, /* 1100 -> 6.5x */
  129. 75, /* 1101 -> 7.5x */
  130. 85, /* 1110 -> 8.5x */
  131. 120, /* 1111 -> 12.0x */
  132. };
  133. static const int ezra_eblcr[16] = {
  134. 50, /* 0000 -> 5.0x */
  135. 30, /* 0001 -> 3.0x */
  136. 40, /* 0010 -> 4.0x */
  137. 100, /* 0011 -> 10.0x */
  138. 55, /* 0100 -> 5.5x */
  139. 35, /* 0101 -> 3.5x */
  140. 45, /* 0110 -> 4.5x */
  141. 95, /* 0111 -> 9.5x */
  142. 90, /* 1000 -> 9.0x */
  143. 70, /* 1001 -> 7.0x */
  144. 80, /* 1010 -> 8.0x */
  145. 60, /* 1011 -> 6.0x */
  146. 120, /* 1100 -> 12.0x */
  147. 75, /* 1101 -> 7.5x */
  148. 85, /* 1110 -> 8.5x */
  149. 65, /* 1111 -> 6.5x */
  150. };
  151. /*
  152. * VIA C3 (Ezra-T) [C5M].
  153. */
  154. static const int ezrat_mults[32] = {
  155. 100, /* 0000 -> 10.0x */
  156. 30, /* 0001 -> 3.0x */
  157. 40, /* 0010 -> 4.0x */
  158. 90, /* 0011 -> 9.0x */
  159. 95, /* 0100 -> 9.5x */
  160. 35, /* 0101 -> 3.5x */
  161. 45, /* 0110 -> 4.5x */
  162. 55, /* 0111 -> 5.5x */
  163. 60, /* 1000 -> 6.0x */
  164. 70, /* 1001 -> 7.0x */
  165. 80, /* 1010 -> 8.0x */
  166. 50, /* 1011 -> 5.0x */
  167. 65, /* 1100 -> 6.5x */
  168. 75, /* 1101 -> 7.5x */
  169. 85, /* 1110 -> 8.5x */
  170. 120, /* 1111 -> 12.0x */
  171. -1, /* 0000 -> RESERVED (10.0x) */
  172. 110, /* 0001 -> 11.0x */
  173. -1, /* 0010 -> 12.0x */
  174. -1, /* 0011 -> RESERVED (9.0x)*/
  175. 105, /* 0100 -> 10.5x */
  176. 115, /* 0101 -> 11.5x */
  177. 125, /* 0110 -> 12.5x */
  178. 135, /* 0111 -> 13.5x */
  179. 140, /* 1000 -> 14.0x */
  180. 150, /* 1001 -> 15.0x */
  181. 160, /* 1010 -> 16.0x */
  182. 130, /* 1011 -> 13.0x */
  183. 145, /* 1100 -> 14.5x */
  184. 155, /* 1101 -> 15.5x */
  185. -1, /* 1110 -> RESERVED (13.0x) */
  186. -1, /* 1111 -> RESERVED (12.0x) */
  187. };
  188. static const int ezrat_eblcr[32] = {
  189. 50, /* 0000 -> 5.0x */
  190. 30, /* 0001 -> 3.0x */
  191. 40, /* 0010 -> 4.0x */
  192. 100, /* 0011 -> 10.0x */
  193. 55, /* 0100 -> 5.5x */
  194. 35, /* 0101 -> 3.5x */
  195. 45, /* 0110 -> 4.5x */
  196. 95, /* 0111 -> 9.5x */
  197. 90, /* 1000 -> 9.0x */
  198. 70, /* 1001 -> 7.0x */
  199. 80, /* 1010 -> 8.0x */
  200. 60, /* 1011 -> 6.0x */
  201. 120, /* 1100 -> 12.0x */
  202. 75, /* 1101 -> 7.5x */
  203. 85, /* 1110 -> 8.5x */
  204. 65, /* 1111 -> 6.5x */
  205. -1, /* 0000 -> RESERVED (9.0x) */
  206. 110, /* 0001 -> 11.0x */
  207. 120, /* 0010 -> 12.0x */
  208. -1, /* 0011 -> RESERVED (10.0x)*/
  209. 135, /* 0100 -> 13.5x */
  210. 115, /* 0101 -> 11.5x */
  211. 125, /* 0110 -> 12.5x */
  212. 105, /* 0111 -> 10.5x */
  213. 130, /* 1000 -> 13.0x */
  214. 150, /* 1001 -> 15.0x */
  215. 160, /* 1010 -> 16.0x */
  216. 140, /* 1011 -> 14.0x */
  217. -1, /* 1100 -> RESERVED (12.0x) */
  218. 155, /* 1101 -> 15.5x */
  219. -1, /* 1110 -> RESERVED (13.0x) */
  220. 145, /* 1111 -> 14.5x */
  221. };
  222. /*
  223. * VIA C3 Nehemiah */
  224. static const int nehemiah_mults[32] = {
  225. 100, /* 0000 -> 10.0x */
  226. -1, /* 0001 -> 16.0x */
  227. 40, /* 0010 -> 4.0x */
  228. 90, /* 0011 -> 9.0x */
  229. 95, /* 0100 -> 9.5x */
  230. -1, /* 0101 -> RESERVED */
  231. 45, /* 0110 -> 4.5x */
  232. 55, /* 0111 -> 5.5x */
  233. 60, /* 1000 -> 6.0x */
  234. 70, /* 1001 -> 7.0x */
  235. 80, /* 1010 -> 8.0x */
  236. 50, /* 1011 -> 5.0x */
  237. 65, /* 1100 -> 6.5x */
  238. 75, /* 1101 -> 7.5x */
  239. 85, /* 1110 -> 8.5x */
  240. 120, /* 1111 -> 12.0x */
  241. -1, /* 0000 -> 10.0x */
  242. 110, /* 0001 -> 11.0x */
  243. -1, /* 0010 -> 12.0x */
  244. -1, /* 0011 -> 9.0x */
  245. 105, /* 0100 -> 10.5x */
  246. 115, /* 0101 -> 11.5x */
  247. 125, /* 0110 -> 12.5x */
  248. 135, /* 0111 -> 13.5x */
  249. 140, /* 1000 -> 14.0x */
  250. 150, /* 1001 -> 15.0x */
  251. 160, /* 1010 -> 16.0x */
  252. 130, /* 1011 -> 13.0x */
  253. 145, /* 1100 -> 14.5x */
  254. 155, /* 1101 -> 15.5x */
  255. -1, /* 1110 -> RESERVED (13.0x) */
  256. -1, /* 1111 -> 12.0x */
  257. };
  258. static const int nehemiah_eblcr[32] = {
  259. 50, /* 0000 -> 5.0x */
  260. 160, /* 0001 -> 16.0x */
  261. 40, /* 0010 -> 4.0x */
  262. 100, /* 0011 -> 10.0x */
  263. 55, /* 0100 -> 5.5x */
  264. -1, /* 0101 -> RESERVED */
  265. 45, /* 0110 -> 4.5x */
  266. 95, /* 0111 -> 9.5x */
  267. 90, /* 1000 -> 9.0x */
  268. 70, /* 1001 -> 7.0x */
  269. 80, /* 1010 -> 8.0x */
  270. 60, /* 1011 -> 6.0x */
  271. 120, /* 1100 -> 12.0x */
  272. 75, /* 1101 -> 7.5x */
  273. 85, /* 1110 -> 8.5x */
  274. 65, /* 1111 -> 6.5x */
  275. 90, /* 0000 -> 9.0x */
  276. 110, /* 0001 -> 11.0x */
  277. 120, /* 0010 -> 12.0x */
  278. 100, /* 0011 -> 10.0x */
  279. 135, /* 0100 -> 13.5x */
  280. 115, /* 0101 -> 11.5x */
  281. 125, /* 0110 -> 12.5x */
  282. 105, /* 0111 -> 10.5x */
  283. 130, /* 1000 -> 13.0x */
  284. 150, /* 1001 -> 15.0x */
  285. 160, /* 1010 -> 16.0x */
  286. 140, /* 1011 -> 14.0x */
  287. 120, /* 1100 -> 12.0x */
  288. 155, /* 1101 -> 15.5x */
  289. -1, /* 1110 -> RESERVED (13.0x) */
  290. 145 /* 1111 -> 14.5x */
  291. };
  292. /*
  293. * Voltage scales. Div/Mod by 1000 to get actual voltage.
  294. * Which scale to use depends on the VRM type in use.
  295. */
  296. struct mV_pos {
  297. unsigned short mV;
  298. unsigned short pos;
  299. };
  300. static const struct mV_pos vrm85_mV[32] = {
  301. {1250, 8}, {1200, 6}, {1150, 4}, {1100, 2},
  302. {1050, 0}, {1800, 30}, {1750, 28}, {1700, 26},
  303. {1650, 24}, {1600, 22}, {1550, 20}, {1500, 18},
  304. {1450, 16}, {1400, 14}, {1350, 12}, {1300, 10},
  305. {1275, 9}, {1225, 7}, {1175, 5}, {1125, 3},
  306. {1075, 1}, {1825, 31}, {1775, 29}, {1725, 27},
  307. {1675, 25}, {1625, 23}, {1575, 21}, {1525, 19},
  308. {1475, 17}, {1425, 15}, {1375, 13}, {1325, 11}
  309. };
  310. static const unsigned char mV_vrm85[32] = {
  311. 0x04, 0x14, 0x03, 0x13, 0x02, 0x12, 0x01, 0x11,
  312. 0x00, 0x10, 0x0f, 0x1f, 0x0e, 0x1e, 0x0d, 0x1d,
  313. 0x0c, 0x1c, 0x0b, 0x1b, 0x0a, 0x1a, 0x09, 0x19,
  314. 0x08, 0x18, 0x07, 0x17, 0x06, 0x16, 0x05, 0x15
  315. };
  316. static const struct mV_pos mobilevrm_mV[32] = {
  317. {1750, 31}, {1700, 30}, {1650, 29}, {1600, 28},
  318. {1550, 27}, {1500, 26}, {1450, 25}, {1400, 24},
  319. {1350, 23}, {1300, 22}, {1250, 21}, {1200, 20},
  320. {1150, 19}, {1100, 18}, {1050, 17}, {1000, 16},
  321. {975, 15}, {950, 14}, {925, 13}, {900, 12},
  322. {875, 11}, {850, 10}, {825, 9}, {800, 8},
  323. {775, 7}, {750, 6}, {725, 5}, {700, 4},
  324. {675, 3}, {650, 2}, {625, 1}, {600, 0}
  325. };
  326. static const unsigned char mV_mobilevrm[32] = {
  327. 0x1f, 0x1e, 0x1d, 0x1c, 0x1b, 0x1a, 0x19, 0x18,
  328. 0x17, 0x16, 0x15, 0x14, 0x13, 0x12, 0x11, 0x10,
  329. 0x0f, 0x0e, 0x0d, 0x0c, 0x0b, 0x0a, 0x09, 0x08,
  330. 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, 0x00
  331. };