linux-acpi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/9] ACPICA 20130725 Release
@ 2013-08-08  7:29 Lv Zheng
  2013-08-08  7:29 ` [PATCH 1/9] ACPICA: Export acpi_tb_validate_rsdp() Lv Zheng
                   ` (8 more replies)
  0 siblings, 9 replies; 12+ messages in thread
From: Lv Zheng @ 2013-08-08  7:29 UTC (permalink / raw)
  To: Rafael J. Wysocki, Robert Moore, Len Brown; +Cc: Lv Zheng, linux-acpi

The 20130725 ACPICA kernel resident system updates is linuxized based on
the pm/linux-next branch.

The patch set has passed a build/boot test on the following machines:
Dell Inspiron Mini 1010 (i386)
HP Compaq 8200 Elite SFF PC (x86-64)
With the following kernel configuration items enabled:
  CONFIG_ACPI_AC
  CONFIG_ACPI_BATTERY
  CONFIG_ACPI_NUMA
  CONFIG_ACPI_PROCESSOR
  CONFIG_ACPI_THERMAL
  CONFIG_ACPI_VIDEO
  CONFIG_CPU_FREQ
  CONFIG_I2C_SCMI
  CONFIG_SENSORS_ACPI_POWER
  CONFIG_PANASONIC_LAPTOP
  CONFIG_XO15_EBOOK
No new divergences are introduced in this release.

Please review.

Bob Moore (8):
  ACPICA: Export acpi_tb_validate_rsdp().
  ACPICA: Emit all unresolved method externals in a text block
  ACPICA: DeRefOf operator: Update to fully resolve FieldUnit and
    BufferField refs.
  ACPICA: Fix possible fault for methods that optionally have no return
    value.
  ACPICA: Make ACPI Power Management Timer (PM Timer) optional.
  ACPICA: Return error if DerefOf resolves to a null package element.
  ACPICA: Update names for walk_namespace callbacks to clarify usage.
  ACPICA: Update version to 20130725.

Lv Zheng (1):
  ACPICA: Fix divergences of the commit - ACPICA: Expose OSI version.

 drivers/acpi/acpica/acglobal.h |    7 +++++-
 drivers/acpi/acpica/aclocal.h  |    1 +
 drivers/acpi/acpica/acnamesp.h |    4 ++--
 drivers/acpi/acpica/actables.h |    2 ++
 drivers/acpi/acpica/exoparg1.c |   48 +++++++++++++++++++++++++++++++++++-----
 drivers/acpi/acpica/hwtimer.c  |   13 ++++++++++-
 drivers/acpi/acpica/nspredef.c |   16 +++++++++++++-
 drivers/acpi/acpica/nswalk.c   |   26 +++++++++++-----------
 drivers/acpi/acpica/nsxfeval.c |   16 +++++++-------
 drivers/acpi/acpica/tbfadt.c   |    4 ++--
 drivers/acpi/acpica/tbxfroot.c |    8 ++-----
 drivers/acpi/acpica/utglobal.c |    1 -
 include/acpi/acpixf.h          |    6 ++---
 include/acpi/actypes.h         |   28 +++++++++++------------
 14 files changed, 121 insertions(+), 59 deletions(-)

-- 
1.7.10


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH 1/9] ACPICA: Export acpi_tb_validate_rsdp().
  2013-08-08  7:29 [PATCH 0/9] ACPICA 20130725 Release Lv Zheng
@ 2013-08-08  7:29 ` Lv Zheng
  2013-08-08  7:29 ` [PATCH 2/9] ACPICA: Emit all unresolved method externals in a text block Lv Zheng
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 12+ messages in thread
From: Lv Zheng @ 2013-08-08  7:29 UTC (permalink / raw)
  To: Rafael J. Wysocki, Robert Moore, Len Brown; +Cc: Lv Zheng, linux-acpi

From: Bob Moore <robert.moore@intel.com>

This patch exports acpi_tb_validate_rsdp(), so that code duplication in
some ACPICA utilities can be reduced.
This patch also includes lint changes.

Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
---
 drivers/acpi/acpica/actables.h |    2 ++
 drivers/acpi/acpica/tbxfroot.c |    8 ++------
 2 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/drivers/acpi/acpica/actables.h b/drivers/acpi/acpica/actables.h
index 917315e..c54f42c 100644
--- a/drivers/acpi/acpica/actables.h
+++ b/drivers/acpi/acpica/actables.h
@@ -49,6 +49,8 @@ acpi_status acpi_allocate_root_table(u32 initial_table_count);
 /*
  * tbxfroot - Root pointer utilities
  */
+acpi_status acpi_tb_validate_rsdp(struct acpi_table_rsdp *rsdp);
+
 u8 *acpi_tb_scan_memory_for_rsdp(u8 *start_address, u32 length);
 
 /*
diff --git a/drivers/acpi/acpica/tbxfroot.c b/drivers/acpi/acpica/tbxfroot.c
index e76ed0f..948c95e 100644
--- a/drivers/acpi/acpica/tbxfroot.c
+++ b/drivers/acpi/acpica/tbxfroot.c
@@ -48,9 +48,6 @@
 #define _COMPONENT          ACPI_TABLES
 ACPI_MODULE_NAME("tbxfroot")
 
-/* Local prototypes */
-static acpi_status acpi_tb_validate_rsdp(struct acpi_table_rsdp *rsdp);
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_tb_validate_rsdp
@@ -62,8 +59,7 @@ static acpi_status acpi_tb_validate_rsdp(struct acpi_table_rsdp *rsdp);
  * DESCRIPTION: Validate the RSDP (ptr)
  *
  ******************************************************************************/
-
-static acpi_status acpi_tb_validate_rsdp(struct acpi_table_rsdp *rsdp)
+acpi_status acpi_tb_validate_rsdp(struct acpi_table_rsdp *rsdp)
 {
 
 	/*
@@ -72,7 +68,7 @@ static acpi_status acpi_tb_validate_rsdp(struct acpi_table_rsdp *rsdp)
 	 * Note: Sometimes there exists more than one RSDP in memory; the valid
 	 * RSDP has a valid checksum, all others have an invalid checksum.
 	 */
-	if (ACPI_STRNCMP((char *)rsdp, ACPI_SIG_RSDP,
+	if (ACPI_STRNCMP((char *)rsdp->signature, ACPI_SIG_RSDP,
 			 sizeof(ACPI_SIG_RSDP) - 1) != 0) {
 
 		/* Nope, BAD Signature */
-- 
1.7.10


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 2/9] ACPICA: Emit all unresolved method externals in a text block
  2013-08-08  7:29 [PATCH 0/9] ACPICA 20130725 Release Lv Zheng
  2013-08-08  7:29 ` [PATCH 1/9] ACPICA: Export acpi_tb_validate_rsdp() Lv Zheng
@ 2013-08-08  7:29 ` Lv Zheng
  2013-08-08  7:29 ` [PATCH 3/9] ACPICA: DeRefOf operator: Update to fully resolve FieldUnit and BufferField refs Lv Zheng
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 12+ messages in thread
From: Lv Zheng @ 2013-08-08  7:29 UTC (permalink / raw)
  To: Rafael J. Wysocki, Robert Moore, Len Brown; +Cc: Lv Zheng, linux-acpi

From: Bob Moore <robert.moore@intel.com>

Put all of the unresolved external method declarations in a single block,
since they are important and may cause the resulting disassembled ASL file
to not compile.
This patch only affects ACPICA utilities and is necessary to avoid adding
source code divergences between Linux and ACPICA upstream.

Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
---
 drivers/acpi/acpica/aclocal.h |    1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/acpi/acpica/aclocal.h b/drivers/acpi/acpica/aclocal.h
index b0e3d15..0ed0066 100644
--- a/drivers/acpi/acpica/aclocal.h
+++ b/drivers/acpi/acpica/aclocal.h
@@ -1033,6 +1033,7 @@ struct acpi_external_list {
 	u8 type;
 	u8 flags;
 	u8 resolved;
+	u8 emitted;
 };
 
 /* Values for Flags field above */
-- 
1.7.10


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 3/9] ACPICA: DeRefOf operator: Update to fully resolve FieldUnit and BufferField refs.
  2013-08-08  7:29 [PATCH 0/9] ACPICA 20130725 Release Lv Zheng
  2013-08-08  7:29 ` [PATCH 1/9] ACPICA: Export acpi_tb_validate_rsdp() Lv Zheng
  2013-08-08  7:29 ` [PATCH 2/9] ACPICA: Emit all unresolved method externals in a text block Lv Zheng
@ 2013-08-08  7:29 ` Lv Zheng
  2013-08-08  7:29 ` [PATCH 4/9] ACPICA: Fix possible fault for methods that optionally have no return value Lv Zheng
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 12+ messages in thread
From: Lv Zheng @ 2013-08-08  7:29 UTC (permalink / raw)
  To: Rafael J. Wysocki, Robert Moore, Len Brown; +Cc: Lv Zheng, linux-acpi

From: Bob Moore <robert.moore@intel.com>

Previously, references to these objects were resolved only to the actual
FieldUnit or BufferField object. The correct behavior is to resolve these
references to an actual value.
The problem is that DerefOf did not resolve these objects to actual
values.  An "Integer" object is simple, return the value.  But a field in
an operation region will require a read operation.  For a BufferField, the
appropriate data must be extracted from the parent buffer.

NOTE: It appears that this issues is present in Windows7 but not
Windows8.

Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
---
 drivers/acpi/acpica/exoparg1.c |   35 ++++++++++++++++++++++++++++++++---
 1 file changed, 32 insertions(+), 3 deletions(-)

diff --git a/drivers/acpi/acpica/exoparg1.c b/drivers/acpi/acpica/exoparg1.c
index 814b4a3..3482df4 100644
--- a/drivers/acpi/acpica/exoparg1.c
+++ b/drivers/acpi/acpica/exoparg1.c
@@ -990,11 +990,40 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state)
 									 acpi_namespace_node
 									 *)
 									return_desc);
-				}
+					if (!return_desc) {
+						break;
+					}
+
+					/*
+					 * June 2013:
+					 * buffer_fields/field_units require additional resolution
+					 */
+					switch (return_desc->common.type) {
+					case ACPI_TYPE_BUFFER_FIELD:
+					case ACPI_TYPE_LOCAL_REGION_FIELD:
+					case ACPI_TYPE_LOCAL_BANK_FIELD:
+					case ACPI_TYPE_LOCAL_INDEX_FIELD:
+
+						status =
+						    acpi_ex_read_data_from_field
+						    (walk_state, return_desc,
+						     &temp_desc);
+						if (ACPI_FAILURE(status)) {
+							goto cleanup;
+						}
 
-				/* Add another reference to the object! */
+						return_desc = temp_desc;
+						break;
 
-				acpi_ut_add_reference(return_desc);
+					default:
+
+						/* Add another reference to the object */
+
+						acpi_ut_add_reference
+						    (return_desc);
+						break;
+					}
+				}
 				break;
 
 			default:
-- 
1.7.10


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 4/9] ACPICA: Fix possible fault for methods that optionally have no return value.
  2013-08-08  7:29 [PATCH 0/9] ACPICA 20130725 Release Lv Zheng
                   ` (2 preceding siblings ...)
  2013-08-08  7:29 ` [PATCH 3/9] ACPICA: DeRefOf operator: Update to fully resolve FieldUnit and BufferField refs Lv Zheng
@ 2013-08-08  7:29 ` Lv Zheng
  2013-08-08  7:29 ` [PATCH 5/9] ACPICA: Fix divergences of the commit - ACPICA: Expose OSI version Lv Zheng
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 12+ messages in thread
From: Lv Zheng @ 2013-08-08  7:29 UTC (permalink / raw)
  To: Rafael J. Wysocki, Robert Moore, Len Brown; +Cc: Lv Zheng, linux-acpi

From: Bob Moore <robert.moore@intel.com>

Currently applies to the _WAK method only. If the method has no return
value and slack mode is not enabled, the return value validation code
can fault.

Also improves the error message when an expected return value is
missing (for any predefined name/method).

Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
---
 drivers/acpi/acpica/nspredef.c |   16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/drivers/acpi/acpica/nspredef.c b/drivers/acpi/acpica/nspredef.c
index 24b71a0..098e766 100644
--- a/drivers/acpi/acpica/nspredef.c
+++ b/drivers/acpi/acpica/nspredef.c
@@ -151,6 +151,15 @@ acpi_ns_check_return_value(struct acpi_namespace_node *node,
 	}
 
 	/*
+	 *
+	 * 4) If there is no return value and it is optional, just return
+	 * AE_OK (_WAK).
+	 */
+	if (!(*return_object_ptr)) {
+		goto exit;
+	}
+
+	/*
 	 * For returned Package objects, check the type of all sub-objects.
 	 * Note: Package may have been newly created by call above.
 	 */
@@ -268,7 +277,12 @@ acpi_ns_check_object_type(struct acpi_evaluate_info *info,
 
 	acpi_ut_get_expected_return_types(type_buffer, expected_btypes);
 
-	if (package_index == ACPI_NOT_PACKAGE_ELEMENT) {
+	if (!return_object) {
+		ACPI_WARN_PREDEFINED((AE_INFO, info->full_pathname,
+				      info->node_flags,
+				      "Expected return object of type %s",
+				      type_buffer));
+	} else if (package_index == ACPI_NOT_PACKAGE_ELEMENT) {
 		ACPI_WARN_PREDEFINED((AE_INFO, info->full_pathname,
 				      info->node_flags,
 				      "Return type mismatch - found %s, expected %s",
-- 
1.7.10


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 5/9] ACPICA: Fix divergences of the commit - ACPICA: Expose OSI version.
  2013-08-08  7:29 [PATCH 0/9] ACPICA 20130725 Release Lv Zheng
                   ` (3 preceding siblings ...)
  2013-08-08  7:29 ` [PATCH 4/9] ACPICA: Fix possible fault for methods that optionally have no return value Lv Zheng
@ 2013-08-08  7:29 ` Lv Zheng
  2013-08-08  7:29 ` [PATCH 6/9] ACPICA: Make ACPI Power Management Timer (PM Timer) optional Lv Zheng
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 12+ messages in thread
From: Lv Zheng @ 2013-08-08  7:29 UTC (permalink / raw)
  To: Rafael J. Wysocki, Robert Moore, Len Brown; +Cc: Lv Zheng, linux-acpi, Aaron Lu

The original commit 242b2287cd7f27521c8b54a4101d569e53e7a0ca "ACPICA:
expose OSI version" triggers build errors in ACPICA when it is back
ported.  The patch removes the divergences between Linux and upstream
ACPICA resulting from that.

Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Bob Moore <robert.moore@intel.com>
Cc: Aaron Lu <aaron.lu@intel.com>
---
 drivers/acpi/acpica/acglobal.h |    7 ++++++-
 drivers/acpi/acpica/utglobal.c |    1 -
 include/acpi/actypes.h         |   28 +++++++++++++---------------
 3 files changed, 19 insertions(+), 17 deletions(-)

diff --git a/drivers/acpi/acpica/acglobal.h b/drivers/acpi/acpica/acglobal.h
index b8d3811..90e846f 100644
--- a/drivers/acpi/acpica/acglobal.h
+++ b/drivers/acpi/acpica/acglobal.h
@@ -138,6 +138,12 @@ u8 ACPI_INIT_GLOBAL(acpi_gbl_disable_auto_repair, FALSE);
  */
 u8 ACPI_INIT_GLOBAL(acpi_gbl_disable_ssdt_table_load, FALSE);
 
+/*
+ * We keep track of the latest version of Windows that has been requested by
+ * the BIOS.
+ */
+u8 ACPI_INIT_GLOBAL(acpi_gbl_osi_data, 0);
+
 /* acpi_gbl_FADT is a local copy of the FADT, converted to a common format. */
 
 struct acpi_table_fadt acpi_gbl_FADT;
@@ -285,7 +291,6 @@ ACPI_EXTERN u8 acpi_gbl_debugger_configuration;
 ACPI_EXTERN u8 acpi_gbl_step_to_next_call;
 ACPI_EXTERN u8 acpi_gbl_acpi_hardware_present;
 ACPI_EXTERN u8 acpi_gbl_events_initialized;
-ACPI_EXTERN u8 acpi_gbl_osi_data;
 ACPI_EXTERN struct acpi_interface_info *acpi_gbl_supported_interfaces;
 ACPI_EXTERN struct acpi_address_range
     *acpi_gbl_address_range_list[ACPI_ADDRESS_RANGE_MAX];
diff --git a/drivers/acpi/acpica/utglobal.c b/drivers/acpi/acpica/utglobal.c
index f736448..d6f26bf 100644
--- a/drivers/acpi/acpica/utglobal.c
+++ b/drivers/acpi/acpica/utglobal.c
@@ -336,7 +336,6 @@ acpi_status acpi_ut_init_globals(void)
 	acpi_gbl_trace_dbg_layer = 0;
 	acpi_gbl_debugger_configuration = DEBUGGER_THREADING;
 	acpi_gbl_db_output_flags = ACPI_DB_CONSOLE_OUTPUT;
-	acpi_gbl_osi_data = 0;
 	acpi_gbl_osi_mutex = NULL;
 	acpi_gbl_reg_methods_executed = FALSE;
 
diff --git a/include/acpi/actypes.h b/include/acpi/actypes.h
index eae55fb..b748aef 100644
--- a/include/acpi/actypes.h
+++ b/include/acpi/actypes.h
@@ -1137,7 +1137,19 @@ struct acpi_memory_list {
 #endif
 };
 
-/* Definitions for _OSI support */
+/* Definitions of _OSI support */
+
+#define ACPI_VENDOR_STRINGS                 0x01
+#define ACPI_FEATURE_STRINGS                0x02
+#define ACPI_ENABLE_INTERFACES              0x00
+#define ACPI_DISABLE_INTERFACES             0x04
+
+#define ACPI_DISABLE_ALL_VENDOR_STRINGS     (ACPI_DISABLE_INTERFACES | ACPI_VENDOR_STRINGS)
+#define ACPI_DISABLE_ALL_FEATURE_STRINGS    (ACPI_DISABLE_INTERFACES | ACPI_FEATURE_STRINGS)
+#define ACPI_DISABLE_ALL_STRINGS            (ACPI_DISABLE_INTERFACES | ACPI_VENDOR_STRINGS | ACPI_FEATURE_STRINGS)
+#define ACPI_ENABLE_ALL_VENDOR_STRINGS      (ACPI_ENABLE_INTERFACES | ACPI_VENDOR_STRINGS)
+#define ACPI_ENABLE_ALL_FEATURE_STRINGS     (ACPI_ENABLE_INTERFACES | ACPI_FEATURE_STRINGS)
+#define ACPI_ENABLE_ALL_STRINGS             (ACPI_ENABLE_INTERFACES | ACPI_VENDOR_STRINGS | ACPI_FEATURE_STRINGS)
 
 #define ACPI_OSI_WIN_2000               0x01
 #define ACPI_OSI_WIN_XP                 0x02
@@ -1152,18 +1164,4 @@ struct acpi_memory_list {
 #define ACPI_OSI_WIN_7                  0x0B
 #define ACPI_OSI_WIN_8                  0x0C
 
-/* _OSI update actions */
-
-#define ACPI_VENDOR_STRINGS                 0x01
-#define ACPI_FEATURE_STRINGS                0x02
-#define ACPI_ENABLE_INTERFACES              0x00
-#define ACPI_DISABLE_INTERFACES             0x04
-
-#define ACPI_DISABLE_ALL_VENDOR_STRINGS     (ACPI_DISABLE_INTERFACES | ACPI_VENDOR_STRINGS)
-#define ACPI_DISABLE_ALL_FEATURE_STRINGS    (ACPI_DISABLE_INTERFACES | ACPI_FEATURE_STRINGS)
-#define ACPI_DISABLE_ALL_STRINGS            (ACPI_DISABLE_INTERFACES | ACPI_VENDOR_STRINGS | ACPI_FEATURE_STRINGS)
-#define ACPI_ENABLE_ALL_VENDOR_STRINGS      (ACPI_ENABLE_INTERFACES | ACPI_VENDOR_STRINGS)
-#define ACPI_ENABLE_ALL_FEATURE_STRINGS     (ACPI_ENABLE_INTERFACES | ACPI_FEATURE_STRINGS)
-#define ACPI_ENABLE_ALL_STRINGS             (ACPI_ENABLE_INTERFACES | ACPI_VENDOR_STRINGS | ACPI_FEATURE_STRINGS)
-
 #endif				/* __ACTYPES_H__ */
-- 
1.7.10


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 6/9] ACPICA: Make ACPI Power Management Timer (PM Timer) optional.
  2013-08-08  7:29 [PATCH 0/9] ACPICA 20130725 Release Lv Zheng
                   ` (4 preceding siblings ...)
  2013-08-08  7:29 ` [PATCH 5/9] ACPICA: Fix divergences of the commit - ACPICA: Expose OSI version Lv Zheng
@ 2013-08-08  7:29 ` Lv Zheng
  2013-08-09  3:17   ` Adachi, Kenichi
  2013-08-08  7:29 ` [PATCH 7/9] ACPICA: Return error if DerefOf resolves to a null package element Lv Zheng
                   ` (2 subsequent siblings)
  8 siblings, 1 reply; 12+ messages in thread
From: Lv Zheng @ 2013-08-08  7:29 UTC (permalink / raw)
  To: Rafael J. Wysocki, Robert Moore, Len Brown; +Cc: Lv Zheng, linux-acpi

From: Bob Moore <robert.moore@intel.com>

PM Timer is now optional.
This support is already in Windows8 and "SHOULD" come out in ACPI 5.0A
(if all goes well).

The change doesn't affect Linux directly, because it has never relied
on the presence of the PM timer.

Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
---
 drivers/acpi/acpica/hwtimer.c |   13 ++++++++++++-
 drivers/acpi/acpica/tbfadt.c  |    4 ++--
 2 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/drivers/acpi/acpica/hwtimer.c b/drivers/acpi/acpica/hwtimer.c
index 0c1a8bb..2d7d22e 100644
--- a/drivers/acpi/acpica/hwtimer.c
+++ b/drivers/acpi/acpica/hwtimer.c
@@ -100,8 +100,13 @@ acpi_status acpi_get_timer(u32 * ticks)
 		return_ACPI_STATUS(AE_BAD_PARAMETER);
 	}
 
-	status = acpi_hw_read(ticks, &acpi_gbl_FADT.xpm_timer_block);
+	/* ACPI 5.0A: PM Timer is optional */
+
+	if (!acpi_gbl_FADT.xpm_timer_block.address) {
+		return_ACPI_STATUS(AE_SUPPORT);
+	}
 
+	status = acpi_hw_read(ticks, &acpi_gbl_FADT.xpm_timer_block);
 	return_ACPI_STATUS(status);
 }
 
@@ -148,6 +153,12 @@ acpi_get_timer_duration(u32 start_ticks, u32 end_ticks, u32 * time_elapsed)
 		return_ACPI_STATUS(AE_BAD_PARAMETER);
 	}
 
+	/* ACPI 5.0A: PM Timer is optional */
+
+	if (!acpi_gbl_FADT.xpm_timer_block.address) {
+		return_ACPI_STATUS(AE_SUPPORT);
+	}
+
 	/*
 	 * Compute Tick Delta:
 	 * Handle (max one) timer rollovers on 24-bit versus 32-bit timers.
diff --git a/drivers/acpi/acpica/tbfadt.c b/drivers/acpi/acpica/tbfadt.c
index 33b00d2..9d99f21 100644
--- a/drivers/acpi/acpica/tbfadt.c
+++ b/drivers/acpi/acpica/tbfadt.c
@@ -117,7 +117,7 @@ static struct acpi_fadt_info fadt_info_table[] = {
 	 ACPI_FADT_OFFSET(pm_timer_block),
 	 ACPI_FADT_OFFSET(pm_timer_length),
 	 ACPI_PM_TIMER_WIDTH,
-	 ACPI_FADT_REQUIRED},
+	 ACPI_FADT_SEPARATE_LENGTH},	/* ACPI 5.0A: Timer is optional */
 
 	{"Gpe0Block",
 	 ACPI_FADT_OFFSET(xgpe0_block),
@@ -574,7 +574,7 @@ static void acpi_tb_validate_fadt(void)
 
 		if (fadt_info_table[i].type & ACPI_FADT_REQUIRED) {
 			/*
-			 * Field is required (Pm1a_event, Pm1a_control, pm_timer).
+			 * Field is required (Pm1a_event, Pm1a_control).
 			 * Both the address and length must be non-zero.
 			 */
 			if (!address64->address || !length) {
-- 
1.7.10


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 7/9] ACPICA: Return error if DerefOf resolves to a null package element.
  2013-08-08  7:29 [PATCH 0/9] ACPICA 20130725 Release Lv Zheng
                   ` (5 preceding siblings ...)
  2013-08-08  7:29 ` [PATCH 6/9] ACPICA: Make ACPI Power Management Timer (PM Timer) optional Lv Zheng
@ 2013-08-08  7:29 ` Lv Zheng
  2013-08-08  7:30 ` [PATCH 8/9] ACPICA: Update names for walk_namespace callbacks to clarify usage Lv Zheng
  2013-08-08  7:30 ` [PATCH 9/9] ACPICA: Update version to 20130725 Lv Zheng
  8 siblings, 0 replies; 12+ messages in thread
From: Lv Zheng @ 2013-08-08  7:29 UTC (permalink / raw)
  To: Rafael J. Wysocki, Robert Moore, Len Brown; +Cc: Lv Zheng, linux-acpi

From: Bob Moore <robert.moore@intel.com>

Disallow the dereference of a reference (via index) to an uninitialized
package element. Provides compatibility with other ACPI
implementations. ACPICA BZ 1003.

Buglink: https://bugs.acpica.org/show_bug.cgi?id=431
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
---
 drivers/acpi/acpica/exoparg1.c |   13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/drivers/acpi/acpica/exoparg1.c b/drivers/acpi/acpica/exoparg1.c
index 3482df4..2cdd41d 100644
--- a/drivers/acpi/acpica/exoparg1.c
+++ b/drivers/acpi/acpica/exoparg1.c
@@ -962,10 +962,17 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state)
 					 */
 					return_desc =
 					    *(operand[0]->reference.where);
-					if (return_desc) {
-						acpi_ut_add_reference
-						    (return_desc);
+					if (!return_desc) {
+						/*
+						 * Element is NULL, do not allow the dereference.
+						 * This provides compatibility with other ACPI
+						 * implementations.
+						 */
+						return_ACPI_STATUS
+						    (AE_AML_UNINITIALIZED_ELEMENT);
 					}
+
+					acpi_ut_add_reference(return_desc);
 					break;
 
 				default:
-- 
1.7.10


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 8/9] ACPICA: Update names for walk_namespace callbacks to clarify usage.
  2013-08-08  7:29 [PATCH 0/9] ACPICA 20130725 Release Lv Zheng
                   ` (6 preceding siblings ...)
  2013-08-08  7:29 ` [PATCH 7/9] ACPICA: Return error if DerefOf resolves to a null package element Lv Zheng
@ 2013-08-08  7:30 ` Lv Zheng
  2013-08-08  7:30 ` [PATCH 9/9] ACPICA: Update version to 20130725 Lv Zheng
  8 siblings, 0 replies; 12+ messages in thread
From: Lv Zheng @ 2013-08-08  7:30 UTC (permalink / raw)
  To: Rafael J. Wysocki, Robert Moore, Len Brown; +Cc: Lv Zheng, linux-acpi

From: Bob Moore <robert.moore@intel.com>

Use of "preorder" and "postorder" was incorrect. The callbacks are
simply invoked during tree ascent and descent during the
depth-first walk.

Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
---
 drivers/acpi/acpica/acnamesp.h |    4 ++--
 drivers/acpi/acpica/nswalk.c   |   26 +++++++++++++-------------
 drivers/acpi/acpica/nsxfeval.c |   16 ++++++++--------
 include/acpi/acpixf.h          |    4 ++--
 4 files changed, 25 insertions(+), 25 deletions(-)

diff --git a/drivers/acpi/acpica/acnamesp.h b/drivers/acpi/acpica/acnamesp.h
index b83dc32..40b04bd 100644
--- a/drivers/acpi/acpica/acnamesp.h
+++ b/drivers/acpi/acpica/acnamesp.h
@@ -104,8 +104,8 @@ acpi_ns_walk_namespace(acpi_object_type type,
 		       acpi_handle start_object,
 		       u32 max_depth,
 		       u32 flags,
-		       acpi_walk_callback pre_order_visit,
-		       acpi_walk_callback post_order_visit,
+		       acpi_walk_callback descending_callback,
+		       acpi_walk_callback ascending_callback,
 		       void *context, void **return_value);
 
 struct acpi_namespace_node *acpi_ns_get_next_node(struct acpi_namespace_node
diff --git a/drivers/acpi/acpica/nswalk.c b/drivers/acpi/acpica/nswalk.c
index e70911a..e81f15e 100644
--- a/drivers/acpi/acpica/nswalk.c
+++ b/drivers/acpi/acpica/nswalk.c
@@ -156,9 +156,9 @@ struct acpi_namespace_node *acpi_ns_get_next_node_typed(acpi_object_type type,
  *              max_depth           - Depth to which search is to reach
  *              flags               - Whether to unlock the NS before invoking
  *                                    the callback routine
- *              pre_order_visit     - Called during tree pre-order visit
+ *              descending_callback - Called during tree descent
  *                                    when an object of "Type" is found
- *              post_order_visit    - Called during tree post-order visit
+ *              ascending_callback  - Called during tree ascent
  *                                    when an object of "Type" is found
  *              context             - Passed to user function(s) above
  *              return_value        - from the user_function if terminated
@@ -185,8 +185,8 @@ acpi_ns_walk_namespace(acpi_object_type type,
 		       acpi_handle start_node,
 		       u32 max_depth,
 		       u32 flags,
-		       acpi_walk_callback pre_order_visit,
-		       acpi_walk_callback post_order_visit,
+		       acpi_walk_callback descending_callback,
+		       acpi_walk_callback ascending_callback,
 		       void *context, void **return_value)
 {
 	acpi_status status;
@@ -255,22 +255,22 @@ acpi_ns_walk_namespace(acpi_object_type type,
 			}
 
 			/*
-			 * Invoke the user function, either pre-order or post-order
+			 * Invoke the user function, either descending, ascending,
 			 * or both.
 			 */
 			if (!node_previously_visited) {
-				if (pre_order_visit) {
+				if (descending_callback) {
 					status =
-					    pre_order_visit(child_node, level,
-							    context,
-							    return_value);
+					    descending_callback(child_node,
+								level, context,
+								return_value);
 				}
 			} else {
-				if (post_order_visit) {
+				if (ascending_callback) {
 					status =
-					    post_order_visit(child_node, level,
-							     context,
-							     return_value);
+					    ascending_callback(child_node,
+							       level, context,
+							       return_value);
 				}
 			}
 
diff --git a/drivers/acpi/acpica/nsxfeval.c b/drivers/acpi/acpica/nsxfeval.c
index f553cfd..b38b4b0 100644
--- a/drivers/acpi/acpica/nsxfeval.c
+++ b/drivers/acpi/acpica/nsxfeval.c
@@ -533,9 +533,9 @@ static void acpi_ns_resolve_references(struct acpi_evaluate_info *info)
  * PARAMETERS:  type                - acpi_object_type to search for
  *              start_object        - Handle in namespace where search begins
  *              max_depth           - Depth to which search is to reach
- *              pre_order_visit     - Called during tree pre-order visit
+ *              descending_callback - Called during tree descent
  *                                    when an object of "Type" is found
- *              post_order_visit    - Called during tree post-order visit
+ *              ascending_callback  - Called during tree ascent
  *                                    when an object of "Type" is found
  *              context             - Passed to user function(s) above
  *              return_value        - Location where return value of
@@ -563,8 +563,8 @@ acpi_status
 acpi_walk_namespace(acpi_object_type type,
 		    acpi_handle start_object,
 		    u32 max_depth,
-		    acpi_walk_callback pre_order_visit,
-		    acpi_walk_callback post_order_visit,
+		    acpi_walk_callback descending_callback,
+		    acpi_walk_callback ascending_callback,
 		    void *context, void **return_value)
 {
 	acpi_status status;
@@ -574,7 +574,7 @@ acpi_walk_namespace(acpi_object_type type,
 	/* Parameter validation */
 
 	if ((type > ACPI_TYPE_LOCAL_MAX) ||
-	    (!max_depth) || (!pre_order_visit && !post_order_visit)) {
+	    (!max_depth) || (!descending_callback && !ascending_callback)) {
 		return_ACPI_STATUS(AE_BAD_PARAMETER);
 	}
 
@@ -606,9 +606,9 @@ acpi_walk_namespace(acpi_object_type type,
 	}
 
 	status = acpi_ns_walk_namespace(type, start_object, max_depth,
-					ACPI_NS_WALK_UNLOCK, pre_order_visit,
-					post_order_visit, context,
-					return_value);
+					ACPI_NS_WALK_UNLOCK,
+					descending_callback, ascending_callback,
+					context, return_value);
 
 	(void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
 
diff --git a/include/acpi/acpixf.h b/include/acpi/acpixf.h
index 0dd03f2..e53f16a 100644
--- a/include/acpi/acpixf.h
+++ b/include/acpi/acpixf.h
@@ -212,8 +212,8 @@ acpi_status
 acpi_walk_namespace(acpi_object_type type,
 		    acpi_handle start_object,
 		    u32 max_depth,
-		    acpi_walk_callback pre_order_visit,
-		    acpi_walk_callback post_order_visit,
+		    acpi_walk_callback descending_callback,
+		    acpi_walk_callback ascending_callback,
 		    void *context, void **return_value);
 
 acpi_status
-- 
1.7.10


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 9/9] ACPICA: Update version to 20130725.
  2013-08-08  7:29 [PATCH 0/9] ACPICA 20130725 Release Lv Zheng
                   ` (7 preceding siblings ...)
  2013-08-08  7:30 ` [PATCH 8/9] ACPICA: Update names for walk_namespace callbacks to clarify usage Lv Zheng
@ 2013-08-08  7:30 ` Lv Zheng
  8 siblings, 0 replies; 12+ messages in thread
From: Lv Zheng @ 2013-08-08  7:30 UTC (permalink / raw)
  To: Rafael J. Wysocki, Robert Moore, Len Brown; +Cc: Lv Zheng, linux-acpi

From: Bob Moore <robert.moore@intel.com>

Version 20130725.

Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
---
 include/acpi/acpixf.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/acpi/acpixf.h b/include/acpi/acpixf.h
index e53f16a..85bfdbe 100644
--- a/include/acpi/acpixf.h
+++ b/include/acpi/acpixf.h
@@ -46,7 +46,7 @@
 
 /* Current ACPICA subsystem version in YYYYMMDD format */
 
-#define ACPI_CA_VERSION                 0x20130626
+#define ACPI_CA_VERSION                 0x20130725
 
 #include <acpi/acconfig.h>
 #include <acpi/actypes.h>
-- 
1.7.10


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [PATCH 6/9] ACPICA: Make ACPI Power Management Timer (PM Timer) optional.
  2013-08-08  7:29 ` [PATCH 6/9] ACPICA: Make ACPI Power Management Timer (PM Timer) optional Lv Zheng
@ 2013-08-09  3:17   ` Adachi, Kenichi
  2013-08-17  0:22     ` Rafael J. Wysocki
  0 siblings, 1 reply; 12+ messages in thread
From: Adachi, Kenichi @ 2013-08-09  3:17 UTC (permalink / raw)
  To: Lv Zheng; +Cc: Rafael J. Wysocki, Robert Moore, Len Brown, linux-acpi

Hi,

On Thu, Aug 8, 2013 at 4:29 PM, Lv Zheng <lv.zheng@intel.com> wrote:
>
> From: Bob Moore <robert.moore@intel.com>
>
> PM Timer is now optional.
...
> The change doesn't affect Linux directly, because it has never relied
> on the presence of the PM timer.
>
Has it been so?

IIRC, there're a couple of accesses to PM Timer via:
-  inl(acpi_gbl_FADT.xpm_timer_block.address);
typically in processor driver code: ex) drivers/acpi/processor_idle.c
which seems to rely on the presence of the PM timer.

The below snippet shows how it was like (which can be seen in earlier
linux kernel such as 2.6 series...)

- drivers/acpi/processor_idle.c:acpi_processor_idle()

    switch (cx->type) {
    case ACPI_STATE_C1:
        ...
        break;

    case ACPI_STATE_C2:
        /* Get start time (ticks) */
-->   t1 = inl(acpi_gbl_FADT.xpm_timer_block.address);
        /* Tell the scheduler that we are going deep-idle: */
        sched_clock_idle_sleep_event();
        /* Invoke C2 */
        acpi_state_timer_broadcast(pr, cx, 1);
        acpi_cstate_enter(cx);
        /* Get end time (ticks) */
-->   t2 = inl(acpi_gbl_FADT.xpm_timer_block.address);

#if defined (CONFIG_GENERIC_TIME) && defined (CONFIG_X86)
        /* TSC halts in C2, so notify users */
        if (tsc_halts_in_c(ACPI_STATE_C2))
            mark_tsc_unstable("possible TSC halt in C2");
#endif
        /* Compute time (ticks) that we were actually asleep */
===>   sleep_ticks = ticks_elapsed(t1, t2);

        /* Tell the scheduler how much we idled: */
===>   sched_clock_idle_wakeup_event(sleep_ticks*PM_TIMER_TICK_NS);
...

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 6/9] ACPICA: Make ACPI Power Management Timer (PM Timer) optional.
  2013-08-09  3:17   ` Adachi, Kenichi
@ 2013-08-17  0:22     ` Rafael J. Wysocki
  0 siblings, 0 replies; 12+ messages in thread
From: Rafael J. Wysocki @ 2013-08-17  0:22 UTC (permalink / raw)
  To: Adachi, Kenichi
  Cc: Lv Zheng, Rafael J. Wysocki, Robert Moore, Len Brown, linux-acpi

On Friday, August 09, 2013 12:17:21 PM Adachi, Kenichi wrote:
> Hi,
> 
> On Thu, Aug 8, 2013 at 4:29 PM, Lv Zheng <lv.zheng@intel.com> wrote:
> >
> > From: Bob Moore <robert.moore@intel.com>
> >
> > PM Timer is now optional.
> ...
> > The change doesn't affect Linux directly, because it has never relied
> > on the presence of the PM timer.
> >
> Has it been so?
> 
> IIRC, there're a couple of accesses to PM Timer via:
> -  inl(acpi_gbl_FADT.xpm_timer_block.address);
> typically in processor driver code: ex) drivers/acpi/processor_idle.c
> which seems to rely on the presence of the PM timer.

That's correct, so I modified the changelog as it was not accurate.  However,
we don't rely on the PM timer presence any more, because we found systems
in the field where the PM timer was not present.

Thanks,
Rafael


^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2013-08-17  0:11 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-08-08  7:29 [PATCH 0/9] ACPICA 20130725 Release Lv Zheng
2013-08-08  7:29 ` [PATCH 1/9] ACPICA: Export acpi_tb_validate_rsdp() Lv Zheng
2013-08-08  7:29 ` [PATCH 2/9] ACPICA: Emit all unresolved method externals in a text block Lv Zheng
2013-08-08  7:29 ` [PATCH 3/9] ACPICA: DeRefOf operator: Update to fully resolve FieldUnit and BufferField refs Lv Zheng
2013-08-08  7:29 ` [PATCH 4/9] ACPICA: Fix possible fault for methods that optionally have no return value Lv Zheng
2013-08-08  7:29 ` [PATCH 5/9] ACPICA: Fix divergences of the commit - ACPICA: Expose OSI version Lv Zheng
2013-08-08  7:29 ` [PATCH 6/9] ACPICA: Make ACPI Power Management Timer (PM Timer) optional Lv Zheng
2013-08-09  3:17   ` Adachi, Kenichi
2013-08-17  0:22     ` Rafael J. Wysocki
2013-08-08  7:29 ` [PATCH 7/9] ACPICA: Return error if DerefOf resolves to a null package element Lv Zheng
2013-08-08  7:30 ` [PATCH 8/9] ACPICA: Update names for walk_namespace callbacks to clarify usage Lv Zheng
2013-08-08  7:30 ` [PATCH 9/9] ACPICA: Update version to 20130725 Lv Zheng

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).