Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 144121
b: refs/heads/master
c: 1fe94d3
h: refs/heads/master
i:
  144119: 59083e1
v: v3
  • Loading branch information
Len Brown committed Apr 24, 2009
1 parent 8500716 commit d322ae2
Show file tree
Hide file tree
Showing 17 changed files with 198 additions and 150 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: b7f0ab460f772b09a9c664d746236a280fec714c
refs/heads/master: 1fe94d37f9296e8884c2f4ca4e22ca3d1398f15c
8 changes: 6 additions & 2 deletions trunk/Documentation/ABI/testing/sysfs-firmware-acpi
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,13 @@ Description:
gpe1F: 0 invalid
gpe_all: 1192
sci: 1194
sci_not: 0

sci - The total number of times the ACPI SCI
has claimed an interrupt.
sci - The number of times the ACPI SCI
has been called and claimed an interrupt.

sci_not - The number of times the ACPI SCI
has been called and NOT claimed an interrupt.

gpe_all - count of SCI caused by GPEs.

Expand Down
4 changes: 2 additions & 2 deletions trunk/Documentation/laptops/thinkpad-acpi.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
ThinkPad ACPI Extras Driver

Version 0.22
November 23rd, 2008
Version 0.23
April 10th, 2009

Borislav Deianov <borislav@users.sf.net>
Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Expand Down
30 changes: 16 additions & 14 deletions trunk/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,18 @@ enum {
struct acpi_cpufreq_data {
struct acpi_processor_performance *acpi_data;
struct cpufreq_frequency_table *freq_table;
unsigned int max_freq;
unsigned int resume;
unsigned int cpu_feature;
u64 saved_aperf, saved_mperf;
};

static DEFINE_PER_CPU(struct acpi_cpufreq_data *, drv_data);

struct acpi_msr_data {
u64 saved_aperf, saved_mperf;
};

static DEFINE_PER_CPU(struct acpi_msr_data, msr_data);

DEFINE_TRACE(power_mark);

/* acpi_perf_data is a pointer to percpu data. */
Expand Down Expand Up @@ -287,11 +291,11 @@ static unsigned int get_measured_perf(struct cpufreq_policy *policy,
return 0;

cur.aperf.whole = readin.aperf.whole -
per_cpu(drv_data, cpu)->saved_aperf;
per_cpu(msr_data, cpu).saved_aperf;
cur.mperf.whole = readin.mperf.whole -
per_cpu(drv_data, cpu)->saved_mperf;
per_cpu(drv_data, cpu)->saved_aperf = readin.aperf.whole;
per_cpu(drv_data, cpu)->saved_mperf = readin.mperf.whole;
per_cpu(msr_data, cpu).saved_mperf;
per_cpu(msr_data, cpu).saved_aperf = readin.aperf.whole;
per_cpu(msr_data, cpu).saved_mperf = readin.mperf.whole;

#ifdef __i386__
/*
Expand Down Expand Up @@ -335,7 +339,7 @@ static unsigned int get_measured_perf(struct cpufreq_policy *policy,

#endif

retval = per_cpu(drv_data, policy->cpu)->max_freq * perf_percent / 100;
retval = (policy->cpuinfo.max_freq * perf_percent) / 100;

return retval;
}
Expand Down Expand Up @@ -688,16 +692,11 @@ static int acpi_cpufreq_cpu_init(struct cpufreq_policy *policy)
/* Check for high latency (>20uS) from buggy BIOSes, like on T42 */
if (perf->control_register.space_id == ACPI_ADR_SPACE_FIXED_HARDWARE &&
policy->cpuinfo.transition_latency > 20 * 1000) {
static int print_once;
policy->cpuinfo.transition_latency = 20 * 1000;
if (!print_once) {
print_once = 1;
printk(KERN_INFO "Capping off P-state tranision latency"
" at 20 uS\n");
}
printk_once(KERN_INFO "Capping off P-state tranision"
" latency at 20 uS\n");
}

data->max_freq = perf->states[0].core_frequency * 1000;
/* table init */
for (i = 0; i < perf->state_count; i++) {
if (i > 0 && perf->states[i].core_frequency >=
Expand All @@ -716,6 +715,9 @@ static int acpi_cpufreq_cpu_init(struct cpufreq_policy *policy)
if (result)
goto err_freqfree;

if (perf->states[0].core_frequency * 1000 != policy->cpuinfo.max_freq)
printk(KERN_WARNING FW_WARN "P-state 0 is not max freq\n");

switch (perf->control_register.space_id) {
case ACPI_ADR_SPACE_SYSTEM_IO:
/* Current speed is unknown and not detectable by IO port */
Expand Down
43 changes: 26 additions & 17 deletions trunk/drivers/acpi/acpica/hwsleep.c
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,12 @@ acpi_status acpi_enter_sleep_state_prep(u8 sleep_state)

ACPI_EXPORT_SYMBOL(acpi_enter_sleep_state_prep)

static unsigned int gts, bfs;
module_param(gts, uint, 0644);
module_param(bfs, uint, 0644);
MODULE_PARM_DESC(gts, "Enable evaluation of _GTS on suspend.");
MODULE_PARM_DESC(bfs, "Enable evaluation of _BFS on resume".);

/*******************************************************************************
*
* FUNCTION: acpi_enter_sleep_state
Expand Down Expand Up @@ -278,16 +284,18 @@ acpi_status asmlinkage acpi_enter_sleep_state(u8 sleep_state)
return_ACPI_STATUS(status);
}

/* Execute the _GTS method */
if (gts) {
/* Execute the _GTS method */

arg_list.count = 1;
arg_list.pointer = &arg;
arg.type = ACPI_TYPE_INTEGER;
arg.integer.value = sleep_state;
arg_list.count = 1;
arg_list.pointer = &arg;
arg.type = ACPI_TYPE_INTEGER;
arg.integer.value = sleep_state;

status = acpi_evaluate_object(NULL, METHOD_NAME__GTS, &arg_list, NULL);
if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) {
return_ACPI_STATUS(status);
status = acpi_evaluate_object(NULL, METHOD_NAME__GTS, &arg_list, NULL);
if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) {
return_ACPI_STATUS(status);
}
}

/* Get current value of PM1A control */
Expand Down Expand Up @@ -513,18 +521,19 @@ acpi_status acpi_leave_sleep_state_prep(u8 sleep_state)
}
}

/* Execute the _BFS method */
if (bfs) {
/* Execute the _BFS method */

arg_list.count = 1;
arg_list.pointer = &arg;
arg.type = ACPI_TYPE_INTEGER;
arg.integer.value = sleep_state;
arg_list.count = 1;
arg_list.pointer = &arg;
arg.type = ACPI_TYPE_INTEGER;
arg.integer.value = sleep_state;

status = acpi_evaluate_object(NULL, METHOD_NAME__BFS, &arg_list, NULL);
if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) {
ACPI_EXCEPTION((AE_INFO, status, "During Method _BFS"));
status = acpi_evaluate_object(NULL, METHOD_NAME__BFS, &arg_list, NULL);
if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) {
ACPI_EXCEPTION((AE_INFO, status, "During Method _BFS"));
}
}

return_ACPI_STATUS(status);
}

Expand Down
27 changes: 2 additions & 25 deletions trunk/drivers/acpi/acpica/rscreate.c
Original file line number Diff line number Diff line change
Expand Up @@ -191,8 +191,6 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object,
user_prt = ACPI_CAST_PTR(struct acpi_pci_routing_table, buffer);

for (index = 0; index < number_of_elements; index++) {
int source_name_index = 2;
int source_index_index = 3;

/*
* Point user_prt past this current structure
Expand Down Expand Up @@ -261,27 +259,6 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object,
return_ACPI_STATUS(AE_BAD_DATA);
}

/*
* If BIOS erroneously reversed the _PRT source_name and source_index,
* then reverse them back.
*/
if ((sub_object_list[3])->common.type !=
ACPI_TYPE_INTEGER) {
if (acpi_gbl_enable_interpreter_slack) {
source_name_index = 3;
source_index_index = 2;
printk(KERN_WARNING
"ACPI: Handling Garbled _PRT entry\n");
} else {
ACPI_ERROR((AE_INFO,
"(PRT[%X].source_index) Need Integer, found %s",
index,
acpi_ut_get_object_type_name
(sub_object_list[3])));
return_ACPI_STATUS(AE_BAD_DATA);
}
}

user_prt->pin = (u32) obj_desc->integer.value;

/*
Expand All @@ -304,7 +281,7 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object,
* 3) Third subobject: Dereference the PRT.source_name
* The name may be unresolved (slack mode), so allow a null object
*/
obj_desc = sub_object_list[source_name_index];
obj_desc = sub_object_list[2];
if (obj_desc) {
switch (obj_desc->common.type) {
case ACPI_TYPE_LOCAL_REFERENCE:
Expand Down Expand Up @@ -378,7 +355,7 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object,

/* 4) Fourth subobject: Dereference the PRT.source_index */

obj_desc = sub_object_list[source_index_index];
obj_desc = sub_object_list[3];
if (obj_desc->common.type != ACPI_TYPE_INTEGER) {
ACPI_ERROR((AE_INFO,
"(PRT[%X].SourceIndex) Need Integer, found %s",
Expand Down
1 change: 1 addition & 0 deletions trunk/drivers/acpi/ec.c
Original file line number Diff line number Diff line change
Expand Up @@ -1065,6 +1065,7 @@ static int acpi_ec_resume(struct acpi_device *device)
struct acpi_ec *ec = acpi_driver_data(device);
/* Enable use of GPE back */
clear_bit(EC_FLAGS_NO_GPE, &ec->flags);
set_bit(EC_FLAGS_GPE_MODE, &ec->flags);
acpi_enable_gpe(NULL, ec->gpe);
return 0;
}
Expand Down
4 changes: 3 additions & 1 deletion trunk/drivers/acpi/osl.c
Original file line number Diff line number Diff line change
Expand Up @@ -353,8 +353,10 @@ static irqreturn_t acpi_irq(int irq, void *dev_id)
if (handled) {
acpi_irq_handled++;
return IRQ_HANDLED;
} else
} else {
acpi_irq_not_handled++;
return IRQ_NONE;
}
}

acpi_status
Expand Down
28 changes: 12 additions & 16 deletions trunk/drivers/acpi/processor_idle.c
Original file line number Diff line number Diff line change
Expand Up @@ -581,6 +581,11 @@ static int acpi_processor_power_verify(struct acpi_processor *pr)
for (i = 1; i < ACPI_PROCESSOR_MAX_POWER; i++) {
struct acpi_processor_cx *cx = &pr->power.states[i];

#if defined (CONFIG_GENERIC_TIME) && defined (CONFIG_X86)
/* TSC could halt in idle, so notify users */
if (tsc_halts_in_c(cx->type))
mark_tsc_unstable("TSC halts in idle");;
#endif
switch (cx->type) {
case ACPI_STATE_C1:
cx->valid = 1;
Expand Down Expand Up @@ -657,11 +662,9 @@ static int acpi_processor_power_seq_show(struct seq_file *seq, void *offset)

seq_printf(seq, "active state: C%zd\n"
"max_cstate: C%d\n"
"bus master activity: %08x\n"
"maximum allowed latency: %d usec\n",
pr->power.state ? pr->power.state - pr->power.states : 0,
max_cstate, (unsigned)pr->power.bm_activity,
pm_qos_requirement(PM_QOS_CPU_DMA_LATENCY));
max_cstate, pm_qos_requirement(PM_QOS_CPU_DMA_LATENCY));

seq_puts(seq, "states:\n");

Expand Down Expand Up @@ -871,11 +874,6 @@ static int acpi_idle_enter_simple(struct cpuidle_device *dev,
kt2 = ktime_get_real();
idle_time = ktime_to_us(ktime_sub(kt2, kt1));

#if defined (CONFIG_GENERIC_TIME) && defined (CONFIG_X86)
/* TSC could halt in idle, so notify users */
if (tsc_halts_in_c(cx->type))
mark_tsc_unstable("TSC halts in idle");;
#endif
sleep_ticks = us_to_pm_timer_ticks(idle_time);

/* Tell the scheduler how much we idled: */
Expand Down Expand Up @@ -955,6 +953,7 @@ static int acpi_idle_enter_bm(struct cpuidle_device *dev,
*/
acpi_state_timer_broadcast(pr, cx, 1);

kt1 = ktime_get_real();
/*
* disable bus master
* bm_check implies we need ARB_DIS
Expand All @@ -976,10 +975,7 @@ static int acpi_idle_enter_bm(struct cpuidle_device *dev,
ACPI_FLUSH_CPU_CACHE();
}

kt1 = ktime_get_real();
acpi_idle_do_entry(cx);
kt2 = ktime_get_real();
idle_time = ktime_to_us(ktime_sub(kt2, kt1));

/* Re-enable bus master arbitration */
if (pr->flags.bm_check && pr->flags.bm_control) {
Expand All @@ -988,12 +984,9 @@ static int acpi_idle_enter_bm(struct cpuidle_device *dev,
c3_cpu_count--;
spin_unlock(&c3_lock);
}
kt2 = ktime_get_real();
idle_time = ktime_to_us(ktime_sub(kt2, kt1));

#if defined (CONFIG_GENERIC_TIME) && defined (CONFIG_X86)
/* TSC could halt in idle, so notify users */
if (tsc_halts_in_c(ACPI_STATE_C3))
mark_tsc_unstable("TSC halts in idle");
#endif
sleep_ticks = us_to_pm_timer_ticks(idle_time);
/* Tell the scheduler how much we idled: */
sched_clock_idle_wakeup_event(sleep_ticks*PM_TIMER_TICK_NS);
Expand Down Expand Up @@ -1037,6 +1030,9 @@ static int acpi_processor_setup_cpuidle(struct acpi_processor *pr)
dev->states[i].desc[0] = '\0';
}

if (max_cstate == 0)
max_cstate = 1;

for (i = 1; i < ACPI_PROCESSOR_MAX_POWER && i <= max_cstate; i++) {
cx = &pr->power.states[i];
state = &dev->states[count];
Expand Down
27 changes: 27 additions & 0 deletions trunk/drivers/acpi/sleep.c
Original file line number Diff line number Diff line change
Expand Up @@ -713,6 +713,32 @@ static void acpi_power_off(void)
acpi_enter_sleep_state(ACPI_STATE_S5);
}

/*
* ACPI 2.0 created the optional _GTS and _BFS,
* but industry adoption has been neither rapid nor broad.
*
* Linux gets into trouble when it executes poorly validated
* paths through the BIOS, so disable _GTS and _BFS by default,
* but do speak up and offer the option to enable them.
*/
void __init acpi_gts_bfs_check(void)
{
acpi_handle dummy;

if (ACPI_SUCCESS(acpi_get_handle(ACPI_ROOT_OBJECT, METHOD_NAME__GTS, &dummy)))
{
printk(KERN_NOTICE PREFIX "BIOS offers _GTS\n");
printk(KERN_NOTICE PREFIX "If \"acpi.gts=1\" improves suspend, "
"please notify linux-acpi@vger.kernel.org\n");
}
if (ACPI_SUCCESS(acpi_get_handle(ACPI_ROOT_OBJECT, METHOD_NAME__BFS, &dummy)))
{
printk(KERN_NOTICE PREFIX "BIOS offers _BFS\n");
printk(KERN_NOTICE PREFIX "If \"acpi.bfs=1\" improves resume, "
"please notify linux-acpi@vger.kernel.org\n");
}
}

int __init acpi_sleep_init(void)
{
acpi_status status;
Expand Down Expand Up @@ -771,5 +797,6 @@ int __init acpi_sleep_init(void)
* object can also be evaluated when the system enters S5.
*/
register_reboot_notifier(&tts_notifier);
acpi_gts_bfs_check();
return 0;
}
Loading

0 comments on commit d322ae2

Please sign in to comment.