Skip to content

Commit

Permalink
Merge branch 'release' of git://git.kernel.org/pub/scm/linux/kernel/g…
Browse files Browse the repository at this point in the history
…it/lenb/linux-acpi-2.6

* 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux-acpi-2.6: (34 commits)
  ACPI, i915: Register ACPI video even when not modesetting
  Revert "ACPICA: delete check for AML access to port 0x81-83"
  I/O port protection: update for windows compatibility.
  sony-laptop: always try to unblock rfkill on load
  sony-laptop: fix bogus error message display on resume
  ACPI: EC: Fix ACPI EC resume non-query interrupt message
  sony-laptop: SNC input event 38 fix
  sony-laptop: SNC 127 Initialization Fix
  sony-laptop: Duplicate SNC 127 Event Fix
  ACPI: prevent processor.max_cstate=0 boot crash
  ACPI/hpet: prevent boot hang when hpet=force used on ICH-4M
  ACPI: delete obsolete "bus master activity" proc field
  ACPI: idle: mark_tsc_unstable() at init-time, not run-time
  ACPI: add /sys/firmware/acpi/interrupts/sci_not counter
  ACPI video: fix an error when the brightness levels on AC and on Battery are same
  acpi-cpufreq: Do not let get_measured perf depend on internal variable
  acpi-cpufreq: style-only: add parens to math expression
  acpi-cpufreq: Cleanup: Use printk_once
  x86, acpi_cpufreq: Fix the NULL pointer dereference in get_measured_perf
  thinkpad-acpi: bump up version to 0.23
  ...
  • Loading branch information
Linus Torvalds committed Apr 24, 2009
2 parents 9fe9293 + 1162cf6 commit ef54b1b
Show file tree
Hide file tree
Showing 19 changed files with 318 additions and 263 deletions.
8 changes: 6 additions & 2 deletions 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 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 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 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
86 changes: 72 additions & 14 deletions drivers/acpi/acpica/hwvalid.c
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ static const struct acpi_port_info acpi_protected_ports[] = {
{"PIT2", 0x0048, 0x004B, ACPI_OSI_WIN_XP},
{"RTC", 0x0070, 0x0071, ACPI_OSI_WIN_XP},
{"CMOS", 0x0074, 0x0076, ACPI_OSI_WIN_XP},
{"DMA1", 0x0081, 0x0083, ACPI_OSI_WIN_XP},
{"DMA1L", 0x0087, 0x0087, ACPI_OSI_WIN_XP},
{"DMA2", 0x0089, 0x008B, ACPI_OSI_WIN_XP},
{"DMA2L", 0x008F, 0x008F, ACPI_OSI_WIN_XP},
Expand Down Expand Up @@ -151,7 +152,7 @@ acpi_hw_validate_io_request(acpi_io_address address, u32 bit_width)
ACPI_ERROR((AE_INFO,
"Illegal I/O port address/length above 64K: 0x%p/%X",
ACPI_CAST_PTR(void, address), byte_width));
return_ACPI_STATUS(AE_AML_ILLEGAL_ADDRESS);
return_ACPI_STATUS(AE_LIMIT);
}

/* Exit if requested address is not within the protected port table */
Expand All @@ -178,11 +179,12 @@ acpi_hw_validate_io_request(acpi_io_address address, u32 bit_width)
/* Port illegality may depend on the _OSI calls made by the BIOS */

if (acpi_gbl_osi_data >= port_info->osi_dependency) {
ACPI_ERROR((AE_INFO,
"Denied AML access to port 0x%p/%X (%s 0x%.4X-0x%.4X)",
ACPI_CAST_PTR(void, address),
byte_width, port_info->name,
port_info->start, port_info->end));
ACPI_DEBUG_PRINT((ACPI_DB_IO,
"Denied AML access to port 0x%p/%X (%s 0x%.4X-0x%.4X)",
ACPI_CAST_PTR(void, address),
byte_width, port_info->name,
port_info->start,
port_info->end));

return_ACPI_STATUS(AE_AML_ILLEGAL_ADDRESS);
}
Expand All @@ -206,7 +208,7 @@ acpi_hw_validate_io_request(acpi_io_address address, u32 bit_width)
* Value Where value is placed
* Width Number of bits
*
* RETURN: Value read from port
* RETURN: Status and value read from port
*
* DESCRIPTION: Read data from an I/O port or register. This is a front-end
* to acpi_os_read_port that performs validation on both the port
Expand All @@ -217,14 +219,43 @@ acpi_hw_validate_io_request(acpi_io_address address, u32 bit_width)
acpi_status acpi_hw_read_port(acpi_io_address address, u32 *value, u32 width)
{
acpi_status status;
u32 one_byte;
u32 i;

/* Validate the entire request and perform the I/O */

status = acpi_hw_validate_io_request(address, width);
if (ACPI_FAILURE(status)) {
if (ACPI_SUCCESS(status)) {
status = acpi_os_read_port(address, value, width);
return status;
}

status = acpi_os_read_port(address, value, width);
return status;
if (status != AE_AML_ILLEGAL_ADDRESS) {
return status;
}

/*
* There has been a protection violation within the request. Fall
* back to byte granularity port I/O and ignore the failing bytes.
* This provides Windows compatibility.
*/
for (i = 0, *value = 0; i < width; i += 8) {

/* Validate and read one byte */

if (acpi_hw_validate_io_request(address, 8) == AE_OK) {
status = acpi_os_read_port(address, &one_byte, 8);
if (ACPI_FAILURE(status)) {
return status;
}

*value |= (one_byte << i);
}

address++;
}

return AE_OK;
}

/******************************************************************************
Expand All @@ -235,7 +266,7 @@ acpi_status acpi_hw_read_port(acpi_io_address address, u32 *value, u32 width)
* Value Value to write
* Width Number of bits
*
* RETURN: None
* RETURN: Status
*
* DESCRIPTION: Write data to an I/O port or register. This is a front-end
* to acpi_os_write_port that performs validation on both the port
Expand All @@ -246,12 +277,39 @@ acpi_status acpi_hw_read_port(acpi_io_address address, u32 *value, u32 width)
acpi_status acpi_hw_write_port(acpi_io_address address, u32 value, u32 width)
{
acpi_status status;
u32 i;

/* Validate the entire request and perform the I/O */

status = acpi_hw_validate_io_request(address, width);
if (ACPI_FAILURE(status)) {
if (ACPI_SUCCESS(status)) {
status = acpi_os_write_port(address, value, width);
return status;
}

status = acpi_os_write_port(address, value, width);
return status;
if (status != AE_AML_ILLEGAL_ADDRESS) {
return status;
}

/*
* There has been a protection violation within the request. Fall
* back to byte granularity port I/O and ignore the failing bytes.
* This provides Windows compatibility.
*/
for (i = 0; i < width; i += 8) {

/* Validate and write one byte */

if (acpi_hw_validate_io_request(address, 8) == AE_OK) {
status =
acpi_os_write_port(address, (value >> i) & 0xFF, 8);
if (ACPI_FAILURE(status)) {
return status;
}
}

address++;
}

return AE_OK;
}
27 changes: 2 additions & 25 deletions 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
Loading

0 comments on commit ef54b1b

Please sign in to comment.