Re: [ACPI] PATCH-ACPI based CPU hotplug[5/6]-ACPI processor driver extension

Keiichiro Tokunaga
2004-09-22T09:57:53Z

On Mon, 20 Sep 2004 09:43:52 -0700 Keshavamurthy Anil S wrote:
> Changes form previous version
> 1) Added depends on EXPERIMENTAL in kconfig file
>
> ---
> Name:processor_drv.patch
> Status:Tested on 2.6.9-rc2
> Signed-off-by: Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com>
> Depends:
> Version: applies on 2.6.9-rc2
> Description:
> Extends the processor driver to support ACPI based Physical CPU hotplug.

> +static int
> +is_processor_present(
> + acpi_handle handle)
> +{
> + acpi_status status;
> + unsigned long sta = 0;
> +
> + ACPI_FUNCTION_TRACE("is_processor_present");
> +
> + status = acpi_evaluate_integer(handle, "_STA", NULL, &sta);
> + if (ACPI_FAILURE(status) || !(sta & ACPI_STA_PRESENT)) {
> + ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
> + "Processor Device is not present\n"));
> + return_VALUE(0);
> + }
> + return_VALUE(1);
> +}

This assumes that a device is not present if acpi_evaluate_integer()
returns failure. But, from the ACPI spec, I think we should assume
the device is present if the function fails due to a failure in finding
_STA method.

I am attaching a patch to fix this. Please see it below.

Thanks,
Keiichiro Tokunaga

Name: cpu_hp_sta_fix.patch
Status: Tested on 2.6.9-rc2
Signed-off-by: Keiichiro Tokunaga <tokunaga.keiich@jp.fujitsu.com>
Description:
Fix the evaluation method of _STA in drivers/acpi/processor.c. If a processor
object does not have _STA, we should consider it as present.

---

linux-2.6.9-rc2-fix-kei/drivers/acpi/processor.c | 12 +++++++++++-
1 files changed, 11 insertions(+), 1 deletion(-)

diff -puN drivers/acpi/processor.c~cpu_hp_sta_fix drivers/acpi/processor.c
--- linux-2.6.9-rc2-fix/drivers/acpi/processor.c~cpu_hp_sta_fix 2004-09-22 11:56:58.000000000 +0900
+++ linux-2.6.9-rc2-fix-kei/drivers/acpi/processor.c 2004-09-22 18:36:34.000000000 +0900
@@ -2551,7 +2551,17 @@ is_processor_present(
ACPI_FUNCTION_TRACE("is_processor_present");

status = acpi_evaluate_integer(handle, "_STA", NULL, &sta);
- if (ACPI_FAILURE(status) || !(sta & ACPI_STA_PRESENT)) {
+ if (ACPI_FAILURE(status)) {
+ /* Assume device is present if it does not have _STA. */
+ if (status == AE_NOT_FOUND)
+ return_VALUE(1);
+ else {
+ printk(KERN_WARNING "Failed to evaluate _STA.\n");
+ return_VALUE(0);
+ }
+ }
+
+ if (!(sta & ACPI_STA_PRESENT)) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
"Processor Device is not present\n"));
return_VALUE(0);

_