ACPICA: Drop Linux-specific waking vector functions
Subsystems (2)
PATCH 1/1 ACPICA: Drop Linux-specific waking vector functions
From: Rafael J. Wysocki <[email protected]>
Commit f06147f9fbf1 (ACPICA: Hardware: Enable firmware waking vector for both 32-bit and 64-bit FACS) added three functions that aren't present in upstream ACPICA, acpi_hw_set_firmware_waking_vectors(), acpi_set_firmware_waking_vectors() and acpi_set_firmware_waking_vector64(), to allow Linux to use the previously existing API for setting the platform firmware waking vector.
However, that wasn't necessary, since the ACPI sleep support code in Linux can be modified to use the upstream ACPICA's API easily and the additional functions may be dropped which reduces the code size and puts the kernel's ACPICA code more in line with the upstream.
Make the changes as per the above.
--- drivers/acpi/acpica/hwxfsleep.c | 88 ++++++---------------------------------- drivers/acpi/sleep.c | 4 - drivers/acpi/sleep.h | 6 ++ include/acpi/acpixf.h | 10 ---- 4 files changed, 24 insertions(+), 84 deletions(-)
drivers/acpi/acpica/hwxfsleep.c +15 -73
@@ -52,9 +52,9 @@ ACPI_MODULE_NAME("hwxfsleep")/* Local prototypes */ #if (!ACPI_REDUCED_HARDWARE )static acpi_status -acpi_hw_set_firmware_waking_vectors (struct acpi_table_facs *facs, -acpi_physical_address physical_address, -acpi_physical_address physical_address64); +acpi_hw_set_firmware_waking_vector (struct acpi_table_facs *facs, +acpi_physical_address physical_address, +acpi_physical_address physical_address64);#endif static acpi_status acpi_hw_sleep_dispatch (u8 sleep_state,u32 function_id);
@@ -79,16 +79,14 @@ static struct acpi_sleep_functions acpi_/* * These functions are removed for the ACPI_REDUCED_HARDWARE case: -* acpi_set_firmware_waking_vectors * acpi_set_firmware_waking_vector -* acpi_set_firmware_waking_vector64 * acpi_enter_sleep_state_s4bios */ #if (!ACPI_REDUCED_HARDWARE )/******************************************************************************* * -* FUNCTION: acpi_hw_set_firmware_waking_vectors +* FUNCTION: acpi_hw_set_firmware_waking_vector * * PARAMETERS: facs - Pointer to FACS table * physical_address - 32-bit physical address of ACPI real mode
@@ -103,11 +101,11 @@ static struct acpi_sleep_functions acpi_******************************************************************************/ static acpi_status -acpi_hw_set_firmware_waking_vectors (struct acpi_table_facs *facs, -acpi_physical_address physical_address, -acpi_physical_address physical_address64) +acpi_hw_set_firmware_waking_vector (struct acpi_table_facs *facs, +acpi_physical_address physical_address, +acpi_physical_address physical_address64) { -ACPI_FUNCTION_TRACE (acpi_hw_set_firmware_waking_vectors); +ACPI_FUNCTION_TRACE (acpi_hw_set_firmware_waking_vector);/*
@@ -140,7 +138,7 @@ acpi_hw_set_firmware_waking_vectors(stru/******************************************************************************* * -* FUNCTION: acpi_set_firmware_waking_vectors +* FUNCTION: acpi_set_firmware_waking_vector * * PARAMETERS: physical_address - 32-bit physical address of ACPI real mode * entry point.
@@ -154,79 +152,23 @@ acpi_hw_set_firmware_waking_vectors(stru******************************************************************************/ acpi_status -acpi_set_firmware_waking_vectors (acpi_physical_address physical_address, -acpi_physical_address physical_address64) +acpi_set_firmware_waking_vector (acpi_physical_address physical_address, +acpi_physical_address physical_address64) { -ACPI_FUNCTION_TRACE (acpi_set_firmware_waking_vectors); +ACPI_FUNCTION_TRACE (acpi_set_firmware_waking_vector);if (acpi_gbl_FACS) { - (void )acpi_hw_set_firmware_waking_vectors (acpi_gbl_FACS, - physical_address, - physical_address64); + (void )acpi_hw_set_firmware_waking_vector (acpi_gbl_FACS, + physical_address, + physical_address64); }return_ACPI_STATUS (AE_OK ); } -ACPI_EXPORT_SYMBOL (acpi_set_firmware_waking_vectors) - -/******************************************************************************* -* -* FUNCTION: acpi_set_firmware_waking_vector -* -* PARAMETERS: physical_address - 32-bit physical address of ACPI real mode -* entry point. -* -* RETURN: Status -* -* DESCRIPTION: Sets the 32-bit firmware_waking_vector field of the FACS -* -******************************************************************************/ -acpi_status acpi_set_firmware_waking_vector(u32 physical_address) -{ -acpi_status status; - -ACPI_FUNCTION_TRACE (acpi_set_firmware_waking_vector); - - status =acpi_set_firmware_waking_vectors ((acpi_physical_address ) - physical_address,0 ); - -return_ACPI_STATUS (status); -} -ACPI_EXPORT_SYMBOL (acpi_set_firmware_waking_vector) -#if ACPI_MACHINE_WIDTH ==64 -/******************************************************************************* -* -* FUNCTION: acpi_set_firmware_waking_vector64 -* -* PARAMETERS: physical_address - 64-bit physical address of ACPI protected -* mode entry point. -* -* RETURN: Status -* -* DESCRIPTION: Sets the 64-bit X_firmware_waking_vector field of the FACS, if -* it exists in the table. This function is intended for use with -* 64-bit host operating systems. -* -******************************************************************************/ -acpi_status acpi_set_firmware_waking_vector64 (u64 physical_address) -{ -acpi_status status; - -ACPI_FUNCTION_TRACE (acpi_set_firmware_waking_vector64); - - status =acpi_set_firmware_waking_vectors (0 , - (acpi_physical_address ) - physical_address); - -return_ACPI_STATUS (status); -} - -ACPI_EXPORT_SYMBOL(acpi_set_firmware_waking_vector64) -#endif /******************************************************************************* * * FUNCTION: acpi_enter_sleep_state_s4bios
include/acpi/acpixf.h +1 -9
@@ -863,17 +863,9 @@ ACPI_EXTERNAL_RETURN_STATUS(acpi_status ACPI_EXTERNAL_RETURN_STATUS(acpi_status acpi_leave_sleep_state(u8 sleep_state))ACPI_HW_DEPENDENT_RETURN_STATUS (acpi_status - acpi_set_firmware_waking_vectors +acpi_set_firmware_waking_vector (acpi_physical_address physical_address,acpi_physical_address physical_address64)) -ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status - acpi_set_firmware_waking_vector(u32 - physical_address)) -#if ACPI_MACHINE_WIDTH ==64 -ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status - acpi_set_firmware_waking_vector64(u64 - physical_address)) -#endif /* * ACPI Timer interfaces */
drivers/acpi/sleep.c +2 -2
@@ -61,7 +61,7 @@ static int acpi_sleep_prepare(u32 acpi_sif (acpi_state ==ACPI_STATE_S3 ) {if (!acpi_wakeup_address)return -EFAULT ; -acpi_set_firmware_waking_vector (acpi_wakeup_address); +acpi_set_waking_vector (acpi_wakeup_address); }ACPI_FLUSH_CPU_CACHE ();
@@ -410,7 +410,7 @@ static void acpi_pm_finish(void)acpi_leave_sleep_state (acpi_state);/* reset firmware waking vector */ -acpi_set_firmware_waking_vector ((acpi_physical_address )0 ); +acpi_set_waking_vector (0 ); acpi_target_sleep_state =ACPI_STATE_S0 ;
drivers/acpi/sleep.h +6 -0
@@ -6,3 +6,9 @@ extern struct list_head acpi_wakeup_deviextern struct mutex acpi_device_lock;extern void acpi_resume_power_resources (void ); + +static inline acpi_status acpi_set_waking_vector (u32 wakeup_address) +{ +return acpi_set_firmware_waking_vector ( + (acpi_physical_address )wakeup_address,0 ); +}
Hi, Rafael
One more improvement is:
After applying this patch, I can still detect the following diff blocks using ACPICA's divergence checking utility:
drivers/acpi/acpica/hwxfsleep.c +4 -4
@@ -90,9 +90,9 @@ static struct acpi_sleep_functions acpi_* * PARAMETERS: facs - Pointer to FACS table * physical_address - 32-bit physical address of ACPI real mode -* entry point. +* entry point * physical_address64 - 64-bit physical address of ACPI protected -* mode entry point. +* entry point * * RETURN: Status *
@@ -141,9 +140,9 @@ acpi_hw_set_firmware_waking_vector(struc* FUNCTION: acpi_set_firmware_waking_vector * * PARAMETERS: physical_address - 32-bit physical address of ACPI real mode -* entry point. +* entry point * physical_address64 - 64-bit physical address of ACPI protected -* mode entry point. +* entry point * * RETURN: Status *
This seems to be added recently in ACPICA upstream. Hope you can help to reduce this in the same patch. Thanks in advance.
Best regards
-Lv
Quoted 263 lines
From: Rafael J. Wysocki [mailto:[email protected]]
Sent: Sunday, January 3, 2016 9:51 AM
Subject: [PATCH] ACPICA: Drop Linux-specific waking vector functionsFrom: Rafael J. Wysocki <[email protected]>
Commit
f06147f9fbf1(ACPICA: Hardware: Enable firmware waking vector for both 32-bit and 64-bit FACS) added three functions that aren't present in upstream ACPICA,acpi_hw_set_firmware_waking_vectors(),acpi_set_firmware_waking_vectors()andacpi_set_firmware_waking_vector64(),
to allow Linux to use the previously existing API for setting the platform firmware waking vector.However, that wasn't necessary, since the ACPI sleep support code in Linux can be modified to use the upstream ACPICA's API easily and the additional functions may be dropped which reduces the code size and puts the kernel's ACPICA code more in line with the upstream.
Make the changes as per the above.
Signed-off-by Rafael J. Wysocki <[email protected]>--- drivers/acpi/acpica/hwxfsleep.c | 88 ++++++---------------------------------- drivers/acpi/sleep.c | 4 - drivers/acpi/sleep.h | 6 ++ include/acpi/acpixf.h | 10 ---- 4 files changed, 24 insertions(+), 84 deletions(-)Index:
linux-pm/drivers/acpi/acpica/hwxfsleep.c
================================================================
===drivers/acpi/acpica/hwxfsleep.c +4
-6@@ -52,9 +52,9 @@ ACPI_MODULE_NAME("hwxfsleep")/* Local prototypes */ #if (!ACPI_REDUCED_HARDWARE )static acpi_status -acpi_hw_set_firmware_waking_vectors (struct acpi_table_facs *facs, -acpi_physical_address physical_address, -acpi_physical_address physical_address64); +acpi_hw_set_firmware_waking_vector (struct acpi_table_facs *facs, +acpi_physical_address physical_address, +acpi_physical_address physical_address64);#endif static acpi_status acpi_hw_sleep_dispatch (u8 sleep_state,u32 function_id);@@ -79,16 +79,14 @@ static struct acpi_sleep_functions acpi_/* * These functions are removed for the ACPI_REDUCED_HARDWARE case: -* acpi_set_firmware_waking_vectors * acpi_set_firmware_waking_vector -* acpi_set_firmware_waking_vector64 * acpi_enter_sleep_state_s4bios */ #if (!ACPI_REDUCED_HARDWARE )/*************************************************************** **************** * -* FUNCTION: acpi_hw_set_firmware_waking_vectors +* FUNCTION: acpi_hw_set_firmware_waking_vector * * PARAMETERS: facs - Pointer to FACS table * physical_address - 32-bit physical address of ACPI real modedrivers/acpi/acpica/hwxfsleep.c +4
-4@@ -103,11 +101,11 @@ static struct acpi_sleep_functions acpi_**************************************************************** **************/ static acpi_status -acpi_hw_set_firmware_waking_vectors (struct acpi_table_facs *facs, -acpi_physical_address physical_address, -acpi_physical_address physical_address64) +acpi_hw_set_firmware_waking_vector (struct acpi_table_facs *facs, +acpi_physical_address physical_address, +acpi_physical_address physical_address64) { -ACPI_FUNCTION_TRACE (acpi_hw_set_firmware_waking_vectors); +ACPI_FUNCTION_TRACE (acpi_hw_set_firmware_waking_vector);drivers/acpi/acpica/hwxfsleep.c +1
-1/* @@ -140,7 +138,7 @@ acpi_hw_set_firmware_waking_vectors(stru/*************************************************************** **************** * -* FUNCTION: acpi_set_firmware_waking_vectors +* FUNCTION: acpi_set_firmware_waking_vector * * PARAMETERS:
physical_address- 32-bit physical address of ACPI real
mode
* entry point.drivers/acpi/acpica/hwxfsleep.c +6
-13@@ -154,79 +152,23 @@ acpi_hw_set_firmware_waking_vectors(stru**************************************************************** **************/ acpi_status -acpi_set_firmware_waking_vectors (acpi_physical_address physical_address, -acpi_physical_address physical_address64) +acpi_set_firmware_waking_vector (acpi_physical_address physical_address, +acpi_physical_address physical_address64) { -ACPI_FUNCTION_TRACE (acpi_set_firmware_waking_vectors); +ACPI_FUNCTION_TRACE (acpi_set_firmware_waking_vector);if (acpi_gbl_FACS) { - (void )acpi_hw_set_firmware_waking_vectors (acpi_gbl_FACS, - physical_address, - physical_address64); + (void )acpi_hw_set_firmware_waking_vector (acpi_gbl_FACS, + physical_address, + physical_address64); }return_ACPI_STATUS (AE_OK ); } -ACPI_EXPORT_SYMBOL (acpi_set_firmware_waking_vectors) - -/*************************************************************** **************** -* -* FUNCTION: acpi_set_firmware_waking_vector -* -* PARAMETERS: physical_address - 32-bit physical address of ACPI real mode
- * entry point.
- *
- * RETURN: Status
- *
- * DESCRIPTION: Sets the 32-bitfirmware_waking_vectorfield of the FACS
- *
-
****************************************************************
**************/drivers/acpi/acpica/hwxfsleep.c +0
-14-acpi_status acpi_set_firmware_waking_vector (u32 physical_address) -{ -acpi_status status; - -ACPI_FUNCTION_TRACE (acpi_set_firmware_waking_vector); - - status =acpi_set_firmware_waking_vectors ((acpi_physical_address ) - physical_address,0 ); - -return_ACPI_STATUS (status); -} -ACPI_EXPORT_SYMBOL (acpi_set_firmware_waking_vector) -#if ACPI_MACHINE_WIDTH ==64 -/***************************************************************
****************
- *
- * FUNCTION:acpi_set_firmware_waking_vector64
- *
- * PARAMETERS:physical_address- 64-bit physical address of ACPI
protected
- * mode entry point.
- *
- * RETURN: Status
- *
- * DESCRIPTION: Sets the 64-bitX_firmware_waking_vectorfield of the FACS, if
- * it exists in the table. This function is intended for use with
- * 64-bit host operating systems.
- *
-
****************************************************************
**************/drivers/acpi/acpica/hwxfsleep.c +0
-15-acpi_status acpi_set_firmware_waking_vector64 (u64 physical_address) -{ -acpi_status status; - -ACPI_FUNCTION_TRACE (acpi_set_firmware_waking_vector64); - - status =acpi_set_firmware_waking_vectors (0 , - (acpi_physical_address ) - physical_address); - -return_ACPI_STATUS (status); -} - -ACPI_EXPORT_SYMBOL(acpi_set_firmware_waking_vector64) -#endif /***************************************************************
****************
*
* FUNCTION:acpi_enter_sleep_state_s4bios
Index:linux-pm/include/acpi/acpixf.h
================================================================
===include/acpi/acpixf.h +1
-9@@ -863,17 +863,9 @@ ACPI_EXTERNAL_RETURN_STATUS(acpi_status ACPI_EXTERNAL_RETURN_STATUS(acpi_status acpi_leave_sleep_state(u8 sleep_state)) ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status - acpi_set_firmware_waking_vectors + acpi_set_firmware_waking_vector (acpi_physical_address physical_address, acpi_physical_address physical_address64)) -ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status - acpi_set_firmware_waking_vector(u32 - physical_address)) -#if ACPI_MACHINE_WIDTH == 64 -ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status -acpi_set_firmware_waking_vector64 (u64 - physical_address)) -#endif/*
* ACPI Timer interfaces
*/
Index:linux-pm/drivers/acpi/sleep.c
================================================================
===drivers/acpi/sleep.c +2
-2@@ -61,7 +61,7 @@ static int acpi_sleep_prepare(u32 acpi_sif (acpi_state ==ACPI_STATE_S3 ) {if (!acpi_wakeup_address)return -EFAULT ; -acpi_set_firmware_waking_vector (acpi_wakeup_address); +acpi_set_waking_vector (acpi_wakeup_address); }ACPI_FLUSH_CPU_CACHE ();@@ -410,7 +410,7 @@ static void acpi_pm_finish(void)acpi_leave_sleep_state (acpi_state);/* reset firmware waking vector */ -acpi_set_firmware_waking_vector ((acpi_physical_address )0 ); +acpi_set_waking_vector (0 ); acpi_target_sleep_state =ACPI_STATE_S0 ;Index:
linux-pm/drivers/acpi/sleep.h
================================================================
===drivers/acpi/sleep.h +6
-0@@ -6,3 +6,9 @@ extern struct list_head acpi_wakeup_deviextern struct mutex acpi_device_lock;extern void acpi_resume_power_resources (void ); + +static inline acpi_status acpi_set_waking_vector (u32 wakeup_address) +{ +return acpi_set_firmware_waking_vector ( + (acpi_physical_address )wakeup_address,0 ); +}
Rafael J. Wysocki
Acked-by Lv ZhengQuoted 33 lines · Lv
Hi, Rafael
Acke-by Lv Zheng <[email protected]>One more improvement is:
After applying this patch, I can still detect the following diff blocks using ACPICA's divergence checking utility:
diff -E -b -w -B -rpuNlinux-acpica/drivers/acpi/acpica/hwxfsleep.cacpica-linuxized/drivers/acpi/acpica/hwxfsleep.cdrivers/acpi/acpica/hwxfsleep.c +4
-4@@ -90,9 +90,9 @@ static struct acpi_sleep_functions acpi_* * PARAMETERS: facs - Pointer to FACS table * physical_address - 32-bit physical address of ACPI real mode -* entry point. +* entry point * physical_address64 - 64-bit physical address of ACPI protected -* mode entry point. +* entry point * * RETURN: Status * @@ -141,9 +140,9 @@ acpi_hw_set_firmware_waking_vector(struc* FUNCTION: acpi_set_firmware_waking_vector * * PARAMETERS: physical_address - 32-bit physical address of ACPI real mode -* entry point. +* entry point * physical_address64 - 64-bit physical address of ACPI protected -* mode entry point. +* entry point * * RETURN: Status *
Quoted 3 lines
This seems to be added recently in ACPICA upstream. Hope you can help to reduce this in the same patch. Thanks in advance.
So the periods seem to have gone away, right?
OK, what about the following one?
---
From: Rafael J. Wysocki <[email protected]>
Subject: [PATCH] ACPICA: Drop Linux-specific waking vector functions
Commit f06147f9fbf1 (ACPICA: Hardware: Enable firmware waking vector for both 32-bit and 64-bit FACS) added three functions that aren't present in upstream ACPICA, acpi_hw_set_firmware_waking_vectors(), acpi_set_firmware_waking_vectors() and acpi_set_firmware_waking_vector64(), to allow Linux to use the previously existing API for setting the platform firmware waking vector.
However, that wasn't necessary, since the ACPI sleep support code in Linux can be modified to use the upstream ACPICA's API easily and the additional functions may be dropped which reduces the code size and puts the kernel's ACPICA code more in line with the upstream.
Make the changes as per the above. While at it, make the relevant function desctiption comments reflect the upstream ACPICA's ones.
--- drivers/acpi/acpica/hwxfsleep.c | 96 +++++++--------------------------------- drivers/acpi/sleep.c | 4 - drivers/acpi/sleep.h | 6 ++ include/acpi/acpixf.h | 10 ---- 4 files changed, 28 insertions(+), 88 deletions(-)
drivers/acpi/acpica/hwxfsleep.c +19 -77
@@ -52,9 +52,9 @@ ACPI_MODULE_NAME("hwxfsleep")/* Local prototypes */ #if (!ACPI_REDUCED_HARDWARE )static acpi_status -acpi_hw_set_firmware_waking_vectors (struct acpi_table_facs *facs, -acpi_physical_address physical_address, -acpi_physical_address physical_address64); +acpi_hw_set_firmware_waking_vector (struct acpi_table_facs *facs, +acpi_physical_address physical_address, +acpi_physical_address physical_address64);#endif static acpi_status acpi_hw_sleep_dispatch (u8 sleep_state,u32 function_id);
@@ -79,22 +79,20 @@ static struct acpi_sleep_functions acpi_/* * These functions are removed for the ACPI_REDUCED_HARDWARE case: -* acpi_set_firmware_waking_vectors * acpi_set_firmware_waking_vector -* acpi_set_firmware_waking_vector64 * acpi_enter_sleep_state_s4bios */ #if (!ACPI_REDUCED_HARDWARE )/******************************************************************************* * -* FUNCTION: acpi_hw_set_firmware_waking_vectors +* FUNCTION: acpi_hw_set_firmware_waking_vector * * PARAMETERS: facs - Pointer to FACS table * physical_address - 32-bit physical address of ACPI real mode -* entry point. +* entry point * physical_address64 - 64-bit physical address of ACPI protected -* mode entry point. +* mode entry point * * RETURN: Status *
@@ -103,11 +101,11 @@ static struct acpi_sleep_functions acpi_******************************************************************************/ static acpi_status -acpi_hw_set_firmware_waking_vectors (struct acpi_table_facs *facs, -acpi_physical_address physical_address, -acpi_physical_address physical_address64) +acpi_hw_set_firmware_waking_vector (struct acpi_table_facs *facs, +acpi_physical_address physical_address, +acpi_physical_address physical_address64) { -ACPI_FUNCTION_TRACE (acpi_hw_set_firmware_waking_vectors); +ACPI_FUNCTION_TRACE (acpi_hw_set_firmware_waking_vector);/*
@@ -140,12 +138,12 @@ acpi_hw_set_firmware_waking_vectors(stru/******************************************************************************* * -* FUNCTION: acpi_set_firmware_waking_vectors +* FUNCTION: acpi_set_firmware_waking_vector * * PARAMETERS: physical_address - 32-bit physical address of ACPI real mode -* entry point. +* entry point * physical_address64 - 64-bit physical address of ACPI protected -* mode entry point. +* mode entry point * * RETURN: Status *
@@ -154,79 +152,23 @@ acpi_hw_set_firmware_waking_vectors(stru******************************************************************************/ acpi_status -acpi_set_firmware_waking_vectors (acpi_physical_address physical_address, -acpi_physical_address physical_address64) +acpi_set_firmware_waking_vector (acpi_physical_address physical_address, +acpi_physical_address physical_address64) { -ACPI_FUNCTION_TRACE (acpi_set_firmware_waking_vectors); +ACPI_FUNCTION_TRACE (acpi_set_firmware_waking_vector);if (acpi_gbl_FACS) { - (void )acpi_hw_set_firmware_waking_vectors (acpi_gbl_FACS, - physical_address, - physical_address64); + (void )acpi_hw_set_firmware_waking_vector (acpi_gbl_FACS, + physical_address, + physical_address64); }return_ACPI_STATUS (AE_OK ); } -ACPI_EXPORT_SYMBOL (acpi_set_firmware_waking_vectors) - -/******************************************************************************* -* -* FUNCTION: acpi_set_firmware_waking_vector -* -* PARAMETERS: physical_address - 32-bit physical address of ACPI real mode -* entry point. -* -* RETURN: Status -* -* DESCRIPTION: Sets the 32-bit firmware_waking_vector field of the FACS -* -******************************************************************************/ -acpi_status acpi_set_firmware_waking_vector(u32 physical_address) -{ -acpi_status status; - -ACPI_FUNCTION_TRACE (acpi_set_firmware_waking_vector); - - status =acpi_set_firmware_waking_vectors ((acpi_physical_address ) - physical_address,0 ); - -return_ACPI_STATUS (status); -} -ACPI_EXPORT_SYMBOL (acpi_set_firmware_waking_vector) -#if ACPI_MACHINE_WIDTH ==64 -/******************************************************************************* -* -* FUNCTION: acpi_set_firmware_waking_vector64 -* -* PARAMETERS: physical_address - 64-bit physical address of ACPI protected -* mode entry point. -* -* RETURN: Status -* -* DESCRIPTION: Sets the 64-bit X_firmware_waking_vector field of the FACS, if -* it exists in the table. This function is intended for use with -* 64-bit host operating systems. -* -******************************************************************************/ -acpi_status acpi_set_firmware_waking_vector64 (u64 physical_address) -{ -acpi_status status; - -ACPI_FUNCTION_TRACE (acpi_set_firmware_waking_vector64); - - status =acpi_set_firmware_waking_vectors (0 , - (acpi_physical_address ) - physical_address); - -return_ACPI_STATUS (status); -} - -ACPI_EXPORT_SYMBOL(acpi_set_firmware_waking_vector64) -#endif /******************************************************************************* * * FUNCTION: acpi_enter_sleep_state_s4bios
include/acpi/acpixf.h +1 -9
@@ -863,17 +863,9 @@ ACPI_EXTERNAL_RETURN_STATUS(acpi_status ACPI_EXTERNAL_RETURN_STATUS(acpi_status acpi_leave_sleep_state(u8 sleep_state))ACPI_HW_DEPENDENT_RETURN_STATUS (acpi_status - acpi_set_firmware_waking_vectors +acpi_set_firmware_waking_vector (acpi_physical_address physical_address,acpi_physical_address physical_address64)) -ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status - acpi_set_firmware_waking_vector(u32 - physical_address)) -#if ACPI_MACHINE_WIDTH ==64 -ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status - acpi_set_firmware_waking_vector64(u64 - physical_address)) -#endif /* * ACPI Timer interfaces */
drivers/acpi/sleep.c +2 -2
@@ -61,7 +61,7 @@ static int acpi_sleep_prepare(u32 acpi_sif (acpi_state ==ACPI_STATE_S3 ) {if (!acpi_wakeup_address)return -EFAULT ; -acpi_set_firmware_waking_vector (acpi_wakeup_address); +acpi_set_waking_vector (acpi_wakeup_address); }ACPI_FLUSH_CPU_CACHE ();
@@ -410,7 +410,7 @@ static void acpi_pm_finish(void)acpi_leave_sleep_state (acpi_state);/* reset firmware waking vector */ -acpi_set_firmware_waking_vector ((acpi_physical_address )0 ); +acpi_set_waking_vector (0 ); acpi_target_sleep_state =ACPI_STATE_S0 ;
drivers/acpi/sleep.h +6 -0
@@ -6,3 +6,9 @@ extern struct list_head acpi_wakeup_deviextern struct mutex acpi_device_lock;extern void acpi_resume_power_resources (void ); + +static inline acpi_status acpi_set_waking_vector (u32 wakeup_address) +{ +return acpi_set_firmware_waking_vector ( + (acpi_physical_address )wakeup_address,0 ); +}
Hi, Rafael
Quoted 47 lines
From: Rafael J. Wysocki [mailto:[email protected]]
Sent: Monday, January 4, 2016 9:28 PM
Subject: Re: [PATCH] ACPICA: Drop Linux-specific waking vector functionsQuoted 6 lines · Lv
Hi, Rafael
Acke-by Lv Zheng <[email protected]>One more improvement is:
After applying this patch, I can still detect the following diff blocks usingACPICA's divergence checking utility:
Quoted 1 line
diff -E -b -w -B -rpuN
linux-acpica/drivers/acpi/acpica/hwxfsleep.cacpica-
linuxized/drivers/acpi/acpica/hwxfsleep.cQuoted 1 line
---
linux-acpica/drivers/acpi/acpica/hwxfsleep.c2016-01-0415:16:31.000000000 +0800
Quoted 1 line
+++
acpica-linuxized/drivers/acpi/acpica/hwxfsleep.c2016-01-0415:17:19.000000000 +0800
Quoted 13 lines
drivers/acpi/acpica/hwxfsleep.c +2
-2@@ -90,9 +90,9 @@ static struct acpi_sleep_functions acpi_* * PARAMETERS: facs - Pointer to FACS table * physical_address - 32-bit physical address of ACPI real mode -* entry point. +* entry point * physical_address64 - 64-bit physical address of ACPI protected -* mode entry point. +* entry point * * RETURN: Status * drivers/acpi/acpica/hwxfsleep.c acpi_hw_set_firmware_waking_vector(struc · line 142
Quoted 3 lines
drivers/acpi/acpica/hwxfsleep.c +0
-0@@ -141,9 +140,9 @@ acpi_hw_set_firmware_waking_vector(struc* FUNCTION: acpi_set_firmware_waking_vector * * PARAMETERS: physical_address - 32-bit physical address of ACPI real mode
Quoted 11 lines
drivers/acpi/acpica/hwxfsleep.c +2
-2-* entry point. +* entry point * physical_address64 - 64-bit physical address of ACPI protected -* mode entry point. +* entry point * * RETURN: Status * This seems to be added recently in ACPICA upstream. Hope you can help to reduce this in the same patch. Thanks in advance.
Quoted 1 line
So the periods seem to have gone away, right?
[Lv Zheng]
Yes, the "mode" deletion from ACPICA upstream seems to be wrong.
Quoted 2 lines
OK, what about the following one?
[Lv Zheng]
Looks perfect!
I'll help to restore "mode" back to ACPICA upstream.
Thanks and best regards
-Lv
Quoted 279 lines
---
From: Rafael J. Wysocki <[email protected]>
Subject: [PATCH] ACPICA: Drop Linux-specific waking vector functionsCommit
f06147f9fbf1(ACPICA: Hardware: Enable firmware waking vector for both 32-bit and 64-bit FACS) added three functions that aren't present in upstream ACPICA,acpi_hw_set_firmware_waking_vectors(),acpi_set_firmware_waking_vectors()andacpi_set_firmware_waking_vector64(),
to allow Linux to use the previously existing API for setting the platform firmware waking vector.However, that wasn't necessary, since the ACPI sleep support code in Linux can be modified to use the upstream ACPICA's API easily and the additional functions may be dropped which reduces the code size and puts the kernel's ACPICA code more in line with the upstream.
Make the changes as per the above. While at it, make the relevant function desctiption comments reflect the upstream ACPICA's ones.
Signed-off-by Rafael J. Wysocki <[email protected]>Acked-by Lv Zheng <[email protected]>--- drivers/acpi/acpica/hwxfsleep.c | 96 +++++++--------------------------------- drivers/acpi/sleep.c | 4 - drivers/acpi/sleep.h | 6 ++ include/acpi/acpixf.h | 10 ---- 4 files changed, 28 insertions(+), 88 deletions(-)Index:
linux-pm/drivers/acpi/acpica/hwxfsleep.c
================================================================
===drivers/acpi/acpica/hwxfsleep.c +6
-8@@ -52,9 +52,9 @@ ACPI_MODULE_NAME("hwxfsleep")/* Local prototypes */ #if (!ACPI_REDUCED_HARDWARE )static acpi_status -acpi_hw_set_firmware_waking_vectors (struct acpi_table_facs *facs, -acpi_physical_address physical_address, -acpi_physical_address physical_address64); +acpi_hw_set_firmware_waking_vector (struct acpi_table_facs *facs, +acpi_physical_address physical_address, +acpi_physical_address physical_address64);#endif static acpi_status acpi_hw_sleep_dispatch (u8 sleep_state,u32 function_id);@@ -79,22 +79,20 @@ static struct acpi_sleep_functions acpi_/* * These functions are removed for the ACPI_REDUCED_HARDWARE case: -* acpi_set_firmware_waking_vectors * acpi_set_firmware_waking_vector -* acpi_set_firmware_waking_vector64 * acpi_enter_sleep_state_s4bios */ #if (!ACPI_REDUCED_HARDWARE )/*************************************************************** **************** * -* FUNCTION: acpi_hw_set_firmware_waking_vectors +* FUNCTION: acpi_hw_set_firmware_waking_vector * * PARAMETERS: facs - Pointer to FACS table * physical_address - 32-bit physical address of ACPI real mode -* entry point. +* entry point * physical_address64 - 64-bit physical address of ACPI protected -* mode entry point. +* mode entry point * * RETURN: Status
*drivers/acpi/acpica/hwxfsleep.c +4
-4@@ -103,11 +101,11 @@ static struct acpi_sleep_functions acpi_**************************************************************** **************/ static acpi_status -acpi_hw_set_firmware_waking_vectors (struct acpi_table_facs *facs, -acpi_physical_address physical_address, -acpi_physical_address physical_address64) +acpi_hw_set_firmware_waking_vector (struct acpi_table_facs *facs, +acpi_physical_address physical_address, +acpi_physical_address physical_address64) { -ACPI_FUNCTION_TRACE (acpi_hw_set_firmware_waking_vectors); +ACPI_FUNCTION_TRACE (acpi_hw_set_firmware_waking_vector);drivers/acpi/acpica/hwxfsleep.c +1
-1/* @@ -140,12 +138,12 @@ acpi_hw_set_firmware_waking_vectors(stru/*************************************************************** **************** * -* FUNCTION: acpi_set_firmware_waking_vectors +* FUNCTION: acpi_set_firmware_waking_vector * * PARAMETERS: physical_address - 32-bit physical address of ACPI real mode
- * entry point.
+ * entry point
*physical_address64- 64-bit physical address of ACPI protected
- * mode entry point.
+ * mode entry point
*
* RETURN: Status
*drivers/acpi/acpica/hwxfsleep.c +6
-13@@ -154,79 +152,23 @@ acpi_hw_set_firmware_waking_vectors(stru**************************************************************** **************/ acpi_status -acpi_set_firmware_waking_vectors (acpi_physical_address physical_address, -acpi_physical_address physical_address64) +acpi_set_firmware_waking_vector (acpi_physical_address physical_address, +acpi_physical_address physical_address64) { -ACPI_FUNCTION_TRACE (acpi_set_firmware_waking_vectors); +ACPI_FUNCTION_TRACE (acpi_set_firmware_waking_vector);if (acpi_gbl_FACS) { - (void )acpi_hw_set_firmware_waking_vectors (acpi_gbl_FACS, - physical_address, - physical_address64); + (void )acpi_hw_set_firmware_waking_vector (acpi_gbl_FACS, + physical_address, + physical_address64); }return_ACPI_STATUS (AE_OK ); } -ACPI_EXPORT_SYMBOL (acpi_set_firmware_waking_vectors) - -/*************************************************************** **************** -* -* FUNCTION: acpi_set_firmware_waking_vector -* -* PARAMETERS: physical_address - 32-bit physical address of ACPI real mode
- * entry point.
- *
- * RETURN: Status
- *
- * DESCRIPTION: Sets the 32-bitfirmware_waking_vectorfield of the FACS
- *
-
****************************************************************
**************/drivers/acpi/acpica/hwxfsleep.c +0
-14-acpi_status acpi_set_firmware_waking_vector (u32 physical_address) -{ -acpi_status status; - -ACPI_FUNCTION_TRACE (acpi_set_firmware_waking_vector); - - status =acpi_set_firmware_waking_vectors ((acpi_physical_address ) - physical_address,0 ); - -return_ACPI_STATUS (status); -} -ACPI_EXPORT_SYMBOL (acpi_set_firmware_waking_vector) -#if ACPI_MACHINE_WIDTH ==64 -/***************************************************************
****************
- *
- * FUNCTION:acpi_set_firmware_waking_vector64
- *
- * PARAMETERS:physical_address- 64-bit physical address of ACPI
protected
- * mode entry point.
- *
- * RETURN: Status
- *
- * DESCRIPTION: Sets the 64-bitX_firmware_waking_vectorfield of the FACS, if
- * it exists in the table. This function is intended for use with
- * 64-bit host operating systems.
- *
-
****************************************************************
**************/drivers/acpi/acpica/hwxfsleep.c +0
-15-acpi_status acpi_set_firmware_waking_vector64 (u64 physical_address) -{ -acpi_status status; - -ACPI_FUNCTION_TRACE (acpi_set_firmware_waking_vector64); - - status =acpi_set_firmware_waking_vectors (0 , - (acpi_physical_address ) - physical_address); - -return_ACPI_STATUS (status); -} - -ACPI_EXPORT_SYMBOL(acpi_set_firmware_waking_vector64) -#endif /***************************************************************
****************
*
* FUNCTION:acpi_enter_sleep_state_s4bios
Index:linux-pm/include/acpi/acpixf.h
================================================================
===include/acpi/acpixf.h +1
-9@@ -863,17 +863,9 @@ ACPI_EXTERNAL_RETURN_STATUS(acpi_status ACPI_EXTERNAL_RETURN_STATUS(acpi_status acpi_leave_sleep_state(u8 sleep_state)) ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status - acpi_set_firmware_waking_vectors + acpi_set_firmware_waking_vector (acpi_physical_address physical_address, acpi_physical_address physical_address64)) -ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status - acpi_set_firmware_waking_vector(u32 - physical_address)) -#if ACPI_MACHINE_WIDTH == 64 -ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status -acpi_set_firmware_waking_vector64 (u64 - physical_address)) -#endif/*
* ACPI Timer interfaces
*/
Index:linux-pm/drivers/acpi/sleep.c
================================================================
===drivers/acpi/sleep.c +2
-2@@ -61,7 +61,7 @@ static int acpi_sleep_prepare(u32 acpi_sif (acpi_state ==ACPI_STATE_S3 ) {if (!acpi_wakeup_address)return -EFAULT ; -acpi_set_firmware_waking_vector (acpi_wakeup_address); +acpi_set_waking_vector (acpi_wakeup_address); }ACPI_FLUSH_CPU_CACHE ();@@ -410,7 +410,7 @@ static void acpi_pm_finish(void)acpi_leave_sleep_state (acpi_state);/* reset firmware waking vector */ -acpi_set_firmware_waking_vector ((acpi_physical_address )0 ); +acpi_set_waking_vector (0 ); acpi_target_sleep_state =ACPI_STATE_S0 ;Index:
linux-pm/drivers/acpi/sleep.h
================================================================
===drivers/acpi/sleep.h +6
-0@@ -6,3 +6,9 @@ extern struct list_head acpi_wakeup_deviextern struct mutex acpi_device_lock;extern void acpi_resume_power_resources (void ); + +static inline acpi_status acpi_set_waking_vector (u32 wakeup_address) +{ +return acpi_set_firmware_waking_vector ( + (acpi_physical_address )wakeup_address,0 ); +}