aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorLv Zheng <lv.zheng@intel.com>2014-04-29 22:05:48 -0400
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2014-05-06 18:55:02 -0400
commitc79322677d95c7cab65e02828677b43d8656eb61 (patch)
tree1e9beedc40d76f21884a82f927fa2fb2707b38d0 /tools
parentfea79bc01cb184432309148af9bf53a961a4d920 (diff)
ACPICA: acpidump: Add support to force using RSDT.
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> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/power/acpi/os_specific/service_layers/oslinuxtbl.c32
-rw-r--r--tools/power/acpi/tools/acpidump/acpidump.h23
-rw-r--r--tools/power/acpi/tools/acpidump/apmain.c13
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 a8cd344d621b..e0699e6e1f26 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)
505 505
506/****************************************************************************** 506/******************************************************************************
507 * 507 *
508 * FUNCTION: osl_can_use_xsdt
509 *
510 * PARAMETERS: None
511 *
512 * RETURN: TRUE if XSDT is allowed to be used.
513 *
514 * DESCRIPTION: This function collects logic that can be used to determine if
515 * XSDT should be used instead of RSDT.
516 *
517 *****************************************************************************/
518
519static u8 osl_can_use_xsdt(void)
520{
521 if (gbl_revision && !acpi_gbl_do_not_use_xsdt) {
522 return (TRUE);
523 } else {
524 return (FALSE);
525 }
526}
527
528/******************************************************************************
529 *
508 * FUNCTION: osl_table_initialize 530 * FUNCTION: osl_table_initialize
509 * 531 *
510 * PARAMETERS: None 532 * PARAMETERS: None
@@ -535,7 +557,7 @@ static acpi_status osl_table_initialize(void)
535 557
536 /* Get XSDT from memory */ 558 /* Get XSDT from memory */
537 559
538 if (gbl_rsdp.revision) { 560 if (gbl_rsdp.revision && !gbl_do_not_dump_xsdt) {
539 if (gbl_xsdt) { 561 if (gbl_xsdt) {
540 free(gbl_xsdt); 562 free(gbl_xsdt);
541 gbl_xsdt = NULL; 563 gbl_xsdt = NULL;
@@ -668,7 +690,7 @@ static acpi_status osl_list_bios_tables(void)
668 acpi_status status = AE_OK; 690 acpi_status status = AE_OK;
669 u32 i; 691 u32 i;
670 692
671 if (gbl_revision) { 693 if (osl_can_use_xsdt()) {
672 item_size = sizeof(u64); 694 item_size = sizeof(u64);
673 table_data = 695 table_data =
674 ACPI_CAST8(gbl_xsdt) + sizeof(struct acpi_table_header); 696 ACPI_CAST8(gbl_xsdt) + sizeof(struct acpi_table_header);
@@ -690,7 +712,7 @@ static acpi_status osl_list_bios_tables(void)
690 /* Search RSDT/XSDT for the requested table */ 712 /* Search RSDT/XSDT for the requested table */
691 713
692 for (i = 0; i < number_of_tables; ++i, table_data += item_size) { 714 for (i = 0; i < number_of_tables; ++i, table_data += item_size) {
693 if (gbl_revision) { 715 if (osl_can_use_xsdt()) {
694 table_address = 716 table_address =
695 (acpi_physical_address) (*ACPI_CAST64(table_data)); 717 (acpi_physical_address) (*ACPI_CAST64(table_data));
696 } else { 718 } else {
@@ -809,7 +831,7 @@ osl_get_bios_table(char *signature,
809 table_length = ap_get_table_length(mapped_table); 831 table_length = ap_get_table_length(mapped_table);
810 } else { /* Case for a normal ACPI table */ 832 } else { /* Case for a normal ACPI table */
811 833
812 if (gbl_revision) { 834 if (osl_can_use_xsdt()) {
813 item_size = sizeof(u64); 835 item_size = sizeof(u64);
814 table_data = 836 table_data =
815 ACPI_CAST8(gbl_xsdt) + 837 ACPI_CAST8(gbl_xsdt) +
@@ -833,7 +855,7 @@ osl_get_bios_table(char *signature,
833 /* Search RSDT/XSDT for the requested table */ 855 /* Search RSDT/XSDT for the requested table */
834 856
835 for (i = 0; i < number_of_tables; ++i, table_data += item_size) { 857 for (i = 0; i < number_of_tables; ++i, table_data += item_size) {
836 if (gbl_revision) { 858 if (osl_can_use_xsdt()) {
837 table_address = 859 table_address =
838 (acpi_physical_address) (*ACPI_CAST64 860 (acpi_physical_address) (*ACPI_CAST64
839 (table_data)); 861 (table_data));
diff --git a/tools/power/acpi/tools/acpidump/acpidump.h b/tools/power/acpi/tools/acpidump/acpidump.h
index 3361b9e04d9c..46f519597fe5 100644
--- a/tools/power/acpi/tools/acpidump/acpidump.h
+++ b/tools/power/acpi/tools/acpidump/acpidump.h
@@ -41,32 +41,34 @@
41 * POSSIBILITY OF SUCH DAMAGES. 41 * POSSIBILITY OF SUCH DAMAGES.
42 */ 42 */
43 43
44#include <acpi/acpi.h>
45#include "accommon.h"
46#include "actables.h"
47
48#include <stdio.h>
49#include <fcntl.h>
50#include <errno.h>
51#include <sys/stat.h>
52
53/* 44/*
54 * Global variables. Defined in main.c only, externed in all other files 45 * Global variables. Defined in main.c only, externed in all other files
55 */ 46 */
56#ifdef _DECLARE_GLOBALS 47#ifdef _DECLARE_GLOBALS
57#define EXTERN 48#define EXTERN
58#define INIT_GLOBAL(a,b) a=b 49#define INIT_GLOBAL(a,b) a=b
50#define DEFINE_ACPI_GLOBALS 1
59#else 51#else
60#define EXTERN extern 52#define EXTERN extern
61#define INIT_GLOBAL(a,b) a 53#define INIT_GLOBAL(a,b) a
62#endif 54#endif
63 55
56#include <acpi/acpi.h>
57#include "accommon.h"
58#include "actables.h"
59
60#include <stdio.h>
61#include <fcntl.h>
62#include <errno.h>
63#include <sys/stat.h>
64
64/* Globals */ 65/* Globals */
65 66
66EXTERN u8 INIT_GLOBAL(gbl_summary_mode, FALSE); 67EXTERN u8 INIT_GLOBAL(gbl_summary_mode, FALSE);
67EXTERN u8 INIT_GLOBAL(gbl_verbose_mode, FALSE); 68EXTERN u8 INIT_GLOBAL(gbl_verbose_mode, FALSE);
68EXTERN u8 INIT_GLOBAL(gbl_binary_mode, FALSE); 69EXTERN u8 INIT_GLOBAL(gbl_binary_mode, FALSE);
69EXTERN u8 INIT_GLOBAL(gbl_dump_customized_tables, FALSE); 70EXTERN u8 INIT_GLOBAL(gbl_dump_customized_tables, FALSE);
71EXTERN u8 INIT_GLOBAL(gbl_do_not_dump_xsdt, FALSE);
70EXTERN FILE INIT_GLOBAL(*gbl_output_file, NULL); 72EXTERN FILE INIT_GLOBAL(*gbl_output_file, NULL);
71EXTERN char INIT_GLOBAL(*gbl_output_filename, NULL); 73EXTERN char INIT_GLOBAL(*gbl_output_filename, NULL);
72EXTERN u64 INIT_GLOBAL(gbl_rsdp_base, 0); 74EXTERN u64 INIT_GLOBAL(gbl_rsdp_base, 0);
@@ -74,10 +76,7 @@ EXTERN u64 INIT_GLOBAL(gbl_rsdp_base, 0);
74/* Globals required for use with ACPICA modules */ 76/* Globals required for use with ACPICA modules */
75 77
76#ifdef _DECLARE_GLOBALS 78#ifdef _DECLARE_GLOBALS
77u8 acpi_gbl_enable_interpreter_slack = FALSE;
78u8 acpi_gbl_integer_byte_width = 8; 79u8 acpi_gbl_integer_byte_width = 8;
79u32 acpi_dbg_level = 0;
80u32 acpi_dbg_layer = 0;
81#endif 80#endif
82 81
83/* Action table used to defer requested options */ 82/* 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 70d71ec687a5..51e8d638db18 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];
80u32 current_action = 0; 80u32 current_action = 0;
81 81
82#define AP_UTILITY_NAME "ACPI Binary Table Dump Utility" 82#define AP_UTILITY_NAME "ACPI Binary Table Dump Utility"
83#define AP_SUPPORTED_OPTIONS "?a:bcf:hn:o:r:svz" 83#define AP_SUPPORTED_OPTIONS "?a:bcf:hn:o:r:svxz"
84 84
85/****************************************************************************** 85/******************************************************************************
86 * 86 *
@@ -109,6 +109,8 @@ static void ap_display_usage(void)
109 ACPI_OPTION("-a <Address>", "Get table via a physical address"); 109 ACPI_OPTION("-a <Address>", "Get table via a physical address");
110 ACPI_OPTION("-f <BinaryFile>", "Get table via a binary file"); 110 ACPI_OPTION("-f <BinaryFile>", "Get table via a binary file");
111 ACPI_OPTION("-n <Signature>", "Get table via a name/signature"); 111 ACPI_OPTION("-n <Signature>", "Get table via a name/signature");
112 ACPI_OPTION("-x", "Do not use but dump XSDT");
113 ACPI_OPTION("-x -x", "Do not use or dump XSDT");
112 114
113 printf("\n" 115 printf("\n"
114 "Invocation without parameters dumps all available tables\n" 116 "Invocation without parameters dumps all available tables\n"
@@ -210,6 +212,15 @@ static int ap_do_options(int argc, char **argv)
210 gbl_summary_mode = TRUE; 212 gbl_summary_mode = TRUE;
211 continue; 213 continue;
212 214
215 case 'x': /* Do not use XSDT */
216
217 if (!acpi_gbl_do_not_use_xsdt) {
218 acpi_gbl_do_not_use_xsdt = TRUE;
219 } else {
220 gbl_do_not_dump_xsdt = TRUE;
221 }
222 continue;
223
213 case 'v': /* Revision/version */ 224 case 'v': /* Revision/version */
214 225
215 printf(ACPI_COMMON_SIGNON(AP_UTILITY_NAME)); 226 printf(ACPI_COMMON_SIGNON(AP_UTILITY_NAME));