intel_gsic.c 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. /*
  2. * (C) 2003 Bruno Ducrot
  3. * (C) 2004 Dominik Brodowski <linux@dominikbrodowski.de>
  4. *
  5. * Licensed under the terms of the GNU GPL License version 2.
  6. *
  7. * Based on code found in
  8. * linux/include/asm-i386/ist.h and linux/arch/i386/kernel/setup.c
  9. * and originally developed by Andy Grover <andrew.grover@intel.com>
  10. */
  11. #include <stdio.h>
  12. #include <string.h>
  13. #include <lrmi.h>
  14. int main (void)
  15. {
  16. struct LRMI_regs r;
  17. int retval;
  18. if (!LRMI_init())
  19. return 0;
  20. memset(&r, 0, sizeof(r));
  21. r.eax = 0x0000E980;
  22. r.edx = 0x47534943;
  23. retval = LRMI_int(0x15, &r);
  24. if (!retval) {
  25. printf("Failed!\n");
  26. return 0;
  27. }
  28. if (r.eax == 0x47534943) {
  29. printf("BIOS supports GSIC call:\n");
  30. printf("\tsignature: %c%c%c%c\n",
  31. (r.eax >> 24) & 0xff,
  32. (r.eax >> 16) & 0xff,
  33. (r.eax >> 8) & 0xff,
  34. (r.eax) & 0xff);
  35. printf("\tcommand port = 0x%.4x\n",
  36. r.ebx & 0xffff);
  37. printf("\tcommand = 0x%.4x\n",
  38. (r.ebx >> 16) & 0xffff);
  39. printf("\tevent port = 0x%.8x\n", r.ecx);
  40. printf("\tflags = 0x%.8x\n", r.edx);
  41. if (((r.ebx >> 16) & 0xffff) != 0x82) {
  42. printf("non-default command value. If speedstep-smi "
  43. "doesn't work out of the box,\nyou may want to "
  44. "try out the default value by passing "
  45. "smi_cmd=0x82 to the module\n ON YOUR OWN "
  46. "RISK.\n");
  47. }
  48. if ((r.ebx & 0xffff) != 0xb2) {
  49. printf("non-default command port. If speedstep-smi "
  50. "doesn't work out of the box,\nyou may want to "
  51. "try out the default value by passing "
  52. "smi_port=0x82 to the module\n ON YOUR OWN "
  53. "RISK.\n");
  54. }
  55. } else {
  56. printf("BIOS DOES NOT support GSIC call. Dumping registers anyway:\n");
  57. printf("eax = 0x%.8x\n", r.eax);
  58. printf("ebx = 0x%.8x\n", r.ebx);
  59. printf("ecx = 0x%.8x\n", r.ecx);
  60. printf("edx = 0x%.8x\n", r.edx);
  61. printf("Note also that some BIOS do not support the initial "
  62. "GSIC call, but the newer\nspeedstep-smi driver may "
  63. "work.\nFor this, you need to pass some arguments to "
  64. "the speedstep-smi driver:\n");
  65. printf("\tsmi_cmd=0x?? smi_port=0x?? smi_sig=1\n");
  66. printf("\nUnfortunately, you have to know what exactly are "
  67. "smi_cmd and smi_port, and this\nis system "
  68. "dependant.\n");
  69. }
  70. return 1;
  71. }