summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLv Zheng <lv.zheng@intel.com>2014-04-17 14:51:06 +0800
committerLv Zheng <lv.zheng@intel.com>2014-04-18 19:47:21 +0800
commit40d382b7c36a8769d2a08b2184d5014cc3db1ec8 (patch)
treedf499b4e63ce48fc9f92804f78158984461ca2da
parent8081d1f55a09dfb74541775921e85c343ec7c285 (diff)
downloadacpica-40d382b7c36a8769d2a08b2184d5014cc3db1ec8.tar.gz
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>
-rw-r--r--source/os_specific/service_layers/oslinuxtbl.c38
-rw-r--r--source/tools/acpidump/acpidump.h22
-rw-r--r--source/tools/acpidump/apmain.c16
3 files changed, 59 insertions, 17 deletions
diff --git a/source/os_specific/service_layers/oslinuxtbl.c b/source/os_specific/service_layers/oslinuxtbl.c
index c8a1d9a31..4e3715066 100644
--- a/source/os_specific/service_layers/oslinuxtbl.c
+++ b/source/os_specific/service_layers/oslinuxtbl.c
@@ -665,6 +665,34 @@ OslLoadRsdp (
/******************************************************************************
*
+ * FUNCTION: OslCanUseXsdt
+ *
+ * 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 BOOLEAN
+OslCanUseXsdt (
+ void)
+{
+ if (Gbl_Revision && !AcpiGbl_DoNotUseXsdt)
+ {
+ return (TRUE);
+ }
+ else
+ {
+ return (FALSE);
+ }
+}
+
+
+/******************************************************************************
+ *
* FUNCTION: OslTableInitialize
*
* PARAMETERS: None
@@ -700,7 +728,7 @@ OslTableInitialize (
/* Get XSDT from memory */
- if (Gbl_Rsdp.Revision)
+ if (Gbl_Rsdp.Revision && !Gbl_DoNotDumpXsdt)
{
if (Gbl_Xsdt)
{
@@ -850,7 +878,7 @@ OslListBiosTables (
UINT32 i;
- if (Gbl_Revision)
+ if (OslCanUseXsdt ())
{
ItemSize = sizeof (UINT64);
TableData = ACPI_CAST8 (Gbl_Xsdt) + sizeof (ACPI_TABLE_HEADER);
@@ -871,7 +899,7 @@ OslListBiosTables (
for (i = 0; i < NumberOfTables; ++i, TableData += ItemSize)
{
- if (Gbl_Revision)
+ if (OslCanUseXsdt ())
{
TableAddress =
(ACPI_PHYSICAL_ADDRESS) (*ACPI_CAST64 (TableData));
@@ -1005,7 +1033,7 @@ OslGetBiosTable (
}
else /* Case for a normal ACPI table */
{
- if (Gbl_Revision)
+ if (OslCanUseXsdt ())
{
ItemSize = sizeof (UINT64);
TableData = ACPI_CAST8 (Gbl_Xsdt) + sizeof (ACPI_TABLE_HEADER);
@@ -1026,7 +1054,7 @@ OslGetBiosTable (
for (i = 0; i < NumberOfTables; ++i, TableData += ItemSize)
{
- if (Gbl_Revision)
+ if (OslCanUseXsdt ())
{
TableAddress =
(ACPI_PHYSICAL_ADDRESS) (*ACPI_CAST64 (TableData));
diff --git a/source/tools/acpidump/acpidump.h b/source/tools/acpidump/acpidump.h
index 22c6f3db8..e57e0d18c 100644
--- a/source/tools/acpidump/acpidump.h
+++ b/source/tools/acpidump/acpidump.h
@@ -113,14 +113,6 @@
*
*****************************************************************************/
-#include "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
@@ -128,11 +120,21 @@
#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.h"
+#include "accommon.h"
+#include "actables.h"
+
+#include <stdio.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <sys/stat.h>
+
/* Globals */
@@ -140,6 +142,7 @@ EXTERN BOOLEAN INIT_GLOBAL (Gbl_SummaryMode, FALSE);
EXTERN BOOLEAN INIT_GLOBAL (Gbl_VerboseMode, FALSE);
EXTERN BOOLEAN INIT_GLOBAL (Gbl_BinaryMode, FALSE);
EXTERN BOOLEAN INIT_GLOBAL (Gbl_DumpCustomizedTables, FALSE);
+EXTERN BOOLEAN INIT_GLOBAL (Gbl_DoNotDumpXsdt, FALSE);
EXTERN FILE INIT_GLOBAL (*Gbl_OutputFile, NULL);
EXTERN char INIT_GLOBAL (*Gbl_OutputFilename, NULL);
EXTERN UINT64 INIT_GLOBAL (Gbl_RsdpBase, 0);
@@ -147,10 +150,7 @@ EXTERN UINT64 INIT_GLOBAL (Gbl_RsdpBase, 0);
/* Globals required for use with ACPICA modules */
#ifdef _DECLARE_GLOBALS
-UINT8 AcpiGbl_EnableInterpreterSlack = FALSE;
UINT8 AcpiGbl_IntegerByteWidth = 8;
-UINT32 AcpiDbgLevel = 0;
-UINT32 AcpiDbgLayer = 0;
#endif
/* Action table used to defer requested options */
diff --git a/source/tools/acpidump/apmain.c b/source/tools/acpidump/apmain.c
index bde4958e2..fbb3cad4a 100644
--- a/source/tools/acpidump/apmain.c
+++ b/source/tools/acpidump/apmain.c
@@ -164,7 +164,7 @@ UINT32 CurrentAction = 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"
/******************************************************************************
@@ -196,6 +196,8 @@ ApDisplayUsage (
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"
@@ -306,6 +308,18 @@ ApDoOptions (
Gbl_SummaryMode = TRUE;
continue;
+ case 'x': /* Do not use XSDT */
+
+ if (!AcpiGbl_DoNotUseXsdt)
+ {
+ AcpiGbl_DoNotUseXsdt = TRUE;
+ }
+ else
+ {
+ Gbl_DoNotDumpXsdt = TRUE;
+ }
+ continue;
+
case 'v': /* Revision/version */
printf (ACPI_COMMON_SIGNON (AP_UTILITY_NAME));