Path: blob/master/tools/power/cpupower/debug/i386/intel_gsic.c
26296 views
// SPDX-License-Identifier: GPL-2.0-only1/*2* (C) 2003 Bruno Ducrot3* (C) 2004 Dominik Brodowski <[email protected]>4*5* Based on code found in6* linux/include/asm-i386/ist.h and linux/arch/i386/kernel/setup.c7* and originally developed by Andy Grover <[email protected]>8*/910#include <stdio.h>11#include <string.h>12#include <lrmi.h>1314int main (void)15{16struct LRMI_regs r;17int retval;1819if (!LRMI_init())20return 0;2122memset(&r, 0, sizeof(r));2324r.eax = 0x0000E980;25r.edx = 0x47534943;2627retval = LRMI_int(0x15, &r);2829if (!retval) {30printf("Failed!\n");31return 0;32}33if (r.eax == 0x47534943) {34printf("BIOS supports GSIC call:\n");35printf("\tsignature: %c%c%c%c\n",36(r.eax >> 24) & 0xff,37(r.eax >> 16) & 0xff,38(r.eax >> 8) & 0xff,39(r.eax) & 0xff);40printf("\tcommand port = 0x%.4x\n",41r.ebx & 0xffff);42printf("\tcommand = 0x%.4x\n",43(r.ebx >> 16) & 0xffff);44printf("\tevent port = 0x%.8x\n", r.ecx);45printf("\tflags = 0x%.8x\n", r.edx);46if (((r.ebx >> 16) & 0xffff) != 0x82) {47printf("non-default command value. If speedstep-smi "48"doesn't work out of the box,\nyou may want to "49"try out the default value by passing "50"smi_cmd=0x82 to the module\n ON YOUR OWN "51"RISK.\n");52}53if ((r.ebx & 0xffff) != 0xb2) {54printf("non-default command port. If speedstep-smi "55"doesn't work out of the box,\nyou may want to "56"try out the default value by passing "57"smi_port=0x82 to the module\n ON YOUR OWN "58"RISK.\n");59}60} else {61printf("BIOS DOES NOT support GSIC call. Dumping registers anyway:\n");62printf("eax = 0x%.8x\n", r.eax);63printf("ebx = 0x%.8x\n", r.ebx);64printf("ecx = 0x%.8x\n", r.ecx);65printf("edx = 0x%.8x\n", r.edx);66printf("Note also that some BIOS do not support the initial "67"GSIC call, but the newer\nspeedstep-smi driver may "68"work.\nFor this, you need to pass some arguments to "69"the speedstep-smi driver:\n");70printf("\tsmi_cmd=0x?? smi_port=0x?? smi_sig=1\n");71printf("\nUnfortunately, you have to know what exactly are "72"smi_cmd and smi_port, and this\nis system "73"dependent.\n");74}75return 1;76}777879