Re: [RFC][PATCH 2/7] ACPI: Separate invocations of _GTS and _BFS from _PTS and _WAK

2008-01-03 Thread Rafael J. Wysocki
On Thursday, 3 of January 2008, Pavel Machek wrote:
> On Thu 2007-12-27 19:15:16, Rafael J. Wysocki wrote:
> > From: Rafael J. Wysocki <[EMAIL PROTECTED]>
> > 
> > The execution of ACPI global control methods _GTS and _BFS is
> > currently tied to the preparation to enter a sleep state and to the
> > leaving of the sleep state, respectively.  However, these functions
> > are called before disabling the nonboot CPUs and after enabling
> > them, respectively (in fact, on ACPI 1.0x systems the first of them
> > ought to be called before suspending devices), while according to the
> > ACPI specification, _GTS is to be executed right prior to entering
> > the system sleep state and _BFS is to be executed right after the
> > platfor firmware has returned control to the OS on wake up.
> > 
> > Move the execution of _GTS and _BFS to the right places.
> > 
> > Signed-off-by: Rafael J. Wysocki <[EMAIL PROTECTED]>
> 
> Seems ok to me, but it is 2.6.25 material earliest, right?

Sure, it is.

[The patches are on top of 2.6.25 ones, btw. ;-)]

Thanks,
Rafael
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [RFC][PATCH 2/7] ACPI: Separate invocations of _GTS and _BFS from _PTS and _WAK

2008-01-03 Thread Pavel Machek
On Thu 2007-12-27 19:15:16, Rafael J. Wysocki wrote:
> From: Rafael J. Wysocki <[EMAIL PROTECTED]>
> 
> The execution of ACPI global control methods _GTS and _BFS is
> currently tied to the preparation to enter a sleep state and to the
> leaving of the sleep state, respectively.  However, these functions
> are called before disabling the nonboot CPUs and after enabling
> them, respectively (in fact, on ACPI 1.0x systems the first of them
> ought to be called before suspending devices), while according to the
> ACPI specification, _GTS is to be executed right prior to entering
> the system sleep state and _BFS is to be executed right after the
> platfor firmware has returned control to the OS on wake up.
> 
> Move the execution of _GTS and _BFS to the right places.
> 
> Signed-off-by: Rafael J. Wysocki <[EMAIL PROTECTED]>

Seems ok to me, but it is 2.6.25 material earliest, right?

-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) 
http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [RFC][PATCH 2/7] ACPI: Separate invocations of _GTS and _BFS from _PTS and _WAK

2008-01-03 Thread Pavel Machek
On Thu 2007-12-27 19:15:16, Rafael J. Wysocki wrote:
 From: Rafael J. Wysocki [EMAIL PROTECTED]
 
 The execution of ACPI global control methods _GTS and _BFS is
 currently tied to the preparation to enter a sleep state and to the
 leaving of the sleep state, respectively.  However, these functions
 are called before disabling the nonboot CPUs and after enabling
 them, respectively (in fact, on ACPI 1.0x systems the first of them
 ought to be called before suspending devices), while according to the
 ACPI specification, _GTS is to be executed right prior to entering
 the system sleep state and _BFS is to be executed right after the
 platfor firmware has returned control to the OS on wake up.
 
 Move the execution of _GTS and _BFS to the right places.
 
 Signed-off-by: Rafael J. Wysocki [EMAIL PROTECTED]

Seems ok to me, but it is 2.6.25 material earliest, right?

-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) 
http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [RFC][PATCH 2/7] ACPI: Separate invocations of _GTS and _BFS from _PTS and _WAK

2008-01-03 Thread Rafael J. Wysocki
On Thursday, 3 of January 2008, Pavel Machek wrote:
 On Thu 2007-12-27 19:15:16, Rafael J. Wysocki wrote:
  From: Rafael J. Wysocki [EMAIL PROTECTED]
  
  The execution of ACPI global control methods _GTS and _BFS is
  currently tied to the preparation to enter a sleep state and to the
  leaving of the sleep state, respectively.  However, these functions
  are called before disabling the nonboot CPUs and after enabling
  them, respectively (in fact, on ACPI 1.0x systems the first of them
  ought to be called before suspending devices), while according to the
  ACPI specification, _GTS is to be executed right prior to entering
  the system sleep state and _BFS is to be executed right after the
  platfor firmware has returned control to the OS on wake up.
  
  Move the execution of _GTS and _BFS to the right places.
  
  Signed-off-by: Rafael J. Wysocki [EMAIL PROTECTED]
 
 Seems ok to me, but it is 2.6.25 material earliest, right?

Sure, it is.

[The patches are on top of 2.6.25 ones, btw. ;-)]

Thanks,
Rafael
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[RFC][PATCH 2/7] ACPI: Separate invocations of _GTS and _BFS from _PTS and _WAK

2007-12-27 Thread Rafael J. Wysocki
From: Rafael J. Wysocki <[EMAIL PROTECTED]>

The execution of ACPI global control methods _GTS and _BFS is
currently tied to the preparation to enter a sleep state and to the
leaving of the sleep state, respectively.  However, these functions
are called before disabling the nonboot CPUs and after enabling
them, respectively (in fact, on ACPI 1.0x systems the first of them
ought to be called before suspending devices), while according to the
ACPI specification, _GTS is to be executed right prior to entering
the system sleep state and _BFS is to be executed right after the
platfor firmware has returned control to the OS on wake up.

Move the execution of _GTS and _BFS to the right places.

Signed-off-by: Rafael J. Wysocki <[EMAIL PROTECTED]>
---
 drivers/acpi/hardware/hwsleep.c |   75 ++--
 drivers/acpi/sleep/main.c   |7 +++
 include/acpi/acpixf.h   |2 +
 3 files changed, 66 insertions(+), 18 deletions(-)

Index: linux-2.6/drivers/acpi/hardware/hwsleep.c
===
--- linux-2.6.orig/drivers/acpi/hardware/hwsleep.c
+++ linux-2.6/drivers/acpi/hardware/hwsleep.c
@@ -192,18 +192,13 @@ acpi_status acpi_enter_sleep_state_prep(
arg.type = ACPI_TYPE_INTEGER;
arg.integer.value = sleep_state;
 
-   /* Run the _PTS and _GTS methods */
+   /* Run the _PTS method */
 
status = acpi_evaluate_object(NULL, METHOD_NAME__PTS, _list, NULL);
if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) {
return_ACPI_STATUS(status);
}
 
-   status = acpi_evaluate_object(NULL, METHOD_NAME__GTS, _list, NULL);
-   if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) {
-   return_ACPI_STATUS(status);
-   }
-
/* Setup the argument to _SST */
 
switch (sleep_state) {
@@ -262,6 +257,8 @@ acpi_status asmlinkage acpi_enter_sleep_
struct acpi_bit_register_info *sleep_type_reg_info;
struct acpi_bit_register_info *sleep_enable_reg_info;
u32 in_value;
+   struct acpi_object_list arg_list;
+   union acpi_object arg;
acpi_status status;
 
ACPI_FUNCTION_TRACE(acpi_enter_sleep_state);
@@ -307,6 +304,18 @@ acpi_status asmlinkage acpi_enter_sleep_
return_ACPI_STATUS(status);
}
 
+   /* Execute the _GTS method */
+
+   arg_list.count = 1;
+   arg_list.pointer = 
+   arg.type = ACPI_TYPE_INTEGER;
+   arg.integer.value = sleep_state;
+
+   status = acpi_evaluate_object(NULL, METHOD_NAME__GTS, _list, NULL);
+   if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) {
+   return_ACPI_STATUS(status);
+   }
+
/* Get current value of PM1A control */
 
status = acpi_hw_register_read(ACPI_REGISTER_PM1_CONTROL, );
@@ -473,17 +482,18 @@ ACPI_EXPORT_SYMBOL(acpi_enter_sleep_stat
 
 
/***
  *
- * FUNCTION:acpi_leave_sleep_state
+ * FUNCTION:acpi_leave_sleep_state_prep
  *
- * PARAMETERS:  sleep_state - Which sleep state we just exited
+ * PARAMETERS:  sleep_state - Which sleep state we are exiting
  *
  * RETURN:  Status
  *
- * DESCRIPTION: Perform OS-independent ACPI cleanup after a sleep
- *  Called with interrupts ENABLED.
+ * DESCRIPTION: Perform the first state of OS-independent ACPI cleanup after a
+ *  sleep.
+ *  Called with interrupts DISABLED.
  *
  
**/
-acpi_status acpi_leave_sleep_state(u8 sleep_state)
+acpi_status acpi_leave_sleep_state_prep(u8 sleep_state)
 {
struct acpi_object_list arg_list;
union acpi_object arg;
@@ -493,7 +503,7 @@ acpi_status acpi_leave_sleep_state(u8 sl
u32 PM1Acontrol;
u32 PM1Bcontrol;
 
-   ACPI_FUNCTION_TRACE(acpi_leave_sleep_state);
+   ACPI_FUNCTION_TRACE(acpi_leave_sleep_state_prep);
 
/*
 * Set SLP_TYPE and SLP_EN to state S0.
@@ -540,6 +550,41 @@ acpi_status acpi_leave_sleep_state(u8 sl
}
}
 
+   /* Execute the _BFS method */
+
+   arg_list.count = 1;
+   arg_list.pointer = 
+   arg.type = ACPI_TYPE_INTEGER;
+   arg.integer.value = sleep_state;
+
+   status = acpi_evaluate_object(NULL, METHOD_NAME__BFS, _list, NULL);
+   if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) {
+   ACPI_EXCEPTION((AE_INFO, status, "During Method _BFS"));
+   }
+
+   return_ACPI_STATUS(status);
+}
+
+/***
+ *
+ * FUNCTION:acpi_leave_sleep_state
+ *
+ * PARAMETERS:  sleep_state - Which sleep state we just exited
+ *
+ * RETURN:  Status
+ *
+ * DESCRIPTION: Perform OS-independent ACPI cleanup after a sleep
+ *  Called with interrupts ENABLED.
+ *
+ 

[RFC][PATCH 2/7] ACPI: Separate invocations of _GTS and _BFS from _PTS and _WAK

2007-12-27 Thread Rafael J. Wysocki
From: Rafael J. Wysocki [EMAIL PROTECTED]

The execution of ACPI global control methods _GTS and _BFS is
currently tied to the preparation to enter a sleep state and to the
leaving of the sleep state, respectively.  However, these functions
are called before disabling the nonboot CPUs and after enabling
them, respectively (in fact, on ACPI 1.0x systems the first of them
ought to be called before suspending devices), while according to the
ACPI specification, _GTS is to be executed right prior to entering
the system sleep state and _BFS is to be executed right after the
platfor firmware has returned control to the OS on wake up.

Move the execution of _GTS and _BFS to the right places.

Signed-off-by: Rafael J. Wysocki [EMAIL PROTECTED]
---
 drivers/acpi/hardware/hwsleep.c |   75 ++--
 drivers/acpi/sleep/main.c   |7 +++
 include/acpi/acpixf.h   |2 +
 3 files changed, 66 insertions(+), 18 deletions(-)

Index: linux-2.6/drivers/acpi/hardware/hwsleep.c
===
--- linux-2.6.orig/drivers/acpi/hardware/hwsleep.c
+++ linux-2.6/drivers/acpi/hardware/hwsleep.c
@@ -192,18 +192,13 @@ acpi_status acpi_enter_sleep_state_prep(
arg.type = ACPI_TYPE_INTEGER;
arg.integer.value = sleep_state;
 
-   /* Run the _PTS and _GTS methods */
+   /* Run the _PTS method */
 
status = acpi_evaluate_object(NULL, METHOD_NAME__PTS, 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);
-   }
-
/* Setup the argument to _SST */
 
switch (sleep_state) {
@@ -262,6 +257,8 @@ acpi_status asmlinkage acpi_enter_sleep_
struct acpi_bit_register_info *sleep_type_reg_info;
struct acpi_bit_register_info *sleep_enable_reg_info;
u32 in_value;
+   struct acpi_object_list arg_list;
+   union acpi_object arg;
acpi_status status;
 
ACPI_FUNCTION_TRACE(acpi_enter_sleep_state);
@@ -307,6 +304,18 @@ acpi_status asmlinkage acpi_enter_sleep_
return_ACPI_STATUS(status);
}
 
+   /* Execute the _GTS method */
+
+   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);
+   }
+
/* Get current value of PM1A control */
 
status = acpi_hw_register_read(ACPI_REGISTER_PM1_CONTROL, PM1Acontrol);
@@ -473,17 +482,18 @@ ACPI_EXPORT_SYMBOL(acpi_enter_sleep_stat
 
 
/***
  *
- * FUNCTION:acpi_leave_sleep_state
+ * FUNCTION:acpi_leave_sleep_state_prep
  *
- * PARAMETERS:  sleep_state - Which sleep state we just exited
+ * PARAMETERS:  sleep_state - Which sleep state we are exiting
  *
  * RETURN:  Status
  *
- * DESCRIPTION: Perform OS-independent ACPI cleanup after a sleep
- *  Called with interrupts ENABLED.
+ * DESCRIPTION: Perform the first state of OS-independent ACPI cleanup after a
+ *  sleep.
+ *  Called with interrupts DISABLED.
  *
  
**/
-acpi_status acpi_leave_sleep_state(u8 sleep_state)
+acpi_status acpi_leave_sleep_state_prep(u8 sleep_state)
 {
struct acpi_object_list arg_list;
union acpi_object arg;
@@ -493,7 +503,7 @@ acpi_status acpi_leave_sleep_state(u8 sl
u32 PM1Acontrol;
u32 PM1Bcontrol;
 
-   ACPI_FUNCTION_TRACE(acpi_leave_sleep_state);
+   ACPI_FUNCTION_TRACE(acpi_leave_sleep_state_prep);
 
/*
 * Set SLP_TYPE and SLP_EN to state S0.
@@ -540,6 +550,41 @@ acpi_status acpi_leave_sleep_state(u8 sl
}
}
 
+   /* Execute the _BFS method */
+
+   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));
+   }
+
+   return_ACPI_STATUS(status);
+}
+
+/***
+ *
+ * FUNCTION:acpi_leave_sleep_state
+ *
+ * PARAMETERS:  sleep_state - Which sleep state we just exited
+ *
+ * RETURN:  Status
+ *
+ * DESCRIPTION: Perform OS-independent ACPI cleanup after a sleep
+ *  Called with interrupts ENABLED.
+ *
+