From: Lv Zheng <lv.zheng@intel.com>
To: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>,
Len Brown <len.brown@intel.com>
Cc: Lv Zheng <lv.zheng@intel.com>, Lv Zheng <zetalog@gmail.com>,
linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org,
Bob Moore <robert.moore@intel.com>
Subject: [PATCH 21/27] ACPICA: acpidump: Add support to force using RSDT.
Date: Wed, 30 Apr 2014 10:05:48 +0800 [thread overview]
Message-ID: <a947d03abc49bdd4493fbfaf9226ded7ea7a7996.1398817612.git.lv.zheng@intel.com> (raw)
In-Reply-To: <cover.1398817612.git.lv.zheng@intel.com>
This patch adds "-x" and "-x -x" options to disable XSDT for acpidump.
The single "-x" can be used to stop using XSDT, RSDT will be forced to find
static tables, note that XSDT will still be dumped. The double "-x" can
stop dumping XSDT, which is useful when the XSDT address reported by RSDP
is pointing to an invalid address.
It is reported there are platforms having broken XSDT shipped, acpidump
will stop working while accessing such XSDT. This patch adds new option so
that users can force acpidump to dump tables listed in the RSDT. Lv Zheng.
Buglink: https://bugzilla.kernel.org/show_bug.cgi?id=73911
Buglink: https://bugs.archlinux.org/task/39811
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Reported-and-tested-by: Bruce Chiarelli <mano155@gmail.com>
Reported-and-tested-by: Spyros Stathopoulos <spystath@gmail.com>
Signed-off-by: Bob Moore <robert.moore@intel.com>
---
.../acpi/os_specific/service_layers/oslinuxtbl.c | 32 +++++++++++++++++---
tools/power/acpi/tools/acpidump/acpidump.h | 23 +++++++-------
tools/power/acpi/tools/acpidump/apmain.c | 13 +++++++-
3 files changed, 50 insertions(+), 18 deletions(-)
diff --git a/tools/power/acpi/os_specific/service_layers/oslinuxtbl.c b/tools/power/acpi/os_specific/service_layers/oslinuxtbl.c
index a8cd344..e0699e6 100644
--- a/tools/power/acpi/os_specific/service_layers/oslinuxtbl.c
+++ b/tools/power/acpi/os_specific/service_layers/oslinuxtbl.c
@@ -505,6 +505,28 @@ static acpi_status osl_load_rsdp(void)
/******************************************************************************
*
+ * FUNCTION: osl_can_use_xsdt
+ *
+ * PARAMETERS: None
+ *
+ * RETURN: TRUE if XSDT is allowed to be used.
+ *
+ * DESCRIPTION: This function collects logic that can be used to determine if
+ * XSDT should be used instead of RSDT.
+ *
+ *****************************************************************************/
+
+static u8 osl_can_use_xsdt(void)
+{
+ if (gbl_revision && !acpi_gbl_do_not_use_xsdt) {
+ return (TRUE);
+ } else {
+ return (FALSE);
+ }
+}
+
+/******************************************************************************
+ *
* FUNCTION: osl_table_initialize
*
* PARAMETERS: None
@@ -535,7 +557,7 @@ static acpi_status osl_table_initialize(void)
/* Get XSDT from memory */
- if (gbl_rsdp.revision) {
+ if (gbl_rsdp.revision && !gbl_do_not_dump_xsdt) {
if (gbl_xsdt) {
free(gbl_xsdt);
gbl_xsdt = NULL;
@@ -668,7 +690,7 @@ static acpi_status osl_list_bios_tables(void)
acpi_status status = AE_OK;
u32 i;
- if (gbl_revision) {
+ if (osl_can_use_xsdt()) {
item_size = sizeof(u64);
table_data =
ACPI_CAST8(gbl_xsdt) + sizeof(struct acpi_table_header);
@@ -690,7 +712,7 @@ static acpi_status osl_list_bios_tables(void)
/* Search RSDT/XSDT for the requested table */
for (i = 0; i < number_of_tables; ++i, table_data += item_size) {
- if (gbl_revision) {
+ if (osl_can_use_xsdt()) {
table_address =
(acpi_physical_address) (*ACPI_CAST64(table_data));
} else {
@@ -809,7 +831,7 @@ osl_get_bios_table(char *signature,
table_length = ap_get_table_length(mapped_table);
} else { /* Case for a normal ACPI table */
- if (gbl_revision) {
+ if (osl_can_use_xsdt()) {
item_size = sizeof(u64);
table_data =
ACPI_CAST8(gbl_xsdt) +
@@ -833,7 +855,7 @@ osl_get_bios_table(char *signature,
/* Search RSDT/XSDT for the requested table */
for (i = 0; i < number_of_tables; ++i, table_data += item_size) {
- if (gbl_revision) {
+ if (osl_can_use_xsdt()) {
table_address =
(acpi_physical_address) (*ACPI_CAST64
(table_data));
diff --git a/tools/power/acpi/tools/acpidump/acpidump.h b/tools/power/acpi/tools/acpidump/acpidump.h
index 3361b9e..46f5195 100644
--- a/tools/power/acpi/tools/acpidump/acpidump.h
+++ b/tools/power/acpi/tools/acpidump/acpidump.h
@@ -41,32 +41,34 @@
* POSSIBILITY OF SUCH DAMAGES.
*/
-#include <acpi/acpi.h>
-#include "accommon.h"
-#include "actables.h"
-
-#include <stdio.h>
-#include <fcntl.h>
-#include <errno.h>
-#include <sys/stat.h>
-
/*
* Global variables. Defined in main.c only, externed in all other files
*/
#ifdef _DECLARE_GLOBALS
#define EXTERN
#define INIT_GLOBAL(a,b) a=b
+#define DEFINE_ACPI_GLOBALS 1
#else
#define EXTERN extern
#define INIT_GLOBAL(a,b) a
#endif
+#include <acpi/acpi.h>
+#include "accommon.h"
+#include "actables.h"
+
+#include <stdio.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <sys/stat.h>
+
/* Globals */
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_do_not_dump_xsdt, FALSE);
EXTERN FILE INIT_GLOBAL(*gbl_output_file, NULL);
EXTERN char INIT_GLOBAL(*gbl_output_filename, NULL);
EXTERN u64 INIT_GLOBAL(gbl_rsdp_base, 0);
@@ -74,10 +76,7 @@ EXTERN u64 INIT_GLOBAL(gbl_rsdp_base, 0);
/* Globals required for use with ACPICA modules */
#ifdef _DECLARE_GLOBALS
-u8 acpi_gbl_enable_interpreter_slack = FALSE;
u8 acpi_gbl_integer_byte_width = 8;
-u32 acpi_dbg_level = 0;
-u32 acpi_dbg_layer = 0;
#endif
/* Action table used to defer requested options */
diff --git a/tools/power/acpi/tools/acpidump/apmain.c b/tools/power/acpi/tools/acpidump/apmain.c
index 70d71ec..51e8d63 100644
--- a/tools/power/acpi/tools/acpidump/apmain.c
+++ b/tools/power/acpi/tools/acpidump/apmain.c
@@ -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:svz"
+#define AP_SUPPORTED_OPTIONS "?a:bcf:hn:o:r:svxz"
/******************************************************************************
*
@@ -109,6 +109,8 @@ static void ap_display_usage(void)
ACPI_OPTION("-a <Address>", "Get table via a physical address");
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");
+ ACPI_OPTION("-x -x", "Do not use or dump XSDT");
printf("\n"
"Invocation without parameters dumps all available tables\n"
@@ -210,6 +212,15 @@ static int ap_do_options(int argc, char **argv)
gbl_summary_mode = TRUE;
continue;
+ case 'x': /* Do not use XSDT */
+
+ if (!acpi_gbl_do_not_use_xsdt) {
+ acpi_gbl_do_not_use_xsdt = TRUE;
+ } else {
+ gbl_do_not_dump_xsdt = TRUE;
+ }
+ continue;
+
case 'v': /* Revision/version */
printf(ACPI_COMMON_SIGNON(AP_UTILITY_NAME));
--
1.7.10
next prev parent reply other threads:[~2014-04-30 2:05 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-30 2:03 [PATCH 00/27] ACPICA: 20140424 Release Lv Zheng
2014-04-30 2:03 ` [PATCH 01/27] ACPICA: Utilities: Cleanup obsoleted global variables Lv Zheng
2014-04-30 2:03 ` [PATCH 02/27] ACPICA: Utilities: Deploy ACPI_DEBUGGER_EXEC for ACPI_DEBUGGER enabled code in utglobal.c Lv Zheng
2014-05-06 7:53 ` Pavel Machek
2014-05-06 8:58 ` Zheng, Lv
2014-05-06 11:08 ` Pavel Machek
2014-05-06 13:54 ` Zheng, Lv
2014-04-30 2:03 ` [PATCH 03/27] ACPICA: acpidump: Fix code issue in invoking fread in the loop Lv Zheng
2014-04-30 2:03 ` [PATCH 04/27] ACPICA: Update global variable definitions. No functional change Lv Zheng
2014-04-30 2:03 ` [PATCH 05/27] ACPICA: Update acpi_buffer_to_resource interface Lv Zheng
2014-04-30 2:04 ` [PATCH 06/27] ACPICA: Add support for LPIT table Lv Zheng
2014-04-30 2:04 ` [PATCH 07/27] ACPICA: Add support for _LPD and _PRP methods Lv Zheng
2014-04-30 2:04 ` [PATCH 08/27] ACPICA: Update handling of PCI ID lists Lv Zheng
2014-04-30 2:04 ` [PATCH 09/27] ACPICA: Comment updates - no functional change Lv Zheng
2014-04-30 2:04 ` [PATCH 10/27] ACPICA: OSL: Move external globals from utglobal.c to acpixf.h using ACPI_INIT_GLOBAL/ACPI_GLOBAL Lv Zheng
2014-04-30 2:04 ` [PATCH 11/27] ACPICA: OSL: Add configurability for memory allocation macros Lv Zheng
2014-04-30 2:04 ` [PATCH 12/27] ACPICA: OSL: Add configurability for error message functions Lv Zheng
2014-04-30 2:04 ` [PATCH 13/27] ACPICA: OSL: Add configurability for debug output functions Lv Zheng
2014-04-30 2:05 ` [PATCH 14/27] ACPICA: OSL: Add section to collect the divergence in acpixf.h Lv Zheng
2014-04-30 2:05 ` [PATCH 15/27] ACPICA: OSL: Add configurability for generic external functions Lv Zheng
2014-04-30 2:05 ` [PATCH 16/27] ACPICA: Linux header: Add support for stubbed externals Lv Zheng
2014-04-30 2:05 ` [PATCH 17/27] ACPICA: acpidump: Fix truncated RSDP signature validation Lv Zheng
2014-04-30 2:05 ` [PATCH 18/27] ACPICA: Back port of _PRP update Lv Zheng
2014-04-30 2:05 ` [PATCH 19/27] ACPICA: Back port of improvements on exception code Lv Zheng
2014-04-30 2:05 ` [PATCH 20/27] ACPICA: Tables: Fix invalid pointer accesses in acpi_tb_parse_root_table() Lv Zheng
2014-05-03 12:59 ` Josh Boyer
2014-05-05 0:43 ` Rafael J. Wysocki
2014-05-05 4:23 ` Zheng, Lv
2014-05-05 12:42 ` Josh Boyer
2014-05-06 0:43 ` Rafael J. Wysocki
2014-05-06 1:39 ` Zheng, Lv
2014-04-30 2:05 ` Lv Zheng [this message]
2014-04-30 2:05 ` [PATCH 22/27] ACPICA: Tables: Add new mechanism to skip NULL entries in RSDT and XSDT Lv Zheng
2014-04-30 2:06 ` [PATCH 23/27] ACPICA: Tables: Remove old mechanism to validate if XSDT contains NULL entries Lv Zheng
2014-04-30 2:06 ` [PATCH 24/27] ACPICA: Remove extraneous error message for large number of GPEs Lv Zheng
2014-04-30 2:06 ` [PATCH 25/27] ACPICA: Events: Update GPE handling and initialization code Lv Zheng
2014-04-30 2:06 ` [PATCH 26/27] ACPICA: Comment/format update, no functional change Lv Zheng
2014-04-30 2:06 ` [PATCH 27/27] ACPICA: Update version to 20140424 Lv Zheng
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=a947d03abc49bdd4493fbfaf9226ded7ea7a7996.1398817612.git.lv.zheng@intel.com \
--to=lv.zheng@intel.com \
--cc=len.brown@intel.com \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rafael.j.wysocki@intel.com \
--cc=robert.moore@intel.com \
--cc=zetalog@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).