// SPDX-License-Identifier: GPL-2.0-only /* * This file was based upon code in Powertweak Linux (http://powertweak.sf.net) * (C) 2000-2003 Dave Jones, Arjan van de Ven, Janne Pänkälä, * Dominik Brodowski. * * BIG FAT DISCLAIMER: Work in progress code. Possibly *dangerous*
*/
/** * powernow_k6_get_cpu_multiplier - returns the current FSB multiplier * * Returns the current setting of the frequency multiplier. Core clock * speed is frequency of the Front-Side Bus multiplied with this value.
*/ staticint powernow_k6_get_cpu_multiplier(void)
{ unsignedlong invalue = 0;
u32 msrval;
local_irq_disable();
msrval = POWERNOW_IOPORT + 0x1;
wrmsr(MSR_K6_EPMR, msrval, 0); /* enable the PowerNow port */
invalue = inl(POWERNOW_IOPORT + 0x8);
msrval = POWERNOW_IOPORT + 0x0;
wrmsr(MSR_K6_EPMR, msrval, 0); /* disable it again */
/* we now need to transform best_i to the BVC format, see AMD#23446 */
/* * The processor doesn't respond to inquiry cycles while changing the * frequency, so we must disable cache.
*/
local_irq_disable();
cr0 = read_cr0();
write_cr0(cr0 | X86_CR0_CD);
wbinvd();
if (!max_multiplier) {
pr_warn("unknown frequency %u, cannot determine current multiplier\n",
khz);
pr_warn("use module parameters max_multiplier and bus_frequency\n"); return -EOPNOTSUPP;
}
/** * powernow_k6_init - initializes the k6 PowerNow! CPUFreq driver * * Initializes the K6 PowerNow! support. Returns -ENODEV on unsupported * devices, -EINVAL or -ENOMEM on problems during initiatization, and zero * on success.
*/ staticint __init powernow_k6_init(void)
{ if (!x86_match_cpu(powernow_k6_ids)) return -ENODEV;
if (!request_region(POWERNOW_IOPORT, 16, "PowerNow!")) {
pr_info("PowerNow IOPORT region already used\n"); return -EIO;
}
if (cpufreq_register_driver(&powernow_k6_driver)) {
release_region(POWERNOW_IOPORT, 16); return -EINVAL;
}
MODULE_AUTHOR("Arjan van de Ven, Dave Jones, " "Dominik Brodowski <linux@brodo.de>");
MODULE_DESCRIPTION("PowerNow! driver for AMD K6-2+ / K6-3+ processors.");
MODULE_LICENSE("GPL");
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.