Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 99403
b: refs/heads/master
c: 219835f
h: refs/heads/master
i:
  99401: d2d6f88
  99399: 48b7c04
v: v3
  • Loading branch information
Paolo Ciarrocchi authored and Ingo Molnar committed Jun 18, 2008
1 parent 5073f7f commit 93b6808
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 22 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: f016e15c11ba8945ff8e1945445648722d6fadfb
refs/heads/master: 219835f10eaef19d2b976076f2bc4ad806856c55
44 changes: 23 additions & 21 deletions trunk/arch/x86/kernel/cpu/cpufreq/cpufreq-nforce2.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,23 +26,24 @@
#define NFORCE2_SAFE_DISTANCE 50

/* Delay in ms between FSB changes */
//#define NFORCE2_DELAY 10
/* #define NFORCE2_DELAY 10 */

/* nforce2_chipset:
/*
* nforce2_chipset:
* FSB is changed using the chipset
*/
static struct pci_dev *nforce2_chipset_dev;

/* fid:
* multiplier * 10
*/
static int fid = 0;
static int fid;

/* min_fsb, max_fsb:
* minimum and maximum FSB (= FSB at boot time)
*/
static int min_fsb = 0;
static int max_fsb = 0;
static int min_fsb;
static int max_fsb;

MODULE_AUTHOR("Sebastian Witt <se.witt@gmx.net>");
MODULE_DESCRIPTION("nForce2 FSB changing cpufreq driver");
Expand All @@ -53,7 +54,7 @@ module_param(min_fsb, int, 0444);

MODULE_PARM_DESC(fid, "CPU multiplier to use (11.5 = 115)");
MODULE_PARM_DESC(min_fsb,
"Minimum FSB to use, if not defined: current FSB - 50");
"Minimum FSB to use, if not defined: current FSB - 50");

#define dprintk(msg...) cpufreq_debug_printk(CPUFREQ_DEBUG_DRIVER, "cpufreq-nforce2", msg)

Expand Down Expand Up @@ -139,21 +140,21 @@ static unsigned int nforce2_fsb_read(int bootfsb)

/* Get chipset boot FSB from subdevice 5 (FSB at boot-time) */
nforce2_sub5 = pci_get_subsys(PCI_VENDOR_ID_NVIDIA,
0x01EF,PCI_ANY_ID,PCI_ANY_ID,NULL);
0x01EF, PCI_ANY_ID, PCI_ANY_ID, NULL);
if (!nforce2_sub5)
return 0;

pci_read_config_dword(nforce2_sub5, NFORCE2_BOOTFSB, &fsb);
fsb /= 1000000;

/* Check if PLL register is already set */
pci_read_config_byte(nforce2_chipset_dev,NFORCE2_PLLENABLE, (u8 *)&temp);
pci_read_config_byte(nforce2_chipset_dev, NFORCE2_PLLENABLE, (u8 *)&temp);

if(bootfsb || !temp)
if (bootfsb || !temp)
return fsb;

/* Use PLL register FSB value */
pci_read_config_dword(nforce2_chipset_dev,NFORCE2_PLLREG, &temp);
pci_read_config_dword(nforce2_chipset_dev, NFORCE2_PLLREG, &temp);
fsb = nforce2_calc_fsb(temp);

return fsb;
Expand Down Expand Up @@ -184,7 +185,7 @@ static int nforce2_set_fsb(unsigned int fsb)
}

/* First write? Then set actual value */
pci_read_config_byte(nforce2_chipset_dev,NFORCE2_PLLENABLE, (u8 *)&temp);
pci_read_config_byte(nforce2_chipset_dev, NFORCE2_PLLENABLE, (u8 *)&temp);
if (!temp) {
pll = nforce2_calc_pll(tfsb);

Expand All @@ -210,7 +211,8 @@ static int nforce2_set_fsb(unsigned int fsb)
tfsb--;

/* Calculate the PLL reg. value */
if ((pll = nforce2_calc_pll(tfsb)) == -1)
pll = nforce2_calc_pll(tfsb);
if (pll == -1)
return -EINVAL;

nforce2_write_pll(pll);
Expand Down Expand Up @@ -249,7 +251,7 @@ static unsigned int nforce2_get(unsigned int cpu)
static int nforce2_target(struct cpufreq_policy *policy,
unsigned int target_freq, unsigned int relation)
{
// unsigned long flags;
/* unsigned long flags; */
struct cpufreq_freqs freqs;
unsigned int target_fsb;

Expand All @@ -271,17 +273,17 @@ static int nforce2_target(struct cpufreq_policy *policy,
cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE);

/* Disable IRQs */
//local_irq_save(flags);
/* local_irq_save(flags); */

if (nforce2_set_fsb(target_fsb) < 0)
printk(KERN_ERR "cpufreq: Changing FSB to %d failed\n",
target_fsb);
target_fsb);
else
dprintk("Changed FSB successfully to %d\n",
target_fsb);
target_fsb);

/* Enable IRQs */
//local_irq_restore(flags);
/* local_irq_restore(flags); */

cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE);

Expand All @@ -302,8 +304,8 @@ static int nforce2_verify(struct cpufreq_policy *policy)
policy->max = (fsb_pol_max + 1) * fid * 100;

cpufreq_verify_within_limits(policy,
policy->cpuinfo.min_freq,
policy->cpuinfo.max_freq);
policy->cpuinfo.min_freq,
policy->cpuinfo.max_freq);
return 0;
}

Expand Down Expand Up @@ -347,7 +349,7 @@ static int nforce2_cpu_init(struct cpufreq_policy *policy)
/* Set maximum FSB to FSB at boot time */
max_fsb = nforce2_fsb_read(1);

if(!max_fsb)
if (!max_fsb)
return -EIO;

if (!min_fsb)
Expand Down

0 comments on commit 93b6808

Please sign in to comment.