Commit 0c55b80c authored by Anton Blanchard's avatar Anton Blanchard

Merge samba.org:/scratch/anton/sfr into samba.org:/scratch/anton/export

parents fcc3bbce 9f43824b
......@@ -4,7 +4,7 @@
EXTRA_TARGETS := head.o
EXTRA_AFLAGS := $(CFLAGS)
CFLAGS += -Werror -Wno-sign-compare
EXTRA_CFLAGS := -Werror -Wno-sign-compare
obj-y := entry.o traps.o process.o init_task.o osf_sys.o irq.o \
irq_alpha.o signal.o setup.o ptrace.o time.o semaphore.o \
......
......@@ -582,6 +582,7 @@ alpha_switch_to:
lda $8, 0x3fff
bsr $1, undo_switch_stack
bic $sp, $8, $8
mov $17, $0
ret
.end alpha_switch_to
......
......@@ -3,7 +3,7 @@
#
EXTRA_AFLAGS := $(CFLAGS)
CFLAGS += -Werror
EXTRA_CFLAGS := -Werror
L_TARGET := lib.a
......
......@@ -2,6 +2,6 @@
# Makefile for the FPU instruction emulation.
#
CFLAGS += -Iinclude/math-emu -w
EXTRA_CFLAGS := -w
obj-$(CONFIG_MATHEMU) += math.o qrnnd.o
......@@ -2,7 +2,7 @@
# Makefile for the linux alpha-specific parts of the memory manager.
#
CFLAGS += -Werror
EXTRA_CFLAGS := -Werror
obj-y := init.o fault.o extable.o remap.o
......
CFLAGS += -Werror -Wno-sign-compare
EXTRA_CFLAGS := -Werror -Wno-sign-compare
obj-$(CONFIG_OPROFILE) += oprofile.o
......
......@@ -954,158 +954,7 @@ config APM_REAL_MODE_POWER_OFF
a work-around for a number of buggy BIOSes. Switch this option on if
your computer crashes instead of powering off properly.
config CPU_FREQ
bool "CPU Frequency scaling"
help
Clock scaling allows you to change the clock speed of CPUs on the
fly. This is a nice method to save battery power on notebooks,
because the lower the clock speed, the less power the CPU consumes.
For more information, take a look at linux/Documentation/cpufreq or
at <http://www.brodo.de/cpufreq/>
If in doubt, say N.
config CPU_FREQ_PROC_INTF
tristate "/proc/cpufreq interface (DEPRECATED)"
depends on CPU_FREQ && PROC_FS
help
This enables the /proc/cpufreq interface for controlling
CPUFreq. Please note that it is recommended to use the sysfs
interface instead (which is built automatically).
For details, take a look at linux/Documentation/cpufreq.
If in doubt, say N.
config CPU_FREQ_24_API
bool "/proc/sys/cpu/ interface (2.4. / OLD)"
depends on CPU_FREQ
help
This enables the /proc/sys/cpu/ sysctl interface for controlling
CPUFreq, as known from the 2.4.-kernel patches for CPUFreq. 2.5
uses a sysfs interface instead. Please note that some drivers do
not work well with the 2.4. /proc/sys/cpu sysctl interface,
so if in doubt, say N here.
For details, take a look at linux/Documentation/cpufreq.
If in doubt, say N.
config CPU_FREQ_TABLE
tristate "CPU frequency table helpers"
depends on CPU_FREQ
default y
help
Many CPUFreq drivers use these helpers, so only say N here if
the CPUFreq driver of your choice doesn't need these helpers.
If in doubt, say Y.
config X86_ACPI_CPUFREQ
tristate "ACPI Processor P-States driver"
depends on CPU_FREQ_TABLE && ACPI_PROCESSOR
help
This driver adds a CPUFreq driver which utilizes the ACPI
Processor Performance States.
For details, take a look at linux/Documentation/cpufreq.
If in doubt, say N.
config X86_POWERNOW_K6
tristate "AMD Mobile K6-2/K6-3 PowerNow!"
depends on CPU_FREQ_TABLE
help
This adds the CPUFreq driver for mobile AMD K6-2+ and mobile
AMD K6-3+ processors.
For details, take a look at linux/Documentation/cpufreq.
If in doubt, say N.
config X86_POWERNOW_K7
tristate "AMD Mobile Athlon/Duron PowerNow!"
depends on CPU_FREQ_TABLE
help
This adds the CPUFreq driver for mobile AMD K7 mobile processors.
For details, take a look at linux/Documentation/cpufreq.
If in doubt, say N.
config ELAN_CPUFREQ
tristate "AMD Elan"
depends on CPU_FREQ_TABLE && MELAN
---help---
This adds the CPUFreq driver for AMD Elan SC400 and SC410
processors.
You need to specify the processor maximum speed as boot
parameter: elanfreq=maxspeed (in kHz) or as module
parameter "max_freq".
For details, take a look at linux/Documentation/cpufreq.
If in doubt, say N.
config X86_LONGHAUL
tristate "VIA Cyrix III Longhaul"
depends on CPU_FREQ
help
This adds the CPUFreq driver for VIA Samuel/CyrixIII,
VIA Cyrix Samuel/C3, VIA Cyrix Ezra and VIA Cyrix Ezra-T
processors.
For details, take a look at linux/Documentation/cpufreq.
If in doubt, say N.
config X86_SPEEDSTEP
tristate "Intel Speedstep"
depends on CPU_FREQ_TABLE
help
This adds the CPUFreq driver for certain mobile Intel Pentium III
(Coppermine), all mobile Intel Pentium III-M (Tulatin) and all
mobile Intel Pentium 4 P4-Ms.
For details, take a look at linux/Documentation/cpufreq.
If in doubt, say N.
config X86_P4_CLOCKMOD
tristate "Intel Pentium 4 clock modulation"
depends on CPU_FREQ_TABLE
help
This adds the CPUFreq driver for Intel Pentium 4 / XEON
processors.
For details, take a look at linux/Documentation/cpufreq.
If in doubt, say N.
config X86_LONGRUN
tristate "Transmeta LongRun"
depends on CPU_FREQ
help
This adds the CPUFreq driver for Transmeta Crusoe processors which
support LongRun.
For details, take a look at linux/Documentation/cpufreq.
If in doubt, say N.
config X86_GX_SUSPMOD
tristate "Cyrix MediaGX/NatSemi Geode Suspend Modulation"
depends on CPU_FREQ
help
This add the CPUFreq driver for NatSemi Geode processors which
support suspend modulation.
For details, take a look at linux/Documentation/cpufreq.
If in doubt, say N.
source "arch/i386/kernel/cpu/cpufreq/Kconfig"
endmenu
......
#
# CPU Frequency scaling
#
menu "CPU Frequency scaling"
config CPU_FREQ
bool "CPU Frequency scaling"
help
Clock scaling allows you to change the clock speed of CPUs on the
fly. This is a nice method to save battery power on notebooks,
because the lower the clock speed, the less power the CPU consumes.
For more information, take a look at linux/Documentation/cpufreq or
at <http://www.brodo.de/cpufreq/>
If in doubt, say N.
source "drivers/cpufreq/Kconfig"
config CPU_FREQ_24_API
bool "/proc/sys/cpu/ interface (2.4. / OLD)"
depends on CPU_FREQ
help
This enables the /proc/sys/cpu/ sysctl interface for controlling
CPUFreq, as known from the 2.4.-kernel patches for CPUFreq. 2.5
uses a sysfs interface instead. Please note that some drivers do
not work well with the 2.4. /proc/sys/cpu sysctl interface,
so if in doubt, say N here.
For details, take a look at linux/Documentation/cpufreq.
If in doubt, say N.
config CPU_FREQ_TABLE
tristate "CPU frequency table helpers"
depends on CPU_FREQ
default y
help
Many CPUFreq drivers use these helpers, so only say N here if
the CPUFreq driver of your choice doesn't need these helpers.
If in doubt, say Y.
comment "CPUFreq processor drivers"
depends on CPU_FREQ
config X86_ACPI_CPUFREQ
tristate "ACPI Processor P-States driver"
depends on CPU_FREQ_TABLE && ACPI_PROCESSOR
help
This driver adds a CPUFreq driver which utilizes the ACPI
Processor Performance States.
For details, take a look at linux/Documentation/cpufreq.
If in doubt, say N.
config ELAN_CPUFREQ
tristate "AMD Elan"
depends on CPU_FREQ_TABLE && MELAN
---help---
This adds the CPUFreq driver for AMD Elan SC400 and SC410
processors.
You need to specify the processor maximum speed as boot
parameter: elanfreq=maxspeed (in kHz) or as module
parameter "max_freq".
For details, take a look at linux/Documentation/cpufreq.
If in doubt, say N.
config X86_POWERNOW_K6
tristate "AMD Mobile K6-2/K6-3 PowerNow!"
depends on CPU_FREQ_TABLE
help
This adds the CPUFreq driver for mobile AMD K6-2+ and mobile
AMD K6-3+ processors.
For details, take a look at linux/Documentation/cpufreq.
If in doubt, say N.
config X86_POWERNOW_K7
tristate "AMD Mobile Athlon/Duron PowerNow!"
depends on CPU_FREQ_TABLE
help
This adds the CPUFreq driver for mobile AMD K7 mobile processors.
For details, take a look at linux/Documentation/cpufreq.
If in doubt, say N.
config X86_GX_SUSPMOD
tristate "Cyrix MediaGX/NatSemi Geode Suspend Modulation"
depends on CPU_FREQ
help
This add the CPUFreq driver for NatSemi Geode processors which
support suspend modulation.
For details, take a look at linux/Documentation/cpufreq.
If in doubt, say N.
config X86_SPEEDSTEP
tristate "Intel Speedstep"
depends on CPU_FREQ_TABLE
help
This adds the CPUFreq driver for certain mobile Intel Pentium III
(Coppermine), all mobile Intel Pentium III-M (Tulatin) and all
mobile Intel Pentium 4 P4-Ms.
For details, take a look at linux/Documentation/cpufreq.
If in doubt, say N.
config X86_P4_CLOCKMOD
tristate "Intel Pentium 4 clock modulation"
depends on CPU_FREQ_TABLE
help
This adds the CPUFreq driver for Intel Pentium 4 / XEON
processors.
For details, take a look at linux/Documentation/cpufreq.
If in doubt, say N.
config X86_LONGRUN
tristate "Transmeta LongRun"
depends on CPU_FREQ
help
This adds the CPUFreq driver for Transmeta Crusoe processors which
support LongRun.
For details, take a look at linux/Documentation/cpufreq.
If in doubt, say N.
config X86_LONGHAUL
tristate "VIA Cyrix III Longhaul"
depends on CPU_FREQ
help
This adds the CPUFreq driver for VIA Samuel/CyrixIII,
VIA Cyrix Samuel/C3, VIA Cyrix Ezra and VIA Cyrix Ezra-T
processors.
For details, take a look at linux/Documentation/cpufreq.
If in doubt, say N.
endmenu
/*
* $Id: longrun.c,v 1.14 2002/10/31 21:17:40 db Exp $
* $Id: longrun.c,v 1.22 2003/02/10 17:31:50 db Exp $
*
* (C) 2002 Dominik Brodowski <linux@brodo.de>
* (C) 2002 - 2003 Dominik Brodowski <linux@brodo.de>
*
* Licensed under the terms of the GNU GPL License version 2.
*
......@@ -18,7 +18,7 @@
#include <asm/processor.h>
#include <asm/timex.h>
static struct cpufreq_driver *longrun_driver;
static struct cpufreq_driver longrun_driver;
/**
* longrun_{low,high}_freq is needed for the conversion of cpufreq kHz
......@@ -39,9 +39,6 @@ static void longrun_get_policy(struct cpufreq_policy *policy)
{
u32 msr_lo, msr_hi;
if (!longrun_driver)
return;
rdmsr(MSR_TMTA_LONGRUN_FLAGS, msr_lo, msr_hi);
if (msr_lo & 0x01)
policy->policy = CPUFREQ_POLICY_PERFORMANCE;
......@@ -72,7 +69,7 @@ static int longrun_set_policy(struct cpufreq_policy *policy)
u32 msr_lo, msr_hi;
u32 pctg_lo, pctg_hi;
if (!longrun_driver || !policy)
if (!policy)
return -EINVAL;
pctg_lo = (policy->min - longrun_low_freq) /
......@@ -117,13 +114,16 @@ static int longrun_set_policy(struct cpufreq_policy *policy)
*/
static int longrun_verify_policy(struct cpufreq_policy *policy)
{
if (!policy || !longrun_driver)
if (!policy)
return -EINVAL;
policy->cpu = 0;
cpufreq_verify_within_limits(policy,
longrun_driver->policy[0].cpuinfo.min_freq,
longrun_driver->policy[0].cpuinfo.max_freq);
policy->cpuinfo.min_freq,
policy->cpuinfo.max_freq);
if (policy->policy == CPUFREQ_POLICY_GOVERNOR)
policy->policy = longrun_driver.policy[0].policy;
return 0;
}
......@@ -221,59 +221,59 @@ static unsigned int __init longrun_determine_freqs(unsigned int *low_freq,
}
/**
* longrun_init - initializes the Transmeta Crusoe LongRun CPUFreq driver
*
* Initializes the LongRun support.
*/
static int __init longrun_init(void)
static int longrun_cpu_init(struct cpufreq_policy *policy)
{
int result;
struct cpufreq_driver *driver;
int result = 0;
struct cpuinfo_x86 *c = cpu_data;
/* capability check */
if (policy->cpu != 0)
return -ENODEV;
if (c->x86_vendor != X86_VENDOR_TRANSMETA ||
!cpu_has(c, X86_FEATURE_LONGRUN))
return 0;
/* initialization of main "cpufreq" code*/
driver = kmalloc(sizeof(struct cpufreq_driver) +
NR_CPUS * sizeof(struct cpufreq_policy), GFP_KERNEL);
if (!driver)
return -ENOMEM;
memset(driver, 0, sizeof(struct cpufreq_driver) +
NR_CPUS * sizeof(struct cpufreq_policy));
driver->policy = (struct cpufreq_policy *) (driver + 1);
if (longrun_determine_freqs(&longrun_low_freq, &longrun_high_freq)) {
kfree(driver);
return -EIO;
}
driver->policy[0].cpuinfo.min_freq = longrun_low_freq;
driver->policy[0].cpuinfo.max_freq = longrun_high_freq;
driver->policy[0].cpuinfo.transition_latency = CPUFREQ_ETERNAL;
return -ENODEV;
/* detect low and high frequency */
result = longrun_determine_freqs(&longrun_low_freq, &longrun_high_freq);
if (result)
return result;
/* cpuinfo and default policy values */
policy->cpuinfo.min_freq = longrun_low_freq;
policy->cpuinfo.max_freq = longrun_high_freq;
policy->cpuinfo.transition_latency = CPUFREQ_ETERNAL;
longrun_get_policy(policy);
#ifdef CONFIG_CPU_FREQ_24_API
longrun_driver.cpu_cur_freq[policy->cpu] = longrun_low_freq; /* dummy value */
#endif
strncpy(driver->name, "longrun", CPUFREQ_NAME_LEN);
return 0;
}
longrun_get_policy(&driver->policy[0]);
#ifdef CONFIG_CPU_FREQ_24_API
driver->cpu_cur_freq[0] = longrun_high_freq; /* dummy value */
#endif
static struct cpufreq_driver longrun_driver = {
.verify = longrun_verify_policy,
.setpolicy = longrun_set_policy,
.init = longrun_cpu_init,
.name = "longrun",
};
driver->verify = &longrun_verify_policy;
driver->setpolicy = &longrun_set_policy;
longrun_driver = driver;
/**
* longrun_init - initializes the Transmeta Crusoe LongRun CPUFreq driver
*
* Initializes the LongRun support.
*/
static int __init longrun_init(void)
{
struct cpuinfo_x86 *c = cpu_data;
result = cpufreq_register(driver);
if (result) {
longrun_driver = NULL;
kfree(driver);
}
if (c->x86_vendor != X86_VENDOR_TRANSMETA ||
!cpu_has(c, X86_FEATURE_LONGRUN))
return -ENODEV;
return result;
return cpufreq_register_driver(&longrun_driver);
}
......@@ -282,15 +282,13 @@ static int __init longrun_init(void)
*/
static void __exit longrun_exit(void)
{
if (longrun_driver) {
cpufreq_unregister();
kfree(longrun_driver);
}
cpufreq_unregister_driver(&longrun_driver);
}
MODULE_AUTHOR ("Dominik Brodowski <linux@brodo.de>");
MODULE_DESCRIPTION ("LongRun driver for Transmeta Crusoe processors.");
MODULE_LICENSE ("GPL");
module_init(longrun_init);
module_exit(longrun_exit);
/*
* Pentium 4/Xeon CPU on demand clock modulation/speed scaling
* (C) 2002 - 2003 Dominik Brodowski <linux@brodo.de>
* (C) 2002 Zwane Mwaikambo <zwane@commfireservices.com>
* (C) 2002 Arjan van de Ven <arjanv@redhat.com>
* (C) 2002 Tora T. Engstad
......@@ -45,11 +46,10 @@ enum {
#define DC_ENTRIES 8
static int has_N44_O17_errata;
static int has_N44_O17_errata[NR_CPUS];
static int stock_freq;
MODULE_PARM(stock_freq, "i");
static struct cpufreq_driver *cpufreq_p4_driver;
static struct cpufreq_driver p4clockmod_driver;
static int cpufreq_p4_setdc(unsigned int cpu, unsigned int newstate)
......@@ -107,17 +107,17 @@ static int cpufreq_p4_setdc(unsigned int cpu, unsigned int newstate)
rdmsr(MSR_IA32_THERM_STATUS, l, h);
if (l & 0x01)
printk(KERN_DEBUG PFX "CPU#%d currently thermal throttled\n", cpu);
// printk(KERN_DEBUG PFX "CPU#%d currently thermal throttled\n", cpu);
if (has_N44_O17_errata && (newstate == DC_25PT || newstate == DC_DFLT))
if (has_N44_O17_errata[cpu] && (newstate == DC_25PT || newstate == DC_DFLT))
newstate = DC_38PT;
rdmsr(MSR_IA32_THERM_CONTROL, l, h);
if (newstate == DC_DISABLE) {
printk(KERN_INFO PFX "CPU#%d disabling modulation\n", cpu);
// printk(KERN_INFO PFX "CPU#%d disabling modulation\n", cpu);
wrmsr(MSR_IA32_THERM_CONTROL, l & ~(1<<4), h);
} else {
printk(KERN_INFO PFX "CPU#%d setting duty cycle to %d%%\n", cpu, ((125 * newstate) / 10));
// printk(KERN_INFO PFX "CPU#%d setting duty cycle to %d%%\n", cpu, ((125 * newstate) / 10));
/* bits 63 - 5 : reserved
* bit 4 : enable/disable
* bits 3-1 : duty cycle
......@@ -155,14 +155,16 @@ static struct cpufreq_frequency_table p4clockmod_table[] = {
};
static int cpufreq_p4_setpolicy(struct cpufreq_policy *policy)
static int cpufreq_p4_target(struct cpufreq_policy *policy,
unsigned int target_freq,
unsigned int relation)
{
unsigned int newstate = DC_RESV;
if (cpufreq_frequency_table_setpolicy(policy, &p4clockmod_table[0], &newstate))
if (cpufreq_frequency_table_target(policy, &p4clockmod_table[0], target_freq, relation, &newstate))
return -EINVAL;
cpufreq_p4_setdc(policy->cpu, newstate);
cpufreq_p4_setdc(policy->cpu, p4clockmod_table[newstate].index);
return 0;
}
......@@ -174,39 +176,30 @@ static int cpufreq_p4_verify(struct cpufreq_policy *policy)
}
static int __init cpufreq_p4_init(void)
{
struct cpuinfo_x86 *c = cpu_data;
int cpuid;
int ret;
struct cpufreq_driver *driver;
static int cpufreq_p4_cpu_init(struct cpufreq_policy *policy)
{
struct cpuinfo_x86 *c = &cpu_data[policy->cpu];
int cpuid = 0;
unsigned int i;
/*
* THERM_CONTROL is architectural for IA32 now, so
* we can rely on the capability checks
*/
/* capability check */
if (c->x86_vendor != X86_VENDOR_INTEL)
return -ENODEV;
if (!test_bit(X86_FEATURE_ACPI, c->x86_capability) ||
!test_bit(X86_FEATURE_ACC, c->x86_capability))
!test_bit(X86_FEATURE_ACC, c->x86_capability))
return -ENODEV;
/* Errata workarounds */
/* Errata workaround */
cpuid = (c->x86 << 8) | (c->x86_model << 4) | c->x86_mask;
switch (cpuid) {
case 0x0f07:
case 0x0f0a:
case 0x0f11:
case 0x0f12:
has_N44_O17_errata = 1;
default:
break;
case 0x0f07:
case 0x0f0a:
case 0x0f11:
case 0x0f12:
has_N44_O17_errata[policy->cpu] = 1;
}
printk(KERN_INFO PFX "P4/Xeon(TM) CPU On-Demand Clock Modulation available\n");
/* get frequency */
if (!stock_freq) {
if (cpu_khz)
stock_freq = cpu_khz;
......@@ -216,71 +209,69 @@ static int __init cpufreq_p4_init(void)
}
}
driver = kmalloc(sizeof(struct cpufreq_driver) +
NR_CPUS * sizeof(struct cpufreq_policy), GFP_KERNEL);
if (!driver)
return -ENOMEM;
memset(driver, 0, sizeof(struct cpufreq_driver) +
NR_CPUS * sizeof(struct cpufreq_policy));
driver->policy = (struct cpufreq_policy *) (driver + 1);
/* table init */
for (i=1; (p4clockmod_table[i].frequency != CPUFREQ_TABLE_END); i++) {
if ((i<2) && (has_N44_O17_errata))
if ((i<2) && (has_N44_O17_errata[policy->cpu]))
p4clockmod_table[i].frequency = CPUFREQ_ENTRY_INVALID;
else
p4clockmod_table[i].frequency = (stock_freq * i)/8;
}
/* cpuinfo and default policy values */
policy->policy = CPUFREQ_POLICY_PERFORMANCE;
policy->cpuinfo.transition_latency = 1000;
#ifdef CONFIG_CPU_FREQ_24_API
for (i=0;i<NR_CPUS;i++) {
driver->cpu_cur_freq[i] = stock_freq;
}
p4clockmod_driver.cpu_cur_freq[policy->cpu] = stock_freq;
#endif
driver->verify = &cpufreq_p4_verify;
driver->setpolicy = &cpufreq_p4_setpolicy;
strncpy(driver->name, "p4-clockmod", CPUFREQ_NAME_LEN);
return cpufreq_frequency_table_cpuinfo(policy, &p4clockmod_table[0]);
}
for (i=0;i<NR_CPUS;i++) {
driver->policy[i].cpu = i;
ret = cpufreq_frequency_table_cpuinfo(&driver->policy[i], &p4clockmod_table[0]);
if (ret) {
kfree(driver);
return ret;
}
driver->policy[i].policy = CPUFREQ_POLICY_PERFORMANCE;
driver->policy[i].cpuinfo.transition_latency = CPUFREQ_ETERNAL;
}
cpufreq_p4_driver = driver;
ret = cpufreq_register(driver);
if (ret) {
cpufreq_p4_driver = NULL;
kfree(driver);
}
static int cpufreq_p4_cpu_exit(struct cpufreq_policy *policy)
{
return cpufreq_p4_setdc(policy->cpu, DC_DISABLE);
}
return ret;
static struct cpufreq_driver p4clockmod_driver = {
.verify = cpufreq_p4_verify,
.target = cpufreq_p4_target,
.init = cpufreq_p4_cpu_init,
.exit = cpufreq_p4_cpu_exit,
.name = "p4-clockmod",
};
static int __init cpufreq_p4_init(void)
{
struct cpuinfo_x86 *c = cpu_data;
/*
* THERM_CONTROL is architectural for IA32 now, so
* we can rely on the capability checks
*/
if (c->x86_vendor != X86_VENDOR_INTEL)
return -ENODEV;
if (!test_bit(X86_FEATURE_ACPI, c->x86_capability) ||
!test_bit(X86_FEATURE_ACC, c->x86_capability))
return -ENODEV;
printk(KERN_INFO PFX "P4/Xeon(TM) CPU On-Demand Clock Modulation available\n");
return cpufreq_register_driver(&p4clockmod_driver);
}
static void __exit cpufreq_p4_exit(void)
{
unsigned int i;
if (cpufreq_p4_driver) {
for (i=0; i<NR_CPUS; i++) {
if (cpu_online(i))
cpufreq_p4_setdc(i, DC_DISABLE);
}
cpufreq_unregister();
kfree(cpufreq_p4_driver);
}
cpufreq_unregister_driver(&p4clockmod_driver);
}
MODULE_PARM(stock_freq, "i");
MODULE_AUTHOR ("Zwane Mwaikambo <zwane@commfireservices.com>");
MODULE_DESCRIPTION ("cpufreq driver for Pentium(TM) 4/Xeon(TM)");
MODULE_LICENSE ("GPL");
......
/*
* $Id: speedstep.c,v 1.58 2002/11/11 15:35:46 db Exp $
* $Id: speedstep.c,v 1.68 2003/01/20 17:31:47 db Exp $
*
* (C) 2001 Dave Jones, Arjan van de ven.
* (C) 2002 Dominik Brodowski <linux@brodo.de>
* (C) 2002 - 2003 Dominik Brodowski <linux@brodo.de>
*
* Licensed under the terms of the GNU GPL License version 2.
* Based upon reverse engineered information, and on Intel documentation
......@@ -30,7 +30,7 @@
#include <asm/msr.h>
static struct cpufreq_driver *speedstep_driver;
static struct cpufreq_driver speedstep_driver;
/* speedstep_chipset:
* It is necessary to know which chipset is used. As accesses to
......@@ -208,7 +208,7 @@ static void speedstep_set_state (unsigned int state, int notify)
pm2_blk &= 0xfe;
outb(pm2_blk, (pmbase + 0x20));
/* check if transition was sucessful */
/* check if transition was successful */
value = inb(pmbase + 0x50);
/* Enable IRQs */
......@@ -217,7 +217,7 @@ static void speedstep_set_state (unsigned int state, int notify)
dprintk(KERN_DEBUG "cpufreq: read at pmbase 0x%x + 0x50 returned 0x%x\n", pmbase, value);
if (state == (value & 0x1)) {
dprintk (KERN_INFO "cpufreq: change to %u MHz succeded\n", (freqs.new / 1000));
dprintk (KERN_INFO "cpufreq: change to %u MHz succeeded\n", (freqs.new / 1000));
} else {
printk (KERN_ERR "cpufreq: change failed - I/O error\n");
}
......@@ -311,7 +311,7 @@ static unsigned int speedstep_detect_chipset (void)
pci_read_config_byte(hostbridge, PCI_REVISION_ID, &rev);
if (rev < 5) {
dprintk(KERN_INFO "cpufreq: hostbrige does not support speedstep\n");
dprintk(KERN_INFO "cpufreq: hostbridge does not support speedstep\n");
speedstep_chipset_dev = NULL;
return 0;
}
......@@ -573,11 +573,13 @@ static int speedstep_detect_speeds (void)
*
* Sets a new CPUFreq policy.
*/
static int speedstep_setpolicy (struct cpufreq_policy *policy)
static int speedstep_target (struct cpufreq_policy *policy,
unsigned int target_freq,
unsigned int relation)
{
unsigned int newstate = 0;
if (cpufreq_frequency_table_setpolicy(policy, &speedstep_freqs[0], &newstate))
if (cpufreq_frequency_table_target(policy, &speedstep_freqs[0], target_freq, relation, &newstate))
return -EINVAL;
speedstep_set_state(newstate, 1);
......@@ -599,6 +601,42 @@ static int speedstep_verify (struct cpufreq_policy *policy)
}
static int speedstep_cpu_init(struct cpufreq_policy *policy)
{
int result = 0;
unsigned int speed;
/* capability check */
if (policy->cpu != 0)
return -ENODEV;
/* detect low and high frequency */
result = speedstep_detect_speeds();
if (result)
return result;
/* get current speed setting */
result = speedstep_get_state(&speed);
if (result)
return result;
speed = (speed == SPEEDSTEP_LOW) ? speedstep_low_freq : speedstep_high_freq;
dprintk(KERN_INFO "cpufreq: currently at %s speed setting - %i MHz\n",
(speed == speedstep_low_freq) ? "low" : "high",
(speed / 1000));
/* cpuinfo and default policy values */
policy->policy = (speed == speedstep_low_freq) ?
CPUFREQ_POLICY_POWERSAVE : CPUFREQ_POLICY_PERFORMANCE;
policy->cpuinfo.transition_latency = CPUFREQ_ETERNAL;
#ifdef CONFIG_CPU_FREQ_24_API
speedstep_driver.cpu_cur_freq[policy->cpu] = speed;
#endif
return cpufreq_frequency_table_cpuinfo(policy, &speedstep_freqs[0]);
}
#ifndef MODULE
/**
* speedstep_setup speedstep command line parameter parsing
......@@ -608,7 +646,7 @@ static int speedstep_verify (struct cpufreq_policy *policy)
* if the CPU in your notebook is a SpeedStep-capable Intel
* Pentium III Coppermine. These processors cannot be detected
* automatically, as Intel continues to consider the detection
* alogrithm as proprietary material.
* algorithm as proprietary material.
*/
static int __init speedstep_setup(char *str)
{
......@@ -618,6 +656,15 @@ static int __init speedstep_setup(char *str)
__setup("speedstep_coppermine=", speedstep_setup);
#endif
static struct cpufreq_driver speedstep_driver = {
.name = "speedstep",
.verify = speedstep_verify,
.target = speedstep_target,
.init = speedstep_cpu_init,
};
/**
* speedstep_init - initializes the SpeedStep CPUFreq driver
*
......@@ -627,11 +674,6 @@ __setup("speedstep_coppermine=", speedstep_setup);
*/
static int __init speedstep_init(void)
{
int result;
unsigned int speed;
struct cpufreq_driver *driver;
/* detect chipset */
speedstep_chipset = speedstep_detect_chipset();
......@@ -644,70 +686,13 @@ static int __init speedstep_init(void)
return -ENODEV;
}
dprintk(KERN_INFO "cpufreq: Intel(R) SpeedStep(TM) support $Revision: 1.58 $\n");
dprintk(KERN_DEBUG "cpufreq: chipset 0x%x - processor 0x%x\n",
speedstep_chipset, speedstep_processor);
dprintk(KERN_INFO "cpufreq: Intel(R) SpeedStep(TM) support $Revision: 1.68 $\n");
/* activate speedstep support */
result = speedstep_activate();
if (result)
return result;
/* detect low and high frequency */
result = speedstep_detect_speeds();
if (result)
return result;
/* get current speed setting */
result = speedstep_get_state(&speed);
if (result)
return result;
speed = (speed == SPEEDSTEP_LOW) ? speedstep_low_freq : speedstep_high_freq;
dprintk(KERN_INFO "cpufreq: currently at %s speed setting - %i MHz\n",
(speed == speedstep_low_freq) ? "low" : "high",
(speed / 1000));
/* initialization of main "cpufreq" code*/
driver = kmalloc(sizeof(struct cpufreq_driver) +
NR_CPUS * sizeof(struct cpufreq_policy), GFP_KERNEL);
if (!driver)
return -ENOMEM;
memset(driver, 0, sizeof(struct cpufreq_driver) +
NR_CPUS * sizeof(struct cpufreq_policy));
driver->policy = (struct cpufreq_policy *) (driver + 1);
driver->policy[0].cpu = 0;
result = cpufreq_frequency_table_cpuinfo(&driver->policy[0], &speedstep_freqs[0]);
if (result) {
kfree(driver);
return result;
}
#ifdef CONFIG_CPU_FREQ_24_API
driver->cpu_cur_freq[0] = speed;
#endif
driver->verify = &speedstep_verify;
driver->setpolicy = &speedstep_setpolicy;
strncpy(driver->name, "speedstep", CPUFREQ_NAME_LEN);
driver->policy[0].cpuinfo.transition_latency = CPUFREQ_ETERNAL;
driver->policy[0].policy = (speed == speedstep_low_freq) ?
CPUFREQ_POLICY_POWERSAVE : CPUFREQ_POLICY_PERFORMANCE;
speedstep_driver = driver;
result = cpufreq_register(driver);
if (result) {
speedstep_driver = NULL;
kfree(driver);
}
if (speedstep_activate())
return -EINVAL;
return result;
return cpufreq_register_driver(&speedstep_driver);
}
......@@ -718,17 +703,15 @@ static int __init speedstep_init(void)
*/
static void __exit speedstep_exit(void)
{
if (speedstep_driver) {
cpufreq_unregister();
kfree(speedstep_driver);
}
cpufreq_unregister_driver(&speedstep_driver);
}
MODULE_PARM (speedstep_coppermine, "i");
MODULE_AUTHOR ("Dave Jones <davej@suse.de>, Dominik Brodowski <linux@brodo.de>");
MODULE_DESCRIPTION ("Speedstep driver for Intel mobile processors.");
MODULE_LICENSE ("GPL");
module_init(speedstep_init);
module_exit(speedstep_exit);
MODULE_PARM (speedstep_coppermine, "i");
......@@ -329,84 +329,46 @@ void close_output_buffer_if_we_run_high(struct moveparams *mv)
void check_cpu(void)
{
int res = 0;
int tmp, flags;
asm volatile( " \n\
movl $3,%%edx # at least 386 \n\
pushfl # push EFLAGS \n\
popl %%eax # get EFLAGS \n\
movl %%eax,%%ecx # save original EFLAGS \n\
xorl $0x40000,%%eax # flip AC bit in EFLAGS \n\
pushl %%eax # copy to EFLAGS \n\
popfl # set EFLAGS \n\
pushfl # get new EFLAGS \n\
popl %%eax # put it in eax \n\
xorl %%ecx,%%eax # change in flags \n\
andl $0x40000,%%eax # check if AC bit changed \n\
je 1f \n\
\n\
movl $4,%%edx # at least 486 \n\
movl %%ecx,%%eax \n\
xorl $0x200000,%%eax # check ID flag \n\
pushl %%eax \n\
popfl # if we are on a straight 486DX, SX, or \n\
pushfl # 487SX we can't change it \n\
popl %%eax \n\
xorl %%ecx,%%eax \n\
pushl %%ecx # restore original EFLAGS \n\
popfl \n\
andl $0x200000,%%eax \n\
je 1f \n\
\n\
/* get vendor info */ \n\
# xorl %%eax,%%eax # call CPUID with 0 -> return vendor ID \n\
# cpuid \n\
# movl $5, %%edx \n\
# cmpl $0x41757468,%%ebx # check thats amd \n\
# jne 1f \n\
\n\
mov $0x80000000,%%eax # Is extended cpuid supported?\n\
cpuid\n\
test $0x80000000,%%eax\n\
movl $5, %%edx \n\
jz 1f\n\
\n\
movl $0x80000001,%%eax \n\
cpuid \n\
andl $0x20000000,%%edx \n\
movl $6, %%edx \n\
jz 1f \n\
\n\
movl $7, %%edx \n\
1:" : "=d" (res) : : "eax", "ebx", "ecx" );
switch (res) {
case 3: puts( "386" );
break;
case 4: puts( "486" );
break;
case 5: puts( "no extended cpuid" );
break;
case 6: puts( "non-64bit 586+" );
break;
case 7: puts( "64bit" );
break;
default:puts( "internal error" );
break;
}
if (res !=7)
error( "Sorry, your CPU is not capable of running 64-bit kernel." );
unsigned before, after, flags;
unsigned a,b,c,d;
int isamd;
/* check if the CPU supports CPUID. This is done by testing if the CPU
supports changing the ID bit (21) in EFLAGS. */
asm("pushfl ; "
"popl %0 ; " /* get EFLAGS */
"movl %0,%1 ; "
"xorl $(1<<21),%0 ; " /* toggle bit 21 */
"pushl %0 ; "
"popfl ; "
"pushfl ; " /* get EFLAGS again */
"popl %0 " : "=r" (after), "=r" (before));
if (before == after)
error("Your CPU doesn't support CPUID.");
/* check if it supports AMD extended cpuid reporting */
asm("cpuid" : "=a" (a), "=b" (b), "=c" (c), "=d" (d) : "0" (0x80000000));
if (a < 0x80000001)
error("Your CPU doesn't support AMD extended CPUIDs.");
/* AuthenticAMD */
isamd = (b == 0x68747541) && (d == 0x69746e65) && (c == 0x444d4163);
/* check required feature flags */
/* see http://www.x86-64.org/lists/discuss/msg02971.html */
#define REQUIRED_MASK1 ((1<<0)|(1<<3)|(1<<4)|(1<<5)|(1<<6)|(1<<8)|(1<<11)| \
(1<<13)|(1<<15)|(1<<24))
asm("cpuid" : "=d" (flags), "=a" (tmp) : "1" (0x80000001) : "ebx", "ecx");
asm("cpuid" : "=d" (flags), "=a" (a) : "1" (0x80000001) : "ebx", "ecx");
flags &= REQUIRED_MASK1;
flags ^= REQUIRED_MASK1;
if (flags & (1<<9)) {
puts("WARNING: non APIC mode for long mode kernel is untested.");
puts("In case of trouble use 32bit kernel or enable APIC.");
}
if (flags & (1<<0))
error("CPU misses x87");
error("CPU misses x87 FPU");
if (flags & (1<<3))
error("CPU doesn't support page size extension (PSE)");
if (flags & (1<<4))
......@@ -425,11 +387,23 @@ void check_cpu(void)
error("CPU doesn't support CMOV");
if (flags & (1<<24))
error("CPU doesn't support FXSAVE/FXRSTOR");
#define REQUIRED_MASK2 ((1<<25)|(1<<26))
asm("cpuid" : "=d" (flags), "=a" (tmp) : "1" (1) : "ebx", "ecx");
flags &= REQUIRED_MASK2;
flags ^= REQUIRED_MASK2;
if (flags & (1<<29))
error("CPU doesn't support long mode");
#define SSE_MASK ((1<<25)|(1<<26))
asm("cpuid" : "=d" (flags), "=a" (a) : "1" (1) : "ebx", "ecx");
if ((flags & SSE_MASK) != SSE_MASK && isamd) {
/* Only try this on AMD CPUs. */
/* Enable SSE in HWCFG MSR */
asm volatile("rdmsr" : "=d" (d), "=a" (flags) : "c" (0xc0010015));
flags &= ~(1<<15);
asm volatile("wrmsr" :: "d" (d), "a" (flags), "c" (0xc0010015));
}
/* Try again */
asm("cpuid" : "=d" (flags), "=a" (a) : "1" (1) : "ebx", "ecx");
flags &= SSE_MASK;
flags ^= SSE_MASK;
if (flags & (1<<25))
error("CPU doesn't support SSE1");
if (flags & (1<<26))
......
......@@ -51,13 +51,14 @@
#include <asm/errno.h>
#define __vsyscall(nr) __attribute__ ((unused,__section__(".vsyscall_" #nr)))
#define force_inline __attribute__((always_inline)) inline
int __sysctl_vsyscall __section_sysctl_vsyscall = 1;
seqlock_t __xtime_lock __section_xtime_lock = SEQLOCK_UNLOCKED;
#include <asm/unistd.h>
static inline void timeval_normalize(struct timeval * tv)
static force_inline void timeval_normalize(struct timeval * tv)
{
time_t __sec;
......@@ -69,7 +70,7 @@ static inline void timeval_normalize(struct timeval * tv)
}
}
static inline void do_vgettimeofday(struct timeval * tv)
static force_inline void do_vgettimeofday(struct timeval * tv)
{
long sequence, t;
unsigned long sec, usec;
......@@ -91,12 +92,12 @@ static inline void do_vgettimeofday(struct timeval * tv)
}
/* RED-PEN may want to readd seq locking, but then the variable should be write-once. */
static inline void do_get_tz(struct timezone * tz)
static force_inline void do_get_tz(struct timezone * tz)
{
*tz = __sys_tz;
}
static inline int gettimeofday(struct timeval *tv, struct timezone *tz)
static force_inline int gettimeofday(struct timeval *tv, struct timezone *tz)
{
int ret;
asm volatile("syscall"
......
......@@ -75,13 +75,6 @@ static int pc_debug = PCMCIA_DEBUG;
#define FIND_FIRST_BIT(n) ((n) - ((n) & ((n)-1)))
#define pci_readb pci_read_config_byte
#define pci_writeb pci_write_config_byte
#define pci_readw pci_read_config_word
#define pci_writew pci_write_config_word
#define pci_readl pci_read_config_dword
#define pci_writel pci_write_config_dword
/* Offsets in the Expansion ROM Image Header */
#define ROM_SIGNATURE 0x0000 /* 2 bytes */
#define ROM_DATA_PTR 0x0018 /* 2 bytes */
......@@ -146,7 +139,7 @@ void cb_release_cis_mem(socket_info_t * s)
}
}
static int cb_setup_cis_mem(socket_info_t * s, struct pci_dev *dev, struct resource *res)
static int cb_setup_cis_mem(socket_info_t * s, struct resource *res)
{
unsigned int start, size;
......@@ -175,8 +168,7 @@ static int cb_setup_cis_mem(socket_info_t * s, struct pci_dev *dev, struct resou
=====================================================================*/
int read_cb_mem(socket_info_t * s, u_char fn, int space,
u_int addr, u_int len, void *ptr)
int read_cb_mem(socket_info_t * s, int space, u_int addr, u_int len, void *ptr)
{
struct pci_dev *dev;
struct resource *res;
......@@ -186,14 +178,14 @@ int read_cb_mem(socket_info_t * s, u_char fn, int space,
if (!s->cb_config)
goto fail;
dev = &s->cb_config[fn].dev;
dev = &s->cb_config[0].dev;
/* Config space? */
if (space == 0) {
if (addr + len > 0x100)
goto fail;
for (; len; addr++, ptr++, len--)
pci_readb(dev, addr, (u_char *) ptr);
pci_read_config_byte(dev, addr, ptr);
return 0;
}
......@@ -201,7 +193,7 @@ int read_cb_mem(socket_info_t * s, u_char fn, int space,
if (!res->flags)
goto fail;
if (cb_setup_cis_mem(s, dev, res) != 0)
if (cb_setup_cis_mem(s, res) != 0)
goto fail;
if (space == 7) {
......@@ -232,29 +224,24 @@ int read_cb_mem(socket_info_t * s, u_char fn, int space,
int cb_alloc(socket_info_t * s)
{
struct pci_bus *bus;
struct pci_dev tmp;
u_short vend, v, dev;
u_char i, hdr, fn;
cb_config_t *c;
int irq;
bus = s->cap.cb_dev->subordinate;
memset(&tmp, 0, sizeof(tmp));
tmp.bus = bus;
tmp.sysdata = bus->sysdata;
tmp.devfn = 0;
pci_readw(&tmp, PCI_VENDOR_ID, &vend);
pci_readw(&tmp, PCI_DEVICE_ID, &dev);
pci_bus_read_config_word(bus, 0, PCI_VENDOR_ID, &vend);
pci_bus_read_config_word(bus, 0, PCI_DEVICE_ID, &dev);
printk(KERN_INFO "cs: cb_alloc(bus %d): vendor 0x%04x, "
"device 0x%04x\n", bus->number, vend, dev);
pci_readb(&tmp, PCI_HEADER_TYPE, &hdr);
pci_bus_read_config_byte(bus, 0, PCI_HEADER_TYPE, &hdr);
fn = 1;
if (hdr & 0x80) {
do {
tmp.devfn = fn;
if (pci_readw(&tmp, PCI_VENDOR_ID, &v) || !v || v == 0xffff)
if (pci_bus_read_config_word(bus, fn, PCI_VENDOR_ID, &v) ||
!v || v == 0xffff)
break;
fn++;
} while (fn < 8);
......@@ -276,10 +263,10 @@ int cb_alloc(socket_info_t * s)
dev->sysdata = bus->sysdata;
dev->dev.parent = bus->dev;
dev->dev.bus = &pci_bus_type;
dev->devfn = i;
dev->vendor = vend;
pci_readw(dev, PCI_DEVICE_ID, &dev->device);
pci_read_config_word(dev, PCI_VENDOR_ID, &dev->vendor);
pci_read_config_word(dev, PCI_DEVICE_ID, &dev->device);
dev->hdr_type = hdr & 0x7f;
dev->dma_mask = 0xffffffff;
dev->dev.dma_mask = &dev->dma_mask;
......@@ -296,7 +283,7 @@ int cb_alloc(socket_info_t * s)
}
/* Does this function have an interrupt at all? */
pci_readb(dev, PCI_INTERRUPT_PIN, &irq_pin);
pci_read_config_byte(dev, PCI_INTERRUPT_PIN, &irq_pin);
if (irq_pin)
dev->irq = irq;
......@@ -306,7 +293,7 @@ int cb_alloc(socket_info_t * s)
continue;
if (irq_pin)
pci_writeb(dev, PCI_INTERRUPT_LINE, irq);
pci_write_config_byte(dev, PCI_INTERRUPT_LINE, irq);
device_register(&dev->dev);
pci_insert_device(dev, bus);
......@@ -333,38 +320,6 @@ void cb_free(socket_info_t * s)
}
}
/*=====================================================================
cb_config() has the job of allocating all system resources that
a Cardbus card requires. Rather than using the CIS (which seems
to not always be present), it treats the card as an ordinary PCI
device, and probes the base address registers to determine each
function's IO and memory space needs.
It is called from the RequestIO card service.
======================================================================*/
int cb_config(socket_info_t * s)
{
return CS_SUCCESS;
}
/*======================================================================
cb_release() releases all the system resources (IO and memory
space, and interrupt) committed for a Cardbus card by a prior call
to cb_config().
It is called from the ReleaseIO() service.
======================================================================*/
void cb_release(socket_info_t * s)
{
DEBUG(0, "cs: cb_release(bus %d)\n", s->cap.cb_dev->subordinate->number);
}
/*=====================================================================
cb_enable() has the job of configuring a socket for a Cardbus
......@@ -393,15 +348,17 @@ void cb_enable(socket_info_t * s)
/* Set up PCI interrupt and command registers */
for (i = 0; i < s->functions; i++) {
dev = &s->cb_config[i].dev;
pci_writeb(dev, PCI_COMMAND, PCI_COMMAND_MASTER |
PCI_COMMAND_IO | PCI_COMMAND_MEMORY);
pci_writeb(dev, PCI_CACHE_LINE_SIZE, L1_CACHE_BYTES / 4);
pci_write_config_byte(dev, PCI_COMMAND, PCI_COMMAND_MASTER |
PCI_COMMAND_IO | PCI_COMMAND_MEMORY);
pci_write_config_byte(dev, PCI_CACHE_LINE_SIZE,
L1_CACHE_BYTES / 4);
}
if (s->irq.AssignedIRQ) {
for (i = 0; i < s->functions; i++) {
dev = &s->cb_config[i].dev;
pci_writeb(dev, PCI_INTERRUPT_LINE, s->irq.AssignedIRQ);
pci_write_config_byte(dev, PCI_INTERRUPT_LINE,
s->irq.AssignedIRQ);
}
s->socket.io_irq = s->irq.AssignedIRQ;
s->ss_entry->set_socket(s->sock, &s->socket);
......
......@@ -327,7 +327,7 @@ static void read_cis_cache(socket_info_t *s, int attr, u_int addr,
}
#ifdef CONFIG_CARDBUS
if (s->state & SOCKET_CARDBUS)
ret = read_cb_mem(s, 0, attr, addr, len, ptr);
ret = read_cb_mem(s, attr, addr, len, ptr);
else
#endif
ret = read_cis_mem(s, attr, addr, len, ptr);
......@@ -358,7 +358,7 @@ int verify_cis_cache(socket_info_t *s)
for (i = 0; i < s->cis_used; i++) {
#ifdef CONFIG_CARDBUS
if (s->state & SOCKET_CARDBUS)
read_cb_mem(s, 0, s->cis_table[i].attr, s->cis_table[i].addr,
read_cb_mem(s, s->cis_table[i].attr, s->cis_table[i].addr,
s->cis_table[i].len, buf);
else
#endif
......
......@@ -337,13 +337,14 @@ int pcmcia_register_socket(struct device *dev)
return -ENOMEM;
memset(s_info, 0, cls_d->nsock * sizeof(socket_info_t));
cls_d->s_info = s_info;
/* socket initialization */
for (i = 0; i < cls_d->nsock; i++) {
socket_info_t *s = &s_info[i];
cls_d->s_info[i] = s;
s->ss_entry = cls_d->ops;
s->sock = i;
s->sock = i + cls_d->sock_offset;
/* base address = 0, map = 0 */
s->cis_mem.flags = 0;
......@@ -359,7 +360,7 @@ int pcmcia_register_socket(struct device *dev)
if (j == sockets) sockets++;
init_socket(s);
s->ss_entry->inquire_socket(i, &s->cap);
s->ss_entry->inquire_socket(s->sock, &s->cap);
#ifdef CONFIG_PROC_FS
if (proc_pccard) {
char name[3];
......@@ -1569,7 +1570,6 @@ int pcmcia_release_io(client_handle_t handle, io_req_t *req)
#ifdef CONFIG_CARDBUS
if (handle->state & CLIENT_CARDBUS) {
cb_release(s);
return CS_SUCCESS;
}
#endif
......@@ -1811,10 +1811,8 @@ int pcmcia_request_io(client_handle_t handle, io_req_t *req)
if (handle->state & CLIENT_CARDBUS) {
#ifdef CONFIG_CARDBUS
int ret = cb_config(s);
if (ret == CS_SUCCESS)
handle->state |= CLIENT_IO_REQ;
return ret;
handle->state |= CLIENT_IO_REQ;
return CS_SUCCESS;
#else
return CS_UNSUPPORTED_FUNCTION;
#endif
......
......@@ -198,12 +198,9 @@ typedef struct socket_info_t {
/* In cardbus.c */
int cb_alloc(socket_info_t *s);
void cb_free(socket_info_t *s);
int cb_config(socket_info_t *s);
void cb_release(socket_info_t *s);
void cb_enable(socket_info_t *s);
void cb_disable(socket_info_t *s);
int read_cb_mem(socket_info_t *s, u_char fn, int space,
u_int addr, u_int len, void *ptr);
int read_cb_mem(socket_info_t *s, int space, u_int addr, u_int len, void *ptr);
void cb_release_cis_mem(socket_info_t *s);
/* In cistpl.c */
......
......@@ -171,6 +171,16 @@ static int __devinit add_pci_socket(int nr, struct pci_dev *dev, struct pci_sock
int err;
memset(socket, 0, sizeof(*socket));
/* prepare class_data */
socket->cls_d.sock_offset = nr;
socket->cls_d.nsock = 1; /* yenta is 1, no other low-level driver uses
this yet */
socket->cls_d.ops = &pci_socket_operations;
socket->cls_d.use_bus_pm = 1;
dev->dev.class_data = &socket->cls_d;
/* prepare pci_socket_t */
socket->dev = dev;
socket->op = ops;
pci_set_drvdata(dev, socket);
......@@ -186,18 +196,6 @@ static int __devinit add_pci_socket(int nr, struct pci_dev *dev, struct pci_sock
int cardbus_register(struct pci_dev *p_dev)
{
pci_socket_t *socket = pci_get_drvdata(p_dev);
struct pcmcia_socket_class_data *cls_d;
if (!socket)
return -EINVAL;
cls_d = &socket->cls_d;
cls_d->nsock = 1; /* yenta is 1, no other low-level driver uses
this yet */
cls_d->ops = &pci_socket_operations;
cls_d->use_bus_pm = 1;
p_dev->dev.class_data = cls_d;
return 0;
}
......@@ -227,14 +225,16 @@ static void __devexit cardbus_remove (struct pci_dev *dev)
static int cardbus_suspend (struct pci_dev *dev, u32 state)
{
pci_socket_t *socket = pci_get_drvdata(dev);
pcmcia_suspend_socket (socket->pcmcia_socket);
if (socket && socket->cls_d.s_info)
pcmcia_suspend_socket (socket->cls_d.s_info);
return 0;
}
static int cardbus_resume (struct pci_dev *dev)
{
pci_socket_t *socket = pci_get_drvdata(dev);
pcmcia_resume_socket (socket->pcmcia_socket);
if (socket && socket->cls_d.s_info)
pcmcia_resume_socket (socket->cls_d.s_info);
return 0;
}
......
......@@ -20,7 +20,6 @@ typedef struct pci_socket {
socket_cap_t cap;
spinlock_t event_lock;
unsigned int events;
struct socket_info_t *pcmcia_socket;
struct work_struct tq_task;
struct timer_list poll_timer;
......
......@@ -47,7 +47,7 @@
__kir; })
# define __kernel_cmpbge(a, b) \
({ unsigned long __kir; \
__asm__("cmpbge %r2,%1,%0" : "=r"(__kir) : "rI"(b), "rJ"(val)); \
__asm__("cmpbge %r2,%1,%0" : "=r"(__kir) : "rI"(b), "rJ"(a)); \
__kir; })
# define __kernel_cttz(x) \
({ unsigned long __kir; \
......
......@@ -131,17 +131,14 @@ struct el_common_EV6_mcheck {
extern void halt(void) __attribute__((noreturn));
#define __halt() __asm__ __volatile__ ("call_pal %0 #halt" : : "i" (PAL_halt))
#define prepare_arch_schedule(prev) do { } while(0)
#define finish_arch_schedule(prev) do { } while(0)
#define switch_to(prev,next,last) \
do { \
alpha_switch_to(virt_to_phys(&(next)->thread_info->pcb), (prev)); \
check_mmu_context(); \
} while (0)
#define switch_to(P,N,L) \
do { \
(L) = alpha_switch_to(virt_to_phys(&(N)->thread_info->pcb), (P)); \
check_mmu_context(); \
} while (0)
struct task_struct;
extern void alpha_switch_to(unsigned long, struct task_struct*);
extern struct task_struct *alpha_switch_to(unsigned long, struct task_struct*);
#define mb() \
__asm__ __volatile__("mb": : :"memory")
......
......@@ -35,11 +35,15 @@ struct mtrr_sentry
unsigned int type; /* Type of region */
};
/* Warning: this structure has a different order from i386
on x86-64. The 32bit emulation code takes care of that.
But you need to use this for 64bit, otherwise your X server
will break. */
struct mtrr_gentry
{
unsigned long base; /* Base address */
unsigned int regnum; /* Register number */
unsigned int size; /* Size of region */
unsigned int regnum; /* Register number */
unsigned int type; /* Type of region */
};
......
......@@ -145,12 +145,12 @@ struct pccard_operations {
* Calls to set up low-level "Socket Services" drivers
*/
#define MAX_SOCKETS_PER_DEV 8
struct pcmcia_socket_class_data {
unsigned int nsock; /* number of sockets */
unsigned int sock_offset; /* socket # (which is
* returned to driver) = sock_offset + (0, 1, .. , (nsock-1) */
struct pccard_operations *ops; /* see above */
void *s_info[MAX_SOCKETS_PER_DEV]; /* socket_info_t */
void *s_info; /* socket_info_t */
unsigned int use_bus_pm;
};
......
......@@ -152,6 +152,14 @@ static int ____call_usermodehelper(void *data)
struct subprocess_info *sub_info = data;
int retval;
/* Unblock all signals. */
flush_signals(current);
spin_lock_irq(&current->sighand->siglock);
flush_signal_handlers(current);
sigemptyset(&current->blocked);
recalc_sigpending();
spin_unlock_irq(&current->sighand->siglock);
retval = -EPERM;
if (current->fs->root)
retval = execve(sub_info->path, sub_info->argv,sub_info->envp);
......
......@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <linux/init.h>
#include <linux/module.h>
#include <linux/spinlock.h>
#include <linux/mm.h>
......
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