Skip to contentSkip to conversation

ACPICA: 20150619 Release

PATCH Superseded Lv Zheng 7 participants 118 messages Jun 19, 2015 – Jul 2, 2015 Page 1 of 2

Subsystems (3)
lore
Share & tools
lore

Lv Zheng

author
#0 lore raw

cover ACPICA: 20150619 Release

The 20150619 ACPICA kernel-resident subsystem updates are linuxized based on the linux-pm/linux-next branch.

The patchset has passed the following build/boot tests. Build tests are performed as follows:
1. i386 + default + COFNIG_ACPI=y
2. i386 + allyes + CONFIG_ACPI=y
3. i386 + default + COFNIG_ACPI=n
4. i386 + allyes + CONFIG_ACPI=n
5. x86_64 + default + COFNIG_ACPI=y
6. x86_64 + allyes + CONFIG_ACPI=y
7. x86_64 + default + COFNIG_ACPI=n
8. x86_64 + allyes + CONFIG_ACPI=n
Boot tests are performed as follows:
1. i386 + default + COFNIG_ACPI=y
2. x86_64 + default + COFNIG_ACPI=y
Where:
1. i386: machine named as "Dell Inspiron Mini 1010"
2. x86_64: machine named as "HP Compaq 8200 Elite SFF PC"
3. default: kernel configuration with following items enabled:
All hardware drivers related to the machines of i386/x86_64 All drivers/acpi configurations
All platform drivers

The divergences checking result:
Before applying (20150515 Release):
565 lines
After applying (20150619 Release):
539 lines

Bob Moore (10):
ACPICA: Remove a prototype for the reduced hardware case.
ACPICA: Namespace: Add support of OSDT table.
ACPICA: Namespace: Change namespace override to avoid node deletion.
ACPICA: Cleanup output for the ASL Debug object.
ACPICA: De-macroize calls to standard C library functions.
ACPICA: Finish C library name transition.
ACPICA: Split C library prototypes to new header.
ACPICA: Update definitions for the TCPA and TPM2 ACPI tables.
ACPICA: Update TPM2 ACPI table.
ACPICA: Update version to 20150619.

Hanjun Guo (1):
ACPICA: ACPI 6.0: Add values for MADT GIC version field.

Lv Zheng (17):
ACPICA: Linuxize: Reduce divergences for 20150616 release.
ACPICA: Linuxize: Replace __FUNCTION__ with __func__.
ACPICA: Hardware: Enable 64-bit firmware waking vector for selected
FACS.
ACPI: sleep: Update acpi_set_firmware_waking_vector() invocations to
favor 32-bit firmware waking vector.
ACPICA: Tables: Enable both 32-bit and 64-bit FACS.
ACPICA: Hardware: Enable firmware waking vector for both 32-bit and

    64-bit FACS.

ACPICA: Hardware: Cleanup the return values in
acpi_set_waking_vector().
ACPICA: Tables: Fix an issue that FACS initialization is performed
twice.
ACPICA: Tables: Fix an issue that ACPI initialization is blocked due
to no FACS.
ACPICA: Tables: Enable default 64-bit FADT addresses favor.
ACPICA: MSVC6: Fix build issue for variable argument macros.
ACPICA: EFI: Add EFI interface definitions to eliminate dependency of
GNU EFI.
ACPICA: Namespace: Add support to allow overriding objects.
ACPICA: acpidump: Allow customized tables to be dumped without
accessing /dev/mem.
ACPICA: acpidump: Convert the default behavior to dump from
/sys/firmware/acpi/tables.
ACPI / acpidump: Update acpidump manual.
ACPICA: Clib: Correct memset() declarations.

Sascha Wildner (1):
ACPICA: Add dragon_fly support to unix file mapping file.

Suravee Suthikulpanit (1):
ACPICA: Utilities: Add _CLS processing

Zhang Rui (1):
ACPICA: Update for acpi_install_table memory types.

gongzg (1):
ACPICA: Comment update, no functional change.

 arch/ia64/include/asm/acpi.h                       |    3 +-
 arch/ia64/kernel/acpi.c                            |    2 -
 arch/x86/include/asm/acpi.h                        |    3 +-
 drivers/acpi/acpica/accommon.h                     |    3 +
 drivers/acpi/acpica/acglobal.h                     |    2 +
 drivers/acpi/acpica/acinterp.h                     |    2 +
 drivers/acpi/acpica/aclocal.h                      |    1 +
 drivers/acpi/acpica/acnamesp.h                     |    1 +
 drivers/acpi/acpica/acobject.h                     |    1 +
 drivers/acpi/acpica/acstruct.h                     |    1 +
 drivers/acpi/acpica/acutils.h                      |   64 +------------
 drivers/acpi/acpica/dsfield.c                      |    2 +-
 drivers/acpi/acpica/dsinit.c                       |    2 +-
 drivers/acpi/acpica/dsobject.c                     |    7 +-
 drivers/acpi/acpica/dsutils.c                      |    4 +-
 drivers/acpi/acpica/dswload.c                      |   17 +++-
 drivers/acpi/acpica/evgpeinit.c                    |    2 +-
 drivers/acpi/acpica/exconfig.c                     |    2 +-
 drivers/acpi/acpica/exconvrt.c                     |    9 +-
 drivers/acpi/acpica/exdebug.c                      |   42 +++++++-
 drivers/acpi/acpica/exdump.c                       |    9 +-
 drivers/acpi/acpica/exfield.c                      |    2 +-
 drivers/acpi/acpica/exfldio.c                      |   52 +++++-----
 drivers/acpi/acpica/exmisc.c                       |   36 +++----
 drivers/acpi/acpica/exnames.c                      |    2 +-
 drivers/acpi/acpica/exoparg2.c                     |    8 +-
 drivers/acpi/acpica/exoparg3.c                     |    4 +-
 drivers/acpi/acpica/exregion.c                     |    9 +-
 drivers/acpi/acpica/exstorob.c                     |   18 ++--
 drivers/acpi/acpica/exutils.c                      |   32 +++++++
 drivers/acpi/acpica/hwxfsleep.c                    |   85 +++++++++++------
 drivers/acpi/acpica/nsaccess.c                     |   16 +++-
 drivers/acpi/acpica/nsconvert.c                    |   10 +-
 drivers/acpi/acpica/nsdump.c                       |    2 +-
 drivers/acpi/acpica/nseval.c                       |    7 +-
 drivers/acpi/acpica/nsinit.c                       |    4 +-
 drivers/acpi/acpica/nsparse.c                      |    7 ++
 drivers/acpi/acpica/nsrepair2.c                    |    2 +-
 drivers/acpi/acpica/nssearch.c                     |   37 +++++++-
 drivers/acpi/acpica/nsutils.c                      |    3 +-
 drivers/acpi/acpica/nsxfeval.c                     |    5 +-
 drivers/acpi/acpica/nsxfname.c                     |   29 ++++--
 drivers/acpi/acpica/psutils.c                      |    7 +-
 drivers/acpi/acpica/rscreate.c                     |    6 +-
 drivers/acpi/acpica/rsmisc.c                       |    8 +-
 drivers/acpi/acpica/rsutils.c                      |   13 ++-
 drivers/acpi/acpica/rsxface.c                      |    8 +-
 drivers/acpi/acpica/tbdata.c                       |    8 +-
 drivers/acpi/acpica/tbfadt.c                       |   27 +++---
 drivers/acpi/acpica/tbfind.c                       |   21 ++--
 drivers/acpi/acpica/tbinstal.c                     |    7 +-
 drivers/acpi/acpica/tbprint.c                      |   10 +-
 drivers/acpi/acpica/tbutils.c                      |   37 +++++---
 drivers/acpi/acpica/tbxface.c                      |   17 ++--
 drivers/acpi/acpica/tbxfload.c                     |   17 ++--
 drivers/acpi/acpica/utalloc.c                      |    6 +-
 drivers/acpi/acpica/utbuffer.c                     |    4 +-
 drivers/acpi/acpica/utcache.c                      |    6 +-
 drivers/acpi/acpica/utcopy.c                       |   42 ++++----
 drivers/acpi/acpica/utdebug.c                      |    4 +-
 drivers/acpi/acpica/utids.c                        |  100 ++++++++++++++++++--
 drivers/acpi/acpica/utmisc.c                       |    9 +-
 drivers/acpi/acpica/utosi.c                        |    9 +-
 drivers/acpi/acpica/utpredef.c                     |    4 +-
 drivers/acpi/acpica/utprint.c                      |    6 +-
 drivers/acpi/acpica/utstring.c                     |   33 ++++---
 drivers/acpi/acpica/uttrack.c                      |    8 +-
 drivers/acpi/acpica/utxface.c                      |    8 +-
 drivers/acpi/acpica/utxfinit.c                     |   10 +-
 drivers/acpi/sleep.c                               |    8 +-
 include/acpi/acnames.h                             |    1 +
 include/acpi/acoutput.h                            |   13 ++-
 include/acpi/acpixf.h                              |   31 ++++--
 include/acpi/actbl.h                               |    1 +
 include/acpi/actbl1.h                              |   11 +++
 include/acpi/actbl2.h                              |   80 ++++++++++++++--
 include/acpi/actbl3.h                              |   34 +------
 include/acpi/actypes.h                             |   33 ++++---
 include/acpi/platform/acenv.h                      |   39 --------
 include/acpi/platform/acenvex.h                    |    6 ++
 include/acpi/platform/acgcc.h                      |    4 +
 tools/power/acpi/common/getopt.c                   |    4 +-
 tools/power/acpi/man/acpidump.8                    |   17 +++-
 .../acpi/os_specific/service_layers/oslinuxtbl.c   |   95 ++++++++++---------
 .../acpi/os_specific/service_layers/osunixmap.c    |    2 +-
 tools/power/acpi/tools/acpidump/acpidump.h         |    2 +-
 tools/power/acpi/tools/acpidump/apdump.c           |    8 +-
 tools/power/acpi/tools/acpidump/apfiles.c          |   12 +--
 tools/power/acpi/tools/acpidump/apmain.c           |   15 ++-
 89 files changed, 851 insertions(+), 549 deletions(-)
Signature · 1 line
1.7.10
author
#1 lore raw

PATCH 1/32 ACPICA: Linuxize: Reduce divergences for 20150616 release.

This patch reduces source code differences between the Linux kernel and the ACPICA upstream so that the linuxized ACPICA 20150616 release can be applied with reduced human intervention.

---
 drivers/acpi/acpica/dsobject.c  |    2 +-
 drivers/acpi/acpica/hwxfsleep.c |    2 --
 drivers/acpi/acpica/rscreate.c  |    2 +-
 drivers/acpi/acpica/rsutils.c   |    2 +-
 drivers/acpi/acpica/tbxface.c   |    1 +
 include/acpi/platform/acenv.h   |    1 -
 6 files changed, 4 insertions(+), 6 deletions(-)
drivers/acpi/acpica/dsobject.c +1 -1
index 8a7b07b..4a4b2f3 100644
@@ -751,7 +751,7 @@ acpi_ds_init_object_from_op(struct acpi_walk_state *walk_state,
 
 		obj_desc->string.pointer = op->common.value.string;
 		obj_desc->string.length =
-		    (u32) ACPI_STRLEN(op->common.value.string);
+		    (u32)ACPI_STRLEN(op->common.value.string);
 
 		/*
 		 * The string is contained in the ACPI table, don't ever try
drivers/acpi/acpica/hwxfsleep.c +0 -2
index 3b37676..82e310b 100644
@@ -138,7 +138,6 @@ acpi_status acpi_set_firmware_waking_vector64(u64 physical_address)
 {
 	ACPI_FUNCTION_TRACE(acpi_set_firmware_waking_vector64);
 
-
 	/* Determine if the 64-bit vector actually exists */
 
 	if ((acpi_gbl_FACS->length <= 32) || (acpi_gbl_FACS->version < 1)) {
@@ -154,7 +153,6 @@ acpi_status acpi_set_firmware_waking_vector64(u64 physical_address)
 
 ACPI_EXPORT_SYMBOL(acpi_set_firmware_waking_vector64)
 #endif
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_enter_sleep_state_s4bios
drivers/acpi/acpica/rscreate.c +1 -1
index 15434e4..f30f35e 100644
@@ -353,7 +353,7 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object,
 				/* +1 to include null terminator */
 
 				user_prt->length +=
-				    (u32) ACPI_STRLEN(user_prt->source) + 1;
+				    (u32)ACPI_STRLEN(user_prt->source) + 1;
 				break;
 
 			case ACPI_TYPE_STRING:
drivers/acpi/acpica/rsutils.c +1 -1
index ece3cd6..90417de 100644
@@ -367,7 +367,7 @@ acpi_rs_get_resource_source(acpi_rs_length resource_length,
 		    (u32)
 		    ACPI_STRLEN(ACPI_CAST_PTR(char, &aml_resource_source[1])) +
 		    1;
-		total_length = (u32) ACPI_ROUND_UP_TO_NATIVE_WORD(total_length);
+		total_length = (u32)ACPI_ROUND_UP_TO_NATIVE_WORD(total_length);
 
 		ACPI_MEMSET(resource_source->string_ptr, 0, total_length);
 
drivers/acpi/acpica/tbxface.c +1 -0
index 60e94f8..54b9f79 100644
@@ -242,6 +242,7 @@ acpi_get_table_header(char *signature,
 				if (!header) {
 					return (AE_NO_MEMORY);
 				}
+
 				ACPI_MEMCPY(out_table_header, header,
 					    sizeof(struct acpi_table_header));
 				acpi_os_unmap_memory(header,
include/acpi/platform/acenv.h +0 -1
index 073997d..1e84e62 100644
@@ -359,7 +359,6 @@
 #define ACPI_MEMCMP(s1,s2,n)    memcmp((const char *)(s1), (const char *)(s2), (acpi_size)(n))
 #define ACPI_MEMCPY(d,s,n)      (void) memcpy((d), (s), (acpi_size)(n))
 #define ACPI_MEMSET(d,s,n)      (void) memset((d), (s), (acpi_size)(n))
-
 #define ACPI_TOUPPER(i)         toupper((int) (i))
 #define ACPI_TOLOWER(i)         tolower((int) (i))
 #define ACPI_IS_XDIGIT(i)       isxdigit((int) (i))
Signature · 1 line
1.7.10
author
#2 lore raw

PATCH 2/32 ACPICA: Linuxize: Replace __FUNCTION__ with __func__.

In reply to Lv Zheng

ACPICA commit cb3d1c79f862cd368d749c9b8d9dced40111b0d0

__FUNCTION__ is MSVC only, in Linux, it is __func__. Lv Zheng.

In ACPICA, this is achieved by string replacement in release script and this patch contains the source code difference between the Linux upstream and ACPICA that is caused by the back porting.

---
 drivers/acpi/acpica/utdebug.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/acpi/acpica/utdebug.c +2 -2
index 4f3f888..cd02693 100644
@@ -111,8 +111,8 @@ void acpi_ut_track_stack_ptr(void)
  * RETURN:      Updated pointer to the function name
  *
  * DESCRIPTION: Remove the "Acpi" prefix from the function name, if present.
- *              This allows compiler macros such as __func__ to be used with no
- *              change to the debug output.
+ *              This allows compiler macros such as __func__ to be used
+ *              with no change to the debug output.
  *
  ******************************************************************************/
 
Signature · 1 line
1.7.10
author
#3 lore raw

PATCH 3/32 ACPICA: Hardware: Enable 64-bit firmware waking vector for selected FACS.

In reply to Lv Zheng

ACPICA commit 7aa598d711644ab0de5f70ad88f1e2de253115e4

The root cause of the reported bug might be one of the followings:
1. BIOS may favor the 64-bit firmware waking vector address when the version of the FACS is greater than 0 and Linux currently only supports resuming from the real mode, so the 64-bit firmware waking vector has never been set and might be invalid to BIOS while the commit enables higher version FACS.
2. BIOS may favor the FACS reported via the "FIRMWARE_CTRL" field in the FADT while the commit doesn't set the firmware waking vector address of the FACS reported by "FIRMWARE_CTRL", it only sets the firware waking vector address of the FACS reported by "X_FIRMWARE_CTRL".

This patch excludes the cases that can trigger the bugs caused by the root cause 1.

ACPI specification says:
A. 32-bit FACS address (FIRMWARE_CTRL field in FADT):
Physical memory address of the FACS, where OSPM and firmware exchange control information.
If the X_FIRMWARE_CTRL field contains a non zero value then this field must be zero.
A zero value indicates that no FACS is specified by this field.
B. 64-bit FACS address (X_FIRMWARE_CTRL field in FADT):
64bit physical memory address of the FACS.
This field is used when the physical address of the FACS is above 4GB. If the FIRMWARE_CTRL field contains a non zero value then this field must be zero.
A zero value indicates that no FACS is specified by this field.
Thus the 32bit and 64bit firmware waking vector should indicate completely different resuming environment - real mode (1MB addressable) and non real mode (4GB+ addressable) and currently Linux only supports resuming from real mode.

This patch enables 64-bit firmware waking vector for selected FACS via acpi_set_firmware_waking_vector() so that it's up to OSPMs to determine which resuming mode should be used by BIOS and ACPICA changes won't trigger the bugs caused by the root cause 1. For example, Linux can pass physical_address64=0 as the parameter of acpi_set_firmware_waking_vector() to indicate no 64bit waking vector support. Lv Zheng.

---
 drivers/acpi/acpica/hwxfsleep.c |   61 ++++++++++++---------------------------
 include/acpi/acpixf.h           |   11 +++----
 2 files changed, 23 insertions(+), 49 deletions(-)
drivers/acpi/acpica/hwxfsleep.c +19 -42
index 82e310b..c67cd32 100644
@@ -73,7 +73,6 @@ static struct acpi_sleep_functions acpi_sleep_dispatch[] = {
 /*
  * These functions are removed for the ACPI_REDUCED_HARDWARE case:
  *      acpi_set_firmware_waking_vector
- *      acpi_set_firmware_waking_vector64
  *      acpi_enter_sleep_state_s4bios
  */
 
@@ -83,15 +82,19 @@ static struct acpi_sleep_functions acpi_sleep_dispatch[] = {
  * 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
+ *                                    entry point
  *
  * RETURN:      Status
  *
- * DESCRIPTION: Sets the 32-bit firmware_waking_vector field of the FACS
+ * DESCRIPTION: Sets the firmware_waking_vector fields of the FACS
  *
  ******************************************************************************/
 
-acpi_status acpi_set_firmware_waking_vector(u32 physical_address)
+acpi_status
+acpi_set_firmware_waking_vector(acpi_physical_address physical_address,
+				acpi_physical_address physical_address64)
 {
 	ACPI_FUNCTION_TRACE(acpi_set_firmware_waking_vector);
 
@@ -106,53 +109,27 @@ acpi_status acpi_set_firmware_waking_vector(u32 physical_address)
 
 	/* Set the 32-bit vector */
 
-	acpi_gbl_FACS->firmware_waking_vector = physical_address;
+	acpi_gbl_FACS->firmware_waking_vector = (u32)physical_address;
 
-	/* Clear the 64-bit vector if it exists */
+	if (acpi_gbl_FACS->length > 32) {
+		if (acpi_gbl_FACS->version >= 1) {
 
-	if ((acpi_gbl_FACS->length > 32) && (acpi_gbl_FACS->version >= 1)) {
-		acpi_gbl_FACS->xfirmware_waking_vector = 0;
-	}
-
-	return_ACPI_STATUS(AE_OK);
-}
-
-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_FUNCTION_TRACE(acpi_set_firmware_waking_vector64);
+			/* Set the 64-bit vector */
 
-	/* Determine if the 64-bit vector actually exists */
+			acpi_gbl_FACS->xfirmware_waking_vector =
+			    physical_address64;
+		} else {
+			/* Clear the 64-bit vector if it exists */
 
-	if ((acpi_gbl_FACS->length <= 32) || (acpi_gbl_FACS->version < 1)) {
-		return_ACPI_STATUS(AE_NOT_EXIST);
+			acpi_gbl_FACS->xfirmware_waking_vector = 0;
+		}
 	}
 
-	/* Clear 32-bit vector, set the 64-bit X_ vector */
-
-	acpi_gbl_FACS->firmware_waking_vector = 0;
-	acpi_gbl_FACS->xfirmware_waking_vector = physical_address;
 	return_ACPI_STATUS(AE_OK);
 }
 
-ACPI_EXPORT_SYMBOL(acpi_set_firmware_waking_vector64)
-#endif
+ACPI_EXPORT_SYMBOL(acpi_set_firmware_waking_vector)
+
 /*******************************************************************************
  *
  * FUNCTION:    acpi_enter_sleep_state_s4bios
include/acpi/acpixf.h +4 -7
index d68f1cd..a68e4b9 100644
@@ -814,13 +814,10 @@ 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_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_set_firmware_waking_vector
+				(acpi_physical_address physical_address,
+				 acpi_physical_address physical_address64))
+
 /*
  * ACPI Timer interfaces
  */
Signature · 1 line
1.7.10
#4 lore raw

Re: [PATCH 03/32] ACPICA: Hardware: Enable 64-bit firmware waking vector for selected FACS.

Quoted 3 lines · Lv Zheng

ACPICA commit 7aa598d711644ab0de5f70ad88f1e2de253115e4

The root cause of the reported bug might be one of the followings:

Care to describe the bug in the changelog too? And in a few following changelogs as well?

Quoted 9 lines

1. BIOS may favor the 64-bit firmware waking vector address when the version of the FACS is greater than 0 and Linux currently only supports resuming from the real mode, so the 64-bit firmware waking vector has never been set and might be invalid to BIOS while the commit enables higher version FACS.
2. BIOS may favor the FACS reported via the "FIRMWARE_CTRL" field in the FADT while the commit doesn't set the firmware waking vector address of the FACS reported by "FIRMWARE_CTRL", it only sets the firware waking vector address of the FACS reported by "X_FIRMWARE_CTRL".

Signature · 4 lines
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.
--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
#5 lore raw

Re: [PATCH 03/32] ACPICA: Hardware: Enable 64-bit firmware waking vector for selected FACS.

In reply to Lv Zheng
Quoted 12 lines · Lv Zheng

ACPICA commit 7aa598d711644ab0de5f70ad88f1e2de253115e4

The root cause of the reported bug might be one of the followings:
1. BIOS may favor the 64-bit firmware waking vector address when the version of the FACS is greater than 0 and Linux currently only supports resuming from the real mode, so the 64-bit firmware waking vector has never been set and might be invalid to BIOS while the commit enables higher version FACS.
2. BIOS may favor the FACS reported via the "FIRMWARE_CTRL" field in the FADT while the commit doesn't set the firmware waking vector address of the FACS reported by "FIRMWARE_CTRL", it only sets the firware waking vector address of the FACS reported by "X_FIRMWARE_CTRL".

I need to go through patches [03-07/32] in detial. I need to understand clearly what's going on in them, but I'm too tired for that today.

I'll get back to them next week.

Thanks,
Rafael

--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in

#6 lore raw

Re: [PATCH 03/32] ACPICA: Hardware: Enable 64-bit firmware waking vector for selected FACS.

In reply to Lv Zheng

Hi Lv,

Quoted 10 lines · Lv Zheng

ACPICA commit 7aa598d711644ab0de5f70ad88f1e2de253115e4

The root cause of the reported bug might be one of the followings:
1. BIOS may favor the 64-bit firmware waking vector address when the version of the FACS is greater than 0 and Linux currently only supports resuming from the real mode, so the 64-bit firmware waking vector has never been set and might be invalid to BIOS while the commit enables higher version FACS.
2. BIOS may favor the FACS reported via the "FIRMWARE_CTRL" field in the FADT while the commit doesn't set the firmware waking vector address of

Can you please tell me which commit this is about?

Quoted 2 lines

the FACS reported by "FIRMWARE_CTRL", it only sets the firware waking vector address of the FACS reported by "X_FIRMWARE_CTRL".

Thanks,
Rafael

author
#7 lore raw

RE: [PATCH 03/32] ACPICA: Hardware: Enable 64-bit firmware waking vector for selected FACS.

Hi, Rafael

Quoted 17 lines

From: [email protected] [mailto:[email protected]] On Behalf Of Rafael J. Wysocki
Sent: Tuesday, June 23, 2015 11:21 PM

Hi Lv,

Quoted 10 lines · Lv Zheng

ACPICA commit 7aa598d711644ab0de5f70ad88f1e2de253115e4

The root cause of the reported bug might be one of the followings:
1. BIOS may favor the 64-bit firmware waking vector address when the version of the FACS is greater than 0 and Linux currently only supports resuming from the real mode, so the 64-bit firmware waking vector has never been set and might be invalid to BIOS while the commit enables higher version FACS.
2. BIOS may favor the FACS reported via the "FIRMWARE_CTRL" field in the FADT while the commit doesn't set the firmware waking vector address of

Quoted 1 line

Can you please tell me which commit this is about?

It's the bisected commit on the Bugzilla entry:
https://bugzilla.kernel.org/show_bug.cgi?id=74021#c23
Since the part of this series originally belongs to a regression fix series, the commit is not mentioned again here. Let me update the description.

Thanks and best regards
-Lv

Quoted 6 lines
Quoted 3 lines

the FACS reported by "FIRMWARE_CTRL", it only sets the firware waking vector address of the FACS reported by "X_FIRMWARE_CTRL".

Thanks,
Rafael

#8 lore raw

Re: [PATCH 03/32] ACPICA: Hardware: Enable 64-bit firmware waking vector for selected FACS.

In reply to Lv Zheng
Quoted 41 lines · Lv Zheng

ACPICA commit 7aa598d711644ab0de5f70ad88f1e2de253115e4

The root cause of the reported bug might be one of the followings:
1. BIOS may favor the 64-bit firmware waking vector address when the version of the FACS is greater than 0 and Linux currently only supports resuming from the real mode, so the 64-bit firmware waking vector has never been set and might be invalid to BIOS while the commit enables higher version FACS.
2. BIOS may favor the FACS reported via the "FIRMWARE_CTRL" field in the FADT while the commit doesn't set the firmware waking vector address of the FACS reported by "FIRMWARE_CTRL", it only sets the firware waking vector address of the FACS reported by "X_FIRMWARE_CTRL".

This patch excludes the cases that can trigger the bugs caused by the root cause 1.

ACPI specification says:
A. 32-bit FACS address (FIRMWARE_CTRL field in FADT):
Physical memory address of the FACS, where OSPM and firmware exchange control information.
If the X_FIRMWARE_CTRL field contains a non zero value then this field must be zero.
A zero value indicates that no FACS is specified by this field.
B. 64-bit FACS address (X_FIRMWARE_CTRL field in FADT):
64bit physical memory address of the FACS.
This field is used when the physical address of the FACS is above 4GB. If the FIRMWARE_CTRL field contains a non zero value then this field must be zero.
A zero value indicates that no FACS is specified by this field.
Thus the 32bit and 64bit firmware waking vector should indicate completely different resuming environment - real mode (1MB addressable) and non real mode (4GB+ addressable) and currently Linux only supports resuming from real mode.

This patch enables 64-bit firmware waking vector for selected FACS via acpi_set_firmware_waking_vector() so that it's up to OSPMs to determine which resuming mode should be used by BIOS and ACPICA changes won't trigger the bugs caused by the root cause 1. For example, Linux can pass physical_address64=0 as the parameter of acpi_set_firmware_waking_vector() to indicate no 64bit waking vector support. Lv Zheng.

Quoted 5 lines

So what the patch does is to replace two functions, acpi_set_firmware_waking_vector() taking one u32 argument and acpi_set_firmware_waking_vector64() taking one u64 argument, with a modified acpi_set_firmware_waking_vector() taking two arguments of type acpi_physical_address. And it breaks compliation when applied to Linux as is AFAICS, doesn't it?

I guess the point is to allow the OS to set firmware_waking_vector *and* clear xfirmware_waking_vector at the same time (by passing 0 as the second argument of the function). And that helps to address the issue when xfirmware_waking_vector has a random value to start with, we don't clear it and the BIOS thinks it is OK to use it, right?

If that's the case, this patch should be combined with [4/32] and the signal-to-noise ratio of [4/32] needs to be increased quite a bit.

Rafael

author
#9 lore raw

RE: [PATCH 03/32] ACPICA: Hardware: Enable 64-bit firmware waking vector for selected FACS.

Hi, Rafael

Quoted 51 lines

From: Rafael J. Wysocki [mailto:[email protected]]
Sent: Wednesday, June 24, 2015 8:30 AM

Quoted 41 lines · Lv Zheng

ACPICA commit 7aa598d711644ab0de5f70ad88f1e2de253115e4

The root cause of the reported bug might be one of the followings:
1. BIOS may favor the 64-bit firmware waking vector address when the version of the FACS is greater than 0 and Linux currently only supports resuming from the real mode, so the 64-bit firmware waking vector has never been set and might be invalid to BIOS while the commit enables higher version FACS.
2. BIOS may favor the FACS reported via the "FIRMWARE_CTRL" field in the FADT while the commit doesn't set the firmware waking vector address of the FACS reported by "FIRMWARE_CTRL", it only sets the firware waking vector address of the FACS reported by "X_FIRMWARE_CTRL".

This patch excludes the cases that can trigger the bugs caused by the root cause 1.

ACPI specification says:
A. 32-bit FACS address (FIRMWARE_CTRL field in FADT):
Physical memory address of the FACS, where OSPM and firmware exchange control information.
If the X_FIRMWARE_CTRL field contains a non zero value then this field must be zero.
A zero value indicates that no FACS is specified by this field.
B. 64-bit FACS address (X_FIRMWARE_CTRL field in FADT):
64bit physical memory address of the FACS.
This field is used when the physical address of the FACS is above 4GB. If the FIRMWARE_CTRL field contains a non zero value then this field must be zero.
A zero value indicates that no FACS is specified by this field.
Thus the 32bit and 64bit firmware waking vector should indicate completely different resuming environment - real mode (1MB addressable) and non real mode (4GB+ addressable) and currently Linux only supports resuming from real mode.

This patch enables 64-bit firmware waking vector for selected FACS via acpi_set_firmware_waking_vector() so that it's up to OSPMs to determine which resuming mode should be used by BIOS and ACPICA changes won't trigger the bugs caused by the root cause 1. For example, Linux can pass physical_address64=0 as the parameter of acpi_set_firmware_waking_vector() to indicate no 64bit waking vector support. Lv Zheng.

Quoted 5 lines
Quoted 5 lines

So what the patch does is to replace two functions, acpi_set_firmware_waking_vector() taking one u32 argument and acpi_set_firmware_waking_vector64() taking one u64 argument, with a modified acpi_set_firmware_waking_vector() taking two arguments of type acpi_physical_address. And it breaks compliation when applied to Linux as is AFAICS, doesn't it?

Yes, and the fix is patch 04/32.

Quoted 5 lines

I guess the point is to allow the OS to set firmware_waking_vector *and* clear xfirmware_waking_vector at the same time (by passing 0 as the second argument of the function). And that helps to address the issue when xfirmware_waking_vector has a random value to start with, we don't clear it and the BIOS thinks it is OK to use it, right?

Yes.

Quoted 2 lines

If that's the case, this patch should be combined with [4/32] and the signal-to-noise ratio of [4/32] needs to be increased quite a bit.

I'll combine the 2 patches.

Thanks and best regards
-Lv

author
#10 lore raw

PATCH 4/32 ACPI: sleep: Update acpi_set_firmware_waking_vector() invocations to favor 32-bit firmware waking vector.

In reply to Lv Zheng

This patch updates acpi_set_firmware_waking_vector() invocations in order to keep 32-bit firmware waking vector favor for Linux.

64-bit firmware waking vector has never been enabled by Linux. The (acpi_physical_address)0 for 64-bit address can be used to force ACPICA to set only 32-bit firmware waking vector for Linux.

Reference: https://bugzilla.kernel.org/show_bug.cgi?id=74021

Cc Thomas Gleixner <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc "H. Peter Anvin" <[email protected]>
Cc Tony Luck <[email protected]>
Cc Fenghua Yu <[email protected]>
---
 arch/ia64/include/asm/acpi.h |    3 ++-
 arch/ia64/kernel/acpi.c      |    2 --
 arch/x86/include/asm/acpi.h  |    3 ++-
 drivers/acpi/sleep.c         |    8 ++++++--
 4 files changed, 10 insertions(+), 6 deletions(-)
arch/ia64/include/asm/acpi.h +2 -1
index aa0fdf1..0ac4fab 100644
@@ -79,7 +79,8 @@ int acpi_gsi_to_irq (u32 gsi, unsigned int *irq);
 /* Low-level suspend routine. */
 extern int acpi_suspend_lowlevel(void);
 
-extern unsigned long acpi_wakeup_address;
+#define acpi_wakeup_address	((acpi_physical_address)0)
+#define acpi_wakeup_address64	((acpi_physical_address)0)
 
 /*
  * Record the cpei override flag and current logical cpu. This is
arch/ia64/kernel/acpi.c +0 -2
index b1698bc..1b08d6f 100644
@@ -60,8 +60,6 @@ int acpi_lapic;
 unsigned int acpi_cpei_override;
 unsigned int acpi_cpei_phys_cpuid;
 
-unsigned long acpi_wakeup_address = 0;
-
 #ifdef CONFIG_IA64_GENERIC
 static unsigned long __init acpi_find_rsdp(void)
 {
arch/x86/include/asm/acpi.h +2 -1
index 3a45668..fc9608d 100644
@@ -72,7 +72,8 @@ static inline void acpi_disable_pci(void)
 extern int (*acpi_suspend_lowlevel)(void);
 
 /* Physical address to resume after wakeup */
-#define acpi_wakeup_address ((unsigned long)(real_mode_header->wakeup_start))
+#define acpi_wakeup_address	((acpi_physical_address)(real_mode_header->wakeup_start))
+#define acpi_wakeup_address64	((acpi_physical_address)(0))
 
 /*
  * Check if the CPU can handle C2 and deeper
drivers/acpi/sleep.c +6 -2
index 2f0d4db..3a6a2eb 100644
@@ -25,6 +25,8 @@
 #include "internal.h"
 #include "sleep.h"
 
+#define ACPI_NO_WAKING_VECTOR		((acpi_physical_address)0)
+
 static u8 sleep_states[ACPI_S_STATE_COUNT];
 
 static void acpi_sleep_tts_switch(u32 acpi_state)
@@ -61,7 +63,8 @@ static int acpi_sleep_prepare(u32 acpi_state)
 	if (acpi_state == ACPI_STATE_S3) {
 		if (!acpi_wakeup_address)
 			return -EFAULT;
-		acpi_set_firmware_waking_vector(acpi_wakeup_address);
+		acpi_set_firmware_waking_vector(acpi_wakeup_address,
+						acpi_wakeup_address64);
 
 	}
 	ACPI_FLUSH_CPU_CACHE();
@@ -410,7 +413,8 @@ 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_firmware_waking_vector(ACPI_NO_WAKING_VECTOR,
+					ACPI_NO_WAKING_VECTOR);
 
 	acpi_target_sleep_state = ACPI_STATE_S0;
 
Signature · 1 line
1.7.10
#11 lore raw

Re: [PATCH 04/32] ACPI: sleep: Update acpi_set_firmware_waking_vector() invocations to favor 32-bit firmware waking vector.

Quoted 2 lines · Lv Zheng

This patch updates acpi_set_firmware_waking_vector() invocations in order to keep 32-bit firmware waking vector favor for Linux.

This sentence does not parse.

Quoted 3 lines

64-bit firmware waking vector has never been enabled by Linux. The (acpi_physical_address)0 for 64-bit address can be used to force ACPICA to set only 32-bit firmware waking vector for Linux.

So this is a change that affects a lot of systems - what is the expected compatibility of this? Does Windows enable the 64-bit address? Which versions of Windows?

Quoted 50 lines

Reference: https://bugzilla.kernel.org/show_bug.cgi?idt021

Cc Thomas Gleixner <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc "H. Peter Anvin" <[email protected]>
Cc Tony Luck <[email protected]>
Cc Fenghua Yu <[email protected]>
---
 arch/ia64/include/asm/acpi.h |    3 ++-
 arch/ia64/kernel/acpi.c      |    2 --
 arch/x86/include/asm/acpi.h  |    3 ++-
 drivers/acpi/sleep.c         |    8 ++++++--
 4 files changed, 10 insertions(+), 6 deletions(-)
arch/ia64/include/asm/acpi.h +2 -1
index aa0fdf1..0ac4fab 100644
@@ -79,7 +79,8 @@ int acpi_gsi_to_irq (u32 gsi, unsigned int *irq);
 /* Low-level suspend routine. */
 extern int acpi_suspend_lowlevel(void);
 
-extern unsigned long acpi_wakeup_address;
+#define acpi_wakeup_address	((acpi_physical_address)0)
+#define acpi_wakeup_address64	((acpi_physical_address)0)
 
 /*
  * Record the cpei override flag and current logical cpu. This is
arch/ia64/kernel/acpi.c +0 -2
index b1698bc..1b08d6f 100644
@@ -60,8 +60,6 @@ int acpi_lapic;
 unsigned int acpi_cpei_override;
 unsigned int acpi_cpei_phys_cpuid;
 
-unsigned long acpi_wakeup_address = 0;
-
 #ifdef CONFIG_IA64_GENERIC
 static unsigned long __init acpi_find_rsdp(void)
 {
arch/x86/include/asm/acpi.h +0 -0
index 3a45668..fc9608d 100644

arch/x86/include/asm/acpi.h static inline void acpi_disable_pci(void) · line 76

Quoted 6 lines
arch/x86/include/asm/acpi.h +2 -1
@@ -72,7 +72,8 @@ static inline void acpi_disable_pci(void)
 extern int (*acpi_suspend_lowlevel)(void);
 
 /* Physical address to resume after wakeup */
-#define acpi_wakeup_address ((unsigned long)(real_mode_header->wakeup_start))
+#define acpi_wakeup_address	((acpi_physical_address)(real_mode_header->wakeup_start))
+#define acpi_wakeup_address64	((acpi_physical_address)(0))

Btw., 'acpi_physical_address' is a mouthful, and despite being a data type, it looks like a variable name. Please rename it to something more sensible, matching existing physical address patterns, like 'acpi_phys_addr_t'.

Also, is there any reason why it's not simply phys_addr_t? It's not like ACPI has a different notion of physical addresses.

drivers/acpi/sleep.c line 28

Quoted 9 lines
drivers/acpi/sleep.c +1 -0
index 2f0d4db..3a6a2eb 100644
@@ -25,6 +25,8 @@
 #include "internal.h"
 #include "sleep.h"
 
+#define ACPI_NO_WAKING_VECTOR		((acpi_physical_address)0)

So in x86 speak, 'vectors' are the things that drive interrupts. They are not addresses. So calling it a 'vector' is a misnomer - it's a wakeup entry address point.

Secondly, when the 64-bit entry point is configured, in what mode does the firmware enter it - still real mode? Exactly what are the semantics when the 64-bit entry point is set?

Thanks,

Ingo

#12 lore raw

Re: [PATCH 04/32] ACPI: sleep: Update acpi_set_firmware_waking_vector() invocations to favor 32-bit firmware waking vector.

Quoted 68 lines · Ingo Molnar
Quoted 2 lines · Lv Zheng

This patch updates acpi_set_firmware_waking_vector() invocations in order to keep 32-bit firmware waking vector favor for Linux.

This sentence does not parse.

Quoted 3 lines

64-bit firmware waking vector has never been enabled by Linux. The (acpi_physical_address)0 for 64-bit address can be used to force ACPICA to set only 32-bit firmware waking vector for Linux.

So this is a change that affects a lot of systems - what is the expected compatibility of this? Does Windows enable the 64-bit address? Which versions of Windows?

Quoted 52 lines

Reference: https://bugzilla.kernel.org/show_bug.cgi?id=74021

Cc Thomas Gleixner <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc "H. Peter Anvin" <[email protected]>
Cc Tony Luck <[email protected]>
Cc Fenghua Yu <[email protected]>
---
 arch/ia64/include/asm/acpi.h |    3 ++-
 arch/ia64/kernel/acpi.c      |    2 --
 arch/x86/include/asm/acpi.h  |    3 ++-
 drivers/acpi/sleep.c         |    8 ++++++--
 4 files changed, 10 insertions(+), 6 deletions(-)
arch/ia64/include/asm/acpi.h +2 -1
index aa0fdf1..0ac4fab 100644
@@ -79,7 +79,8 @@ int acpi_gsi_to_irq (u32 gsi, unsigned int *irq);
 /* Low-level suspend routine. */
 extern int acpi_suspend_lowlevel(void);
 
-extern unsigned long acpi_wakeup_address;
+#define acpi_wakeup_address	((acpi_physical_address)0)
+#define acpi_wakeup_address64	((acpi_physical_address)0)
 
 /*
  * Record the cpei override flag and current logical cpu. This is
arch/ia64/kernel/acpi.c +0 -2
index b1698bc..1b08d6f 100644
@@ -60,8 +60,6 @@ int acpi_lapic;
 unsigned int acpi_cpei_override;
 unsigned int acpi_cpei_phys_cpuid;
 
-unsigned long acpi_wakeup_address = 0;
-
 #ifdef CONFIG_IA64_GENERIC
 static unsigned long __init acpi_find_rsdp(void)
 {
arch/x86/include/asm/acpi.h +0 -0
index 3a45668..fc9608d 100644
@@ -72,7 +72,8 @@ static inline void acpi_disable_pci(void)
 extern int (*acpi_suspend_lowlevel)(void);
 
Quoted 8 lines

arch/x86/include/asm/acpi.h static inline void acpi_disable_pci(void) · line 76

Quoted 4 lines
arch/x86/include/asm/acpi.h +2 -1
 /* Physical address to resume after wakeup */
-#define acpi_wakeup_address ((unsigned long)(real_mode_header->wakeup_start))
+#define acpi_wakeup_address	((acpi_physical_address)(real_mode_header->wakeup_start))
+#define acpi_wakeup_address64	((acpi_physical_address)(0))

Btw., 'acpi_physical_address' is a mouthful, and despite being a data type, it looks like a variable name. Please rename it to something more sensible, matching existing physical address patterns, like 'acpi_phys_addr_t'.

This is an ACPICA data type which means that it is used by multiple OSes, not only by Linux. We're just a user here. :-)

Quoted 2 lines

Also, is there any reason why it's not simply phys_addr_t? It's not like ACPI has a different notion of physical addresses.

Portability between different OSes is the reason.

Quoted 8 lines
Quoted 8 lines
drivers/acpi/sleep.c +0 -0
index 2f0d4db..3a6a2eb 100644
@@ -25,6 +25,8 @@
 #include "internal.h"
 #include "sleep.h"
 
Quoted 5 lines

drivers/acpi/sleep.c line 28

Quoted 1 line
drivers/acpi/sleep.c +1 -0
+#define ACPI_NO_WAKING_VECTOR		((acpi_physical_address)0)

So in x86 speak, 'vectors' are the things that drive interrupts. They are not addresses. So calling it a 'vector' is a misnomer - it's a wakeup entry address point.

But it is called "the waking vector" by the spec, so the naming here follows the spec.

Quoted 3 lines

Secondly, when the 64-bit entry point is configured, in what mode does the firmware enter it - still real mode? Exactly what are the semantics when the 64-bit entry point is set?

It can't do that in real mode, because the 64-bit one is only supposed to be used when the entry point is above 4 GB in the physical address space.

Thanks,
Rafael

--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in

author
#13 lore raw

PATCH 5/32 ACPICA: Tables: Enable both 32-bit and 64-bit FACS.

In reply to Lv Zheng

ACPICA commit f7b86f35416e3d1f71c3d816ff5075ddd33ed486

The root cause of the reported bug might be one of the followings:
1. BIOS may favor the 64-bit firmware waking vector address when the version of the FACS is greater than 0 and Linux currently only supports resuming from the real mode, so the 64-bit firmware waking vector has never been set and might be invalid to BIOS while the commit enables higher version FACS.
2. BIOS may favor the FACS reported via the "FIRMWARE_CTRL" field in the FADT while the commit doesn't set the firmware waking vector address of the FACS reported by "FIRMWARE_CTRL", it only sets the firware waking vector address of the FACS reported by "X_FIRMWARE_CTRL".

This patch excludes the cases that can trigger the bugs caused by the root cause 2.

There is no handshaking mechanism can be used by OSPM to tell BIOS which FACS is currently used. Thus the FACS reported by "FIRMWARE_CTRL" may still be used by BIOS and the 0 value of the 32-bit firmware waking vector might trigger such failure.

This patch tries to favor 32bit FACS address in another way where both the FACS reported by "FIRMWARE_CTRL" and the FACS reported by "X_FIRMWARE_CTRL" are loaded so that further commit can set firmware waking vector in the both tables to ensure we can exclude the cases that trigger the bugs caused by the root cause 2. The exclusion is split into 2 commits as this commit is also useful for dumping more ACPI tables, it won't get reverted when such exclusion is no longer necessary. Lv Zheng.

---
 drivers/acpi/acpica/aclocal.h  |    1 +
 drivers/acpi/acpica/tbfadt.c   |   21 +++++++++++++--------
 drivers/acpi/acpica/tbutils.c  |   37 ++++++++++++++++++++++++++-----------
 drivers/acpi/acpica/tbxfload.c |    3 ++-
 include/acpi/acpixf.h          |    9 +++++++++
 5 files changed, 51 insertions(+), 20 deletions(-)
drivers/acpi/acpica/aclocal.h +1 -0
index ffdb956..bc60096 100644
@@ -213,6 +213,7 @@ struct acpi_table_list {
 
 #define ACPI_TABLE_INDEX_DSDT           (0)
 #define ACPI_TABLE_INDEX_FACS           (1)
+#define ACPI_TABLE_INDEX_X_FACS         (2)
 
 struct acpi_find_context {
 	char *search_for;
drivers/acpi/acpica/tbfadt.c +13 -8
index 7d24860..05be59c 100644
@@ -350,9 +350,18 @@ void acpi_tb_parse_fadt(u32 table_index)
 	/* If Hardware Reduced flag is set, there is no FACS */
 
 	if (!acpi_gbl_reduced_hardware) {
-		acpi_tb_install_fixed_table((acpi_physical_address)
-					    acpi_gbl_FADT.Xfacs, ACPI_SIG_FACS,
-					    ACPI_TABLE_INDEX_FACS);
+		if (acpi_gbl_FADT.facs) {
+			acpi_tb_install_fixed_table((acpi_physical_address)
+						    acpi_gbl_FADT.facs,
+						    ACPI_SIG_FACS,
+						    ACPI_TABLE_INDEX_FACS);
+		}
+		if (acpi_gbl_FADT.Xfacs) {
+			acpi_tb_install_fixed_table((acpi_physical_address)
+						    acpi_gbl_FADT.Xfacs,
+						    ACPI_SIG_FACS,
+						    ACPI_TABLE_INDEX_X_FACS);
+		}
 	}
 }
 
@@ -491,13 +500,9 @@ static void acpi_tb_convert_fadt(void)
 	acpi_gbl_FADT.header.length = sizeof(struct acpi_table_fadt);
 
 	/*
-	 * Expand the 32-bit FACS and DSDT addresses to 64-bit as necessary.
+	 * Expand the 32-bit DSDT addresses to 64-bit as necessary.
 	 * Later ACPICA code will always use the X 64-bit field.
 	 */
-	acpi_gbl_FADT.Xfacs = acpi_tb_select_address("FACS",
-						     acpi_gbl_FADT.facs,
-						     acpi_gbl_FADT.Xfacs);
-
 	acpi_gbl_FADT.Xdsdt = acpi_tb_select_address("DSDT",
 						     acpi_gbl_FADT.dsdt,
 						     acpi_gbl_FADT.Xdsdt);
drivers/acpi/acpica/tbutils.c +26 -11
index 6559a58..a4e6dab 100644
@@ -68,7 +68,8 @@ acpi_tb_get_root_table_entry(u8 *table_entry, u32 table_entry_size);
 
 acpi_status acpi_tb_initialize_facs(void)
 {
-	acpi_status status;
+	struct acpi_table_facs *facs32;
+	struct acpi_table_facs *facs64;
 
 	/* If Hardware Reduced flag is set, there is no FACS */
 
@@ -77,11 +78,25 @@ acpi_status acpi_tb_initialize_facs(void)
 		return (AE_OK);
 	}
 
-	status = acpi_get_table_by_index(ACPI_TABLE_INDEX_FACS,
-					 ACPI_CAST_INDIRECT_PTR(struct
-								acpi_table_header,
-								&acpi_gbl_FACS));
-	return (status);
+	(void)acpi_get_table_by_index(ACPI_TABLE_INDEX_FACS,
+				      ACPI_CAST_INDIRECT_PTR(struct
+							     acpi_table_header,
+							     &facs32));
+	(void)acpi_get_table_by_index(ACPI_TABLE_INDEX_X_FACS,
+				      ACPI_CAST_INDIRECT_PTR(struct
+							     acpi_table_header,
+							     &facs64));
+	if (!facs32 && !facs64) {
+		return (AE_NO_MEMORY);
+	}
+
+	if (acpi_gbl_use32_bit_facs_addresses) {
+		acpi_gbl_FACS = facs32 ? facs32 : facs64;
+	} else {
+		acpi_gbl_FACS = facs64 ? facs64 : facs32;
+	}
+
+	return (AE_OK);
 }
 #endif				/* !ACPI_REDUCED_HARDWARE */
 
@@ -101,7 +116,7 @@ acpi_status acpi_tb_initialize_facs(void)
 u8 acpi_tb_tables_loaded(void)
 {
 
-	if (acpi_gbl_root_table_list.current_table_count >= 3) {
+	if (acpi_gbl_root_table_list.current_table_count >= 4) {
 		return (TRUE);
 	}
 
@@ -357,11 +372,11 @@ acpi_status __init acpi_tb_parse_root_table(acpi_physical_address rsdp_address)
 	table_entry = ACPI_ADD_PTR(u8, table, sizeof(struct acpi_table_header));
 
 	/*
-	 * First two entries in the table array are reserved for the DSDT
-	 * and FACS, which are not actually present in the RSDT/XSDT - they
-	 * come from the FADT
+	 * First three entries in the table array are reserved for the DSDT
+	 * and 32bit/64bit FACS, which are not actually present in the
+	 * RSDT/XSDT - they come from the FADT
 	 */
-	acpi_gbl_root_table_list.current_table_count = 2;
+	acpi_gbl_root_table_list.current_table_count = 3;
 
 	/* Initialize the root table array from the RSDT/XSDT */
 
drivers/acpi/acpica/tbxfload.c +2 -1
index aadb300..b63e35d 100644
@@ -166,7 +166,8 @@ static acpi_status acpi_tb_load_namespace(void)
 
 	(void)acpi_ut_acquire_mutex(ACPI_MTX_TABLES);
 	for (i = 0; i < acpi_gbl_root_table_list.current_table_count; ++i) {
-		if ((!ACPI_COMPARE_NAME
+		if (!acpi_gbl_root_table_list.tables[i].address ||
+		    (!ACPI_COMPARE_NAME
 		     (&(acpi_gbl_root_table_list.tables[i].signature),
 		      ACPI_SIG_SSDT)
 		     &&
include/acpi/acpixf.h +9 -0
index a68e4b9..dec71ff 100644
@@ -200,6 +200,15 @@ ACPI_INIT_GLOBAL(u8, acpi_gbl_do_not_use_xsdt, FALSE);
 ACPI_INIT_GLOBAL(u8, acpi_gbl_use32_bit_fadt_addresses, TRUE);
 
 /*
+ * Optionally use 32-bit FACS table addresses.
+ * It is reported that some platforms fail to resume from system suspending
+ * if 64-bit FACS table address is selected:
+ * https://bugzilla.kernel.org/show_bug.cgi?id=74021
+ * Default is TRUE, favor the 32-bit addresses.
+ */
+ACPI_INIT_GLOBAL(u8, acpi_gbl_use32_bit_facs_addresses, TRUE);
+
+/*
  * Optionally truncate I/O addresses to 16 bits. Provides compatibility
  * with other ACPI implementations. NOTE: During ACPICA initialization,
  * this value is set to TRUE if any Windows OSI strings have been
Signature · 1 line
1.7.10
#14 lore raw

Re: [PATCH 05/32] ACPICA: Tables: Enable both 32-bit and 64-bit FACS.

Quoted 3 lines · Lv Zheng

ACPICA commit f7b86f35416e3d1f71c3d816ff5075ddd33ed486

The root cause of the reported bug might be one of the followings:

Again, please describe the bug you're addressing here.

Thanks,
Rafael

author
#15 lore raw

RE: [PATCH 05/32] ACPICA: Tables: Enable both 32-bit and 64-bit FACS.

Hi, Rafael

Quoted 9 lines

From: Rafael J. Wysocki [mailto:[email protected]]
Sent: Wednesday, June 24, 2015 8:32 AM

Quoted 3 lines · Lv Zheng

ACPICA commit f7b86f35416e3d1f71c3d816ff5075ddd33ed486

The root cause of the reported bug might be one of the followings:

Again, please describe the bug you're addressing here.

OK, I'll update the description and re-send the series with some of the patches combined.

Thanks and best regards
-Lv

author
#16 lore raw

PATCH 6/32 ACPICA: Hardware: Enable firmware waking vector for both 32-bit and 64-bit FACS.

In reply to Lv Zheng

ACPICA commit 368eb60778b27b6ae94d3658ddc902ca1342a963

The root cause of the reported bug might be one of the followings:
1. BIOS may favor the 64-bit firmware waking vector address when the version of the FACS is greater than 0 and Linux currently only supports resuming from the real mode, so the 64-bit firmware waking vector has never been set and might be invalid to BIOS while the commit enables higher version FACS.
2. BIOS may favor the FACS reported via the "FIRMWARE_CTRL" field in the FADT while the commit doesn't set the firmware waking vector address of the FACS reported by "FIRMWARE_CTRL", it only sets the firware waking vector address of the FACS reported by "X_FIRMWARE_CTRL".

This patch excludes the cases that can trigger the bugs caused by the root cause 2.

There is no handshaking mechanism can be used by OSPM to tell BIOS which FACS is currently used. Thus the FACS reported by "FIRMWARE_CTRL" may still be used by BIOS and the 0 value of the 32-bit firmware waking vector might trigger such failure.

This patch enables the firmware waking vectors for both 32bit/64bit FACS tables in order to ensure we can exclude the cases that trigger the bugs caused by the root cause 2. The exclusion is split into 2 commits so that if it turns out not to be necessary, this single commit can be reverted without affecting the useful one. Lv Zheng.

---
 drivers/acpi/acpica/acglobal.h  |    2 ++
 drivers/acpi/acpica/hwxfsleep.c |   72 ++++++++++++++++++++++++++++++++-------
 drivers/acpi/acpica/tbutils.c   |   14 ++++----
 3 files changed, 69 insertions(+), 19 deletions(-)
drivers/acpi/acpica/acglobal.h +2 -0
index a0c4787..53f96a3 100644
@@ -61,6 +61,8 @@ ACPI_GLOBAL(struct acpi_table_header, acpi_gbl_original_dsdt_header);
 
 #if (!ACPI_REDUCED_HARDWARE)
 ACPI_GLOBAL(struct acpi_table_facs *, acpi_gbl_FACS);
+ACPI_GLOBAL(struct acpi_table_facs *, acpi_gbl_facs32);
+ACPI_GLOBAL(struct acpi_table_facs *, acpi_gbl_facs64);
 
 #endif				/* !ACPI_REDUCED_HARDWARE */
 
drivers/acpi/acpica/hwxfsleep.c +60 -12

111 lines not on this page · raw message

drivers/acpi/acpica/tbutils.c +7 -7
index a4e6dab..6a6c5be 100644
@@ -68,8 +68,6 @@ acpi_tb_get_root_table_entry(u8 *table_entry, u32 table_entry_size);
 
 acpi_status acpi_tb_initialize_facs(void)
 {
-	struct acpi_table_facs *facs32;
-	struct acpi_table_facs *facs64;
 
 	/* If Hardware Reduced flag is set, there is no FACS */
 
@@ -81,19 +79,21 @@ acpi_status acpi_tb_initialize_facs(void)
 	(void)acpi_get_table_by_index(ACPI_TABLE_INDEX_FACS,
 				      ACPI_CAST_INDIRECT_PTR(struct
 							     acpi_table_header,
-							     &facs32));
+							     &acpi_gbl_facs32));
 	(void)acpi_get_table_by_index(ACPI_TABLE_INDEX_X_FACS,
 				      ACPI_CAST_INDIRECT_PTR(struct
 							     acpi_table_header,
-							     &facs64));
-	if (!facs32 && !facs64) {
+							     &acpi_gbl_facs64));
+	if (!acpi_gbl_facs32 && !acpi_gbl_facs64) {
 		return (AE_NO_MEMORY);
 	}
 
 	if (acpi_gbl_use32_bit_facs_addresses) {
-		acpi_gbl_FACS = facs32 ? facs32 : facs64;
+		acpi_gbl_FACS =
+		    acpi_gbl_facs32 ? acpi_gbl_facs32 : acpi_gbl_facs64;
 	} else {
-		acpi_gbl_FACS = facs64 ? facs64 : facs32;
+		acpi_gbl_FACS =
+		    acpi_gbl_facs64 ? acpi_gbl_facs64 : acpi_gbl_facs32;
 	}
 
 	return (AE_OK);
Signature · 1 line
1.7.10
author
#17 lore raw

PATCH 7/32 ACPICA: Hardware: Cleanup the return values in acpi_set_waking_vector().

In reply to Lv Zheng

ACPICA commit a04dbfa308a48ab0b2d10519c54a6c533c5c8949

The return statement in acpi_set_waking_vector() is wrong and this patch corrects it. Lv Zheng.

---
 drivers/acpi/acpica/hwxfsleep.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/acpi/acpica/hwxfsleep.c +1 -1
index 9a438d2..5601fed 100644
@@ -159,7 +159,7 @@ acpi_set_firmware_waking_vector(acpi_physical_address physical_address,
 	/* If Hardware Reduced flag is set, there is no FACS */
 
 	if (acpi_gbl_reduced_hardware) {
-		return (AE_OK);
+		return_ACPI_STATUS(AE_OK);
 	}
 
 	if (acpi_gbl_facs32) {
Signature · 1 line
1.7.10
author
#18 lore raw

PATCH 8/32 ACPICA: Tables: Fix an issue that FACS initialization is performed twice.

In reply to Lv Zheng

ACPICA commit 90f5332a15e9d9ba83831ca700b2b9f708274658

This patch adds a new FACS initialization flag for acpi_tb_initialize(). acpi_enable_subsystem() might be invoked several times in OS bootup process, and we don't want FACS initialization to be invoked twice. Lv Zheng.

---
 drivers/acpi/acpica/utxfinit.c |   10 ++++++----
 include/acpi/actypes.h         |    1 +
 2 files changed, 7 insertions(+), 4 deletions(-)
drivers/acpi/acpica/utxfinit.c +6 -4
index 083a768..42a32a6 100644
@@ -179,10 +179,12 @@ acpi_status __init acpi_enable_subsystem(u32 flags)
 	 * Obtain a permanent mapping for the FACS. This is required for the
 	 * Global Lock and the Firmware Waking Vector
 	 */
-	status = acpi_tb_initialize_facs();
-	if (ACPI_FAILURE(status)) {
-		ACPI_WARNING((AE_INFO, "Could not map the FACS table"));
-		return_ACPI_STATUS(status);
+	if (!(flags & ACPI_NO_FACS_INIT)) {
+		status = acpi_tb_initialize_facs();
+		if (ACPI_FAILURE(status)) {
+			ACPI_WARNING((AE_INFO, "Could not map the FACS table"));
+			return_ACPI_STATUS(status);
+		}
 	}
 #endif				/* !ACPI_REDUCED_HARDWARE */
 
include/acpi/actypes.h +1 -0
index 63fd7f5..ff0b53e 100644
@@ -568,6 +568,7 @@ typedef u64 acpi_integer;
 #define ACPI_NO_ACPI_ENABLE             0x10
 #define ACPI_NO_DEVICE_INIT             0x20
 #define ACPI_NO_OBJECT_INIT             0x40
+#define ACPI_NO_FACS_INIT               0x80
 
 /*
  * Initialization state
Signature · 1 line
1.7.10
author
#19 lore raw

PATCH 9/32 ACPICA: Tables: Fix an issue that ACPI initialization is blocked due to no FACS.

In reply to Lv Zheng

ACPICA commit ebd544ed24c5a4faba11f265e228b7a821a729f5

This patch fixes an issue that when FACS tables do not exist, ACPI initialization cannot proceed. ACPICA BZ 1122. Lv Zheng.

---
 drivers/acpi/acpica/tbutils.c |   16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)
drivers/acpi/acpica/tbutils.c +7 -9
index 6a6c5be..2bb6a11 100644
@@ -84,18 +84,16 @@ acpi_status acpi_tb_initialize_facs(void)
 				      ACPI_CAST_INDIRECT_PTR(struct
 							     acpi_table_header,
 							     &acpi_gbl_facs64));
-	if (!acpi_gbl_facs32 && !acpi_gbl_facs64) {
-		return (AE_NO_MEMORY);
-	}
 
-	if (acpi_gbl_use32_bit_facs_addresses) {
-		acpi_gbl_FACS =
-		    acpi_gbl_facs32 ? acpi_gbl_facs32 : acpi_gbl_facs64;
-	} else {
-		acpi_gbl_FACS =
-		    acpi_gbl_facs64 ? acpi_gbl_facs64 : acpi_gbl_facs32;
+	if (acpi_gbl_facs64
+	    && (!acpi_gbl_facs32 || !acpi_gbl_use32_bit_facs_addresses)) {
+		acpi_gbl_FACS = acpi_gbl_facs64;
+	} else if (acpi_gbl_facs32) {
+		acpi_gbl_FACS = acpi_gbl_facs32;
 	}
 
+	/* If there is no FACS, just continue. There was already an error msg */
+
 	return (AE_OK);
 }
 #endif				/* !ACPI_REDUCED_HARDWARE */
Signature · 1 line
1.7.10
author
#20 lore raw

PATCH 10/32 ACPICA: Remove a prototype for the reduced hardware case.

In reply to Lv Zheng

From: Bob Moore <[email protected]>

ACPICA commit 70f62a80d65515e1285fdeeb50d94ee6f07df4bd

Causes an error on some hosts.

---
 drivers/acpi/acpica/hwxfsleep.c |    2 ++
 1 file changed, 2 insertions(+)
drivers/acpi/acpica/hwxfsleep.c +2 -0
index 5601fed..c25fedb 100644
@@ -50,10 +50,12 @@
 ACPI_MODULE_NAME("hwxfsleep")
 
 /* Local prototypes */
+#if (!ACPI_REDUCED_HARDWARE)
 static acpi_status
 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);
 
Signature · 1 line
1.7.10
author
#21 lore raw

PATCH 11/32 ACPICA: Tables: Enable default 64-bit FADT addresses favor.

In reply to Lv Zheng

ACPICA commit 4da56eeae0749dfe8491285c1e1fad48f6efafd8

With enough protections, this patch re-enables 64-bit FADT addresses by default. If regressions are reported against such change, this patch should be bisected and reverted.
Note that 64-bit FACS favor and 64-bit firmware waking vector favor are excluded by this commit in order not to break OSPMs. Lv Zheng.

---
 include/acpi/acpixf.h |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
include/acpi/acpixf.h +2 -2
index dec71ff..00daa3c 100644
@@ -195,9 +195,9 @@ ACPI_INIT_GLOBAL(u8, acpi_gbl_do_not_use_xsdt, FALSE);
  * address. Although ACPICA adheres to the ACPI specification which
  * requires the use of the corresponding 64-bit address if it is non-zero,
  * some machines have been found to have a corrupted non-zero 64-bit
- * address. Default is TRUE, favor the 32-bit addresses.
+ * address. Default is FALSE, do not favor the 32-bit addresses.
  */
-ACPI_INIT_GLOBAL(u8, acpi_gbl_use32_bit_fadt_addresses, TRUE);
+ACPI_INIT_GLOBAL(u8, acpi_gbl_use32_bit_fadt_addresses, FALSE);
 
 /*
  * Optionally use 32-bit FACS table addresses.
Signature · 1 line
1.7.10
author
#22 lore raw

PATCH 12/32 ACPICA: MSVC6: Fix build issue for variable argument macros.

In reply to Lv Zheng

ACPICA commit 72f5a358f28c5d154ed613c142c7dca03192c5ee

This patch intoduces generic variable macro detection support and fixes build breakage issue with macros using __VA_ARGS__ feature defined in C99.

This patch fixes this build issue. Lv Zheng.

This patch doesn't affect Linux kernel.

---
 include/acpi/acoutput.h       |   13 +++++++++++--
 include/acpi/platform/acgcc.h |    4 ++++
 2 files changed, 15 insertions(+), 2 deletions(-)
include/acpi/acoutput.h +11 -2
index a8f3443..f56de8c 100644
@@ -294,8 +294,12 @@
 
 /* DEBUG_PRINT functions */
 
-#define ACPI_DEBUG_PRINT(plist)         ACPI_ACTUAL_DEBUG plist
-#define ACPI_DEBUG_PRINT_RAW(plist)     ACPI_ACTUAL_DEBUG_RAW plist
+#ifndef COMPILER_VA_MACRO
+
+#define ACPI_DEBUG_PRINT(plist)         acpi_debug_print plist
+#define ACPI_DEBUG_PRINT_RAW(plist)     acpi_debug_print_raw plist
+
+#else
 
 /* Helper macros for DEBUG_PRINT */
 
@@ -315,6 +319,11 @@
 	ACPI_DO_DEBUG_PRINT (acpi_debug_print_raw, level, line, \
 		filename, modulename, component, __VA_ARGS__)
 
+#define ACPI_DEBUG_PRINT(plist)         ACPI_ACTUAL_DEBUG plist
+#define ACPI_DEBUG_PRINT_RAW(plist)     ACPI_ACTUAL_DEBUG_RAW plist
+
+#endif
+
 /*
  * Function entry tracing
  *
include/acpi/platform/acgcc.h +4 -0
index f54de0a..5457a06 100644
@@ -75,4 +75,8 @@
 #undef strchr
 #endif
 
+/* GCC supports __VA_ARGS__ in macros */
+
+#define COMPILER_VA_MACRO               1
+
 #endif				/* __ACGCC_H__ */
Signature · 1 line
1.7.10
author
#23 lore raw

PATCH 13/32 ACPICA: EFI: Add EFI interface definitions to eliminate dependency of GNU EFI.

In reply to Lv Zheng

ACPICA commit 5d00e67a74542d030f0a55e7a947a020ef0d9693

This patch copies EFI interface definitions to the ACPICA code base so that the EFI utility support can be ported to other EFI implementation.

Known issues:
1. MS Builds of uefi_call_wrapper()
The uefi_call_wrapper() in GNU EFI is implemented in a the way to work around the ABI difference between Unix and MS. While I don't have environment to test the MS builds.

In order to port the ACPICA utilities to other EFI implementation, all that need to be done is to impelement the 64-bit division support and the program entry point where the efi_main() is invoked. Code to impelement these is platform specific, and ACPICA currently choose to hide such platform specific code within the specific EFI impelementation. Lv Zheng.

This patch doesn't affect Linux kernel.

---
 include/acpi/platform/acenvex.h |    6 ++++++
 1 file changed, 6 insertions(+)
include/acpi/platform/acenvex.h +6 -0
index 14dc6f6..0a7dc8e 100644
@@ -56,6 +56,12 @@
 #if defined(_LINUX) || defined(__linux__)
 #include <acpi/platform/aclinuxex.h>
 
+#elif defined(_AED_EFI)
+#include "acefiex.h"
+
+#elif defined(_GNU_EFI)
+#include "acefiex.h"
+
 #elif defined(__DragonFly__)
 #include "acdragonflyex.h"
 
Signature · 1 line
1.7.10
author
#24 lore raw

PATCH 14/32 ACPICA: Add dragon_fly support to unix file mapping file.

In reply to Lv Zheng

From: Sascha Wildner <[email protected]>

ACPICA commit 795b215d6fd062386f0a1c23dff9ffa244683c4f

ACPICA BZ 1130

This patch doesn't affect Linux kernel.

---
 tools/power/acpi/os_specific/service_layers/osunixmap.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/power/acpi/os_specific/service_layers/osunixmap.c +1 -1
index 0b1fa29..44ad488 100644
@@ -54,7 +54,7 @@ ACPI_MODULE_NAME("osunixmap")
 #ifndef O_BINARY
 #define O_BINARY 0
 #endif
-#ifdef _free_BSD
+#if defined(_dragon_fly) || defined(_free_BSD)
 #define MMAP_FLAGS          MAP_SHARED
 #else
 #define MMAP_FLAGS          MAP_PRIVATE
Signature · 1 line
1.7.10
author
#25 lore raw

PATCH 15/32 ACPICA: Utilities: Add _CLS processing

In reply to Lv Zheng

From: Suravee Suthikulpanit <[email protected]>

ACPICA commit 9a2b638acb3a7215209432e070c6bd0312374229

ACPI Device object often contains a _CLS object to supply PCI-defined class code for the device. This patch introduces logic to process the _CLS object. Suravee Suthikulpanit, Lv Zheng.

---
 drivers/acpi/acpica/acinterp.h |    2 +
 drivers/acpi/acpica/acutils.h  |    4 ++
 drivers/acpi/acpica/exutils.c  |   32 ++++++++++++++
 drivers/acpi/acpica/nsxfname.c |   23 ++++++++--
 drivers/acpi/acpica/utids.c    |   91 +++++++++++++++++++++++++++++++++++++++-
 include/acpi/acnames.h         |    1 +
 include/acpi/actypes.h         |   24 +++++++----
 7 files changed, 164 insertions(+), 13 deletions(-)
drivers/acpi/acpica/acinterp.h +2 -0
index 1886bde..7ac9800 100644
@@ -468,6 +468,8 @@ void acpi_ex_eisa_id_to_string(char *dest, u64 compressed_id);
 
 void acpi_ex_integer_to_string(char *dest, u64 value);
 
+void acpi_ex_pci_cls_to_string(char *dest, u8 class_code[3]);
+
 u8 acpi_is_valid_space_id(u8 space_id);
 
 /*
drivers/acpi/acpica/acutils.h +4 -0
index d49f5c7..6391c97 100644
@@ -430,6 +430,10 @@ acpi_status
 acpi_ut_execute_CID(struct acpi_namespace_node *device_node,
 		    struct acpi_pnp_device_id_list ** return_cid_list);
 
+acpi_status
+acpi_ut_execute_CLS(struct acpi_namespace_node *device_node,
+		    struct acpi_pnp_device_id **return_id);
+
 /*
  * utlock - reader/writer locks
  */
drivers/acpi/acpica/exutils.c +32 -0
index 3f4225e..30c3f46 100644
@@ -380,6 +380,38 @@ void acpi_ex_integer_to_string(char *out_string, u64 value)
 
 /*******************************************************************************
  *
+ * FUNCTION:    acpi_ex_pci_cls_to_string
+ *
+ * PARAMETERS:  out_string      - Where to put the converted string (7 bytes)
+ * PARAMETERS:  class_code      - PCI class code to be converted (3 bytes)
+ *
+ * RETURN:      None
+ *
+ * DESCRIPTION: Convert 3-bytes PCI class code to string representation.
+ *              Return buffer must be large enough to hold the string. The
+ *              string returned is always exactly of length
+ *              ACPI_PCICLS_STRING_SIZE (includes null terminator).
+ *
+ ******************************************************************************/
+
+void acpi_ex_pci_cls_to_string(char *out_string, u8 class_code[3])
+{
+
+	ACPI_FUNCTION_ENTRY();
+
+	/* All 3 bytes are hexadecimal */
+
+	out_string[0] = acpi_ut_hex_to_ascii_char((u64)class_code[0], 4);
+	out_string[1] = acpi_ut_hex_to_ascii_char((u64)class_code[0], 0);
+	out_string[2] = acpi_ut_hex_to_ascii_char((u64)class_code[1], 4);
+	out_string[3] = acpi_ut_hex_to_ascii_char((u64)class_code[1], 0);
+	out_string[4] = acpi_ut_hex_to_ascii_char((u64)class_code[2], 4);
+	out_string[5] = acpi_ut_hex_to_ascii_char((u64)class_code[2], 0);
+	out_string[6] = 0;
+}
+
+/*******************************************************************************
+ *
  * FUNCTION:    acpi_is_valid_space_id
  *
  * PARAMETERS:  space_id            - ID to be validated
drivers/acpi/acpica/nsxfname.c +20 -3
index d66c326..dc0836a 100644
@@ -260,7 +260,7 @@ static char *acpi_ns_copy_device_id(struct acpi_pnp_device_id *dest,
  *              control methods (Such as in the case of a device.)
  *
  * For Device and Processor objects, run the Device _HID, _UID, _CID, _SUB,
- * _STA, _ADR, _sx_w, and _sx_d methods.
+ * _CLS, _STA, _ADR, _sx_w, and _sx_d methods.
  *
  * Note: Allocates the return buffer, must be freed by the caller.
  *
@@ -276,11 +276,12 @@ acpi_get_object_info(acpi_handle handle,
 	struct acpi_pnp_device_id *hid = NULL;
 	struct acpi_pnp_device_id *uid = NULL;
 	struct acpi_pnp_device_id *sub = NULL;
+	struct acpi_pnp_device_id *cls = NULL;
 	char *next_id_string;
 	acpi_object_type type;
 	acpi_name name;
 	u8 param_count = 0;
-	u8 valid = 0;
+	u16 valid = 0;
 	u32 info_size;
 	u32 i;
 	acpi_status status;
@@ -320,7 +321,7 @@ acpi_get_object_info(acpi_handle handle,
 	if ((type == ACPI_TYPE_DEVICE) || (type == ACPI_TYPE_PROCESSOR)) {
 		/*
 		 * Get extra info for ACPI Device/Processor objects only:
-		 * Run the Device _HID, _UID, _SUB, and _CID methods.
+		 * Run the Device _HID, _UID, _SUB, _CID, and _CLS methods.
 		 *
 		 * Note: none of these methods are required, so they may or may
 		 * not be present for this device. The Info->Valid bitfield is used
@@ -363,6 +364,14 @@ acpi_get_object_info(acpi_handle handle,
 			     sizeof(struct acpi_pnp_device_id_list));
 			valid |= ACPI_VALID_CID;
 		}
+
+		/* Execute the Device._CLS method */
+
+		status = acpi_ut_execute_CLS(node, &cls);
+		if (ACPI_SUCCESS(status)) {
+			info_size += cls->length;
+			valid |= ACPI_VALID_CLS;
+		}
 	}
 
 	/*
@@ -486,6 +495,11 @@ acpi_get_object_info(acpi_handle handle,
 		}
 	}
 
+	if (cls) {
+		next_id_string = acpi_ns_copy_device_id(&info->class_code,
+							cls, next_id_string);
+	}
+
 	/* Copy the fixed-length data */
 
 	info->info_size = info_size;
@@ -510,6 +524,9 @@ cleanup:
 	if (cid_list) {
 		ACPI_FREE(cid_list);
 	}
+	if (cls) {
+		ACPI_FREE(cls);
+	}
 	return (status);
 }
 
drivers/acpi/acpica/utids.c +90 -1

99 lines not on this page · raw message

include/acpi/acnames.h +1 -0
index 273de70..b52c0dc 100644
@@ -51,6 +51,7 @@
 #define METHOD_NAME__BBN        "_BBN"
 #define METHOD_NAME__CBA        "_CBA"
 #define METHOD_NAME__CID        "_CID"
+#define METHOD_NAME__CLS        "_CLS"
 #define METHOD_NAME__CRS        "_CRS"
 #define METHOD_NAME__DDN        "_DDN"
 #define METHOD_NAME__HID        "_HID"
include/acpi/actypes.h +15 -9
index ff0b53e..d791b98 100644
@@ -1141,6 +1141,10 @@ u32 (*acpi_interface_handler) (acpi_string interface_name, u32 supported);
 
 #define ACPI_UUID_LENGTH                16
 
+/* Length of 3-byte PCI class code values when converted back to a string */
+
+#define ACPI_PCICLS_STRING_SIZE         7	/* Includes null terminator */
+
 /* Structures used for device/processor HID, UID, CID, and SUB */
 
 struct acpi_pnp_device_id {
@@ -1163,7 +1167,7 @@ struct acpi_device_info {
 	u32 name;		/* ACPI object Name */
 	acpi_object_type type;	/* ACPI object Type */
 	u8 param_count;		/* If a method, required parameter count */
-	u8 valid;		/* Indicates which optional fields are valid */
+	u16 valid;		/* Indicates which optional fields are valid */
 	u8 flags;		/* Miscellaneous info */
 	u8 highest_dstates[4];	/* _sx_d values: 0xFF indicates not valid */
 	u8 lowest_dstates[5];	/* _sx_w values: 0xFF indicates not valid */
@@ -1172,6 +1176,7 @@ struct acpi_device_info {
 	struct acpi_pnp_device_id hardware_id;	/* _HID value */
 	struct acpi_pnp_device_id unique_id;	/* _UID value */
 	struct acpi_pnp_device_id subsystem_id;	/* _SUB value */
+	struct acpi_pnp_device_id class_code;	/* _CLS value */
 	struct acpi_pnp_device_id_list compatible_id_list;	/* _CID list <must be last> */
 };
 
@@ -1181,14 +1186,15 @@ struct acpi_device_info {
 
 /* Flags for Valid field above (acpi_get_object_info) */
 
-#define ACPI_VALID_STA                  0x01
-#define ACPI_VALID_ADR                  0x02
-#define ACPI_VALID_HID                  0x04
-#define ACPI_VALID_UID                  0x08
-#define ACPI_VALID_SUB                  0x10
-#define ACPI_VALID_CID                  0x20
-#define ACPI_VALID_SXDS                 0x40
-#define ACPI_VALID_SXWS                 0x80
+#define ACPI_VALID_STA                  0x0001
+#define ACPI_VALID_ADR                  0x0002
+#define ACPI_VALID_HID                  0x0004
+#define ACPI_VALID_UID                  0x0008
+#define ACPI_VALID_SUB                  0x0010
+#define ACPI_VALID_CID                  0x0020
+#define ACPI_VALID_CLS                  0x0040
+#define ACPI_VALID_SXDS                 0x0100
+#define ACPI_VALID_SXWS                 0x0200
 
 /* Flags for _STA return value (current_status above) */
 
Signature · 1 line
1.7.10
author
#26 lore raw

PATCH 16/32 ACPICA: ACPI 6.0: Add values for MADT GIC version field.

In reply to Lv Zheng

From: Hanjun Guo <[email protected]>

ACPICA commit 4b100dc43e8baee8c8b4891b23bc7ad03eba6a28

Support for the new version field in the generic distributor subtable. Hanjun Guo <[email protected]>

---
 include/acpi/actbl1.h |   11 +++++++++++
 1 file changed, 11 insertions(+)
include/acpi/actbl1.h +11 -0
index 06b61f0..fcd5709 100644
@@ -835,6 +835,17 @@ struct acpi_madt_generic_distributor {
 	u8 reserved2[3];	/* reserved - must be zero */
 };
 
+/* Values for Version field above */
+
+enum acpi_madt_gic_version {
+	ACPI_MADT_GIC_VERSION_NONE = 0,
+	ACPI_MADT_GIC_VERSION_V1 = 1,
+	ACPI_MADT_GIC_VERSION_V2 = 2,
+	ACPI_MADT_GIC_VERSION_V3 = 3,
+	ACPI_MADT_GIC_VERSION_V4 = 4,
+	ACPI_MADT_GIC_VERSION_RESERVED = 5	/* 5 and greater are reserved */
+};
+
 /* 13: Generic MSI Frame (ACPI 5.1) */
 
 struct acpi_madt_generic_msi_frame {
Signature · 1 line
1.7.10
author
#27 lore raw

PATCH 17/32 ACPICA: Namespace: Add support to allow overriding objects.

In reply to Lv Zheng

ACPICA commit 6084e34e44565c6293f446c0202b5e59b055e351

This patch adds an "NamespaceOverride" flag in struct acpi_walk_state, and allows namespace objects to be overridden when this flag is set. Lv Zheng.

---
 drivers/acpi/acpica/acnamesp.h |    1 +
 drivers/acpi/acpica/acstruct.h |    1 +
 drivers/acpi/acpica/dswload.c  |   17 +++++++++++++----
 drivers/acpi/acpica/nsaccess.c |   10 +++++++++-
 drivers/acpi/acpica/nssearch.c |   22 ++++++++++++++++++++--
 5 files changed, 44 insertions(+), 7 deletions(-)
drivers/acpi/acpica/acnamesp.h +1 -0
index 952fbe0..0dd0882 100644
@@ -66,6 +66,7 @@
 #define ACPI_NS_PREFIX_IS_SCOPE     0x10
 #define ACPI_NS_EXTERNAL            0x20
 #define ACPI_NS_TEMPORARY           0x40
+#define ACPI_NS_OVERRIDE_IF_FOUND   0x80
 
 /* Flags for acpi_ns_walk_namespace */
 
drivers/acpi/acpica/acstruct.h +1 -0
index 87c7860..44997ca 100644
@@ -82,6 +82,7 @@ struct acpi_walk_state {
 	u8 return_used;
 	u8 scope_depth;
 	u8 pass_number;		/* Parse pass during table load */
+	u8 namespace_override;	/* Override existing objects */
 	u8 result_size;		/* Total elements for the result stack */
 	u8 result_count;	/* Current number of occupied elements of result stack */
 	u32 aml_offset;
drivers/acpi/acpica/dswload.c +13 -4
index 843942f..845ff44 100644
@@ -315,10 +315,19 @@ acpi_ds_load1_begin_op(struct acpi_walk_state * walk_state,
 		flags = ACPI_NS_NO_UPSEARCH;
 		if ((walk_state->opcode != AML_SCOPE_OP) &&
 		    (!(walk_state->parse_flags & ACPI_PARSE_DEFERRED_OP))) {
-			flags |= ACPI_NS_ERROR_IF_FOUND;
-			ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
-					  "[%s] Cannot already exist\n",
-					  acpi_ut_get_type_name(object_type)));
+			if (walk_state->namespace_override) {
+				flags |= ACPI_NS_OVERRIDE_IF_FOUND;
+				ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
+						  "[%s] Override allowed\n",
+						  acpi_ut_get_type_name
+						  (object_type)));
+			} else {
+				flags |= ACPI_NS_ERROR_IF_FOUND;
+				ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
+						  "[%s] Cannot already exist\n",
+						  acpi_ut_get_type_name
+						  (object_type)));
+			}
 		} else {
 			ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
 					  "[%s] Both Find or Create allowed\n",
drivers/acpi/acpica/nsaccess.c +9 -1
index 24fa19a..19ad0b5 100644
@@ -304,7 +304,9 @@ acpi_ns_lookup(union acpi_generic_state *scope_info,
 		return_ACPI_STATUS(AE_BAD_PARAMETER);
 	}
 
-	local_flags = flags & ~(ACPI_NS_ERROR_IF_FOUND | ACPI_NS_SEARCH_PARENT);
+	local_flags = flags &
+	    ~(ACPI_NS_ERROR_IF_FOUND | ACPI_NS_OVERRIDE_IF_FOUND |
+	      ACPI_NS_SEARCH_PARENT);
 	*return_node = ACPI_ENTRY_NOT_FOUND;
 	acpi_gbl_ns_lookup_count++;
 
@@ -547,6 +549,12 @@ acpi_ns_lookup(union acpi_generic_state *scope_info,
 			if (flags & ACPI_NS_ERROR_IF_FOUND) {
 				local_flags |= ACPI_NS_ERROR_IF_FOUND;
 			}
+
+			/* Set override flag according to caller */
+
+			if (flags & ACPI_NS_OVERRIDE_IF_FOUND) {
+				local_flags |= ACPI_NS_OVERRIDE_IF_FOUND;
+			}
 		}
 
 		/* Extract one ACPI name from the front of the pathname */
drivers/acpi/acpica/nssearch.c +20 -2
index 4a9d4a6..47fbe5b 100644
@@ -325,8 +325,26 @@ acpi_ns_search_and_enter(u32 target_name,
 		 * If we found it AND the request specifies that a find is an error,
 		 * return the error
 		 */
-		if ((status == AE_OK) && (flags & ACPI_NS_ERROR_IF_FOUND)) {
-			status = AE_ALREADY_EXISTS;
+		if (status == AE_OK) {
+
+			/* The node was found in the namespace */
+
+			/*
+			 * If the namespace override feature is enabled for this node,
+			 * delete any existing node. This can only happen during the
+			 * boot stage, thus it is safe to remove the node here.
+			 */
+			if (flags & ACPI_NS_OVERRIDE_IF_FOUND) {
+				acpi_ns_delete_children(*return_node);
+				acpi_ns_remove_node(*return_node);
+				*return_node = ACPI_ENTRY_NOT_FOUND;
+			}
+
+			/* Return an error if we don't expect to find the object */
+
+			else if (flags & ACPI_NS_ERROR_IF_FOUND) {
+				status = AE_ALREADY_EXISTS;
+			}
 		}
 #ifdef ACPI_ASL_COMPILER
 		if (*return_node && (*return_node)->type == ACPI_TYPE_ANY) {
Signature · 1 line
1.7.10
author
#28 lore raw

PATCH 18/32 ACPICA: Namespace: Add support of OSDT table.

In reply to Lv Zheng

From: Bob Moore <[email protected]>

ACPICA commit 27415c82fcecf467446f66d1007a0691cc5f3709

This patch adds OSDT (Override System Definition Table) support. When OSDT is loaded, conflict namespace objects will be overridden by the AML interpreter. Bob Moore, Lv Zheng.

---
 drivers/acpi/acpica/nsparse.c  |    7 +++++++
 drivers/acpi/acpica/tbxfload.c |    6 +++++-
 drivers/acpi/acpica/utmisc.c   |    3 ++-
 include/acpi/actbl.h           |    1 +
 4 files changed, 15 insertions(+), 2 deletions(-)
drivers/acpi/acpica/nsparse.c +7 -0
index c95a119..57a4cfe 100644
@@ -117,6 +117,13 @@ acpi_ns_one_complete_parse(u32 pass_number,
 					       (u8) pass_number);
 	}
 
+	/* Found OSDT table, enable the namespace override feature */
+
+	if (ACPI_COMPARE_NAME(table->signature, ACPI_SIG_OSDT) &&
+	    pass_number == ACPI_IMODE_LOAD_PASS1) {
+		walk_state->namespace_override = TRUE;
+	}
+
 	if (ACPI_FAILURE(status)) {
 		acpi_ds_delete_walk_state(walk_state);
 		goto cleanup;
drivers/acpi/acpica/tbxfload.c +5 -1
index b63e35d..960bd99 100644
@@ -173,7 +173,11 @@ static acpi_status acpi_tb_load_namespace(void)
 		     &&
 		     !ACPI_COMPARE_NAME(&
 					(acpi_gbl_root_table_list.tables[i].
-					 signature), ACPI_SIG_PSDT))
+					 signature), ACPI_SIG_PSDT)
+		     &&
+		     !ACPI_COMPARE_NAME(&
+					(acpi_gbl_root_table_list.tables[i].
+					 signature), ACPI_SIG_OSDT))
 		    ||
 		    ACPI_FAILURE(acpi_tb_validate_table
 				 (&acpi_gbl_root_table_list.tables[i]))) {
drivers/acpi/acpica/utmisc.c +2 -1
index cbb7034..28099e2 100644
@@ -97,7 +97,8 @@ u8 acpi_ut_is_aml_table(struct acpi_table_header *table)
 
 	if (ACPI_COMPARE_NAME(table->signature, ACPI_SIG_DSDT) ||
 	    ACPI_COMPARE_NAME(table->signature, ACPI_SIG_PSDT) ||
-	    ACPI_COMPARE_NAME(table->signature, ACPI_SIG_SSDT)) {
+	    ACPI_COMPARE_NAME(table->signature, ACPI_SIG_SSDT) ||
+	    ACPI_COMPARE_NAME(table->signature, ACPI_SIG_OSDT)) {
 		return (TRUE);
 	}
 
include/acpi/actbl.h +1 -0
index cb8a6b9..2d5faf5 100644
@@ -65,6 +65,7 @@
 #define ACPI_SIG_DSDT           "DSDT"	/* Differentiated System Description Table */
 #define ACPI_SIG_FADT           "FACP"	/* Fixed ACPI Description Table */
 #define ACPI_SIG_FACS           "FACS"	/* Firmware ACPI Control Structure */
+#define ACPI_SIG_OSDT           "OSDT"	/* Override System Description Table */
 #define ACPI_SIG_PSDT           "PSDT"	/* Persistent System Description Table */
 #define ACPI_SIG_RSDP           "RSD PTR "	/* Root System Description Pointer */
 #define ACPI_SIG_RSDT           "RSDT"	/* Root System Description Table */
Signature · 1 line
1.7.10
author
#29 lore raw

PATCH 19/32 ACPICA: Namespace: Change namespace override to avoid node deletion.

In reply to Lv Zheng

From: Bob Moore <[email protected]>

ACPICA commit c0ce529e1fbb8ec47d2522a3aa10f3ab77e16e41

There is no reference counting implemented for struct acpi_namespace_node, so it is currently not removable during runtime.
This patch changes the namespace override code to keep the old struct acpi_namespace_node undeleted so that the override mechanism can happen during runtime. Bob Moore.

---
 drivers/acpi/acpica/nssearch.c |   23 +++++++++++++++++++----
 include/acpi/acpixf.h          |    5 +++++
 2 files changed, 24 insertions(+), 4 deletions(-)
drivers/acpi/acpica/nssearch.c +19 -4
index 47fbe5b..d739040 100644
@@ -331,13 +331,28 @@ acpi_ns_search_and_enter(u32 target_name,
 
 			/*
 			 * If the namespace override feature is enabled for this node,
-			 * delete any existing node. This can only happen during the
-			 * boot stage, thus it is safe to remove the node here.
+			 * delete any existing attached sub-object and make the node
+			 * look like a new node that is owned by the override table.
 			 */
 			if (flags & ACPI_NS_OVERRIDE_IF_FOUND) {
+				ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
+						  "Namespace override: %4.4s pass %u type %X Owner %X\n",
+						  ACPI_CAST_PTR(char,
+								&target_name),
+						  interpreter_mode,
+						  (*return_node)->type,
+						  walk_state->owner_id));
+
 				acpi_ns_delete_children(*return_node);
-				acpi_ns_remove_node(*return_node);
-				*return_node = ACPI_ENTRY_NOT_FOUND;
+				if (acpi_gbl_runtime_namespace_override) {
+					acpi_ut_remove_reference((*return_node)->object);
+					(*return_node)->object = NULL;
+					(*return_node)->owner_id =
+					    walk_state->owner_id;
+				} else {
+					acpi_ns_remove_node(*return_node);
+					*return_node = ACPI_ENTRY_NOT_FOUND;
+				}
 			}
 
 			/* Return an error if we don't expect to find the object */
include/acpi/acpixf.h +5 -0
index 00daa3c..33b4675 100644
@@ -229,6 +229,11 @@ ACPI_INIT_GLOBAL(u8, acpi_gbl_disable_auto_repair, FALSE);
 ACPI_INIT_GLOBAL(u8, acpi_gbl_disable_ssdt_table_install, FALSE);
 
 /*
+ * Optionally enable runtime namespace override.
+ */
+ACPI_INIT_GLOBAL(u8, acpi_gbl_runtime_namespace_override, TRUE);
+
+/*
  * We keep track of the latest version of Windows that has been requested by
  * the BIOS. ACPI 5.0.
  */
Signature · 1 line
1.7.10
author
#30 lore raw

PATCH 20/32 ACPICA: Update for acpi_install_table memory types.

In reply to Lv Zheng

From: Zhang Rui <[email protected]>

ACPICA commit 3f78b7fb3f98f35d62f532c1891deb748ad196c9

Physical/virtual address flags were reversed.

---
 drivers/acpi/acpica/tbxfload.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/acpi/acpica/tbxfload.c +2 -2
index 960bd99..cf56e18 100644
@@ -224,9 +224,9 @@ acpi_install_table(acpi_physical_address address, u8 physical)
 	ACPI_FUNCTION_TRACE(acpi_install_table);
 
 	if (physical) {
-		flags = ACPI_TABLE_ORIGIN_EXTERNAL_VIRTUAL;
-	} else {
 		flags = ACPI_TABLE_ORIGIN_INTERNAL_PHYSICAL;
+	} else {
+		flags = ACPI_TABLE_ORIGIN_EXTERNAL_VIRTUAL;
 	}
 
 	status = acpi_tb_install_standard_table(address, flags,
Signature · 1 line
1.7.10
author
#31 lore raw

PATCH 21/32 ACPICA: Cleanup output for the ASL Debug object.

In reply to Lv Zheng

From: Bob Moore <[email protected]>

ACPICA commit d4a53a396fe5d384425251b0257f8d125bbed617

Especially for use of the Index operator. For buffers and strings, only output the actual byte pointed to by the index. For packages, only print the package element decoded by the index.

---
 drivers/acpi/acpica/acobject.h |    1 +
 drivers/acpi/acpica/exdebug.c  |   42 ++++++++++++++++++++++++++++++++++++++--
 drivers/acpi/acpica/exdump.c   |    9 +++++----
 drivers/acpi/acpica/exoparg2.c |    4 ++++
 4 files changed, 50 insertions(+), 6 deletions(-)
drivers/acpi/acpica/acobject.h +1 -0
index 3e9720e..c81d98d 100644
@@ -335,6 +335,7 @@ struct acpi_object_reference {
 	void *object;		/* name_op=>HANDLE to obj, index_op=>union acpi_operand_object */
 	struct acpi_namespace_node *node;	/* ref_of or Namepath */
 	union acpi_operand_object **where;	/* Target of Index */
+	u8 *index_pointer;	/* Used for Buffers and Strings */
 	u32 value;		/* Used for Local/Arg/Index/ddb_handle */
 };
 
drivers/acpi/acpica/exdebug.c +40 -2

54 lines not on this page · raw message

drivers/acpi/acpica/exdump.c +5 -4
index 1da52be..401e7ed 100644
@@ -224,7 +224,7 @@ static struct acpi_exdump_info acpi_ex_dump_index_field[5] = {
 	{ACPI_EXD_POINTER, ACPI_EXD_OFFSET(index_field.data_obj), "Data Object"}
 };
 
-static struct acpi_exdump_info acpi_ex_dump_reference[8] = {
+static struct acpi_exdump_info acpi_ex_dump_reference[9] = {
 	{ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_reference), NULL},
 	{ACPI_EXD_UINT8, ACPI_EXD_OFFSET(reference.class), "Class"},
 	{ACPI_EXD_UINT8, ACPI_EXD_OFFSET(reference.target_type), "Target Type"},
@@ -232,6 +232,8 @@ static struct acpi_exdump_info acpi_ex_dump_reference[8] = {
 	{ACPI_EXD_POINTER, ACPI_EXD_OFFSET(reference.object), "Object Desc"},
 	{ACPI_EXD_NODE, ACPI_EXD_OFFSET(reference.node), "Node"},
 	{ACPI_EXD_POINTER, ACPI_EXD_OFFSET(reference.where), "Where"},
+	{ACPI_EXD_POINTER, ACPI_EXD_OFFSET(reference.index_pointer),
+	 "Index Pointer"},
 	{ACPI_EXD_REFERENCE, 0, NULL}
 };
 
@@ -1005,14 +1007,13 @@ static void acpi_ex_dump_reference_obj(union acpi_operand_object *obj_desc)
 	} else if (obj_desc->reference.object) {
 		if (ACPI_GET_DESCRIPTOR_TYPE(obj_desc) ==
 		    ACPI_DESC_TYPE_OPERAND) {
-			acpi_os_printf(" Target: %p",
+			acpi_os_printf("%22s %p", "Target :",
 				       obj_desc->reference.object);
 			if (obj_desc->reference.class == ACPI_REFCLASS_TABLE) {
 				acpi_os_printf(" Table Index: %X\n",
 					       obj_desc->reference.value);
 			} else {
-				acpi_os_printf(" Target: %p [%s]\n",
-					       obj_desc->reference.object,
+				acpi_os_printf(" [%s]\n",
 					       acpi_ut_get_type_name(((union
 								       acpi_operand_object
 								       *)
drivers/acpi/acpica/exoparg2.c +4 -0
index fcc618a..6fac5e0 100644
@@ -380,6 +380,8 @@ acpi_status acpi_ex_opcode_2A_1T_1R(struct acpi_walk_state *walk_state)
 
 			return_desc->reference.target_type =
 			    ACPI_TYPE_BUFFER_FIELD;
+			return_desc->reference.index_pointer =
+			    &(operand[0]->buffer.pointer[index]);
 			break;
 
 		case ACPI_TYPE_BUFFER:
@@ -391,6 +393,8 @@ acpi_status acpi_ex_opcode_2A_1T_1R(struct acpi_walk_state *walk_state)
 
 			return_desc->reference.target_type =
 			    ACPI_TYPE_BUFFER_FIELD;
+			return_desc->reference.index_pointer =
+			    &(operand[0]->buffer.pointer[index]);
 			break;
 
 		case ACPI_TYPE_PACKAGE:
Signature · 1 line
1.7.10
author
#32 lore raw

PATCH 22/32 ACPICA: acpidump: Allow customized tables to be dumped without accessing /dev/mem.

In reply to Lv Zheng

ACPICA commit ab29013cfa2424140446aff196a70b211ab343a9

The /dev/mem can be configured out, in which case, acpidump should still work with "-c" option as tables can be found in /sys/firmware/acpi/tables. This patch allows acpidump to work without /dev/mem.
This patch has been tested with "acpidump -c" and "acpidump -c -n FADT". And it worked as expected. Lv Zheng.

---
 .../acpi/os_specific/service_layers/oslinuxtbl.c   |   89 ++++++++++----------
 1 file changed, 46 insertions(+), 43 deletions(-)
tools/power/acpi/os_specific/service_layers/oslinuxtbl.c +46 -43
index db15c9d..3aff9a2 100644
@@ -582,64 +582,67 @@ static acpi_status osl_table_initialize(void)
 		return (AE_OK);
 	}
 
-	/* Get RSDP from memory */
+	if (!gbl_dump_customized_tables) {
 
-	status = osl_load_rsdp();
-	if (ACPI_FAILURE(status)) {
-		return (status);
-	}
+		/* Get RSDP from memory */
+
+		status = osl_load_rsdp();
+		if (ACPI_FAILURE(status)) {
+			return (status);
+		}
 
-	/* Get XSDT from memory */
+		/* Get XSDT from memory */
 
-	if (gbl_rsdp.revision && !gbl_do_not_dump_xsdt) {
-		if (gbl_xsdt) {
-			free(gbl_xsdt);
-			gbl_xsdt = NULL;
+		if (gbl_rsdp.revision && !gbl_do_not_dump_xsdt) {
+			if (gbl_xsdt) {
+				free(gbl_xsdt);
+				gbl_xsdt = NULL;
+			}
+
+			gbl_revision = 2;
+			status = osl_get_bios_table(ACPI_SIG_XSDT, 0,
+						    ACPI_CAST_PTR(struct
+								  acpi_table_header
+								  *, &gbl_xsdt),
+						    &address);
+			if (ACPI_FAILURE(status)) {
+				return (status);
+			}
 		}
 
-		gbl_revision = 2;
-		status = osl_get_bios_table(ACPI_SIG_XSDT, 0,
-					    ACPI_CAST_PTR(struct
-							  acpi_table_header *,
-							  &gbl_xsdt), &address);
-		if (ACPI_FAILURE(status)) {
-			return (status);
+		/* Get RSDT from memory */
+
+		if (gbl_rsdp.rsdt_physical_address) {
+			if (gbl_rsdt) {
+				free(gbl_rsdt);
+				gbl_rsdt = NULL;
+			}
+
+			status = osl_get_bios_table(ACPI_SIG_RSDT, 0,
+						    ACPI_CAST_PTR(struct
+								  acpi_table_header
+								  *, &gbl_rsdt),
+						    &address);
+			if (ACPI_FAILURE(status)) {
+				return (status);
+			}
 		}
-	}
 
-	/* Get RSDT from memory */
+		/* Get FADT from memory */
 
-	if (gbl_rsdp.rsdt_physical_address) {
-		if (gbl_rsdt) {
-			free(gbl_rsdt);
-			gbl_rsdt = NULL;
+		if (gbl_fadt) {
+			free(gbl_fadt);
+			gbl_fadt = NULL;
 		}
 
-		status = osl_get_bios_table(ACPI_SIG_RSDT, 0,
+		status = osl_get_bios_table(ACPI_SIG_FADT, 0,
 					    ACPI_CAST_PTR(struct
 							  acpi_table_header *,
-							  &gbl_rsdt), &address);
+							  &gbl_fadt),
+					    &gbl_fadt_address);
 		if (ACPI_FAILURE(status)) {
 			return (status);
 		}
-	}
-
-	/* Get FADT from memory */
-
-	if (gbl_fadt) {
-		free(gbl_fadt);
-		gbl_fadt = NULL;
-	}
-
-	status = osl_get_bios_table(ACPI_SIG_FADT, 0,
-				    ACPI_CAST_PTR(struct acpi_table_header *,
-						  &gbl_fadt),
-				    &gbl_fadt_address);
-	if (ACPI_FAILURE(status)) {
-		return (status);
-	}
-
-	if (!gbl_dump_customized_tables) {
 
 		/* Add mandatory tables to global table list first */
 
Signature · 1 line
1.7.10
author
#33 lore raw

PATCH 23/32 ACPICA: acpidump: Convert the default behavior to dump from /sys/firmware/acpi/tables.

In reply to Lv Zheng

ACPICA commit 04c3bd7e9d6aeb2b3edebe99c90dc271ae4e6353

In order to work without any additional option to dump tables when /dev/mem doesn't exist, this patch switches the default behavior of acpidump to dump from /sys/firmware/acpi/tables. Reported by Al Stone, Fixed by Lv Zheng.

---
 tools/power/acpi/tools/acpidump/acpidump.h |    2 +-
 tools/power/acpi/tools/acpidump/apmain.c   |   15 ++++++++++++---
 2 files changed, 13 insertions(+), 4 deletions(-)
tools/power/acpi/tools/acpidump/acpidump.h +1 -1
index 84bdef0..eed5344 100644
@@ -66,7 +66,7 @@
 EXTERN u8 INIT_GLOBAL(gbl_summary_mode, FALSE);
 EXTERN u8 INIT_GLOBAL(gbl_verbose_mode, FALSE);
 EXTERN u8 INIT_GLOBAL(gbl_binary_mode, FALSE);
-EXTERN u8 INIT_GLOBAL(gbl_dump_customized_tables, FALSE);
+EXTERN u8 INIT_GLOBAL(gbl_dump_customized_tables, TRUE);
 EXTERN u8 INIT_GLOBAL(gbl_do_not_dump_xsdt, FALSE);
 EXTERN ACPI_FILE INIT_GLOBAL(gbl_output_file, NULL);
 EXTERN char INIT_GLOBAL(*gbl_output_filename, NULL);
tools/power/acpi/tools/acpidump/apmain.c +12 -3
index d0ba653..57620f6 100644
@@ -80,7 +80,7 @@ struct ap_dump_action action_table[AP_MAX_ACTIONS];
 u32 current_action = 0;
 
 #define AP_UTILITY_NAME             "ACPI Binary Table Dump Utility"
-#define AP_SUPPORTED_OPTIONS        "?a:bcf:hn:o:r:svxz"
+#define AP_SUPPORTED_OPTIONS        "?a:bc:f:hn:o:r:svxz"
 
 /******************************************************************************
  *
@@ -96,7 +96,6 @@ static void ap_display_usage(void)
 	ACPI_USAGE_HEADER("acpidump [options]");
 
 	ACPI_OPTION("-b", "Dump tables to binary files");
-	ACPI_OPTION("-c", "Dump customized tables");
 	ACPI_OPTION("-h -?", "This help message");
 	ACPI_OPTION("-o <File>", "Redirect output to file");
 	ACPI_OPTION("-r <Address>", "Dump tables from specified RSDP");
@@ -107,6 +106,7 @@ static void ap_display_usage(void)
 	ACPI_USAGE_TEXT("\nTable Options:\n");
 
 	ACPI_OPTION("-a <Address>", "Get table via a physical address");
+	ACPI_OPTION("-c <on|off>", "Turning on/off customized table dumping");
 	ACPI_OPTION("-f <BinaryFile>", "Get table via a binary file");
 	ACPI_OPTION("-n <Signature>", "Get table via a name/signature");
 	ACPI_OPTION("-x", "Do not use but dump XSDT");
@@ -181,7 +181,16 @@ static int ap_do_options(int argc, char **argv)
 
 		case 'c':	/* Dump customized tables */
 
-			gbl_dump_customized_tables = TRUE;
+			if (!strcmp(acpi_gbl_optarg, "on")) {
+				gbl_dump_customized_tables = TRUE;
+			} else if (!strcmp(acpi_gbl_optarg, "off")) {
+				gbl_dump_customized_tables = FALSE;
+			} else {
+				acpi_log_error
+				    ("%s: Cannot handle this switch, please use on|off\n",
+				     acpi_gbl_optarg);
+				return (-1);
+			}
 			continue;
 
 		case 'h':
Signature · 1 line
1.7.10
author
#34 lore raw

PATCH 24/32 ACPI / acpidump: Update acpidump manual.

In reply to Lv Zheng

This patch updates acpidump manual according to the recent changes.

---
 tools/power/acpi/man/acpidump.8 |   17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)
tools/power/acpi/man/acpidump.8 +12 -5
index 38f095d..79e2d1d 100644
@@ -22,9 +22,6 @@ acpidump options are as follow:
 .B \-b
 Dump tables to binary files
 .TP
-.B \-c
-Dump customized tables
-.TP
 .B \-h \-?
 This help message
 .TP
@@ -48,15 +45,25 @@ Verbose mode
 .B \-a <Address>
 Get table via a physical address
 .TP
+.B \-c <on|off>
+Turning on/off customized table dumping
+.TP
 .B \-f <BinaryFile>
 Get table via a binary file
 .TP
 .B \-n <Signature>
 Get table via a name/signature
 .TP
-Invocation without parameters dumps all available tables
+.B \-x
+Do not use but dump XSDT
+.TP
+.B \-x \-x
+Do not use or dump XSDT
+.TP
+.fi
+Invocation without parameters dumps all available tables.
 .TP
-Multiple mixed instances of -a, -f, and -n are supported
+Multiple mixed instances of -a, -f, and -n are supported.
 
 .SH EXAMPLES
 
Signature · 1 line
1.7.10
author
#35 lore raw

PATCH 25/32 ACPICA: De-macroize calls to standard C library functions.

In reply to Lv Zheng

From: Bob Moore <[email protected]>

ACPICA commit 3b1026e0bdd3c32eb6d5d313f3ba0b1fee7597b4

Across all of ACPICA. Replace C library macros such as ACPI_STRLEN with the standard names such as strlen. The original purpose for these macros is long since obsolete.

---
 drivers/acpi/acpica/acutils.h                      |   64 ++++++++++++--------
 drivers/acpi/acpica/dsfield.c                      |    2 +-
 drivers/acpi/acpica/dsinit.c                       |    2 +-
 drivers/acpi/acpica/dsobject.c                     |    7 +--
 drivers/acpi/acpica/dsutils.c                      |    4 +-
 drivers/acpi/acpica/evgpeinit.c                    |    2 +-
 drivers/acpi/acpica/exconfig.c                     |    2 +-
 drivers/acpi/acpica/exconvrt.c                     |    9 ++-
 drivers/acpi/acpica/exfield.c                      |    2 +-
 drivers/acpi/acpica/exfldio.c                      |   52 ++++++++--------
 drivers/acpi/acpica/exmisc.c                       |   36 +++++------
 drivers/acpi/acpica/exnames.c                      |    2 +-
 drivers/acpi/acpica/exoparg2.c                     |    4 +-
 drivers/acpi/acpica/exoparg3.c                     |    4 +-
 drivers/acpi/acpica/exregion.c                     |    9 ++-
 drivers/acpi/acpica/exstorob.c                     |   18 +++---
 drivers/acpi/acpica/nsaccess.c                     |    6 +-
 drivers/acpi/acpica/nsconvert.c                    |   10 +--
 drivers/acpi/acpica/nsdump.c                       |    2 +-
 drivers/acpi/acpica/nseval.c                       |    2 +-
 drivers/acpi/acpica/nsinit.c                       |    4 +-
 drivers/acpi/acpica/nsrepair2.c                    |    2 +-
 drivers/acpi/acpica/nsutils.c                      |    3 +-
 drivers/acpi/acpica/nsxfeval.c                     |    5 +-
 drivers/acpi/acpica/nsxfname.c                     |    6 +-
 drivers/acpi/acpica/psutils.c                      |    7 +--
 drivers/acpi/acpica/rscreate.c                     |    6 +-
 drivers/acpi/acpica/rsmisc.c                       |    8 +--
 drivers/acpi/acpica/rsutils.c                      |   11 ++--
 drivers/acpi/acpica/rsxface.c                      |    8 +--
 drivers/acpi/acpica/tbdata.c                       |    8 +--
 drivers/acpi/acpica/tbfadt.c                       |    6 +-
 drivers/acpi/acpica/tbfind.c                       |   21 +++----
 drivers/acpi/acpica/tbinstal.c                     |    7 +--
 drivers/acpi/acpica/tbprint.c                      |   10 +--
 drivers/acpi/acpica/tbutils.c                      |    2 +-
 drivers/acpi/acpica/tbxface.c                      |   16 ++---
 drivers/acpi/acpica/tbxfload.c                     |    4 +-
 drivers/acpi/acpica/utalloc.c                      |    6 +-
 drivers/acpi/acpica/utbuffer.c                     |    4 +-
 drivers/acpi/acpica/utcache.c                      |    6 +-
 drivers/acpi/acpica/utcopy.c                       |   42 ++++++-------
 drivers/acpi/acpica/utids.c                        |    9 ++-
 drivers/acpi/acpica/utmisc.c                       |    6 +-
 drivers/acpi/acpica/utosi.c                        |    9 ++-
 drivers/acpi/acpica/utpredef.c                     |    4 +-
 drivers/acpi/acpica/utprint.c                      |    6 +-
 drivers/acpi/acpica/utstring.c                     |   33 +++++-----
 drivers/acpi/acpica/uttrack.c                      |    8 +--
 drivers/acpi/acpica/utxface.c                      |    8 +--
 include/acpi/actypes.h                             |    8 +--
 include/acpi/platform/acenv.h                      |   38 ------------
 tools/power/acpi/common/getopt.c                   |    4 +-
 .../acpi/os_specific/service_layers/oslinuxtbl.c   |    6 +-
 tools/power/acpi/tools/acpidump/apdump.c           |    8 +--
 tools/power/acpi/tools/acpidump/apfiles.c          |   12 ++--
 56 files changed, 278 insertions(+), 312 deletions(-)
drivers/acpi/acpica/acutils.h +40 -24
index 6391c97..8f62703 100644
@@ -210,37 +210,35 @@ void acpi_ut_subsystem_shutdown(void);
  */
 #ifndef ACPI_USE_SYSTEM_CLIBRARY
 
-acpi_size acpi_ut_strlen(const char *string);
+acpi_size strlen(const char *string);
 
-char *acpi_ut_strchr(const char *string, int ch);
+char *strchr(const char *string, int ch);
 
-char *acpi_ut_strcpy(char *dst_string, const char *src_string);
+char *strcpy(char *dst_string, const char *src_string);
 
-char *acpi_ut_strncpy(char *dst_string,
-		      const char *src_string, acpi_size count);
+char *strncpy(char *dst_string, const char *src_string, acpi_size count);
 
-int acpi_ut_memcmp(const char *buffer1, const char *buffer2, acpi_size count);
+int strncmp(const char *string1, const char *string2, acpi_size count);
 
-int acpi_ut_strncmp(const char *string1, const char *string2, acpi_size count);
+int strcmp(const char *string1, const char *string2);
 
-int acpi_ut_strcmp(const char *string1, const char *string2);
+char *strcat(char *dst_string, const char *src_string);
 
-char *acpi_ut_strcat(char *dst_string, const char *src_string);
+char *strncat(char *dst_string, const char *src_string, acpi_size count);
 
-char *acpi_ut_strncat(char *dst_string,
-		      const char *src_string, acpi_size count);
+u32 strtoul(const char *string, char **terminator, u32 base);
 
-u32 acpi_ut_strtoul(const char *string, char **terminator, u32 base);
+char *strstr(char *string1, char *string2);
 
-char *acpi_ut_strstr(char *string1, char *string2);
+int memcmp(void *buffer1, void *buffer2, acpi_size count);
 
-void *acpi_ut_memcpy(void *dest, const void *src, acpi_size count);
+void *memcpy(void *dest, const void *src, acpi_size count);
 
-void *acpi_ut_memset(void *dest, u8 value, acpi_size count);
+void *memset(void *dest, u8 value, acpi_size count);
 
-int acpi_ut_to_upper(int c);
+int toupper(int c);
 
-int acpi_ut_to_lower(int c);
+int tolower(int c);
 
 extern const u8 _acpi_ctype[];
 
@@ -255,13 +253,31 @@ extern const u8 _acpi_ctype[];
 #define _ACPI_UP     0x01	/* 'A'-'Z' */
 #define _ACPI_XD     0x80	/* '0'-'9', 'A'-'F', 'a'-'f' */
 
-#define ACPI_IS_DIGIT(c)  (_acpi_ctype[(unsigned char)(c)] & (_ACPI_DI))
-#define ACPI_IS_SPACE(c)  (_acpi_ctype[(unsigned char)(c)] & (_ACPI_SP))
-#define ACPI_IS_XDIGIT(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_XD))
-#define ACPI_IS_UPPER(c)  (_acpi_ctype[(unsigned char)(c)] & (_ACPI_UP))
-#define ACPI_IS_LOWER(c)  (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO))
-#define ACPI_IS_PRINT(c)  (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO | _ACPI_UP | _ACPI_DI | _ACPI_XS | _ACPI_PU))
-#define ACPI_IS_ALPHA(c)  (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO | _ACPI_UP))
+#define isdigit(c)  (_acpi_ctype[(unsigned char)(c)] & (_ACPI_DI))
+#define isspace(c)  (_acpi_ctype[(unsigned char)(c)] & (_ACPI_SP))
+#define isxdigit(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_XD))
+#define isupper(c)  (_acpi_ctype[(unsigned char)(c)] & (_ACPI_UP))
+#define islower(c)  (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO))
+#define isprint(c)  (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO | _ACPI_UP | _ACPI_DI | _ACPI_XS | _ACPI_PU))
+#define isalpha(c)  (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO | _ACPI_UP))
+
+#ifndef ACPI_CLIBRARY
+#define strstr(s1,s2)       strstr ((s1), (s2))
+#define strchr(s1,c)        strchr ((s1), (c))
+#define strlen(s)           (acpi_size) strlen ((s))
+#define strcpy(d,s)         (void) strcpy ((d), (s))
+#define strncpy(d,s,n)      (void) strncpy ((d), (s), (acpi_size)(n))
+#define strncmp(d,s,n)      strncmp ((d), (s), (acpi_size)(n))
+#define strcmp(d,s)         strcmp ((d), (s))
+#define strcat(d,s)         (void) strcat ((d), (s))
+#define strncat(d,s,n)      strncat ((d), (s), (acpi_size)(n))
+#define strtoul(d,s,n)      strtoul ((d), (s), (acpi_size)(n))
+#define memcmp(s1,s2,n)     memcmp((void *)(s1), (void *)(s2), (acpi_size)(n))
+#define memcpy(d,s,n)       (void) memcpy ((d), (s), (acpi_size)(n))
+#define memset(d,v,n)       (void) memset ((d), (v), (acpi_size)(n))
+#define toupper(c)          toupper ((int) (c))
+#define tolower(c)          tolower ((int) (c))
+#endif				/* ACPI_CLIBRARY */
 
 #endif				/* !ACPI_USE_SYSTEM_CLIBRARY */
 
drivers/acpi/acpica/dsfield.c +1 -1
index 43b40de..20de148 100644
@@ -502,7 +502,7 @@ acpi_ds_create_field(union acpi_parse_object *op,
 		}
 	}
 
-	ACPI_MEMSET(&info, 0, sizeof(struct acpi_create_field_info));
+	memset(&info, 0, sizeof(struct acpi_create_field_info));
 
 	/* Second arg is the field flags */
 
drivers/acpi/acpica/dsinit.c +1 -1
index bbe74bc..95779e8 100644
@@ -207,7 +207,7 @@ acpi_ds_initialize_objects(u32 table_index,
 
 	/* Set all init info to zero */
 
-	ACPI_MEMSET(&info, 0, sizeof(struct acpi_init_walk_info));
+	memset(&info, 0, sizeof(struct acpi_init_walk_info));
 
 	info.owner_id = owner_id;
 	info.table_index = table_index;
drivers/acpi/acpica/dsobject.c +3 -4
index 4a4b2f3..2beb7fd 100644
@@ -339,8 +339,8 @@ acpi_ds_build_internal_buffer_obj(struct acpi_walk_state *walk_state,
 		/* Initialize buffer from the byte_list (if present) */
 
 		if (byte_list) {
-			ACPI_MEMCPY(obj_desc->buffer.pointer,
-				    byte_list->named.data, byte_list_length);
+			memcpy(obj_desc->buffer.pointer, byte_list->named.data,
+			       byte_list_length);
 		}
 	}
 
@@ -750,8 +750,7 @@ acpi_ds_init_object_from_op(struct acpi_walk_state *walk_state,
 	case ACPI_TYPE_STRING:
 
 		obj_desc->string.pointer = op->common.value.string;
-		obj_desc->string.length =
-		    (u32)ACPI_STRLEN(op->common.value.string);
+		obj_desc->string.length = (u32)strlen(op->common.value.string);
 
 		/*
 		 * The string is contained in the ACPI table, don't ever try
drivers/acpi/acpica/dsutils.c +2 -2
index deeddd6..ebc577b 100644
@@ -572,8 +572,8 @@ acpi_ds_create_operand(struct acpi_walk_state *walk_state,
 					obj_desc =
 					    acpi_ut_create_string_object((acpi_size) name_length);
 
-					ACPI_STRNCPY(obj_desc->string.pointer,
-						     name_string, name_length);
+					strncpy(obj_desc->string.pointer,
+						name_string, name_length);
 					status = AE_OK;
 				} else {
 					/*
drivers/acpi/acpica/evgpeinit.c +1 -1
index 8840296..ea4c0d3 100644
@@ -377,7 +377,7 @@ acpi_ev_match_gpe_method(acpi_handle obj_handle,
 
 	/* 4) The last two characters of the name are the hex GPE Number */
 
-	gpe_number = ACPI_STRTOUL(&name[2], NULL, 16);
+	gpe_number = strtoul(&name[2], NULL, 16);
 	if (gpe_number == ACPI_UINT32_MAX) {
 
 		/* Conversion failed; invalid method, just ignore it */
drivers/acpi/acpica/exconfig.c +1 -1
index 6e0df2b..24a4c5c 100644
@@ -470,7 +470,7 @@ acpi_ex_load_op(union acpi_operand_object *obj_desc,
 			return_ACPI_STATUS(AE_NO_MEMORY);
 		}
 
-		ACPI_MEMCPY(table, table_header, length);
+		memcpy(table, table_header, length);
 		break;
 
 	default:
drivers/acpi/acpica/exconvrt.c +4 -5
index 89a976b..075d654 100644
@@ -227,9 +227,8 @@ acpi_ex_convert_to_buffer(union acpi_operand_object *obj_desc,
 		/* Copy the integer to the buffer, LSB first */
 
 		new_buf = return_desc->buffer.pointer;
-		ACPI_MEMCPY(new_buf,
-			    &obj_desc->integer.value,
-			    acpi_gbl_integer_byte_width);
+		memcpy(new_buf,
+		       &obj_desc->integer.value, acpi_gbl_integer_byte_width);
 		break;
 
 	case ACPI_TYPE_STRING:
@@ -252,8 +251,8 @@ acpi_ex_convert_to_buffer(union acpi_operand_object *obj_desc,
 		/* Copy the string to the buffer */
 
 		new_buf = return_desc->buffer.pointer;
-		ACPI_STRNCPY((char *)new_buf, (char *)obj_desc->string.pointer,
-			     obj_desc->string.length);
+		strncpy((char *)new_buf, (char *)obj_desc->string.pointer,
+			obj_desc->string.length);
 		break;
 
 	default:
drivers/acpi/acpica/exfield.c +1 -1
index c161dd9..61fd9c7 100644
@@ -428,7 +428,7 @@ acpi_ex_write_data_to_field(union acpi_operand_object *source_desc,
 		}
 
 		buffer = buffer_desc->buffer.pointer;
-		ACPI_MEMCPY(buffer, source_desc->buffer.pointer, length);
+		memcpy(buffer, source_desc->buffer.pointer, length);
 
 		/* Lock entire transaction if requested */
 
drivers/acpi/acpica/exfldio.c +26 -26

105 lines not on this page · raw message

drivers/acpi/acpica/exmisc.c +18 -18
index b56fc9d..d02afec 100644
@@ -209,8 +209,8 @@ acpi_ex_concat_template(union acpi_operand_object *operand0,
 	 * end_tag descriptor is copied from Operand1.
 	 */
 	new_buf = return_desc->buffer.pointer;
-	ACPI_MEMCPY(new_buf, operand0->buffer.pointer, length0);
-	ACPI_MEMCPY(new_buf + length0, operand1->buffer.pointer, length1);
+	memcpy(new_buf, operand0->buffer.pointer, length0);
+	memcpy(new_buf + length0, operand1->buffer.pointer, length1);
 
 	/* Insert end_tag and set the checksum to zero, means "ignore checksum" */
 
@@ -318,14 +318,14 @@ acpi_ex_do_concatenate(union acpi_operand_object *operand0,
 
 		/* Copy the first integer, LSB first */
 
-		ACPI_MEMCPY(new_buf, &operand0->integer.value,
-			    acpi_gbl_integer_byte_width);
+		memcpy(new_buf, &operand0->integer.value,
+		       acpi_gbl_integer_byte_width);
 
 		/* Copy the second integer (LSB first) after the first */
 
-		ACPI_MEMCPY(new_buf + acpi_gbl_integer_byte_width,
-			    &local_operand1->integer.value,
-			    acpi_gbl_integer_byte_width);
+		memcpy(new_buf + acpi_gbl_integer_byte_width,
+		       &local_operand1->integer.value,
+		       acpi_gbl_integer_byte_width);
 		break;
 
 	case ACPI_TYPE_STRING:
@@ -346,9 +346,9 @@ acpi_ex_do_concatenate(union acpi_operand_object *operand0,
 
 		/* Concatenate the strings */
 
-		ACPI_STRCPY(new_buf, operand0->string.pointer);
-		ACPI_STRCPY(new_buf + operand0->string.length,
-			    local_operand1->string.pointer);
+		strcpy(new_buf, operand0->string.pointer);
+		strcpy(new_buf + operand0->string.length,
+		       local_operand1->string.pointer);
 		break;
 
 	case ACPI_TYPE_BUFFER:
@@ -369,11 +369,11 @@ acpi_ex_do_concatenate(union acpi_operand_object *operand0,
 
 		/* Concatenate the buffers */
 
-		ACPI_MEMCPY(new_buf, operand0->buffer.pointer,
-			    operand0->buffer.length);
-		ACPI_MEMCPY(new_buf + operand0->buffer.length,
-			    local_operand1->buffer.pointer,
-			    local_operand1->buffer.length);
+		memcpy(new_buf, operand0->buffer.pointer,
+		       operand0->buffer.length);
+		memcpy(new_buf + operand0->buffer.length,
+		       local_operand1->buffer.pointer,
+		       local_operand1->buffer.length);
 		break;
 
 	default:
@@ -660,9 +660,9 @@ acpi_ex_do_logical_op(u16 opcode,
 
 		/* Lexicographic compare: compare the data bytes */
 
-		compare = ACPI_MEMCMP(operand0->buffer.pointer,
-				      local_operand1->buffer.pointer,
-				      (length0 > length1) ? length1 : length0);
+		compare = memcmp(operand0->buffer.pointer,
+				 local_operand1->buffer.pointer,
+				 (length0 > length1) ? length1 : length0);
 
 		switch (opcode) {
 		case AML_LEQUAL_OP:	/* LEqual (Operand0, Operand1) */
drivers/acpi/acpica/exnames.c +1 -1
index 453b00c..20e8781 100644
@@ -192,7 +192,7 @@ static acpi_status acpi_ex_name_segment(u8 ** in_aml_address, char *name_string)
 		char_buf[4] = '\0';
 
 		if (name_string) {
-			ACPI_STRCAT(name_string, char_buf);
+			strcat(name_string, char_buf);
 			ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
 					  "Appended to - %s\n", name_string));
 		} else {
drivers/acpi/acpica/exoparg2.c +2 -2
index 6fac5e0..b8944eb 100644
@@ -337,8 +337,8 @@ acpi_status acpi_ex_opcode_2A_1T_1R(struct acpi_walk_state *walk_state)
 		 * Copy the raw buffer data with no transform.
 		 * (NULL terminated already)
 		 */
-		ACPI_MEMCPY(return_desc->string.pointer,
-			    operand[0]->buffer.pointer, length);
+		memcpy(return_desc->string.pointer,
+		       operand[0]->buffer.pointer, length);
 		break;
 
 	case AML_CONCAT_RES_OP:
drivers/acpi/acpica/exoparg3.c +2 -2
index 1c64a98..fa100b3 100644
@@ -237,8 +237,8 @@ acpi_status acpi_ex_opcode_3A_1T_1R(struct acpi_walk_state *walk_state)
 
 			/* We have a buffer, copy the portion requested */
 
-			ACPI_MEMCPY(buffer, operand[0]->string.pointer + index,
-				    length);
+			memcpy(buffer, operand[0]->string.pointer + index,
+			       length);
 		}
 
 		/* Set the length of the new String/Buffer */
drivers/acpi/acpica/exregion.c +4 -5
index f6c2f54..b4a5e44 100644
@@ -517,15 +517,14 @@ acpi_ex_data_table_space_handler(u32 function,
 	switch (function) {
 	case ACPI_READ:
 
-		ACPI_MEMCPY(ACPI_CAST_PTR(char, value),
-			    ACPI_PHYSADDR_TO_PTR(address),
-			    ACPI_DIV_8(bit_width));
+		memcpy(ACPI_CAST_PTR(char, value),
+		       ACPI_PHYSADDR_TO_PTR(address), ACPI_DIV_8(bit_width));
 		break;
 
 	case ACPI_WRITE:
 
-		ACPI_MEMCPY(ACPI_PHYSADDR_TO_PTR(address),
-			    ACPI_CAST_PTR(char, value), ACPI_DIV_8(bit_width));
+		memcpy(ACPI_PHYSADDR_TO_PTR(address),
+		       ACPI_CAST_PTR(char, value), ACPI_DIV_8(bit_width));
 		break;
 
 	default:
drivers/acpi/acpica/exstorob.c +9 -9
index 6fa3c8d..e1d4f4d 100644
@@ -100,9 +100,9 @@ acpi_ex_store_buffer_to_buffer(union acpi_operand_object *source_desc,
 
 		/* Clear existing buffer and copy in the new one */
 
-		ACPI_MEMSET(target_desc->buffer.pointer, 0,
-			    target_desc->buffer.length);
-		ACPI_MEMCPY(target_desc->buffer.pointer, buffer, length);
+		memset(target_desc->buffer.pointer, 0,
+		       target_desc->buffer.length);
+		memcpy(target_desc->buffer.pointer, buffer, length);
 
 #ifdef ACPI_OBSOLETE_BEHAVIOR
 		/*
@@ -129,8 +129,8 @@ acpi_ex_store_buffer_to_buffer(union acpi_operand_object *source_desc,
 	} else {
 		/* Truncate the source, copy only what will fit */
 
-		ACPI_MEMCPY(target_desc->buffer.pointer, buffer,
-			    target_desc->buffer.length);
+		memcpy(target_desc->buffer.pointer, buffer,
+		       target_desc->buffer.length);
 
 		ACPI_DEBUG_PRINT((ACPI_DB_INFO,
 				  "Truncating source buffer from %X to %X\n",
@@ -187,9 +187,9 @@ acpi_ex_store_string_to_string(union acpi_operand_object *source_desc,
 		 * String will fit in existing non-static buffer.
 		 * Clear old string and copy in the new one
 		 */
-		ACPI_MEMSET(target_desc->string.pointer, 0,
-			    (acpi_size) target_desc->string.length + 1);
-		ACPI_MEMCPY(target_desc->string.pointer, buffer, length);
+		memset(target_desc->string.pointer, 0,
+		       (acpi_size) target_desc->string.length + 1);
+		memcpy(target_desc->string.pointer, buffer, length);
 	} else {
 		/*
 		 * Free the current buffer, then allocate a new buffer
@@ -210,7 +210,7 @@ acpi_ex_store_string_to_string(union acpi_operand_object *source_desc,
 		}
 
 		target_desc->common.flags &= ~AOPOBJ_STATIC_POINTER;
-		ACPI_MEMCPY(target_desc->string.pointer, buffer, length);
+		memcpy(target_desc->string.pointer, buffer, length);
 	}
 
 	/* Set the new target length */
drivers/acpi/acpica/nsaccess.c +3 -3
index 19ad0b5..c687b99 100644
@@ -102,7 +102,7 @@ acpi_status acpi_ns_root_initialize(void)
 
 		/* _OSI is optional for now, will be permanent later */
 
-		if (!ACPI_STRCMP(init_val->name, "_OSI")
+		if (!strcmp(init_val->name, "_OSI")
 		    && !acpi_gbl_create_osi_method) {
 			continue;
 		}
@@ -180,7 +180,7 @@ acpi_status acpi_ns_root_initialize(void)
 
 				/* Build an object around the static string */
 
-				obj_desc->string.length = (u32)ACPI_STRLEN(val);
+				obj_desc->string.length = (u32)strlen(val);
 				obj_desc->string.pointer = val;
 				obj_desc->common.flags |= AOPOBJ_STATIC_POINTER;
 				break;
@@ -203,7 +203,7 @@ acpi_status acpi_ns_root_initialize(void)
 
 				/* Special case for ACPI Global Lock */
 
-				if (ACPI_STRCMP(init_val->name, "_GL_") == 0) {
+				if (strcmp(init_val->name, "_GL_") == 0) {
 					acpi_gbl_global_lock_mutex = obj_desc;
 
 					/* Create additional counting semaphore for global lock */
drivers/acpi/acpica/nsconvert.c +5 -5
index 1a8b39c..da55a1c 100644
@@ -187,8 +187,8 @@ acpi_ns_convert_to_string(union acpi_operand_object *original_object,
 		 * Copy the raw buffer data with no transform. String is already NULL
 		 * terminated at Length+1.
 		 */
-		ACPI_MEMCPY(new_object->string.pointer,
-			    original_object->buffer.pointer, length);
+		memcpy(new_object->string.pointer,
+		       original_object->buffer.pointer, length);
 		break;
 
 	default:
@@ -251,9 +251,9 @@ acpi_ns_convert_to_buffer(union acpi_operand_object *original_object,
 			return (AE_NO_MEMORY);
 		}
 
-		ACPI_MEMCPY(new_object->buffer.pointer,
-			    original_object->string.pointer,
-			    original_object->string.length);
+		memcpy(new_object->buffer.pointer,
+		       original_object->string.pointer,
+		       original_object->string.length);
 		break;
 
 	case ACPI_TYPE_PACKAGE:
drivers/acpi/acpica/nsdump.c +1 -1
index d259393..b5fcf65 100644
@@ -101,7 +101,7 @@ void acpi_ns_print_pathname(u32 num_segments, char *pathname)
 
 	while (num_segments) {
 		for (i = 0; i < 4; i++) {
-			ACPI_IS_PRINT(pathname[i]) ?
+			isprint(pathname[i]) ?
 			    acpi_os_printf("%c", pathname[i]) :
 			    acpi_os_printf("?");
 		}
drivers/acpi/acpica/nseval.c +1 -1
index 7bcc68f..a725d88 100644
@@ -440,7 +440,7 @@ acpi_ns_exec_module_code(union acpi_operand_object *method_obj,
 
 	/* Initialize the evaluation information block */
 
-	ACPI_MEMSET(info, 0, sizeof(struct acpi_evaluate_info));
+	memset(info, 0, sizeof(struct acpi_evaluate_info));
 	info->prefix_node = parent_node;
 
 	/*
drivers/acpi/acpica/nsinit.c +2 -2
index 4a85c45..b744a53 100644
@@ -90,7 +90,7 @@ acpi_status acpi_ns_initialize_objects(void)
 
 	/* Set all init info to zero */
 
-	ACPI_MEMSET(&info, 0, sizeof(struct acpi_init_walk_info));
+	memset(&info, 0, sizeof(struct acpi_init_walk_info));
 
 	/* Walk entire namespace from the supplied root */
 
@@ -566,7 +566,7 @@ acpi_ns_init_one_device(acpi_handle obj_handle,
 	ACPI_DEBUG_EXEC(acpi_ut_display_init_pathname
 			(ACPI_TYPE_METHOD, device_node, METHOD_NAME__INI));
 
-	ACPI_MEMSET(info, 0, sizeof(struct acpi_evaluate_info));
+	memset(info, 0, sizeof(struct acpi_evaluate_info));
 	info->prefix_node = device_node;
 	info->relative_pathname = METHOD_NAME__INI;
 	info->parameters = NULL;
drivers/acpi/acpica/nsrepair2.c +1 -1
index c30672d..abf8dff 100644
@@ -580,7 +580,7 @@ acpi_ns_repair_HID(struct acpi_evaluate_info *info,
 	 * # is a hex digit.
 	 */
 	for (dest = new_string->string.pointer; *source; dest++, source++) {
-		*dest = (char)ACPI_TOUPPER(*source);
+		*dest = (char)toupper(*source);
 	}
 
 	acpi_ut_remove_reference(return_object);
drivers/acpi/acpica/nsutils.c +1 -2
index 6ad0200..8d8104b 100644
@@ -292,8 +292,7 @@ acpi_status acpi_ns_build_internal_name(struct acpi_namestring_info *info)
 			} else {
 				/* Convert the character to uppercase and save it */
 
-				result[i] =
-				    (char)ACPI_TOUPPER((int)*external_name);
+				result[i] = (char)toupper((int)*external_name);
 				external_name++;
 			}
 		}
drivers/acpi/acpica/nsxfeval.c +2 -3
index b6030a2..6ee1e52 100644
@@ -696,7 +696,7 @@ acpi_ns_get_device_callback(acpi_handle obj_handle,
 			return (AE_CTRL_DEPTH);
 		}
 
-		no_match = ACPI_STRCMP(hid->string, info->hid);
+		no_match = strcmp(hid->string, info->hid);
 		ACPI_FREE(hid);
 
 		if (no_match) {
@@ -715,8 +715,7 @@ acpi_ns_get_device_callback(acpi_handle obj_handle,
 
 			found = FALSE;
 			for (i = 0; i < cid->count; i++) {
-				if (ACPI_STRCMP(cid->ids[i].string, info->hid)
-				    == 0) {
+				if (strcmp(cid->ids[i].string, info->hid) == 0) {
 
 					/* Found a matching CID */
 
drivers/acpi/acpica/nsxfname.c +3 -3
index dc0836a..9ff643b 100644
@@ -114,7 +114,7 @@ acpi_get_handle(acpi_handle parent,
 
 		/* Special case for root-only, since we can't search for it */
 
-		if (!ACPI_STRCMP(pathname, ACPI_NS_ROOT_PATH)) {
+		if (!strcmp(pathname, ACPI_NS_ROOT_PATH)) {
 			*ret_handle =
 			    ACPI_CAST_PTR(acpi_handle, acpi_gbl_root_node);
 			return (AE_OK);
@@ -242,7 +242,7 @@ static char *acpi_ns_copy_device_id(struct acpi_pnp_device_id *dest,
 
 	/* Copy actual string and return a pointer to the next string area */
 
-	ACPI_MEMCPY(string_area, source->string, source->length);
+	memcpy(string_area, source->string, source->length);
 	return (string_area + source->length);
 }
 
@@ -637,7 +637,7 @@ acpi_status acpi_install_method(u8 *buffer)
 
 	/* Copy the method AML to the local buffer */
 
-	ACPI_MEMCPY(aml_buffer, aml_start, aml_length);
+	memcpy(aml_buffer, aml_start, aml_length);
 
 	/* Initialize the method object with the new method's information */
 
drivers/acpi/acpica/psutils.c +3 -4
index 960505a..3244091 100644
@@ -93,10 +93,9 @@ void acpi_ps_init_op(union acpi_parse_object *op, u16 opcode)
 	op->common.descriptor_type = ACPI_DESC_TYPE_PARSER;
 	op->common.aml_opcode = opcode;
 
-	ACPI_DISASM_ONLY_MEMBERS(ACPI_STRNCPY(op->common.aml_op_name,
-					      (acpi_ps_get_opcode_info
-					       (opcode))->name,
-					      sizeof(op->common.aml_op_name)));
+	ACPI_DISASM_ONLY_MEMBERS(strncpy(op->common.aml_op_name,
+					 (acpi_ps_get_opcode_info(opcode))->
+					 name, sizeof(op->common.aml_op_name)));
 }
 
 /*******************************************************************************
drivers/acpi/acpica/rscreate.c +3 -3
index f30f35e..3fa829e 100644
@@ -353,13 +353,13 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object,
 				/* +1 to include null terminator */
 
 				user_prt->length +=
-				    (u32)ACPI_STRLEN(user_prt->source) + 1;
+				    (u32)strlen(user_prt->source) + 1;
 				break;
 
 			case ACPI_TYPE_STRING:
 
-				ACPI_STRCPY(user_prt->source,
-					    obj_desc->string.pointer);
+				strcpy(user_prt->source,
+				       obj_desc->string.pointer);
 
 				/*
 				 * Add to the Length field the length of the string
drivers/acpi/acpica/rsmisc.c +4 -4
index 1fe49d2..ac37852 100644
@@ -119,7 +119,7 @@ acpi_rs_convert_aml_to_resource(struct acpi_resource *resource,
 			/*
 			 * Get the resource type and the initial (minimum) length
 			 */
-			ACPI_MEMSET(resource, 0, INIT_RESOURCE_LENGTH(info));
+			memset(resource, 0, INIT_RESOURCE_LENGTH(info));
 			resource->type = INIT_RESOURCE_TYPE(info);
 			resource->length = INIT_RESOURCE_LENGTH(info);
 			break;
@@ -324,13 +324,13 @@ acpi_rs_convert_aml_to_resource(struct acpi_resource *resource,
 
 		case ACPI_RSC_SET8:
 
-			ACPI_MEMSET(destination, info->aml_offset, info->value);
+			memset(destination, info->aml_offset, info->value);
 			break;
 
 		case ACPI_RSC_DATA8:
 
 			target = ACPI_ADD_PTR(char, resource, info->value);
-			ACPI_MEMCPY(destination, source, ACPI_GET16(target));
+			memcpy(destination, source, ACPI_GET16(target));
 			break;
 
 		case ACPI_RSC_ADDRESS:
@@ -502,7 +502,7 @@ acpi_rs_convert_resource_to_aml(struct acpi_resource *resource,
 		switch (info->opcode) {
 		case ACPI_RSC_INITSET:
 
-			ACPI_MEMSET(aml, 0, INIT_RESOURCE_LENGTH(info));
+			memset(aml, 0, INIT_RESOURCE_LENGTH(info));
 			aml_length = INIT_RESOURCE_LENGTH(info);
 			acpi_rs_set_resource_header(INIT_RESOURCE_TYPE(info),
 						    aml_length, aml);
drivers/acpi/acpica/rsutils.c +5 -6
index 90417de..52b024d 100644
@@ -148,7 +148,7 @@ acpi_rs_move_data(void *destination, void *source, u16 item_count, u8 move_type)
 		case ACPI_RSC_MOVE_SERIAL_VEN:
 		case ACPI_RSC_MOVE_SERIAL_RES:
 
-			ACPI_MEMCPY(destination, source, item_count);
+			memcpy(destination, source, item_count);
 			return;
 
 			/*
@@ -364,12 +364,11 @@ acpi_rs_get_resource_source(acpi_rs_length resource_length,
 		 * Zero the entire area of the buffer.
 		 */
 		total_length =
-		    (u32)
-		    ACPI_STRLEN(ACPI_CAST_PTR(char, &aml_resource_source[1])) +
+		    (u32)strlen(ACPI_CAST_PTR(char, &aml_resource_source[1])) +
 		    1;
 		total_length = (u32)ACPI_ROUND_UP_TO_NATIVE_WORD(total_length);
 
-		ACPI_MEMSET(resource_source->string_ptr, 0, total_length);
+		memset(resource_source->string_ptr, 0, total_length);
 
 		/* Copy the resource_source string to the destination */
 
@@ -432,8 +431,8 @@ acpi_rs_set_resource_source(union aml_resource * aml,
 
 		/* Copy the resource_source string */
 
-		ACPI_STRCPY(ACPI_CAST_PTR(char, &aml_resource_source[1]),
-			    resource_source->string_ptr);
+		strcpy(ACPI_CAST_PTR(char, &aml_resource_source[1]),
+		       resource_source->string_ptr);
 
 		/*
 		 * Add the length of the string (+ 1 for null terminator) to the
drivers/acpi/acpica/rsxface.c +4 -4
index 8e6276d..de51f83 100644
@@ -398,8 +398,8 @@ acpi_resource_to_address64(struct acpi_resource *resource,
 
 		/* Simple copy for 64 bit source */
 
-		ACPI_MEMCPY(out, &resource->data,
-			    sizeof(struct acpi_resource_address64));
+		memcpy(out, &resource->data,
+		       sizeof(struct acpi_resource_address64));
 		break;
 
 	default:
@@ -499,7 +499,7 @@ acpi_rs_match_vendor_resource(struct acpi_resource *resource, void *context)
 	 */
 	if ((vendor->byte_length < (ACPI_UUID_LENGTH + 1)) ||
 	    (vendor->uuid_subtype != info->uuid->subtype) ||
-	    (ACPI_MEMCMP(vendor->uuid, info->uuid->data, ACPI_UUID_LENGTH))) {
+	    (memcmp(vendor->uuid, info->uuid->data, ACPI_UUID_LENGTH))) {
 		return (AE_OK);
 	}
 
@@ -513,7 +513,7 @@ acpi_rs_match_vendor_resource(struct acpi_resource *resource, void *context)
 
 	/* Found the correct resource, copy and return it */
 
-	ACPI_MEMCPY(buffer->pointer, resource, resource->length);
+	memcpy(buffer->pointer, resource, resource->length);
 	buffer->length = resource->length;
 
 	/* Found the desired descriptor, terminate resource walk */
drivers/acpi/acpica/tbdata.c +4 -4
index d7f8386..5c9d5ab 100644
@@ -73,7 +73,7 @@ acpi_tb_init_table_descriptor(struct acpi_table_desc *table_desc,
 	 * Initialize the table descriptor. Set the pointer to NULL, since the
 	 * table is not fully mapped at this time.
 	 */
-	ACPI_MEMSET(table_desc, 0, sizeof(struct acpi_table_desc));
+	memset(table_desc, 0, sizeof(struct acpi_table_desc));
 	table_desc->address = address;
 	table_desc->length = table->length;
 	table_desc->flags = flags;
@@ -465,9 +465,9 @@ acpi_status acpi_tb_resize_root_table_list(void)
 	/* Copy and free the previous table array */
 
 	if (acpi_gbl_root_table_list.tables) {
-		ACPI_MEMCPY(tables, acpi_gbl_root_table_list.tables,
-			    (acpi_size) table_count *
-			    sizeof(struct acpi_table_desc));
+		memcpy(tables, acpi_gbl_root_table_list.tables,
+		       (acpi_size) table_count *
+		       sizeof(struct acpi_table_desc));
 
 		if (acpi_gbl_root_table_list.flags & ACPI_ROOT_ORIGIN_ALLOCATED) {
 			ACPI_FREE(acpi_gbl_root_table_list.tables);
drivers/acpi/acpica/tbfadt.c +3 -3
index 05be59c..6253001 100644
@@ -398,12 +398,12 @@ void acpi_tb_create_local_fadt(struct acpi_table_header *table, u32 length)
 
 	/* Clear the entire local FADT */
 
-	ACPI_MEMSET(&acpi_gbl_FADT, 0, sizeof(struct acpi_table_fadt));
+	memset(&acpi_gbl_FADT, 0, sizeof(struct acpi_table_fadt));
 
 	/* Copy the original FADT, up to sizeof (struct acpi_table_fadt) */
 
-	ACPI_MEMCPY(&acpi_gbl_FADT, table,
-		    ACPI_MIN(length, sizeof(struct acpi_table_fadt)));
+	memcpy(&acpi_gbl_FADT, table,
+	       ACPI_MIN(length, sizeof(struct acpi_table_fadt)));
 
 	/* Take a copy of the Hardware Reduced flag */
 
drivers/acpi/acpica/tbfind.c +10 -11
index 0b879fc..119c84a 100644
@@ -76,16 +76,16 @@ acpi_tb_find_table(char *signature,
 
 	/* Normalize the input strings */
 
-	ACPI_MEMSET(&header, 0, sizeof(struct acpi_table_header));
+	memset(&header, 0, sizeof(struct acpi_table_header));
 	ACPI_MOVE_NAME(header.signature, signature);
-	ACPI_STRNCPY(header.oem_id, oem_id, ACPI_OEM_ID_SIZE);
-	ACPI_STRNCPY(header.oem_table_id, oem_table_id, ACPI_OEM_TABLE_ID_SIZE);
+	strncpy(header.oem_id, oem_id, ACPI_OEM_ID_SIZE);
+	strncpy(header.oem_table_id, oem_table_id, ACPI_OEM_TABLE_ID_SIZE);
 
 	/* Search for the table */
 
 	for (i = 0; i < acpi_gbl_root_table_list.current_table_count; ++i) {
-		if (ACPI_MEMCMP(&(acpi_gbl_root_table_list.tables[i].signature),
-				header.signature, ACPI_NAME_SIZE)) {
+		if (memcmp(&(acpi_gbl_root_table_list.tables[i].signature),
+			   header.signature, ACPI_NAME_SIZE)) {
 
 			/* Not the requested table */
 
@@ -112,21 +112,20 @@ acpi_tb_find_table(char *signature,
 
 		/* Check for table match on all IDs */
 
-		if (!ACPI_MEMCMP
+		if (!memcmp
 		    (acpi_gbl_root_table_list.tables[i].pointer->signature,
 		     header.signature, ACPI_NAME_SIZE) && (!oem_id[0]
 							   ||
-							   !ACPI_MEMCMP
+							   !memcmp
 							   (acpi_gbl_root_table_list.
 							    tables[i].pointer->
 							    oem_id,
 							    header.oem_id,
 							    ACPI_OEM_ID_SIZE))
 		    && (!oem_table_id[0]
-			|| !ACPI_MEMCMP(acpi_gbl_root_table_list.tables[i].
-					pointer->oem_table_id,
-					header.oem_table_id,
-					ACPI_OEM_TABLE_ID_SIZE))) {
+			|| !memcmp(acpi_gbl_root_table_list.tables[i].pointer->
+				   oem_table_id, header.oem_table_id,
+				   ACPI_OEM_TABLE_ID_SIZE))) {
 			*table_index = i;
 
 			ACPI_DEBUG_PRINT((ACPI_DB_TABLES,
drivers/acpi/acpica/tbinstal.c +3 -4
index 008a251..15ea98e 100644
@@ -87,8 +87,8 @@ acpi_tb_compare_tables(struct acpi_table_desc *table_desc, u32 table_index)
 	 * not just the header.
 	 */
 	is_identical = (u8)((table_desc->length != table_length ||
-			     ACPI_MEMCMP(table_desc->pointer, table,
-					 table_length)) ? FALSE : TRUE);
+			     memcmp(table_desc->pointer, table, table_length)) ?
+			    FALSE : TRUE);
 
 	/* Release the acquired table */
 
@@ -289,8 +289,7 @@ acpi_tb_install_standard_table(acpi_physical_address address,
 		if ((new_table_desc.signature.ascii[0] != 0x00) &&
 		    (!ACPI_COMPARE_NAME
 		     (&new_table_desc.signature, ACPI_SIG_SSDT))
-		    && (ACPI_STRNCMP(new_table_desc.signature.ascii, "OEM", 3)))
-		{
+		    && (strncmp(new_table_desc.signature.ascii, "OEM", 3))) {
 			ACPI_BIOS_ERROR((AE_INFO,
 					 "Table has invalid signature [%4.4s] (0x%8.8X), "
 					 "must be SSDT or OEMx",
drivers/acpi/acpica/tbprint.c +5 -5
index 77ba5c7..c8ed532 100644
@@ -73,7 +73,7 @@ static void acpi_tb_fix_string(char *string, acpi_size length)
 {
 
 	while (length && *string) {
-		if (!ACPI_IS_PRINT(*string)) {
+		if (!isprint(*string)) {
 			*string = '?';
 		}
 		string++;
@@ -100,7 +100,7 @@ acpi_tb_cleanup_table_header(struct acpi_table_header *out_header,
 			     struct acpi_table_header *header)
 {
 
-	ACPI_MEMCPY(out_header, header, sizeof(struct acpi_table_header));
+	memcpy(out_header, header, sizeof(struct acpi_table_header));
 
 	acpi_tb_fix_string(out_header->signature, ACPI_NAME_SIZE);
 	acpi_tb_fix_string(out_header->oem_id, ACPI_OEM_ID_SIZE);
@@ -138,9 +138,9 @@ acpi_tb_print_table_header(acpi_physical_address address,
 
 		/* RSDP has no common fields */
 
-		ACPI_MEMCPY(local_header.oem_id,
-			    ACPI_CAST_PTR(struct acpi_table_rsdp,
-					  header)->oem_id, ACPI_OEM_ID_SIZE);
+		memcpy(local_header.oem_id,
+		       ACPI_CAST_PTR(struct acpi_table_rsdp, header)->oem_id,
+		       ACPI_OEM_ID_SIZE);
 		acpi_tb_fix_string(local_header.oem_id, ACPI_OEM_ID_SIZE);
 
 		ACPI_INFO((AE_INFO, "RSDP 0x%8.8X%8.8X %06X (v%.2d %-6.6s)",
drivers/acpi/acpica/tbutils.c +1 -1
index 2bb6a11..568ac0e 100644
@@ -188,7 +188,7 @@ struct acpi_table_header *acpi_tb_copy_dsdt(u32 table_index)
 		return (NULL);
 	}
 
-	ACPI_MEMCPY(new_table, table_desc->pointer, table_desc->length);
+	memcpy(new_table, table_desc->pointer, table_desc->length);
 	acpi_tb_uninstall_table(table_desc);
 
 	acpi_tb_init_table_descriptor(&acpi_gbl_root_table_list.
drivers/acpi/acpica/tbxface.c +8 -8
index 54b9f79..5559e2c 100644
@@ -119,9 +119,9 @@ acpi_initialize_tables(struct acpi_table_desc * initial_table_array,
 	} else {
 		/* Root Table Array has been statically allocated by the host */
 
-		ACPI_MEMSET(initial_table_array, 0,
-			    (acpi_size) initial_table_count *
-			    sizeof(struct acpi_table_desc));
+		memset(initial_table_array, 0,
+		       (acpi_size) initial_table_count *
+		       sizeof(struct acpi_table_desc));
 
 		acpi_gbl_root_table_list.tables = initial_table_array;
 		acpi_gbl_root_table_list.max_table_count = initial_table_count;
@@ -243,8 +243,8 @@ acpi_get_table_header(char *signature,
 					return (AE_NO_MEMORY);
 				}
 
-				ACPI_MEMCPY(out_table_header, header,
-					    sizeof(struct acpi_table_header));
+				memcpy(out_table_header, header,
+				       sizeof(struct acpi_table_header));
 				acpi_os_unmap_memory(header,
 						     sizeof(struct
 							    acpi_table_header));
@@ -252,9 +252,9 @@ acpi_get_table_header(char *signature,
 				return (AE_NOT_FOUND);
 			}
 		} else {
-			ACPI_MEMCPY(out_table_header,
-				    acpi_gbl_root_table_list.tables[i].pointer,
-				    sizeof(struct acpi_table_header));
+			memcpy(out_table_header,
+			       acpi_gbl_root_table_list.tables[i].pointer,
+			       sizeof(struct acpi_table_header));
 		}
 		return (AE_OK);
 	}
drivers/acpi/acpica/tbxfload.c +2 -2
index cf56e18..9682d40 100644
@@ -150,8 +150,8 @@ static acpi_status acpi_tb_load_namespace(void)
 	 * Save the original DSDT header for detection of table corruption
 	 * and/or replacement of the DSDT from outside the OS.
 	 */
-	ACPI_MEMCPY(&acpi_gbl_original_dsdt_header, acpi_gbl_DSDT,
-		    sizeof(struct acpi_table_header));
+	memcpy(&acpi_gbl_original_dsdt_header, acpi_gbl_DSDT,
+	       sizeof(struct acpi_table_header));
 
 	(void)acpi_ut_release_mutex(ACPI_MTX_TABLES);
 
drivers/acpi/acpica/utalloc.c +3 -3
index 61d8f6d..7a4101f 100644
@@ -73,7 +73,7 @@ void *acpi_os_allocate_zeroed(acpi_size size)
 
 		/* Clear the memory block */
 
-		ACPI_MEMSET(allocation, 0, size);
+		memset(allocation, 0, size);
 	}
 
 	return (allocation);
@@ -181,7 +181,7 @@ acpi_status acpi_ut_delete_caches(void)
 	char buffer[7];
 
 	if (acpi_gbl_display_final_mem_stats) {
-		ACPI_STRCPY(buffer, "MEMORY");
+		strcpy(buffer, "MEMORY");
 		(void)acpi_db_display_statistics(buffer);
 	}
 #endif
@@ -337,6 +337,6 @@ acpi_ut_initialize_buffer(struct acpi_buffer * buffer,
 
 	/* Have a valid buffer, clear it */
 
-	ACPI_MEMSET(buffer->pointer, 0, required_length);
+	memset(buffer->pointer, 0, required_length);
 	return (AE_OK);
 }
drivers/acpi/acpica/utbuffer.c +2 -2
index a8c3964..01c8709 100644
@@ -159,7 +159,7 @@ void acpi_ut_dump_buffer(u8 *buffer, u32 count, u32 display, u32 base_offset)
 			}
 
 			buf_char = buffer[(acpi_size) i + j];
-			if (ACPI_IS_PRINT(buf_char)) {
+			if (isprint(buf_char)) {
 				acpi_os_printf("%c", buf_char);
 			} else {
 				acpi_os_printf(".");
@@ -319,7 +319,7 @@ acpi_ut_dump_buffer_to_file(ACPI_FILE file,
 			}
 
 			buf_char = buffer[(acpi_size) i + j];
-			if (ACPI_IS_PRINT(buf_char)) {
+			if (isprint(buf_char)) {
 				acpi_ut_file_printf(file, "%c", buf_char);
 			} else {
 				acpi_ut_file_printf(file, ".");
drivers/acpi/acpica/utcache.c +3 -3
index eacc5ee..0d21fbd 100644
@@ -84,7 +84,7 @@ acpi_os_create_cache(char *cache_name,
 
 	/* Populate the cache object and return it */
 
-	ACPI_MEMSET(cache, 0, sizeof(struct acpi_memory_list));
+	memset(cache, 0, sizeof(struct acpi_memory_list));
 	cache->list_name = cache_name;
 	cache->object_size = object_size;
 	cache->max_depth = max_depth;
@@ -212,7 +212,7 @@ acpi_os_release_object(struct acpi_memory_list * cache, void *object)
 
 		/* Mark the object as cached */
 
-		ACPI_MEMSET(object, 0xCA, cache->object_size);
+		memset(object, 0xCA, cache->object_size);
 		ACPI_SET_DESCRIPTOR_TYPE(object, ACPI_DESC_TYPE_CACHED);
 
 		/* Put the object at the head of the cache list */
@@ -281,7 +281,7 @@ void *acpi_os_acquire_object(struct acpi_memory_list *cache)
 
 		/* Clear (zero) the previously used Object */
 
-		ACPI_MEMSET(object, 0, cache->object_size);
+		memset(object, 0, cache->object_size);
 	} else {
 		/* The cache is empty, create a new object */
 
drivers/acpi/acpica/utcopy.c +21 -21

90 lines not on this page · raw message

drivers/acpi/acpica/utids.c +4 -5
index 3afe07f..7956df1 100644
@@ -111,7 +111,7 @@ acpi_ut_execute_HID(struct acpi_namespace_node *device_node,
 	if (obj_desc->common.type == ACPI_TYPE_INTEGER) {
 		acpi_ex_eisa_id_to_string(hid->string, obj_desc->integer.value);
 	} else {
-		ACPI_STRCPY(hid->string, obj_desc->string.pointer);
+		strcpy(hid->string, obj_desc->string.pointer);
 	}
 
 	hid->length = length;
@@ -180,7 +180,7 @@ acpi_ut_execute_SUB(struct acpi_namespace_node *device_node,
 
 	/* Simply copy existing string */
 
-	ACPI_STRCPY(sub->string, obj_desc->string.pointer);
+	strcpy(sub->string, obj_desc->string.pointer);
 	sub->length = length;
 	*return_id = sub;
 
@@ -256,7 +256,7 @@ acpi_ut_execute_UID(struct acpi_namespace_node *device_node,
 	if (obj_desc->common.type == ACPI_TYPE_INTEGER) {
 		acpi_ex_integer_to_string(uid->string, obj_desc->integer.value);
 	} else {
-		ACPI_STRCPY(uid->string, obj_desc->string.pointer);
+		strcpy(uid->string, obj_desc->string.pointer);
 	}
 
 	uid->length = length;
@@ -393,8 +393,7 @@ acpi_ut_execute_CID(struct acpi_namespace_node *device_node,
 
 			/* Copy the String CID from the returned object */
 
-			ACPI_STRCPY(next_id_string,
-				    cid_objects[i]->string.pointer);
+			strcpy(next_id_string, cid_objects[i]->string.pointer);
 			length = cid_objects[i]->string.length + 1;
 		}
 
drivers/acpi/acpica/utmisc.c +3 -3
index 28099e2..71b6653 100644
@@ -66,9 +66,9 @@ u8 acpi_ut_is_pci_root_bridge(char *id)
 	 * Check if this is a PCI root bridge.
 	 * ACPI 3.0+: check for a PCI Express root also.
 	 */
-	if (!(ACPI_STRCMP(id,
-			  PCI_ROOT_HID_STRING)) ||
-	    !(ACPI_STRCMP(id, PCI_EXPRESS_ROOT_HID_STRING))) {
+	if (!(strcmp(id,
+		     PCI_ROOT_HID_STRING)) ||
+	    !(strcmp(id, PCI_EXPRESS_ROOT_HID_STRING))) {
 		return (TRUE);
 	}
 
drivers/acpi/acpica/utosi.c +4 -5
index 44035ab..8f3d203a 100644
@@ -232,8 +232,7 @@ acpi_status acpi_ut_install_interface(acpi_string interface_name)
 		return (AE_NO_MEMORY);
 	}
 
-	interface_info->name =
-	    ACPI_ALLOCATE_ZEROED(ACPI_STRLEN(interface_name) + 1);
+	interface_info->name = ACPI_ALLOCATE_ZEROED(strlen(interface_name) + 1);
 	if (!interface_info->name) {
 		ACPI_FREE(interface_info);
 		return (AE_NO_MEMORY);
@@ -241,7 +240,7 @@ acpi_status acpi_ut_install_interface(acpi_string interface_name)
 
 	/* Initialize new info and insert at the head of the global list */
 
-	ACPI_STRCPY(interface_info->name, interface_name);
+	strcpy(interface_info->name, interface_name);
 	interface_info->flags = ACPI_OSI_DYNAMIC;
 	interface_info->next = acpi_gbl_supported_interfaces;
 
@@ -269,7 +268,7 @@ acpi_status acpi_ut_remove_interface(acpi_string interface_name)
 
 	previous_interface = next_interface = acpi_gbl_supported_interfaces;
 	while (next_interface) {
-		if (!ACPI_STRCMP(interface_name, next_interface->name)) {
+		if (!strcmp(interface_name, next_interface->name)) {
 
 			/* Found: name is in either the static list or was added at runtime */
 
@@ -373,7 +372,7 @@ struct acpi_interface_info *acpi_ut_get_interface(acpi_string interface_name)
 
 	next_interface = acpi_gbl_supported_interfaces;
 	while (next_interface) {
-		if (!ACPI_STRCMP(interface_name, next_interface->name)) {
+		if (!strcmp(interface_name, next_interface->name)) {
 			return (next_interface);
 		}
 
drivers/acpi/acpica/utpredef.c +2 -2
index 29e4499..97898ed 100644
@@ -148,7 +148,7 @@ void acpi_ut_get_expected_return_types(char *buffer, u32 expected_btypes)
 	u32 j;
 
 	if (!expected_btypes) {
-		ACPI_STRCPY(buffer, "NONE");
+		strcpy(buffer, "NONE");
 		return;
 	}
 
@@ -161,7 +161,7 @@ void acpi_ut_get_expected_return_types(char *buffer, u32 expected_btypes)
 		/* If one of the expected types, concatenate the name of this type */
 
 		if (expected_btypes & this_rtype) {
-			ACPI_STRCAT(buffer, &ut_rtype_names[i][j]);
+			strcat(buffer, &ut_rtype_names[i][j]);
 			j = 0;	/* Use name separator from now on */
 		}
 
drivers/acpi/acpica/utprint.c +3 -3
index 2be6bd4..342b02e 100644
@@ -180,7 +180,7 @@ const char *acpi_ut_scan_number(const char *string, u64 *number_ptr)
 {
 	u64 number = 0;
 
-	while (ACPI_IS_DIGIT(*string)) {
+	while (isdigit(*string)) {
 		number *= 10;
 		number += *(string++) - '0';
 	}
@@ -405,7 +405,7 @@ acpi_ut_vsnprintf(char *string,
 		/* Process width */
 
 		width = -1;
-		if (ACPI_IS_DIGIT(*format)) {
+		if (isdigit(*format)) {
 			format = acpi_ut_scan_number(format, &number);
 			width = (s32) number;
 		} else if (*format == '*') {
@@ -422,7 +422,7 @@ acpi_ut_vsnprintf(char *string,
 		precision = -1;
 		if (*format == '.') {
 			++format;
-			if (ACPI_IS_DIGIT(*format)) {
+			if (isdigit(*format)) {
 				format = acpi_ut_scan_number(format, &number);
 				precision = (s32) number;
 			} else if (*format == '*') {
drivers/acpi/acpica/utstring.c +16 -17
index 83b6c52..e9dfafc 100644
@@ -79,7 +79,7 @@ void acpi_ut_strlwr(char *src_string)
 	/* Walk entire string, lowercasing the letters */
 
 	for (string = src_string; *string; string++) {
-		*string = (char)ACPI_TOLOWER(*string);
+		*string = (char)tolower(*string);
 	}
 
 	return;
@@ -145,7 +145,7 @@ void acpi_ut_strupr(char *src_string)
 	/* Walk entire string, uppercasing the letters */
 
 	for (string = src_string; *string; string++) {
-		*string = (char)ACPI_TOUPPER(*string);
+		*string = (char)toupper(*string);
 	}
 
 	return;
@@ -202,7 +202,7 @@ acpi_status acpi_ut_strtoul64(char *string, u32 base, u64 *ret_integer)
 
 	/* Skip over any white space in the buffer */
 
-	while ((*string) && (ACPI_IS_SPACE(*string) || *string == '\t')) {
+	while ((*string) && (isspace(*string) || *string == '\t')) {
 		string++;
 	}
 
@@ -211,7 +211,7 @@ acpi_status acpi_ut_strtoul64(char *string, u32 base, u64 *ret_integer)
 		 * Base equal to ACPI_ANY_BASE means 'ToInteger operation case'.
 		 * We need to determine if it is decimal or hexadecimal.
 		 */
-		if ((*string == '0') && (ACPI_TOLOWER(*(string + 1)) == 'x')) {
+		if ((*string == '0') && (tolower(*(string + 1)) == 'x')) {
 			sign_of0x = 1;
 			base = 16;
 
@@ -224,7 +224,7 @@ acpi_status acpi_ut_strtoul64(char *string, u32 base, u64 *ret_integer)
 
 	/* Any string left? Check that '0x' is not followed by white space. */
 
-	if (!(*string) || ACPI_IS_SPACE(*string) || *string == '\t') {
+	if (!(*string) || isspace(*string) || *string == '\t') {
 		if (to_integer_op) {
 			goto error_exit;
 		} else {
@@ -241,7 +241,7 @@ acpi_status acpi_ut_strtoul64(char *string, u32 base, u64 *ret_integer)
 	/* Main loop: convert the string to a 32- or 64-bit integer */
 
 	while (*string) {
-		if (ACPI_IS_DIGIT(*string)) {
+		if (isdigit(*string)) {
 
 			/* Convert ASCII 0-9 to Decimal value */
 
@@ -252,8 +252,8 @@ acpi_status acpi_ut_strtoul64(char *string, u32 base, u64 *ret_integer)
 
 			term = 1;
 		} else {
-			this_digit = (u8)ACPI_TOUPPER(*string);
-			if (ACPI_IS_XDIGIT((char)this_digit)) {
+			this_digit = (u8)toupper(*string);
+			if (isxdigit((char)this_digit)) {
 
 				/* Convert ASCII Hex char to value */
 
@@ -404,7 +404,7 @@ void acpi_ut_print_string(char *string, u16 max_length)
 
 			/* Check for printable character or hex escape */
 
-			if (ACPI_IS_PRINT(string[i])) {
+			if (isprint(string[i])) {
 				/* This is a normal character */
 
 				acpi_os_printf("%c", (int)string[i]);
@@ -609,22 +609,22 @@ void ut_convert_backslashes(char *pathname)
 u8 acpi_ut_safe_strcpy(char *dest, acpi_size dest_size, char *source)
 {
 
-	if (ACPI_STRLEN(source) >= dest_size) {
+	if (strlen(source) >= dest_size) {
 		return (TRUE);
 	}
 
-	ACPI_STRCPY(dest, source);
+	strcpy(dest, source);
 	return (FALSE);
 }
 
 u8 acpi_ut_safe_strcat(char *dest, acpi_size dest_size, char *source)
 {
 
-	if ((ACPI_STRLEN(dest) + ACPI_STRLEN(source)) >= dest_size) {
+	if ((strlen(dest) + strlen(source)) >= dest_size) {
 		return (TRUE);
 	}
 
-	ACPI_STRCAT(dest, source);
+	strcat(dest, source);
 	return (FALSE);
 }
 
@@ -635,14 +635,13 @@ acpi_ut_safe_strncat(char *dest,
 {
 	acpi_size actual_transfer_length;
 
-	actual_transfer_length =
-	    ACPI_MIN(max_transfer_length, ACPI_STRLEN(source));
+	actual_transfer_length = ACPI_MIN(max_transfer_length, strlen(source));
 
-	if ((ACPI_STRLEN(dest) + actual_transfer_length) >= dest_size) {
+	if ((strlen(dest) + actual_transfer_length) >= dest_size) {
 		return (TRUE);
 	}
 
-	ACPI_STRNCAT(dest, source, max_transfer_length);
+	strncat(dest, source, max_transfer_length);
 	return (FALSE);
 }
 #endif
drivers/acpi/acpica/uttrack.c +4 -4
index 130dd9f..9a7dc81 100644
@@ -100,7 +100,7 @@ acpi_ut_create_list(char *list_name,
 		return (AE_NO_MEMORY);
 	}
 
-	ACPI_MEMSET(cache, 0, sizeof(struct acpi_memory_list));
+	memset(cache, 0, sizeof(struct acpi_memory_list));
 
 	cache->list_name = list_name;
 	cache->object_size = object_size;
@@ -402,7 +402,7 @@ acpi_ut_track_allocation(struct acpi_debug_mem_block *allocation,
 	allocation->component = component;
 	allocation->line = line;
 
-	ACPI_STRNCPY(allocation->module, module, ACPI_MAX_MODULE_NAME);
+	strncpy(allocation->module, module, ACPI_MAX_MODULE_NAME);
 	allocation->module[ACPI_MAX_MODULE_NAME - 1] = 0;
 
 	if (!element) {
@@ -497,7 +497,7 @@ acpi_ut_remove_allocation(struct acpi_debug_mem_block *allocation,
 
 	/* Mark the segment as deleted */
 
-	ACPI_MEMSET(&allocation->user_space, 0xEA, allocation->size);
+	memset(&allocation->user_space, 0xEA, allocation->size);
 
 	status = acpi_ut_release_mutex(ACPI_MTX_MEMORY);
 	return (status);
@@ -595,7 +595,7 @@ void acpi_ut_dump_allocations(u32 component, const char *module)
 	while (element) {
 		if ((element->component & component) &&
 		    ((module == NULL)
-		     || (0 == ACPI_STRCMP(module, element->module)))) {
+		     || (0 == strcmp(module, element->module)))) {
 			descriptor =
 			    ACPI_CAST_PTR(union acpi_descriptor,
 					  &element->user_space);
drivers/acpi/acpica/utxface.c +4 -4
index 0929187..51cf52d 100644
@@ -234,8 +234,8 @@ acpi_status acpi_get_statistics(struct acpi_statistics *stats)
 	stats->sci_count = acpi_sci_count;
 	stats->gpe_count = acpi_gpe_count;
 
-	ACPI_MEMCPY(stats->fixed_event_count, acpi_fixed_event_count,
-		    sizeof(acpi_fixed_event_count));
+	memcpy(stats->fixed_event_count, acpi_fixed_event_count,
+	       sizeof(acpi_fixed_event_count));
 
 	/* Other counters */
 
@@ -322,7 +322,7 @@ acpi_status acpi_install_interface(acpi_string interface_name)
 
 	/* Parameter validation */
 
-	if (!interface_name || (ACPI_STRLEN(interface_name) == 0)) {
+	if (!interface_name || (strlen(interface_name) == 0)) {
 		return (AE_BAD_PARAMETER);
 	}
 
@@ -374,7 +374,7 @@ acpi_status acpi_remove_interface(acpi_string interface_name)
 
 	/* Parameter validation */
 
-	if (!interface_name || (ACPI_STRLEN(interface_name) == 0)) {
+	if (!interface_name || (strlen(interface_name) == 0)) {
 		return (AE_BAD_PARAMETER);
 	}
 
include/acpi/actypes.h +4 -4
index d791b98..c2a41d2 100644
@@ -542,14 +542,14 @@ typedef u64 acpi_integer;
 #define ACPI_COMPARE_NAME(a,b)          (*ACPI_CAST_PTR (u32, (a)) == *ACPI_CAST_PTR (u32, (b)))
 #define ACPI_MOVE_NAME(dest,src)        (*ACPI_CAST_PTR (u32, (dest)) = *ACPI_CAST_PTR (u32, (src)))
 #else
-#define ACPI_COMPARE_NAME(a,b)          (!ACPI_STRNCMP (ACPI_CAST_PTR (char, (a)), ACPI_CAST_PTR (char, (b)), ACPI_NAME_SIZE))
-#define ACPI_MOVE_NAME(dest,src)        (ACPI_STRNCPY (ACPI_CAST_PTR (char, (dest)), ACPI_CAST_PTR (char, (src)), ACPI_NAME_SIZE))
+#define ACPI_COMPARE_NAME(a,b)          (!strncmp (ACPI_CAST_PTR (char, (a)), ACPI_CAST_PTR (char, (b)), ACPI_NAME_SIZE))
+#define ACPI_MOVE_NAME(dest,src)        (strncpy (ACPI_CAST_PTR (char, (dest)), ACPI_CAST_PTR (char, (src)), ACPI_NAME_SIZE))
 #endif
 
 /* Support for the special RSDP signature (8 characters) */
 
-#define ACPI_VALIDATE_RSDP_SIG(a)       (!ACPI_STRNCMP (ACPI_CAST_PTR (char, (a)), ACPI_SIG_RSDP, 8))
-#define ACPI_MAKE_RSDP_SIG(dest)        (ACPI_MEMCPY (ACPI_CAST_PTR (char, (dest)), ACPI_SIG_RSDP, 8))
+#define ACPI_VALIDATE_RSDP_SIG(a)       (!strncmp (ACPI_CAST_PTR (char, (a)), ACPI_SIG_RSDP, 8))
+#define ACPI_MAKE_RSDP_SIG(dest)        (memcpy (ACPI_CAST_PTR (char, (dest)), ACPI_SIG_RSDP, 8))
 
 /*******************************************************************************
  *
include/acpi/platform/acenv.h +0 -38
index 1e84e62..3cedd43 100644
@@ -346,28 +346,6 @@
 
 /* We will be linking to the standard Clib functions */
 
-#define ACPI_STRSTR(s1,s2)      strstr((s1), (s2))
-#define ACPI_STRCHR(s1,c)       strchr((s1), (c))
-#define ACPI_STRLEN(s)          (acpi_size) strlen((s))
-#define ACPI_STRCPY(d,s)        (void) strcpy((d), (s))
-#define ACPI_STRNCPY(d,s,n)     (void) strncpy((d), (s), (acpi_size)(n))
-#define ACPI_STRNCMP(d,s,n)     strncmp((d), (s), (acpi_size)(n))
-#define ACPI_STRCMP(d,s)        strcmp((d), (s))
-#define ACPI_STRCAT(d,s)        (void) strcat((d), (s))
-#define ACPI_STRNCAT(d,s,n)     strncat((d), (s), (acpi_size)(n))
-#define ACPI_STRTOUL(d,s,n)     strtoul((d), (s), (acpi_size)(n))
-#define ACPI_MEMCMP(s1,s2,n)    memcmp((const char *)(s1), (const char *)(s2), (acpi_size)(n))
-#define ACPI_MEMCPY(d,s,n)      (void) memcpy((d), (s), (acpi_size)(n))
-#define ACPI_MEMSET(d,s,n)      (void) memset((d), (s), (acpi_size)(n))
-#define ACPI_TOUPPER(i)         toupper((int) (i))
-#define ACPI_TOLOWER(i)         tolower((int) (i))
-#define ACPI_IS_XDIGIT(i)       isxdigit((int) (i))
-#define ACPI_IS_DIGIT(i)        isdigit((int) (i))
-#define ACPI_IS_SPACE(i)        isspace((int) (i))
-#define ACPI_IS_UPPER(i)        isupper((int) (i))
-#define ACPI_IS_PRINT(i)        isprint((int) (i))
-#define ACPI_IS_ALPHA(i)        isalpha((int) (i))
-
 #else
 
 /******************************************************************************
@@ -405,22 +383,6 @@ typedef char *va_list;
 
 /* Use the local (ACPICA) definitions of the clib functions */
 
-#define ACPI_STRSTR(s1,s2)      acpi_ut_strstr ((s1), (s2))
-#define ACPI_STRCHR(s1,c)       acpi_ut_strchr ((s1), (c))
-#define ACPI_STRLEN(s)          (acpi_size) acpi_ut_strlen ((s))
-#define ACPI_STRCPY(d,s)        (void) acpi_ut_strcpy ((d), (s))
-#define ACPI_STRNCPY(d,s,n)     (void) acpi_ut_strncpy ((d), (s), (acpi_size)(n))
-#define ACPI_STRNCMP(d,s,n)     acpi_ut_strncmp ((d), (s), (acpi_size)(n))
-#define ACPI_STRCMP(d,s)        acpi_ut_strcmp ((d), (s))
-#define ACPI_STRCAT(d,s)        (void) acpi_ut_strcat ((d), (s))
-#define ACPI_STRNCAT(d,s,n)     acpi_ut_strncat ((d), (s), (acpi_size)(n))
-#define ACPI_STRTOUL(d,s,n)     acpi_ut_strtoul ((d), (s), (acpi_size)(n))
-#define ACPI_MEMCMP(s1,s2,n)    acpi_ut_memcmp((const char *)(s1), (const char *)(s2), (acpi_size)(n))
-#define ACPI_MEMCPY(d,s,n)      (void) acpi_ut_memcpy ((d), (s), (acpi_size)(n))
-#define ACPI_MEMSET(d,v,n)      (void) acpi_ut_memset ((d), (v), (acpi_size)(n))
-#define ACPI_TOUPPER(c)         acpi_ut_to_upper ((int) (c))
-#define ACPI_TOLOWER(c)         acpi_ut_to_lower ((int) (c))
-
 #endif				/* ACPI_USE_SYSTEM_CLIBRARY */
 
 #ifndef ACPI_FILE
tools/power/acpi/common/getopt.c +2 -2
index 5da129e..326e826 100644
@@ -127,7 +127,7 @@ int acpi_getopt(int argc, char **argv, char *opts)
 		    argv[acpi_gbl_optind][0] != '-' ||
 		    argv[acpi_gbl_optind][1] == '\0') {
 			return (ACPI_OPT_END);
-		} else if (ACPI_STRCMP(argv[acpi_gbl_optind], "--") == 0) {
+		} else if (strcmp(argv[acpi_gbl_optind], "--") == 0) {
 			acpi_gbl_optind++;
 			return (ACPI_OPT_END);
 		}
@@ -140,7 +140,7 @@ int acpi_getopt(int argc, char **argv, char *opts)
 	/* Make sure that the option is legal */
 
 	if (current_char == ':' ||
-	    (opts_ptr = ACPI_STRCHR(opts, current_char)) == NULL) {
+	    (opts_ptr = strchr(opts, current_char)) == NULL) {
 		ACPI_OPTION_ERROR("Illegal option: -", current_char);
 
 		if (argv[acpi_gbl_optind][++current_char_ptr] == '\0') {
tools/power/acpi/os_specific/service_layers/oslinuxtbl.c +3 -3
index 3aff9a2..dd5008b 100644
@@ -222,7 +222,7 @@ acpi_os_get_table_by_address(acpi_physical_address address,
 		goto exit;
 	}
 
-	ACPI_MEMCPY(local_table, mapped_table, table_length);
+	memcpy(local_table, mapped_table, table_length);
 
 exit:
 	osl_unmap_table(mapped_table);
@@ -531,7 +531,7 @@ static acpi_status osl_load_rsdp(void)
 	gbl_rsdp_address =
 	    rsdp_base + (ACPI_CAST8(mapped_table) - rsdp_address);
 
-	ACPI_MEMCPY(&gbl_rsdp, mapped_table, sizeof(struct acpi_table_rsdp));
+	memcpy(&gbl_rsdp, mapped_table, sizeof(struct acpi_table_rsdp));
 	acpi_os_unmap_memory(rsdp_address, rsdp_size);
 
 	return (AE_OK);
@@ -964,7 +964,7 @@ osl_get_bios_table(char *signature,
 		goto exit;
 	}
 
-	ACPI_MEMCPY(local_table, mapped_table, table_length);
+	memcpy(local_table, mapped_table, table_length);
 	*address = table_address;
 	*table = local_table;
 
tools/power/acpi/tools/acpidump/apdump.c +4 -4
index c736adf..61d0de8 100644
@@ -329,7 +329,7 @@ int ap_dump_table_by_name(char *signature)
 	acpi_status status;
 	int table_status;
 
-	if (ACPI_STRLEN(signature) != ACPI_NAME_SIZE) {
+	if (strlen(signature) != ACPI_NAME_SIZE) {
 		acpi_log_error
 		    ("Invalid table signature [%s]: must be exactly 4 characters\n",
 		     signature);
@@ -338,15 +338,15 @@ int ap_dump_table_by_name(char *signature)
 
 	/* Table signatures are expected to be uppercase */
 
-	ACPI_STRCPY(local_signature, signature);
+	strcpy(local_signature, signature);
 	acpi_ut_strupr(local_signature);
 
 	/* To be friendly, handle tables whose signatures do not match the name */
 
 	if (ACPI_COMPARE_NAME(local_signature, "FADT")) {
-		ACPI_STRCPY(local_signature, ACPI_SIG_FADT);
+		strcpy(local_signature, ACPI_SIG_FADT);
 	} else if (ACPI_COMPARE_NAME(local_signature, "MADT")) {
-		ACPI_STRCPY(local_signature, ACPI_SIG_MADT);
+		strcpy(local_signature, ACPI_SIG_MADT);
 	}
 
 	/* Dump all instances of this signature (to handle multiple SSDTs) */
tools/power/acpi/tools/acpidump/apfiles.c +6 -6
index 8f2fe16..9a26fb5 100644
@@ -136,10 +136,10 @@ int ap_write_to_binary_file(struct acpi_table_header *table, u32 instance)
 	} else {
 		ACPI_MOVE_NAME(filename, table->signature);
 	}
-	filename[0] = (char)ACPI_TOLOWER(filename[0]);
-	filename[1] = (char)ACPI_TOLOWER(filename[1]);
-	filename[2] = (char)ACPI_TOLOWER(filename[2]);
-	filename[3] = (char)ACPI_TOLOWER(filename[3]);
+	filename[0] = (char)tolower(filename[0]);
+	filename[1] = (char)tolower(filename[1]);
+	filename[2] = (char)tolower(filename[2]);
+	filename[3] = (char)tolower(filename[3]);
 	filename[ACPI_NAME_SIZE] = 0;
 
 	/* Handle multiple SSDts - create different filenames for each */
@@ -147,10 +147,10 @@ int ap_write_to_binary_file(struct acpi_table_header *table, u32 instance)
 	if (instance > 0) {
 		acpi_ut_snprintf(instance_str, sizeof(instance_str), "%u",
 				 instance);
-		ACPI_STRCAT(filename, instance_str);
+		strcat(filename, instance_str);
 	}
 
-	ACPI_STRCAT(filename, ACPI_TABLE_FILE_SUFFIX);
+	strcat(filename, ACPI_TABLE_FILE_SUFFIX);
 
 	if (gbl_verbose_mode) {
 		acpi_log_error
Signature · 1 line
1.7.10
author
#36 lore raw

PATCH 26/32 ACPICA: Clib: Correct memset() declarations.

In reply to Lv Zheng

ACPICA commit 00f0dc83f5cfca53b27a3213ae0d7719b88c2d6b

Gcc complains memset() prototype used in the ACPICA even when the nostdinc
is specified:
../../../source/include/acutils.h:418:1: error: conflicting types for built-in function 'memset' [-Werror]

This patch corrects the declarations of memset(). Lv Zheng.

---
 drivers/acpi/acpica/acutils.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/acpi/acpica/acutils.h +1 -1
index 8f62703..6372a6b 100644
@@ -234,7 +234,7 @@ int memcmp(void *buffer1, void *buffer2, acpi_size count);
 
 void *memcpy(void *dest, const void *src, acpi_size count);
 
-void *memset(void *dest, u8 value, acpi_size count);
+void *memset(void *dest, int value, acpi_size count);
 
 int toupper(int c);
 
Signature · 1 line
1.7.10
author
#37 lore raw

PATCH 27/32 ACPICA: Finish C library name transition.

In reply to Lv Zheng

From: Bob Moore <[email protected]>

ACPICA commit 47d22a738d0e19fd241ffe4e3e9d4e198e4afc69

Cast various invocations as necessary.

---
 drivers/acpi/acpica/acutils.h             |   18 ------------------
 drivers/acpi/acpica/nsdump.c              |    2 +-
 drivers/acpi/acpica/nsrepair2.c           |    2 +-
 drivers/acpi/acpica/tbprint.c             |    2 +-
 drivers/acpi/acpica/utprint.c             |    6 +++---
 drivers/acpi/acpica/utstring.c            |   18 +++++++++---------
 tools/power/acpi/tools/acpidump/apfiles.c |    8 ++++----
 7 files changed, 19 insertions(+), 37 deletions(-)
drivers/acpi/acpica/acutils.h +0 -18
index 6372a6b..ef1e51d 100644
@@ -261,24 +261,6 @@ extern const u8 _acpi_ctype[];
 #define isprint(c)  (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO | _ACPI_UP | _ACPI_DI | _ACPI_XS | _ACPI_PU))
 #define isalpha(c)  (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO | _ACPI_UP))
 
-#ifndef ACPI_CLIBRARY
-#define strstr(s1,s2)       strstr ((s1), (s2))
-#define strchr(s1,c)        strchr ((s1), (c))
-#define strlen(s)           (acpi_size) strlen ((s))
-#define strcpy(d,s)         (void) strcpy ((d), (s))
-#define strncpy(d,s,n)      (void) strncpy ((d), (s), (acpi_size)(n))
-#define strncmp(d,s,n)      strncmp ((d), (s), (acpi_size)(n))
-#define strcmp(d,s)         strcmp ((d), (s))
-#define strcat(d,s)         (void) strcat ((d), (s))
-#define strncat(d,s,n)      strncat ((d), (s), (acpi_size)(n))
-#define strtoul(d,s,n)      strtoul ((d), (s), (acpi_size)(n))
-#define memcmp(s1,s2,n)     memcmp((void *)(s1), (void *)(s2), (acpi_size)(n))
-#define memcpy(d,s,n)       (void) memcpy ((d), (s), (acpi_size)(n))
-#define memset(d,v,n)       (void) memset ((d), (v), (acpi_size)(n))
-#define toupper(c)          toupper ((int) (c))
-#define tolower(c)          tolower ((int) (c))
-#endif				/* ACPI_CLIBRARY */
-
 #endif				/* !ACPI_USE_SYSTEM_CLIBRARY */
 
 #define ACPI_IS_ASCII(c)  ((c) < 0x80)
drivers/acpi/acpica/nsdump.c +1 -1
index b5fcf65..0f1daba 100644
@@ -101,7 +101,7 @@ void acpi_ns_print_pathname(u32 num_segments, char *pathname)
 
 	while (num_segments) {
 		for (i = 0; i < 4; i++) {
-			isprint(pathname[i]) ?
+			isprint((int)pathname[i]) ?
 			    acpi_os_printf("%c", pathname[i]) :
 			    acpi_os_printf("?");
 		}
drivers/acpi/acpica/nsrepair2.c +1 -1
index abf8dff..0515a70 100644
@@ -580,7 +580,7 @@ acpi_ns_repair_HID(struct acpi_evaluate_info *info,
 	 * # is a hex digit.
 	 */
 	for (dest = new_string->string.pointer; *source; dest++, source++) {
-		*dest = (char)toupper(*source);
+		*dest = (char)toupper((int)*source);
 	}
 
 	acpi_ut_remove_reference(return_object);
drivers/acpi/acpica/tbprint.c +1 -1
index c8ed532..709d511 100644
@@ -73,7 +73,7 @@ static void acpi_tb_fix_string(char *string, acpi_size length)
 {
 
 	while (length && *string) {
-		if (!isprint(*string)) {
+		if (!isprint((int)*string)) {
 			*string = '?';
 		}
 		string++;
drivers/acpi/acpica/utprint.c +3 -3
index 342b02e..b26297c 100644
@@ -180,7 +180,7 @@ const char *acpi_ut_scan_number(const char *string, u64 *number_ptr)
 {
 	u64 number = 0;
 
-	while (isdigit(*string)) {
+	while (isdigit((int)*string)) {
 		number *= 10;
 		number += *(string++) - '0';
 	}
@@ -405,7 +405,7 @@ acpi_ut_vsnprintf(char *string,
 		/* Process width */
 
 		width = -1;
-		if (isdigit(*format)) {
+		if (isdigit((int)*format)) {
 			format = acpi_ut_scan_number(format, &number);
 			width = (s32) number;
 		} else if (*format == '*') {
@@ -422,7 +422,7 @@ acpi_ut_vsnprintf(char *string,
 		precision = -1;
 		if (*format == '.') {
 			++format;
-			if (isdigit(*format)) {
+			if (isdigit((int)*format)) {
 				format = acpi_ut_scan_number(format, &number);
 				precision = (s32) number;
 			} else if (*format == '*') {
drivers/acpi/acpica/utstring.c +9 -9
index e9dfafc..8f3c883 100644
@@ -79,7 +79,7 @@ void acpi_ut_strlwr(char *src_string)
 	/* Walk entire string, lowercasing the letters */
 
 	for (string = src_string; *string; string++) {
-		*string = (char)tolower(*string);
+		*string = (char)tolower((int)*string);
 	}
 
 	return;
@@ -145,7 +145,7 @@ void acpi_ut_strupr(char *src_string)
 	/* Walk entire string, uppercasing the letters */
 
 	for (string = src_string; *string; string++) {
-		*string = (char)toupper(*string);
+		*string = (char)toupper((int)*string);
 	}
 
 	return;
@@ -202,7 +202,7 @@ acpi_status acpi_ut_strtoul64(char *string, u32 base, u64 *ret_integer)
 
 	/* Skip over any white space in the buffer */
 
-	while ((*string) && (isspace(*string) || *string == '\t')) {
+	while ((*string) && (isspace((int)*string) || *string == '\t')) {
 		string++;
 	}
 
@@ -211,7 +211,7 @@ acpi_status acpi_ut_strtoul64(char *string, u32 base, u64 *ret_integer)
 		 * Base equal to ACPI_ANY_BASE means 'ToInteger operation case'.
 		 * We need to determine if it is decimal or hexadecimal.
 		 */
-		if ((*string == '0') && (tolower(*(string + 1)) == 'x')) {
+		if ((*string == '0') && (tolower((int)*(string + 1)) == 'x')) {
 			sign_of0x = 1;
 			base = 16;
 
@@ -224,7 +224,7 @@ acpi_status acpi_ut_strtoul64(char *string, u32 base, u64 *ret_integer)
 
 	/* Any string left? Check that '0x' is not followed by white space. */
 
-	if (!(*string) || isspace(*string) || *string == '\t') {
+	if (!(*string) || isspace((int)*string) || *string == '\t') {
 		if (to_integer_op) {
 			goto error_exit;
 		} else {
@@ -241,7 +241,7 @@ acpi_status acpi_ut_strtoul64(char *string, u32 base, u64 *ret_integer)
 	/* Main loop: convert the string to a 32- or 64-bit integer */
 
 	while (*string) {
-		if (isdigit(*string)) {
+		if (isdigit((int)*string)) {
 
 			/* Convert ASCII 0-9 to Decimal value */
 
@@ -252,8 +252,8 @@ acpi_status acpi_ut_strtoul64(char *string, u32 base, u64 *ret_integer)
 
 			term = 1;
 		} else {
-			this_digit = (u8)toupper(*string);
-			if (isxdigit((char)this_digit)) {
+			this_digit = (u8)toupper((int)*string);
+			if (isxdigit((int)this_digit)) {
 
 				/* Convert ASCII Hex char to value */
 
@@ -404,7 +404,7 @@ void acpi_ut_print_string(char *string, u16 max_length)
 
 			/* Check for printable character or hex escape */
 
-			if (isprint(string[i])) {
+			if (isprint((int)string[i])) {
 				/* This is a normal character */
 
 				acpi_os_printf("%c", (int)string[i]);
tools/power/acpi/tools/acpidump/apfiles.c +4 -4
index 9a26fb5..a37f970 100644
@@ -136,10 +136,10 @@ int ap_write_to_binary_file(struct acpi_table_header *table, u32 instance)
 	} else {
 		ACPI_MOVE_NAME(filename, table->signature);
 	}
-	filename[0] = (char)tolower(filename[0]);
-	filename[1] = (char)tolower(filename[1]);
-	filename[2] = (char)tolower(filename[2]);
-	filename[3] = (char)tolower(filename[3]);
+	filename[0] = (char)tolower((int)filename[0]);
+	filename[1] = (char)tolower((int)filename[1]);
+	filename[2] = (char)tolower((int)filename[2]);
+	filename[3] = (char)tolower((int)filename[3]);
 	filename[ACPI_NAME_SIZE] = 0;
 
 	/* Handle multiple SSDts - create different filenames for each */
Signature · 1 line
1.7.10
author
#38 lore raw

PATCH 28/32 ACPICA: Split C library prototypes to new header.

In reply to Lv Zheng

From: Bob Moore <[email protected]>

ACPICA commit f51bf8497889a94046820639537165bbd7ccdee6

Adds acclib.h

This patch doesn't affect Linux kernel.

---
 drivers/acpi/acpica/accommon.h |    3 +++
 drivers/acpi/acpica/acutils.h  |   58 ----------------------------------------
 2 files changed, 3 insertions(+), 58 deletions(-)
drivers/acpi/acpica/accommon.h +3 -0
index 853aa2d..a8d8092 100644
@@ -59,5 +59,8 @@
 #include "acglobal.h"		/* All global variables */
 #include "achware.h"		/* Hardware defines and interfaces */
 #include "acutils.h"		/* Utility interfaces */
+#ifndef ACPI_USE_SYSTEM_CLIBRARY
+#include "acclib.h"		/* C library interfaces */
+#endif				/* !ACPI_USE_SYSTEM_CLIBRARY */
 
 #endif				/* __ACCOMMON_H__ */
drivers/acpi/acpica/acutils.h +0 -58

64 lines not on this page · raw message

Signature · 1 line
1.7.10
author
#39 lore raw

PATCH 29/32 ACPICA: Update definitions for the TCPA and TPM2 ACPI tables.

In reply to Lv Zheng

From: Bob Moore <[email protected]>

ACPICA commit 33140b4498666337dd33a00cf3c4797a53981a7b

Changes for a new version of the 3rd party spec for these tables, the "TCG ACPI Specification", December 14, 2014. Also, moved the definition of TPM2 to actbl2.h, next to TCPA, since both should be together.

Update the table compiler/disassembler code for the tables. However, the "Server" TCPA table is not supported at this time.

---
 include/acpi/actbl2.h |   86 +++++++++++++++++++++++++++++++++++++++++++++----
 include/acpi/actbl3.h |   34 ++-----------------
 2 files changed, 81 insertions(+), 39 deletions(-)
include/acpi/actbl2.h +79 -7
index 370d69d..2a9dcc1 100644
@@ -51,8 +51,8 @@
  * These tables are not consumed directly by the ACPICA subsystem, but are
  * included here to support device drivers and the AML disassembler.
  *
- * The tables in this file are defined by third-party specifications, and are
- * not defined directly by the ACPI specification itself.
+ * Generally, the tables in this file are defined by third-party specifications,
+ * and are not defined directly by the ACPI specification itself.
  *
  ******************************************************************************/
 
@@ -80,6 +80,7 @@
 #define ACPI_SIG_SPCR           "SPCR"	/* Serial Port Console Redirection table */
 #define ACPI_SIG_SPMI           "SPMI"	/* Server Platform Management Interface table */
 #define ACPI_SIG_TCPA           "TCPA"	/* Trusted Computing Platform Alliance table */
+#define ACPI_SIG_TPM2           "TPM2"	/* Trusted Platform Module 2.0 H/W interface table */
 #define ACPI_SIG_UEFI           "UEFI"	/* Uefi Boot Optimization Table */
 #define ACPI_SIG_VRTC           "VRTC"	/* Virtual Real Time Clock Table */
 #define ACPI_SIG_WAET           "WAET"	/* Windows ACPI Emulated devices Table */
@@ -1179,18 +1180,89 @@ enum acpi_spmi_interface_types {
 /*******************************************************************************
  *
  * TCPA - Trusted Computing Platform Alliance table
- *        Version 1
+ *        Version 2
+ *
+ * Conforms to "TCG ACPI Specification, Family 1.2 and 2.0",
+ * December 19, 2014
  *
- * Conforms to "TCG PC Specific Implementation Specification",
- * Version 1.1, August 18, 2003
+ * NOTE: There are two versions of the table with the same signature --
+ * the client version and the server version.
  *
  ******************************************************************************/
 
-struct acpi_table_tcpa {
+struct acpi_table_tcpa_client {
+	struct acpi_table_header header;	/* Common ACPI table header */
+	u16 platform_class;
+	u32 minimum_log_length;	/* Minimum length for the event log area */
+	u64 log_address;	/* Address of the event log area */
+};
+
+struct acpi_table_tcpa_server {
 	struct acpi_table_header header;	/* Common ACPI table header */
+	u16 platform_class;
 	u16 reserved;
-	u32 max_log_length;	/* Maximum length for the event log area */
+	u64 minimum_log_length;	/* Minimum length for the event log area */
 	u64 log_address;	/* Address of the event log area */
+	u16 spec_revision;
+	u8 device_flags;
+	u8 interrupt_flags;
+	u8 gpe_number;
+	u8 reserved2[3];
+	u32 global_interrupt;
+	struct acpi_generic_address address;
+	u32 reserved3;
+	struct acpi_generic_address config_address;
+	u8 group;
+	u8 bus;			/* PCI Bus/Segment/Function numbers */
+	u8 device;
+	u8 function;
+};
+
+/* Values for device_flags above */
+
+#define ACPI_TCPA_PCI_DEVICE            (1)
+#define ACPI_TCPA_BUS_PNP               (1<<1)
+#define ACPI_TCPA_ADDRESS_VALID         (1<<2)
+
+/* Values for interrupt_flags above */
+
+#define ACPI_TCPA_INTERRUPT_MODE        (1)
+#define ACPI_TCPA_INTERRUPT_POLARITY    (1<<1)
+#define ACPI_TCPA_SCI_VIA_GPE           (1<<2)
+#define ACPI_TCPA_GLOBAL_INTERRUPT      (1<<3)
+
+/*******************************************************************************
+ *
+ * TPM2 - Trusted Platform Module (TPM) 2.0 Hardware Interface Table
+ *        Version 4
+ *
+ * Conforms to "TCG ACPI Specification, Family 1.2 and 2.0",
+ * December 19, 2014
+ *
+ ******************************************************************************/
+
+struct acpi_table_tpm2 {
+	struct acpi_table_header header;	/* Common ACPI table header */
+	u16 platform_class;
+	u16 reserved;
+	u64 control_address;
+	u32 start_method;
+
+	/* Platform-specific data follows */
+};
+
+/* Control area structure (not part of table, pointed to by control_address) */
+
+struct acpi_tpm2_control {
+	u32 reserved;
+	u32 error;
+	u32 cancel;
+	u32 start;
+	u64 interrupt_control;
+	u32 command_size;
+	u64 command_address;
+	u32 response_size;
+	u64 response_address;
 };
 
 /*******************************************************************************
include/acpi/actbl3.h +2 -32
index 4018986..1df8916 100644
@@ -51,7 +51,8 @@
  * These tables are not consumed directly by the ACPICA subsystem, but are
  * included here to support device drivers and the AML disassembler.
  *
- * The tables in this file are fully defined within the ACPI specification.
+ * In general, the tables in this file are fully defined within the ACPI
+ * specification.
  *
  ******************************************************************************/
 
@@ -69,7 +70,6 @@
 #define ACPI_SIG_PMTT           "PMTT"	/* Platform Memory Topology Table */
 #define ACPI_SIG_RASF           "RASF"	/* RAS Feature table */
 #define ACPI_SIG_STAO           "STAO"	/* Status Override table */
-#define ACPI_SIG_TPM2           "TPM2"	/* Trusted Platform Module 2.0 H/W interface table */
 #define ACPI_SIG_WPBT           "WPBT"	/* Windows Platform Binary Table */
 #define ACPI_SIG_XENV           "XENV"	/* Xen Environment table */
 
@@ -722,36 +722,6 @@ struct acpi_table_stao {
 
 /*******************************************************************************
  *
- * TPM2 - Trusted Platform Module (TPM) 2.0 Hardware Interface Table
- *        Version 3
- *
- * Conforms to "TPM 2.0 Hardware Interface Table (TPM2)" 29 November 2011
- *
- ******************************************************************************/
-
-struct acpi_table_tpm2 {
-	struct acpi_table_header header;	/* Common ACPI table header */
-	u32 flags;
-	u64 control_address;
-	u32 start_method;
-};
-
-/* Control area structure (not part of table, pointed to by control_address) */
-
-struct acpi_tpm2_control {
-	u32 reserved;
-	u32 error;
-	u32 cancel;
-	u32 start;
-	u64 interrupt_control;
-	u32 command_size;
-	u64 command_address;
-	u32 response_size;
-	u64 response_address;
-};
-
-/*******************************************************************************
- *
  * WPBT - Windows Platform Environment Table (ACPI 6.0)
  *        Version 1
  *
Signature · 1 line
1.7.10
author
#40 lore raw

PATCH 30/32 ACPICA: Update TPM2 ACPI table.

In reply to Lv Zheng

From: Bob Moore <[email protected]>

ACPICA commit 254bf77e7ca01cb27e026fa5737f7df8dae03f2c

- Add constans for the start_method.
- Remove the control structure, not part of ACPI, not defined in the current TCG spec.

---
 include/acpi/actbl2.h |   18 ++++++------------
 1 file changed, 6 insertions(+), 12 deletions(-)
include/acpi/actbl2.h +6 -12
index 2a9dcc1..a948fc5 100644
@@ -1251,19 +1251,13 @@ struct acpi_table_tpm2 {
 	/* Platform-specific data follows */
 };
 
-/* Control area structure (not part of table, pointed to by control_address) */
+/* Values for start_method above */
 
-struct acpi_tpm2_control {
-	u32 reserved;
-	u32 error;
-	u32 cancel;
-	u32 start;
-	u64 interrupt_control;
-	u32 command_size;
-	u64 command_address;
-	u32 response_size;
-	u64 response_address;
-};
+#define ACPI_TPM2_NOT_ALLOWED                       0
+#define ACPI_TPM2_START_METHOD                      2
+#define ACPI_TPM2_MEMORY_MAPPED                     6
+#define ACPI_TPM2_COMMAND_BUFFER                    7
+#define ACPI_TPM2_COMMAND_BUFFER_WITH_START_METHOD  8
 
 /*******************************************************************************
  *
Signature · 1 line
1.7.10
author
#41 lore raw

PATCH 31/32 ACPICA: Comment update, no functional change.

In reply to Lv Zheng

From: gongzg <[email protected]>

ACPICA commit 1a8ec7b83d55c7b957247d685bd1c73f6a012f1e

Remove redundant comment in nseval.c

---
 drivers/acpi/acpica/nseval.c |    5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/acpi/acpica/nseval.c +2 -3
index a725d88..80670cb 100644
@@ -59,15 +59,14 @@ acpi_ns_exec_module_code(union acpi_operand_object *method_obj,
  *
  * FUNCTION:    acpi_ns_evaluate
  *
- * PARAMETERS:  info            - Evaluation info block, contains:
+ * PARAMETERS:  info            - Evaluation info block, contains these fields
+ *                                and more:
  *                  prefix_node     - Prefix or Method/Object Node to execute
  *                  relative_path   - Name of method to execute, If NULL, the
  *                                    Node is the object to execute
  *                  parameters      - List of parameters to pass to the method,
  *                                    terminated by NULL. Params itself may be
  *                                    NULL if no parameters are being passed.
- *                  return_object   - Where to put method's return value (if
- *                                    any). If NULL, no value is returned.
  *                  parameter_type  - Type of Parameter list
  *                  return_object   - Where to put method's return value (if
  *                                    any). If NULL, no value is returned.
Signature · 1 line
1.7.10
author
#42 lore raw

PATCH 32/32 ACPICA: Update version to 20150619.

In reply to Lv Zheng

From: Bob Moore <[email protected]>

ACPICA commit 2fcf4f4c95e6a4875f39a929f8f92ef50cc53bb5 ACPICA commit d7a940bb308d001b5d2b196174fee36c7daa61d6

Version 20150619.

---
 include/acpi/acpixf.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/acpi/acpixf.h +1 -1
index 33b4675..c1e9578 100644
@@ -46,7 +46,7 @@
 
 /* Current ACPICA subsystem version in YYYYMMDD format */
 
-#define ACPI_CA_VERSION                 0x20150515
+#define ACPI_CA_VERSION                 0x20150619
 
 #include <acpi/acconfig.h>
 #include <acpi/actypes.h>
Signature · 1 line
1.7.10
author
#43 lore raw

v2 cover ACPICA: 20150619 Release

In reply to Lv Zheng

The 20150619 ACPICA kernel-resident subsystem updates are linuxized based on the linux-pm/linux-next branch.

The patchset has passed the following build/boot tests. Build tests are performed as follows:
1. i386 + default + COFNIG_ACPI=y
2. i386 + allyes + CONFIG_ACPI=y
3. i386 + default + COFNIG_ACPI=n
4. i386 + allyes + CONFIG_ACPI=n
5. x86_64 + default + COFNIG_ACPI=y
6. x86_64 + allyes + CONFIG_ACPI=y
7. x86_64 + default + COFNIG_ACPI=n
8. x86_64 + allyes + CONFIG_ACPI=n
Boot tests are performed as follows:
1. i386 + default + COFNIG_ACPI=y
2. x86_64 + default + COFNIG_ACPI=y
Where:
1. i386: machine named as "Dell Inspiron Mini 1010"
2. x86_64: machine named as "HP Compaq 8200 Elite SFF PC"
3. default: kernel configuration with following items enabled:
All hardware drivers related to the machines of i386/x86_64 All drivers/acpi configurations
All platform drivers

The divergences checking result:
Before applying (20150515 Release):
565 lines
After applying (20150619 Release):
539 lines

Bob Moore (8):
ACPICA: Namespace: Add support of OSDT table.
ACPICA: Namespace: Change namespace override to avoid node deletion.
ACPICA: Cleanup output for the ASL Debug object.
ACPICA: De-macroize calls to standard C library functions.
ACPICA: Split C library prototypes to new header.
ACPICA: Update definitions for the TCPA and TPM2 ACPI tables.
ACPICA: Update TPM2 ACPI table.
ACPICA: Update version to 20150619.

Hanjun Guo (1):
ACPICA: ACPI 6.0: Add values for MADT GIC version field.

Lv Zheng (15):
ACPICA: Linuxize: Reduce divergences for 20150619 release.
ACPICA: Linuxize: Replace __FUNCTION__ with __func__.
ACPICA: Hardware: Enable 64-bit firmware waking vector for selected
FACS.
ACPICA: Tables: Enable both 32-bit and 64-bit FACS.
ACPICA: Hardware: Enable firmware waking vector for both 32-bit and

    64-bit FACS.

ACPICA: Hardware: Cleanup the return values in
acpi_set_waking_vector().
ACPICA: Tables: Fix an issue that FACS initialization is performed
twice.
ACPICA: Tables: Fix an issue that ACPI initialization is blocked due
to no FACS.
ACPICA: Tables: Enable default 64-bit FADT addresses favor.
ACPICA: MSVC6: Fix build issue for variable argument macros.
ACPICA: EFI: Add EFI interface definitions to eliminate dependency of
GNU EFI.
ACPICA: Namespace: Add support to allow overriding objects.
ACPICA: acpidump: Allow customized tables to be dumped without
accessing /dev/mem.
ACPICA: acpidump: Convert the default behavior to dump from
/sys/firmware/acpi/tables.
ACPI / acpidump: Update acpidump manual.

Sascha Wildner (1):
ACPICA: Add dragon_fly support to unix file mapping file.

Suravee Suthikulpanit (1):
ACPICA: Utilities: Add _CLS processing

Zhang Rui (1):
ACPICA: Update for acpi_install_table memory types.

gongzg (1):
ACPICA: Comment update, no functional change.

 arch/ia64/include/asm/acpi.h                       |    3 +-
 arch/ia64/kernel/acpi.c                            |    2 -
 arch/x86/include/asm/acpi.h                        |    3 +-
 drivers/acpi/acpica/accommon.h                     |    3 +
 drivers/acpi/acpica/acglobal.h                     |    2 +
 drivers/acpi/acpica/acinterp.h                     |    2 +
 drivers/acpi/acpica/aclocal.h                      |    1 +
 drivers/acpi/acpica/acnamesp.h                     |    1 +
 drivers/acpi/acpica/acobject.h                     |    1 +
 drivers/acpi/acpica/acstruct.h                     |    1 +
 drivers/acpi/acpica/acutils.h                      |   64 +------------
 drivers/acpi/acpica/dsfield.c                      |    2 +-
 drivers/acpi/acpica/dsinit.c                       |    2 +-
 drivers/acpi/acpica/dsobject.c                     |    7 +-
 drivers/acpi/acpica/dsutils.c                      |    4 +-
 drivers/acpi/acpica/dswload.c                      |   17 +++-
 drivers/acpi/acpica/evgpeinit.c                    |    2 +-
 drivers/acpi/acpica/exconfig.c                     |    2 +-
 drivers/acpi/acpica/exconvrt.c                     |    9 +-
 drivers/acpi/acpica/exdebug.c                      |   42 +++++++-
 drivers/acpi/acpica/exdump.c                       |    9 +-
 drivers/acpi/acpica/exfield.c                      |    2 +-
 drivers/acpi/acpica/exfldio.c                      |   52 +++++-----
 drivers/acpi/acpica/exmisc.c                       |   36 +++----
 drivers/acpi/acpica/exnames.c                      |    2 +-
 drivers/acpi/acpica/exoparg2.c                     |    8 +-
 drivers/acpi/acpica/exoparg3.c                     |    4 +-
 drivers/acpi/acpica/exregion.c                     |    9 +-
 drivers/acpi/acpica/exstorob.c                     |   18 ++--
 drivers/acpi/acpica/exutils.c                      |   32 +++++++
 drivers/acpi/acpica/hwxfsleep.c                    |   85 +++++++++++------
 drivers/acpi/acpica/nsaccess.c                     |   16 +++-
 drivers/acpi/acpica/nsconvert.c                    |   10 +-
 drivers/acpi/acpica/nsdump.c                       |    2 +-
 drivers/acpi/acpica/nseval.c                       |    7 +-
 drivers/acpi/acpica/nsinit.c                       |    4 +-
 drivers/acpi/acpica/nsparse.c                      |    7 ++
 drivers/acpi/acpica/nsrepair2.c                    |    2 +-
 drivers/acpi/acpica/nssearch.c                     |   37 +++++++-
 drivers/acpi/acpica/nsutils.c                      |    3 +-
 drivers/acpi/acpica/nsxfeval.c                     |    5 +-
 drivers/acpi/acpica/nsxfname.c                     |   29 ++++--
 drivers/acpi/acpica/psutils.c                      |    7 +-
 drivers/acpi/acpica/rscreate.c                     |    6 +-
 drivers/acpi/acpica/rsmisc.c                       |    8 +-
 drivers/acpi/acpica/rsutils.c                      |   13 ++-
 drivers/acpi/acpica/rsxface.c                      |    8 +-
 drivers/acpi/acpica/tbdata.c                       |    8 +-
 drivers/acpi/acpica/tbfadt.c                       |   27 +++---
 drivers/acpi/acpica/tbfind.c                       |   21 ++--
 drivers/acpi/acpica/tbinstal.c                     |    7 +-
 drivers/acpi/acpica/tbprint.c                      |   10 +-
 drivers/acpi/acpica/tbutils.c                      |   37 +++++---
 drivers/acpi/acpica/tbxface.c                      |   17 ++--
 drivers/acpi/acpica/tbxfload.c                     |   17 ++--
 drivers/acpi/acpica/utalloc.c                      |    6 +-
 drivers/acpi/acpica/utbuffer.c                     |    4 +-
 drivers/acpi/acpica/utcache.c                      |    6 +-
 drivers/acpi/acpica/utcopy.c                       |   42 ++++----
 drivers/acpi/acpica/utdebug.c                      |    4 +-
 drivers/acpi/acpica/utids.c                        |  100 ++++++++++++++++++--
 drivers/acpi/acpica/utmisc.c                       |    9 +-
 drivers/acpi/acpica/utosi.c                        |    9 +-
 drivers/acpi/acpica/utpredef.c                     |    4 +-
 drivers/acpi/acpica/utprint.c                      |    6 +-
 drivers/acpi/acpica/utstring.c                     |   33 ++++---
 drivers/acpi/acpica/uttrack.c                      |    8 +-
 drivers/acpi/acpica/utxface.c                      |    8 +-
 drivers/acpi/acpica/utxfinit.c                     |   10 +-
 drivers/acpi/sleep.c                               |    8 +-
 include/acpi/acnames.h                             |    1 +
 include/acpi/acoutput.h                            |   13 ++-
 include/acpi/acpixf.h                              |   31 ++++--
 include/acpi/actbl.h                               |    1 +
 include/acpi/actbl1.h                              |   11 +++
 include/acpi/actbl2.h                              |   80 ++++++++++++++--
 include/acpi/actbl3.h                              |   34 +------
 include/acpi/actypes.h                             |   33 ++++---
 include/acpi/platform/acenv.h                      |   39 --------
 include/acpi/platform/acenvex.h                    |    6 ++
 include/acpi/platform/acgcc.h                      |    4 +
 tools/power/acpi/common/getopt.c                   |    4 +-
 tools/power/acpi/man/acpidump.8                    |   17 +++-
 .../acpi/os_specific/service_layers/oslinuxtbl.c   |   95 ++++++++++---------
 .../acpi/os_specific/service_layers/osunixmap.c    |    2 +-
 tools/power/acpi/tools/acpidump/acpidump.h         |    2 +-
 tools/power/acpi/tools/acpidump/apdump.c           |    8 +-
 tools/power/acpi/tools/acpidump/apfiles.c          |   12 +--
 tools/power/acpi/tools/acpidump/apmain.c           |   15 ++-
 89 files changed, 851 insertions(+), 549 deletions(-)
Signature · 1 line
1.7.10
author
#44 lore raw

PATCH v2 1/28 ACPICA: Linuxize: Reduce divergences for 20150619 release.

This patch reduces source code differences between the Linux kernel and the ACPICA upstream so that the linuxized ACPICA 20150619 release can be applied with reduced human intervention.

---
 drivers/acpi/acpica/dsobject.c  |    2 +-
 drivers/acpi/acpica/hwxfsleep.c |    2 --
 drivers/acpi/acpica/rscreate.c  |    2 +-
 drivers/acpi/acpica/rsutils.c   |    2 +-
 drivers/acpi/acpica/tbxface.c   |    1 +
 include/acpi/platform/acenv.h   |    1 -
 6 files changed, 4 insertions(+), 6 deletions(-)
drivers/acpi/acpica/dsobject.c +1 -1
index 8a7b07b..4a4b2f3 100644
@@ -751,7 +751,7 @@ acpi_ds_init_object_from_op(struct acpi_walk_state *walk_state,
 
 		obj_desc->string.pointer = op->common.value.string;
 		obj_desc->string.length =
-		    (u32) ACPI_STRLEN(op->common.value.string);
+		    (u32)ACPI_STRLEN(op->common.value.string);
 
 		/*
 		 * The string is contained in the ACPI table, don't ever try
drivers/acpi/acpica/hwxfsleep.c +0 -2
index 3b37676..82e310b 100644
@@ -138,7 +138,6 @@ acpi_status acpi_set_firmware_waking_vector64(u64 physical_address)
 {
 	ACPI_FUNCTION_TRACE(acpi_set_firmware_waking_vector64);
 
-
 	/* Determine if the 64-bit vector actually exists */
 
 	if ((acpi_gbl_FACS->length <= 32) || (acpi_gbl_FACS->version < 1)) {
@@ -154,7 +153,6 @@ acpi_status acpi_set_firmware_waking_vector64(u64 physical_address)
 
 ACPI_EXPORT_SYMBOL(acpi_set_firmware_waking_vector64)
 #endif
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_enter_sleep_state_s4bios
drivers/acpi/acpica/rscreate.c +1 -1
index 15434e4..f30f35e 100644
@@ -353,7 +353,7 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object,
 				/* +1 to include null terminator */
 
 				user_prt->length +=
-				    (u32) ACPI_STRLEN(user_prt->source) + 1;
+				    (u32)ACPI_STRLEN(user_prt->source) + 1;
 				break;
 
 			case ACPI_TYPE_STRING:
drivers/acpi/acpica/rsutils.c +1 -1
index ece3cd6..90417de 100644
@@ -367,7 +367,7 @@ acpi_rs_get_resource_source(acpi_rs_length resource_length,
 		    (u32)
 		    ACPI_STRLEN(ACPI_CAST_PTR(char, &aml_resource_source[1])) +
 		    1;
-		total_length = (u32) ACPI_ROUND_UP_TO_NATIVE_WORD(total_length);
+		total_length = (u32)ACPI_ROUND_UP_TO_NATIVE_WORD(total_length);
 
 		ACPI_MEMSET(resource_source->string_ptr, 0, total_length);
 
drivers/acpi/acpica/tbxface.c +1 -0
index 60e94f8..54b9f79 100644
@@ -242,6 +242,7 @@ acpi_get_table_header(char *signature,
 				if (!header) {
 					return (AE_NO_MEMORY);
 				}
+
 				ACPI_MEMCPY(out_table_header, header,
 					    sizeof(struct acpi_table_header));
 				acpi_os_unmap_memory(header,
include/acpi/platform/acenv.h +0 -1
index 073997d..1e84e62 100644
@@ -359,7 +359,6 @@
 #define ACPI_MEMCMP(s1,s2,n)    memcmp((const char *)(s1), (const char *)(s2), (acpi_size)(n))
 #define ACPI_MEMCPY(d,s,n)      (void) memcpy((d), (s), (acpi_size)(n))
 #define ACPI_MEMSET(d,s,n)      (void) memset((d), (s), (acpi_size)(n))
-
 #define ACPI_TOUPPER(i)         toupper((int) (i))
 #define ACPI_TOLOWER(i)         tolower((int) (i))
 #define ACPI_IS_XDIGIT(i)       isxdigit((int) (i))
Signature · 1 line
1.7.10
author
#45 lore raw

PATCH v2 2/28 ACPICA: Linuxize: Replace __FUNCTION__ with __func__.

In reply to Lv Zheng

ACPICA commit cb3d1c79f862cd368d749c9b8d9dced40111b0d0

__FUNCTION__ is MSVC only, in Linux, it is __func__. Lv Zheng.

In ACPICA, this is achieved by string replacement in release script and this patch contains the source code difference between the Linux upstream and ACPICA that is caused by the back porting.

---
 drivers/acpi/acpica/utdebug.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/acpi/acpica/utdebug.c +2 -2
index 4f3f888..cd02693 100644
@@ -111,8 +111,8 @@ void acpi_ut_track_stack_ptr(void)
  * RETURN:      Updated pointer to the function name
  *
  * DESCRIPTION: Remove the "Acpi" prefix from the function name, if present.
- *              This allows compiler macros such as __func__ to be used with no
- *              change to the debug output.
+ *              This allows compiler macros such as __func__ to be used
+ *              with no change to the debug output.
  *
  ******************************************************************************/
 
Signature · 1 line
1.7.10
#46 lore raw

Re: [PATCH v2 02/28] ACPICA: Linuxize: Replace __FUNCTION__ with __func__.

Quoted 7 lines · Lv Zheng

ACPICA commit cb3d1c79f862cd368d749c9b8d9dced40111b0d0

__FUNCTION__ is MSVC only, in Linux, it is __func__. Lv Zheng.

In ACPICA, this is achieved by string replacement in release script and this patch contains the source code difference between the Linux upstream and ACPICA that is caused by the back porting.

__func__ is in C99 and never. __FUNCTION__ is an old extension supported by various compilers.

author
#47 lore raw

RE: [PATCH v2 02/28] ACPICA: Linuxize: Replace __FUNCTION__ with __func__.

Hi,

Quoted 6 lines

From: Christoph Hellwig [mailto:[email protected]]
Sent: Wednesday, June 24, 2015 8:56 PM

Quoted 2 lines · Lv Zheng

ACPICA commit cb3d1c79f862cd368d749c9b8d9dced40111b0d0

Quoted 8 lines
Quoted 5 lines

__FUNCTION__ is MSVC only, in Linux, it is __func__. Lv Zheng.

In ACPICA, this is achieved by string replacement in release script and this patch contains the source code difference between the Linux upstream and ACPICA that is caused by the back porting.

__func__ is in C99 and never. __FUNCTION__ is an old extension supported by various compilers.

This patch description is used in ACPICA upstream.
For ACPICA code base, __FUNCTION__ is only used for its MSVC builds. And __func__ is converted from __FUNCTION__ by the linuxize release script.

See the original commit here:
https://github.com/acpica/acpica/commit/cb3d1c79

So this is simply an automated release output.
Without this merged, source code differences between Linux upstream and ACPICA upstream will hurt the automation.

Thanks and best regards
-Lv

author
#48 lore raw

PATCH v2 3/28 ACPICA: Hardware: Enable 64-bit firmware waking vector for selected FACS.

In reply to Lv Zheng

ACPICA commit 7aa598d711644ab0de5f70ad88f1e2de253115e4

The following commit is reported to have broken s2ram on some platforms:
Commit: 0249ed2444d65d65fc3f3f64f398f1ad0b7e54cd
ACPICA: Add option to favor 32-bit FADT addresses.
The platform reports 2 FACS tables (which is not allowed by ACPI specification) and the new 32-bit address favor rule forces OSPMs to use the FACS table reported via FADT's X_FIRMWARE_CTRL field.

The root cause of the reported bug might be one of the followings:
1. BIOS may favor the 64-bit firmware waking vector address when the version of the FACS is greater than 0 and Linux currently only supports resuming from the real mode, so the 64-bit firmware waking vector has never been set and might be invalid to BIOS while the commit enables higher version FACS.
2. BIOS may favor the FACS reported via the "FIRMWARE_CTRL" field in the FADT while the commit doesn't set the firmware waking vector address of the FACS reported by "FIRMWARE_CTRL", it only sets the firware waking vector address of the FACS reported by "X_FIRMWARE_CTRL".

This patch excludes the cases that can trigger the bugs caused by the root cause 1.

ACPI specification says:
A. 32-bit FACS address (FIRMWARE_CTRL field in FADT):
Physical memory address of the FACS, where OSPM and firmware exchange control information.
If the X_FIRMWARE_CTRL field contains a non zero value then this field must be zero.
A zero value indicates that no FACS is specified by this field.
B. 64-bit FACS address (X_FIRMWARE_CTRL field in FADT):
64bit physical memory address of the FACS.
This field is used when the physical address of the FACS is above 4GB. If the FIRMWARE_CTRL field contains a non zero value then this field must be zero.
A zero value indicates that no FACS is specified by this field.
Thus the 32bit and 64bit firmware waking vector should indicate completely different resuming environment - real mode (1MB addressable) and non real mode (4GB+ addressable) and currently Linux only supports resuming from real mode.

This patch enables 64-bit firmware waking vector for selected FACS via acpi_set_firmware_waking_vector() so that it's up to OSPMs to determine which resuming mode should be used by BIOS and ACPICA changes won't trigger the bugs caused by the root cause 1. For example, Linux can pass physical_address64=0 as the parameter of acpi_set_firmware_waking_vector() to indicate no 64bit waking vector support. Lv Zheng.

This patch also updates acpi_set_firmware_waking_vector() invocations in order to keep 32-bit firmware waking vector favor for Linux. 64-bit firmware waking vector has never been enabled by Linux. The (acpi_physical_address)0 for 64-bit address can be used to force ACPICA to set only 32-bit firmware waking vector for Linux.

---
 arch/ia64/include/asm/acpi.h    |    3 +-
 arch/ia64/kernel/acpi.c         |    2 --
 arch/x86/include/asm/acpi.h     |    3 +-
 drivers/acpi/acpica/hwxfsleep.c |   61 ++++++++++++---------------------------
 drivers/acpi/sleep.c            |    8 +++--
 include/acpi/acpixf.h           |   11 +++----
 6 files changed, 33 insertions(+), 55 deletions(-)
arch/ia64/include/asm/acpi.h +2 -1
index aa0fdf1..0ac4fab 100644
@@ -79,7 +79,8 @@ int acpi_gsi_to_irq (u32 gsi, unsigned int *irq);
 /* Low-level suspend routine. */
 extern int acpi_suspend_lowlevel(void);
 
-extern unsigned long acpi_wakeup_address;
+#define acpi_wakeup_address	((acpi_physical_address)0)
+#define acpi_wakeup_address64	((acpi_physical_address)0)
 
 /*
  * Record the cpei override flag and current logical cpu. This is
arch/ia64/kernel/acpi.c +0 -2
index b1698bc..1b08d6f 100644
@@ -60,8 +60,6 @@ int acpi_lapic;
 unsigned int acpi_cpei_override;
 unsigned int acpi_cpei_phys_cpuid;
 
-unsigned long acpi_wakeup_address = 0;
-
 #ifdef CONFIG_IA64_GENERIC
 static unsigned long __init acpi_find_rsdp(void)
 {
arch/x86/include/asm/acpi.h +2 -1
index 3a45668..fc9608d 100644
@@ -72,7 +72,8 @@ static inline void acpi_disable_pci(void)
 extern int (*acpi_suspend_lowlevel)(void);
 
 /* Physical address to resume after wakeup */
-#define acpi_wakeup_address ((unsigned long)(real_mode_header->wakeup_start))
+#define acpi_wakeup_address	((acpi_physical_address)(real_mode_header->wakeup_start))
+#define acpi_wakeup_address64	((acpi_physical_address)(0))
 
 /*
  * Check if the CPU can handle C2 and deeper
drivers/acpi/acpica/hwxfsleep.c +18 -42

93 lines not on this page · raw message

drivers/acpi/sleep.c +6 -2
index 2f0d4db..3a6a2eb 100644
@@ -25,6 +25,8 @@
 #include "internal.h"
 #include "sleep.h"
 
+#define ACPI_NO_WAKING_VECTOR		((acpi_physical_address)0)
+
 static u8 sleep_states[ACPI_S_STATE_COUNT];
 
 static void acpi_sleep_tts_switch(u32 acpi_state)
@@ -61,7 +63,8 @@ static int acpi_sleep_prepare(u32 acpi_state)
 	if (acpi_state = ACPI_STATE_S3) {
 		if (!acpi_wakeup_address)
 			return -EFAULT;
-		acpi_set_firmware_waking_vector(acpi_wakeup_address);
+		acpi_set_firmware_waking_vector(acpi_wakeup_address,
+						acpi_wakeup_address64);
 
 	}
 	ACPI_FLUSH_CPU_CACHE();
@@ -410,7 +413,8 @@ 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_firmware_waking_vector(ACPI_NO_WAKING_VECTOR,
+					ACPI_NO_WAKING_VECTOR);
 
 	acpi_target_sleep_state = ACPI_STATE_S0;
 
include/acpi/acpixf.h +4 -7
index d68f1cd..a68e4b9 100644
@@ -814,13 +814,10 @@ 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_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_set_firmware_waking_vector
+				(acpi_physical_address physical_address,
+				 acpi_physical_address physical_address64))
+
 /*
  * ACPI Timer interfaces
  */
Signature · 1 line
1.7.10
#49 lore raw

Re: [PATCH v2 03/28] ACPICA: Hardware: Enable 64-bit firmware waking vector for selected FACS.

Quoted 108 lines · Lv Zheng

ACPICA commit 7aa598d711644ab0de5f70ad88f1e2de253115e4

The following commit is reported to have broken s2ram on some platforms:
Commit: 0249ed2444d65d65fc3f3f64f398f1ad0b7e54cd
ACPICA: Add option to favor 32-bit FADT addresses.
The platform reports 2 FACS tables (which is not allowed by ACPI specification) and the new 32-bit address favor rule forces OSPMs to use the FACS table reported via FADT's X_FIRMWARE_CTRL field.

The root cause of the reported bug might be one of the followings:
1. BIOS may favor the 64-bit firmware waking vector address when the version of the FACS is greater than 0 and Linux currently only supports resuming from the real mode, so the 64-bit firmware waking vector has never been set and might be invalid to BIOS while the commit enables higher version FACS.
2. BIOS may favor the FACS reported via the "FIRMWARE_CTRL" field in the FADT while the commit doesn't set the firmware waking vector address of the FACS reported by "FIRMWARE_CTRL", it only sets the firware waking vector address of the FACS reported by "X_FIRMWARE_CTRL".

This patch excludes the cases that can trigger the bugs caused by the root cause 1.

ACPI specification says:
A. 32-bit FACS address (FIRMWARE_CTRL field in FADT):
Physical memory address of the FACS, where OSPM and firmware exchange control information.
If the X_FIRMWARE_CTRL field contains a non zero value then this field must be zero.
A zero value indicates that no FACS is specified by this field.
B. 64-bit FACS address (X_FIRMWARE_CTRL field in FADT):
64bit physical memory address of the FACS.
This field is used when the physical address of the FACS is above 4GB. If the FIRMWARE_CTRL field contains a non zero value then this field must be zero.
A zero value indicates that no FACS is specified by this field.
Thus the 32bit and 64bit firmware waking vector should indicate completely different resuming environment - real mode (1MB addressable) and non real mode (4GB+ addressable) and currently Linux only supports resuming from real mode.

This patch enables 64-bit firmware waking vector for selected FACS via acpi_set_firmware_waking_vector() so that it's up to OSPMs to determine which resuming mode should be used by BIOS and ACPICA changes won't trigger the bugs caused by the root cause 1. For example, Linux can pass physical_address64=0 as the parameter of acpi_set_firmware_waking_vector() to indicate no 64bit waking vector support. Lv Zheng.

This patch also updates acpi_set_firmware_waking_vector() invocations in order to keep 32-bit firmware waking vector favor for Linux. 64-bit firmware waking vector has never been enabled by Linux. The (acpi_physical_address)0 for 64-bit address can be used to force ACPICA to set only 32-bit firmware waking vector for Linux.

---
 arch/ia64/include/asm/acpi.h    |    3 +-
 arch/ia64/kernel/acpi.c         |    2 --
 arch/x86/include/asm/acpi.h     |    3 +-
 drivers/acpi/acpica/hwxfsleep.c |   61 ++++++++++++---------------------------
 drivers/acpi/sleep.c            |    8 +++--
 include/acpi/acpixf.h           |   11 +++----
 6 files changed, 33 insertions(+), 55 deletions(-)
arch/ia64/include/asm/acpi.h +2 -1
index aa0fdf1..0ac4fab 100644
@@ -79,7 +79,8 @@ int acpi_gsi_to_irq (u32 gsi, unsigned int *irq);
 /* Low-level suspend routine. */
 extern int acpi_suspend_lowlevel(void);
 
-extern unsigned long acpi_wakeup_address;
+#define acpi_wakeup_address	((acpi_physical_address)0)
+#define acpi_wakeup_address64	((acpi_physical_address)0)
 
 /*
  * Record the cpei override flag and current logical cpu. This is
arch/ia64/kernel/acpi.c +0 -2
index b1698bc..1b08d6f 100644
@@ -60,8 +60,6 @@ int acpi_lapic;
 unsigned int acpi_cpei_override;
 unsigned int acpi_cpei_phys_cpuid;
 
-unsigned long acpi_wakeup_address = 0;
-
 #ifdef CONFIG_IA64_GENERIC
 static unsigned long __init acpi_find_rsdp(void)
 {
arch/x86/include/asm/acpi.h +0 -0
index 3a45668..fc9608d 100644

arch/x86/include/asm/acpi.h static inline void acpi_disable_pci(void) · line 76

Quoted 6 lines
arch/x86/include/asm/acpi.h +2 -1
@@ -72,7 +72,8 @@ static inline void acpi_disable_pci(void)
 extern int (*acpi_suspend_lowlevel)(void);
 
 /* Physical address to resume after wakeup */
-#define acpi_wakeup_address ((unsigned long)(real_mode_header->wakeup_start))
+#define acpi_wakeup_address	((acpi_physical_address)(real_mode_header->wakeup_start))
+#define acpi_wakeup_address64	((acpi_physical_address)(0))

Do we need this?

Why don't we define

static inline void acpi_set_wakeup_address(void)

{
	acpi_set_firmware_waking_vector((unsigned long)real_mode_header->wakeup_start, 0);
}

and

static inline void acpi_clear_wakeup_address(void)

{
	acpi_set_firmware_waking_vector(0, 0);
}

instead?

Which may be defined as empty stubs on ia64?

Quoted 108 lines
arch/x86/include/asm/acpi.h +0 -0
 /*
  * Check if the CPU can handle C2 and deeper
drivers/acpi/acpica/hwxfsleep.c +18 -42
index 82e310b..c67cd32 100644
@@ -73,7 +73,6 @@ static struct acpi_sleep_functions acpi_sleep_dispatch[] = {
 /*
  * These functions are removed for the ACPI_REDUCED_HARDWARE case:
  *      acpi_set_firmware_waking_vector
- *      acpi_set_firmware_waking_vector64
  *      acpi_enter_sleep_state_s4bios
  */
 
@@ -83,15 +82,19 @@ static struct acpi_sleep_functions acpi_sleep_dispatch[] = {
  * 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
+ *                                    entry point
  *
  * RETURN:      Status
  *
- * DESCRIPTION: Sets the 32-bit firmware_waking_vector field of the FACS
+ * DESCRIPTION: Sets the firmware_waking_vector fields of the FACS
  *
  ******************************************************************************/
 
-acpi_status acpi_set_firmware_waking_vector(u32 physical_address)
+acpi_status
+acpi_set_firmware_waking_vector(acpi_physical_address physical_address,
+				acpi_physical_address physical_address64)
 {
 	ACPI_FUNCTION_TRACE(acpi_set_firmware_waking_vector);
 
@@ -106,53 +109,27 @@ acpi_status acpi_set_firmware_waking_vector(u32 physical_address)
 
 	/* Set the 32-bit vector */
 
-	acpi_gbl_FACS->firmware_waking_vector = physical_address;
+	acpi_gbl_FACS->firmware_waking_vector = (u32)physical_address;
 
-	/* Clear the 64-bit vector if it exists */
+	if (acpi_gbl_FACS->length > 32) {
+		if (acpi_gbl_FACS->version >= 1) {
 
-	if ((acpi_gbl_FACS->length > 32) && (acpi_gbl_FACS->version >= 1)) {
-		acpi_gbl_FACS->xfirmware_waking_vector = 0;
-	}
-
-	return_ACPI_STATUS(AE_OK);
-}
-
-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_FUNCTION_TRACE(acpi_set_firmware_waking_vector64);
+			/* Set the 64-bit vector */
 
-	/* Determine if the 64-bit vector actually exists */
+			acpi_gbl_FACS->xfirmware_waking_vector > +			    physical_address64;
+		} else {
+			/* Clear the 64-bit vector if it exists */
 
-	if ((acpi_gbl_FACS->length <= 32) || (acpi_gbl_FACS->version < 1)) {
-		return_ACPI_STATUS(AE_NOT_EXIST);
+			acpi_gbl_FACS->xfirmware_waking_vector = 0;
+		}
 	}
 
-	/* Clear 32-bit vector, set the 64-bit X_ vector */
-
-	acpi_gbl_FACS->firmware_waking_vector = 0;
-	acpi_gbl_FACS->xfirmware_waking_vector = physical_address;
 	return_ACPI_STATUS(AE_OK);
 }
 
-ACPI_EXPORT_SYMBOL(acpi_set_firmware_waking_vector64)
-#endif
+ACPI_EXPORT_SYMBOL(acpi_set_firmware_waking_vector)
+
 /*******************************************************************************
  *
  * FUNCTION:    acpi_enter_sleep_state_s4bios
drivers/acpi/sleep.c +0 -0
index 2f0d4db..3a6a2eb 100644

drivers/acpi/sleep.c line 28

Quoted 4 lines
drivers/acpi/sleep.c +1 -0
@@ -25,6 +25,8 @@
 #include "internal.h"
 #include "sleep.h"
 
+#define ACPI_NO_WAKING_VECTOR		((acpi_physical_address)0)

Do we need this too?

Quoted 47 lines
drivers/acpi/sleep.c +5 -2
+
 static u8 sleep_states[ACPI_S_STATE_COUNT];
 
 static void acpi_sleep_tts_switch(u32 acpi_state)
@@ -61,7 +63,8 @@ static int acpi_sleep_prepare(u32 acpi_state)
 	if (acpi_state = ACPI_STATE_S3) {
 		if (!acpi_wakeup_address)
 			return -EFAULT;
-		acpi_set_firmware_waking_vector(acpi_wakeup_address);
+		acpi_set_firmware_waking_vector(acpi_wakeup_address,
+						acpi_wakeup_address64);
 
 	}
 	ACPI_FLUSH_CPU_CACHE();
@@ -410,7 +413,8 @@ 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_firmware_waking_vector(ACPI_NO_WAKING_VECTOR,
+					ACPI_NO_WAKING_VECTOR);
 
 	acpi_target_sleep_state = ACPI_STATE_S0;
 
include/acpi/acpixf.h +4 -7
index d68f1cd..a68e4b9 100644
@@ -814,13 +814,10 @@ 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_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_set_firmware_waking_vector
+				(acpi_physical_address physical_address,
+				 acpi_physical_address physical_address64))
+
 /*
  * ACPI Timer interfaces
  */
Signature · 2 lines
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.
#50 lore raw

Re: [PATCH v2 03/28] ACPICA: Hardware: Enable 64-bit firmware waking vector for selected FACS.

Quoted 111 lines · Rafael J. Wysocki
Quoted 110 lines · Lv Zheng

ACPICA commit 7aa598d711644ab0de5f70ad88f1e2de253115e4

The following commit is reported to have broken s2ram on some platforms:
Commit: 0249ed2444d65d65fc3f3f64f398f1ad0b7e54cd
ACPICA: Add option to favor 32-bit FADT addresses.
The platform reports 2 FACS tables (which is not allowed by ACPI specification) and the new 32-bit address favor rule forces OSPMs to use the FACS table reported via FADT's X_FIRMWARE_CTRL field.

The root cause of the reported bug might be one of the followings:
1. BIOS may favor the 64-bit firmware waking vector address when the version of the FACS is greater than 0 and Linux currently only supports resuming from the real mode, so the 64-bit firmware waking vector has never been set and might be invalid to BIOS while the commit enables higher version FACS.
2. BIOS may favor the FACS reported via the "FIRMWARE_CTRL" field in the FADT while the commit doesn't set the firmware waking vector address of the FACS reported by "FIRMWARE_CTRL", it only sets the firware waking vector address of the FACS reported by "X_FIRMWARE_CTRL".

This patch excludes the cases that can trigger the bugs caused by the root cause 1.

ACPI specification says:
A. 32-bit FACS address (FIRMWARE_CTRL field in FADT):
Physical memory address of the FACS, where OSPM and firmware exchange control information.
If the X_FIRMWARE_CTRL field contains a non zero value then this field must be zero.
A zero value indicates that no FACS is specified by this field.
B. 64-bit FACS address (X_FIRMWARE_CTRL field in FADT):
64bit physical memory address of the FACS.
This field is used when the physical address of the FACS is above 4GB. If the FIRMWARE_CTRL field contains a non zero value then this field must be zero.
A zero value indicates that no FACS is specified by this field.
Thus the 32bit and 64bit firmware waking vector should indicate completely different resuming environment - real mode (1MB addressable) and non real mode (4GB+ addressable) and currently Linux only supports resuming from real mode.

This patch enables 64-bit firmware waking vector for selected FACS via acpi_set_firmware_waking_vector() so that it's up to OSPMs to determine which resuming mode should be used by BIOS and ACPICA changes won't trigger the bugs caused by the root cause 1. For example, Linux can pass physical_address64=0 as the parameter of acpi_set_firmware_waking_vector() to indicate no 64bit waking vector support. Lv Zheng.

This patch also updates acpi_set_firmware_waking_vector() invocations in order to keep 32-bit firmware waking vector favor for Linux. 64-bit firmware waking vector has never been enabled by Linux. The (acpi_physical_address)0 for 64-bit address can be used to force ACPICA to set only 32-bit firmware waking vector for Linux.

---
 arch/ia64/include/asm/acpi.h    |    3 +-
 arch/ia64/kernel/acpi.c         |    2 --
 arch/x86/include/asm/acpi.h     |    3 +-
 drivers/acpi/acpica/hwxfsleep.c |   61 ++++++++++++---------------------------
 drivers/acpi/sleep.c            |    8 +++--
 include/acpi/acpixf.h           |   11 +++----
 6 files changed, 33 insertions(+), 55 deletions(-)
arch/ia64/include/asm/acpi.h +2 -1
index aa0fdf1..0ac4fab 100644
@@ -79,7 +79,8 @@ int acpi_gsi_to_irq (u32 gsi, unsigned int *irq);
 /* Low-level suspend routine. */
 extern int acpi_suspend_lowlevel(void);
 
-extern unsigned long acpi_wakeup_address;
+#define acpi_wakeup_address	((acpi_physical_address)0)
+#define acpi_wakeup_address64	((acpi_physical_address)0)
 
 /*
  * Record the cpei override flag and current logical cpu. This is
arch/ia64/kernel/acpi.c +0 -2
index b1698bc..1b08d6f 100644
@@ -60,8 +60,6 @@ int acpi_lapic;
 unsigned int acpi_cpei_override;
 unsigned int acpi_cpei_phys_cpuid;
 
-unsigned long acpi_wakeup_address = 0;
-
 #ifdef CONFIG_IA64_GENERIC
 static unsigned long __init acpi_find_rsdp(void)
 {
arch/x86/include/asm/acpi.h +0 -0
index 3a45668..fc9608d 100644
@@ -72,7 +72,8 @@ static inline void acpi_disable_pci(void)
 extern int (*acpi_suspend_lowlevel)(void);
 
Quoted 6 lines

arch/x86/include/asm/acpi.h static inline void acpi_disable_pci(void) · line 76

Quoted 4 lines
arch/x86/include/asm/acpi.h +2 -1
 /* Physical address to resume after wakeup */
-#define acpi_wakeup_address ((unsigned long)(real_mode_header->wakeup_start))
+#define acpi_wakeup_address	((acpi_physical_address)(real_mode_header->wakeup_start))
+#define acpi_wakeup_address64	((acpi_physical_address)(0))

Do we need this?

In fact, I don't see why we need to redefine the symbols at all.

Couldn't acpi_set_firmware_waking_vector() be defined to take u32 and u64 so we could just pass acpi_wakeup_address (as already defined) as the first argument and 0 as the second argument to it? The back-and-forth type casts from and to acpi_physical_address don't look entirely clean to me.

Moreover, I don't really see a functional difference between the old and the new code.

The old code does "set the 32-bit waking vector and clear the 64-bit waking vector if present". The new code does "set the 32-bit waking vector and either clear the 64-bit one if present, or assign the second function argument to it", but we always pass 0 as the second argument (which is *extremely* obfuscated in your patch), so I really don't see the difference here.

Am I missing anything?

Rafael

author
#51 lore raw

RE: [PATCH v2 03/28] ACPICA: Hardware: Enable 64-bit firmware waking vector for selected FACS.

SGksIFJhZmFlbA0KDQo+IEZyb206IFJhZmFlbCBKLiBXeXNvY2tpIFttYWlsdG86cmp3QHJqd3lz b2NraS5uZXRdDQo+IFNlbnQ6IFRodXJzZGF5LCBKdW5lIDI1LCAyMDE1IDc6MjQgQU0NCj4gVG86 IFpoZW5nLCBMdg0KPiANCj4gT24gV2VkbmVzZGF5LCBKdW5lIDI0LCAyMDE1IDA0OjA1OjQyIFBN IFJhZmFlbCBKLiBXeXNvY2tpIHdyb3RlOg0KPiA+IE9uIFdlZG5lc2RheSwgSnVuZSAyNCwgMjAx NSAxMTowMjoxMCBBTSBMdiBaaGVuZyB3cm90ZToNCj4gPiA+IEFDUElDQSBjb21taXQgN2FhNTk4 ZDcxMTY0NGFiMGRlNWY3MGFkODhmMWUyZGUyNTMxMTVlNA0KPiA+ID4NCj4gPiA+IFRoZSBmb2xs b3dpbmcgY29tbWl0IGlzIHJlcG9ydGVkIHRvIGhhdmUgYnJva2VuIHMycmFtIG9uIHNvbWUgcGxh dGZvcm1zOg0KPiA+ID4gIENvbW1pdDogMDI0OWVkMjQ0NGQ2NWQ2NWZjM2YzZjY0ZjM5OGYxYWQw YjdlNTRjZA0KPiA+ID4gIEFDUElDQTogQWRkIG9wdGlvbiB0byBmYXZvciAzMi1iaXQgRkFEVCBh ZGRyZXNzZXMuDQo+ID4gPiBUaGUgcGxhdGZvcm0gcmVwb3J0cyAyIEZBQ1MgdGFibGVzICh3aGlj aCBpcyBub3QgYWxsb3dlZCBieSBBQ1BJDQo+ID4gPiBzcGVjaWZpY2F0aW9uKSBhbmQgdGhlIG5l dyAzMi1iaXQgYWRkcmVzcyBmYXZvciBydWxlIGZvcmNlcyBPU1BNcyB0byB1c2UNCj4gPiA+IHRo ZSBGQUNTIHRhYmxlIHJlcG9ydGVkIHZpYSBGQURUJ3MgWF9GSVJNV0FSRV9DVFJMIGZpZWxkLg0K PiA+ID4NCj4gPiA+IFRoZSByb290IGNhdXNlIG9mIHRoZSByZXBvcnRlZCBidWcgbWlnaHQgYmUg b25lIG9mIHRoZSBmb2xsb3dpbmdzOg0KPiA+ID4gMS4gQklPUyBtYXkgZmF2b3IgdGhlIDY0LWJp dCBmaXJtd2FyZSB3YWtpbmcgdmVjdG9yIGFkZHJlc3Mgd2hlbiB0aGUNCj4gPiA+ICAgIHZlcnNp b24gb2YgdGhlIEZBQ1MgaXMgZ3JlYXRlciB0aGFuIDAgYW5kIExpbnV4IGN1cnJlbnRseSBvbmx5 IHN1cHBvcnRzDQo+ID4gPiAgICByZXN1bWluZyBmcm9tIHRoZSByZWFsIG1vZGUsIHNvIHRoZSA2 NC1iaXQgZmlybXdhcmUgd2FraW5nIHZlY3RvciBoYXMNCj4gPiA+ICAgIG5ldmVyIGJlZW4gc2V0 IGFuZCBtaWdodCBiZSBpbnZhbGlkIHRvIEJJT1Mgd2hpbGUgdGhlIGNvbW1pdCBlbmFibGVzDQo+ ID4gPiAgICBoaWdoZXIgdmVyc2lvbiBGQUNTLg0KPiA+ID4gMi4gQklPUyBtYXkgZmF2b3IgdGhl IEZBQ1MgcmVwb3J0ZWQgdmlhIHRoZSAiRklSTVdBUkVfQ1RSTCIgZmllbGQgaW4gdGhlDQo+ID4g PiAgICBGQURUIHdoaWxlIHRoZSBjb21taXQgZG9lc24ndCBzZXQgdGhlIGZpcm13YXJlIHdha2lu ZyB2ZWN0b3IgYWRkcmVzcyBvZg0KPiA+ID4gICAgdGhlIEZBQ1MgcmVwb3J0ZWQgYnkgIkZJUk1X QVJFX0NUUkwiLCBpdCBvbmx5IHNldHMgdGhlIGZpcndhcmUgd2FraW5nDQo+ID4gPiAgICB2ZWN0 b3IgYWRkcmVzcyBvZiB0aGUgRkFDUyByZXBvcnRlZCBieSAiWF9GSVJNV0FSRV9DVFJMIi4NCj4g PiA+DQo+ID4gPiBUaGlzIHBhdGNoIGV4Y2x1ZGVzIHRoZSBjYXNlcyB0aGF0IGNhbiB0cmlnZ2Vy IHRoZSBidWdzIGNhdXNlZCBieSB0aGUgcm9vdA0KPiA+ID4gY2F1c2UgMS4NCj4gPiA+DQo+ID4g PiBBQ1BJIHNwZWNpZmljYXRpb24gc2F5czoNCj4gPiA+IEEuIDMyLWJpdCBGQUNTIGFkZHJlc3Mg KEZJUk1XQVJFX0NUUkwgZmllbGQgaW4gRkFEVCk6DQo+ID4gPiAgICBQaHlzaWNhbCBtZW1vcnkg YWRkcmVzcyBvZiB0aGUgRkFDUywgd2hlcmUgT1NQTSBhbmQgZmlybXdhcmUgZXhjaGFuZ2UNCj4g PiA+ICAgIGNvbnRyb2wgaW5mb3JtYXRpb24uDQo+ID4gPiAgICBJZiB0aGUgWF9GSVJNV0FSRV9D VFJMIGZpZWxkIGNvbnRhaW5zIGEgbm9uIHplcm8gdmFsdWUgdGhlbiB0aGlzIGZpZWxkDQo+ID4g PiAgICBtdXN0IGJlIHplcm8uDQo+ID4gPiAgICBBIHplcm8gdmFsdWUgaW5kaWNhdGVzIHRoYXQg bm8gRkFDUyBpcyBzcGVjaWZpZWQgYnkgdGhpcyBmaWVsZC4NCj4gPiA+IEIuIDY0LWJpdCBGQUNT IGFkZHJlc3MgKFhfRklSTVdBUkVfQ1RSTCBmaWVsZCBpbiBGQURUKToNCj4gPiA+ICAgIDY0Yml0 IHBoeXNpY2FsIG1lbW9yeSBhZGRyZXNzIG9mIHRoZSBGQUNTLg0KPiA+ID4gICAgVGhpcyBmaWVs ZCBpcyB1c2VkIHdoZW4gdGhlIHBoeXNpY2FsIGFkZHJlc3Mgb2YgdGhlIEZBQ1MgaXMgYWJvdmUg NEdCLg0KPiA+ID4gICAgSWYgdGhlIEZJUk1XQVJFX0NUUkwgZmllbGQgY29udGFpbnMgYSBub24g emVybyB2YWx1ZSB0aGVuIHRoaXMgZmllbGQNCj4gPiA+ICAgIG11c3QgYmUgemVyby4NCj4gPiA+ ICAgIEEgemVybyB2YWx1ZSBpbmRpY2F0ZXMgdGhhdCBubyBGQUNTIGlzIHNwZWNpZmllZCBieSB0 aGlzIGZpZWxkLg0KPiA+ID4gVGh1cyB0aGUgMzJiaXQgYW5kIDY0Yml0IGZpcm13YXJlIHdha2lu ZyB2ZWN0b3Igc2hvdWxkIGluZGljYXRlIGNvbXBsZXRlbHkNCj4gPiA+IGRpZmZlcmVudCByZXN1 bWluZyBlbnZpcm9ubWVudCAtIHJlYWwgbW9kZSAoMU1CIGFkZHJlc3NhYmxlKSBhbmQgbm9uIHJl YWwNCj4gPiA+IG1vZGUgKDRHQisgYWRkcmVzc2FibGUpIGFuZCBjdXJyZW50bHkgTGludXggb25s eSBzdXBwb3J0cyByZXN1bWluZyBmcm9tDQo+ID4gPiByZWFsIG1vZGUuDQo+ID4gPg0KPiA+ID4g VGhpcyBwYXRjaCBlbmFibGVzIDY0LWJpdCBmaXJtd2FyZSB3YWtpbmcgdmVjdG9yIGZvciBzZWxl Y3RlZCBGQUNTIHZpYQ0KPiA+ID4gYWNwaV9zZXRfZmlybXdhcmVfd2FraW5nX3ZlY3RvcigpIHNv IHRoYXQgaXQncyB1cCB0byBPU1BNcyB0byBkZXRlcm1pbmUgd2hpY2gNCj4gPiA+IHJlc3VtaW5n IG1vZGUgc2hvdWxkIGJlIHVzZWQgYnkgQklPUyBhbmQgQUNQSUNBIGNoYW5nZXMgd29uJ3QgdHJp Z2dlciB0aGUNCj4gPiA+IGJ1Z3MgY2F1c2VkIGJ5IHRoZSByb290IGNhdXNlIDEuIEZvciBleGFt cGxlLCBMaW51eCBjYW4gcGFzcw0KPiA+ID4gcGh5c2ljYWxfYWRkcmVzczY0PTAgYXMgdGhlIHBh cmFtZXRlciBvZiBhY3BpX3NldF9maXJtd2FyZV93YWtpbmdfdmVjdG9yKCkgdG8NCj4gPiA+IGlu ZGljYXRlIG5vIDY0Yml0IHdha2luZyB2ZWN0b3Igc3VwcG9ydC4gTHYgWmhlbmcuDQo+ID4gPg0K PiA+ID4gVGhpcyBwYXRjaCBhbHNvIHVwZGF0ZXMgYWNwaV9zZXRfZmlybXdhcmVfd2FraW5nX3Zl Y3RvcigpIGludm9jYXRpb25zIGluDQo+ID4gPiBvcmRlciB0byBrZWVwIDMyLWJpdCBmaXJtd2Fy ZSB3YWtpbmcgdmVjdG9yIGZhdm9yIGZvciBMaW51eC4gNjQtYml0DQo+ID4gPiBmaXJtd2FyZSB3 YWtpbmcgdmVjdG9yIGhhcyBuZXZlciBiZWVuIGVuYWJsZWQgYnkgTGludXguICBUaGUNCj4gPiA+ IChhY3BpX3BoeXNpY2FsX2FkZHJlc3MpMCBmb3IgNjQtYml0IGFkZHJlc3MgY2FuIGJlIHVzZWQg dG8gZm9yY2UgQUNQSUNBIHRvDQo+ID4gPiBzZXQgb25seSAzMi1iaXQgZmlybXdhcmUgd2FraW5n IHZlY3RvciBmb3IgTGludXguDQo+ID4gPg0KPiA+ID4gTGluazogaHR0cHM6Ly9idWd6aWxsYS5r ZXJuZWwub3JnL3Nob3dfYnVnLmNnaT9pZD03NDAyMQ0KPiA+ID4gTGluazogaHR0cHM6Ly9naXRo dWIuY29tL2FjcGljYS9hY3BpY2EvY29tbWl0LzdhYTU5OGQ3DQo+ID4gPiBDYzogMy4xNC4xKyA8 c3RhYmxlQHZnZXIua2VybmVsLm9yZz4gIyAzLjE0LjErDQo+ID4gPiBSZXBvcnRlZC1hbmQtdGVz dGVkLWJ5OiBPc3dhbGQgQnVkZGVuaGFnZW4gPG9zc2lAa2RlLm9yZz4NCj4gPiA+IFNpZ25lZC1v ZmYtYnk6IEx2IFpoZW5nIDxsdi56aGVuZ0BpbnRlbC5jb20+DQo+ID4gPiBTaWduZWQtb2ZmLWJ5 OiBCb2IgTW9vcmUgPHJvYmVydC5tb29yZUBpbnRlbC5jb20+DQo+ID4gPiBDYzogVGhvbWFzIEds ZWl4bmVyIDx0Z2x4QGxpbnV0cm9uaXguZGU+DQo+ID4gPiBDYzogSW5nbyBNb2xuYXIgPG1pbmdv QHJlZGhhdC5jb20+DQo+ID4gPiBDYzogIkguIFBldGVyIEFudmluIiA8aHBhQHp5dG9yLmNvbT4N Cj4gPiA+IENjOiB4ODZAa2VybmVsLm9yZw0KPiA+ID4gQ2M6IFRvbnkgTHVjayA8dG9ueS5sdWNr QGludGVsLmNvbT4NCj4gPiA+IENjOiBGZW5naHVhIFl1IDxmZW5naHVhLnl1QGludGVsLmNvbT4N Cj4gPiA+IENjOiBsaW51eC1pYTY0QHZnZXIua2VybmVsLm9yZw0KPiA+ID4gLS0tDQo+ID4gPiAg YXJjaC9pYTY0L2luY2x1ZGUvYXNtL2FjcGkuaCAgICB8ICAgIDMgKy0NCj4gPiA+ICBhcmNoL2lh NjQva2VybmVsL2FjcGkuYyAgICAgICAgIHwgICAgMiAtLQ0KPiA+ID4gIGFyY2gveDg2L2luY2x1 ZGUvYXNtL2FjcGkuaCAgICAgfCAgICAzICstDQo+ID4gPiAgZHJpdmVycy9hY3BpL2FjcGljYS9o d3hmc2xlZXAuYyB8ICAgNjEgKysrKysrKysrKysrLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0t DQo+ID4gPiAgZHJpdmVycy9hY3BpL3NsZWVwLmMgICAgICAgICAgICB8ICAgIDggKysrLS0NCj4g PiA+ICBpbmNsdWRlL2FjcGkvYWNwaXhmLmggICAgICAgICAgIHwgICAxMSArKystLS0tDQo+ID4g PiAgNiBmaWxlcyBjaGFuZ2VkLCAzMyBpbnNlcnRpb25zKCspLCA1NSBkZWxldGlvbnMoLSkNCj4g PiA+DQo+ID4gPiBkaWZmIC0tZ2l0IGEvYXJjaC9pYTY0L2luY2x1ZGUvYXNtL2FjcGkuaCBiL2Fy Y2gvaWE2NC9pbmNsdWRlL2FzbS9hY3BpLmgNCj4gPiA+IGluZGV4IGFhMGZkZjEuLjBhYzRmYWIg MTAwNjQ0DQo+ID4gPiAtLS0gYS9hcmNoL2lhNjQvaW5jbHVkZS9hc20vYWNwaS5oDQo+ID4gPiAr KysgYi9hcmNoL2lhNjQvaW5jbHVkZS9hc20vYWNwaS5oDQo+ID4gPiBAQCAtNzksNyArNzksOCBA QCBpbnQgYWNwaV9nc2lfdG9faXJxICh1MzIgZ3NpLCB1bnNpZ25lZCBpbnQgKmlycSk7DQo+ID4g PiAgLyogTG93LWxldmVsIHN1c3BlbmQgcm91dGluZS4gKi8NCj4gPiA+ICBleHRlcm4gaW50IGFj cGlfc3VzcGVuZF9sb3dsZXZlbCh2b2lkKTsNCj4gPiA+DQo+ID4gPiAtZXh0ZXJuIHVuc2lnbmVk IGxvbmcgYWNwaV93YWtldXBfYWRkcmVzczsNCj4gPiA+ICsjZGVmaW5lIGFjcGlfd2FrZXVwX2Fk ZHJlc3MJKChhY3BpX3BoeXNpY2FsX2FkZHJlc3MpMCkNCj4gPiA+ICsjZGVmaW5lIGFjcGlfd2Fr ZXVwX2FkZHJlc3M2NAkoKGFjcGlfcGh5c2ljYWxfYWRkcmVzcykwKQ0KPiA+ID4NCj4gPiA+ICAv Kg0KPiA+ID4gICAqIFJlY29yZCB0aGUgY3BlaSBvdmVycmlkZSBmbGFnIGFuZCBjdXJyZW50IGxv Z2ljYWwgY3B1LiBUaGlzIGlzDQo+ID4gPiBkaWZmIC0tZ2l0IGEvYXJjaC9pYTY0L2tlcm5lbC9h Y3BpLmMgYi9hcmNoL2lhNjQva2VybmVsL2FjcGkuYw0KPiA+ID4gaW5kZXggYjE2OThiYy4uMWIw OGQ2ZiAxMDA2NDQNCj4gPiA+IC0tLSBhL2FyY2gvaWE2NC9rZXJuZWwvYWNwaS5jDQo+ID4gPiAr KysgYi9hcmNoL2lhNjQva2VybmVsL2FjcGkuYw0KPiA+ID4gQEAgLTYwLDggKzYwLDYgQEAgaW50 IGFjcGlfbGFwaWM7DQo+ID4gPiAgdW5zaWduZWQgaW50IGFjcGlfY3BlaV9vdmVycmlkZTsNCj4g PiA+ICB1bnNpZ25lZCBpbnQgYWNwaV9jcGVpX3BoeXNfY3B1aWQ7DQo+ID4gPg0KPiA+ID4gLXVu c2lnbmVkIGxvbmcgYWNwaV93YWtldXBfYWRkcmVzcyA9IDA7DQo+ID4gPiAtDQo+ID4gPiAgI2lm ZGVmIENPTkZJR19JQTY0X0dFTkVSSUMNCj4gPiA+ICBzdGF0aWMgdW5zaWduZWQgbG9uZyBfX2lu aXQgYWNwaV9maW5kX3JzZHAodm9pZCkNCj4gPiA+ICB7DQo+ID4gPiBkaWZmIC0tZ2l0IGEvYXJj aC94ODYvaW5jbHVkZS9hc20vYWNwaS5oIGIvYXJjaC94ODYvaW5jbHVkZS9hc20vYWNwaS5oDQo+ ID4gPiBpbmRleCAzYTQ1NjY4Li5mYzk2MDhkIDEwMDY0NA0KPiA+ID4gLS0tIGEvYXJjaC94ODYv aW5jbHVkZS9hc20vYWNwaS5oDQo+ID4gPiArKysgYi9hcmNoL3g4Ni9pbmNsdWRlL2FzbS9hY3Bp LmgNCj4gPiA+IEBAIC03Miw3ICs3Miw4IEBAIHN0YXRpYyBpbmxpbmUgdm9pZCBhY3BpX2Rpc2Fi bGVfcGNpKHZvaWQpDQo+ID4gPiAgZXh0ZXJuIGludCAoKmFjcGlfc3VzcGVuZF9sb3dsZXZlbCko dm9pZCk7DQo+ID4gPg0KPiA+ID4gIC8qIFBoeXNpY2FsIGFkZHJlc3MgdG8gcmVzdW1lIGFmdGVy IHdha2V1cCAqLw0KPiA+ID4gLSNkZWZpbmUgYWNwaV93YWtldXBfYWRkcmVzcyAoKHVuc2lnbmVk IGxvbmcpKHJlYWxfbW9kZV9oZWFkZXItPndha2V1cF9zdGFydCkpDQo+ID4gPiArI2RlZmluZSBh Y3BpX3dha2V1cF9hZGRyZXNzCSgoYWNwaV9waHlzaWNhbF9hZGRyZXNzKShyZWFsX21vZGVfaGVh ZGVyLT53YWtldXBfc3RhcnQpKQ0KPiA+ID4gKyNkZWZpbmUgYWNwaV93YWtldXBfYWRkcmVzczY0 CSgoYWNwaV9waHlzaWNhbF9hZGRyZXNzKSgwKSkNCj4gPg0KPiA+IERvIHdlIG5lZWQgdGhpcz8N Cj4gDQo+IEluIGZhY3QsIEkgZG9uJ3Qgc2VlIHdoeSB3ZSBuZWVkIHRvIHJlZGVmaW5lIHRoZSBz eW1ib2xzIGF0IGFsbC4NCj4gDQo+IENvdWxkbid0IGFjcGlfc2V0X2Zpcm13YXJlX3dha2luZ192 ZWN0b3IoKSBiZSBkZWZpbmVkIHRvIHRha2UgdTMyIGFuZCB1NjQgc28NCj4gd2UgY291bGQganVz dCBwYXNzIGFjcGlfd2FrZXVwX2FkZHJlc3MgKGFzIGFscmVhZHkgZGVmaW5lZCkgYXMgdGhlIGZp cnN0IGFyZ3VtZW50DQo+IGFuZCAwIGFzIHRoZSBzZWNvbmQgYXJndW1lbnQgdG8gaXQ/ICBUaGUg YmFjay1hbmQtZm9ydGggdHlwZSBjYXN0cyBmcm9tIGFuZA0KPiB0byBhY3BpX3BoeXNpY2FsX2Fk ZHJlc3MgZG9uJ3QgbG9vayBlbnRpcmVseSBjbGVhbiB0byBtZS4NCj4gDQo+IE1vcmVvdmVyLCBJ IGRvbid0IHJlYWxseSBzZWUgYSBmdW5jdGlvbmFsIGRpZmZlcmVuY2UgYmV0d2VlbiB0aGUgb2xk IGFuZCB0aGUNCj4gbmV3IGNvZGUuDQo+IA0KPiBUaGUgb2xkIGNvZGUgZG9lcyAic2V0IHRoZSAz Mi1iaXQgd2FraW5nIHZlY3RvciBhbmQgY2xlYXIgdGhlIDY0LWJpdCB3YWtpbmcNCj4gdmVjdG9y IGlmIHByZXNlbnQiLiAgVGhlIG5ldyBjb2RlIGRvZXMgInNldCB0aGUgMzItYml0IHdha2luZyB2 ZWN0b3IgYW5kDQo+IGVpdGhlciBjbGVhciB0aGUgNjQtYml0IG9uZSBpZiBwcmVzZW50LCBvciBh c3NpZ24gdGhlIHNlY29uZCBmdW5jdGlvbiBhcmd1bWVudA0KPiB0byBpdCIsIGJ1dCB3ZSBhbHdh eXMgcGFzcyAwIGFzIHRoZSBzZWNvbmQgYXJndW1lbnQgKHdoaWNoIGlzICpleHRyZW1lbHkqDQo+ IG9iZnVzY2F0ZWQgaW4geW91ciBwYXRjaCksIHNvIEkgcmVhbGx5IGRvbid0IHNlZSB0aGUgZGlm ZmVyZW5jZSBoZXJlLg0KPiANCj4gQW0gSSBtaXNzaW5nIGFueXRoaW5nPw0KDQpUaGUgc3Rvcnkg aXM6DQpBY2NvcmRpbmcgdG8gdGhlIHRlc3QsIGlmIGJvdGggMzItYml0IHdha2luZyB2ZWN0b3Ig YW5kIDY0LWJpdCB3YWtpbmcgdmVjdG9yIGlzIHNldCBieSB0aGUgT1NQTSwgQklPU2VzIG9ubHkg c3VwcG9ydCAzMi1iaXQgcmVzdW1lIGVudmlyb25tZW50IHdpbGwganVtcCB0byB0aGUgMzItYml0 IHdha2luZyB2ZWN0b3IgYWRkcmVzcyBhbmQgQklPU2VzIHN1cHBvcnQgNjQtYml0IHJlc3VtZSBl bnZpcm9ubWVudCB3aWxsIGp1bXAgdG8gNjQtYml0IHdha2luZyB2ZWN0b3IuDQpTbyB0aGV5IGNh biBiZSBzZXQgYnkgdGhlIE9TUE1zIHNpbXVsdGFuZW91c2x5IHRvIGluZGljYXRlIHRoYXQgdGhl IE9TUE0gY2FuIHN1cHBvcnQgYm90aCByZXN1bWUgZW52aXJvbm1lbnRzLg0KVGhhdCdzIHdoeSBB Q1BJQ0EgaW50ZXJmYWNlIGlzIGNoYW5nZWQuDQoNClRoYW5rcyBhbmQgYmVzdCByZWdhcmRzDQot THYNCg=

#52 lore raw

Re: [PATCH v2 03/28] ACPICA: Hardware: Enable 64-bit firmware waking vector for selected FACS.

Quoted 5 lines · Lv

Hi, Rafael

Quoted 3 lines

From: Rafael J. Wysocki [mailto:[email protected]]
Sent: Thursday, June 25, 2015 7:24 AM
To: Zheng, Lv

[cut]

Quoted 17 lines
Quoted 17 lines

In fact, I don't see why we need to redefine the symbols at all.

Couldn't acpi_set_firmware_waking_vector() be defined to take u32 and u64 so we could just pass acpi_wakeup_address (as already defined) as the first argument and 0 as the second argument to it? The back-and-forth type casts from and to acpi_physical_address don't look entirely clean to me.

Moreover, I don't really see a functional difference between the old and the new code.

The old code does "set the 32-bit waking vector and clear the 64-bit waking vector if present". The new code does "set the 32-bit waking vector and either clear the 64-bit one if present, or assign the second function argument to it", but we always pass 0 as the second argument (which is *extremely* obfuscated in your patch), so I really don't see the difference here.

Quoted 5 lines
Quoted 1 line

Am I missing anything?

The story is:
According to the test, if both 32-bit waking vector and 64-bit waking vector is set by the OSPM,

The current code in Linux never does that.

It never calls acpi_set_firmware_waking_vector64() and the acpi_set_firmware_waking_vector() (before your patch) explicitly clears the 64-bit vector address.

Quoted 3 lines

BIOSes only support 32-bit resume environment will jump to the 32-bit waking vector address and BIOSes support 64-bit resume environment will jump to 64-bit waking vector.

Which doesn't matter for Linux one whit.

Quoted 2 lines

So they can be set by the OSPMs simultaneously to indicate that the OSPM can support both resume environments. That's why ACPICA interface is changed.

It shouldn't. It just forces host OSes to make pointless changes to their non-ACPICA code.

As I said elsewhere, the old acpi_set_firmware_waking_vector() should still be available to the OSes that don't care about the 64-bit waking vector and a *new* interface should be added for those OSes that do care about it. And *internally* acpi_set_firmware_waking_vector() can be defined in terms of the new interface, but there's no reason at all for a host OS to care about that.

So the $subject patch is entirely poitless. It doesn't fix anything and it doesn't even change the way the code works today in Linux. It just adds complexity and pointlessly redefines some stuff.

So I'm not going to apply it.

Thanks,
Rafael

author
#53 lore raw

RE: [PATCH v2 03/28] ACPICA: Hardware: Enable 64-bit firmware waking vector for selected FACS.

Hi, Rafael

Quoted 31 lines

From: Rafael J. Wysocki [mailto:[email protected]]
Sent: Friday, June 26, 2015 9:21 AM

Quoted 5 lines · Lv

Hi, Rafael

Quoted 3 lines

From: Rafael J. Wysocki [mailto:[email protected]]
Sent: Thursday, June 25, 2015 7:24 AM
To: Zheng, Lv

[cut]

Quoted 19 lines
Quoted 18 lines

In fact, I don't see why we need to redefine the symbols at all.

Couldn't acpi_set_firmware_waking_vector() be defined to take u32 and u64 so we could just pass acpi_wakeup_address (as already defined) as the first argument and 0 as the second argument to it? The back-and-forth type casts from and to acpi_physical_address don't look entirely clean to me.

Moreover, I don't really see a functional difference between the old and the new code.

The old code does "set the 32-bit waking vector and clear the 64-bit waking vector if present". The new code does "set the 32-bit waking vector and either clear the 64-bit one if present, or assign the second function argument to it", but we always pass 0 as the second argument (which is *extremely* obfuscated in your patch), so I really don't see the difference here.

Am I missing anything?

Quoted 8 lines
Quoted 3 lines

The story is:
According to the test, if both 32-bit waking vector and 64-bit waking vector is set by the OSPM,

The current code in Linux never does that.

It never calls acpi_set_firmware_waking_vector64() and the acpi_set_firmware_waking_vector() (before your patch) explicitly clears the 64-bit vector address.

In ACPICA upstream, this is an issue before applying this patch.
acpi_set_firmware_waking_vector64() and acpi_set_firmware_waking_vector() depends on ACPI_MACHINE_WIDTH definition, thus cannot be used for this purpose.

Quoted 6 lines
Quoted 4 lines

BIOSes only support 32-bit resume environment will jump to the 32-bit waking vector address and BIOSes support 64-bit resume environment will jump to 64-bit waking vector.

Which doesn't matter for Linux one whit.

The bug report is against the 64-bit address favor mechanism.
But if the OSPM can support resuming from 64-bit waking vector, the 64-bit address favor mechanism doesn't seem to be buggy.

Quoted 4 lines
Quoted 3 lines

So they can be set by the OSPMs simultaneously to indicate that the OSPM can support both resume environments. That's why ACPICA interface is changed.

Quoted 8 lines

It shouldn't. It just forces host OSes to make pointless changes to their non-ACPICA code.

As I said elsewhere, the old acpi_set_firmware_waking_vector() should still be available to the OSes that don't care about the 64-bit waking vector and a *new* interface should be added for those OSes that do care about it. And *internally* acpi_set_firmware_waking_vector() can be defined in terms of the new interface, but there's no reason at all for a host OS to care about that.

OK, we can refine the interface inside of ACPICA.

Quoted 5 lines

So the $subject patch is entirely poitless. It doesn't fix anything and it doesn't even change the way the code works today in Linux. It just adds complexity and pointlessly redefines some stuff.

It doesn't fix any functionality problem right here in this patch.
But it fixes the code logic problem that acpi_set_firmware_waking_vector64()/acpi_set_firmware_waking_vector() depends on ACPI_MACHINE_WIDTH definition. And it facilitates the OSPMs with the capability to support both 32-bit/64-bit resuming environment.

Quoted 1 line

So I'm not going to apply it.

OK, I'll go back to refine the interface change.

Thanks and best regards
-Lv

author
#54 lore raw

RE: [PATCH v2 03/28] ACPICA: Hardware: Enable 64-bit firmware waking vector for selected FACS.

In reply to Rafael J. Wysocki

Hi, Rafael

Quoted 130 lines

From: Rafael J. Wysocki [mailto:[email protected]]
Sent: Wednesday, June 24, 2015 10:06 PM

Quoted 108 lines · Lv Zheng

ACPICA commit 7aa598d711644ab0de5f70ad88f1e2de253115e4

The following commit is reported to have broken s2ram on some platforms:
Commit: 0249ed2444d65d65fc3f3f64f398f1ad0b7e54cd
ACPICA: Add option to favor 32-bit FADT addresses.
The platform reports 2 FACS tables (which is not allowed by ACPI specification) and the new 32-bit address favor rule forces OSPMs to use the FACS table reported via FADT's X_FIRMWARE_CTRL field.

The root cause of the reported bug might be one of the followings:
1. BIOS may favor the 64-bit firmware waking vector address when the version of the FACS is greater than 0 and Linux currently only supports resuming from the real mode, so the 64-bit firmware waking vector has never been set and might be invalid to BIOS while the commit enables higher version FACS.
2. BIOS may favor the FACS reported via the "FIRMWARE_CTRL" field in the FADT while the commit doesn't set the firmware waking vector address of the FACS reported by "FIRMWARE_CTRL", it only sets the firware waking vector address of the FACS reported by "X_FIRMWARE_CTRL".

This patch excludes the cases that can trigger the bugs caused by the root cause 1.

ACPI specification says:
A. 32-bit FACS address (FIRMWARE_CTRL field in FADT):
Physical memory address of the FACS, where OSPM and firmware exchange control information.
If the X_FIRMWARE_CTRL field contains a non zero value then this field must be zero.
A zero value indicates that no FACS is specified by this field.
B. 64-bit FACS address (X_FIRMWARE_CTRL field in FADT):
64bit physical memory address of the FACS.
This field is used when the physical address of the FACS is above 4GB. If the FIRMWARE_CTRL field contains a non zero value then this field must be zero.
A zero value indicates that no FACS is specified by this field.
Thus the 32bit and 64bit firmware waking vector should indicate completely different resuming environment - real mode (1MB addressable) and non real mode (4GB+ addressable) and currently Linux only supports resuming from real mode.

This patch enables 64-bit firmware waking vector for selected FACS via acpi_set_firmware_waking_vector() so that it's up to OSPMs to determine which resuming mode should be used by BIOS and ACPICA changes won't trigger the bugs caused by the root cause 1. For example, Linux can pass physical_address64=0 as the parameter of acpi_set_firmware_waking_vector() to indicate no 64bit waking vector support. Lv Zheng.

This patch also updates acpi_set_firmware_waking_vector() invocations in order to keep 32-bit firmware waking vector favor for Linux. 64-bit firmware waking vector has never been enabled by Linux. The (acpi_physical_address)0 for 64-bit address can be used to force ACPICA to set only 32-bit firmware waking vector for Linux.

---
 arch/ia64/include/asm/acpi.h    |    3 +-
 arch/ia64/kernel/acpi.c         |    2 --
 arch/x86/include/asm/acpi.h     |    3 +-
 drivers/acpi/acpica/hwxfsleep.c |   61 ++++++++++++---------------------------
 drivers/acpi/sleep.c            |    8 +++--
 include/acpi/acpixf.h           |   11 +++----
 6 files changed, 33 insertions(+), 55 deletions(-)
arch/ia64/include/asm/acpi.h +2 -1
index aa0fdf1..0ac4fab 100644
@@ -79,7 +79,8 @@ int acpi_gsi_to_irq (u32 gsi, unsigned int *irq);
 /* Low-level suspend routine. */
 extern int acpi_suspend_lowlevel(void);
 
-extern unsigned long acpi_wakeup_address;
+#define acpi_wakeup_address	((acpi_physical_address)0)
+#define acpi_wakeup_address64	((acpi_physical_address)0)
 
 /*
  * Record the cpei override flag and current logical cpu. This is
arch/ia64/kernel/acpi.c +0 -2
index b1698bc..1b08d6f 100644
@@ -60,8 +60,6 @@ int acpi_lapic;
 unsigned int acpi_cpei_override;
 unsigned int acpi_cpei_phys_cpuid;
 
-unsigned long acpi_wakeup_address = 0;
-
 #ifdef CONFIG_IA64_GENERIC
 static unsigned long __init acpi_find_rsdp(void)
 {
arch/x86/include/asm/acpi.h +0 -0
index 3a45668..fc9608d 100644

arch/x86/include/asm/acpi.h static inline void acpi_disable_pci(void) · line 76

Quoted 6 lines
arch/x86/include/asm/acpi.h +2 -1
@@ -72,7 +72,8 @@ static inline void acpi_disable_pci(void)
 extern int (*acpi_suspend_lowlevel)(void);
 
 /* Physical address to resume after wakeup */
-#define acpi_wakeup_address ((unsigned long)(real_mode_header->wakeup_start))
+#define acpi_wakeup_address	((acpi_physical_address)(real_mode_header->wakeup_start))
+#define acpi_wakeup_address64	((acpi_physical_address)(0))

Do we need this?

Why don't we define

static inline void acpi_set_wakeup_address(void)

{
	acpi_set_firmware_waking_vector((unsigned long)real_mode_header->wakeup_start, 0);
}

and

Quoted 9 lines

static inline void acpi_clear_wakeup_address(void)

{
	acpi_set_firmware_waking_vector(0, 0);
}

instead?

Which may be defined as empty stubs on ia64?

This is reasonable, we can do this in Linux so that we can leave the maximum capability only in ACPICA and reflect the Linux favor in the Linux side. And this can also make the patch cleaner.
I'll modify this patch and re-send an update for this patch.

Thanks and best regards
-Lv

Quoted 167 lines
Quoted 109 lines
arch/x86/include/asm/acpi.h +0 -0
 /*
  * Check if the CPU can handle C2 and deeper
drivers/acpi/acpica/hwxfsleep.c +19 -42
index 82e310b..c67cd32 100644
@@ -73,7 +73,6 @@ static struct acpi_sleep_functions acpi_sleep_dispatch[] = {
 /*
  * These functions are removed for the ACPI_REDUCED_HARDWARE case:
  *      acpi_set_firmware_waking_vector
- *      acpi_set_firmware_waking_vector64
  *      acpi_enter_sleep_state_s4bios
  */
 
@@ -83,15 +82,19 @@ static struct acpi_sleep_functions acpi_sleep_dispatch[] = {
  * 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
+ *                                    entry point
  *
  * RETURN:      Status
  *
- * DESCRIPTION: Sets the 32-bit firmware_waking_vector field of the FACS
+ * DESCRIPTION: Sets the firmware_waking_vector fields of the FACS
  *
  ******************************************************************************/
 
-acpi_status acpi_set_firmware_waking_vector(u32 physical_address)
+acpi_status
+acpi_set_firmware_waking_vector(acpi_physical_address physical_address,
+				acpi_physical_address physical_address64)
 {
 	ACPI_FUNCTION_TRACE(acpi_set_firmware_waking_vector);
 
@@ -106,53 +109,27 @@ acpi_status acpi_set_firmware_waking_vector(u32 physical_address)
 
 	/* Set the 32-bit vector */
 
-	acpi_gbl_FACS->firmware_waking_vector = physical_address;
+	acpi_gbl_FACS->firmware_waking_vector = (u32)physical_address;
 
-	/* Clear the 64-bit vector if it exists */
+	if (acpi_gbl_FACS->length > 32) {
+		if (acpi_gbl_FACS->version >= 1) {
 
-	if ((acpi_gbl_FACS->length > 32) && (acpi_gbl_FACS->version >= 1)) {
-		acpi_gbl_FACS->xfirmware_waking_vector = 0;
-	}
-
-	return_ACPI_STATUS(AE_OK);
-}
-
-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_FUNCTION_TRACE(acpi_set_firmware_waking_vector64);
+			/* Set the 64-bit vector */
 
-	/* Determine if the 64-bit vector actually exists */
+			acpi_gbl_FACS->xfirmware_waking_vector =
+			    physical_address64;
+		} else {
+			/* Clear the 64-bit vector if it exists */
 
-	if ((acpi_gbl_FACS->length <= 32) || (acpi_gbl_FACS->version < 1)) {
-		return_ACPI_STATUS(AE_NOT_EXIST);
+			acpi_gbl_FACS->xfirmware_waking_vector = 0;
+		}
 	}
 
-	/* Clear 32-bit vector, set the 64-bit X_ vector */
-
-	acpi_gbl_FACS->firmware_waking_vector = 0;
-	acpi_gbl_FACS->xfirmware_waking_vector = physical_address;
 	return_ACPI_STATUS(AE_OK);
 }
 
-ACPI_EXPORT_SYMBOL(acpi_set_firmware_waking_vector64)
-#endif
+ACPI_EXPORT_SYMBOL(acpi_set_firmware_waking_vector)
+
 /*******************************************************************************
  *
  * FUNCTION:    acpi_enter_sleep_state_s4bios
drivers/acpi/sleep.c +0 -0
index 2f0d4db..3a6a2eb 100644

drivers/acpi/sleep.c line 28

Quoted 4 lines
drivers/acpi/sleep.c +1 -0
@@ -25,6 +25,8 @@
 #include "internal.h"
 #include "sleep.h"
 
+#define ACPI_NO_WAKING_VECTOR		((acpi_physical_address)0)

Do we need this too?

Quoted 37 lines
drivers/acpi/sleep.c +5 -2
+
 static u8 sleep_states[ACPI_S_STATE_COUNT];
 
 static void acpi_sleep_tts_switch(u32 acpi_state)
@@ -61,7 +63,8 @@ static int acpi_sleep_prepare(u32 acpi_state)
 	if (acpi_state == ACPI_STATE_S3) {
 		if (!acpi_wakeup_address)
 			return -EFAULT;
-		acpi_set_firmware_waking_vector(acpi_wakeup_address);
+		acpi_set_firmware_waking_vector(acpi_wakeup_address,
+						acpi_wakeup_address64);
 
 	}
 	ACPI_FLUSH_CPU_CACHE();
@@ -410,7 +413,8 @@ 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_firmware_waking_vector(ACPI_NO_WAKING_VECTOR,
+					ACPI_NO_WAKING_VECTOR);
 
 	acpi_target_sleep_state = ACPI_STATE_S0;
 
include/acpi/acpixf.h +0 -4
index d68f1cd..a68e4b9 100644
@@ -814,13 +814,10 @@ 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_vector(u32
-								physical_address))
-#if ACPI_MACHINE_WIDTH == 64
-ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status

include/acpi/acpixf.h ACPI_EXTERNAL_RETURN_STATUS(acpi_status · line 823

Quoted 10 lines
include/acpi/acpixf.h +4 -3
-				acpi_set_firmware_waking_vector64(u64
-								  physical_address))
-#endif
+				acpi_set_firmware_waking_vector
+				(acpi_physical_address physical_address,
+				 acpi_physical_address physical_address64))
+
 /*
  * ACPI Timer interfaces
  */

--
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.

author
#55 lore raw

PATCH v2 4/28 ACPICA: Tables: Enable both 32-bit and 64-bit FACS.

In reply to Lv Zheng

ACPICA commit f7b86f35416e3d1f71c3d816ff5075ddd33ed486

The following commit is reported to have broken s2ram on some platforms:
Commit: 0249ed2444d65d65fc3f3f64f398f1ad0b7e54cd
ACPICA: Add option to favor 32-bit FADT addresses.
The platform reports 2 FACS tables (which is not allowed by ACPI specification) and the new 32-bit address favor rule forces OSPMs to use the FACS table reported via FADT's X_FIRMWARE_CTRL field.

The root cause of the reported bug might be one of the followings:
1. BIOS may favor the 64-bit firmware waking vector address when the version of the FACS is greater than 0 and Linux currently only supports resuming from the real mode, so the 64-bit firmware waking vector has never been set and might be invalid to BIOS while the commit enables higher version FACS.
2. BIOS may favor the FACS reported via the "FIRMWARE_CTRL" field in the FADT while the commit doesn't set the firmware waking vector address of the FACS reported by "FIRMWARE_CTRL", it only sets the firware waking vector address of the FACS reported by "X_FIRMWARE_CTRL".

This patch excludes the cases that can trigger the bugs caused by the root cause 2.

There is no handshaking mechanism can be used by OSPM to tell BIOS which FACS is currently used. Thus the FACS reported by "FIRMWARE_CTRL" may still be used by BIOS and the 0 value of the 32-bit firmware waking vector might trigger such failure.

This patch tries to favor 32bit FACS address in another way where both the FACS reported by "FIRMWARE_CTRL" and the FACS reported by "X_FIRMWARE_CTRL" are loaded so that further commit can set firmware waking vector in the both tables to ensure we can exclude the cases that trigger the bugs caused by the root cause 2. The exclusion is split into 2 commits as this commit is also useful for dumping more ACPI tables, it won't get reverted when such exclusion is no longer necessary. Lv Zheng.

---
 drivers/acpi/acpica/aclocal.h  |    1 +
 drivers/acpi/acpica/tbfadt.c   |   21 +++++++++++++--------
 drivers/acpi/acpica/tbutils.c  |   37 ++++++++++++++++++++++++++-----------
 drivers/acpi/acpica/tbxfload.c |    3 ++-
 include/acpi/acpixf.h          |    9 +++++++++
 5 files changed, 51 insertions(+), 20 deletions(-)
drivers/acpi/acpica/aclocal.h +1 -0
index ffdb956..bc60096 100644
@@ -213,6 +213,7 @@ struct acpi_table_list {
 
 #define ACPI_TABLE_INDEX_DSDT           (0)
 #define ACPI_TABLE_INDEX_FACS           (1)
+#define ACPI_TABLE_INDEX_X_FACS         (2)
 
 struct acpi_find_context {
 	char *search_for;
drivers/acpi/acpica/tbfadt.c +13 -8
index 7d24860..05be59c 100644
@@ -350,9 +350,18 @@ void acpi_tb_parse_fadt(u32 table_index)
 	/* If Hardware Reduced flag is set, there is no FACS */
 
 	if (!acpi_gbl_reduced_hardware) {
-		acpi_tb_install_fixed_table((acpi_physical_address)
-					    acpi_gbl_FADT.Xfacs, ACPI_SIG_FACS,
-					    ACPI_TABLE_INDEX_FACS);
+		if (acpi_gbl_FADT.facs) {
+			acpi_tb_install_fixed_table((acpi_physical_address)
+						    acpi_gbl_FADT.facs,
+						    ACPI_SIG_FACS,
+						    ACPI_TABLE_INDEX_FACS);
+		}
+		if (acpi_gbl_FADT.Xfacs) {
+			acpi_tb_install_fixed_table((acpi_physical_address)
+						    acpi_gbl_FADT.Xfacs,
+						    ACPI_SIG_FACS,
+						    ACPI_TABLE_INDEX_X_FACS);
+		}
 	}
 }
 
@@ -491,13 +500,9 @@ static void acpi_tb_convert_fadt(void)
 	acpi_gbl_FADT.header.length = sizeof(struct acpi_table_fadt);
 
 	/*
-	 * Expand the 32-bit FACS and DSDT addresses to 64-bit as necessary.
+	 * Expand the 32-bit DSDT addresses to 64-bit as necessary.
 	 * Later ACPICA code will always use the X 64-bit field.
 	 */
-	acpi_gbl_FADT.Xfacs = acpi_tb_select_address("FACS",
-						     acpi_gbl_FADT.facs,
-						     acpi_gbl_FADT.Xfacs);
-
 	acpi_gbl_FADT.Xdsdt = acpi_tb_select_address("DSDT",
 						     acpi_gbl_FADT.dsdt,
 						     acpi_gbl_FADT.Xdsdt);
drivers/acpi/acpica/tbutils.c +26 -11
index 6559a58..a4e6dab 100644
@@ -68,7 +68,8 @@ acpi_tb_get_root_table_entry(u8 *table_entry, u32 table_entry_size);
 
 acpi_status acpi_tb_initialize_facs(void)
 {
-	acpi_status status;
+	struct acpi_table_facs *facs32;
+	struct acpi_table_facs *facs64;
 
 	/* If Hardware Reduced flag is set, there is no FACS */
 
@@ -77,11 +78,25 @@ acpi_status acpi_tb_initialize_facs(void)
 		return (AE_OK);
 	}
 
-	status = acpi_get_table_by_index(ACPI_TABLE_INDEX_FACS,
-					 ACPI_CAST_INDIRECT_PTR(struct
-								acpi_table_header,
-								&acpi_gbl_FACS));
-	return (status);
+	(void)acpi_get_table_by_index(ACPI_TABLE_INDEX_FACS,
+				      ACPI_CAST_INDIRECT_PTR(struct
+							     acpi_table_header,
+							     &facs32));
+	(void)acpi_get_table_by_index(ACPI_TABLE_INDEX_X_FACS,
+				      ACPI_CAST_INDIRECT_PTR(struct
+							     acpi_table_header,
+							     &facs64));
+	if (!facs32 && !facs64) {
+		return (AE_NO_MEMORY);
+	}
+
+	if (acpi_gbl_use32_bit_facs_addresses) {
+		acpi_gbl_FACS = facs32 ? facs32 : facs64;
+	} else {
+		acpi_gbl_FACS = facs64 ? facs64 : facs32;
+	}
+
+	return (AE_OK);
 }
 #endif				/* !ACPI_REDUCED_HARDWARE */
 
@@ -101,7 +116,7 @@ acpi_status acpi_tb_initialize_facs(void)
 u8 acpi_tb_tables_loaded(void)
 {
 
-	if (acpi_gbl_root_table_list.current_table_count >= 3) {
+	if (acpi_gbl_root_table_list.current_table_count >= 4) {
 		return (TRUE);
 	}
 
@@ -357,11 +372,11 @@ acpi_status __init acpi_tb_parse_root_table(acpi_physical_address rsdp_address)
 	table_entry = ACPI_ADD_PTR(u8, table, sizeof(struct acpi_table_header));
 
 	/*
-	 * First two entries in the table array are reserved for the DSDT
-	 * and FACS, which are not actually present in the RSDT/XSDT - they
-	 * come from the FADT
+	 * First three entries in the table array are reserved for the DSDT
+	 * and 32bit/64bit FACS, which are not actually present in the
+	 * RSDT/XSDT - they come from the FADT
 	 */
-	acpi_gbl_root_table_list.current_table_count = 2;
+	acpi_gbl_root_table_list.current_table_count = 3;
 
 	/* Initialize the root table array from the RSDT/XSDT */
 
drivers/acpi/acpica/tbxfload.c +2 -1
index aadb300..b63e35d 100644
@@ -166,7 +166,8 @@ static acpi_status acpi_tb_load_namespace(void)
 
 	(void)acpi_ut_acquire_mutex(ACPI_MTX_TABLES);
 	for (i = 0; i < acpi_gbl_root_table_list.current_table_count; ++i) {
-		if ((!ACPI_COMPARE_NAME
+		if (!acpi_gbl_root_table_list.tables[i].address ||
+		    (!ACPI_COMPARE_NAME
 		     (&(acpi_gbl_root_table_list.tables[i].signature),
 		      ACPI_SIG_SSDT)
 		     &&
include/acpi/acpixf.h +9 -0
index a68e4b9..dec71ff 100644
@@ -200,6 +200,15 @@ ACPI_INIT_GLOBAL(u8, acpi_gbl_do_not_use_xsdt, FALSE);
 ACPI_INIT_GLOBAL(u8, acpi_gbl_use32_bit_fadt_addresses, TRUE);
 
 /*
+ * Optionally use 32-bit FACS table addresses.
+ * It is reported that some platforms fail to resume from system suspending
+ * if 64-bit FACS table address is selected:
+ * https://bugzilla.kernel.org/show_bug.cgi?id=74021
+ * Default is TRUE, favor the 32-bit addresses.
+ */
+ACPI_INIT_GLOBAL(u8, acpi_gbl_use32_bit_facs_addresses, TRUE);
+
+/*
  * Optionally truncate I/O addresses to 16 bits. Provides compatibility
  * with other ACPI implementations. NOTE: During ACPICA initialization,
  * this value is set to TRUE if any Windows OSI strings have been
Signature · 1 line
1.7.10
author
#56 lore raw

PATCH v2 5/28 ACPICA: Hardware: Enable firmware waking vector for both 32-bit and 64-bit FACS.

In reply to Lv Zheng

ACPICA commit 368eb60778b27b6ae94d3658ddc902ca1342a963 ACPICA commit 70f62a80d65515e1285fdeeb50d94ee6f07df4bd

The following commit is reported to have broken s2ram on some platforms:
Commit: 0249ed2444d65d65fc3f3f64f398f1ad0b7e54cd
ACPICA: Add option to favor 32-bit FADT addresses.
The platform reports 2 FACS tables (which is not allowed by ACPI specification) and the new 32-bit address favor rule forces OSPMs to use the FACS table reported via FADT's X_FIRMWARE_CTRL field.

The root cause of the reported bug might be one of the followings:
1. BIOS may favor the 64-bit firmware waking vector address when the version of the FACS is greater than 0 and Linux currently only supports resuming from the real mode, so the 64-bit firmware waking vector has never been set and might be invalid to BIOS while the commit enables higher version FACS.
2. BIOS may favor the FACS reported via the "FIRMWARE_CTRL" field in the FADT while the commit doesn't set the firmware waking vector address of the FACS reported by "FIRMWARE_CTRL", it only sets the firware waking vector address of the FACS reported by "X_FIRMWARE_CTRL".

This patch excludes the cases that can trigger the bugs caused by the root cause 2.

There is no handshaking mechanism can be used by OSPM to tell BIOS which FACS is currently used. Thus the FACS reported by "FIRMWARE_CTRL" may still be used by BIOS and the 0 value of the 32-bit firmware waking vector might trigger such failure.

This patch enables the firmware waking vectors for both 32bit/64bit FACS tables in order to ensure we can exclude the cases that trigger the bugs caused by the root cause 2. The exclusion is split into 2 commits so that if it turns out not to be necessary, this single commit can be reverted without affecting the useful one. Lv Zheng, Bob Moore.

---
 drivers/acpi/acpica/acglobal.h  |    2 ++
 drivers/acpi/acpica/hwxfsleep.c |   74 ++++++++++++++++++++++++++++++++-------
 drivers/acpi/acpica/tbutils.c   |   14 ++++----
 3 files changed, 71 insertions(+), 19 deletions(-)
drivers/acpi/acpica/acglobal.h +2 -0
index a0c4787..53f96a3 100644
@@ -61,6 +61,8 @@ ACPI_GLOBAL(struct acpi_table_header, acpi_gbl_original_dsdt_header);
 
 #if (!ACPI_REDUCED_HARDWARE)
 ACPI_GLOBAL(struct acpi_table_facs *, acpi_gbl_FACS);
+ACPI_GLOBAL(struct acpi_table_facs *, acpi_gbl_facs32);
+ACPI_GLOBAL(struct acpi_table_facs *, acpi_gbl_facs64);
 
 #endif				/* !ACPI_REDUCED_HARDWARE */
 
drivers/acpi/acpica/hwxfsleep.c +62 -12

113 lines not on this page · raw message

drivers/acpi/acpica/tbutils.c +7 -7
index a4e6dab..6a6c5be 100644
@@ -68,8 +68,6 @@ acpi_tb_get_root_table_entry(u8 *table_entry, u32 table_entry_size);
 
 acpi_status acpi_tb_initialize_facs(void)
 {
-	struct acpi_table_facs *facs32;
-	struct acpi_table_facs *facs64;
 
 	/* If Hardware Reduced flag is set, there is no FACS */
 
@@ -81,19 +79,21 @@ acpi_status acpi_tb_initialize_facs(void)
 	(void)acpi_get_table_by_index(ACPI_TABLE_INDEX_FACS,
 				      ACPI_CAST_INDIRECT_PTR(struct
 							     acpi_table_header,
-							     &facs32));
+							     &acpi_gbl_facs32));
 	(void)acpi_get_table_by_index(ACPI_TABLE_INDEX_X_FACS,
 				      ACPI_CAST_INDIRECT_PTR(struct
 							     acpi_table_header,
-							     &facs64));
-	if (!facs32 && !facs64) {
+							     &acpi_gbl_facs64));
+	if (!acpi_gbl_facs32 && !acpi_gbl_facs64) {
 		return (AE_NO_MEMORY);
 	}
 
 	if (acpi_gbl_use32_bit_facs_addresses) {
-		acpi_gbl_FACS = facs32 ? facs32 : facs64;
+		acpi_gbl_FACS =
+		    acpi_gbl_facs32 ? acpi_gbl_facs32 : acpi_gbl_facs64;
 	} else {
-		acpi_gbl_FACS = facs64 ? facs64 : facs32;
+		acpi_gbl_FACS =
+		    acpi_gbl_facs64 ? acpi_gbl_facs64 : acpi_gbl_facs32;
 	}
 
 	return (AE_OK);
Signature · 1 line
1.7.10
#57 lore raw

Re: [PATCH v2 05/28] ACPICA: Hardware: Enable firmware waking vector for both 32-bit and 64-bit FACS.

Quoted 144 lines · Lv Zheng

ACPICA commit 368eb60778b27b6ae94d3658ddc902ca1342a963 ACPICA commit 70f62a80d65515e1285fdeeb50d94ee6f07df4bd

The following commit is reported to have broken s2ram on some platforms:
Commit: 0249ed2444d65d65fc3f3f64f398f1ad0b7e54cd
ACPICA: Add option to favor 32-bit FADT addresses.
The platform reports 2 FACS tables (which is not allowed by ACPI specification) and the new 32-bit address favor rule forces OSPMs to use the FACS table reported via FADT's X_FIRMWARE_CTRL field.

The root cause of the reported bug might be one of the followings:
1. BIOS may favor the 64-bit firmware waking vector address when the version of the FACS is greater than 0 and Linux currently only supports resuming from the real mode, so the 64-bit firmware waking vector has never been set and might be invalid to BIOS while the commit enables higher version FACS.
2. BIOS may favor the FACS reported via the "FIRMWARE_CTRL" field in the FADT while the commit doesn't set the firmware waking vector address of the FACS reported by "FIRMWARE_CTRL", it only sets the firware waking vector address of the FACS reported by "X_FIRMWARE_CTRL".

This patch excludes the cases that can trigger the bugs caused by the root cause 2.

There is no handshaking mechanism can be used by OSPM to tell BIOS which FACS is currently used. Thus the FACS reported by "FIRMWARE_CTRL" may still be used by BIOS and the 0 value of the 32-bit firmware waking vector might trigger such failure.

This patch enables the firmware waking vectors for both 32bit/64bit FACS tables in order to ensure we can exclude the cases that trigger the bugs caused by the root cause 2. The exclusion is split into 2 commits so that if it turns out not to be necessary, this single commit can be reverted without affecting the useful one. Lv Zheng, Bob Moore.

---
 drivers/acpi/acpica/acglobal.h  |    2 ++
 drivers/acpi/acpica/hwxfsleep.c |   74 ++++++++++++++++++++++++++++++++-------
 drivers/acpi/acpica/tbutils.c   |   14 ++++----
 3 files changed, 71 insertions(+), 19 deletions(-)
drivers/acpi/acpica/acglobal.h +2 -0
index a0c4787..53f96a3 100644
@@ -61,6 +61,8 @@ ACPI_GLOBAL(struct acpi_table_header, acpi_gbl_original_dsdt_header);
 
 #if (!ACPI_REDUCED_HARDWARE)
 ACPI_GLOBAL(struct acpi_table_facs *, acpi_gbl_FACS);
+ACPI_GLOBAL(struct acpi_table_facs *, acpi_gbl_facs32);
+ACPI_GLOBAL(struct acpi_table_facs *, acpi_gbl_facs64);
 
 #endif				/* !ACPI_REDUCED_HARDWARE */
 
drivers/acpi/acpica/hwxfsleep.c +28 -12
index c67cd32..e273b2e 100644
@@ -50,6 +50,13 @@
 ACPI_MODULE_NAME("hwxfsleep")
 
 /* Local prototypes */
+#if (!ACPI_REDUCED_HARDWARE)
+static acpi_status
+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,9 +86,10 @@ static struct acpi_sleep_functions acpi_sleep_dispatch[] = {
 #if (!ACPI_REDUCED_HARDWARE)
 /*******************************************************************************
  *
- * FUNCTION:    acpi_set_firmware_waking_vector
+ * FUNCTION:    acpi_hw_set_firmware_waking_vector
  *
- * PARAMETERS:  physical_address    - 32-bit physical address of ACPI real mode
+ * PARAMETERS:  facs                - Pointer to FACS table
+ *              physical_address    - 32-bit physical address of ACPI real mode
  *                                    entry point
  *              physical_address64  - 64-bit physical address of ACPI protected
  *                                    entry point
@@ -92,11 +100,12 @@ static struct acpi_sleep_functions acpi_sleep_dispatch[] = {
  *
  ******************************************************************************/
 
-acpi_status
-acpi_set_firmware_waking_vector(acpi_physical_address physical_address,
-				acpi_physical_address physical_address64)
+static acpi_status
+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_set_firmware_waking_vector);
+	ACPI_FUNCTION_TRACE(acpi_hw_set_firmware_waking_vector);
 
 
 	/*
@@ -109,25 +118,66 @@ acpi_set_firmware_waking_vector(acpi_physical_address physical_address,
 
 	/* Set the 32-bit vector */
 
-	acpi_gbl_FACS->firmware_waking_vector = (u32)physical_address;
+	facs->firmware_waking_vector = (u32)physical_address;
 
-	if (acpi_gbl_FACS->length > 32) {
-		if (acpi_gbl_FACS->version >= 1) {
+	if (facs->length > 32) {
+		if (facs->version >= 1) {
 
 			/* Set the 64-bit vector */
 
-			acpi_gbl_FACS->xfirmware_waking_vector =
-			    physical_address64;
+			facs->xfirmware_waking_vector = physical_address64;
 		} else {
 			/* Clear the 64-bit vector if it exists */
 
-			acpi_gbl_FACS->xfirmware_waking_vector = 0;
+			facs->xfirmware_waking_vector = 0;
 		}
 	}
 
 	return_ACPI_STATUS(AE_OK);
 }
 
+/*******************************************************************************
+ *
+ * FUNCTION:    acpi_set_firmware_waking_vector
+ *
+ * PARAMETERS:  physical_address    - 32-bit physical address of ACPI real mode
+ *                                    entry point
+ *              physical_address64  - 64-bit physical address of ACPI protected
+ *                                    entry point

drivers/acpi/acpica/hwxfsleep.c acpi_set_firmware_waking_vector(acpi_physical_address physical_address, · line 156

Quoted 10 lines
drivers/acpi/acpica/hwxfsleep.c +10 -0
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Sets the firmware_waking_vector fields of the FACS
+ *
+ ******************************************************************************/
+
+acpi_status
+acpi_set_firmware_waking_vector(acpi_physical_address physical_address,
+				acpi_physical_address physical_address64)

The question here is: Why does the host OS need to care about the second argument of this function that will always be 0? Why didn't you keep the old header of acpi_set_firmware_waking_vector() as a one-argument function taking a u32 and why didn't you add something like

acpi_status acpi_set_firmware_waking_vector_full(u32 real_mode_address,
acpi_physical_address high_address)

and why didn't you redefine acpi_set_firmware_waking_vector() as

acpi_status acpi_set_firmware_waking_vector(u32 real_mode_address)

{
	return acpi_set_firmware_waking_vector_full(real_mode_address, 0);
}

?

If you did that, there wouldn't be any need to touch the code in drivers/acpi/sleep.c and the arch headers, so can you please explain to me why *exactly* you didn't do that?

Rafael

author
#58 lore raw

RE: [PATCH v2 05/28] ACPICA: Hardware: Enable firmware waking vector for both 32-bit and 64-bit FACS.

Hi, Rafael

Quoted 174 lines

From: Rafael J. Wysocki [mailto:[email protected]]
Sent: Thursday, June 25, 2015 7:57 AM

Quoted 144 lines · Lv Zheng

ACPICA commit 368eb60778b27b6ae94d3658ddc902ca1342a963 ACPICA commit 70f62a80d65515e1285fdeeb50d94ee6f07df4bd

The following commit is reported to have broken s2ram on some platforms:
Commit: 0249ed2444d65d65fc3f3f64f398f1ad0b7e54cd
ACPICA: Add option to favor 32-bit FADT addresses.
The platform reports 2 FACS tables (which is not allowed by ACPI specification) and the new 32-bit address favor rule forces OSPMs to use the FACS table reported via FADT's X_FIRMWARE_CTRL field.

The root cause of the reported bug might be one of the followings:
1. BIOS may favor the 64-bit firmware waking vector address when the version of the FACS is greater than 0 and Linux currently only supports resuming from the real mode, so the 64-bit firmware waking vector has never been set and might be invalid to BIOS while the commit enables higher version FACS.
2. BIOS may favor the FACS reported via the "FIRMWARE_CTRL" field in the FADT while the commit doesn't set the firmware waking vector address of the FACS reported by "FIRMWARE_CTRL", it only sets the firware waking vector address of the FACS reported by "X_FIRMWARE_CTRL".

This patch excludes the cases that can trigger the bugs caused by the root cause 2.

There is no handshaking mechanism can be used by OSPM to tell BIOS which FACS is currently used. Thus the FACS reported by "FIRMWARE_CTRL" may still be used by BIOS and the 0 value of the 32-bit firmware waking vector might trigger such failure.

This patch enables the firmware waking vectors for both 32bit/64bit FACS tables in order to ensure we can exclude the cases that trigger the bugs caused by the root cause 2. The exclusion is split into 2 commits so that if it turns out not to be necessary, this single commit can be reverted without affecting the useful one. Lv Zheng, Bob Moore.

---
 drivers/acpi/acpica/acglobal.h  |    2 ++
 drivers/acpi/acpica/hwxfsleep.c |   74 ++++++++++++++++++++++++++++++++-------
 drivers/acpi/acpica/tbutils.c   |   14 ++++----
 3 files changed, 71 insertions(+), 19 deletions(-)
drivers/acpi/acpica/acglobal.h +2 -0
index a0c4787..53f96a3 100644
@@ -61,6 +61,8 @@ ACPI_GLOBAL(struct acpi_table_header, acpi_gbl_original_dsdt_header);
 
 #if (!ACPI_REDUCED_HARDWARE)
 ACPI_GLOBAL(struct acpi_table_facs *, acpi_gbl_FACS);
+ACPI_GLOBAL(struct acpi_table_facs *, acpi_gbl_facs32);
+ACPI_GLOBAL(struct acpi_table_facs *, acpi_gbl_facs64);
 
 #endif				/* !ACPI_REDUCED_HARDWARE */
 
drivers/acpi/acpica/hwxfsleep.c +28 -12
index c67cd32..e273b2e 100644
@@ -50,6 +50,13 @@
 ACPI_MODULE_NAME("hwxfsleep")
 
 /* Local prototypes */
+#if (!ACPI_REDUCED_HARDWARE)
+static acpi_status
+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,9 +86,10 @@ static struct acpi_sleep_functions acpi_sleep_dispatch[] = {
 #if (!ACPI_REDUCED_HARDWARE)
 /*******************************************************************************
  *
- * FUNCTION:    acpi_set_firmware_waking_vector
+ * FUNCTION:    acpi_hw_set_firmware_waking_vector
  *
- * PARAMETERS:  physical_address    - 32-bit physical address of ACPI real mode
+ * PARAMETERS:  facs                - Pointer to FACS table
+ *              physical_address    - 32-bit physical address of ACPI real mode
  *                                    entry point
  *              physical_address64  - 64-bit physical address of ACPI protected
  *                                    entry point
@@ -92,11 +100,12 @@ static struct acpi_sleep_functions acpi_sleep_dispatch[] = {
  *
  ******************************************************************************/
 
-acpi_status
-acpi_set_firmware_waking_vector(acpi_physical_address physical_address,
-				acpi_physical_address physical_address64)
+static acpi_status
+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_set_firmware_waking_vector);
+	ACPI_FUNCTION_TRACE(acpi_hw_set_firmware_waking_vector);
 
 
 	/*
@@ -109,25 +118,66 @@ acpi_set_firmware_waking_vector(acpi_physical_address physical_address,
 
 	/* Set the 32-bit vector */
 
-	acpi_gbl_FACS->firmware_waking_vector = (u32)physical_address;
+	facs->firmware_waking_vector = (u32)physical_address;
 
-	if (acpi_gbl_FACS->length > 32) {
-		if (acpi_gbl_FACS->version >= 1) {
+	if (facs->length > 32) {
+		if (facs->version >= 1) {
 
 			/* Set the 64-bit vector */
 
-			acpi_gbl_FACS->xfirmware_waking_vector =
-			    physical_address64;
+			facs->xfirmware_waking_vector = physical_address64;
 		} else {
 			/* Clear the 64-bit vector if it exists */
 
-			acpi_gbl_FACS->xfirmware_waking_vector = 0;
+			facs->xfirmware_waking_vector = 0;
 		}
 	}
 
 	return_ACPI_STATUS(AE_OK);
 }
 
+/*******************************************************************************
+ *
+ * FUNCTION:    acpi_set_firmware_waking_vector
+ *
+ * PARAMETERS:  physical_address    - 32-bit physical address of ACPI real mode
+ *                                    entry point
+ *              physical_address64  - 64-bit physical address of ACPI protected
+ *                                    entry point

drivers/acpi/acpica/hwxfsleep.c acpi_set_firmware_waking_vector(acpi_physical_address physical_address, · line 156

Quoted 10 lines
drivers/acpi/acpica/hwxfsleep.c +10 -0
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Sets the firmware_waking_vector fields of the FACS
+ *
+ ******************************************************************************/
+
+acpi_status
+acpi_set_firmware_waking_vector(acpi_physical_address physical_address,
+				acpi_physical_address physical_address64)

The question here is: Why does the host OS need to care about the second argument of this function that will always be 0? Why didn't you keep the old header of acpi_set_firmware_waking_vector() as a one-argument function taking a u32 and why didn't you add something like

acpi_status acpi_set_firmware_waking_vector_full(u32 real_mode_address,
acpi_physical_address high_address)

and why didn't you redefine acpi_set_firmware_waking_vector() as

acpi_status acpi_set_firmware_waking_vector(u32 real_mode_address)

{
	return acpi_set_firmware_waking_vector_full(real_mode_address, 0);
}
Quoted 5 lines

?

If you did that, there wouldn't be any need to touch the code in drivers/acpi/sleep.c and the arch headers, so can you please explain to me why *exactly* you didn't do that?

Host OS can set non 0 address for both real_mode_address and high_address to indicate that it can support both 32-bit and 64-bit resume environments. So if a BIOS favors 32-bit resume environment, it can resume from here; if another BIOS favors 64-bit resume environment, it can resume from there. And host OSes can be implemented using only 1 binary to work with both BIOSes.

Thanks and best regards
-Lv

#59 lore raw

Re: [PATCH v2 05/28] ACPICA: Hardware: Enable firmware waking vector for both 32-bit and 64-bit FACS.

Quoted 5 lines · Lv

Hi, Rafael

Quoted 3 lines

From: Rafael J. Wysocki [mailto:[email protected]]
Sent: Thursday, June 25, 2015 7:57 AM

[cut]

Quoted 37 lines
Quoted 37 lines
Quoted 9 lines
drivers/acpi/acpica/hwxfsleep.c +8 -0
+/*******************************************************************************
+ *
+ * FUNCTION:    acpi_set_firmware_waking_vector
+ *
+ * PARAMETERS:  physical_address    - 32-bit physical address of ACPI real mode
+ *                                    entry point
+ *              physical_address64  - 64-bit physical address of ACPI protected
+ *                                    entry point

drivers/acpi/acpica/hwxfsleep.c acpi_set_firmware_waking_vector(acpi_physical_address physical_address, · line 156

Quoted 10 lines
drivers/acpi/acpica/hwxfsleep.c +10 -0
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Sets the firmware_waking_vector fields of the FACS
+ *
+ ******************************************************************************/
+
+acpi_status
+acpi_set_firmware_waking_vector(acpi_physical_address physical_address,
+				acpi_physical_address physical_address64)

The question here is: Why does the host OS need to care about the second argument of this function that will always be 0? Why didn't you keep the old header of acpi_set_firmware_waking_vector() as a one-argument function taking a u32 and why didn't you add something like

acpi_status acpi_set_firmware_waking_vector_full(u32 real_mode_address,
acpi_physical_address high_address)

and why didn't you redefine acpi_set_firmware_waking_vector() as

acpi_status acpi_set_firmware_waking_vector(u32 real_mode_address)

{
	return acpi_set_firmware_waking_vector_full(real_mode_address, 0);
}

?

Quoted 7 lines
Quoted 3 lines

If you did that, there wouldn't be any need to touch the code in drivers/acpi/sleep.c and the arch headers, so can you please explain to me why *exactly* you didn't do that?

Host OS can set non 0 address for both real_mode_address and high_address to indicate that it can support both 32-bit and 64-bit resume environments. So if a BIOS favors 32-bit resume environment, it can resume from here; if another BIOS favors 64-bit resume environment, it can resume from there. And host OSes can be implemented using only 1 binary to work with both BIOSes.

I'm not talking about that.

It is fine to provide a *new* interface for the OSes that want to do that (if any), but *why* is that regarded as a good enough reason for essentially *removing* the old interface that Linux (and presumably other OSes too) have been using so far?

We don't want to pass nonzero as high_address anyway, so why are we *forced* to make pointless changes to non-ACPICA code just to be able to always pass 0 as high_address?

Rafael

author
#60 lore raw

RE: [PATCH v2 05/28] ACPICA: Hardware: Enable firmware waking vector for both 32-bit and 64-bit FACS.

Hi, Rafael

Quoted 57 lines

From: Rafael J. Wysocki [mailto:[email protected]]
Sent: Friday, June 26, 2015 8:44 AM

Quoted 5 lines · Lv

Hi, Rafael

Quoted 3 lines

From: Rafael J. Wysocki [mailto:[email protected]]
Sent: Thursday, June 25, 2015 7:57 AM

[cut]

Quoted 35 lines
Quoted 35 lines
Quoted 9 lines
drivers/acpi/acpica/hwxfsleep.c +8 -0
+/*******************************************************************************
+ *
+ * FUNCTION:    acpi_set_firmware_waking_vector
+ *
+ * PARAMETERS:  physical_address    - 32-bit physical address of ACPI real mode
+ *                                    entry point
+ *              physical_address64  - 64-bit physical address of ACPI protected
+ *                                    entry point

drivers/acpi/acpica/hwxfsleep.c acpi_set_firmware_waking_vector(acpi_physical_address physical_address, · line 156

Quoted 10 lines
drivers/acpi/acpica/hwxfsleep.c +10 -0
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Sets the firmware_waking_vector fields of the FACS
+ *
+ ******************************************************************************/
+
+acpi_status
+acpi_set_firmware_waking_vector(acpi_physical_address physical_address,
+				acpi_physical_address physical_address64)

The question here is: Why does the host OS need to care about the second argument of this function that will always be 0? Why didn't you keep the old header of acpi_set_firmware_waking_vector() as a one-argument function taking a u32 and why didn't you add something like

acpi_status acpi_set_firmware_waking_vector_full(u32 real_mode_address,
acpi_physical_address high_address)

and why didn't you redefine acpi_set_firmware_waking_vector() as

acpi_status acpi_set_firmware_waking_vector(u32 real_mode_address)

{
	return acpi_set_firmware_waking_vector_full(real_mode_address, 0);
}
Quoted 7 lines
Quoted 5 lines

?

If you did that, there wouldn't be any need to touch the code in drivers/acpi/sleep.c and the arch headers, so can you please explain to me why *exactly* you didn't do that?

Host OS can set non 0 address for both real_mode_address and high_address to indicate that it can support both 32-bit and 64-bit

resume environments.

Quoted 1 line

So if a BIOS favors 32-bit resume environment, it can resume from here; if another BIOS favors 64-bit resume environment, it can

resume from there.

Quoted 8 lines
Quoted 1 line

And host OSes can be implemented using only 1 binary to work with both BIOSes.

I'm not talking about that.

It is fine to provide a *new* interface for the OSes that want to do that (if any), but *why* is that regarded as a good enough reason for essentially *removing* the old interface that Linux (and presumably other OSes too) have been using so far?

Maybe we should ask Bob if we shall just provide a new interfaces for this and keep the old ones? According to my understanding, there is no such example in the ACPICA upstream.
Some xxxx_full functions are still pending for being merged by ACPICA upstream, they are divergences for now.

Quoted 4 lines

We don't want to pass nonzero as high_address anyway, so why are we *forced* to make pointless changes to non-ACPICA code just to be able to always pass 0 as high_address?

IMO, OSPMs can do this if the cost is not high.
It seems by following your suggestion, we only need to do slight changes in sleep.c.

Thanks and best regards
-Lv

#61 lore raw

Re: [PATCH v2 05/28] ACPICA: Hardware: Enable firmware waking vector for both 32-bit and 64-bit FACS.

Quoted 63 lines · Lv

Hi, Rafael

Quoted 61 lines

From: Rafael J. Wysocki [mailto:[email protected]]
Sent: Friday, June 26, 2015 8:44 AM

Quoted 5 lines · Lv

Hi, Rafael

Quoted 3 lines

From: Rafael J. Wysocki [mailto:[email protected]]
Sent: Thursday, June 25, 2015 7:57 AM

[cut]

Quoted 35 lines
Quoted 35 lines
Quoted 9 lines
drivers/acpi/acpica/hwxfsleep.c +8 -0
+/*******************************************************************************
+ *
+ * FUNCTION:    acpi_set_firmware_waking_vector
+ *
+ * PARAMETERS:  physical_address    - 32-bit physical address of ACPI real mode
+ *                                    entry point
+ *              physical_address64  - 64-bit physical address of ACPI protected
+ *                                    entry point

drivers/acpi/acpica/hwxfsleep.c acpi_set_firmware_waking_vector(acpi_physical_address physical_address, · line 156

Quoted 10 lines
drivers/acpi/acpica/hwxfsleep.c +10 -0
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Sets the firmware_waking_vector fields of the FACS
+ *
+ ******************************************************************************/
+
+acpi_status
+acpi_set_firmware_waking_vector(acpi_physical_address physical_address,
+				acpi_physical_address physical_address64)

The question here is: Why does the host OS need to care about the second argument of this function that will always be 0? Why didn't you keep the old header of acpi_set_firmware_waking_vector() as a one-argument function taking a u32 and why didn't you add something like

acpi_status acpi_set_firmware_waking_vector_full(u32 real_mode_address,
acpi_physical_address high_address)

and why didn't you redefine acpi_set_firmware_waking_vector() as

acpi_status acpi_set_firmware_waking_vector(u32 real_mode_address)

{
	return acpi_set_firmware_waking_vector_full(real_mode_address, 0);
}
Quoted 7 lines
Quoted 5 lines

?

If you did that, there wouldn't be any need to touch the code in drivers/acpi/sleep.c and the arch headers, so can you please explain to me why *exactly* you didn't do that?

Host OS can set non 0 address for both real_mode_address and high_address to indicate that it can support both 32-bit and 64-bit

resume environments.

Quoted 1 line

So if a BIOS favors 32-bit resume environment, it can resume from here; if another BIOS favors 64-bit resume environment, it can

resume from there.

Quoted 1 line

And host OSes can be implemented using only 1 binary to work with both BIOSes.

I'm not talking about that.

Quoted 7 lines
Quoted 4 lines

It is fine to provide a *new* interface for the OSes that want to do that (if any), but *why* is that regarded as a good enough reason for essentially *removing* the old interface that Linux (and presumably other OSes too) have been using so far?

Maybe we should ask Bob if we shall just provide a new interfaces for this and keep the old ones?

Sure, we can talk to Bob about that.

Quoted 1 line

According to my understanding, there is no such example in the ACPICA upstream.

Even so, that doesn't necessarily mean it is be impossible.

Quoted 2 lines

Some xxxx_full functions are still pending for being merged by ACPICA upstream, they are divergences for now.

And it looks like this particular case will become one more divergence of that kind.

Quoted 7 lines
Quoted 4 lines

We don't want to pass nonzero as high_address anyway, so why are we *forced* to make pointless changes to non-ACPICA code just to be able to always pass 0 as high_address?

IMO, OSPMs can do this if the cost is not high.
It seems by following your suggestion, we only need to do slight changes in sleep.c.

Which aren't necessary, right? And they don't really make things any better.

So I don't see a reason to make them.

Thanks,
Rafael

author
#62 lore raw

RE: [PATCH v2 05/28] ACPICA: Hardware: Enable firmware waking vector for both 32-bit and 64-bit FACS.

Hi, Rafael

Quoted 74 lines

From: Rafael J. Wysocki [mailto:[email protected]]
Sent: Friday, June 26, 2015 9:41 AM

Quoted 56 lines · Lv

Hi, Rafael

Quoted 54 lines

From: Rafael J. Wysocki [mailto:[email protected]]
Sent: Friday, June 26, 2015 8:44 AM

Quoted 5 lines · Lv

Hi, Rafael

Quoted 3 lines

From: Rafael J. Wysocki [mailto:[email protected]]
Sent: Thursday, June 25, 2015 7:57 AM

[cut]

Quoted 42 lines
Quoted 35 lines
Quoted 9 lines
drivers/acpi/acpica/hwxfsleep.c +8 -0
+/*******************************************************************************
+ *
+ * FUNCTION:    acpi_set_firmware_waking_vector
+ *
+ * PARAMETERS:  physical_address    - 32-bit physical address of ACPI real mode
+ *                                    entry point
+ *              physical_address64  - 64-bit physical address of ACPI protected
+ *                                    entry point

drivers/acpi/acpica/hwxfsleep.c acpi_set_firmware_waking_vector(acpi_physical_address physical_address, · line 156

Quoted 10 lines
drivers/acpi/acpica/hwxfsleep.c +10 -0
+ *
+ * RETURN:      Status
+ *
+ * DESCRIPTION: Sets the firmware_waking_vector fields of the FACS
+ *
+ ******************************************************************************/
+
+acpi_status
+acpi_set_firmware_waking_vector(acpi_physical_address physical_address,
+				acpi_physical_address physical_address64)

The question here is: Why does the host OS need to care about the second argument of this function that will always be 0? Why didn't you keep the old header of acpi_set_firmware_waking_vector() as a one-argument function taking a u32 and why didn't you add something like

acpi_status acpi_set_firmware_waking_vector_full(u32 real_mode_address,
acpi_physical_address high_address)

and why didn't you redefine acpi_set_firmware_waking_vector() as

acpi_status acpi_set_firmware_waking_vector(u32 real_mode_address)

{
	return acpi_set_firmware_waking_vector_full(real_mode_address, 0);
}
Quoted 5 lines

?

If you did that, there wouldn't be any need to touch the code in drivers/acpi/sleep.c and the arch headers, so can you please explain to me why *exactly* you didn't do that?

Host OS can set non 0 address for both real_mode_address and high_address to indicate that it can support both 32-bit and 64-

bit

Quoted 2 lines
Quoted 2 lines

resume environments.

Quoted 1 line

So if a BIOS favors 32-bit resume environment, it can resume from here; if another BIOS favors 64-bit resume environment, it

can

Quoted 10 lines
Quoted 9 lines

resume from there.

Quoted 1 line

And host OSes can be implemented using only 1 binary to work with both BIOSes.

I'm not talking about that.

It is fine to provide a *new* interface for the OSes that want to do that (if any), but *why* is that regarded as a good enough reason for essentially *removing* the old interface that Linux (and presumably other OSes too) have been using so far?

Quoted 8 lines
Quoted 2 lines

Maybe we should ask Bob if we shall just provide a new interfaces for this and keep the old ones?

Sure, we can talk to Bob about that.

Quoted 1 line

According to my understanding, there is no such example in the ACPICA upstream.

Even so, that doesn't necessarily mean it is be impossible.

Yes.

Quoted 6 lines
Quoted 3 lines

Some xxxx_full functions are still pending for being merged by ACPICA upstream, they are divergences for now.

And it looks like this particular case will become one more divergence of that kind.

OK.
I'll refine the interface change to eliminate the divergence.

Quoted 6 lines
Quoted 6 lines
Quoted 5 lines

We don't want to pass nonzero as high_address anyway, so why are we *forced* to make pointless changes to non-ACPICA code just to be able to always pass 0 as high_address?

Quoted 6 lines
Quoted 2 lines

IMO, OSPMs can do this if the cost is not high.
It seems by following your suggestion, we only need to do slight changes in sleep.c.

Which aren't necessary, right? And they don't really make things any better.

So I don't see a reason to make them.

Yes.
If this is done in ACPICA, sleep.c needn't be changed.

Thanks and best regards
-Lv

author
#63 lore raw

PATCH v2 6/28 ACPICA: Hardware: Cleanup the return values in acpi_set_waking_vector().

In reply to Lv Zheng

ACPICA commit a04dbfa308a48ab0b2d10519c54a6c533c5c8949

The return statement in acpi_set_waking_vector() is wrong and this patch corrects it. Lv Zheng.

---
 drivers/acpi/acpica/hwxfsleep.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/acpi/acpica/hwxfsleep.c +1 -1
index e273b2e..c25fedb 100644
@@ -161,7 +161,7 @@ acpi_set_firmware_waking_vector(acpi_physical_address physical_address,
 	/* If Hardware Reduced flag is set, there is no FACS */
 
 	if (acpi_gbl_reduced_hardware) {
-		return (AE_OK);
+		return_ACPI_STATUS(AE_OK);
 	}
 
 	if (acpi_gbl_facs32) {
Signature · 1 line
1.7.10
author
#64 lore raw

PATCH v2 7/28 ACPICA: Tables: Fix an issue that FACS initialization is performed twice.

In reply to Lv Zheng

ACPICA commit 90f5332a15e9d9ba83831ca700b2b9f708274658

This patch adds a new FACS initialization flag for acpi_tb_initialize(). acpi_enable_subsystem() might be invoked several times in OS bootup process, and we don't want FACS initialization to be invoked twice. Lv Zheng.

---
 drivers/acpi/acpica/utxfinit.c |   10 ++++++----
 include/acpi/actypes.h         |    1 +
 2 files changed, 7 insertions(+), 4 deletions(-)
drivers/acpi/acpica/utxfinit.c +6 -4
index 083a768..42a32a6 100644
@@ -179,10 +179,12 @@ acpi_status __init acpi_enable_subsystem(u32 flags)
 	 * Obtain a permanent mapping for the FACS. This is required for the
 	 * Global Lock and the Firmware Waking Vector
 	 */
-	status = acpi_tb_initialize_facs();
-	if (ACPI_FAILURE(status)) {
-		ACPI_WARNING((AE_INFO, "Could not map the FACS table"));
-		return_ACPI_STATUS(status);
+	if (!(flags & ACPI_NO_FACS_INIT)) {
+		status = acpi_tb_initialize_facs();
+		if (ACPI_FAILURE(status)) {
+			ACPI_WARNING((AE_INFO, "Could not map the FACS table"));
+			return_ACPI_STATUS(status);
+		}
 	}
 #endif				/* !ACPI_REDUCED_HARDWARE */
 
include/acpi/actypes.h +1 -0
index 63fd7f5..ff0b53e 100644
@@ -568,6 +568,7 @@ typedef u64 acpi_integer;
 #define ACPI_NO_ACPI_ENABLE             0x10
 #define ACPI_NO_DEVICE_INIT             0x20
 #define ACPI_NO_OBJECT_INIT             0x40
+#define ACPI_NO_FACS_INIT               0x80
 
 /*
  * Initialization state
Signature · 1 line
1.7.10
author
#65 lore raw

PATCH v2 8/28 ACPICA: Tables: Fix an issue that ACPI initialization is blocked due to no FACS.

In reply to Lv Zheng

ACPICA commit ebd544ed24c5a4faba11f265e228b7a821a729f5

This patch fixes an issue that when FACS tables do not exist, ACPI initialization cannot proceed. ACPICA BZ 1122. Lv Zheng.

---
 drivers/acpi/acpica/tbutils.c |   16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)
drivers/acpi/acpica/tbutils.c +7 -9
index 6a6c5be..2bb6a11 100644
@@ -84,18 +84,16 @@ acpi_status acpi_tb_initialize_facs(void)
 				      ACPI_CAST_INDIRECT_PTR(struct
 							     acpi_table_header,
 							     &acpi_gbl_facs64));
-	if (!acpi_gbl_facs32 && !acpi_gbl_facs64) {
-		return (AE_NO_MEMORY);
-	}
 
-	if (acpi_gbl_use32_bit_facs_addresses) {
-		acpi_gbl_FACS =
-		    acpi_gbl_facs32 ? acpi_gbl_facs32 : acpi_gbl_facs64;
-	} else {
-		acpi_gbl_FACS =
-		    acpi_gbl_facs64 ? acpi_gbl_facs64 : acpi_gbl_facs32;
+	if (acpi_gbl_facs64
+	    && (!acpi_gbl_facs32 || !acpi_gbl_use32_bit_facs_addresses)) {
+		acpi_gbl_FACS = acpi_gbl_facs64;
+	} else if (acpi_gbl_facs32) {
+		acpi_gbl_FACS = acpi_gbl_facs32;
 	}
 
+	/* If there is no FACS, just continue. There was already an error msg */
+
 	return (AE_OK);
 }
 #endif				/* !ACPI_REDUCED_HARDWARE */
Signature · 1 line
1.7.10
author
#66 lore raw

PATCH v2 9/28 ACPICA: Tables: Enable default 64-bit FADT addresses favor.

In reply to Lv Zheng

ACPICA commit 4da56eeae0749dfe8491285c1e1fad48f6efafd8

The following commit temporarily disables correct 64-bit FADT addresses favor during the period the root cause of the bug is not fixed:
Commit: 85dbd5801f62b66e2aa7826aaefcaebead44c8a6
ACPICA: Tables: Restore old behavor to favor 32-bit FADT addresses.

With enough protections, this patch re-enables 64-bit FADT addresses by default. If regressions are reported against such change, this patch should be bisected and reverted.
Note that 64-bit FACS favor and 64-bit firmware waking vector favor are excluded by this commit in order not to break OSPMs. Lv Zheng.

---
 include/acpi/acpixf.h |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
include/acpi/acpixf.h +2 -2
index dec71ff..00daa3c 100644
@@ -195,9 +195,9 @@ ACPI_INIT_GLOBAL(u8, acpi_gbl_do_not_use_xsdt, FALSE);
  * address. Although ACPICA adheres to the ACPI specification which
  * requires the use of the corresponding 64-bit address if it is non-zero,
  * some machines have been found to have a corrupted non-zero 64-bit
- * address. Default is TRUE, favor the 32-bit addresses.
+ * address. Default is FALSE, do not favor the 32-bit addresses.
  */
-ACPI_INIT_GLOBAL(u8, acpi_gbl_use32_bit_fadt_addresses, TRUE);
+ACPI_INIT_GLOBAL(u8, acpi_gbl_use32_bit_fadt_addresses, FALSE);
 
 /*
  * Optionally use 32-bit FACS table addresses.
Signature · 1 line
1.7.10
author
#67 lore raw

PATCH v2 10/28 ACPICA: MSVC6: Fix build issue for variable argument macros.

In reply to Lv Zheng

ACPICA commit 72f5a358f28c5d154ed613c142c7dca03192c5ee

This patch intoduces generic variable macro detection support and fixes build breakage issue with macros using __VA_ARGS__ feature defined in C99.

This patch fixes this build issue. Lv Zheng.

This patch doesn't affect Linux kernel.

---
 include/acpi/acoutput.h       |   13 +++++++++++--
 include/acpi/platform/acgcc.h |    4 ++++
 2 files changed, 15 insertions(+), 2 deletions(-)
include/acpi/acoutput.h +11 -2
index a8f3443..f56de8c 100644
@@ -294,8 +294,12 @@
 
 /* DEBUG_PRINT functions */
 
-#define ACPI_DEBUG_PRINT(plist)         ACPI_ACTUAL_DEBUG plist
-#define ACPI_DEBUG_PRINT_RAW(plist)     ACPI_ACTUAL_DEBUG_RAW plist
+#ifndef COMPILER_VA_MACRO
+
+#define ACPI_DEBUG_PRINT(plist)         acpi_debug_print plist
+#define ACPI_DEBUG_PRINT_RAW(plist)     acpi_debug_print_raw plist
+
+#else
 
 /* Helper macros for DEBUG_PRINT */
 
@@ -315,6 +319,11 @@
 	ACPI_DO_DEBUG_PRINT (acpi_debug_print_raw, level, line, \
 		filename, modulename, component, __VA_ARGS__)
 
+#define ACPI_DEBUG_PRINT(plist)         ACPI_ACTUAL_DEBUG plist
+#define ACPI_DEBUG_PRINT_RAW(plist)     ACPI_ACTUAL_DEBUG_RAW plist
+
+#endif
+
 /*
  * Function entry tracing
  *
include/acpi/platform/acgcc.h +4 -0
index f54de0a..5457a06 100644
@@ -75,4 +75,8 @@
 #undef strchr
 #endif
 
+/* GCC supports __VA_ARGS__ in macros */
+
+#define COMPILER_VA_MACRO               1
+
 #endif				/* __ACGCC_H__ */
Signature · 1 line
1.7.10
author
#68 lore raw

PATCH v2 11/28 ACPICA: EFI: Add EFI interface definitions to eliminate dependency of GNU EFI.

In reply to Lv Zheng

ACPICA commit 5d00e67a74542d030f0a55e7a947a020ef0d9693

This patch copies EFI interface definitions to the ACPICA code base so that the EFI utility support can be ported to other EFI implementation.

Known issues:
1. MS Builds of uefi_call_wrapper()
The uefi_call_wrapper() in GNU EFI is implemented in a the way to work around the ABI difference between Unix and MS. While I don't have environment to test the MS builds.

In order to port the ACPICA utilities to other EFI implementation, all that need to be done is to impelement the 64-bit division support and the program entry point where the efi_main() is invoked. Code to impelement these is platform specific, and ACPICA currently choose to hide such platform specific code within the specific EFI impelementation. Lv Zheng.

This patch doesn't affect Linux kernel.

---
 include/acpi/platform/acenvex.h |    6 ++++++
 1 file changed, 6 insertions(+)
include/acpi/platform/acenvex.h +6 -0
index 14dc6f6..0a7dc8e 100644
@@ -56,6 +56,12 @@
 #if defined(_LINUX) || defined(__linux__)
 #include <acpi/platform/aclinuxex.h>
 
+#elif defined(_AED_EFI)
+#include "acefiex.h"
+
+#elif defined(_GNU_EFI)
+#include "acefiex.h"
+
 #elif defined(__DragonFly__)
 #include "acdragonflyex.h"
 
Signature · 1 line
1.7.10
author
#69 lore raw

PATCH v2 12/28 ACPICA: Add dragon_fly support to unix file mapping file.

In reply to Lv Zheng

From: Sascha Wildner <[email protected]>

ACPICA commit 795b215d6fd062386f0a1c23dff9ffa244683c4f

ACPICA BZ 1130

This patch doesn't affect Linux kernel.

---
 tools/power/acpi/os_specific/service_layers/osunixmap.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/power/acpi/os_specific/service_layers/osunixmap.c +1 -1
index 0b1fa29..44ad488 100644
@@ -54,7 +54,7 @@ ACPI_MODULE_NAME("osunixmap")
 #ifndef O_BINARY
 #define O_BINARY 0
 #endif
-#ifdef _free_BSD
+#if defined(_dragon_fly) || defined(_free_BSD)
 #define MMAP_FLAGS          MAP_SHARED
 #else
 #define MMAP_FLAGS          MAP_PRIVATE
Signature · 1 line
1.7.10
author
#70 lore raw

PATCH v2 13/28 ACPICA: Utilities: Add _CLS processing

In reply to Lv Zheng

From: Suravee Suthikulpanit <[email protected]>

ACPICA commit 9a2b638acb3a7215209432e070c6bd0312374229

ACPI Device object often contains a _CLS object to supply PCI-defined class code for the device. This patch introduces logic to process the _CLS object. Suravee Suthikulpanit, Lv Zheng.

---
 drivers/acpi/acpica/acinterp.h |    2 +
 drivers/acpi/acpica/acutils.h  |    4 ++
 drivers/acpi/acpica/exutils.c  |   32 ++++++++++++++
 drivers/acpi/acpica/nsxfname.c |   23 ++++++++--
 drivers/acpi/acpica/utids.c    |   91 +++++++++++++++++++++++++++++++++++++++-
 include/acpi/acnames.h         |    1 +
 include/acpi/actypes.h         |   24 +++++++----
 7 files changed, 164 insertions(+), 13 deletions(-)
drivers/acpi/acpica/acinterp.h +2 -0
index 1886bde..7ac9800 100644
@@ -468,6 +468,8 @@ void acpi_ex_eisa_id_to_string(char *dest, u64 compressed_id);
 
 void acpi_ex_integer_to_string(char *dest, u64 value);
 
+void acpi_ex_pci_cls_to_string(char *dest, u8 class_code[3]);
+
 u8 acpi_is_valid_space_id(u8 space_id);
 
 /*
drivers/acpi/acpica/acutils.h +4 -0
index d49f5c7..6391c97 100644
@@ -430,6 +430,10 @@ acpi_status
 acpi_ut_execute_CID(struct acpi_namespace_node *device_node,
 		    struct acpi_pnp_device_id_list ** return_cid_list);
 
+acpi_status
+acpi_ut_execute_CLS(struct acpi_namespace_node *device_node,
+		    struct acpi_pnp_device_id **return_id);
+
 /*
  * utlock - reader/writer locks
  */
drivers/acpi/acpica/exutils.c +32 -0
index 3f4225e..30c3f46 100644
@@ -380,6 +380,38 @@ void acpi_ex_integer_to_string(char *out_string, u64 value)
 
 /*******************************************************************************
  *
+ * FUNCTION:    acpi_ex_pci_cls_to_string
+ *
+ * PARAMETERS:  out_string      - Where to put the converted string (7 bytes)
+ * PARAMETERS:  class_code      - PCI class code to be converted (3 bytes)
+ *
+ * RETURN:      None
+ *
+ * DESCRIPTION: Convert 3-bytes PCI class code to string representation.
+ *              Return buffer must be large enough to hold the string. The
+ *              string returned is always exactly of length
+ *              ACPI_PCICLS_STRING_SIZE (includes null terminator).
+ *
+ ******************************************************************************/
+
+void acpi_ex_pci_cls_to_string(char *out_string, u8 class_code[3])
+{
+
+	ACPI_FUNCTION_ENTRY();
+
+	/* All 3 bytes are hexadecimal */
+
+	out_string[0] = acpi_ut_hex_to_ascii_char((u64)class_code[0], 4);
+	out_string[1] = acpi_ut_hex_to_ascii_char((u64)class_code[0], 0);
+	out_string[2] = acpi_ut_hex_to_ascii_char((u64)class_code[1], 4);
+	out_string[3] = acpi_ut_hex_to_ascii_char((u64)class_code[1], 0);
+	out_string[4] = acpi_ut_hex_to_ascii_char((u64)class_code[2], 4);
+	out_string[5] = acpi_ut_hex_to_ascii_char((u64)class_code[2], 0);
+	out_string[6] = 0;
+}
+
+/*******************************************************************************
+ *
  * FUNCTION:    acpi_is_valid_space_id
  *
  * PARAMETERS:  space_id            - ID to be validated
drivers/acpi/acpica/nsxfname.c +20 -3
index d66c326..dc0836a 100644
@@ -260,7 +260,7 @@ static char *acpi_ns_copy_device_id(struct acpi_pnp_device_id *dest,
  *              control methods (Such as in the case of a device.)
  *
  * For Device and Processor objects, run the Device _HID, _UID, _CID, _SUB,
- * _STA, _ADR, _sx_w, and _sx_d methods.
+ * _CLS, _STA, _ADR, _sx_w, and _sx_d methods.
  *
  * Note: Allocates the return buffer, must be freed by the caller.
  *
@@ -276,11 +276,12 @@ acpi_get_object_info(acpi_handle handle,
 	struct acpi_pnp_device_id *hid = NULL;
 	struct acpi_pnp_device_id *uid = NULL;
 	struct acpi_pnp_device_id *sub = NULL;
+	struct acpi_pnp_device_id *cls = NULL;
 	char *next_id_string;
 	acpi_object_type type;
 	acpi_name name;
 	u8 param_count = 0;
-	u8 valid = 0;
+	u16 valid = 0;
 	u32 info_size;
 	u32 i;
 	acpi_status status;
@@ -320,7 +321,7 @@ acpi_get_object_info(acpi_handle handle,
 	if ((type == ACPI_TYPE_DEVICE) || (type == ACPI_TYPE_PROCESSOR)) {
 		/*
 		 * Get extra info for ACPI Device/Processor objects only:
-		 * Run the Device _HID, _UID, _SUB, and _CID methods.
+		 * Run the Device _HID, _UID, _SUB, _CID, and _CLS methods.
 		 *
 		 * Note: none of these methods are required, so they may or may
 		 * not be present for this device. The Info->Valid bitfield is used
@@ -363,6 +364,14 @@ acpi_get_object_info(acpi_handle handle,
 			     sizeof(struct acpi_pnp_device_id_list));
 			valid |= ACPI_VALID_CID;
 		}
+
+		/* Execute the Device._CLS method */
+
+		status = acpi_ut_execute_CLS(node, &cls);
+		if (ACPI_SUCCESS(status)) {
+			info_size += cls->length;
+			valid |= ACPI_VALID_CLS;
+		}
 	}
 
 	/*
@@ -486,6 +495,11 @@ acpi_get_object_info(acpi_handle handle,
 		}
 	}
 
+	if (cls) {
+		next_id_string = acpi_ns_copy_device_id(&info->class_code,
+							cls, next_id_string);
+	}
+
 	/* Copy the fixed-length data */
 
 	info->info_size = info_size;
@@ -510,6 +524,9 @@ cleanup:
 	if (cid_list) {
 		ACPI_FREE(cid_list);
 	}
+	if (cls) {
+		ACPI_FREE(cls);
+	}
 	return (status);
 }
 
drivers/acpi/acpica/utids.c +90 -1

99 lines not on this page · raw message

include/acpi/acnames.h +1 -0
index 273de70..b52c0dc 100644
@@ -51,6 +51,7 @@
 #define METHOD_NAME__BBN        "_BBN"
 #define METHOD_NAME__CBA        "_CBA"
 #define METHOD_NAME__CID        "_CID"
+#define METHOD_NAME__CLS        "_CLS"
 #define METHOD_NAME__CRS        "_CRS"
 #define METHOD_NAME__DDN        "_DDN"
 #define METHOD_NAME__HID        "_HID"
include/acpi/actypes.h +15 -9
index ff0b53e..d791b98 100644
@@ -1141,6 +1141,10 @@ u32 (*acpi_interface_handler) (acpi_string interface_name, u32 supported);
 
 #define ACPI_UUID_LENGTH                16
 
+/* Length of 3-byte PCI class code values when converted back to a string */
+
+#define ACPI_PCICLS_STRING_SIZE         7	/* Includes null terminator */
+
 /* Structures used for device/processor HID, UID, CID, and SUB */
 
 struct acpi_pnp_device_id {
@@ -1163,7 +1167,7 @@ struct acpi_device_info {
 	u32 name;		/* ACPI object Name */
 	acpi_object_type type;	/* ACPI object Type */
 	u8 param_count;		/* If a method, required parameter count */
-	u8 valid;		/* Indicates which optional fields are valid */
+	u16 valid;		/* Indicates which optional fields are valid */
 	u8 flags;		/* Miscellaneous info */
 	u8 highest_dstates[4];	/* _sx_d values: 0xFF indicates not valid */
 	u8 lowest_dstates[5];	/* _sx_w values: 0xFF indicates not valid */
@@ -1172,6 +1176,7 @@ struct acpi_device_info {
 	struct acpi_pnp_device_id hardware_id;	/* _HID value */
 	struct acpi_pnp_device_id unique_id;	/* _UID value */
 	struct acpi_pnp_device_id subsystem_id;	/* _SUB value */
+	struct acpi_pnp_device_id class_code;	/* _CLS value */
 	struct acpi_pnp_device_id_list compatible_id_list;	/* _CID list <must be last> */
 };
 
@@ -1181,14 +1186,15 @@ struct acpi_device_info {
 
 /* Flags for Valid field above (acpi_get_object_info) */
 
-#define ACPI_VALID_STA                  0x01
-#define ACPI_VALID_ADR                  0x02
-#define ACPI_VALID_HID                  0x04
-#define ACPI_VALID_UID                  0x08
-#define ACPI_VALID_SUB                  0x10
-#define ACPI_VALID_CID                  0x20
-#define ACPI_VALID_SXDS                 0x40
-#define ACPI_VALID_SXWS                 0x80
+#define ACPI_VALID_STA                  0x0001
+#define ACPI_VALID_ADR                  0x0002
+#define ACPI_VALID_HID                  0x0004
+#define ACPI_VALID_UID                  0x0008
+#define ACPI_VALID_SUB                  0x0010
+#define ACPI_VALID_CID                  0x0020
+#define ACPI_VALID_CLS                  0x0040
+#define ACPI_VALID_SXDS                 0x0100
+#define ACPI_VALID_SXWS                 0x0200
 
 /* Flags for _STA return value (current_status above) */
 
Signature · 1 line
1.7.10
author
#71 lore raw

PATCH v2 14/28 ACPICA: ACPI 6.0: Add values for MADT GIC version field.

In reply to Lv Zheng

From: Hanjun Guo <[email protected]>

ACPICA commit 4b100dc43e8baee8c8b4891b23bc7ad03eba6a28

Support for the new version field in the generic distributor subtable. Hanjun Guo <[email protected]>

---
 include/acpi/actbl1.h |   11 +++++++++++
 1 file changed, 11 insertions(+)
include/acpi/actbl1.h +11 -0
index 06b61f0..fcd5709 100644
@@ -835,6 +835,17 @@ struct acpi_madt_generic_distributor {
 	u8 reserved2[3];	/* reserved - must be zero */
 };
 
+/* Values for Version field above */
+
+enum acpi_madt_gic_version {
+	ACPI_MADT_GIC_VERSION_NONE = 0,
+	ACPI_MADT_GIC_VERSION_V1 = 1,
+	ACPI_MADT_GIC_VERSION_V2 = 2,
+	ACPI_MADT_GIC_VERSION_V3 = 3,
+	ACPI_MADT_GIC_VERSION_V4 = 4,
+	ACPI_MADT_GIC_VERSION_RESERVED = 5	/* 5 and greater are reserved */
+};
+
 /* 13: Generic MSI Frame (ACPI 5.1) */
 
 struct acpi_madt_generic_msi_frame {
Signature · 1 line
1.7.10
author
#72 lore raw

PATCH v2 15/28 ACPICA: Namespace: Add support to allow overriding objects.

In reply to Lv Zheng

ACPICA commit 6084e34e44565c6293f446c0202b5e59b055e351

This patch adds an "NamespaceOverride" flag in struct acpi_walk_state, and allows namespace objects to be overridden when this flag is set. Lv Zheng.

---
 drivers/acpi/acpica/acnamesp.h |    1 +
 drivers/acpi/acpica/acstruct.h |    1 +
 drivers/acpi/acpica/dswload.c  |   17 +++++++++++++----
 drivers/acpi/acpica/nsaccess.c |   10 +++++++++-
 drivers/acpi/acpica/nssearch.c |   22 ++++++++++++++++++++--
 5 files changed, 44 insertions(+), 7 deletions(-)
drivers/acpi/acpica/acnamesp.h +1 -0
index 952fbe0..0dd0882 100644
@@ -66,6 +66,7 @@
 #define ACPI_NS_PREFIX_IS_SCOPE     0x10
 #define ACPI_NS_EXTERNAL            0x20
 #define ACPI_NS_TEMPORARY           0x40
+#define ACPI_NS_OVERRIDE_IF_FOUND   0x80
 
 /* Flags for acpi_ns_walk_namespace */
 
drivers/acpi/acpica/acstruct.h +1 -0
index 87c7860..44997ca 100644
@@ -82,6 +82,7 @@ struct acpi_walk_state {
 	u8 return_used;
 	u8 scope_depth;
 	u8 pass_number;		/* Parse pass during table load */
+	u8 namespace_override;	/* Override existing objects */
 	u8 result_size;		/* Total elements for the result stack */
 	u8 result_count;	/* Current number of occupied elements of result stack */
 	u32 aml_offset;
drivers/acpi/acpica/dswload.c +13 -4
index 843942f..845ff44 100644
@@ -315,10 +315,19 @@ acpi_ds_load1_begin_op(struct acpi_walk_state * walk_state,
 		flags = ACPI_NS_NO_UPSEARCH;
 		if ((walk_state->opcode != AML_SCOPE_OP) &&
 		    (!(walk_state->parse_flags & ACPI_PARSE_DEFERRED_OP))) {
-			flags |= ACPI_NS_ERROR_IF_FOUND;
-			ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
-					  "[%s] Cannot already exist\n",
-					  acpi_ut_get_type_name(object_type)));
+			if (walk_state->namespace_override) {
+				flags |= ACPI_NS_OVERRIDE_IF_FOUND;
+				ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
+						  "[%s] Override allowed\n",
+						  acpi_ut_get_type_name
+						  (object_type)));
+			} else {
+				flags |= ACPI_NS_ERROR_IF_FOUND;
+				ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
+						  "[%s] Cannot already exist\n",
+						  acpi_ut_get_type_name
+						  (object_type)));
+			}
 		} else {
 			ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
 					  "[%s] Both Find or Create allowed\n",
drivers/acpi/acpica/nsaccess.c +9 -1
index 24fa19a..19ad0b5 100644
@@ -304,7 +304,9 @@ acpi_ns_lookup(union acpi_generic_state *scope_info,
 		return_ACPI_STATUS(AE_BAD_PARAMETER);
 	}
 
-	local_flags = flags & ~(ACPI_NS_ERROR_IF_FOUND | ACPI_NS_SEARCH_PARENT);
+	local_flags = flags &
+	    ~(ACPI_NS_ERROR_IF_FOUND | ACPI_NS_OVERRIDE_IF_FOUND |
+	      ACPI_NS_SEARCH_PARENT);
 	*return_node = ACPI_ENTRY_NOT_FOUND;
 	acpi_gbl_ns_lookup_count++;
 
@@ -547,6 +549,12 @@ acpi_ns_lookup(union acpi_generic_state *scope_info,
 			if (flags & ACPI_NS_ERROR_IF_FOUND) {
 				local_flags |= ACPI_NS_ERROR_IF_FOUND;
 			}
+
+			/* Set override flag according to caller */
+
+			if (flags & ACPI_NS_OVERRIDE_IF_FOUND) {
+				local_flags |= ACPI_NS_OVERRIDE_IF_FOUND;
+			}
 		}
 
 		/* Extract one ACPI name from the front of the pathname */
drivers/acpi/acpica/nssearch.c +20 -2
index 4a9d4a6..47fbe5b 100644
@@ -325,8 +325,26 @@ acpi_ns_search_and_enter(u32 target_name,
 		 * If we found it AND the request specifies that a find is an error,
 		 * return the error
 		 */
-		if ((status == AE_OK) && (flags & ACPI_NS_ERROR_IF_FOUND)) {
-			status = AE_ALREADY_EXISTS;
+		if (status == AE_OK) {
+
+			/* The node was found in the namespace */
+
+			/*
+			 * If the namespace override feature is enabled for this node,
+			 * delete any existing node. This can only happen during the
+			 * boot stage, thus it is safe to remove the node here.
+			 */
+			if (flags & ACPI_NS_OVERRIDE_IF_FOUND) {
+				acpi_ns_delete_children(*return_node);
+				acpi_ns_remove_node(*return_node);
+				*return_node = ACPI_ENTRY_NOT_FOUND;
+			}
+
+			/* Return an error if we don't expect to find the object */
+
+			else if (flags & ACPI_NS_ERROR_IF_FOUND) {
+				status = AE_ALREADY_EXISTS;
+			}
 		}
 #ifdef ACPI_ASL_COMPILER
 		if (*return_node && (*return_node)->type == ACPI_TYPE_ANY) {
Signature · 1 line
1.7.10
author
#73 lore raw

PATCH v2 16/28 ACPICA: Namespace: Add support of OSDT table.

In reply to Lv Zheng

From: Bob Moore <[email protected]>

ACPICA commit 27415c82fcecf467446f66d1007a0691cc5f3709

This patch adds OSDT (Override System Definition Table) support. When OSDT is loaded, conflict namespace objects will be overridden by the AML interpreter. Bob Moore, Lv Zheng.

---
 drivers/acpi/acpica/nsparse.c  |    7 +++++++
 drivers/acpi/acpica/tbxfload.c |    6 +++++-
 drivers/acpi/acpica/utmisc.c   |    3 ++-
 include/acpi/actbl.h           |    1 +
 4 files changed, 15 insertions(+), 2 deletions(-)
drivers/acpi/acpica/nsparse.c +7 -0
index c95a119..57a4cfe 100644
@@ -117,6 +117,13 @@ acpi_ns_one_complete_parse(u32 pass_number,
 					       (u8) pass_number);
 	}
 
+	/* Found OSDT table, enable the namespace override feature */
+
+	if (ACPI_COMPARE_NAME(table->signature, ACPI_SIG_OSDT) &&
+	    pass_number == ACPI_IMODE_LOAD_PASS1) {
+		walk_state->namespace_override = TRUE;
+	}
+
 	if (ACPI_FAILURE(status)) {
 		acpi_ds_delete_walk_state(walk_state);
 		goto cleanup;
drivers/acpi/acpica/tbxfload.c +5 -1
index b63e35d..960bd99 100644
@@ -173,7 +173,11 @@ static acpi_status acpi_tb_load_namespace(void)
 		     &&
 		     !ACPI_COMPARE_NAME(&
 					(acpi_gbl_root_table_list.tables[i].
-					 signature), ACPI_SIG_PSDT))
+					 signature), ACPI_SIG_PSDT)
+		     &&
+		     !ACPI_COMPARE_NAME(&
+					(acpi_gbl_root_table_list.tables[i].
+					 signature), ACPI_SIG_OSDT))
 		    ||
 		    ACPI_FAILURE(acpi_tb_validate_table
 				 (&acpi_gbl_root_table_list.tables[i]))) {
drivers/acpi/acpica/utmisc.c +2 -1
index cbb7034..28099e2 100644
@@ -97,7 +97,8 @@ u8 acpi_ut_is_aml_table(struct acpi_table_header *table)
 
 	if (ACPI_COMPARE_NAME(table->signature, ACPI_SIG_DSDT) ||
 	    ACPI_COMPARE_NAME(table->signature, ACPI_SIG_PSDT) ||
-	    ACPI_COMPARE_NAME(table->signature, ACPI_SIG_SSDT)) {
+	    ACPI_COMPARE_NAME(table->signature, ACPI_SIG_SSDT) ||
+	    ACPI_COMPARE_NAME(table->signature, ACPI_SIG_OSDT)) {
 		return (TRUE);
 	}
 
include/acpi/actbl.h +1 -0
index cb8a6b9..2d5faf5 100644
@@ -65,6 +65,7 @@
 #define ACPI_SIG_DSDT           "DSDT"	/* Differentiated System Description Table */
 #define ACPI_SIG_FADT           "FACP"	/* Fixed ACPI Description Table */
 #define ACPI_SIG_FACS           "FACS"	/* Firmware ACPI Control Structure */
+#define ACPI_SIG_OSDT           "OSDT"	/* Override System Description Table */
 #define ACPI_SIG_PSDT           "PSDT"	/* Persistent System Description Table */
 #define ACPI_SIG_RSDP           "RSD PTR "	/* Root System Description Pointer */
 #define ACPI_SIG_RSDT           "RSDT"	/* Root System Description Table */
Signature · 1 line
1.7.10
#74 lore raw

Re: [PATCH v2 16/28] ACPICA: Namespace: Add support of OSDT table.

Quoted 73 lines · Lv Zheng

From: Bob Moore <[email protected]>

ACPICA commit 27415c82fcecf467446f66d1007a0691cc5f3709

This patch adds OSDT (Override System Definition Table) support. When OSDT is loaded, conflict namespace objects will be overridden by the AML interpreter. Bob Moore, Lv Zheng.

---
 drivers/acpi/acpica/nsparse.c  |    7 +++++++
 drivers/acpi/acpica/tbxfload.c |    6 +++++-
 drivers/acpi/acpica/utmisc.c   |    3 ++-
 include/acpi/actbl.h           |    1 +
 4 files changed, 15 insertions(+), 2 deletions(-)
drivers/acpi/acpica/nsparse.c +7 -0
index c95a119..57a4cfe 100644
@@ -117,6 +117,13 @@ acpi_ns_one_complete_parse(u32 pass_number,
 					       (u8) pass_number);
 	}
 
+	/* Found OSDT table, enable the namespace override feature */
+
+	if (ACPI_COMPARE_NAME(table->signature, ACPI_SIG_OSDT) &&
+	    pass_number == ACPI_IMODE_LOAD_PASS1) {
+		walk_state->namespace_override = TRUE;
+	}
+
 	if (ACPI_FAILURE(status)) {
 		acpi_ds_delete_walk_state(walk_state);
 		goto cleanup;
drivers/acpi/acpica/tbxfload.c +5 -1
index b63e35d..960bd99 100644
@@ -173,7 +173,11 @@ static acpi_status acpi_tb_load_namespace(void)
 		     &&
 		     !ACPI_COMPARE_NAME(&
 					(acpi_gbl_root_table_list.tables[i].
-					 signature), ACPI_SIG_PSDT))
+					 signature), ACPI_SIG_PSDT)
+		     &&
+		     !ACPI_COMPARE_NAME(&
+					(acpi_gbl_root_table_list.tables[i].
+					 signature), ACPI_SIG_OSDT))
 		    ||
 		    ACPI_FAILURE(acpi_tb_validate_table
 				 (&acpi_gbl_root_table_list.tables[i]))) {
drivers/acpi/acpica/utmisc.c +2 -1
index cbb7034..28099e2 100644
@@ -97,7 +97,8 @@ u8 acpi_ut_is_aml_table(struct acpi_table_header *table)
 
 	if (ACPI_COMPARE_NAME(table->signature, ACPI_SIG_DSDT) ||
 	    ACPI_COMPARE_NAME(table->signature, ACPI_SIG_PSDT) ||
-	    ACPI_COMPARE_NAME(table->signature, ACPI_SIG_SSDT)) {
+	    ACPI_COMPARE_NAME(table->signature, ACPI_SIG_SSDT) ||
+	    ACPI_COMPARE_NAME(table->signature, ACPI_SIG_OSDT)) {
 		return (TRUE);
 	}
 
include/acpi/actbl.h +0 -0
index cb8a6b9..2d5faf5 100644

include/acpi/actbl.h line 71

Quoted 7 lines
include/acpi/actbl.h +1 -0
@@ -65,6 +65,7 @@
 #define ACPI_SIG_DSDT           "DSDT"	/* Differentiated System Description Table */
 #define ACPI_SIG_FADT           "FACP"	/* Fixed ACPI Description Table */
 #define ACPI_SIG_FACS           "FACS"	/* Firmware ACPI Control Structure */
+#define ACPI_SIG_OSDT           "OSDT"	/* Override System Description Table */
 #define ACPI_SIG_PSDT           "PSDT"	/* Persistent System Description Table */
 #define ACPI_SIG_RSDP           "RSD PTR "	/* Root System Description Pointer */
 #define ACPI_SIG_RSDT           "RSDT"	/* Root System Description Table */

I'm a little puzzled by this patch and the previous one (15-16/28). I see no definition for OSDT in the ACPI spec nor at http://uefi.org/acpi. Personally, I like the feature, but I really don't like the idea that I'm now going to have to go dig around to figure out what this table looks like and what its semantics are supposed to be. Without doing that, though, it is impossible for me to tell if these patches are doing the right thing.

So, can I get a URL to the OSDT definition? And if this is going to be part of ACPI, please submit it as a change request to the spec; I sit on the committee but this table hasn't come up at all to date (I just searched the issue data base a few minutes ago to make sure I hadn't missed it somewhere). If OSDT is not going to be part of standard ACPI, why the divergence from the spec?

Signature · 8 lines
ciao,
al
-----------------------------------
Al Stone
Software Engineer
Red Hat, Inc.
[email protected]
-----------------------------------
#75 lore raw

RE: [PATCH v2 16/28] ACPICA: Namespace: Add support of OSDT table.

It is the current plan to add this to the next revision of the ACPI specification.

In the meantime, the OSDT looks exactly like a DSDT or SSDT (hence the "SDT" suffix), with the only difference being the signature "OSDT":

DefinitionBlock ("osdt.aml", "OSDT", 2, "Intel", "Template", 0x00000001) {

The current iASL compiler will emit a template for you if you want:

iasl -T OSDT

We are working on the proposal/ECR for the ACPI spec. Bob

Quoted 124 lines

-----Original Message-----
From: Al Stone [mailto:[email protected]]
Sent: Wednesday, June 24, 2015 12:09 PM
To: Zheng, Lv; Wysocki, Rafael J; Brown, Len
Cc: Lv Zheng; [email protected]; [email protected]; Moore, Robert
Subject: Re: [PATCH v2 16/28] ACPICA: Namespace: Add support of OSDT table.

Quoted 43 lines · Lv Zheng

From: Bob Moore <[email protected]>

ACPICA commit 27415c82fcecf467446f66d1007a0691cc5f3709

This patch adds OSDT (Override System Definition Table) support. When OSDT is loaded, conflict namespace objects will be overridden by the AML interpreter. Bob Moore, Lv Zheng.

---
 drivers/acpi/acpica/nsparse.c  |    7 +++++++
 drivers/acpi/acpica/tbxfload.c |    6 +++++-
 drivers/acpi/acpica/utmisc.c   |    3 ++-
 include/acpi/actbl.h           |    1 +
 4 files changed, 15 insertions(+), 2 deletions(-)
(quoted diff) +0 -0

b/drivers/acpi/acpica/nsparse.c index c95a119..57a4cfe 100644

drivers/acpi/acpica/nsparse.c +7 -0
@@ -117,6 +117,13 @@ acpi_ns_one_complete_parse(u32 pass_number,
 					       (u8) pass_number);
 	}
 
+	/* Found OSDT table, enable the namespace override feature */
+
+	if (ACPI_COMPARE_NAME(table->signature, ACPI_SIG_OSDT) &&
+	    pass_number == ACPI_IMODE_LOAD_PASS1) {
+		walk_state->namespace_override = TRUE;
+	}
+
 	if (ACPI_FAILURE(status)) {
 		acpi_ds_delete_walk_state(walk_state);
 		goto cleanup;
(quoted diff) +0 -0

b/drivers/acpi/acpica/tbxfload.c index b63e35d..960bd99 100644

drivers/acpi/acpica/tbxfload.c +0 -0
@@ -173,7 +173,11 @@ static acpi_status acpi_tb_load_namespace(void)
 		     &&
 		     !ACPI_COMPARE_NAME(&

drivers/acpi/acpica/tbxfload.c static acpi_status acpi_tb_load_namespace(void) · line 183

Quoted 10 lines
drivers/acpi/acpica/tbxfload.c +5 -1
 					(acpi_gbl_root_table_list.tables[i].
-					 signature), ACPI_SIG_PSDT))
+					 signature), ACPI_SIG_PSDT)
+		     &&
+		     !ACPI_COMPARE_NAME(&
+					(acpi_gbl_root_table_list.tables[i].
+					 signature), ACPI_SIG_OSDT))
 		    ||
 		    ACPI_FAILURE(acpi_tb_validate_table
 				 (&acpi_gbl_root_table_list.tables[i]))) { diff --

git

Quoted 20 lines

a/drivers/acpi/acpica/utmisc.c b/drivers/acpi/acpica/utmisc.c index cbb7034..28099e2 100644

drivers/acpi/acpica/utmisc.c +2 -1
@@ -97,7 +97,8 @@ u8 acpi_ut_is_aml_table(struct acpi_table_header
 *table)
 
 	if (ACPI_COMPARE_NAME(table->signature, ACPI_SIG_DSDT) ||
 	    ACPI_COMPARE_NAME(table->signature, ACPI_SIG_PSDT) ||
-	    ACPI_COMPARE_NAME(table->signature, ACPI_SIG_SSDT)) {
+	    ACPI_COMPARE_NAME(table->signature, ACPI_SIG_SSDT) ||
+	    ACPI_COMPARE_NAME(table->signature, ACPI_SIG_OSDT)) {
 		return (TRUE);
 	}
include/acpi/actbl.h index renamed from include/acpi/actbl.h +0 -0

cb8a6b9..2d5faf5 100644

include/acpi/actbl.h line 65

Quoted 1 line
include/acpi/actbl.h +0 -0
@@ -65,6 +65,7 @@
 #define ACPI_SIG_DSDT           "DSDT"	/* Differentiated System

Description Table */

include/acpi/actbl.h line 66

Quoted 1 line
include/acpi/actbl.h +0 -0
 #define ACPI_SIG_FADT           "FACP"	/* Fixed ACPI Description Table

*/

include/acpi/actbl.h line 67

Quoted 1 line
include/acpi/actbl.h +0 -0
 #define ACPI_SIG_FACS           "FACS"	/* Firmware ACPI Control

Structure */

include/acpi/actbl.h line 68

Quoted 1 line
include/acpi/actbl.h +1 -0
+#define ACPI_SIG_OSDT           "OSDT"	/* Override System Description

Table */

include/acpi/actbl.h line 69

Quoted 1 line
include/acpi/actbl.h +0 -0
 #define ACPI_SIG_PSDT           "PSDT"	/* Persistent System Description

Table */

include/acpi/actbl.h line 70

Quoted 1 line
include/acpi/actbl.h +0 -0
 #define ACPI_SIG_RSDP           "RSD PTR "	/* Root System Description

Pointer */

include/acpi/actbl.h line 71

Quoted 1 line
include/acpi/actbl.h +0 -0
 #define ACPI_SIG_RSDT           "RSDT"	/* Root System Description Table

*/

Quoted 1 line

I'm a little puzzled by this patch and the previous one (15-16/28). I see no definition for OSDT in the ACPI spec nor at http://uefi.org/acpi.
Personally, I like the feature, but I really don't like the idea that I'm now going to have to go dig around to figure out what this table looks like and what its semantics are supposed to be. Without doing that, though, it is impossible for me to tell if these patches are doing the right thing.

So, can I get a URL to the OSDT definition? And if this is going to be part of ACPI, please submit it as a change request to the spec; I sit on the committee but this table hasn't come up at all to date (I just searched the issue data base a few minutes ago to make sure I hadn't missed it somewhere). If OSDT is not going to be part of standard ACPI, why the divergence from the spec?

--
ciao,
al
-----------------------------------
Al Stone
Software Engineer
Red Hat, Inc.
[email protected]
-----------------------------------

author
#76 lore raw

PATCH v2 17/28 ACPICA: Namespace: Change namespace override to avoid node deletion.

In reply to Lv Zheng

From: Bob Moore <[email protected]>

ACPICA commit c0ce529e1fbb8ec47d2522a3aa10f3ab77e16e41

There is no reference counting implemented for struct acpi_namespace_node, so it is currently not removable during runtime.
This patch changes the namespace override code to keep the old struct acpi_namespace_node undeleted so that the override mechanism can happen during runtime. Bob Moore.

---
 drivers/acpi/acpica/nssearch.c |   23 +++++++++++++++++++----
 include/acpi/acpixf.h          |    5 +++++
 2 files changed, 24 insertions(+), 4 deletions(-)
drivers/acpi/acpica/nssearch.c +19 -4
index 47fbe5b..d739040 100644
@@ -331,13 +331,28 @@ acpi_ns_search_and_enter(u32 target_name,
 
 			/*
 			 * If the namespace override feature is enabled for this node,
-			 * delete any existing node. This can only happen during the
-			 * boot stage, thus it is safe to remove the node here.
+			 * delete any existing attached sub-object and make the node
+			 * look like a new node that is owned by the override table.
 			 */
 			if (flags & ACPI_NS_OVERRIDE_IF_FOUND) {
+				ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
+						  "Namespace override: %4.4s pass %u type %X Owner %X\n",
+						  ACPI_CAST_PTR(char,
+								&target_name),
+						  interpreter_mode,
+						  (*return_node)->type,
+						  walk_state->owner_id));
+
 				acpi_ns_delete_children(*return_node);
-				acpi_ns_remove_node(*return_node);
-				*return_node = ACPI_ENTRY_NOT_FOUND;
+				if (acpi_gbl_runtime_namespace_override) {
+					acpi_ut_remove_reference((*return_node)->object);
+					(*return_node)->object = NULL;
+					(*return_node)->owner_id =
+					    walk_state->owner_id;
+				} else {
+					acpi_ns_remove_node(*return_node);
+					*return_node = ACPI_ENTRY_NOT_FOUND;
+				}
 			}
 
 			/* Return an error if we don't expect to find the object */
include/acpi/acpixf.h +5 -0
index 00daa3c..33b4675 100644
@@ -229,6 +229,11 @@ ACPI_INIT_GLOBAL(u8, acpi_gbl_disable_auto_repair, FALSE);
 ACPI_INIT_GLOBAL(u8, acpi_gbl_disable_ssdt_table_install, FALSE);
 
 /*
+ * Optionally enable runtime namespace override.
+ */
+ACPI_INIT_GLOBAL(u8, acpi_gbl_runtime_namespace_override, TRUE);
+
+/*
  * We keep track of the latest version of Windows that has been requested by
  * the BIOS. ACPI 5.0.
  */
Signature · 1 line
1.7.10
author
#77 lore raw

PATCH v2 18/28 ACPICA: Update for acpi_install_table memory types.

In reply to Lv Zheng

From: Zhang Rui <[email protected]>

ACPICA commit 3f78b7fb3f98f35d62f532c1891deb748ad196c9

Physical/virtual address flags were reversed.

---
 drivers/acpi/acpica/tbxfload.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/acpi/acpica/tbxfload.c +2 -2
index 960bd99..cf56e18 100644
@@ -224,9 +224,9 @@ acpi_install_table(acpi_physical_address address, u8 physical)
 	ACPI_FUNCTION_TRACE(acpi_install_table);
 
 	if (physical) {
-		flags = ACPI_TABLE_ORIGIN_EXTERNAL_VIRTUAL;
-	} else {
 		flags = ACPI_TABLE_ORIGIN_INTERNAL_PHYSICAL;
+	} else {
+		flags = ACPI_TABLE_ORIGIN_EXTERNAL_VIRTUAL;
 	}
 
 	status = acpi_tb_install_standard_table(address, flags,
Signature · 1 line
1.7.10
author
#78 lore raw

PATCH v2 19/28 ACPICA: Cleanup output for the ASL Debug object.

In reply to Lv Zheng

From: Bob Moore <[email protected]>

ACPICA commit d4a53a396fe5d384425251b0257f8d125bbed617

Especially for use of the Index operator. For buffers and strings, only output the actual byte pointed to by the index. For packages, only print the package element decoded by the index.

---
 drivers/acpi/acpica/acobject.h |    1 +
 drivers/acpi/acpica/exdebug.c  |   42 ++++++++++++++++++++++++++++++++++++++--
 drivers/acpi/acpica/exdump.c   |    9 +++++----
 drivers/acpi/acpica/exoparg2.c |    4 ++++
 4 files changed, 50 insertions(+), 6 deletions(-)
drivers/acpi/acpica/acobject.h +1 -0
index 3e9720e..c81d98d 100644
@@ -335,6 +335,7 @@ struct acpi_object_reference {
 	void *object;		/* name_op=>HANDLE to obj, index_op=>union acpi_operand_object */
 	struct acpi_namespace_node *node;	/* ref_of or Namepath */
 	union acpi_operand_object **where;	/* Target of Index */
+	u8 *index_pointer;	/* Used for Buffers and Strings */
 	u32 value;		/* Used for Local/Arg/Index/ddb_handle */
 };
 
drivers/acpi/acpica/exdebug.c +40 -2

54 lines not on this page · raw message

drivers/acpi/acpica/exdump.c +5 -4
index 1da52be..401e7ed 100644
@@ -224,7 +224,7 @@ static struct acpi_exdump_info acpi_ex_dump_index_field[5] = {
 	{ACPI_EXD_POINTER, ACPI_EXD_OFFSET(index_field.data_obj), "Data Object"}
 };
 
-static struct acpi_exdump_info acpi_ex_dump_reference[8] = {
+static struct acpi_exdump_info acpi_ex_dump_reference[9] = {
 	{ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_reference), NULL},
 	{ACPI_EXD_UINT8, ACPI_EXD_OFFSET(reference.class), "Class"},
 	{ACPI_EXD_UINT8, ACPI_EXD_OFFSET(reference.target_type), "Target Type"},
@@ -232,6 +232,8 @@ static struct acpi_exdump_info acpi_ex_dump_reference[8] = {
 	{ACPI_EXD_POINTER, ACPI_EXD_OFFSET(reference.object), "Object Desc"},
 	{ACPI_EXD_NODE, ACPI_EXD_OFFSET(reference.node), "Node"},
 	{ACPI_EXD_POINTER, ACPI_EXD_OFFSET(reference.where), "Where"},
+	{ACPI_EXD_POINTER, ACPI_EXD_OFFSET(reference.index_pointer),
+	 "Index Pointer"},
 	{ACPI_EXD_REFERENCE, 0, NULL}
 };
 
@@ -1005,14 +1007,13 @@ static void acpi_ex_dump_reference_obj(union acpi_operand_object *obj_desc)
 	} else if (obj_desc->reference.object) {
 		if (ACPI_GET_DESCRIPTOR_TYPE(obj_desc) ==
 		    ACPI_DESC_TYPE_OPERAND) {
-			acpi_os_printf(" Target: %p",
+			acpi_os_printf("%22s %p", "Target :",
 				       obj_desc->reference.object);
 			if (obj_desc->reference.class == ACPI_REFCLASS_TABLE) {
 				acpi_os_printf(" Table Index: %X\n",
 					       obj_desc->reference.value);
 			} else {
-				acpi_os_printf(" Target: %p [%s]\n",
-					       obj_desc->reference.object,
+				acpi_os_printf(" [%s]\n",
 					       acpi_ut_get_type_name(((union
 								       acpi_operand_object
 								       *)
drivers/acpi/acpica/exoparg2.c +4 -0
index fcc618a..6fac5e0 100644
@@ -380,6 +380,8 @@ acpi_status acpi_ex_opcode_2A_1T_1R(struct acpi_walk_state *walk_state)
 
 			return_desc->reference.target_type =
 			    ACPI_TYPE_BUFFER_FIELD;
+			return_desc->reference.index_pointer =
+			    &(operand[0]->buffer.pointer[index]);
 			break;
 
 		case ACPI_TYPE_BUFFER:
@@ -391,6 +393,8 @@ acpi_status acpi_ex_opcode_2A_1T_1R(struct acpi_walk_state *walk_state)
 
 			return_desc->reference.target_type =
 			    ACPI_TYPE_BUFFER_FIELD;
+			return_desc->reference.index_pointer =
+			    &(operand[0]->buffer.pointer[index]);
 			break;
 
 		case ACPI_TYPE_PACKAGE:
Signature · 1 line
1.7.10
author
#79 lore raw

PATCH v2 20/28 ACPICA: acpidump: Allow customized tables to be dumped without accessing /dev/mem.

In reply to Lv Zheng

ACPICA commit ab29013cfa2424140446aff196a70b211ab343a9

The /dev/mem can be configured out, in which case, acpidump should still work with "-c" option as tables can be found in /sys/firmware/acpi/tables. This patch allows acpidump to work without /dev/mem.
This patch has been tested with "acpidump -c" and "acpidump -c -n FADT". And it worked as expected. Lv Zheng.

---
 .../acpi/os_specific/service_layers/oslinuxtbl.c   |   89 ++++++++++----------
 1 file changed, 46 insertions(+), 43 deletions(-)
tools/power/acpi/os_specific/service_layers/oslinuxtbl.c +46 -43
index db15c9d..3aff9a2 100644
@@ -582,64 +582,67 @@ static acpi_status osl_table_initialize(void)
 		return (AE_OK);
 	}
 
-	/* Get RSDP from memory */
+	if (!gbl_dump_customized_tables) {
 
-	status = osl_load_rsdp();
-	if (ACPI_FAILURE(status)) {
-		return (status);
-	}
+		/* Get RSDP from memory */
+
+		status = osl_load_rsdp();
+		if (ACPI_FAILURE(status)) {
+			return (status);
+		}
 
-	/* Get XSDT from memory */
+		/* Get XSDT from memory */
 
-	if (gbl_rsdp.revision && !gbl_do_not_dump_xsdt) {
-		if (gbl_xsdt) {
-			free(gbl_xsdt);
-			gbl_xsdt = NULL;
+		if (gbl_rsdp.revision && !gbl_do_not_dump_xsdt) {
+			if (gbl_xsdt) {
+				free(gbl_xsdt);
+				gbl_xsdt = NULL;
+			}
+
+			gbl_revision = 2;
+			status = osl_get_bios_table(ACPI_SIG_XSDT, 0,
+						    ACPI_CAST_PTR(struct
+								  acpi_table_header
+								  *, &gbl_xsdt),
+						    &address);
+			if (ACPI_FAILURE(status)) {
+				return (status);
+			}
 		}
 
-		gbl_revision = 2;
-		status = osl_get_bios_table(ACPI_SIG_XSDT, 0,
-					    ACPI_CAST_PTR(struct
-							  acpi_table_header *,
-							  &gbl_xsdt), &address);
-		if (ACPI_FAILURE(status)) {
-			return (status);
+		/* Get RSDT from memory */
+
+		if (gbl_rsdp.rsdt_physical_address) {
+			if (gbl_rsdt) {
+				free(gbl_rsdt);
+				gbl_rsdt = NULL;
+			}
+
+			status = osl_get_bios_table(ACPI_SIG_RSDT, 0,
+						    ACPI_CAST_PTR(struct
+								  acpi_table_header
+								  *, &gbl_rsdt),
+						    &address);
+			if (ACPI_FAILURE(status)) {
+				return (status);
+			}
 		}
-	}
 
-	/* Get RSDT from memory */
+		/* Get FADT from memory */
 
-	if (gbl_rsdp.rsdt_physical_address) {
-		if (gbl_rsdt) {
-			free(gbl_rsdt);
-			gbl_rsdt = NULL;
+		if (gbl_fadt) {
+			free(gbl_fadt);
+			gbl_fadt = NULL;
 		}
 
-		status = osl_get_bios_table(ACPI_SIG_RSDT, 0,
+		status = osl_get_bios_table(ACPI_SIG_FADT, 0,
 					    ACPI_CAST_PTR(struct
 							  acpi_table_header *,
-							  &gbl_rsdt), &address);
+							  &gbl_fadt),
+					    &gbl_fadt_address);
 		if (ACPI_FAILURE(status)) {
 			return (status);
 		}
-	}
-
-	/* Get FADT from memory */
-
-	if (gbl_fadt) {
-		free(gbl_fadt);
-		gbl_fadt = NULL;
-	}
-
-	status = osl_get_bios_table(ACPI_SIG_FADT, 0,
-				    ACPI_CAST_PTR(struct acpi_table_header *,
-						  &gbl_fadt),
-				    &gbl_fadt_address);
-	if (ACPI_FAILURE(status)) {
-		return (status);
-	}
-
-	if (!gbl_dump_customized_tables) {
 
 		/* Add mandatory tables to global table list first */
 
Signature · 1 line
1.7.10
author
#80 lore raw

PATCH v2 21/28 ACPICA: acpidump: Convert the default behavior to dump from /sys/firmware/acpi/tables.

In reply to Lv Zheng

ACPICA commit 04c3bd7e9d6aeb2b3edebe99c90dc271ae4e6353

In order to work without any additional option to dump tables when /dev/mem doesn't exist, this patch switches the default behavior of acpidump to dump from /sys/firmware/acpi/tables. Reported by Al Stone, Fixed by Lv Zheng.

---
 tools/power/acpi/tools/acpidump/acpidump.h |    2 +-
 tools/power/acpi/tools/acpidump/apmain.c   |   15 ++++++++++++---
 2 files changed, 13 insertions(+), 4 deletions(-)
tools/power/acpi/tools/acpidump/acpidump.h +1 -1
index 84bdef0..eed5344 100644
@@ -66,7 +66,7 @@
 EXTERN u8 INIT_GLOBAL(gbl_summary_mode, FALSE);
 EXTERN u8 INIT_GLOBAL(gbl_verbose_mode, FALSE);
 EXTERN u8 INIT_GLOBAL(gbl_binary_mode, FALSE);
-EXTERN u8 INIT_GLOBAL(gbl_dump_customized_tables, FALSE);
+EXTERN u8 INIT_GLOBAL(gbl_dump_customized_tables, TRUE);
 EXTERN u8 INIT_GLOBAL(gbl_do_not_dump_xsdt, FALSE);
 EXTERN ACPI_FILE INIT_GLOBAL(gbl_output_file, NULL);
 EXTERN char INIT_GLOBAL(*gbl_output_filename, NULL);
tools/power/acpi/tools/acpidump/apmain.c +12 -3
index d0ba653..57620f6 100644
@@ -80,7 +80,7 @@ struct ap_dump_action action_table[AP_MAX_ACTIONS];
 u32 current_action = 0;
 
 #define AP_UTILITY_NAME             "ACPI Binary Table Dump Utility"
-#define AP_SUPPORTED_OPTIONS        "?a:bcf:hn:o:r:svxz"
+#define AP_SUPPORTED_OPTIONS        "?a:bc:f:hn:o:r:svxz"
 
 /******************************************************************************
  *
@@ -96,7 +96,6 @@ static void ap_display_usage(void)
 	ACPI_USAGE_HEADER("acpidump [options]");
 
 	ACPI_OPTION("-b", "Dump tables to binary files");
-	ACPI_OPTION("-c", "Dump customized tables");
 	ACPI_OPTION("-h -?", "This help message");
 	ACPI_OPTION("-o <File>", "Redirect output to file");
 	ACPI_OPTION("-r <Address>", "Dump tables from specified RSDP");
@@ -107,6 +106,7 @@ static void ap_display_usage(void)
 	ACPI_USAGE_TEXT("\nTable Options:\n");
 
 	ACPI_OPTION("-a <Address>", "Get table via a physical address");
+	ACPI_OPTION("-c <on|off>", "Turning on/off customized table dumping");
 	ACPI_OPTION("-f <BinaryFile>", "Get table via a binary file");
 	ACPI_OPTION("-n <Signature>", "Get table via a name/signature");
 	ACPI_OPTION("-x", "Do not use but dump XSDT");
@@ -181,7 +181,16 @@ static int ap_do_options(int argc, char **argv)
 
 		case 'c':	/* Dump customized tables */
 
-			gbl_dump_customized_tables = TRUE;
+			if (!strcmp(acpi_gbl_optarg, "on")) {
+				gbl_dump_customized_tables = TRUE;
+			} else if (!strcmp(acpi_gbl_optarg, "off")) {
+				gbl_dump_customized_tables = FALSE;
+			} else {
+				acpi_log_error
+				    ("%s: Cannot handle this switch, please use on|off\n",
+				     acpi_gbl_optarg);
+				return (-1);
+			}
 			continue;
 
 		case 'h':
Signature · 1 line
1.7.10
author
#81 lore raw

PATCH v2 22/28 ACPI / acpidump: Update acpidump manual.

In reply to Lv Zheng

This patch updates acpidump manual according to the recent changes.

---
 tools/power/acpi/man/acpidump.8 |   17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)
tools/power/acpi/man/acpidump.8 +12 -5
index 38f095d..79e2d1d 100644
@@ -22,9 +22,6 @@ acpidump options are as follow:
 .B \-b
 Dump tables to binary files
 .TP
-.B \-c
-Dump customized tables
-.TP
 .B \-h \-?
 This help message
 .TP
@@ -48,15 +45,25 @@ Verbose mode
 .B \-a <Address>
 Get table via a physical address
 .TP
+.B \-c <on|off>
+Turning on/off customized table dumping
+.TP
 .B \-f <BinaryFile>
 Get table via a binary file
 .TP
 .B \-n <Signature>
 Get table via a name/signature
 .TP
-Invocation without parameters dumps all available tables
+.B \-x
+Do not use but dump XSDT
+.TP
+.B \-x \-x
+Do not use or dump XSDT
+.TP
+.fi
+Invocation without parameters dumps all available tables.
 .TP
-Multiple mixed instances of -a, -f, and -n are supported
+Multiple mixed instances of -a, -f, and -n are supported.
 
 .SH EXAMPLES
 
Signature · 1 line
1.7.10
author
#82 lore raw

PATCH v2 23/28 ACPICA: De-macroize calls to standard C library functions.

In reply to Lv Zheng

From: Bob Moore <[email protected]>

ACPICA commit 3b1026e0bdd3c32eb6d5d313f3ba0b1fee7597b4 ACPICA commit 00f0dc83f5cfca53b27a3213ae0d7719b88c2d6b ACPICA commit 47d22a738d0e19fd241ffe4e3e9d4e198e4afc69

Across all of ACPICA. Replace C library macros such as ACPI_STRLEN with the standard names such as strlen. The original purpose for these macros is long since obsolete.
Also cast various invocations as necessary. Bob Moore, Jung-uk Kim, Lv Zheng.

---
 drivers/acpi/acpica/acutils.h                      |   46 +++++++++--------
 drivers/acpi/acpica/dsfield.c                      |    2 +-
 drivers/acpi/acpica/dsinit.c                       |    2 +-
 drivers/acpi/acpica/dsobject.c                     |    7 ++-
 drivers/acpi/acpica/dsutils.c                      |    4 +-
 drivers/acpi/acpica/evgpeinit.c                    |    2 +-
 drivers/acpi/acpica/exconfig.c                     |    2 +-
 drivers/acpi/acpica/exconvrt.c                     |    9 ++--
 drivers/acpi/acpica/exfield.c                      |    2 +-
 drivers/acpi/acpica/exfldio.c                      |   52 ++++++++++----------
 drivers/acpi/acpica/exmisc.c                       |   36 +++++++-------
 drivers/acpi/acpica/exnames.c                      |    2 +-
 drivers/acpi/acpica/exoparg2.c                     |    4 +-
 drivers/acpi/acpica/exoparg3.c                     |    4 +-
 drivers/acpi/acpica/exregion.c                     |    9 ++--
 drivers/acpi/acpica/exstorob.c                     |   18 +++----
 drivers/acpi/acpica/nsaccess.c                     |    6 +--
 drivers/acpi/acpica/nsconvert.c                    |   10 ++--
 drivers/acpi/acpica/nsdump.c                       |    2 +-
 drivers/acpi/acpica/nseval.c                       |    2 +-
 drivers/acpi/acpica/nsinit.c                       |    4 +-
 drivers/acpi/acpica/nsrepair2.c                    |    2 +-
 drivers/acpi/acpica/nsutils.c                      |    3 +-
 drivers/acpi/acpica/nsxfeval.c                     |    5 +-
 drivers/acpi/acpica/nsxfname.c                     |    6 +--
 drivers/acpi/acpica/psutils.c                      |    7 ++-
 drivers/acpi/acpica/rscreate.c                     |    6 +--
 drivers/acpi/acpica/rsmisc.c                       |    8 +--
 drivers/acpi/acpica/rsutils.c                      |   11 ++---
 drivers/acpi/acpica/rsxface.c                      |    8 +--
 drivers/acpi/acpica/tbdata.c                       |    8 +--
 drivers/acpi/acpica/tbfadt.c                       |    6 +--
 drivers/acpi/acpica/tbfind.c                       |   21 ++++----
 drivers/acpi/acpica/tbinstal.c                     |    7 ++-
 drivers/acpi/acpica/tbprint.c                      |   10 ++--
 drivers/acpi/acpica/tbutils.c                      |    2 +-
 drivers/acpi/acpica/tbxface.c                      |   16 +++---
 drivers/acpi/acpica/tbxfload.c                     |    4 +-
 drivers/acpi/acpica/utalloc.c                      |    6 +--
 drivers/acpi/acpica/utbuffer.c                     |    4 +-
 drivers/acpi/acpica/utcache.c                      |    6 +--
 drivers/acpi/acpica/utcopy.c                       |   42 ++++++++--------
 drivers/acpi/acpica/utids.c                        |    9 ++--
 drivers/acpi/acpica/utmisc.c                       |    6 +--
 drivers/acpi/acpica/utosi.c                        |    9 ++--
 drivers/acpi/acpica/utpredef.c                     |    4 +-
 drivers/acpi/acpica/utprint.c                      |    6 +--
 drivers/acpi/acpica/utstring.c                     |   33 ++++++-------
 drivers/acpi/acpica/uttrack.c                      |    8 +--
 drivers/acpi/acpica/utxface.c                      |    8 +--
 include/acpi/actypes.h                             |    8 +--
 include/acpi/platform/acenv.h                      |   38 --------------
 tools/power/acpi/common/getopt.c                   |    4 +-
 .../acpi/os_specific/service_layers/oslinuxtbl.c   |    6 +--
 tools/power/acpi/tools/acpidump/apdump.c           |    8 +--
 tools/power/acpi/tools/acpidump/apfiles.c          |   12 ++---
 56 files changed, 260 insertions(+), 312 deletions(-)
drivers/acpi/acpica/acutils.h +22 -24
index 6391c97..ef1e51d 100644
@@ -210,37 +210,35 @@ void acpi_ut_subsystem_shutdown(void);
  */
 #ifndef ACPI_USE_SYSTEM_CLIBRARY
 
-acpi_size acpi_ut_strlen(const char *string);
+acpi_size strlen(const char *string);
 
-char *acpi_ut_strchr(const char *string, int ch);
+char *strchr(const char *string, int ch);
 
-char *acpi_ut_strcpy(char *dst_string, const char *src_string);
+char *strcpy(char *dst_string, const char *src_string);
 
-char *acpi_ut_strncpy(char *dst_string,
-		      const char *src_string, acpi_size count);
+char *strncpy(char *dst_string, const char *src_string, acpi_size count);
 
-int acpi_ut_memcmp(const char *buffer1, const char *buffer2, acpi_size count);
+int strncmp(const char *string1, const char *string2, acpi_size count);
 
-int acpi_ut_strncmp(const char *string1, const char *string2, acpi_size count);
+int strcmp(const char *string1, const char *string2);
 
-int acpi_ut_strcmp(const char *string1, const char *string2);
+char *strcat(char *dst_string, const char *src_string);
 
-char *acpi_ut_strcat(char *dst_string, const char *src_string);
+char *strncat(char *dst_string, const char *src_string, acpi_size count);
 
-char *acpi_ut_strncat(char *dst_string,
-		      const char *src_string, acpi_size count);
+u32 strtoul(const char *string, char **terminator, u32 base);
 
-u32 acpi_ut_strtoul(const char *string, char **terminator, u32 base);
+char *strstr(char *string1, char *string2);
 
-char *acpi_ut_strstr(char *string1, char *string2);
+int memcmp(void *buffer1, void *buffer2, acpi_size count);
 
-void *acpi_ut_memcpy(void *dest, const void *src, acpi_size count);
+void *memcpy(void *dest, const void *src, acpi_size count);
 
-void *acpi_ut_memset(void *dest, u8 value, acpi_size count);
+void *memset(void *dest, int value, acpi_size count);
 
-int acpi_ut_to_upper(int c);
+int toupper(int c);
 
-int acpi_ut_to_lower(int c);
+int tolower(int c);
 
 extern const u8 _acpi_ctype[];
 
@@ -255,13 +253,13 @@ extern const u8 _acpi_ctype[];
 #define _ACPI_UP     0x01	/* 'A'-'Z' */
 #define _ACPI_XD     0x80	/* '0'-'9', 'A'-'F', 'a'-'f' */
 
-#define ACPI_IS_DIGIT(c)  (_acpi_ctype[(unsigned char)(c)] & (_ACPI_DI))
-#define ACPI_IS_SPACE(c)  (_acpi_ctype[(unsigned char)(c)] & (_ACPI_SP))
-#define ACPI_IS_XDIGIT(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_XD))
-#define ACPI_IS_UPPER(c)  (_acpi_ctype[(unsigned char)(c)] & (_ACPI_UP))
-#define ACPI_IS_LOWER(c)  (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO))
-#define ACPI_IS_PRINT(c)  (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO | _ACPI_UP | _ACPI_DI | _ACPI_XS | _ACPI_PU))
-#define ACPI_IS_ALPHA(c)  (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO | _ACPI_UP))
+#define isdigit(c)  (_acpi_ctype[(unsigned char)(c)] & (_ACPI_DI))
+#define isspace(c)  (_acpi_ctype[(unsigned char)(c)] & (_ACPI_SP))
+#define isxdigit(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_XD))
+#define isupper(c)  (_acpi_ctype[(unsigned char)(c)] & (_ACPI_UP))
+#define islower(c)  (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO))
+#define isprint(c)  (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO | _ACPI_UP | _ACPI_DI | _ACPI_XS | _ACPI_PU))
+#define isalpha(c)  (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO | _ACPI_UP))
 
 #endif				/* !ACPI_USE_SYSTEM_CLIBRARY */
 
drivers/acpi/acpica/dsfield.c +1 -1
index 43b40de..20de148 100644
@@ -502,7 +502,7 @@ acpi_ds_create_field(union acpi_parse_object *op,
 		}
 	}
 
-	ACPI_MEMSET(&info, 0, sizeof(struct acpi_create_field_info));
+	memset(&info, 0, sizeof(struct acpi_create_field_info));
 
 	/* Second arg is the field flags */
 
drivers/acpi/acpica/dsinit.c +1 -1
index bbe74bc..95779e8 100644
@@ -207,7 +207,7 @@ acpi_ds_initialize_objects(u32 table_index,
 
 	/* Set all init info to zero */
 
-	ACPI_MEMSET(&info, 0, sizeof(struct acpi_init_walk_info));
+	memset(&info, 0, sizeof(struct acpi_init_walk_info));
 
 	info.owner_id = owner_id;
 	info.table_index = table_index;
drivers/acpi/acpica/dsobject.c +3 -4
index 4a4b2f3..2beb7fd 100644
@@ -339,8 +339,8 @@ acpi_ds_build_internal_buffer_obj(struct acpi_walk_state *walk_state,
 		/* Initialize buffer from the byte_list (if present) */
 
 		if (byte_list) {
-			ACPI_MEMCPY(obj_desc->buffer.pointer,
-				    byte_list->named.data, byte_list_length);
+			memcpy(obj_desc->buffer.pointer, byte_list->named.data,
+			       byte_list_length);
 		}
 	}
 
@@ -750,8 +750,7 @@ acpi_ds_init_object_from_op(struct acpi_walk_state *walk_state,
 	case ACPI_TYPE_STRING:
 
 		obj_desc->string.pointer = op->common.value.string;
-		obj_desc->string.length =
-		    (u32)ACPI_STRLEN(op->common.value.string);
+		obj_desc->string.length = (u32)strlen(op->common.value.string);
 
 		/*
 		 * The string is contained in the ACPI table, don't ever try
drivers/acpi/acpica/dsutils.c +2 -2
index deeddd6..ebc577b 100644
@@ -572,8 +572,8 @@ acpi_ds_create_operand(struct acpi_walk_state *walk_state,
 					obj_desc =
 					    acpi_ut_create_string_object((acpi_size) name_length);
 
-					ACPI_STRNCPY(obj_desc->string.pointer,
-						     name_string, name_length);
+					strncpy(obj_desc->string.pointer,
+						name_string, name_length);
 					status = AE_OK;
 				} else {
 					/*
drivers/acpi/acpica/evgpeinit.c +1 -1
index 8840296..ea4c0d3 100644
@@ -377,7 +377,7 @@ acpi_ev_match_gpe_method(acpi_handle obj_handle,
 
 	/* 4) The last two characters of the name are the hex GPE Number */
 
-	gpe_number = ACPI_STRTOUL(&name[2], NULL, 16);
+	gpe_number = strtoul(&name[2], NULL, 16);
 	if (gpe_number == ACPI_UINT32_MAX) {
 
 		/* Conversion failed; invalid method, just ignore it */
drivers/acpi/acpica/exconfig.c +1 -1
index 6e0df2b..24a4c5c 100644
@@ -470,7 +470,7 @@ acpi_ex_load_op(union acpi_operand_object *obj_desc,
 			return_ACPI_STATUS(AE_NO_MEMORY);
 		}
 
-		ACPI_MEMCPY(table, table_header, length);
+		memcpy(table, table_header, length);
 		break;
 
 	default:
drivers/acpi/acpica/exconvrt.c +4 -5
index 89a976b..075d654 100644
@@ -227,9 +227,8 @@ acpi_ex_convert_to_buffer(union acpi_operand_object *obj_desc,
 		/* Copy the integer to the buffer, LSB first */
 
 		new_buf = return_desc->buffer.pointer;
-		ACPI_MEMCPY(new_buf,
-			    &obj_desc->integer.value,
-			    acpi_gbl_integer_byte_width);
+		memcpy(new_buf,
+		       &obj_desc->integer.value, acpi_gbl_integer_byte_width);
 		break;
 
 	case ACPI_TYPE_STRING:
@@ -252,8 +251,8 @@ acpi_ex_convert_to_buffer(union acpi_operand_object *obj_desc,
 		/* Copy the string to the buffer */
 
 		new_buf = return_desc->buffer.pointer;
-		ACPI_STRNCPY((char *)new_buf, (char *)obj_desc->string.pointer,
-			     obj_desc->string.length);
+		strncpy((char *)new_buf, (char *)obj_desc->string.pointer,
+			obj_desc->string.length);
 		break;
 
 	default:
drivers/acpi/acpica/exfield.c +1 -1
index c161dd9..61fd9c7 100644
@@ -428,7 +428,7 @@ acpi_ex_write_data_to_field(union acpi_operand_object *source_desc,
 		}
 
 		buffer = buffer_desc->buffer.pointer;
-		ACPI_MEMCPY(buffer, source_desc->buffer.pointer, length);
+		memcpy(buffer, source_desc->buffer.pointer, length);
 
 		/* Lock entire transaction if requested */
 
drivers/acpi/acpica/exfldio.c +26 -26

105 lines not on this page · raw message

drivers/acpi/acpica/exmisc.c +18 -18
index b56fc9d..d02afec 100644
@@ -209,8 +209,8 @@ acpi_ex_concat_template(union acpi_operand_object *operand0,
 	 * end_tag descriptor is copied from Operand1.
 	 */
 	new_buf = return_desc->buffer.pointer;
-	ACPI_MEMCPY(new_buf, operand0->buffer.pointer, length0);
-	ACPI_MEMCPY(new_buf + length0, operand1->buffer.pointer, length1);
+	memcpy(new_buf, operand0->buffer.pointer, length0);
+	memcpy(new_buf + length0, operand1->buffer.pointer, length1);
 
 	/* Insert end_tag and set the checksum to zero, means "ignore checksum" */
 
@@ -318,14 +318,14 @@ acpi_ex_do_concatenate(union acpi_operand_object *operand0,
 
 		/* Copy the first integer, LSB first */
 
-		ACPI_MEMCPY(new_buf, &operand0->integer.value,
-			    acpi_gbl_integer_byte_width);
+		memcpy(new_buf, &operand0->integer.value,
+		       acpi_gbl_integer_byte_width);
 
 		/* Copy the second integer (LSB first) after the first */
 
-		ACPI_MEMCPY(new_buf + acpi_gbl_integer_byte_width,
-			    &local_operand1->integer.value,
-			    acpi_gbl_integer_byte_width);
+		memcpy(new_buf + acpi_gbl_integer_byte_width,
+		       &local_operand1->integer.value,
+		       acpi_gbl_integer_byte_width);
 		break;
 
 	case ACPI_TYPE_STRING:
@@ -346,9 +346,9 @@ acpi_ex_do_concatenate(union acpi_operand_object *operand0,
 
 		/* Concatenate the strings */
 
-		ACPI_STRCPY(new_buf, operand0->string.pointer);
-		ACPI_STRCPY(new_buf + operand0->string.length,
-			    local_operand1->string.pointer);
+		strcpy(new_buf, operand0->string.pointer);
+		strcpy(new_buf + operand0->string.length,
+		       local_operand1->string.pointer);
 		break;
 
 	case ACPI_TYPE_BUFFER:
@@ -369,11 +369,11 @@ acpi_ex_do_concatenate(union acpi_operand_object *operand0,
 
 		/* Concatenate the buffers */
 
-		ACPI_MEMCPY(new_buf, operand0->buffer.pointer,
-			    operand0->buffer.length);
-		ACPI_MEMCPY(new_buf + operand0->buffer.length,
-			    local_operand1->buffer.pointer,
-			    local_operand1->buffer.length);
+		memcpy(new_buf, operand0->buffer.pointer,
+		       operand0->buffer.length);
+		memcpy(new_buf + operand0->buffer.length,
+		       local_operand1->buffer.pointer,
+		       local_operand1->buffer.length);
 		break;
 
 	default:
@@ -660,9 +660,9 @@ acpi_ex_do_logical_op(u16 opcode,
 
 		/* Lexicographic compare: compare the data bytes */
 
-		compare = ACPI_MEMCMP(operand0->buffer.pointer,
-				      local_operand1->buffer.pointer,
-				      (length0 > length1) ? length1 : length0);
+		compare = memcmp(operand0->buffer.pointer,
+				 local_operand1->buffer.pointer,
+				 (length0 > length1) ? length1 : length0);
 
 		switch (opcode) {
 		case AML_LEQUAL_OP:	/* LEqual (Operand0, Operand1) */
drivers/acpi/acpica/exnames.c +1 -1
index 453b00c..20e8781 100644
@@ -192,7 +192,7 @@ static acpi_status acpi_ex_name_segment(u8 ** in_aml_address, char *name_string)
 		char_buf[4] = '\0';
 
 		if (name_string) {
-			ACPI_STRCAT(name_string, char_buf);
+			strcat(name_string, char_buf);
 			ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
 					  "Appended to - %s\n", name_string));
 		} else {
drivers/acpi/acpica/exoparg2.c +2 -2
index 6fac5e0..b8944eb 100644
@@ -337,8 +337,8 @@ acpi_status acpi_ex_opcode_2A_1T_1R(struct acpi_walk_state *walk_state)
 		 * Copy the raw buffer data with no transform.
 		 * (NULL terminated already)
 		 */
-		ACPI_MEMCPY(return_desc->string.pointer,
-			    operand[0]->buffer.pointer, length);
+		memcpy(return_desc->string.pointer,
+		       operand[0]->buffer.pointer, length);
 		break;
 
 	case AML_CONCAT_RES_OP:
drivers/acpi/acpica/exoparg3.c +2 -2
index 1c64a98..fa100b3 100644
@@ -237,8 +237,8 @@ acpi_status acpi_ex_opcode_3A_1T_1R(struct acpi_walk_state *walk_state)
 
 			/* We have a buffer, copy the portion requested */
 
-			ACPI_MEMCPY(buffer, operand[0]->string.pointer + index,
-				    length);
+			memcpy(buffer, operand[0]->string.pointer + index,
+			       length);
 		}
 
 		/* Set the length of the new String/Buffer */
drivers/acpi/acpica/exregion.c +4 -5
index f6c2f54..b4a5e44 100644
@@ -517,15 +517,14 @@ acpi_ex_data_table_space_handler(u32 function,
 	switch (function) {
 	case ACPI_READ:
 
-		ACPI_MEMCPY(ACPI_CAST_PTR(char, value),
-			    ACPI_PHYSADDR_TO_PTR(address),
-			    ACPI_DIV_8(bit_width));
+		memcpy(ACPI_CAST_PTR(char, value),
+		       ACPI_PHYSADDR_TO_PTR(address), ACPI_DIV_8(bit_width));
 		break;
 
 	case ACPI_WRITE:
 
-		ACPI_MEMCPY(ACPI_PHYSADDR_TO_PTR(address),
-			    ACPI_CAST_PTR(char, value), ACPI_DIV_8(bit_width));
+		memcpy(ACPI_PHYSADDR_TO_PTR(address),
+		       ACPI_CAST_PTR(char, value), ACPI_DIV_8(bit_width));
 		break;
 
 	default:
drivers/acpi/acpica/exstorob.c +9 -9
index 6fa3c8d..e1d4f4d 100644
@@ -100,9 +100,9 @@ acpi_ex_store_buffer_to_buffer(union acpi_operand_object *source_desc,
 
 		/* Clear existing buffer and copy in the new one */
 
-		ACPI_MEMSET(target_desc->buffer.pointer, 0,
-			    target_desc->buffer.length);
-		ACPI_MEMCPY(target_desc->buffer.pointer, buffer, length);
+		memset(target_desc->buffer.pointer, 0,
+		       target_desc->buffer.length);
+		memcpy(target_desc->buffer.pointer, buffer, length);
 
 #ifdef ACPI_OBSOLETE_BEHAVIOR
 		/*
@@ -129,8 +129,8 @@ acpi_ex_store_buffer_to_buffer(union acpi_operand_object *source_desc,
 	} else {
 		/* Truncate the source, copy only what will fit */
 
-		ACPI_MEMCPY(target_desc->buffer.pointer, buffer,
-			    target_desc->buffer.length);
+		memcpy(target_desc->buffer.pointer, buffer,
+		       target_desc->buffer.length);
 
 		ACPI_DEBUG_PRINT((ACPI_DB_INFO,
 				  "Truncating source buffer from %X to %X\n",
@@ -187,9 +187,9 @@ acpi_ex_store_string_to_string(union acpi_operand_object *source_desc,
 		 * String will fit in existing non-static buffer.
 		 * Clear old string and copy in the new one
 		 */
-		ACPI_MEMSET(target_desc->string.pointer, 0,
-			    (acpi_size) target_desc->string.length + 1);
-		ACPI_MEMCPY(target_desc->string.pointer, buffer, length);
+		memset(target_desc->string.pointer, 0,
+		       (acpi_size) target_desc->string.length + 1);
+		memcpy(target_desc->string.pointer, buffer, length);
 	} else {
 		/*
 		 * Free the current buffer, then allocate a new buffer
@@ -210,7 +210,7 @@ acpi_ex_store_string_to_string(union acpi_operand_object *source_desc,
 		}
 
 		target_desc->common.flags &= ~AOPOBJ_STATIC_POINTER;
-		ACPI_MEMCPY(target_desc->string.pointer, buffer, length);
+		memcpy(target_desc->string.pointer, buffer, length);
 	}
 
 	/* Set the new target length */
drivers/acpi/acpica/nsaccess.c +3 -3
index 19ad0b5..c687b99 100644
@@ -102,7 +102,7 @@ acpi_status acpi_ns_root_initialize(void)
 
 		/* _OSI is optional for now, will be permanent later */
 
-		if (!ACPI_STRCMP(init_val->name, "_OSI")
+		if (!strcmp(init_val->name, "_OSI")
 		    && !acpi_gbl_create_osi_method) {
 			continue;
 		}
@@ -180,7 +180,7 @@ acpi_status acpi_ns_root_initialize(void)
 
 				/* Build an object around the static string */
 
-				obj_desc->string.length = (u32)ACPI_STRLEN(val);
+				obj_desc->string.length = (u32)strlen(val);
 				obj_desc->string.pointer = val;
 				obj_desc->common.flags |= AOPOBJ_STATIC_POINTER;
 				break;
@@ -203,7 +203,7 @@ acpi_status acpi_ns_root_initialize(void)
 
 				/* Special case for ACPI Global Lock */
 
-				if (ACPI_STRCMP(init_val->name, "_GL_") == 0) {
+				if (strcmp(init_val->name, "_GL_") == 0) {
 					acpi_gbl_global_lock_mutex = obj_desc;
 
 					/* Create additional counting semaphore for global lock */
drivers/acpi/acpica/nsconvert.c +5 -5
index 1a8b39c..da55a1c 100644
@@ -187,8 +187,8 @@ acpi_ns_convert_to_string(union acpi_operand_object *original_object,
 		 * Copy the raw buffer data with no transform. String is already NULL
 		 * terminated at Length+1.
 		 */
-		ACPI_MEMCPY(new_object->string.pointer,
-			    original_object->buffer.pointer, length);
+		memcpy(new_object->string.pointer,
+		       original_object->buffer.pointer, length);
 		break;
 
 	default:
@@ -251,9 +251,9 @@ acpi_ns_convert_to_buffer(union acpi_operand_object *original_object,
 			return (AE_NO_MEMORY);
 		}
 
-		ACPI_MEMCPY(new_object->buffer.pointer,
-			    original_object->string.pointer,
-			    original_object->string.length);
+		memcpy(new_object->buffer.pointer,
+		       original_object->string.pointer,
+		       original_object->string.length);
 		break;
 
 	case ACPI_TYPE_PACKAGE:
drivers/acpi/acpica/nsdump.c +1 -1
index d259393..0f1daba 100644
@@ -101,7 +101,7 @@ void acpi_ns_print_pathname(u32 num_segments, char *pathname)
 
 	while (num_segments) {
 		for (i = 0; i < 4; i++) {
-			ACPI_IS_PRINT(pathname[i]) ?
+			isprint((int)pathname[i]) ?
 			    acpi_os_printf("%c", pathname[i]) :
 			    acpi_os_printf("?");
 		}
drivers/acpi/acpica/nseval.c +1 -1
index 7bcc68f..a725d88 100644
@@ -440,7 +440,7 @@ acpi_ns_exec_module_code(union acpi_operand_object *method_obj,
 
 	/* Initialize the evaluation information block */
 
-	ACPI_MEMSET(info, 0, sizeof(struct acpi_evaluate_info));
+	memset(info, 0, sizeof(struct acpi_evaluate_info));
 	info->prefix_node = parent_node;
 
 	/*
drivers/acpi/acpica/nsinit.c +2 -2
index 4a85c45..b744a53 100644
@@ -90,7 +90,7 @@ acpi_status acpi_ns_initialize_objects(void)
 
 	/* Set all init info to zero */
 
-	ACPI_MEMSET(&info, 0, sizeof(struct acpi_init_walk_info));
+	memset(&info, 0, sizeof(struct acpi_init_walk_info));
 
 	/* Walk entire namespace from the supplied root */
 
@@ -566,7 +566,7 @@ acpi_ns_init_one_device(acpi_handle obj_handle,
 	ACPI_DEBUG_EXEC(acpi_ut_display_init_pathname
 			(ACPI_TYPE_METHOD, device_node, METHOD_NAME__INI));
 
-	ACPI_MEMSET(info, 0, sizeof(struct acpi_evaluate_info));
+	memset(info, 0, sizeof(struct acpi_evaluate_info));
 	info->prefix_node = device_node;
 	info->relative_pathname = METHOD_NAME__INI;
 	info->parameters = NULL;
drivers/acpi/acpica/nsrepair2.c +1 -1
index c30672d..0515a70 100644
@@ -580,7 +580,7 @@ acpi_ns_repair_HID(struct acpi_evaluate_info *info,
 	 * # is a hex digit.
 	 */
 	for (dest = new_string->string.pointer; *source; dest++, source++) {
-		*dest = (char)ACPI_TOUPPER(*source);
+		*dest = (char)toupper((int)*source);
 	}
 
 	acpi_ut_remove_reference(return_object);
drivers/acpi/acpica/nsutils.c +1 -2
index 6ad0200..8d8104b 100644
@@ -292,8 +292,7 @@ acpi_status acpi_ns_build_internal_name(struct acpi_namestring_info *info)
 			} else {
 				/* Convert the character to uppercase and save it */
 
-				result[i] =
-				    (char)ACPI_TOUPPER((int)*external_name);
+				result[i] = (char)toupper((int)*external_name);
 				external_name++;
 			}
 		}
drivers/acpi/acpica/nsxfeval.c +2 -3
index b6030a2..6ee1e52 100644
@@ -696,7 +696,7 @@ acpi_ns_get_device_callback(acpi_handle obj_handle,
 			return (AE_CTRL_DEPTH);
 		}
 
-		no_match = ACPI_STRCMP(hid->string, info->hid);
+		no_match = strcmp(hid->string, info->hid);
 		ACPI_FREE(hid);
 
 		if (no_match) {
@@ -715,8 +715,7 @@ acpi_ns_get_device_callback(acpi_handle obj_handle,
 
 			found = FALSE;
 			for (i = 0; i < cid->count; i++) {
-				if (ACPI_STRCMP(cid->ids[i].string, info->hid)
-				    == 0) {
+				if (strcmp(cid->ids[i].string, info->hid) == 0) {
 
 					/* Found a matching CID */
 
drivers/acpi/acpica/nsxfname.c +3 -3
index dc0836a..9ff643b 100644
@@ -114,7 +114,7 @@ acpi_get_handle(acpi_handle parent,
 
 		/* Special case for root-only, since we can't search for it */
 
-		if (!ACPI_STRCMP(pathname, ACPI_NS_ROOT_PATH)) {
+		if (!strcmp(pathname, ACPI_NS_ROOT_PATH)) {
 			*ret_handle =
 			    ACPI_CAST_PTR(acpi_handle, acpi_gbl_root_node);
 			return (AE_OK);
@@ -242,7 +242,7 @@ static char *acpi_ns_copy_device_id(struct acpi_pnp_device_id *dest,
 
 	/* Copy actual string and return a pointer to the next string area */
 
-	ACPI_MEMCPY(string_area, source->string, source->length);
+	memcpy(string_area, source->string, source->length);
 	return (string_area + source->length);
 }
 
@@ -637,7 +637,7 @@ acpi_status acpi_install_method(u8 *buffer)
 
 	/* Copy the method AML to the local buffer */
 
-	ACPI_MEMCPY(aml_buffer, aml_start, aml_length);
+	memcpy(aml_buffer, aml_start, aml_length);
 
 	/* Initialize the method object with the new method's information */
 
drivers/acpi/acpica/psutils.c +3 -4
index 960505a..3244091 100644
@@ -93,10 +93,9 @@ void acpi_ps_init_op(union acpi_parse_object *op, u16 opcode)
 	op->common.descriptor_type = ACPI_DESC_TYPE_PARSER;
 	op->common.aml_opcode = opcode;
 
-	ACPI_DISASM_ONLY_MEMBERS(ACPI_STRNCPY(op->common.aml_op_name,
-					      (acpi_ps_get_opcode_info
-					       (opcode))->name,
-					      sizeof(op->common.aml_op_name)));
+	ACPI_DISASM_ONLY_MEMBERS(strncpy(op->common.aml_op_name,
+					 (acpi_ps_get_opcode_info(opcode))->
+					 name, sizeof(op->common.aml_op_name)));
 }
 
 /*******************************************************************************
drivers/acpi/acpica/rscreate.c +3 -3
index f30f35e..3fa829e 100644
@@ -353,13 +353,13 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object,
 				/* +1 to include null terminator */
 
 				user_prt->length +=
-				    (u32)ACPI_STRLEN(user_prt->source) + 1;
+				    (u32)strlen(user_prt->source) + 1;
 				break;
 
 			case ACPI_TYPE_STRING:
 
-				ACPI_STRCPY(user_prt->source,
-					    obj_desc->string.pointer);
+				strcpy(user_prt->source,
+				       obj_desc->string.pointer);
 
 				/*
 				 * Add to the Length field the length of the string
drivers/acpi/acpica/rsmisc.c +4 -4
index 1fe49d2..ac37852 100644
@@ -119,7 +119,7 @@ acpi_rs_convert_aml_to_resource(struct acpi_resource *resource,
 			/*
 			 * Get the resource type and the initial (minimum) length
 			 */
-			ACPI_MEMSET(resource, 0, INIT_RESOURCE_LENGTH(info));
+			memset(resource, 0, INIT_RESOURCE_LENGTH(info));
 			resource->type = INIT_RESOURCE_TYPE(info);
 			resource->length = INIT_RESOURCE_LENGTH(info);
 			break;
@@ -324,13 +324,13 @@ acpi_rs_convert_aml_to_resource(struct acpi_resource *resource,
 
 		case ACPI_RSC_SET8:
 
-			ACPI_MEMSET(destination, info->aml_offset, info->value);
+			memset(destination, info->aml_offset, info->value);
 			break;
 
 		case ACPI_RSC_DATA8:
 
 			target = ACPI_ADD_PTR(char, resource, info->value);
-			ACPI_MEMCPY(destination, source, ACPI_GET16(target));
+			memcpy(destination, source, ACPI_GET16(target));
 			break;
 
 		case ACPI_RSC_ADDRESS:
@@ -502,7 +502,7 @@ acpi_rs_convert_resource_to_aml(struct acpi_resource *resource,
 		switch (info->opcode) {
 		case ACPI_RSC_INITSET:
 
-			ACPI_MEMSET(aml, 0, INIT_RESOURCE_LENGTH(info));
+			memset(aml, 0, INIT_RESOURCE_LENGTH(info));
 			aml_length = INIT_RESOURCE_LENGTH(info);
 			acpi_rs_set_resource_header(INIT_RESOURCE_TYPE(info),
 						    aml_length, aml);
drivers/acpi/acpica/rsutils.c +5 -6
index 90417de..52b024d 100644
@@ -148,7 +148,7 @@ acpi_rs_move_data(void *destination, void *source, u16 item_count, u8 move_type)
 		case ACPI_RSC_MOVE_SERIAL_VEN:
 		case ACPI_RSC_MOVE_SERIAL_RES:
 
-			ACPI_MEMCPY(destination, source, item_count);
+			memcpy(destination, source, item_count);
 			return;
 
 			/*
@@ -364,12 +364,11 @@ acpi_rs_get_resource_source(acpi_rs_length resource_length,
 		 * Zero the entire area of the buffer.
 		 */
 		total_length =
-		    (u32)
-		    ACPI_STRLEN(ACPI_CAST_PTR(char, &aml_resource_source[1])) +
+		    (u32)strlen(ACPI_CAST_PTR(char, &aml_resource_source[1])) +
 		    1;
 		total_length = (u32)ACPI_ROUND_UP_TO_NATIVE_WORD(total_length);
 
-		ACPI_MEMSET(resource_source->string_ptr, 0, total_length);
+		memset(resource_source->string_ptr, 0, total_length);
 
 		/* Copy the resource_source string to the destination */
 
@@ -432,8 +431,8 @@ acpi_rs_set_resource_source(union aml_resource * aml,
 
 		/* Copy the resource_source string */
 
-		ACPI_STRCPY(ACPI_CAST_PTR(char, &aml_resource_source[1]),
-			    resource_source->string_ptr);
+		strcpy(ACPI_CAST_PTR(char, &aml_resource_source[1]),
+		       resource_source->string_ptr);
 
 		/*
 		 * Add the length of the string (+ 1 for null terminator) to the
drivers/acpi/acpica/rsxface.c +4 -4
index 8e6276d..de51f83 100644
@@ -398,8 +398,8 @@ acpi_resource_to_address64(struct acpi_resource *resource,
 
 		/* Simple copy for 64 bit source */
 
-		ACPI_MEMCPY(out, &resource->data,
-			    sizeof(struct acpi_resource_address64));
+		memcpy(out, &resource->data,
+		       sizeof(struct acpi_resource_address64));
 		break;
 
 	default:
@@ -499,7 +499,7 @@ acpi_rs_match_vendor_resource(struct acpi_resource *resource, void *context)
 	 */
 	if ((vendor->byte_length < (ACPI_UUID_LENGTH + 1)) ||
 	    (vendor->uuid_subtype != info->uuid->subtype) ||
-	    (ACPI_MEMCMP(vendor->uuid, info->uuid->data, ACPI_UUID_LENGTH))) {
+	    (memcmp(vendor->uuid, info->uuid->data, ACPI_UUID_LENGTH))) {
 		return (AE_OK);
 	}
 
@@ -513,7 +513,7 @@ acpi_rs_match_vendor_resource(struct acpi_resource *resource, void *context)
 
 	/* Found the correct resource, copy and return it */
 
-	ACPI_MEMCPY(buffer->pointer, resource, resource->length);
+	memcpy(buffer->pointer, resource, resource->length);
 	buffer->length = resource->length;
 
 	/* Found the desired descriptor, terminate resource walk */
drivers/acpi/acpica/tbdata.c +4 -4
index d7f8386..5c9d5ab 100644
@@ -73,7 +73,7 @@ acpi_tb_init_table_descriptor(struct acpi_table_desc *table_desc,
 	 * Initialize the table descriptor. Set the pointer to NULL, since the
 	 * table is not fully mapped at this time.
 	 */
-	ACPI_MEMSET(table_desc, 0, sizeof(struct acpi_table_desc));
+	memset(table_desc, 0, sizeof(struct acpi_table_desc));
 	table_desc->address = address;
 	table_desc->length = table->length;
 	table_desc->flags = flags;
@@ -465,9 +465,9 @@ acpi_status acpi_tb_resize_root_table_list(void)
 	/* Copy and free the previous table array */
 
 	if (acpi_gbl_root_table_list.tables) {
-		ACPI_MEMCPY(tables, acpi_gbl_root_table_list.tables,
-			    (acpi_size) table_count *
-			    sizeof(struct acpi_table_desc));
+		memcpy(tables, acpi_gbl_root_table_list.tables,
+		       (acpi_size) table_count *
+		       sizeof(struct acpi_table_desc));
 
 		if (acpi_gbl_root_table_list.flags & ACPI_ROOT_ORIGIN_ALLOCATED) {
 			ACPI_FREE(acpi_gbl_root_table_list.tables);
drivers/acpi/acpica/tbfadt.c +3 -3
index 05be59c..6253001 100644
@@ -398,12 +398,12 @@ void acpi_tb_create_local_fadt(struct acpi_table_header *table, u32 length)
 
 	/* Clear the entire local FADT */
 
-	ACPI_MEMSET(&acpi_gbl_FADT, 0, sizeof(struct acpi_table_fadt));
+	memset(&acpi_gbl_FADT, 0, sizeof(struct acpi_table_fadt));
 
 	/* Copy the original FADT, up to sizeof (struct acpi_table_fadt) */
 
-	ACPI_MEMCPY(&acpi_gbl_FADT, table,
-		    ACPI_MIN(length, sizeof(struct acpi_table_fadt)));
+	memcpy(&acpi_gbl_FADT, table,
+	       ACPI_MIN(length, sizeof(struct acpi_table_fadt)));
 
 	/* Take a copy of the Hardware Reduced flag */
 
drivers/acpi/acpica/tbfind.c +10 -11
index 0b879fc..119c84a 100644
@@ -76,16 +76,16 @@ acpi_tb_find_table(char *signature,
 
 	/* Normalize the input strings */
 
-	ACPI_MEMSET(&header, 0, sizeof(struct acpi_table_header));
+	memset(&header, 0, sizeof(struct acpi_table_header));
 	ACPI_MOVE_NAME(header.signature, signature);
-	ACPI_STRNCPY(header.oem_id, oem_id, ACPI_OEM_ID_SIZE);
-	ACPI_STRNCPY(header.oem_table_id, oem_table_id, ACPI_OEM_TABLE_ID_SIZE);
+	strncpy(header.oem_id, oem_id, ACPI_OEM_ID_SIZE);
+	strncpy(header.oem_table_id, oem_table_id, ACPI_OEM_TABLE_ID_SIZE);
 
 	/* Search for the table */
 
 	for (i = 0; i < acpi_gbl_root_table_list.current_table_count; ++i) {
-		if (ACPI_MEMCMP(&(acpi_gbl_root_table_list.tables[i].signature),
-				header.signature, ACPI_NAME_SIZE)) {
+		if (memcmp(&(acpi_gbl_root_table_list.tables[i].signature),
+			   header.signature, ACPI_NAME_SIZE)) {
 
 			/* Not the requested table */
 
@@ -112,21 +112,20 @@ acpi_tb_find_table(char *signature,
 
 		/* Check for table match on all IDs */
 
-		if (!ACPI_MEMCMP
+		if (!memcmp
 		    (acpi_gbl_root_table_list.tables[i].pointer->signature,
 		     header.signature, ACPI_NAME_SIZE) && (!oem_id[0]
 							   ||
-							   !ACPI_MEMCMP
+							   !memcmp
 							   (acpi_gbl_root_table_list.
 							    tables[i].pointer->
 							    oem_id,
 							    header.oem_id,
 							    ACPI_OEM_ID_SIZE))
 		    && (!oem_table_id[0]
-			|| !ACPI_MEMCMP(acpi_gbl_root_table_list.tables[i].
-					pointer->oem_table_id,
-					header.oem_table_id,
-					ACPI_OEM_TABLE_ID_SIZE))) {
+			|| !memcmp(acpi_gbl_root_table_list.tables[i].pointer->
+				   oem_table_id, header.oem_table_id,
+				   ACPI_OEM_TABLE_ID_SIZE))) {
 			*table_index = i;
 
 			ACPI_DEBUG_PRINT((ACPI_DB_TABLES,
drivers/acpi/acpica/tbinstal.c +3 -4
index 008a251..15ea98e 100644
@@ -87,8 +87,8 @@ acpi_tb_compare_tables(struct acpi_table_desc *table_desc, u32 table_index)
 	 * not just the header.
 	 */
 	is_identical = (u8)((table_desc->length != table_length ||
-			     ACPI_MEMCMP(table_desc->pointer, table,
-					 table_length)) ? FALSE : TRUE);
+			     memcmp(table_desc->pointer, table, table_length)) ?
+			    FALSE : TRUE);
 
 	/* Release the acquired table */
 
@@ -289,8 +289,7 @@ acpi_tb_install_standard_table(acpi_physical_address address,
 		if ((new_table_desc.signature.ascii[0] != 0x00) &&
 		    (!ACPI_COMPARE_NAME
 		     (&new_table_desc.signature, ACPI_SIG_SSDT))
-		    && (ACPI_STRNCMP(new_table_desc.signature.ascii, "OEM", 3)))
-		{
+		    && (strncmp(new_table_desc.signature.ascii, "OEM", 3))) {
 			ACPI_BIOS_ERROR((AE_INFO,
 					 "Table has invalid signature [%4.4s] (0x%8.8X), "
 					 "must be SSDT or OEMx",
drivers/acpi/acpica/tbprint.c +5 -5
index 77ba5c7..709d511 100644
@@ -73,7 +73,7 @@ static void acpi_tb_fix_string(char *string, acpi_size length)
 {
 
 	while (length && *string) {
-		if (!ACPI_IS_PRINT(*string)) {
+		if (!isprint((int)*string)) {
 			*string = '?';
 		}
 		string++;
@@ -100,7 +100,7 @@ acpi_tb_cleanup_table_header(struct acpi_table_header *out_header,
 			     struct acpi_table_header *header)
 {
 
-	ACPI_MEMCPY(out_header, header, sizeof(struct acpi_table_header));
+	memcpy(out_header, header, sizeof(struct acpi_table_header));
 
 	acpi_tb_fix_string(out_header->signature, ACPI_NAME_SIZE);
 	acpi_tb_fix_string(out_header->oem_id, ACPI_OEM_ID_SIZE);
@@ -138,9 +138,9 @@ acpi_tb_print_table_header(acpi_physical_address address,
 
 		/* RSDP has no common fields */
 
-		ACPI_MEMCPY(local_header.oem_id,
-			    ACPI_CAST_PTR(struct acpi_table_rsdp,
-					  header)->oem_id, ACPI_OEM_ID_SIZE);
+		memcpy(local_header.oem_id,
+		       ACPI_CAST_PTR(struct acpi_table_rsdp, header)->oem_id,
+		       ACPI_OEM_ID_SIZE);
 		acpi_tb_fix_string(local_header.oem_id, ACPI_OEM_ID_SIZE);
 
 		ACPI_INFO((AE_INFO, "RSDP 0x%8.8X%8.8X %06X (v%.2d %-6.6s)",
drivers/acpi/acpica/tbutils.c +1 -1
index 2bb6a11..568ac0e 100644
@@ -188,7 +188,7 @@ struct acpi_table_header *acpi_tb_copy_dsdt(u32 table_index)
 		return (NULL);
 	}
 
-	ACPI_MEMCPY(new_table, table_desc->pointer, table_desc->length);
+	memcpy(new_table, table_desc->pointer, table_desc->length);
 	acpi_tb_uninstall_table(table_desc);
 
 	acpi_tb_init_table_descriptor(&acpi_gbl_root_table_list.
drivers/acpi/acpica/tbxface.c +8 -8
index 54b9f79..5559e2c 100644
@@ -119,9 +119,9 @@ acpi_initialize_tables(struct acpi_table_desc * initial_table_array,
 	} else {
 		/* Root Table Array has been statically allocated by the host */
 
-		ACPI_MEMSET(initial_table_array, 0,
-			    (acpi_size) initial_table_count *
-			    sizeof(struct acpi_table_desc));
+		memset(initial_table_array, 0,
+		       (acpi_size) initial_table_count *
+		       sizeof(struct acpi_table_desc));
 
 		acpi_gbl_root_table_list.tables = initial_table_array;
 		acpi_gbl_root_table_list.max_table_count = initial_table_count;
@@ -243,8 +243,8 @@ acpi_get_table_header(char *signature,
 					return (AE_NO_MEMORY);
 				}
 
-				ACPI_MEMCPY(out_table_header, header,
-					    sizeof(struct acpi_table_header));
+				memcpy(out_table_header, header,
+				       sizeof(struct acpi_table_header));
 				acpi_os_unmap_memory(header,
 						     sizeof(struct
 							    acpi_table_header));
@@ -252,9 +252,9 @@ acpi_get_table_header(char *signature,
 				return (AE_NOT_FOUND);
 			}
 		} else {
-			ACPI_MEMCPY(out_table_header,
-				    acpi_gbl_root_table_list.tables[i].pointer,
-				    sizeof(struct acpi_table_header));
+			memcpy(out_table_header,
+			       acpi_gbl_root_table_list.tables[i].pointer,
+			       sizeof(struct acpi_table_header));
 		}
 		return (AE_OK);
 	}
drivers/acpi/acpica/tbxfload.c +2 -2
index cf56e18..9682d40 100644
@@ -150,8 +150,8 @@ static acpi_status acpi_tb_load_namespace(void)
 	 * Save the original DSDT header for detection of table corruption
 	 * and/or replacement of the DSDT from outside the OS.
 	 */
-	ACPI_MEMCPY(&acpi_gbl_original_dsdt_header, acpi_gbl_DSDT,
-		    sizeof(struct acpi_table_header));
+	memcpy(&acpi_gbl_original_dsdt_header, acpi_gbl_DSDT,
+	       sizeof(struct acpi_table_header));
 
 	(void)acpi_ut_release_mutex(ACPI_MTX_TABLES);
 
drivers/acpi/acpica/utalloc.c +3 -3
index 61d8f6d..7a4101f 100644
@@ -73,7 +73,7 @@ void *acpi_os_allocate_zeroed(acpi_size size)
 
 		/* Clear the memory block */
 
-		ACPI_MEMSET(allocation, 0, size);
+		memset(allocation, 0, size);
 	}
 
 	return (allocation);
@@ -181,7 +181,7 @@ acpi_status acpi_ut_delete_caches(void)
 	char buffer[7];
 
 	if (acpi_gbl_display_final_mem_stats) {
-		ACPI_STRCPY(buffer, "MEMORY");
+		strcpy(buffer, "MEMORY");
 		(void)acpi_db_display_statistics(buffer);
 	}
 #endif
@@ -337,6 +337,6 @@ acpi_ut_initialize_buffer(struct acpi_buffer * buffer,
 
 	/* Have a valid buffer, clear it */
 
-	ACPI_MEMSET(buffer->pointer, 0, required_length);
+	memset(buffer->pointer, 0, required_length);
 	return (AE_OK);
 }
drivers/acpi/acpica/utbuffer.c +2 -2
index a8c3964..01c8709 100644
@@ -159,7 +159,7 @@ void acpi_ut_dump_buffer(u8 *buffer, u32 count, u32 display, u32 base_offset)
 			}
 
 			buf_char = buffer[(acpi_size) i + j];
-			if (ACPI_IS_PRINT(buf_char)) {
+			if (isprint(buf_char)) {
 				acpi_os_printf("%c", buf_char);
 			} else {
 				acpi_os_printf(".");
@@ -319,7 +319,7 @@ acpi_ut_dump_buffer_to_file(ACPI_FILE file,
 			}
 
 			buf_char = buffer[(acpi_size) i + j];
-			if (ACPI_IS_PRINT(buf_char)) {
+			if (isprint(buf_char)) {
 				acpi_ut_file_printf(file, "%c", buf_char);
 			} else {
 				acpi_ut_file_printf(file, ".");
drivers/acpi/acpica/utcache.c +3 -3
index eacc5ee..0d21fbd 100644
@@ -84,7 +84,7 @@ acpi_os_create_cache(char *cache_name,
 
 	/* Populate the cache object and return it */
 
-	ACPI_MEMSET(cache, 0, sizeof(struct acpi_memory_list));
+	memset(cache, 0, sizeof(struct acpi_memory_list));
 	cache->list_name = cache_name;
 	cache->object_size = object_size;
 	cache->max_depth = max_depth;
@@ -212,7 +212,7 @@ acpi_os_release_object(struct acpi_memory_list * cache, void *object)
 
 		/* Mark the object as cached */
 
-		ACPI_MEMSET(object, 0xCA, cache->object_size);
+		memset(object, 0xCA, cache->object_size);
 		ACPI_SET_DESCRIPTOR_TYPE(object, ACPI_DESC_TYPE_CACHED);
 
 		/* Put the object at the head of the cache list */
@@ -281,7 +281,7 @@ void *acpi_os_acquire_object(struct acpi_memory_list *cache)
 
 		/* Clear (zero) the previously used Object */
 
-		ACPI_MEMSET(object, 0, cache->object_size);
+		memset(object, 0, cache->object_size);
 	} else {
 		/* The cache is empty, create a new object */
 
drivers/acpi/acpica/utcopy.c +21 -21

90 lines not on this page · raw message

drivers/acpi/acpica/utids.c +4 -5
index 3afe07f..7956df1 100644
@@ -111,7 +111,7 @@ acpi_ut_execute_HID(struct acpi_namespace_node *device_node,
 	if (obj_desc->common.type == ACPI_TYPE_INTEGER) {
 		acpi_ex_eisa_id_to_string(hid->string, obj_desc->integer.value);
 	} else {
-		ACPI_STRCPY(hid->string, obj_desc->string.pointer);
+		strcpy(hid->string, obj_desc->string.pointer);
 	}
 
 	hid->length = length;
@@ -180,7 +180,7 @@ acpi_ut_execute_SUB(struct acpi_namespace_node *device_node,
 
 	/* Simply copy existing string */
 
-	ACPI_STRCPY(sub->string, obj_desc->string.pointer);
+	strcpy(sub->string, obj_desc->string.pointer);
 	sub->length = length;
 	*return_id = sub;
 
@@ -256,7 +256,7 @@ acpi_ut_execute_UID(struct acpi_namespace_node *device_node,
 	if (obj_desc->common.type == ACPI_TYPE_INTEGER) {
 		acpi_ex_integer_to_string(uid->string, obj_desc->integer.value);
 	} else {
-		ACPI_STRCPY(uid->string, obj_desc->string.pointer);
+		strcpy(uid->string, obj_desc->string.pointer);
 	}
 
 	uid->length = length;
@@ -393,8 +393,7 @@ acpi_ut_execute_CID(struct acpi_namespace_node *device_node,
 
 			/* Copy the String CID from the returned object */
 
-			ACPI_STRCPY(next_id_string,
-				    cid_objects[i]->string.pointer);
+			strcpy(next_id_string, cid_objects[i]->string.pointer);
 			length = cid_objects[i]->string.length + 1;
 		}
 
drivers/acpi/acpica/utmisc.c +3 -3
index 28099e2..71b6653 100644
@@ -66,9 +66,9 @@ u8 acpi_ut_is_pci_root_bridge(char *id)
 	 * Check if this is a PCI root bridge.
 	 * ACPI 3.0+: check for a PCI Express root also.
 	 */
-	if (!(ACPI_STRCMP(id,
-			  PCI_ROOT_HID_STRING)) ||
-	    !(ACPI_STRCMP(id, PCI_EXPRESS_ROOT_HID_STRING))) {
+	if (!(strcmp(id,
+		     PCI_ROOT_HID_STRING)) ||
+	    !(strcmp(id, PCI_EXPRESS_ROOT_HID_STRING))) {
 		return (TRUE);
 	}
 
drivers/acpi/acpica/utosi.c +4 -5
index 44035ab..8f3d203a 100644
@@ -232,8 +232,7 @@ acpi_status acpi_ut_install_interface(acpi_string interface_name)
 		return (AE_NO_MEMORY);
 	}
 
-	interface_info->name =
-	    ACPI_ALLOCATE_ZEROED(ACPI_STRLEN(interface_name) + 1);
+	interface_info->name = ACPI_ALLOCATE_ZEROED(strlen(interface_name) + 1);
 	if (!interface_info->name) {
 		ACPI_FREE(interface_info);
 		return (AE_NO_MEMORY);
@@ -241,7 +240,7 @@ acpi_status acpi_ut_install_interface(acpi_string interface_name)
 
 	/* Initialize new info and insert at the head of the global list */
 
-	ACPI_STRCPY(interface_info->name, interface_name);
+	strcpy(interface_info->name, interface_name);
 	interface_info->flags = ACPI_OSI_DYNAMIC;
 	interface_info->next = acpi_gbl_supported_interfaces;
 
@@ -269,7 +268,7 @@ acpi_status acpi_ut_remove_interface(acpi_string interface_name)
 
 	previous_interface = next_interface = acpi_gbl_supported_interfaces;
 	while (next_interface) {
-		if (!ACPI_STRCMP(interface_name, next_interface->name)) {
+		if (!strcmp(interface_name, next_interface->name)) {
 
 			/* Found: name is in either the static list or was added at runtime */
 
@@ -373,7 +372,7 @@ struct acpi_interface_info *acpi_ut_get_interface(acpi_string interface_name)
 
 	next_interface = acpi_gbl_supported_interfaces;
 	while (next_interface) {
-		if (!ACPI_STRCMP(interface_name, next_interface->name)) {
+		if (!strcmp(interface_name, next_interface->name)) {
 			return (next_interface);
 		}
 
drivers/acpi/acpica/utpredef.c +2 -2
index 29e4499..97898ed 100644
@@ -148,7 +148,7 @@ void acpi_ut_get_expected_return_types(char *buffer, u32 expected_btypes)
 	u32 j;
 
 	if (!expected_btypes) {
-		ACPI_STRCPY(buffer, "NONE");
+		strcpy(buffer, "NONE");
 		return;
 	}
 
@@ -161,7 +161,7 @@ void acpi_ut_get_expected_return_types(char *buffer, u32 expected_btypes)
 		/* If one of the expected types, concatenate the name of this type */
 
 		if (expected_btypes & this_rtype) {
-			ACPI_STRCAT(buffer, &ut_rtype_names[i][j]);
+			strcat(buffer, &ut_rtype_names[i][j]);
 			j = 0;	/* Use name separator from now on */
 		}
 
drivers/acpi/acpica/utprint.c +3 -3
index 2be6bd4..b26297c 100644
@@ -180,7 +180,7 @@ const char *acpi_ut_scan_number(const char *string, u64 *number_ptr)
 {
 	u64 number = 0;
 
-	while (ACPI_IS_DIGIT(*string)) {
+	while (isdigit((int)*string)) {
 		number *= 10;
 		number += *(string++) - '0';
 	}
@@ -405,7 +405,7 @@ acpi_ut_vsnprintf(char *string,
 		/* Process width */
 
 		width = -1;
-		if (ACPI_IS_DIGIT(*format)) {
+		if (isdigit((int)*format)) {
 			format = acpi_ut_scan_number(format, &number);
 			width = (s32) number;
 		} else if (*format == '*') {
@@ -422,7 +422,7 @@ acpi_ut_vsnprintf(char *string,
 		precision = -1;
 		if (*format == '.') {
 			++format;
-			if (ACPI_IS_DIGIT(*format)) {
+			if (isdigit((int)*format)) {
 				format = acpi_ut_scan_number(format, &number);
 				precision = (s32) number;
 			} else if (*format == '*') {
drivers/acpi/acpica/utstring.c +16 -17
index 83b6c52..8f3c883 100644
@@ -79,7 +79,7 @@ void acpi_ut_strlwr(char *src_string)
 	/* Walk entire string, lowercasing the letters */
 
 	for (string = src_string; *string; string++) {
-		*string = (char)ACPI_TOLOWER(*string);
+		*string = (char)tolower((int)*string);
 	}
 
 	return;
@@ -145,7 +145,7 @@ void acpi_ut_strupr(char *src_string)
 	/* Walk entire string, uppercasing the letters */
 
 	for (string = src_string; *string; string++) {
-		*string = (char)ACPI_TOUPPER(*string);
+		*string = (char)toupper((int)*string);
 	}
 
 	return;
@@ -202,7 +202,7 @@ acpi_status acpi_ut_strtoul64(char *string, u32 base, u64 *ret_integer)
 
 	/* Skip over any white space in the buffer */
 
-	while ((*string) && (ACPI_IS_SPACE(*string) || *string == '\t')) {
+	while ((*string) && (isspace((int)*string) || *string == '\t')) {
 		string++;
 	}
 
@@ -211,7 +211,7 @@ acpi_status acpi_ut_strtoul64(char *string, u32 base, u64 *ret_integer)
 		 * Base equal to ACPI_ANY_BASE means 'ToInteger operation case'.
 		 * We need to determine if it is decimal or hexadecimal.
 		 */
-		if ((*string == '0') && (ACPI_TOLOWER(*(string + 1)) == 'x')) {
+		if ((*string == '0') && (tolower((int)*(string + 1)) == 'x')) {
 			sign_of0x = 1;
 			base = 16;
 
@@ -224,7 +224,7 @@ acpi_status acpi_ut_strtoul64(char *string, u32 base, u64 *ret_integer)
 
 	/* Any string left? Check that '0x' is not followed by white space. */
 
-	if (!(*string) || ACPI_IS_SPACE(*string) || *string == '\t') {
+	if (!(*string) || isspace((int)*string) || *string == '\t') {
 		if (to_integer_op) {
 			goto error_exit;
 		} else {
@@ -241,7 +241,7 @@ acpi_status acpi_ut_strtoul64(char *string, u32 base, u64 *ret_integer)
 	/* Main loop: convert the string to a 32- or 64-bit integer */
 
 	while (*string) {
-		if (ACPI_IS_DIGIT(*string)) {
+		if (isdigit((int)*string)) {
 
 			/* Convert ASCII 0-9 to Decimal value */
 
@@ -252,8 +252,8 @@ acpi_status acpi_ut_strtoul64(char *string, u32 base, u64 *ret_integer)
 
 			term = 1;
 		} else {
-			this_digit = (u8)ACPI_TOUPPER(*string);
-			if (ACPI_IS_XDIGIT((char)this_digit)) {
+			this_digit = (u8)toupper((int)*string);
+			if (isxdigit((int)this_digit)) {
 
 				/* Convert ASCII Hex char to value */
 
@@ -404,7 +404,7 @@ void acpi_ut_print_string(char *string, u16 max_length)
 
 			/* Check for printable character or hex escape */
 
-			if (ACPI_IS_PRINT(string[i])) {
+			if (isprint((int)string[i])) {
 				/* This is a normal character */
 
 				acpi_os_printf("%c", (int)string[i]);
@@ -609,22 +609,22 @@ void ut_convert_backslashes(char *pathname)
 u8 acpi_ut_safe_strcpy(char *dest, acpi_size dest_size, char *source)
 {
 
-	if (ACPI_STRLEN(source) >= dest_size) {
+	if (strlen(source) >= dest_size) {
 		return (TRUE);
 	}
 
-	ACPI_STRCPY(dest, source);
+	strcpy(dest, source);
 	return (FALSE);
 }
 
 u8 acpi_ut_safe_strcat(char *dest, acpi_size dest_size, char *source)
 {
 
-	if ((ACPI_STRLEN(dest) + ACPI_STRLEN(source)) >= dest_size) {
+	if ((strlen(dest) + strlen(source)) >= dest_size) {
 		return (TRUE);
 	}
 
-	ACPI_STRCAT(dest, source);
+	strcat(dest, source);
 	return (FALSE);
 }
 
@@ -635,14 +635,13 @@ acpi_ut_safe_strncat(char *dest,
 {
 	acpi_size actual_transfer_length;
 
-	actual_transfer_length =
-	    ACPI_MIN(max_transfer_length, ACPI_STRLEN(source));
+	actual_transfer_length = ACPI_MIN(max_transfer_length, strlen(source));
 
-	if ((ACPI_STRLEN(dest) + actual_transfer_length) >= dest_size) {
+	if ((strlen(dest) + actual_transfer_length) >= dest_size) {
 		return (TRUE);
 	}
 
-	ACPI_STRNCAT(dest, source, max_transfer_length);
+	strncat(dest, source, max_transfer_length);
 	return (FALSE);
 }
 #endif
drivers/acpi/acpica/uttrack.c +4 -4
index 130dd9f..9a7dc81 100644
@@ -100,7 +100,7 @@ acpi_ut_create_list(char *list_name,
 		return (AE_NO_MEMORY);
 	}
 
-	ACPI_MEMSET(cache, 0, sizeof(struct acpi_memory_list));
+	memset(cache, 0, sizeof(struct acpi_memory_list));
 
 	cache->list_name = list_name;
 	cache->object_size = object_size;
@@ -402,7 +402,7 @@ acpi_ut_track_allocation(struct acpi_debug_mem_block *allocation,
 	allocation->component = component;
 	allocation->line = line;
 
-	ACPI_STRNCPY(allocation->module, module, ACPI_MAX_MODULE_NAME);
+	strncpy(allocation->module, module, ACPI_MAX_MODULE_NAME);
 	allocation->module[ACPI_MAX_MODULE_NAME - 1] = 0;
 
 	if (!element) {
@@ -497,7 +497,7 @@ acpi_ut_remove_allocation(struct acpi_debug_mem_block *allocation,
 
 	/* Mark the segment as deleted */
 
-	ACPI_MEMSET(&allocation->user_space, 0xEA, allocation->size);
+	memset(&allocation->user_space, 0xEA, allocation->size);
 
 	status = acpi_ut_release_mutex(ACPI_MTX_MEMORY);
 	return (status);
@@ -595,7 +595,7 @@ void acpi_ut_dump_allocations(u32 component, const char *module)
 	while (element) {
 		if ((element->component & component) &&
 		    ((module == NULL)
-		     || (0 == ACPI_STRCMP(module, element->module)))) {
+		     || (0 == strcmp(module, element->module)))) {
 			descriptor =
 			    ACPI_CAST_PTR(union acpi_descriptor,
 					  &element->user_space);
drivers/acpi/acpica/utxface.c +4 -4
index 0929187..51cf52d 100644
@@ -234,8 +234,8 @@ acpi_status acpi_get_statistics(struct acpi_statistics *stats)
 	stats->sci_count = acpi_sci_count;
 	stats->gpe_count = acpi_gpe_count;
 
-	ACPI_MEMCPY(stats->fixed_event_count, acpi_fixed_event_count,
-		    sizeof(acpi_fixed_event_count));
+	memcpy(stats->fixed_event_count, acpi_fixed_event_count,
+	       sizeof(acpi_fixed_event_count));
 
 	/* Other counters */
 
@@ -322,7 +322,7 @@ acpi_status acpi_install_interface(acpi_string interface_name)
 
 	/* Parameter validation */
 
-	if (!interface_name || (ACPI_STRLEN(interface_name) == 0)) {
+	if (!interface_name || (strlen(interface_name) == 0)) {
 		return (AE_BAD_PARAMETER);
 	}
 
@@ -374,7 +374,7 @@ acpi_status acpi_remove_interface(acpi_string interface_name)
 
 	/* Parameter validation */
 
-	if (!interface_name || (ACPI_STRLEN(interface_name) == 0)) {
+	if (!interface_name || (strlen(interface_name) == 0)) {
 		return (AE_BAD_PARAMETER);
 	}
 
include/acpi/actypes.h +4 -4
index d791b98..c2a41d2 100644
@@ -542,14 +542,14 @@ typedef u64 acpi_integer;
 #define ACPI_COMPARE_NAME(a,b)          (*ACPI_CAST_PTR (u32, (a)) == *ACPI_CAST_PTR (u32, (b)))
 #define ACPI_MOVE_NAME(dest,src)        (*ACPI_CAST_PTR (u32, (dest)) = *ACPI_CAST_PTR (u32, (src)))
 #else
-#define ACPI_COMPARE_NAME(a,b)          (!ACPI_STRNCMP (ACPI_CAST_PTR (char, (a)), ACPI_CAST_PTR (char, (b)), ACPI_NAME_SIZE))
-#define ACPI_MOVE_NAME(dest,src)        (ACPI_STRNCPY (ACPI_CAST_PTR (char, (dest)), ACPI_CAST_PTR (char, (src)), ACPI_NAME_SIZE))
+#define ACPI_COMPARE_NAME(a,b)          (!strncmp (ACPI_CAST_PTR (char, (a)), ACPI_CAST_PTR (char, (b)), ACPI_NAME_SIZE))
+#define ACPI_MOVE_NAME(dest,src)        (strncpy (ACPI_CAST_PTR (char, (dest)), ACPI_CAST_PTR (char, (src)), ACPI_NAME_SIZE))
 #endif
 
 /* Support for the special RSDP signature (8 characters) */
 
-#define ACPI_VALIDATE_RSDP_SIG(a)       (!ACPI_STRNCMP (ACPI_CAST_PTR (char, (a)), ACPI_SIG_RSDP, 8))
-#define ACPI_MAKE_RSDP_SIG(dest)        (ACPI_MEMCPY (ACPI_CAST_PTR (char, (dest)), ACPI_SIG_RSDP, 8))
+#define ACPI_VALIDATE_RSDP_SIG(a)       (!strncmp (ACPI_CAST_PTR (char, (a)), ACPI_SIG_RSDP, 8))
+#define ACPI_MAKE_RSDP_SIG(dest)        (memcpy (ACPI_CAST_PTR (char, (dest)), ACPI_SIG_RSDP, 8))
 
 /*******************************************************************************
  *
include/acpi/platform/acenv.h +0 -38
index 1e84e62..3cedd43 100644
@@ -346,28 +346,6 @@
 
 /* We will be linking to the standard Clib functions */
 
-#define ACPI_STRSTR(s1,s2)      strstr((s1), (s2))
-#define ACPI_STRCHR(s1,c)       strchr((s1), (c))
-#define ACPI_STRLEN(s)          (acpi_size) strlen((s))
-#define ACPI_STRCPY(d,s)        (void) strcpy((d), (s))
-#define ACPI_STRNCPY(d,s,n)     (void) strncpy((d), (s), (acpi_size)(n))
-#define ACPI_STRNCMP(d,s,n)     strncmp((d), (s), (acpi_size)(n))
-#define ACPI_STRCMP(d,s)        strcmp((d), (s))
-#define ACPI_STRCAT(d,s)        (void) strcat((d), (s))
-#define ACPI_STRNCAT(d,s,n)     strncat((d), (s), (acpi_size)(n))
-#define ACPI_STRTOUL(d,s,n)     strtoul((d), (s), (acpi_size)(n))
-#define ACPI_MEMCMP(s1,s2,n)    memcmp((const char *)(s1), (const char *)(s2), (acpi_size)(n))
-#define ACPI_MEMCPY(d,s,n)      (void) memcpy((d), (s), (acpi_size)(n))
-#define ACPI_MEMSET(d,s,n)      (void) memset((d), (s), (acpi_size)(n))
-#define ACPI_TOUPPER(i)         toupper((int) (i))
-#define ACPI_TOLOWER(i)         tolower((int) (i))
-#define ACPI_IS_XDIGIT(i)       isxdigit((int) (i))
-#define ACPI_IS_DIGIT(i)        isdigit((int) (i))
-#define ACPI_IS_SPACE(i)        isspace((int) (i))
-#define ACPI_IS_UPPER(i)        isupper((int) (i))
-#define ACPI_IS_PRINT(i)        isprint((int) (i))
-#define ACPI_IS_ALPHA(i)        isalpha((int) (i))
-
 #else
 
 /******************************************************************************
@@ -405,22 +383,6 @@ typedef char *va_list;
 
 /* Use the local (ACPICA) definitions of the clib functions */
 
-#define ACPI_STRSTR(s1,s2)      acpi_ut_strstr ((s1), (s2))
-#define ACPI_STRCHR(s1,c)       acpi_ut_strchr ((s1), (c))
-#define ACPI_STRLEN(s)          (acpi_size) acpi_ut_strlen ((s))
-#define ACPI_STRCPY(d,s)        (void) acpi_ut_strcpy ((d), (s))
-#define ACPI_STRNCPY(d,s,n)     (void) acpi_ut_strncpy ((d), (s), (acpi_size)(n))
-#define ACPI_STRNCMP(d,s,n)     acpi_ut_strncmp ((d), (s), (acpi_size)(n))
-#define ACPI_STRCMP(d,s)        acpi_ut_strcmp ((d), (s))
-#define ACPI_STRCAT(d,s)        (void) acpi_ut_strcat ((d), (s))
-#define ACPI_STRNCAT(d,s,n)     acpi_ut_strncat ((d), (s), (acpi_size)(n))
-#define ACPI_STRTOUL(d,s,n)     acpi_ut_strtoul ((d), (s), (acpi_size)(n))
-#define ACPI_MEMCMP(s1,s2,n)    acpi_ut_memcmp((const char *)(s1), (const char *)(s2), (acpi_size)(n))
-#define ACPI_MEMCPY(d,s,n)      (void) acpi_ut_memcpy ((d), (s), (acpi_size)(n))
-#define ACPI_MEMSET(d,v,n)      (void) acpi_ut_memset ((d), (v), (acpi_size)(n))
-#define ACPI_TOUPPER(c)         acpi_ut_to_upper ((int) (c))
-#define ACPI_TOLOWER(c)         acpi_ut_to_lower ((int) (c))
-
 #endif				/* ACPI_USE_SYSTEM_CLIBRARY */
 
 #ifndef ACPI_FILE
tools/power/acpi/common/getopt.c +2 -2
index 5da129e..326e826 100644
@@ -127,7 +127,7 @@ int acpi_getopt(int argc, char **argv, char *opts)
 		    argv[acpi_gbl_optind][0] != '-' ||
 		    argv[acpi_gbl_optind][1] == '\0') {
 			return (ACPI_OPT_END);
-		} else if (ACPI_STRCMP(argv[acpi_gbl_optind], "--") == 0) {
+		} else if (strcmp(argv[acpi_gbl_optind], "--") == 0) {
 			acpi_gbl_optind++;
 			return (ACPI_OPT_END);
 		}
@@ -140,7 +140,7 @@ int acpi_getopt(int argc, char **argv, char *opts)
 	/* Make sure that the option is legal */
 
 	if (current_char == ':' ||
-	    (opts_ptr = ACPI_STRCHR(opts, current_char)) == NULL) {
+	    (opts_ptr = strchr(opts, current_char)) == NULL) {
 		ACPI_OPTION_ERROR("Illegal option: -", current_char);
 
 		if (argv[acpi_gbl_optind][++current_char_ptr] == '\0') {
tools/power/acpi/os_specific/service_layers/oslinuxtbl.c +3 -3
index 3aff9a2..dd5008b 100644
@@ -222,7 +222,7 @@ acpi_os_get_table_by_address(acpi_physical_address address,
 		goto exit;
 	}
 
-	ACPI_MEMCPY(local_table, mapped_table, table_length);
+	memcpy(local_table, mapped_table, table_length);
 
 exit:
 	osl_unmap_table(mapped_table);
@@ -531,7 +531,7 @@ static acpi_status osl_load_rsdp(void)
 	gbl_rsdp_address =
 	    rsdp_base + (ACPI_CAST8(mapped_table) - rsdp_address);
 
-	ACPI_MEMCPY(&gbl_rsdp, mapped_table, sizeof(struct acpi_table_rsdp));
+	memcpy(&gbl_rsdp, mapped_table, sizeof(struct acpi_table_rsdp));
 	acpi_os_unmap_memory(rsdp_address, rsdp_size);
 
 	return (AE_OK);
@@ -964,7 +964,7 @@ osl_get_bios_table(char *signature,
 		goto exit;
 	}
 
-	ACPI_MEMCPY(local_table, mapped_table, table_length);
+	memcpy(local_table, mapped_table, table_length);
 	*address = table_address;
 	*table = local_table;
 
tools/power/acpi/tools/acpidump/apdump.c +4 -4
index c736adf..61d0de8 100644
@@ -329,7 +329,7 @@ int ap_dump_table_by_name(char *signature)
 	acpi_status status;
 	int table_status;
 
-	if (ACPI_STRLEN(signature) != ACPI_NAME_SIZE) {
+	if (strlen(signature) != ACPI_NAME_SIZE) {
 		acpi_log_error
 		    ("Invalid table signature [%s]: must be exactly 4 characters\n",
 		     signature);
@@ -338,15 +338,15 @@ int ap_dump_table_by_name(char *signature)
 
 	/* Table signatures are expected to be uppercase */
 
-	ACPI_STRCPY(local_signature, signature);
+	strcpy(local_signature, signature);
 	acpi_ut_strupr(local_signature);
 
 	/* To be friendly, handle tables whose signatures do not match the name */
 
 	if (ACPI_COMPARE_NAME(local_signature, "FADT")) {
-		ACPI_STRCPY(local_signature, ACPI_SIG_FADT);
+		strcpy(local_signature, ACPI_SIG_FADT);
 	} else if (ACPI_COMPARE_NAME(local_signature, "MADT")) {
-		ACPI_STRCPY(local_signature, ACPI_SIG_MADT);
+		strcpy(local_signature, ACPI_SIG_MADT);
 	}
 
 	/* Dump all instances of this signature (to handle multiple SSDTs) */
tools/power/acpi/tools/acpidump/apfiles.c +6 -6
index 8f2fe16..a37f970 100644
@@ -136,10 +136,10 @@ int ap_write_to_binary_file(struct acpi_table_header *table, u32 instance)
 	} else {
 		ACPI_MOVE_NAME(filename, table->signature);
 	}
-	filename[0] = (char)ACPI_TOLOWER(filename[0]);
-	filename[1] = (char)ACPI_TOLOWER(filename[1]);
-	filename[2] = (char)ACPI_TOLOWER(filename[2]);
-	filename[3] = (char)ACPI_TOLOWER(filename[3]);
+	filename[0] = (char)tolower((int)filename[0]);
+	filename[1] = (char)tolower((int)filename[1]);
+	filename[2] = (char)tolower((int)filename[2]);
+	filename[3] = (char)tolower((int)filename[3]);
 	filename[ACPI_NAME_SIZE] = 0;
 
 	/* Handle multiple SSDts - create different filenames for each */
@@ -147,10 +147,10 @@ int ap_write_to_binary_file(struct acpi_table_header *table, u32 instance)
 	if (instance > 0) {
 		acpi_ut_snprintf(instance_str, sizeof(instance_str), "%u",
 				 instance);
-		ACPI_STRCAT(filename, instance_str);
+		strcat(filename, instance_str);
 	}
 
-	ACPI_STRCAT(filename, ACPI_TABLE_FILE_SUFFIX);
+	strcat(filename, ACPI_TABLE_FILE_SUFFIX);
 
 	if (gbl_verbose_mode) {
 		acpi_log_error
Signature · 1 line
1.7.10
author
#83 lore raw

PATCH v2 24/28 ACPICA: Split C library prototypes to new header.

In reply to Lv Zheng

From: Bob Moore <[email protected]>

ACPICA commit f51bf8497889a94046820639537165bbd7ccdee6

Adds acclib.h

This patch doesn't affect Linux kernel.

---
 drivers/acpi/acpica/accommon.h |    3 +++
 drivers/acpi/acpica/acutils.h  |   58 ----------------------------------------
 2 files changed, 3 insertions(+), 58 deletions(-)
drivers/acpi/acpica/accommon.h +3 -0
index 853aa2d..a8d8092 100644
@@ -59,5 +59,8 @@
 #include "acglobal.h"		/* All global variables */
 #include "achware.h"		/* Hardware defines and interfaces */
 #include "acutils.h"		/* Utility interfaces */
+#ifndef ACPI_USE_SYSTEM_CLIBRARY
+#include "acclib.h"		/* C library interfaces */
+#endif				/* !ACPI_USE_SYSTEM_CLIBRARY */
 
 #endif				/* __ACCOMMON_H__ */
drivers/acpi/acpica/acutils.h +0 -58

64 lines not on this page · raw message

Signature · 1 line
1.7.10
author
#84 lore raw

PATCH v2 25/28 ACPICA: Update definitions for the TCPA and TPM2 ACPI tables.

In reply to Lv Zheng

From: Bob Moore <[email protected]>

ACPICA commit 33140b4498666337dd33a00cf3c4797a53981a7b

Changes for a new version of the 3rd party spec for these tables, the "TCG ACPI Specification", December 14, 2014. Also, moved the definition of TPM2 to actbl2.h, next to TCPA, since both should be together.

Update the table compiler/disassembler code for the tables. However, the "Server" TCPA table is not supported at this time.

---
 include/acpi/actbl2.h |   86 +++++++++++++++++++++++++++++++++++++++++++++----
 include/acpi/actbl3.h |   34 ++-----------------
 2 files changed, 81 insertions(+), 39 deletions(-)
include/acpi/actbl2.h +79 -7
index 370d69d..2a9dcc1 100644
@@ -51,8 +51,8 @@
  * These tables are not consumed directly by the ACPICA subsystem, but are
  * included here to support device drivers and the AML disassembler.
  *
- * The tables in this file are defined by third-party specifications, and are
- * not defined directly by the ACPI specification itself.
+ * Generally, the tables in this file are defined by third-party specifications,
+ * and are not defined directly by the ACPI specification itself.
  *
  ******************************************************************************/
 
@@ -80,6 +80,7 @@
 #define ACPI_SIG_SPCR           "SPCR"	/* Serial Port Console Redirection table */
 #define ACPI_SIG_SPMI           "SPMI"	/* Server Platform Management Interface table */
 #define ACPI_SIG_TCPA           "TCPA"	/* Trusted Computing Platform Alliance table */
+#define ACPI_SIG_TPM2           "TPM2"	/* Trusted Platform Module 2.0 H/W interface table */
 #define ACPI_SIG_UEFI           "UEFI"	/* Uefi Boot Optimization Table */
 #define ACPI_SIG_VRTC           "VRTC"	/* Virtual Real Time Clock Table */
 #define ACPI_SIG_WAET           "WAET"	/* Windows ACPI Emulated devices Table */
@@ -1179,18 +1180,89 @@ enum acpi_spmi_interface_types {
 /*******************************************************************************
  *
  * TCPA - Trusted Computing Platform Alliance table
- *        Version 1
+ *        Version 2
+ *
+ * Conforms to "TCG ACPI Specification, Family 1.2 and 2.0",
+ * December 19, 2014
  *
- * Conforms to "TCG PC Specific Implementation Specification",
- * Version 1.1, August 18, 2003
+ * NOTE: There are two versions of the table with the same signature --
+ * the client version and the server version.
  *
  ******************************************************************************/
 
-struct acpi_table_tcpa {
+struct acpi_table_tcpa_client {
+	struct acpi_table_header header;	/* Common ACPI table header */
+	u16 platform_class;
+	u32 minimum_log_length;	/* Minimum length for the event log area */
+	u64 log_address;	/* Address of the event log area */
+};
+
+struct acpi_table_tcpa_server {
 	struct acpi_table_header header;	/* Common ACPI table header */
+	u16 platform_class;
 	u16 reserved;
-	u32 max_log_length;	/* Maximum length for the event log area */
+	u64 minimum_log_length;	/* Minimum length for the event log area */
 	u64 log_address;	/* Address of the event log area */
+	u16 spec_revision;
+	u8 device_flags;
+	u8 interrupt_flags;
+	u8 gpe_number;
+	u8 reserved2[3];
+	u32 global_interrupt;
+	struct acpi_generic_address address;
+	u32 reserved3;
+	struct acpi_generic_address config_address;
+	u8 group;
+	u8 bus;			/* PCI Bus/Segment/Function numbers */
+	u8 device;
+	u8 function;
+};
+
+/* Values for device_flags above */
+
+#define ACPI_TCPA_PCI_DEVICE            (1)
+#define ACPI_TCPA_BUS_PNP               (1<<1)
+#define ACPI_TCPA_ADDRESS_VALID         (1<<2)
+
+/* Values for interrupt_flags above */
+
+#define ACPI_TCPA_INTERRUPT_MODE        (1)
+#define ACPI_TCPA_INTERRUPT_POLARITY    (1<<1)
+#define ACPI_TCPA_SCI_VIA_GPE           (1<<2)
+#define ACPI_TCPA_GLOBAL_INTERRUPT      (1<<3)
+
+/*******************************************************************************
+ *
+ * TPM2 - Trusted Platform Module (TPM) 2.0 Hardware Interface Table
+ *        Version 4
+ *
+ * Conforms to "TCG ACPI Specification, Family 1.2 and 2.0",
+ * December 19, 2014
+ *
+ ******************************************************************************/
+
+struct acpi_table_tpm2 {
+	struct acpi_table_header header;	/* Common ACPI table header */
+	u16 platform_class;
+	u16 reserved;
+	u64 control_address;
+	u32 start_method;
+
+	/* Platform-specific data follows */
+};
+
+/* Control area structure (not part of table, pointed to by control_address) */
+
+struct acpi_tpm2_control {
+	u32 reserved;
+	u32 error;
+	u32 cancel;
+	u32 start;
+	u64 interrupt_control;
+	u32 command_size;
+	u64 command_address;
+	u32 response_size;
+	u64 response_address;
 };
 
 /*******************************************************************************
include/acpi/actbl3.h +2 -32
index 4018986..1df8916 100644
@@ -51,7 +51,8 @@
  * These tables are not consumed directly by the ACPICA subsystem, but are
  * included here to support device drivers and the AML disassembler.
  *
- * The tables in this file are fully defined within the ACPI specification.
+ * In general, the tables in this file are fully defined within the ACPI
+ * specification.
  *
  ******************************************************************************/
 
@@ -69,7 +70,6 @@
 #define ACPI_SIG_PMTT           "PMTT"	/* Platform Memory Topology Table */
 #define ACPI_SIG_RASF           "RASF"	/* RAS Feature table */
 #define ACPI_SIG_STAO           "STAO"	/* Status Override table */
-#define ACPI_SIG_TPM2           "TPM2"	/* Trusted Platform Module 2.0 H/W interface table */
 #define ACPI_SIG_WPBT           "WPBT"	/* Windows Platform Binary Table */
 #define ACPI_SIG_XENV           "XENV"	/* Xen Environment table */
 
@@ -722,36 +722,6 @@ struct acpi_table_stao {
 
 /*******************************************************************************
  *
- * TPM2 - Trusted Platform Module (TPM) 2.0 Hardware Interface Table
- *        Version 3
- *
- * Conforms to "TPM 2.0 Hardware Interface Table (TPM2)" 29 November 2011
- *
- ******************************************************************************/
-
-struct acpi_table_tpm2 {
-	struct acpi_table_header header;	/* Common ACPI table header */
-	u32 flags;
-	u64 control_address;
-	u32 start_method;
-};
-
-/* Control area structure (not part of table, pointed to by control_address) */
-
-struct acpi_tpm2_control {
-	u32 reserved;
-	u32 error;
-	u32 cancel;
-	u32 start;
-	u64 interrupt_control;
-	u32 command_size;
-	u64 command_address;
-	u32 response_size;
-	u64 response_address;
-};
-
-/*******************************************************************************
- *
  * WPBT - Windows Platform Environment Table (ACPI 6.0)
  *        Version 1
  *
Signature · 1 line
1.7.10
author
#85 lore raw

PATCH v2 26/28 ACPICA: Update TPM2 ACPI table.

In reply to Lv Zheng

From: Bob Moore <[email protected]>

ACPICA commit 254bf77e7ca01cb27e026fa5737f7df8dae03f2c

- Add constans for the start_method.
- Remove the control structure, not part of ACPI, not defined in the current TCG spec.

---
 include/acpi/actbl2.h |   18 ++++++------------
 1 file changed, 6 insertions(+), 12 deletions(-)
include/acpi/actbl2.h +6 -12
index 2a9dcc1..a948fc5 100644
@@ -1251,19 +1251,13 @@ struct acpi_table_tpm2 {
 	/* Platform-specific data follows */
 };
 
-/* Control area structure (not part of table, pointed to by control_address) */
+/* Values for start_method above */
 
-struct acpi_tpm2_control {
-	u32 reserved;
-	u32 error;
-	u32 cancel;
-	u32 start;
-	u64 interrupt_control;
-	u32 command_size;
-	u64 command_address;
-	u32 response_size;
-	u64 response_address;
-};
+#define ACPI_TPM2_NOT_ALLOWED                       0
+#define ACPI_TPM2_START_METHOD                      2
+#define ACPI_TPM2_MEMORY_MAPPED                     6
+#define ACPI_TPM2_COMMAND_BUFFER                    7
+#define ACPI_TPM2_COMMAND_BUFFER_WITH_START_METHOD  8
 
 /*******************************************************************************
  *
Signature · 1 line
1.7.10
author
#86 lore raw

PATCH v2 27/28 ACPICA: Comment update, no functional change.

In reply to Lv Zheng

From: gongzg <[email protected]>

ACPICA commit 1a8ec7b83d55c7b957247d685bd1c73f6a012f1e

Remove redundant comment in nseval.c

---
 drivers/acpi/acpica/nseval.c |    5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/acpi/acpica/nseval.c +2 -3
index a725d88..80670cb 100644
@@ -59,15 +59,14 @@ acpi_ns_exec_module_code(union acpi_operand_object *method_obj,
  *
  * FUNCTION:    acpi_ns_evaluate
  *
- * PARAMETERS:  info            - Evaluation info block, contains:
+ * PARAMETERS:  info            - Evaluation info block, contains these fields
+ *                                and more:
  *                  prefix_node     - Prefix or Method/Object Node to execute
  *                  relative_path   - Name of method to execute, If NULL, the
  *                                    Node is the object to execute
  *                  parameters      - List of parameters to pass to the method,
  *                                    terminated by NULL. Params itself may be
  *                                    NULL if no parameters are being passed.
- *                  return_object   - Where to put method's return value (if
- *                                    any). If NULL, no value is returned.
  *                  parameter_type  - Type of Parameter list
  *                  return_object   - Where to put method's return value (if
  *                                    any). If NULL, no value is returned.
Signature · 1 line
1.7.10
author
#87 lore raw

PATCH v2 28/28 ACPICA: Update version to 20150619.

In reply to Lv Zheng

From: Bob Moore <[email protected]>

ACPICA commit 2fcf4f4c95e6a4875f39a929f8f92ef50cc53bb5 ACPICA commit d7a940bb308d001b5d2b196174fee36c7daa61d6

Version 20150619.

---
 include/acpi/acpixf.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/acpi/acpixf.h +1 -1
index 33b4675..c1e9578 100644
@@ -46,7 +46,7 @@
 
 /* Current ACPICA subsystem version in YYYYMMDD format */
 
-#define ACPI_CA_VERSION                 0x20150515
+#define ACPI_CA_VERSION                 0x20150619
 
 #include <acpi/acconfig.h>
 #include <acpi/actypes.h>
Signature · 1 line
1.7.10
author
#88 lore raw

v3 cover ACPICA: 20150619 Release

In reply to Lv Zheng

The 20150619 ACPICA kernel-resident subsystem updates are linuxized based on the linux-pm/linux-next branch.

The patchset has passed the following build/boot tests. Build tests are performed as follows:
1. i386 + default + COFNIG_ACPI=y
2. i386 + allyes + CONFIG_ACPI=y
3. i386 + default + COFNIG_ACPI=n
4. i386 + allyes + CONFIG_ACPI=n
5. x86_64 + default + COFNIG_ACPI=y
6. x86_64 + allyes + CONFIG_ACPI=y
7. x86_64 + default + COFNIG_ACPI=n
8. x86_64 + allyes + CONFIG_ACPI=n
Boot tests are performed as follows:
1. i386 + default + COFNIG_ACPI=y
2. x86_64 + default + COFNIG_ACPI=y
Where:
1. i386: machine named as "Dell Inspiron Mini 1010"
2. x86_64: machine named as "HP Compaq 8200 Elite SFF PC"
3. default: kernel configuration with following items enabled:
All hardware drivers related to the machines of i386/x86_64 All drivers/acpi configurations
All platform drivers

The divergences checking result:
Before applying (20150515 Release):
565 lines
After applying (20150619 Release):
539 lines

Bob Moore (8):
ACPICA: Namespace: Add support of OSDT table.
ACPICA: Namespace: Change namespace override to avoid node deletion.
ACPICA: Cleanup output for the ASL Debug object.
ACPICA: De-macroize calls to standard C library functions.
ACPICA: Split C library prototypes to new header.
ACPICA: Update definitions for the TCPA and TPM2 ACPI tables.
ACPICA: Update TPM2 ACPI table.
ACPICA: Update version to 20150619.

Hanjun Guo (1):
ACPICA: ACPI 6.0: Add values for MADT GIC version field.

Lv Zheng (13):
ACPICA: Linuxize: Reduce divergences for 20150619 release.
ACPICA: Linuxize: Replace __FUNCTION__ with __func__.
ACPICA: Hardware: Enable 64-bit firmware waking vector for selected
FACS.
ACPICA: Tables: Enable both 32-bit and 64-bit FACS.
ACPICA: Hardware: Enable firmware waking vector for both 32-bit and

    64-bit FACS.

ACPICA: Tables: Fix an issue that FACS initialization is performed
twice.
ACPICA: Tables: Enable default 64-bit FADT addresses favor.
ACPICA: MSVC6: Fix build issue for variable argument macros.
ACPICA: EFI: Add EFI interface definitions to eliminate dependency of
GNU EFI.
ACPICA: Namespace: Add support to allow overriding objects.
ACPICA: acpidump: Allow customized tables to be dumped without
accessing /dev/mem.
ACPICA: acpidump: Convert the default behavior to dump from
/sys/firmware/acpi/tables.
ACPI / acpidump: Update acpidump manual.

Sascha Wildner (1):
ACPICA: Add dragon_fly support to unix file mapping file.

Suravee Suthikulpanit (1):
ACPICA: Utilities: Add _CLS processing

Zhang Rui (1):
ACPICA: Update for acpi_install_table memory types.

gongzg (1):
ACPICA: Comment update, no functional change.

 drivers/acpi/acpica/accommon.h                     |    3 +
 drivers/acpi/acpica/acglobal.h                     |    2 +
 drivers/acpi/acpica/acinterp.h                     |    2 +
 drivers/acpi/acpica/aclocal.h                      |    1 +
 drivers/acpi/acpica/acnamesp.h                     |    1 +
 drivers/acpi/acpica/acobject.h                     |    1 +
 drivers/acpi/acpica/acstruct.h                     |    1 +
 drivers/acpi/acpica/acutils.h                      |   64 +---------
 drivers/acpi/acpica/dsfield.c                      |    2 +-
 drivers/acpi/acpica/dsinit.c                       |    2 +-
 drivers/acpi/acpica/dsobject.c                     |    7 +-
 drivers/acpi/acpica/dsutils.c                      |    4 +-
 drivers/acpi/acpica/dswload.c                      |   17 ++-
 drivers/acpi/acpica/evgpeinit.c                    |    2 +-
 drivers/acpi/acpica/exconfig.c                     |    2 +-
 drivers/acpi/acpica/exconvrt.c                     |    9 +-
 drivers/acpi/acpica/exdebug.c                      |   42 ++++++-
 drivers/acpi/acpica/exdump.c                       |    9 +-
 drivers/acpi/acpica/exfield.c                      |    2 +-
 drivers/acpi/acpica/exfldio.c                      |   52 ++++----
 drivers/acpi/acpica/exmisc.c                       |   36 +++---
 drivers/acpi/acpica/exnames.c                      |    2 +-
 drivers/acpi/acpica/exoparg2.c                     |    8 +-
 drivers/acpi/acpica/exoparg3.c                     |    4 +-
 drivers/acpi/acpica/exregion.c                     |    9 +-
 drivers/acpi/acpica/exstorob.c                     |   18 +--
 drivers/acpi/acpica/exutils.c                      |   32 +++++
 drivers/acpi/acpica/hwxfsleep.c                    |  126 ++++++++++++++++----
 drivers/acpi/acpica/nsaccess.c                     |   16 ++-
 drivers/acpi/acpica/nsconvert.c                    |   10 +-
 drivers/acpi/acpica/nsdump.c                       |    2 +-
 drivers/acpi/acpica/nseval.c                       |    7 +-
 drivers/acpi/acpica/nsinit.c                       |    4 +-
 drivers/acpi/acpica/nsparse.c                      |    7 ++
 drivers/acpi/acpica/nsrepair2.c                    |    2 +-
 drivers/acpi/acpica/nssearch.c                     |   37 +++++-
 drivers/acpi/acpica/nsutils.c                      |    3 +-
 drivers/acpi/acpica/nsxfeval.c                     |    5 +-
 drivers/acpi/acpica/nsxfname.c                     |   29 ++++-
 drivers/acpi/acpica/psutils.c                      |    7 +-
 drivers/acpi/acpica/rscreate.c                     |    6 +-
 drivers/acpi/acpica/rsmisc.c                       |    8 +-
 drivers/acpi/acpica/rsutils.c                      |   13 +-
 drivers/acpi/acpica/rsxface.c                      |    8 +-
 drivers/acpi/acpica/tbdata.c                       |    8 +-
 drivers/acpi/acpica/tbfadt.c                       |   27 +++--
 drivers/acpi/acpica/tbfind.c                       |   21 ++--
 drivers/acpi/acpica/tbinstal.c                     |    7 +-
 drivers/acpi/acpica/tbprint.c                      |   10 +-
 drivers/acpi/acpica/tbutils.c                      |   37 ++++--
 drivers/acpi/acpica/tbxface.c                      |   17 +--
 drivers/acpi/acpica/tbxfload.c                     |   17 ++-
 drivers/acpi/acpica/utalloc.c                      |    6 +-
 drivers/acpi/acpica/utbuffer.c                     |    4 +-
 drivers/acpi/acpica/utcache.c                      |    6 +-
 drivers/acpi/acpica/utcopy.c                       |   42 +++----
 drivers/acpi/acpica/utdebug.c                      |    4 +-
 drivers/acpi/acpica/utids.c                        |  100 +++++++++++++++-
 drivers/acpi/acpica/utmisc.c                       |    9 +-
 drivers/acpi/acpica/utosi.c                        |    9 +-
 drivers/acpi/acpica/utpredef.c                     |    4 +-
 drivers/acpi/acpica/utprint.c                      |    6 +-
 drivers/acpi/acpica/utstring.c                     |   33 +++--
 drivers/acpi/acpica/uttrack.c                      |    8 +-
 drivers/acpi/acpica/utxface.c                      |    8 +-
 drivers/acpi/acpica/utxfinit.c                     |   10 +-
 include/acpi/acnames.h                             |    1 +
 include/acpi/acoutput.h                            |   13 +-
 include/acpi/acpixf.h                              |   28 ++++-
 include/acpi/actbl.h                               |    1 +
 include/acpi/actbl1.h                              |   11 ++
 include/acpi/actbl2.h                              |   80 +++++++++++--
 include/acpi/actbl3.h                              |   34 +-----
 include/acpi/actypes.h                             |   33 +++--
 include/acpi/platform/acenv.h                      |   39 ------
 include/acpi/platform/acenvex.h                    |    6 +
 include/acpi/platform/acgcc.h                      |    4 +
 tools/power/acpi/common/getopt.c                   |    4 +-
 tools/power/acpi/man/acpidump.8                    |   17 ++-
 .../acpi/os_specific/service_layers/oslinuxtbl.c   |   95 ++++++++-------
 .../acpi/os_specific/service_layers/osunixmap.c    |    2 +-
 tools/power/acpi/tools/acpidump/acpidump.h         |    2 +-
 tools/power/acpi/tools/acpidump/apdump.c           |    8 +-
 tools/power/acpi/tools/acpidump/apfiles.c          |   12 +-
 tools/power/acpi/tools/acpidump/apmain.c           |   15 ++-
 85 files changed, 893 insertions(+), 529 deletions(-)
Signature · 1 line
1.7.10
author
#89 lore raw

PATCH v3 1/26 ACPICA: Linuxize: Reduce divergences for 20150619 release.

This patch reduces source code differences between the Linux kernel and the ACPICA upstream so that the linuxized ACPICA 20150619 release can be applied with reduced human intervention.

---
 drivers/acpi/acpica/dsobject.c  |    2 +-
 drivers/acpi/acpica/hwxfsleep.c |    3 +--
 drivers/acpi/acpica/rscreate.c  |    2 +-
 drivers/acpi/acpica/rsutils.c   |    2 +-
 drivers/acpi/acpica/tbxface.c   |    1 +
 include/acpi/platform/acenv.h   |    1 -
 6 files changed, 5 insertions(+), 6 deletions(-)
drivers/acpi/acpica/dsobject.c +1 -1
index 8a7b07b..4a4b2f3 100644
@@ -751,7 +751,7 @@ acpi_ds_init_object_from_op(struct acpi_walk_state *walk_state,
 
 		obj_desc->string.pointer = op->common.value.string;
 		obj_desc->string.length =
-		    (u32) ACPI_STRLEN(op->common.value.string);
+		    (u32)ACPI_STRLEN(op->common.value.string);
 
 		/*
 		 * The string is contained in the ACPI table, don't ever try
drivers/acpi/acpica/hwxfsleep.c +1 -2
index 3b37676..6f171c2 100644
@@ -93,6 +93,7 @@ static struct acpi_sleep_functions acpi_sleep_dispatch[] = {
 
 acpi_status acpi_set_firmware_waking_vector(u32 physical_address)
 {
+
 	ACPI_FUNCTION_TRACE(acpi_set_firmware_waking_vector);
 
 
@@ -138,7 +139,6 @@ acpi_status acpi_set_firmware_waking_vector64(u64 physical_address)
 {
 	ACPI_FUNCTION_TRACE(acpi_set_firmware_waking_vector64);
 
-
 	/* Determine if the 64-bit vector actually exists */
 
 	if ((acpi_gbl_FACS->length <= 32) || (acpi_gbl_FACS->version < 1)) {
@@ -154,7 +154,6 @@ acpi_status acpi_set_firmware_waking_vector64(u64 physical_address)
 
 ACPI_EXPORT_SYMBOL(acpi_set_firmware_waking_vector64)
 #endif
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_enter_sleep_state_s4bios
drivers/acpi/acpica/rscreate.c +1 -1
index 15434e4..f30f35e 100644
@@ -353,7 +353,7 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object,
 				/* +1 to include null terminator */
 
 				user_prt->length +=
-				    (u32) ACPI_STRLEN(user_prt->source) + 1;
+				    (u32)ACPI_STRLEN(user_prt->source) + 1;
 				break;
 
 			case ACPI_TYPE_STRING:
drivers/acpi/acpica/rsutils.c +1 -1
index ece3cd6..90417de 100644
@@ -367,7 +367,7 @@ acpi_rs_get_resource_source(acpi_rs_length resource_length,
 		    (u32)
 		    ACPI_STRLEN(ACPI_CAST_PTR(char, &aml_resource_source[1])) +
 		    1;
-		total_length = (u32) ACPI_ROUND_UP_TO_NATIVE_WORD(total_length);
+		total_length = (u32)ACPI_ROUND_UP_TO_NATIVE_WORD(total_length);
 
 		ACPI_MEMSET(resource_source->string_ptr, 0, total_length);
 
drivers/acpi/acpica/tbxface.c +1 -0
index 60e94f8..54b9f79 100644
@@ -242,6 +242,7 @@ acpi_get_table_header(char *signature,
 				if (!header) {
 					return (AE_NO_MEMORY);
 				}
+
 				ACPI_MEMCPY(out_table_header, header,
 					    sizeof(struct acpi_table_header));
 				acpi_os_unmap_memory(header,
include/acpi/platform/acenv.h +0 -1
index 073997d..1e84e62 100644
@@ -359,7 +359,6 @@
 #define ACPI_MEMCMP(s1,s2,n)    memcmp((const char *)(s1), (const char *)(s2), (acpi_size)(n))
 #define ACPI_MEMCPY(d,s,n)      (void) memcpy((d), (s), (acpi_size)(n))
 #define ACPI_MEMSET(d,s,n)      (void) memset((d), (s), (acpi_size)(n))
-
 #define ACPI_TOUPPER(i)         toupper((int) (i))
 #define ACPI_TOLOWER(i)         tolower((int) (i))
 #define ACPI_IS_XDIGIT(i)       isxdigit((int) (i))
Signature · 1 line
1.7.10
author
#90 lore raw

PATCH v3 2/26 ACPICA: Linuxize: Replace __FUNCTION__ with __func__.

In reply to Lv Zheng

ACPICA commit cb3d1c79f862cd368d749c9b8d9dced40111b0d0

__FUNCTION__ is MSVC only, in Linux, it is __func__. Lv Zheng.

In ACPICA, this is achieved by string replacement in release script and this patch contains the source code difference between the Linux upstream and ACPICA that is caused by the back porting.

---
 drivers/acpi/acpica/utdebug.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/acpi/acpica/utdebug.c +2 -2
index 4f3f888..cd02693 100644
@@ -111,8 +111,8 @@ void acpi_ut_track_stack_ptr(void)
  * RETURN:      Updated pointer to the function name
  *
  * DESCRIPTION: Remove the "Acpi" prefix from the function name, if present.
- *              This allows compiler macros such as __func__ to be used with no
- *              change to the debug output.
+ *              This allows compiler macros such as __func__ to be used
+ *              with no change to the debug output.
  *
  ******************************************************************************/
 
Signature · 1 line
1.7.10
author
#91 lore raw

PATCH v3 3/26 ACPICA: Hardware: Enable 64-bit firmware waking vector for selected FACS.

In reply to Lv Zheng

ACPICA commit 7aa598d711644ab0de5f70ad88f1e2de253115e4

The following commit is reported to have broken s2ram on some platforms:
Commit: 0249ed2444d65d65fc3f3f64f398f1ad0b7e54cd
ACPICA: Add option to favor 32-bit FADT addresses.
The platform reports 2 FACS tables (which is not allowed by ACPI specification) and the new 32-bit address favor rule forces OSPMs to use the FACS table reported via FADT's X_FIRMWARE_CTRL field.

The root cause of the reported bug might be one of the followings:
1. BIOS may favor the 64-bit firmware waking vector address when the version of the FACS is greater than 0 and Linux currently only supports resuming from the real mode, so the 64-bit firmware waking vector has never been set and might be invalid to BIOS while the commit enables higher version FACS.
2. BIOS may favor the FACS reported via the "FIRMWARE_CTRL" field in the FADT while the commit doesn't set the firmware waking vector address of the FACS reported by "FIRMWARE_CTRL", it only sets the firware waking vector address of the FACS reported by "X_FIRMWARE_CTRL".

This patch excludes the cases that can trigger the bugs caused by the root cause 1.

ACPI specification says:
A. 32-bit FACS address (FIRMWARE_CTRL field in FADT):
Physical memory address of the FACS, where OSPM and firmware exchange control information.
If the X_FIRMWARE_CTRL field contains a non zero value then this field must be zero.
A zero value indicates that no FACS is specified by this field.
B. 64-bit FACS address (X_FIRMWARE_CTRL field in FADT):
64bit physical memory address of the FACS.
This field is used when the physical address of the FACS is above 4GB. If the FIRMWARE_CTRL field contains a non zero value then this field must be zero.
A zero value indicates that no FACS is specified by this field.
Thus the 32bit and 64bit firmware waking vector should indicate completely different resuming environment - real mode (1MB addressable) and non real mode (4GB+ addressable) and currently Linux only supports resuming from real mode.

This patch enables 64-bit firmware waking vector for selected FACS via new acpi_set_firmware_waking_vectors() API so that it's up to OSPMs to determine which resuming mode should be used by BIOS and ACPICA changes won't trigger the bugs caused by the root cause 1. Lv Zheng.

---
 drivers/acpi/acpica/hwxfsleep.c |   71 +++++++++++++++++++++++++++++----------
 include/acpi/acpixf.h           |    8 +++--
 2 files changed, 59 insertions(+), 20 deletions(-)
drivers/acpi/acpica/hwxfsleep.c +53 -18
index 6f171c2..510bd326 100644
@@ -72,6 +72,7 @@ static struct acpi_sleep_functions acpi_sleep_dispatch[] = {
 
 /*
  * 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
@@ -80,21 +81,25 @@ static struct acpi_sleep_functions acpi_sleep_dispatch[] = {
 #if (!ACPI_REDUCED_HARDWARE)
 /*******************************************************************************
  *
- * FUNCTION:    acpi_set_firmware_waking_vector
+ * FUNCTION:    acpi_set_firmware_waking_vectors
  *
  * PARAMETERS:  physical_address    - 32-bit physical address of ACPI real mode
  *                                    entry point.
+ *              physical_address64  - 64-bit physical address of ACPI protected
+ *                                    mode entry point.
  *
  * RETURN:      Status
  *
- * DESCRIPTION: Sets the 32-bit firmware_waking_vector field of the FACS
+ * DESCRIPTION: Sets the firmware_waking_vector fields of the FACS
  *
  ******************************************************************************/
 
-acpi_status acpi_set_firmware_waking_vector(u32 physical_address)
+acpi_status
+acpi_set_firmware_waking_vectors(acpi_physical_address physical_address,
+				 acpi_physical_address physical_address64)
 {
 
-	ACPI_FUNCTION_TRACE(acpi_set_firmware_waking_vector);
+	ACPI_FUNCTION_TRACE(acpi_set_firmware_waking_vectors);
 
 
 	/*
@@ -107,17 +112,51 @@ acpi_status acpi_set_firmware_waking_vector(u32 physical_address)
 
 	/* Set the 32-bit vector */
 
-	acpi_gbl_FACS->firmware_waking_vector = physical_address;
+	acpi_gbl_FACS->firmware_waking_vector = (u32)physical_address;
 
-	/* Clear the 64-bit vector if it exists */
+	if (acpi_gbl_FACS->length > 32) {
+		if (acpi_gbl_FACS->version >= 1) {
 
-	if ((acpi_gbl_FACS->length > 32) && (acpi_gbl_FACS->version >= 1)) {
-		acpi_gbl_FACS->xfirmware_waking_vector = 0;
+			/* Set the 64-bit vector */
+
+			acpi_gbl_FACS->xfirmware_waking_vector =
+			    physical_address64;
+		} else {
+			/* Clear the 64-bit vector if it exists */
+
+			acpi_gbl_FACS->xfirmware_waking_vector = 0;
+		}
 	}
 
 	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
@@ -137,19 +176,15 @@ ACPI_EXPORT_SYMBOL(acpi_set_firmware_waking_vector)
  ******************************************************************************/
 acpi_status acpi_set_firmware_waking_vector64(u64 physical_address)
 {
-	ACPI_FUNCTION_TRACE(acpi_set_firmware_waking_vector64);
-
-	/* Determine if the 64-bit vector actually exists */
+	acpi_status status;
 
-	if ((acpi_gbl_FACS->length <= 32) || (acpi_gbl_FACS->version < 1)) {
-		return_ACPI_STATUS(AE_NOT_EXIST);
-	}
+	ACPI_FUNCTION_TRACE(acpi_set_firmware_waking_vector64);
 
-	/* Clear 32-bit vector, set the 64-bit X_ vector */
+	status = acpi_set_firmware_waking_vectors(0,
+						  (acpi_physical_address)
+						  physical_address);
 
-	acpi_gbl_FACS->firmware_waking_vector = 0;
-	acpi_gbl_FACS->xfirmware_waking_vector = physical_address;
-	return_ACPI_STATUS(AE_OK);
+	return_ACPI_STATUS(status);
 }
 
 ACPI_EXPORT_SYMBOL(acpi_set_firmware_waking_vector64)
include/acpi/acpixf.h +6 -2
index d68f1cd..821095c 100644
@@ -814,8 +814,12 @@ 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_vector(u32
-								physical_address))
+				acpi_set_firmware_waking_vectors
+				(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
Signature · 1 line
1.7.10
author
#92 lore raw

PATCH v3 4/26 ACPICA: Tables: Enable both 32-bit and 64-bit FACS.

In reply to Lv Zheng

ACPICA commit f7b86f35416e3d1f71c3d816ff5075ddd33ed486

The following commit is reported to have broken s2ram on some platforms:
Commit: 0249ed2444d65d65fc3f3f64f398f1ad0b7e54cd
ACPICA: Add option to favor 32-bit FADT addresses.
The platform reports 2 FACS tables (which is not allowed by ACPI specification) and the new 32-bit address favor rule forces OSPMs to use the FACS table reported via FADT's X_FIRMWARE_CTRL field.

The root cause of the reported bug might be one of the followings:
1. BIOS may favor the 64-bit firmware waking vector address when the version of the FACS is greater than 0 and Linux currently only supports resuming from the real mode, so the 64-bit firmware waking vector has never been set and might be invalid to BIOS while the commit enables higher version FACS.
2. BIOS may favor the FACS reported via the "FIRMWARE_CTRL" field in the FADT while the commit doesn't set the firmware waking vector address of the FACS reported by "FIRMWARE_CTRL", it only sets the firware waking vector address of the FACS reported by "X_FIRMWARE_CTRL".

This patch excludes the cases that can trigger the bugs caused by the root cause 2.

There is no handshaking mechanism can be used by OSPM to tell BIOS which FACS is currently used. Thus the FACS reported by "FIRMWARE_CTRL" may still be used by BIOS and the 0 value of the 32-bit firmware waking vector might trigger such failure.

This patch tries to favor 32bit FACS address in another way where both the FACS reported by "FIRMWARE_CTRL" and the FACS reported by "X_FIRMWARE_CTRL" are loaded so that further commit can set firmware waking vector in the both tables to ensure we can exclude the cases that trigger the bugs caused by the root cause 2. The exclusion is split into 2 commits as this commit is also useful for dumping more ACPI tables, it won't get reverted when such exclusion is no longer necessary. Lv Zheng.

---
 drivers/acpi/acpica/aclocal.h  |    1 +
 drivers/acpi/acpica/tbfadt.c   |   21 +++++++++++++--------
 drivers/acpi/acpica/tbutils.c  |   34 +++++++++++++++++++++++-----------
 drivers/acpi/acpica/tbxfload.c |    3 ++-
 include/acpi/acpixf.h          |    9 +++++++++
 5 files changed, 48 insertions(+), 20 deletions(-)
drivers/acpi/acpica/aclocal.h +1 -0
index ffdb956..bc60096 100644
@@ -213,6 +213,7 @@ struct acpi_table_list {
 
 #define ACPI_TABLE_INDEX_DSDT           (0)
 #define ACPI_TABLE_INDEX_FACS           (1)
+#define ACPI_TABLE_INDEX_X_FACS         (2)
 
 struct acpi_find_context {
 	char *search_for;
drivers/acpi/acpica/tbfadt.c +13 -8
index 7d24860..05be59c 100644
@@ -350,9 +350,18 @@ void acpi_tb_parse_fadt(u32 table_index)
 	/* If Hardware Reduced flag is set, there is no FACS */
 
 	if (!acpi_gbl_reduced_hardware) {
-		acpi_tb_install_fixed_table((acpi_physical_address)
-					    acpi_gbl_FADT.Xfacs, ACPI_SIG_FACS,
-					    ACPI_TABLE_INDEX_FACS);
+		if (acpi_gbl_FADT.facs) {
+			acpi_tb_install_fixed_table((acpi_physical_address)
+						    acpi_gbl_FADT.facs,
+						    ACPI_SIG_FACS,
+						    ACPI_TABLE_INDEX_FACS);
+		}
+		if (acpi_gbl_FADT.Xfacs) {
+			acpi_tb_install_fixed_table((acpi_physical_address)
+						    acpi_gbl_FADT.Xfacs,
+						    ACPI_SIG_FACS,
+						    ACPI_TABLE_INDEX_X_FACS);
+		}
 	}
 }
 
@@ -491,13 +500,9 @@ static void acpi_tb_convert_fadt(void)
 	acpi_gbl_FADT.header.length = sizeof(struct acpi_table_fadt);
 
 	/*
-	 * Expand the 32-bit FACS and DSDT addresses to 64-bit as necessary.
+	 * Expand the 32-bit DSDT addresses to 64-bit as necessary.
 	 * Later ACPICA code will always use the X 64-bit field.
 	 */
-	acpi_gbl_FADT.Xfacs = acpi_tb_select_address("FACS",
-						     acpi_gbl_FADT.facs,
-						     acpi_gbl_FADT.Xfacs);
-
 	acpi_gbl_FADT.Xdsdt = acpi_tb_select_address("DSDT",
 						     acpi_gbl_FADT.dsdt,
 						     acpi_gbl_FADT.Xdsdt);
drivers/acpi/acpica/tbutils.c +23 -11
index 6559a58..2fb1afa 100644
@@ -68,7 +68,8 @@ acpi_tb_get_root_table_entry(u8 *table_entry, u32 table_entry_size);
 
 acpi_status acpi_tb_initialize_facs(void)
 {
-	acpi_status status;
+	struct acpi_table_facs *facs32;
+	struct acpi_table_facs *facs64;
 
 	/* If Hardware Reduced flag is set, there is no FACS */
 
@@ -77,11 +78,22 @@ acpi_status acpi_tb_initialize_facs(void)
 		return (AE_OK);
 	}
 
-	status = acpi_get_table_by_index(ACPI_TABLE_INDEX_FACS,
-					 ACPI_CAST_INDIRECT_PTR(struct
-								acpi_table_header,
-								&acpi_gbl_FACS));
-	return (status);
+	(void)acpi_get_table_by_index(ACPI_TABLE_INDEX_FACS,
+				      ACPI_CAST_INDIRECT_PTR(struct
+							     acpi_table_header,
+							     &facs32));
+	(void)acpi_get_table_by_index(ACPI_TABLE_INDEX_X_FACS,
+				      ACPI_CAST_INDIRECT_PTR(struct
+							     acpi_table_header,
+							     &facs64));
+
+	if (acpi_gbl_use32_bit_facs_addresses) {
+		acpi_gbl_FACS = facs32 ? facs32 : facs64;
+	} else {
+		acpi_gbl_FACS = facs64 ? facs64 : facs32;
+	}
+
+	return (AE_OK);
 }
 #endif				/* !ACPI_REDUCED_HARDWARE */
 
@@ -101,7 +113,7 @@ acpi_status acpi_tb_initialize_facs(void)
 u8 acpi_tb_tables_loaded(void)
 {
 
-	if (acpi_gbl_root_table_list.current_table_count >= 3) {
+	if (acpi_gbl_root_table_list.current_table_count >= 4) {
 		return (TRUE);
 	}
 
@@ -357,11 +369,11 @@ acpi_status __init acpi_tb_parse_root_table(acpi_physical_address rsdp_address)
 	table_entry = ACPI_ADD_PTR(u8, table, sizeof(struct acpi_table_header));
 
 	/*
-	 * First two entries in the table array are reserved for the DSDT
-	 * and FACS, which are not actually present in the RSDT/XSDT - they
-	 * come from the FADT
+	 * First three entries in the table array are reserved for the DSDT
+	 * and 32bit/64bit FACS, which are not actually present in the
+	 * RSDT/XSDT - they come from the FADT
 	 */
-	acpi_gbl_root_table_list.current_table_count = 2;
+	acpi_gbl_root_table_list.current_table_count = 3;
 
 	/* Initialize the root table array from the RSDT/XSDT */
 
drivers/acpi/acpica/tbxfload.c +2 -1
index aadb300..b63e35d 100644
@@ -166,7 +166,8 @@ static acpi_status acpi_tb_load_namespace(void)
 
 	(void)acpi_ut_acquire_mutex(ACPI_MTX_TABLES);
 	for (i = 0; i < acpi_gbl_root_table_list.current_table_count; ++i) {
-		if ((!ACPI_COMPARE_NAME
+		if (!acpi_gbl_root_table_list.tables[i].address ||
+		    (!ACPI_COMPARE_NAME
 		     (&(acpi_gbl_root_table_list.tables[i].signature),
 		      ACPI_SIG_SSDT)
 		     &&
include/acpi/acpixf.h +9 -0
index 821095c..445fd1e 100644
@@ -200,6 +200,15 @@ ACPI_INIT_GLOBAL(u8, acpi_gbl_do_not_use_xsdt, FALSE);
 ACPI_INIT_GLOBAL(u8, acpi_gbl_use32_bit_fadt_addresses, TRUE);
 
 /*
+ * Optionally use 32-bit FACS table addresses.
+ * It is reported that some platforms fail to resume from system suspending
+ * if 64-bit FACS table address is selected:
+ * https://bugzilla.kernel.org/show_bug.cgi?id=74021
+ * Default is TRUE, favor the 32-bit addresses.
+ */
+ACPI_INIT_GLOBAL(u8, acpi_gbl_use32_bit_facs_addresses, TRUE);
+
+/*
  * Optionally truncate I/O addresses to 16 bits. Provides compatibility
  * with other ACPI implementations. NOTE: During ACPICA initialization,
  * this value is set to TRUE if any Windows OSI strings have been
Signature · 1 line
1.7.10
author
#93 lore raw

PATCH v3 5/26 ACPICA: Hardware: Enable firmware waking vector for both 32-bit and 64-bit FACS.

In reply to Lv Zheng

ACPICA commit 368eb60778b27b6ae94d3658ddc902ca1342a963 ACPICA commit 70f62a80d65515e1285fdeeb50d94ee6f07df4bd ACPICA commit a04dbfa308a48ab0b2d10519c54a6c533c5c8949 ACPICA commit ebd544ed24c5a4faba11f265e228b7a821a729f5

The following commit is reported to have broken s2ram on some platforms:
Commit: 0249ed2444d65d65fc3f3f64f398f1ad0b7e54cd
ACPICA: Add option to favor 32-bit FADT addresses.
The platform reports 2 FACS tables (which is not allowed by ACPI specification) and the new 32-bit address favor rule forces OSPMs to use the FACS table reported via FADT's X_FIRMWARE_CTRL field.

The root cause of the reported bug might be one of the followings:
1. BIOS may favor the 64-bit firmware waking vector address when the version of the FACS is greater than 0 and Linux currently only supports resuming from the real mode, so the 64-bit firmware waking vector has never been set and might be invalid to BIOS while the commit enables higher version FACS.
2. BIOS may favor the FACS reported via the "FIRMWARE_CTRL" field in the FADT while the commit doesn't set the firmware waking vector address of the FACS reported by "FIRMWARE_CTRL", it only sets the firware waking vector address of the FACS reported by "X_FIRMWARE_CTRL".

This patch excludes the cases that can trigger the bugs caused by the root cause 2.

There is no handshaking mechanism can be used by OSPM to tell BIOS which FACS is currently used. Thus the FACS reported by "FIRMWARE_CTRL" may still be used by BIOS and the 0 value of the 32-bit firmware waking vector might trigger such failure.

This patch enables the firmware waking vectors for both 32bit/64bit FACS tables in order to ensure we can exclude the cases that trigger the bugs caused by the root cause 2. The exclusion is split into 2 commits so that if it turns out not to be necessary, this single commit can be reverted without affecting the useful one. Lv Zheng, Bob Moore.

---
 drivers/acpi/acpica/acglobal.h  |    2 ++
 drivers/acpi/acpica/hwxfsleep.c |   74 ++++++++++++++++++++++++++++++++-------
 drivers/acpi/acpica/tbutils.c   |   17 ++++-----
 3 files changed, 73 insertions(+), 20 deletions(-)
drivers/acpi/acpica/acglobal.h +2 -0
index a0c4787..53f96a3 100644
@@ -61,6 +61,8 @@ ACPI_GLOBAL(struct acpi_table_header, acpi_gbl_original_dsdt_header);
 
 #if (!ACPI_REDUCED_HARDWARE)
 ACPI_GLOBAL(struct acpi_table_facs *, acpi_gbl_FACS);
+ACPI_GLOBAL(struct acpi_table_facs *, acpi_gbl_facs32);
+ACPI_GLOBAL(struct acpi_table_facs *, acpi_gbl_facs64);
 
 #endif				/* !ACPI_REDUCED_HARDWARE */
 
drivers/acpi/acpica/hwxfsleep.c +62 -12

114 lines not on this page · raw message

drivers/acpi/acpica/tbutils.c +9 -8
index 2fb1afa..2bb6a11 100644
@@ -68,8 +68,6 @@ acpi_tb_get_root_table_entry(u8 *table_entry, u32 table_entry_size);
 
 acpi_status acpi_tb_initialize_facs(void)
 {
-	struct acpi_table_facs *facs32;
-	struct acpi_table_facs *facs64;
 
 	/* If Hardware Reduced flag is set, there is no FACS */
 
@@ -81,18 +79,21 @@ acpi_status acpi_tb_initialize_facs(void)
 	(void)acpi_get_table_by_index(ACPI_TABLE_INDEX_FACS,
 				      ACPI_CAST_INDIRECT_PTR(struct
 							     acpi_table_header,
-							     &facs32));
+							     &acpi_gbl_facs32));
 	(void)acpi_get_table_by_index(ACPI_TABLE_INDEX_X_FACS,
 				      ACPI_CAST_INDIRECT_PTR(struct
 							     acpi_table_header,
-							     &facs64));
+							     &acpi_gbl_facs64));
 
-	if (acpi_gbl_use32_bit_facs_addresses) {
-		acpi_gbl_FACS = facs32 ? facs32 : facs64;
-	} else {
-		acpi_gbl_FACS = facs64 ? facs64 : facs32;
+	if (acpi_gbl_facs64
+	    && (!acpi_gbl_facs32 || !acpi_gbl_use32_bit_facs_addresses)) {
+		acpi_gbl_FACS = acpi_gbl_facs64;
+	} else if (acpi_gbl_facs32) {
+		acpi_gbl_FACS = acpi_gbl_facs32;
 	}
 
+	/* If there is no FACS, just continue. There was already an error msg */
+
 	return (AE_OK);
 }
 #endif				/* !ACPI_REDUCED_HARDWARE */
Signature · 1 line
1.7.10
author
#94 lore raw

PATCH v3 6/26 ACPICA: Tables: Fix an issue that FACS initialization is performed twice.

In reply to Lv Zheng

ACPICA commit 90f5332a15e9d9ba83831ca700b2b9f708274658

This patch adds a new FACS initialization flag for acpi_tb_initialize(). acpi_enable_subsystem() might be invoked several times in OS bootup process, and we don't want FACS initialization to be invoked twice. Lv Zheng.

---
 drivers/acpi/acpica/utxfinit.c |   10 ++++++----
 include/acpi/actypes.h         |    1 +
 2 files changed, 7 insertions(+), 4 deletions(-)
drivers/acpi/acpica/utxfinit.c +6 -4
index 083a768..42a32a6 100644
@@ -179,10 +179,12 @@ acpi_status __init acpi_enable_subsystem(u32 flags)
 	 * Obtain a permanent mapping for the FACS. This is required for the
 	 * Global Lock and the Firmware Waking Vector
 	 */
-	status = acpi_tb_initialize_facs();
-	if (ACPI_FAILURE(status)) {
-		ACPI_WARNING((AE_INFO, "Could not map the FACS table"));
-		return_ACPI_STATUS(status);
+	if (!(flags & ACPI_NO_FACS_INIT)) {
+		status = acpi_tb_initialize_facs();
+		if (ACPI_FAILURE(status)) {
+			ACPI_WARNING((AE_INFO, "Could not map the FACS table"));
+			return_ACPI_STATUS(status);
+		}
 	}
 #endif				/* !ACPI_REDUCED_HARDWARE */
 
include/acpi/actypes.h +1 -0
index 63fd7f5..ff0b53e 100644
@@ -568,6 +568,7 @@ typedef u64 acpi_integer;
 #define ACPI_NO_ACPI_ENABLE             0x10
 #define ACPI_NO_DEVICE_INIT             0x20
 #define ACPI_NO_OBJECT_INIT             0x40
+#define ACPI_NO_FACS_INIT               0x80
 
 /*
  * Initialization state
Signature · 1 line
1.7.10
author
#95 lore raw

PATCH v3 7/26 ACPICA: Tables: Enable default 64-bit FADT addresses favor.

In reply to Lv Zheng

ACPICA commit 4da56eeae0749dfe8491285c1e1fad48f6efafd8

The following commit temporarily disables correct 64-bit FADT addresses favor during the period the root cause of the bug is not fixed:
Commit: 85dbd5801f62b66e2aa7826aaefcaebead44c8a6
ACPICA: Tables: Restore old behavor to favor 32-bit FADT addresses.

With enough protections, this patch re-enables 64-bit FADT addresses by default. If regressions are reported against such change, this patch should be bisected and reverted.
Note that 64-bit FACS favor and 64-bit firmware waking vector favor are excluded by this commit in order not to break OSPMs. Lv Zheng.

---
 include/acpi/acpixf.h |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
include/acpi/acpixf.h +2 -2
index 445fd1e..213ed7e 100644
@@ -195,9 +195,9 @@ ACPI_INIT_GLOBAL(u8, acpi_gbl_do_not_use_xsdt, FALSE);
  * address. Although ACPICA adheres to the ACPI specification which
  * requires the use of the corresponding 64-bit address if it is non-zero,
  * some machines have been found to have a corrupted non-zero 64-bit
- * address. Default is TRUE, favor the 32-bit addresses.
+ * address. Default is FALSE, do not favor the 32-bit addresses.
  */
-ACPI_INIT_GLOBAL(u8, acpi_gbl_use32_bit_fadt_addresses, TRUE);
+ACPI_INIT_GLOBAL(u8, acpi_gbl_use32_bit_fadt_addresses, FALSE);
 
 /*
  * Optionally use 32-bit FACS table addresses.
Signature · 1 line
1.7.10
author
#96 lore raw

PATCH v3 8/26 ACPICA: MSVC6: Fix build issue for variable argument macros.

In reply to Lv Zheng

ACPICA commit 72f5a358f28c5d154ed613c142c7dca03192c5ee

This patch intoduces generic variable macro detection support and fixes build breakage issue with macros using __VA_ARGS__ feature defined in C99.

This patch fixes this build issue. Lv Zheng.

This patch doesn't affect Linux kernel.

---
 include/acpi/acoutput.h       |   13 +++++++++++--
 include/acpi/platform/acgcc.h |    4 ++++
 2 files changed, 15 insertions(+), 2 deletions(-)
include/acpi/acoutput.h +11 -2
index a8f3443..f56de8c 100644
@@ -294,8 +294,12 @@
 
 /* DEBUG_PRINT functions */
 
-#define ACPI_DEBUG_PRINT(plist)         ACPI_ACTUAL_DEBUG plist
-#define ACPI_DEBUG_PRINT_RAW(plist)     ACPI_ACTUAL_DEBUG_RAW plist
+#ifndef COMPILER_VA_MACRO
+
+#define ACPI_DEBUG_PRINT(plist)         acpi_debug_print plist
+#define ACPI_DEBUG_PRINT_RAW(plist)     acpi_debug_print_raw plist
+
+#else
 
 /* Helper macros for DEBUG_PRINT */
 
@@ -315,6 +319,11 @@
 	ACPI_DO_DEBUG_PRINT (acpi_debug_print_raw, level, line, \
 		filename, modulename, component, __VA_ARGS__)
 
+#define ACPI_DEBUG_PRINT(plist)         ACPI_ACTUAL_DEBUG plist
+#define ACPI_DEBUG_PRINT_RAW(plist)     ACPI_ACTUAL_DEBUG_RAW plist
+
+#endif
+
 /*
  * Function entry tracing
  *
include/acpi/platform/acgcc.h +4 -0
index f54de0a..5457a06 100644
@@ -75,4 +75,8 @@
 #undef strchr
 #endif
 
+/* GCC supports __VA_ARGS__ in macros */
+
+#define COMPILER_VA_MACRO               1
+
 #endif				/* __ACGCC_H__ */
Signature · 1 line
1.7.10
author
#97 lore raw

PATCH v3 9/26 ACPICA: EFI: Add EFI interface definitions to eliminate dependency of GNU EFI.

In reply to Lv Zheng

ACPICA commit 5d00e67a74542d030f0a55e7a947a020ef0d9693

This patch copies EFI interface definitions to the ACPICA code base so that the EFI utility support can be ported to other EFI implementation.

Known issues:
1. MS Builds of uefi_call_wrapper()
The uefi_call_wrapper() in GNU EFI is implemented in a the way to work around the ABI difference between Unix and MS. While I don't have environment to test the MS builds.

In order to port the ACPICA utilities to other EFI implementation, all that need to be done is to impelement the 64-bit division support and the program entry point where the efi_main() is invoked. Code to impelement these is platform specific, and ACPICA currently choose to hide such platform specific code within the specific EFI impelementation. Lv Zheng.

This patch doesn't affect Linux kernel.

---
 include/acpi/platform/acenvex.h |    6 ++++++
 1 file changed, 6 insertions(+)
include/acpi/platform/acenvex.h +6 -0
index 14dc6f6..0a7dc8e 100644
@@ -56,6 +56,12 @@
 #if defined(_LINUX) || defined(__linux__)
 #include <acpi/platform/aclinuxex.h>
 
+#elif defined(_AED_EFI)
+#include "acefiex.h"
+
+#elif defined(_GNU_EFI)
+#include "acefiex.h"
+
 #elif defined(__DragonFly__)
 #include "acdragonflyex.h"
 
Signature · 1 line
1.7.10
author
#98 lore raw

PATCH v3 10/26 ACPICA: Add dragon_fly support to unix file mapping file.

In reply to Lv Zheng

From: Sascha Wildner <[email protected]>

ACPICA commit 795b215d6fd062386f0a1c23dff9ffa244683c4f

ACPICA BZ 1130

This patch doesn't affect Linux kernel.

---
 tools/power/acpi/os_specific/service_layers/osunixmap.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/power/acpi/os_specific/service_layers/osunixmap.c +1 -1
index 0b1fa29..44ad488 100644
@@ -54,7 +54,7 @@ ACPI_MODULE_NAME("osunixmap")
 #ifndef O_BINARY
 #define O_BINARY 0
 #endif
-#ifdef _free_BSD
+#if defined(_dragon_fly) || defined(_free_BSD)
 #define MMAP_FLAGS          MAP_SHARED
 #else
 #define MMAP_FLAGS          MAP_PRIVATE
Signature · 1 line
1.7.10
author
#99 lore raw

PATCH v3 11/26 ACPICA: Utilities: Add _CLS processing

In reply to Lv Zheng

From: Suravee Suthikulpanit <[email protected]>

ACPICA commit 9a2b638acb3a7215209432e070c6bd0312374229

ACPI Device object often contains a _CLS object to supply PCI-defined class code for the device. This patch introduces logic to process the _CLS object. Suravee Suthikulpanit, Lv Zheng.

---
 drivers/acpi/acpica/acinterp.h |    2 +
 drivers/acpi/acpica/acutils.h  |    4 ++
 drivers/acpi/acpica/exutils.c  |   32 ++++++++++++++
 drivers/acpi/acpica/nsxfname.c |   23 ++++++++--
 drivers/acpi/acpica/utids.c    |   91 +++++++++++++++++++++++++++++++++++++++-
 include/acpi/acnames.h         |    1 +
 include/acpi/actypes.h         |   24 +++++++----
 7 files changed, 164 insertions(+), 13 deletions(-)
drivers/acpi/acpica/acinterp.h +2 -0
index 1886bde..7ac9800 100644
@@ -468,6 +468,8 @@ void acpi_ex_eisa_id_to_string(char *dest, u64 compressed_id);
 
 void acpi_ex_integer_to_string(char *dest, u64 value);
 
+void acpi_ex_pci_cls_to_string(char *dest, u8 class_code[3]);
+
 u8 acpi_is_valid_space_id(u8 space_id);
 
 /*
drivers/acpi/acpica/acutils.h +4 -0
index d49f5c7..6391c97 100644
@@ -430,6 +430,10 @@ acpi_status
 acpi_ut_execute_CID(struct acpi_namespace_node *device_node,
 		    struct acpi_pnp_device_id_list ** return_cid_list);
 
+acpi_status
+acpi_ut_execute_CLS(struct acpi_namespace_node *device_node,
+		    struct acpi_pnp_device_id **return_id);
+
 /*
  * utlock - reader/writer locks
  */
drivers/acpi/acpica/exutils.c +32 -0
index 3f4225e..30c3f46 100644
@@ -380,6 +380,38 @@ void acpi_ex_integer_to_string(char *out_string, u64 value)
 
 /*******************************************************************************
  *
+ * FUNCTION:    acpi_ex_pci_cls_to_string
+ *
+ * PARAMETERS:  out_string      - Where to put the converted string (7 bytes)
+ * PARAMETERS:  class_code      - PCI class code to be converted (3 bytes)
+ *
+ * RETURN:      None
+ *
+ * DESCRIPTION: Convert 3-bytes PCI class code to string representation.
+ *              Return buffer must be large enough to hold the string. The
+ *              string returned is always exactly of length
+ *              ACPI_PCICLS_STRING_SIZE (includes null terminator).
+ *
+ ******************************************************************************/
+
+void acpi_ex_pci_cls_to_string(char *out_string, u8 class_code[3])
+{
+
+	ACPI_FUNCTION_ENTRY();
+
+	/* All 3 bytes are hexadecimal */
+
+	out_string[0] = acpi_ut_hex_to_ascii_char((u64)class_code[0], 4);
+	out_string[1] = acpi_ut_hex_to_ascii_char((u64)class_code[0], 0);
+	out_string[2] = acpi_ut_hex_to_ascii_char((u64)class_code[1], 4);
+	out_string[3] = acpi_ut_hex_to_ascii_char((u64)class_code[1], 0);
+	out_string[4] = acpi_ut_hex_to_ascii_char((u64)class_code[2], 4);
+	out_string[5] = acpi_ut_hex_to_ascii_char((u64)class_code[2], 0);
+	out_string[6] = 0;
+}
+
+/*******************************************************************************
+ *
  * FUNCTION:    acpi_is_valid_space_id
  *
  * PARAMETERS:  space_id            - ID to be validated
drivers/acpi/acpica/nsxfname.c +20 -3
index d66c326..dc0836a 100644
@@ -260,7 +260,7 @@ static char *acpi_ns_copy_device_id(struct acpi_pnp_device_id *dest,
  *              control methods (Such as in the case of a device.)
  *
  * For Device and Processor objects, run the Device _HID, _UID, _CID, _SUB,
- * _STA, _ADR, _sx_w, and _sx_d methods.
+ * _CLS, _STA, _ADR, _sx_w, and _sx_d methods.
  *
  * Note: Allocates the return buffer, must be freed by the caller.
  *
@@ -276,11 +276,12 @@ acpi_get_object_info(acpi_handle handle,
 	struct acpi_pnp_device_id *hid = NULL;
 	struct acpi_pnp_device_id *uid = NULL;
 	struct acpi_pnp_device_id *sub = NULL;
+	struct acpi_pnp_device_id *cls = NULL;
 	char *next_id_string;
 	acpi_object_type type;
 	acpi_name name;
 	u8 param_count = 0;
-	u8 valid = 0;
+	u16 valid = 0;
 	u32 info_size;
 	u32 i;
 	acpi_status status;
@@ -320,7 +321,7 @@ acpi_get_object_info(acpi_handle handle,
 	if ((type == ACPI_TYPE_DEVICE) || (type == ACPI_TYPE_PROCESSOR)) {
 		/*
 		 * Get extra info for ACPI Device/Processor objects only:
-		 * Run the Device _HID, _UID, _SUB, and _CID methods.
+		 * Run the Device _HID, _UID, _SUB, _CID, and _CLS methods.
 		 *
 		 * Note: none of these methods are required, so they may or may
 		 * not be present for this device. The Info->Valid bitfield is used
@@ -363,6 +364,14 @@ acpi_get_object_info(acpi_handle handle,
 			     sizeof(struct acpi_pnp_device_id_list));
 			valid |= ACPI_VALID_CID;
 		}
+
+		/* Execute the Device._CLS method */
+
+		status = acpi_ut_execute_CLS(node, &cls);
+		if (ACPI_SUCCESS(status)) {
+			info_size += cls->length;
+			valid |= ACPI_VALID_CLS;
+		}
 	}
 
 	/*
@@ -486,6 +495,11 @@ acpi_get_object_info(acpi_handle handle,
 		}
 	}
 
+	if (cls) {
+		next_id_string = acpi_ns_copy_device_id(&info->class_code,
+							cls, next_id_string);
+	}
+
 	/* Copy the fixed-length data */
 
 	info->info_size = info_size;
@@ -510,6 +524,9 @@ cleanup:
 	if (cid_list) {
 		ACPI_FREE(cid_list);
 	}
+	if (cls) {
+		ACPI_FREE(cls);
+	}
 	return (status);
 }
 
drivers/acpi/acpica/utids.c +90 -1

99 lines not on this page · raw message

include/acpi/acnames.h +1 -0
index 273de70..b52c0dc 100644
@@ -51,6 +51,7 @@
 #define METHOD_NAME__BBN        "_BBN"
 #define METHOD_NAME__CBA        "_CBA"
 #define METHOD_NAME__CID        "_CID"
+#define METHOD_NAME__CLS        "_CLS"
 #define METHOD_NAME__CRS        "_CRS"
 #define METHOD_NAME__DDN        "_DDN"
 #define METHOD_NAME__HID        "_HID"
include/acpi/actypes.h +15 -9
index ff0b53e..d791b98 100644
@@ -1141,6 +1141,10 @@ u32 (*acpi_interface_handler) (acpi_string interface_name, u32 supported);
 
 #define ACPI_UUID_LENGTH                16
 
+/* Length of 3-byte PCI class code values when converted back to a string */
+
+#define ACPI_PCICLS_STRING_SIZE         7	/* Includes null terminator */
+
 /* Structures used for device/processor HID, UID, CID, and SUB */
 
 struct acpi_pnp_device_id {
@@ -1163,7 +1167,7 @@ struct acpi_device_info {
 	u32 name;		/* ACPI object Name */
 	acpi_object_type type;	/* ACPI object Type */
 	u8 param_count;		/* If a method, required parameter count */
-	u8 valid;		/* Indicates which optional fields are valid */
+	u16 valid;		/* Indicates which optional fields are valid */
 	u8 flags;		/* Miscellaneous info */
 	u8 highest_dstates[4];	/* _sx_d values: 0xFF indicates not valid */
 	u8 lowest_dstates[5];	/* _sx_w values: 0xFF indicates not valid */
@@ -1172,6 +1176,7 @@ struct acpi_device_info {
 	struct acpi_pnp_device_id hardware_id;	/* _HID value */
 	struct acpi_pnp_device_id unique_id;	/* _UID value */
 	struct acpi_pnp_device_id subsystem_id;	/* _SUB value */
+	struct acpi_pnp_device_id class_code;	/* _CLS value */
 	struct acpi_pnp_device_id_list compatible_id_list;	/* _CID list <must be last> */
 };
 
@@ -1181,14 +1186,15 @@ struct acpi_device_info {
 
 /* Flags for Valid field above (acpi_get_object_info) */
 
-#define ACPI_VALID_STA                  0x01
-#define ACPI_VALID_ADR                  0x02
-#define ACPI_VALID_HID                  0x04
-#define ACPI_VALID_UID                  0x08
-#define ACPI_VALID_SUB                  0x10
-#define ACPI_VALID_CID                  0x20
-#define ACPI_VALID_SXDS                 0x40
-#define ACPI_VALID_SXWS                 0x80
+#define ACPI_VALID_STA                  0x0001
+#define ACPI_VALID_ADR                  0x0002
+#define ACPI_VALID_HID                  0x0004
+#define ACPI_VALID_UID                  0x0008
+#define ACPI_VALID_SUB                  0x0010
+#define ACPI_VALID_CID                  0x0020
+#define ACPI_VALID_CLS                  0x0040
+#define ACPI_VALID_SXDS                 0x0100
+#define ACPI_VALID_SXWS                 0x0200
 
 /* Flags for _STA return value (current_status above) */
 
Signature · 1 line
1.7.10