1*4f19048fSThomas Gleixner // SPDX-License-Identifier: GPL-2.0-only 27fe2f639SDominik Brodowski /* 37fe2f639SDominik Brodowski * (C) 2003 Bruno Ducrot 47fe2f639SDominik Brodowski * (C) 2004 Dominik Brodowski <linux@dominikbrodowski.de> 57fe2f639SDominik Brodowski * 67fe2f639SDominik Brodowski * Based on code found in 77fe2f639SDominik Brodowski * linux/include/asm-i386/ist.h and linux/arch/i386/kernel/setup.c 87fe2f639SDominik Brodowski * and originally developed by Andy Grover <andrew.grover@intel.com> 97fe2f639SDominik Brodowski */ 107fe2f639SDominik Brodowski 117fe2f639SDominik Brodowski #include <stdio.h> 127fe2f639SDominik Brodowski #include <string.h> 137fe2f639SDominik Brodowski #include <lrmi.h> 147fe2f639SDominik Brodowski 157fe2f639SDominik Brodowski int main (void) 167fe2f639SDominik Brodowski { 177fe2f639SDominik Brodowski struct LRMI_regs r; 187fe2f639SDominik Brodowski int retval; 197fe2f639SDominik Brodowski 207fe2f639SDominik Brodowski if (!LRMI_init()) 217fe2f639SDominik Brodowski return 0; 227fe2f639SDominik Brodowski 237fe2f639SDominik Brodowski memset(&r, 0, sizeof(r)); 247fe2f639SDominik Brodowski 257fe2f639SDominik Brodowski r.eax = 0x0000E980; 267fe2f639SDominik Brodowski r.edx = 0x47534943; 277fe2f639SDominik Brodowski 287fe2f639SDominik Brodowski retval = LRMI_int(0x15, &r); 297fe2f639SDominik Brodowski 307fe2f639SDominik Brodowski if (!retval) { 317fe2f639SDominik Brodowski printf("Failed!\n"); 327fe2f639SDominik Brodowski return 0; 337fe2f639SDominik Brodowski } 347fe2f639SDominik Brodowski if (r.eax == 0x47534943) { 357fe2f639SDominik Brodowski printf("BIOS supports GSIC call:\n"); 367fe2f639SDominik Brodowski printf("\tsignature: %c%c%c%c\n", 377fe2f639SDominik Brodowski (r.eax >> 24) & 0xff, 387fe2f639SDominik Brodowski (r.eax >> 16) & 0xff, 397fe2f639SDominik Brodowski (r.eax >> 8) & 0xff, 407fe2f639SDominik Brodowski (r.eax) & 0xff); 417fe2f639SDominik Brodowski printf("\tcommand port = 0x%.4x\n", 427fe2f639SDominik Brodowski r.ebx & 0xffff); 437fe2f639SDominik Brodowski printf("\tcommand = 0x%.4x\n", 447fe2f639SDominik Brodowski (r.ebx >> 16) & 0xffff); 457fe2f639SDominik Brodowski printf("\tevent port = 0x%.8x\n", r.ecx); 467fe2f639SDominik Brodowski printf("\tflags = 0x%.8x\n", r.edx); 477fe2f639SDominik Brodowski if (((r.ebx >> 16) & 0xffff) != 0x82) { 487fe2f639SDominik Brodowski printf("non-default command value. If speedstep-smi " 497fe2f639SDominik Brodowski "doesn't work out of the box,\nyou may want to " 507fe2f639SDominik Brodowski "try out the default value by passing " 517fe2f639SDominik Brodowski "smi_cmd=0x82 to the module\n ON YOUR OWN " 527fe2f639SDominik Brodowski "RISK.\n"); 537fe2f639SDominik Brodowski } 547fe2f639SDominik Brodowski if ((r.ebx & 0xffff) != 0xb2) { 557fe2f639SDominik Brodowski printf("non-default command port. If speedstep-smi " 567fe2f639SDominik Brodowski "doesn't work out of the box,\nyou may want to " 577fe2f639SDominik Brodowski "try out the default value by passing " 587fe2f639SDominik Brodowski "smi_port=0x82 to the module\n ON YOUR OWN " 597fe2f639SDominik Brodowski "RISK.\n"); 607fe2f639SDominik Brodowski } 617fe2f639SDominik Brodowski } else { 627fe2f639SDominik Brodowski printf("BIOS DOES NOT support GSIC call. Dumping registers anyway:\n"); 637fe2f639SDominik Brodowski printf("eax = 0x%.8x\n", r.eax); 647fe2f639SDominik Brodowski printf("ebx = 0x%.8x\n", r.ebx); 657fe2f639SDominik Brodowski printf("ecx = 0x%.8x\n", r.ecx); 667fe2f639SDominik Brodowski printf("edx = 0x%.8x\n", r.edx); 677fe2f639SDominik Brodowski printf("Note also that some BIOS do not support the initial " 681051e9b3SMasanari Iida "GSIC call, but the newer\nspeedstep-smi driver may " 697fe2f639SDominik Brodowski "work.\nFor this, you need to pass some arguments to " 707fe2f639SDominik Brodowski "the speedstep-smi driver:\n"); 717fe2f639SDominik Brodowski printf("\tsmi_cmd=0x?? smi_port=0x?? smi_sig=1\n"); 727fe2f639SDominik Brodowski printf("\nUnfortunately, you have to know what exactly are " 737fe2f639SDominik Brodowski "smi_cmd and smi_port, and this\nis system " 747fe2f639SDominik Brodowski "dependant.\n"); 757fe2f639SDominik Brodowski } 767fe2f639SDominik Brodowski return 1; 777fe2f639SDominik Brodowski } 78