Commit 2f57572d authored by Linus Torvalds's avatar Linus Torvalds

Merge http://jfs.bkbits.net/linux-2.5

into home.osdl.org:/home/torvalds/v2.5/linux
parents 469c5855 d6ad3d08
...@@ -28,30 +28,34 @@ ...@@ -28,30 +28,34 @@
* with 'Suspend Modulation OFF Count Register' * with 'Suspend Modulation OFF Count Register'
* and 'Suspend Modulation ON Count Register'. * and 'Suspend Modulation ON Count Register'.
* These registers are 8bit counters that represent the number of * These registers are 8bit counters that represent the number of
* 32us intervals which the SUSP# pin is asserted/de-asserted to the * 32us intervals which the SUSP# pin is asserted(ON)/de-asserted(OFF)
* processor. * to the processor.
* *
* These counters define a ratio which is the effective frequency * These counters define a ratio which is the effective frequency
* of operation of the system. * of operation of the system.
* *
* On Count * OFF Count
* F_eff = Fgx * ---------------------- * F_eff = Fgx * ----------------------
* On Count + Off Count * OFF Count + ON Count
* *
* 0 <= On Count, Off Count <= 255 * 0 <= On Count, Off Count <= 255
* *
* From these limits, we can get register values * From these limits, we can get register values
* *
* on_duration + off_duration <= MAX_DURATION * off_duration + on_duration <= MAX_DURATION
* off_duration = on_duration * (stock_freq - freq) / freq * on_duration = off_duration * (stock_freq - freq) / freq
* *
* on_duration = (freq * DURATION) / stock_freq * off_duration = (freq * DURATION) / stock_freq
* off_duration = DURATION - on_duration * on_duration = DURATION - off_duration
* *
* *
*--------------------------------------------------------------------------- *---------------------------------------------------------------------------
* *
* ChangeLog: * ChangeLog:
* Dec. 12, 2003 Hiroshi Miura <miura@da-cha.org>
* - fix on/off register mistake
* - fix cpu_khz calc when it stops cpu modulation.
*
* Dec. 11, 2002 Hiroshi Miura <miura@da-cha.org> * Dec. 11, 2002 Hiroshi Miura <miura@da-cha.org>
* - rewrite for Cyrix MediaGX Cx5510/5520 and * - rewrite for Cyrix MediaGX Cx5510/5520 and
* NatSemi Geode Cs5530(A). * NatSemi Geode Cs5530(A).
...@@ -233,13 +237,13 @@ static unsigned int gx_validate_speed(unsigned int khz, u8 *on_duration, u8 *off ...@@ -233,13 +237,13 @@ static unsigned int gx_validate_speed(unsigned int khz, u8 *on_duration, u8 *off
int old_tmp_freq = stock_freq; int old_tmp_freq = stock_freq;
int tmp_freq; int tmp_freq;
*on_duration=1; *off_duration=1;
*off_duration=0; *on_duration=0;
for (i=max_duration; i>0; i--) { for (i=max_duration; i>0; i--) {
tmp_on = ((khz * i) / stock_freq) & 0xff; tmp_off = ((khz * i) / stock_freq) & 0xff;
tmp_off = i - tmp_on; tmp_on = i - tmp_off;
tmp_freq = (stock_freq * tmp_on) / i; tmp_freq = (stock_freq * tmp_off) / i;
/* if this relation is closer to khz, use this. If it's equal, /* if this relation is closer to khz, use this. If it's equal,
* prefer it, too - lower latency */ * prefer it, too - lower latency */
if (abs(tmp_freq - khz) <= abs(old_tmp_freq - khz)) { if (abs(tmp_freq - khz) <= abs(old_tmp_freq - khz)) {
...@@ -273,42 +277,37 @@ static void gx_set_cpuspeed(unsigned int khz) ...@@ -273,42 +277,37 @@ static void gx_set_cpuspeed(unsigned int khz)
freqs.new = new_khz; freqs.new = new_khz;
if (new_khz == stock_freq) { /* if new khz == 100% of CPU speed, it is special case */
local_irq_save(flags);
cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE);
pci_write_config_byte(gx_params->cs55x0, PCI_SUSCFG, (gx_params->pci_suscfg & ~(SUSMOD)));
pci_read_config_byte(gx_params->cs55x0, PCI_SUSCFG, &(gx_params->pci_suscfg));
local_irq_restore(flags);
dprintk("suspend modulation disabled: cpu runs 100 percent speed.\n");
cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE);
return;
}
cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE); cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE);
local_irq_save(flags); local_irq_save(flags);
switch (gx_params->cs55x0->device) {
case PCI_DEVICE_ID_CYRIX_5530_LEGACY: if (new_khz != stock_freq) { /* if new khz == 100% of CPU speed, it is special case */
pmer1 = gx_params->pci_pmer1 | IRQ_SPDUP | VID_SPDUP; switch (gx_params->cs55x0->device) {
/* FIXME: need to test other values -- Zwane,Miura */ case PCI_DEVICE_ID_CYRIX_5530_LEGACY:
pci_write_config_byte(gx_params->cs55x0, PCI_IRQTC, 4); /* typical 2 to 4ms */ pmer1 = gx_params->pci_pmer1 | IRQ_SPDUP | VID_SPDUP;
pci_write_config_byte(gx_params->cs55x0, PCI_VIDTC, 100);/* typical 50 to 100ms */ /* FIXME: need to test other values -- Zwane,Miura */
pci_write_config_byte(gx_params->cs55x0, PCI_PMER1, pmer1); pci_write_config_byte(gx_params->cs55x0, PCI_IRQTC, 4); /* typical 2 to 4ms */
pci_write_config_byte(gx_params->cs55x0, PCI_VIDTC, 100);/* typical 50 to 100ms */
if (gx_params->pci_rev < 0x10) { /* CS5530(rev 1.2, 1.3) */ pci_write_config_byte(gx_params->cs55x0, PCI_PMER1, pmer1);
if (gx_params->pci_rev < 0x10) { /* CS5530(rev 1.2, 1.3) */
suscfg = gx_params->pci_suscfg | SUSMOD;
} else { /* CS5530A,B.. */
suscfg = gx_params->pci_suscfg | SUSMOD | PWRSVE;
}
break;
case PCI_DEVICE_ID_CYRIX_5520:
case PCI_DEVICE_ID_CYRIX_5510:
suscfg = gx_params->pci_suscfg | SUSMOD; suscfg = gx_params->pci_suscfg | SUSMOD;
} else { /* CS5530A,B.. */ default:
suscfg = gx_params->pci_suscfg | SUSMOD | PWRSVE; local_irq_restore(flags);
dprintk("fatal: try to set unknown chipset.\n");
return;
} }
break; } else {
case PCI_DEVICE_ID_CYRIX_5520: suscfg = gx_params->pci_suscfg & ~(SUSMOD);
case PCI_DEVICE_ID_CYRIX_5510: gx_params->off_duration = 0;
suscfg = gx_params->pci_suscfg | SUSMOD; gx_params->on_duration = 0;
break; dprintk("suspend modulation disabled: cpu runs 100 percent speed.\n");
default:
local_irq_restore(flags);
dprintk("fatal: try to set unknown chipset.\n");
return;
} }
pci_write_config_byte(gx_params->cs55x0, PCI_MODOFF, gx_params->off_duration); pci_write_config_byte(gx_params->cs55x0, PCI_MODOFF, gx_params->off_duration);
......
...@@ -246,7 +246,7 @@ static int cpufreq_p4_cpu_init(struct cpufreq_policy *policy) ...@@ -246,7 +246,7 @@ static int cpufreq_p4_cpu_init(struct cpufreq_policy *policy)
static int cpufreq_p4_cpu_exit(struct cpufreq_policy *policy) static int cpufreq_p4_cpu_exit(struct cpufreq_policy *policy)
{ {
cpufreq_frequency_table_put_attr(policy->cpu); cpufreq_frequency_table_put_attr(policy->cpu);
return cpufreq_p4_setdc(policy->cpu, DC_DISABLE); return 0;
} }
static struct freq_attr* p4clockmod_attr[] = { static struct freq_attr* p4clockmod_attr[] = {
......
...@@ -91,18 +91,13 @@ static int check_powernow(void) ...@@ -91,18 +91,13 @@ static int check_powernow(void)
struct cpuinfo_x86 *c = cpu_data; struct cpuinfo_x86 *c = cpu_data;
unsigned int maxei, eax, ebx, ecx, edx; unsigned int maxei, eax, ebx, ecx, edx;
if (c->x86_vendor != X86_VENDOR_AMD) { if ((c->x86_vendor != X86_VENDOR_AMD) || (c->x86 !=6)) {
printk (KERN_INFO PFX "AMD processor not detected.\n"); #ifdef MODULE
return 0;
}
if (c->x86 !=6) {
printk (KERN_INFO PFX "This module only works with AMD K7 CPUs\n"); printk (KERN_INFO PFX "This module only works with AMD K7 CPUs\n");
#endif
return 0; return 0;
} }
printk (KERN_INFO PFX "AMD K7 CPU detected.\n");
if ((c->x86_model == 6) && (c->x86_mask == 0)) { if ((c->x86_model == 6) && (c->x86_mask == 0)) {
printk (KERN_INFO PFX "K7 660[A0] core detected, enabling errata workarounds\n"); printk (KERN_INFO PFX "K7 660[A0] core detected, enabling errata workarounds\n");
have_a0 = 1; have_a0 = 1;
......
This diff is collapsed.
...@@ -120,7 +120,3 @@ struct pst_s { ...@@ -120,7 +120,3 @@ struct pst_s {
static inline int core_voltage_pre_transition(u32 reqvid); static inline int core_voltage_pre_transition(u32 reqvid);
static inline int core_voltage_post_transition(u32 reqvid); static inline int core_voltage_post_transition(u32 reqvid);
static inline int core_frequency_transition(u32 reqfid); static inline int core_frequency_transition(u32 reqfid);
static int powernowk8_verify(struct cpufreq_policy *pol);
static int powernowk8_target(struct cpufreq_policy *pol, unsigned targfreq,
unsigned relation);
static int __init powernowk8_cpu_init(struct cpufreq_policy *pol);
...@@ -207,17 +207,55 @@ unsigned int speedstep_detect_processor (void) ...@@ -207,17 +207,55 @@ unsigned int speedstep_detect_processor (void)
if (c->x86_model != 2) if (c->x86_model != 2)
return 0; return 0;
if ((c->x86_mask != 4) && /* B-stepping [M-P4-M] */
(c->x86_mask != 7) && /* C-stepping [M-P4-M] */
(c->x86_mask != 9)) /* D-stepping [M-P4-M or M-P4/533] */
return 0;
ebx = cpuid_ebx(0x00000001); ebx = cpuid_ebx(0x00000001);
ebx &= 0x000000FF; ebx &= 0x000000FF;
if ((ebx != 0x0e) && (ebx != 0x0f))
return 0;
return SPEEDSTEP_PROCESSOR_P4M; dprintk(KERN_INFO "ebx value is %x, x86_mask is %x\n", ebx, c->86_mask);
switch (c->x86_mask) {
case 4:
/*
* B-stepping [M-P4-M]
* sample has ebx = 0x0f, production has 0x0e.
*/
if ((ebx == 0x0e) || (ebx == 0x0f))
return SPEEDSTEP_PROCESSOR_P4M;
break;
case 7:
/*
* C-stepping [M-P4-M]
* needs to have ebx=0x0e, else it's a celeron:
* cf. 25130917.pdf / page 7, footnote 5 even
* though 25072120.pdf / page 7 doesn't say
* samples are only of B-stepping...
*/
if (ebx == 0x0e)
return SPEEDSTEP_PROCESSOR_P4M;
break;
case 9:
/*
* D-stepping [M-P4-M or M-P4/533]
*
* this is totally strange: CPUID 0x0F29 is
* used by M-P4-M, M-P4/533 and(!) Celeron CPUs.
* The latter need to be sorted out as they don't
* support speedstep.
* Celerons with CPUID 0x0F29 may have either
* ebx=0x8 or 0xf -- 25130917.pdf doesn't say anything
* specific.
* M-P4-Ms may have either ebx=0xe or 0xf [see above]
* M-P4/533 have either ebx=0xe or 0xf. [25317607.pdf]
* So, how to distinguish all those processors with
* ebx=0xf? I don't know. Sort them out, and wait
* for someone to complain.
*/
if (ebx == 0x0e)
return SPEEDSTEP_PROCESSOR_P4M;
break;
default:
break;
}
return 0;
} }
switch (c->x86_model) { switch (c->x86_model) {
......
...@@ -296,12 +296,8 @@ static void __init init_intel(struct cpuinfo_x86 *c) ...@@ -296,12 +296,8 @@ static void __init init_intel(struct cpuinfo_x86 *c)
} else if (smp_num_siblings > 1 ) { } else if (smp_num_siblings > 1 ) {
index_lsb = 0; index_lsb = 0;
index_msb = 31; index_msb = 31;
/*
* At this point we only support two siblings per if (smp_num_siblings > NR_CPUS) {
* processor package.
*/
#define NR_SIBLINGS 2
if (smp_num_siblings != NR_SIBLINGS) {
printk(KERN_WARNING "CPU: Unsupported number of the siblings %d", smp_num_siblings); printk(KERN_WARNING "CPU: Unsupported number of the siblings %d", smp_num_siblings);
smp_num_siblings = 1; smp_num_siblings = 1;
goto too_many_siblings; goto too_many_siblings;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* linux/drivers/cpufreq/cpufreq_userspace.c * linux/drivers/cpufreq/cpufreq_userspace.c
* *
* Copyright (C) 2001 Russell King * Copyright (C) 2001 Russell King
* (C) 2002 - 2003 Dominik Brodowski <linux@brodo.de> * (C) 2002 - 2004 Dominik Brodowski <linux@brodo.de>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as * it under the terms of the GNU General Public License version 2 as
...@@ -112,7 +112,14 @@ int cpufreq_set(unsigned int freq, unsigned int cpu) ...@@ -112,7 +112,14 @@ int cpufreq_set(unsigned int freq, unsigned int cpu)
if (freq > cpu_max_freq[cpu]) if (freq > cpu_max_freq[cpu])
freq = cpu_max_freq[cpu]; freq = cpu_max_freq[cpu];
ret = cpufreq_driver_target(&current_policy[cpu], freq, /*
* We're safe from concurrent calls to ->target() here
* as we hold the userspace_sem lock. If we were calling
* cpufreq_driver_target, a deadlock situation might occur:
* A: cpufreq_set (lock userspace_sem) -> cpufreq_driver_target(lock policy->lock)
* B: cpufreq_set_policy(lock policy->lock) -> __cpufreq_governor -> cpufreq_governor_userspace (lock userspace_sem)
*/
ret = __cpufreq_driver_target(&current_policy[cpu], freq,
CPUFREQ_RELATION_L); CPUFREQ_RELATION_L);
err: err:
......
...@@ -82,9 +82,14 @@ validate_fields( ...@@ -82,9 +82,14 @@ validate_fields(
va.va_mask = XFS_AT_NLINK|XFS_AT_SIZE|XFS_AT_NBLOCKS; va.va_mask = XFS_AT_NLINK|XFS_AT_SIZE|XFS_AT_NBLOCKS;
VOP_GETATTR(vp, &va, ATTR_LAZY, NULL, error); VOP_GETATTR(vp, &va, ATTR_LAZY, NULL, error);
ip->i_nlink = va.va_nlink; if (likely(!error)) {
ip->i_size = va.va_size; ip->i_nlink = va.va_nlink;
ip->i_blocks = va.va_nblocks; ip->i_blocks = va.va_nblocks;
/* we're under i_sem so i_size can't change under us */
if (i_size_read(ip) != va.va_size)
i_size_write(ip, va.va_size);
}
} }
/* /*
...@@ -536,6 +541,7 @@ linvfs_setattr( ...@@ -536,6 +541,7 @@ linvfs_setattr(
if (error) if (error)
return(-error); /* Positive error up from XFS */ return(-error); /* Positive error up from XFS */
if (ia_valid & ATTR_SIZE) { if (ia_valid & ATTR_SIZE) {
i_size_write(inode, vattr.va_size);
error = vmtruncate(inode, attr->ia_size); error = vmtruncate(inode, attr->ia_size);
} }
......
...@@ -213,7 +213,6 @@ vn_revalidate( ...@@ -213,7 +213,6 @@ vn_revalidate(
inode->i_mtime = va.va_mtime; inode->i_mtime = va.va_mtime;
inode->i_ctime = va.va_ctime; inode->i_ctime = va.va_ctime;
inode->i_atime = va.va_atime; inode->i_atime = va.va_atime;
i_size_write(inode, va.va_size);
if (va.va_xflags & XFS_XFLAG_IMMUTABLE) if (va.va_xflags & XFS_XFLAG_IMMUTABLE)
inode->i_flags |= S_IMMUTABLE; inode->i_flags |= S_IMMUTABLE;
else else
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment