2016-03-24 01:38:26

by Zheng, Lv

[permalink] [raw]
Subject: [PATCH 00/30] ACPICA: 20160318 Release

The 20160318 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 + allyes
2. i386 + allno
3. i386 + default + ACPI_DEBUGGER=y
4. i386 + default + ACPI_DEBUGGER=n + ACPI_DEBUG=y
5. i386 + default + ACPI_DEBUG=n + ACPI=y
6. i386 + default + ACPI=n
7. x86_64 + allyes
8. x86_64 + allno
9. x86_64 + default + ACPI_DEBUGGER=y
10.x86_64 + default + ACPI_DEBUGGER=n + ACPI_DEBUG=y
11.x86_64 + default + ACPI_DEBUG=n + ACPI=y
12.x86_64 + default + ACPI=n
Boot tests are performed as follows:
1. i386 + default + ACPI_DEBUGGER=y
2. x86_64 + default + ACPI_DEBUGGER=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 "drivers/platform" drivers
All other drivers that link the APIs provided by ACPICA subsystem

The divergences checking result:
Before applying (20160212 Release):
506 lines
After applying (20160318 Release):
494 lines

Al Stone (1):
ACPICA: IORT: Add in support for the SMMUv3 subtable

Aleksey Makarov (1):
ACPICA: Headers: Add new constants for the DBG2 ACPI table

Bob Moore (16):
ACPICA: Headers: Minor update for SPCR ACPI table
ACPICA: ACPI 6.1: Updates for the HEST ACPI table
ACPICA: ACPI 6.1: Update NFIT table for additional new fields
ACPICA: Headers: Update DMAR table for October 2014 I/O spec
ACPICA: Tables: Update FADT handling
ACPICA: ACPI 6.1: Add full support for this version of ACPI spec
ACPICA: iASL/Headers: Fix incorrect definition of FPDT table
ACPICA: Intepreter: Add object extensions to Concatenate operand
ACPICA: Interpreter: Update some function headers, no functional
change
ACPICA: iASL: Cleanup/optimization for ToPLD macro support
ACPICA: Cleanup some invocation indentations, no functional change
ACPICA: Headers: Update generation of the ACPICA library
ACPICA: Utilities: Update for strtoul64 merger
ACPICA: All: const keyword changes across the ACPICA source
ACPICA: iASL/Disassembler: Improve handling of unresolved methods
ACPICA: Update version to 20160318

Lv Zheng (11):
ACPICA: Linuxize: reduce divergences for 20160212 release
ACPICA: Linuxize: Remove useless platform headers
ACPICA: Utilities: Add ACPI_IS_POWER_OF_TWO()
Utilities: Fix missing parentheses in ACPI_GET_BITS()/ACPI_SET_BITS()
ACPICA: Hardware: Enhance acpi_hw_validate_register() with
access_width/bit_offset awareness
ACPICA: Hardware: Add access_width/bit_offset support in
acpi_hw_read()
ACPICA: Hardware: Add access_width/bit_offset support for
acpi_hw_write()
ACPICA: Interpreter: Fix wrong conditions for
acpi_ev_install_region_handlers() invocation
ACPICA: Tables: Fix wrong MLC condition for dynamic table loading
ACPICA: Events: Fix an issue that _REG association can happen before
namespace is initialized
ACPICA: Namespace: Reorder \_SB._INI to make sure it is evaluated
before _REG evaluations

Will Miles (1):
ACPICA: Add support for QNX 6.6 platform

drivers/acpi/acpica/Makefile | 1 +
drivers/acpi/acpica/acdebug.h | 4 +-
drivers/acpi/acpica/acevents.h | 2 -
drivers/acpi/acpica/acglobal.h | 11 +
drivers/acpi/acpica/acinterp.h | 2 +-
drivers/acpi/acpica/aclocal.h | 1 +
drivers/acpi/acpica/acmacros.h | 8 +-
drivers/acpi/acpica/acnamesp.h | 5 +-
drivers/acpi/acpica/acparser.h | 2 +-
drivers/acpi/acpica/acpredef.h | 9 +
drivers/acpi/acpica/acresrc.h | 4 +-
drivers/acpi/acpica/acstruct.h | 2 +-
drivers/acpi/acpica/acutils.h | 23 +-
drivers/acpi/acpica/dbconvert.c | 4 +-
drivers/acpi/acpica/dbinput.c | 13 +-
drivers/acpi/acpica/dbutils.c | 9 +-
drivers/acpi/acpica/evregion.c | 74 ++--
drivers/acpi/acpica/evrgnini.c | 1 -
drivers/acpi/acpica/exconcat.c | 439 ++++++++++++++++++++
drivers/acpi/acpica/exconfig.c | 4 +-
drivers/acpi/acpica/exconvrt.c | 4 +-
drivers/acpi/acpica/exdump.c | 15 +-
drivers/acpi/acpica/exmisc.c | 290 -------------
drivers/acpi/acpica/exutils.c | 12 +-
drivers/acpi/acpica/hwregs.c | 217 ++++++++--
drivers/acpi/acpica/hwxface.c | 4 +-
drivers/acpi/acpica/nsaccess.c | 7 +-
drivers/acpi/acpica/nsconvert.c | 3 +-
drivers/acpi/acpica/nsdump.c | 9 +-
drivers/acpi/acpica/nsinit.c | 76 +++-
drivers/acpi/acpica/nsload.c | 2 +-
drivers/acpi/acpica/nsprepkg.c | 6 +
drivers/acpi/acpica/psopinfo.c | 2 +-
drivers/acpi/acpica/rsdump.c | 50 +--
drivers/acpi/acpica/rsutils.c | 2 +-
drivers/acpi/acpica/tbfadt.c | 26 +-
drivers/acpi/acpica/tbxfload.c | 2 +-
drivers/acpi/acpica/utdebug.c | 47 +--
drivers/acpi/acpica/utdecode.c | 30 +-
drivers/acpi/acpica/uteval.c | 4 +-
drivers/acpi/acpica/utglobal.c | 48 +++
drivers/acpi/acpica/utmisc.c | 2 +-
drivers/acpi/acpica/utnonansi.c | 67 +--
drivers/acpi/acpica/utprint.c | 5 -
drivers/acpi/acpica/uttrack.c | 2 +-
drivers/acpi/osl.c | 2 +-
include/acpi/acpiosxf.h | 2 +-
include/acpi/acpixf.h | 2 +-
include/acpi/actbl.h | 4 +-
include/acpi/actbl1.h | 74 +++-
include/acpi/actbl2.h | 39 +-
include/acpi/actbl3.h | 43 +-
include/acpi/actypes.h | 7 +-
include/acpi/platform/acenv.h | 44 +-
include/acpi/platform/acmsvcex.h | 54 ---
include/acpi/platform/acwinex.h | 49 ---
.../acpi/os_specific/service_layers/osunixmap.c | 2 +-
tools/power/acpi/tools/acpidump/apdump.c | 3 +-
tools/power/acpi/tools/acpidump/apmain.c | 3 +-
59 files changed, 1142 insertions(+), 736 deletions(-)
create mode 100644 drivers/acpi/acpica/exconcat.c
delete mode 100644 include/acpi/platform/acmsvcex.h
delete mode 100644 include/acpi/platform/acwinex.h

--
1.7.10


2016-03-24 01:38:33

by Zheng, Lv

[permalink] [raw]
Subject: [PATCH 01/30] ACPICA: Linuxize: reduce divergences for 20160212 release

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

Signed-off-by: Lv Zheng <[email protected]>
---
drivers/acpi/acpica/hwregs.c | 2 +-
drivers/acpi/acpica/nsinit.c | 1 -
drivers/acpi/acpica/nsload.c | 2 +-
drivers/acpi/osl.c | 2 +-
include/acpi/acpiosxf.h | 2 +-
5 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/acpi/acpica/hwregs.c b/drivers/acpi/acpica/hwregs.c
index 5ba0498..93f8831 100644
--- a/drivers/acpi/acpica/hwregs.c
+++ b/drivers/acpi/acpica/hwregs.c
@@ -152,7 +152,7 @@ acpi_hw_validate_register(struct acpi_generic_address *reg,
*
******************************************************************************/

-acpi_status acpi_hw_read(u32 *value, struct acpi_generic_address *reg)
+acpi_status acpi_hw_read(u32 *value, struct acpi_generic_address * reg)
{
u64 address;
u64 value64;
diff --git a/drivers/acpi/acpica/nsinit.c b/drivers/acpi/acpica/nsinit.c
index d4aa8b6..2de8adb 100644
--- a/drivers/acpi/acpica/nsinit.c
+++ b/drivers/acpi/acpica/nsinit.c
@@ -602,7 +602,6 @@ acpi_ns_init_one_device(acpi_handle obj_handle,
info->flags = ACPI_IGNORE_RETURN_VALUE;

status = acpi_ns_evaluate(info);
-
if (ACPI_SUCCESS(status)) {
walk_info->num_INI++;
}
diff --git a/drivers/acpi/acpica/nsload.c b/drivers/acpi/acpica/nsload.c
index 75cdb87..b5e2b0a 100644
--- a/drivers/acpi/acpica/nsload.c
+++ b/drivers/acpi/acpica/nsload.c
@@ -123,8 +123,8 @@ acpi_ns_load_table(u32 table_index, struct acpi_namespace_node *node)
(void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
acpi_ns_delete_namespace_by_owner(acpi_gbl_root_table_list.
tables[table_index].owner_id);
- acpi_tb_release_owner_id(table_index);

+ acpi_tb_release_owner_id(table_index);
return_ACPI_STATUS(status);
}

diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c
index 814d5f8..bef06c9 100644
--- a/drivers/acpi/osl.c
+++ b/drivers/acpi/osl.c
@@ -582,7 +582,7 @@ static char acpi_os_name[ACPI_MAX_OVERRIDE_LEN];

acpi_status
acpi_os_predefined_override(const struct acpi_predefined_names *init_val,
- char **new_val)
+ acpi_string *new_val)
{
if (!init_val || !new_val)
return AE_BAD_PARAMETER;
diff --git a/include/acpi/acpiosxf.h b/include/acpi/acpiosxf.h
index d1e34d1..dfdcf5a 100644
--- a/include/acpi/acpiosxf.h
+++ b/include/acpi/acpiosxf.h
@@ -96,7 +96,7 @@ acpi_physical_address acpi_os_get_root_pointer(void);
#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_predefined_override
acpi_status
acpi_os_predefined_override(const struct acpi_predefined_names *init_val,
- char **new_val);
+ acpi_string * new_val);
#endif

#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_table_override
--
1.7.10

2016-03-24 01:38:42

by Zheng, Lv

[permalink] [raw]
Subject: [PATCH 02/30] ACPICA: Linuxize: Remove useless platform headers

Some platform headers are leaked to Linux during release cycle.
This patch removes them. Lv Zheng.

Signed-off-by: Lv Zheng <[email protected]>
---
include/acpi/platform/acmsvcex.h | 54 --------------------------------------
include/acpi/platform/acwinex.h | 49 ----------------------------------
2 files changed, 103 deletions(-)
delete mode 100644 include/acpi/platform/acmsvcex.h
delete mode 100644 include/acpi/platform/acwinex.h

diff --git a/include/acpi/platform/acmsvcex.h b/include/acpi/platform/acmsvcex.h
deleted file mode 100644
index 28084a1..0000000
--- a/include/acpi/platform/acmsvcex.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/******************************************************************************
- *
- * Name: acmsvcex.h - Extra VC specific defines, etc.
- *
- *****************************************************************************/
-
-/*
- * Copyright (C) 2000 - 2016, Intel Corp.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions, and the following disclaimer,
- * without modification.
- * 2. Redistributions in binary form must reproduce at minimum a disclaimer
- * substantially similar to the "NO WARRANTY" disclaimer below
- * ("Disclaimer") and any redistribution must be conditioned upon
- * including a substantially similar Disclaimer requirement for further
- * binary redistribution.
- * 3. Neither the names of the above-listed copyright holders nor the names
- * of any contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * Alternatively, this software may be distributed under the terms of the
- * GNU General Public License ("GPL") version 2 as published by the Free
- * Software Foundation.
- *
- * NO WARRANTY
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
- * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGES.
- */
-
-#ifndef __ACMSVCEX_H__
-#define __ACMSVCEX_H__
-
-/* Debug support. */
-
-#ifdef _DEBUG
-#define _CRTDBG_MAP_ALLOC /* Enables specific file/lineno for leaks */
-#include <crtdbg.h>
-#endif
-
-#endif /* __ACMSVCEX_H__ */
diff --git a/include/acpi/platform/acwinex.h b/include/acpi/platform/acwinex.h
deleted file mode 100644
index a00b3e4..0000000
--- a/include/acpi/platform/acwinex.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/******************************************************************************
- *
- * Name: acwinex.h - Extra OS specific defines, etc.
- *
- *****************************************************************************/
-
-/*
- * Copyright (C) 2000 - 2016, Intel Corp.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions, and the following disclaimer,
- * without modification.
- * 2. Redistributions in binary form must reproduce at minimum a disclaimer
- * substantially similar to the "NO WARRANTY" disclaimer below
- * ("Disclaimer") and any redistribution must be conditioned upon
- * including a substantially similar Disclaimer requirement for further
- * binary redistribution.
- * 3. Neither the names of the above-listed copyright holders nor the names
- * of any contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * Alternatively, this software may be distributed under the terms of the
- * GNU General Public License ("GPL") version 2 as published by the Free
- * Software Foundation.
- *
- * NO WARRANTY
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
- * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGES.
- */
-
-#ifndef __ACWINEX_H__
-#define __ACWINEX_H__
-
-/* Windows uses VC */
-
-#endif /* __ACWINEX_H__ */
--
1.7.10

2016-03-24 01:38:48

by Zheng, Lv

[permalink] [raw]
Subject: [PATCH 03/30] ACPICA: Headers: Add new constants for the DBG2 ACPI table

From: Aleksey Makarov <[email protected]>

ACPICA commit 1607b69238df9c1b2940262a17aa94ec49033278

Link: https://github.com/acpica/acpica/commit/1607b692
Signed-off-by: Aleksey Makarov <[email protected]>.
Signed-off-by: Bob Moore <[email protected]>
Signed-off-by: Lv Zheng <[email protected]>
---
include/acpi/actbl2.h | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/include/acpi/actbl2.h b/include/acpi/actbl2.h
index a4ef625..7702b27 100644
--- a/include/acpi/actbl2.h
+++ b/include/acpi/actbl2.h
@@ -321,7 +321,7 @@ struct acpi_csrt_descriptor {
* DBG2 - Debug Port Table 2
* Version 0 (Both main table and subtables)
*
- * Conforms to "Microsoft Debug Port Table 2 (DBG2)", May 22 2012.
+ * Conforms to "Microsoft Debug Port Table 2 (DBG2)", December 10, 2015
*
******************************************************************************/

@@ -371,6 +371,11 @@ struct acpi_dbg2_device {

#define ACPI_DBG2_16550_COMPATIBLE 0x0000
#define ACPI_DBG2_16550_SUBSET 0x0001
+#define ACPI_DBG2_ARM_PL011 0x0003
+#define ACPI_DBG2_ARM_SBSA_32BIT 0x000D
+#define ACPI_DBG2_ARM_SBSA_GENERIC 0x000E
+#define ACPI_DBG2_ARM_DCC 0x000F
+#define ACPI_DBG2_BCM2835 0x0010

#define ACPI_DBG2_1394_STANDARD 0x0000

--
1.7.10

2016-03-24 01:38:55

by Zheng, Lv

[permalink] [raw]
Subject: [PATCH 04/30] ACPICA: Headers: Minor update for SPCR ACPI table

From: Bob Moore <[email protected]>

ACPICA commit f3caa7f2e63be31f7fb8dbccabffbb70c29c3021

Update version number and date of specification document.
Point to DBG2 table for some constants.

Link: https://github.com/acpica/acpica/commit/f3caa7f2
Signed-off-by: Bob Moore <[email protected]>
Signed-off-by: Lv Zheng <[email protected]>
---
include/acpi/actbl2.h | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/include/acpi/actbl2.h b/include/acpi/actbl2.h
index 7702b27..e9d3cc1 100644
--- a/include/acpi/actbl2.h
+++ b/include/acpi/actbl2.h
@@ -1107,10 +1107,10 @@ struct acpi_table_slic {
/*******************************************************************************
*
* SPCR - Serial Port Console Redirection table
- * Version 1
+ * Version 2
*
* Conforms to "Serial Port Console Redirection Table",
- * Version 1.00, January 11, 2002
+ * Version 1.03, August 10, 2015
*
******************************************************************************/

@@ -1142,6 +1142,8 @@ struct acpi_table_spcr {

#define ACPI_SPCR_DO_NOT_DISABLE (1)

+/* Values for Interface Type: See the definition of the DBG2 table */
+
/*******************************************************************************
*
* SPMI - Server Platform Management Interface table
--
1.7.10

2016-03-24 01:39:15

by Zheng, Lv

[permalink] [raw]
Subject: [PATCH 05/30] ACPICA: ACPI 6.1: Updates for the HEST ACPI table

From: Bob Moore <[email protected]>

ACPICA commit 7e81afb625f5184000713de2b1f280e73251bc03

Additional structure for the generic error entry.
Some additional constants/flags.
With assistance from Abdulhamid, Harb <[email protected]>

Link: https://github.com/acpica/acpica/commit/7e81afb6
Reviewed-by: Harb Abdulhamid <[email protected]>
Signed-off-by: Bob Moore <[email protected]>
Signed-off-by: Lv Zheng <[email protected]>
---
include/acpi/actbl1.h | 54 +++++++++++++++++++++++++++++++++++++++++++++++--
1 file changed, 52 insertions(+), 2 deletions(-)

diff --git a/include/acpi/actbl1.h b/include/acpi/actbl1.h
index 16e0136..b7c96b7 100644
--- a/include/acpi/actbl1.h
+++ b/include/acpi/actbl1.h
@@ -427,7 +427,8 @@ enum acpi_hest_types {
ACPI_HEST_TYPE_AER_ENDPOINT = 7,
ACPI_HEST_TYPE_AER_BRIDGE = 8,
ACPI_HEST_TYPE_GENERIC_ERROR = 9,
- ACPI_HEST_TYPE_RESERVED = 10 /* 10 and greater are reserved */
+ ACPI_HEST_TYPE_GENERIC_ERROR_V2 = 10,
+ ACPI_HEST_TYPE_RESERVED = 11 /* 11 and greater are reserved */
};

/*
@@ -506,7 +507,11 @@ enum acpi_hest_notify_types {
ACPI_HEST_NOTIFY_NMI = 4,
ACPI_HEST_NOTIFY_CMCI = 5, /* ACPI 5.0 */
ACPI_HEST_NOTIFY_MCE = 6, /* ACPI 5.0 */
- ACPI_HEST_NOTIFY_RESERVED = 7 /* 7 and greater are reserved */
+ ACPI_HEST_NOTIFY_GPIO = 7, /* ACPI 6.0 */
+ ACPI_HEST_NOTIFY_SEA = 8, /* ACPI 6.1 */
+ ACPI_HEST_NOTIFY_SEI = 9, /* ACPI 6.1 */
+ ACPI_HEST_NOTIFY_GSIV = 10, /* ACPI 6.1 */
+ ACPI_HEST_NOTIFY_RESERVED = 11 /* 11 and greater are reserved */
};

/* Values for config_write_enable bitfield above */
@@ -603,6 +608,24 @@ struct acpi_hest_generic {
u32 error_block_length;
};

+/* 10: Generic Hardware Error Source, version 2 */
+
+struct acpi_hest_generic_v2 {
+ struct acpi_hest_header header;
+ u16 related_source_id;
+ u8 reserved;
+ u8 enabled;
+ u32 records_to_preallocate;
+ u32 max_sections_per_record;
+ u32 max_raw_data_length;
+ struct acpi_generic_address error_status_address;
+ struct acpi_hest_notify notify;
+ u32 error_block_length;
+ struct acpi_generic_address read_ack_register;
+ u64 read_ack_preserve;
+ u64 read_ack_write;
+};
+
/* Generic Error Status block */

struct acpi_hest_generic_status {
@@ -634,6 +657,33 @@ struct acpi_hest_generic_data {
u8 fru_text[20];
};

+/* Extension for revision 0x0300 */
+
+struct acpi_hest_generic_data_v300 {
+ u8 section_type[16];
+ u32 error_severity;
+ u16 revision;
+ u8 validation_bits;
+ u8 flags;
+ u32 error_data_length;
+ u8 fru_id[16];
+ u8 fru_text[20];
+ u64 time_stamp;
+};
+
+/* Values for error_severity above */
+
+#define ACPI_HEST_GEN_ERROR_RECOVERABLE 0
+#define ACPI_HEST_GEN_ERROR_FATAL 1
+#define ACPI_HEST_GEN_ERROR_CORRECTED 2
+#define ACPI_HEST_GEN_ERROR_NONE 3
+
+/* Flags for validation_bits above */
+
+#define ACPI_HEST_GEN_VALID_FRU_ID (1)
+#define ACPI_HEST_GEN_VALID_FRU_STRING (1<<1)
+#define ACPI_HEST_GEN_VALID_TIMESTAMP (1<<2)
+
/*******************************************************************************
*
* MADT - Multiple APIC Description Table
--
1.7.10

2016-03-24 01:39:21

by Zheng, Lv

[permalink] [raw]
Subject: [PATCH 07/30] ACPICA: ACPI 6.1: Update NFIT table for additional new fields

From: Bob Moore <[email protected]>

ACPICA commit bc81a4494d7648a496e0a82f0d27562103ee1ec1

Changes the NFIT Control Region.

Link: https://github.com/acpica/acpica/commit/bc81a449
Signed-off-by: Bob Moore <[email protected]>
Signed-off-by: Lv Zheng <[email protected]>
---
include/acpi/actbl1.h | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/include/acpi/actbl1.h b/include/acpi/actbl1.h
index b7c96b7..912dff9 100644
--- a/include/acpi/actbl1.h
+++ b/include/acpi/actbl1.h
@@ -984,7 +984,7 @@ struct acpi_msct_proximity {

/*******************************************************************************
*
- * NFIT - NVDIMM Interface Table (ACPI 6.0)
+ * NFIT - NVDIMM Interface Table (ACPI 6.0+)
* Version 1
*
******************************************************************************/
@@ -1065,6 +1065,7 @@ struct acpi_nfit_memory_map {
#define ACPI_NFIT_MEM_NOT_ARMED (1<<3) /* 03: Memory Device is not armed */
#define ACPI_NFIT_MEM_HEALTH_OBSERVED (1<<4) /* 04: Memory Device observed SMART/health events */
#define ACPI_NFIT_MEM_HEALTH_ENABLED (1<<5) /* 05: SMART/health events enabled */
+#define ACPI_NFIT_MEM_MAP_FAILED (1<<6) /* 06: Mapping to SPA failed */

/* 2: Interleave Structure */

@@ -1096,7 +1097,10 @@ struct acpi_nfit_control_region {
u16 subsystem_vendor_id;
u16 subsystem_device_id;
u16 subsystem_revision_id;
- u8 reserved[6]; /* Reserved, must be zero */
+ u8 valid_fields;
+ u8 manufacturing_location;
+ u16 manufacturing_date;
+ u8 reserved[2]; /* Reserved, must be zero */
u32 serial_number;
u16 code;
u16 windows;
@@ -1111,7 +1115,11 @@ struct acpi_nfit_control_region {

/* Flags */

-#define ACPI_NFIT_CONTROL_BUFFERED (1) /* Block Data Windows implementation is buffered */
+#define ACPI_NFIT_CONTROL_BUFFERED (1) /* Block Data Windows implementation is buffered */
+
+/* valid_fields bits */
+
+#define ACPI_NFIT_CONTROL_MFG_INFO_VALID (1) /* Manufacturing fields are valid */

/* 5: NVDIMM Block Data Window Region Structure */

--
1.7.10

2016-03-24 01:39:27

by Zheng, Lv

[permalink] [raw]
Subject: [PATCH 08/30] ACPICA: Headers: Update DMAR table for October 2014 I/O spec

From: Bob Moore <[email protected]>

ACPICA commit 454b2ea5f0c254e97612e15994f7d4734a7931ea

Adds two flags to the DMAR table.

Link: https://github.com/acpica/acpica/commit/454b2ea5
Signed-off-by: Bob Moore <[email protected]>
Signed-off-by: Lv Zheng <[email protected]>
---
include/acpi/actbl2.h | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/include/acpi/actbl2.h b/include/acpi/actbl2.h
index d6bd377..c93dbad 100644
--- a/include/acpi/actbl2.h
+++ b/include/acpi/actbl2.h
@@ -404,7 +404,7 @@ struct acpi_table_dbgp {
* Version 1
*
* Conforms to "Intel Virtualization Technology for Directed I/O",
- * Version 2.2, Sept. 2013
+ * Version 2.3, October 2014
*
******************************************************************************/

@@ -418,6 +418,8 @@ struct acpi_table_dmar {
/* Masks for Flags field above */

#define ACPI_DMAR_INTR_REMAP (1)
+#define ACPI_DMAR_X2APIC_OPT_OUT (1<<1)
+#define ACPI_DMAR_X2APIC_MODE (1<<2)

/* DMAR subtable header */

--
1.7.10

2016-03-24 01:39:34

by Zheng, Lv

[permalink] [raw]
Subject: [PATCH 09/30] ACPICA: Tables: Update FADT handling

From: Bob Moore <[email protected]>

ACPICA commit bca0c4cb063ee488c543e6f160fe89679a2338d6

Update a warning message
simplify versioning for "table too big" case.

Link: https://github.com/acpica/acpica/commit/bca0c4cb
Signed-off-by: Bob Moore <[email protected]>
Signed-off-by: Lv Zheng <[email protected]>
---
drivers/acpi/acpica/tbfadt.c | 18 +++++++++++-------
include/acpi/actbl.h | 4 +++-
2 files changed, 14 insertions(+), 8 deletions(-)

diff --git a/drivers/acpi/acpica/tbfadt.c b/drivers/acpi/acpica/tbfadt.c
index a79e4f3..f63f3fd 100644
--- a/drivers/acpi/acpica/tbfadt.c
+++ b/drivers/acpi/acpica/tbfadt.c
@@ -385,14 +385,15 @@ void acpi_tb_create_local_fadt(struct acpi_table_header *table, u32 length)
{
/*
* Check if the FADT is larger than the largest table that we expect
- * (the ACPI 5.0 version). If so, truncate the table, and issue
- * a warning.
+ * (typically the current ACPI specification version). If so, truncate
+ * the table, and issue a warning.
*/
if (length > sizeof(struct acpi_table_fadt)) {
ACPI_BIOS_WARNING((AE_INFO,
- "FADT (revision %u) is longer than ACPI 5.0 version, "
+ "FADT (revision %u) is longer than %s length, "
"truncating length %u to %u",
- table->revision, length,
+ table->revision, ACPI_FADT_CONFORMANCE,
+ length,
(u32)sizeof(struct acpi_table_fadt)));
}

@@ -646,9 +647,12 @@ static void acpi_tb_convert_fadt(void)
if ((address64->address && !length) ||
(!address64->address && length)) {
ACPI_BIOS_WARNING((AE_INFO,
- "Optional FADT field %s has zero address or length: "
- "0x%8.8X%8.8X/0x%X",
- name,
+ "Optional FADT field %s has valid %s but zero %s: "
+ "0x%8.8X%8.8X/0x%X", name,
+ (length ? "Length" :
+ "Address"),
+ (length ? "Address" :
+ "Length"),
ACPI_FORMAT_UINT64
(address64->address),
length));
diff --git a/include/acpi/actbl.h b/include/acpi/actbl.h
index 0cb1a00..c19700e 100644
--- a/include/acpi/actbl.h
+++ b/include/acpi/actbl.h
@@ -223,7 +223,7 @@ struct acpi_table_facs {
/*******************************************************************************
*
* FADT - Fixed ACPI Description Table (Signature "FACP")
- * Version 4
+ * Version 6
*
******************************************************************************/

@@ -413,4 +413,6 @@ struct acpi_table_desc {
#define ACPI_FADT_V5_SIZE (u32) (ACPI_FADT_OFFSET (hypervisor_id))
#define ACPI_FADT_V6_SIZE (u32) (sizeof (struct acpi_table_fadt))

+#define ACPI_FADT_CONFORMANCE "ACPI 6.1 (FADT version 6)"
+
#endif /* __ACTBL_H__ */
--
1.7.10

2016-03-24 01:39:49

by Zheng, Lv

[permalink] [raw]
Subject: [PATCH 11/30] ACPICA: iASL/Headers: Fix incorrect definition of FPDT table

From: Bob Moore <[email protected]>

ACPICA commit f30ba83711bcb860f9b17dd36d0bcc5242a4ef91

ACPICA BZ 1249.

Link: https://github.com/acpica/acpica/commit/f30ba837
Link: https://bugs.acpica.org/show_bug.cgi?id=1249
Reported-by: Greg Elkin <[email protected]>
Signed-off-by: Bob Moore <[email protected]>
Signed-off-by: Lv Zheng <[email protected]>
---
include/acpi/actbl3.h | 43 ++++++++++++++++++++++++-------------------
1 file changed, 24 insertions(+), 19 deletions(-)

diff --git a/include/acpi/actbl3.h b/include/acpi/actbl3.h
index ddf5e66..f12f4bb 100644
--- a/include/acpi/actbl3.h
+++ b/include/acpi/actbl3.h
@@ -184,7 +184,7 @@ struct acpi_table_fpdt {
struct acpi_table_header header; /* Common ACPI table header */
};

-/* FPDT subtable header */
+/* FPDT subtable header (Performance Record Structure) */

struct acpi_fpdt_header {
u16 type;
@@ -205,19 +205,15 @@ enum acpi_fpdt_type {

/* 0: Firmware Basic Boot Performance Record */

-struct acpi_fpdt_boot {
+struct acpi_fpdt_boot_pointer {
struct acpi_fpdt_header header;
u8 reserved[4];
- u64 reset_end;
- u64 load_start;
- u64 startup_start;
- u64 exit_services_entry;
- u64 exit_services_exit;
+ u64 address;
};

/* 1: S3 Performance Table Pointer Record */

-struct acpi_fpdt_s3pt_ptr {
+struct acpi_fpdt_s3pt_pointer {
struct acpi_fpdt_header header;
u8 reserved[4];
u64 address;
@@ -225,7 +221,7 @@ struct acpi_fpdt_s3pt_ptr {

/*
* S3PT - S3 Performance Table. This table is pointed to by the
- * FPDT S3 Pointer Record above.
+ * S3 Pointer Record above.
*/
struct acpi_table_s3pt {
u8 signature[4]; /* "S3PT" */
@@ -233,34 +229,43 @@ struct acpi_table_s3pt {
};

/*
- * S3PT Subtables
+ * S3PT Subtables (Not part of the actual FPDT)
*/
-struct acpi_s3pt_header {
- u16 type;
- u8 length;
- u8 revision;
-};

-/* Values for Type field above */
+/* Values for Type field in S3PT header */

enum acpi_s3pt_type {
ACPI_S3PT_TYPE_RESUME = 0,
- ACPI_S3PT_TYPE_SUSPEND = 1
+ ACPI_S3PT_TYPE_SUSPEND = 1,
+ ACPI_FPDT_BOOT_PERFORMANCE = 2
};

struct acpi_s3pt_resume {
- struct acpi_s3pt_header header;
+ struct acpi_fpdt_header header;
u32 resume_count;
u64 full_resume;
u64 average_resume;
};

struct acpi_s3pt_suspend {
- struct acpi_s3pt_header header;
+ struct acpi_fpdt_header header;
u64 suspend_start;
u64 suspend_end;
};

+/*
+ * FPDT Boot Performance Record (Not part of the actual FPDT)
+ */
+struct acpi_fpdt_boot {
+ struct acpi_fpdt_header header;
+ u8 reserved[4];
+ u64 reset_end;
+ u64 load_start;
+ u64 startup_start;
+ u64 exit_services_entry;
+ u64 exit_services_exit;
+};
+
/*******************************************************************************
*
* GTDT - Generic Timer Description Table (ACPI 5.1)
--
1.7.10

2016-03-24 01:39:41

by Zheng, Lv

[permalink] [raw]
Subject: [PATCH 10/30] ACPICA: ACPI 6.1: Add full support for this version of ACPI spec

From: Bob Moore <[email protected]>

ACPICA commit 5f21bddaa2cec035ca80608803ce2f0858d4f387

Small changes:
1) A couple new predefined names
2) New _HID values
3) New subtable for HEST

Link: https://github.com/acpica/acpica/commit/5f21bdda
Signed-off-by: Bob Moore <[email protected]>
Signed-off-by: Lv Zheng <[email protected]>
---
drivers/acpi/acpica/acpredef.h | 9 +++++++++
drivers/acpi/acpica/utdecode.c | 30 +++++++++++++++++-------------
include/acpi/actbl1.h | 6 ++++--
include/acpi/actypes.h | 3 ++-
4 files changed, 32 insertions(+), 16 deletions(-)

diff --git a/drivers/acpi/acpica/acpredef.h b/drivers/acpi/acpica/acpredef.h
index 5faeab4..4ca426b 100644
--- a/drivers/acpi/acpica/acpredef.h
+++ b/drivers/acpi/acpica/acpredef.h
@@ -523,6 +523,9 @@ const union acpi_predefined_info acpi_gbl_predefined_methods[] = {
METHOD_RETURNS(ACPI_RTYPE_PACKAGE)}}, /* Fixed-length (4 Int) */
PACKAGE_INFO(ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 4, 0, 0, 0),

+ {{"_FIT", METHOD_0ARGS,
+ METHOD_RETURNS(ACPI_RTYPE_BUFFER)}}, /* ACPI 6.0 */
+
{{"_FIX", METHOD_0ARGS,
METHOD_RETURNS(ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Ints) */
PACKAGE_INFO(ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 0, 0, 0, 0),
@@ -1053,6 +1056,12 @@ const union acpi_predefined_info acpi_gbl_predefined_methods[] = {
METHOD_RETURNS(ACPI_RTYPE_INTEGER | ACPI_RTYPE_STRING |
ACPI_RTYPE_BUFFER)}},

+ {{"_WPC", METHOD_0ARGS,
+ METHOD_RETURNS(ACPI_RTYPE_INTEGER)}}, /* ACPI 6.1 */
+
+ {{"_WPP", METHOD_0ARGS,
+ METHOD_RETURNS(ACPI_RTYPE_INTEGER)}}, /* ACPI 6.1 */
+
PACKAGE_INFO(0, 0, 0, 0, 0, 0) /* Table terminator */
};
#else
diff --git a/drivers/acpi/acpica/utdecode.c b/drivers/acpi/acpica/utdecode.c
index 6ba65b0..efd7988 100644
--- a/drivers/acpi/acpica/utdecode.c
+++ b/drivers/acpi/acpica/utdecode.c
@@ -446,7 +446,7 @@ const char *acpi_ut_get_mutex_name(u32 mutex_id)

/* Names for Notify() values, used for debug output */

-static const char *acpi_gbl_generic_notify[ACPI_NOTIFY_MAX + 1] = {
+static const char *acpi_gbl_generic_notify[ACPI_GENERIC_NOTIFY_MAX + 1] = {
/* 00 */ "Bus Check",
/* 01 */ "Device Check",
/* 02 */ "Device Wake",
@@ -459,49 +459,53 @@ static const char *acpi_gbl_generic_notify[ACPI_NOTIFY_MAX + 1] = {
/* 09 */ "Device PLD Check",
/* 0A */ "Reserved",
/* 0B */ "System Locality Update",
- /* 0C */ "Shutdown Request",
+ /* 0C */ "Shutdown Request",
+ /* Reserved in ACPI 6.0 */
/* 0D */ "System Resource Affinity Update"
};

-static const char *acpi_gbl_device_notify[4] = {
+static const char *acpi_gbl_device_notify[5] = {
/* 80 */ "Status Change",
/* 81 */ "Information Change",
/* 82 */ "Device-Specific Change",
- /* 83 */ "Device-Specific Change"
+ /* 83 */ "Device-Specific Change",
+ /* 84 */ "Reserved"
};

-static const char *acpi_gbl_processor_notify[4] = {
+static const char *acpi_gbl_processor_notify[5] = {
/* 80 */ "Performance Capability Change",
/* 81 */ "C-State Change",
/* 82 */ "Throttling Capability Change",
- /* 83 */ "Device-Specific Change"
+ /* 83 */ "Guaranteed Change",
+ /* 84 */ "Minimum Excursion"
};

-static const char *acpi_gbl_thermal_notify[4] = {
+static const char *acpi_gbl_thermal_notify[5] = {
/* 80 */ "Thermal Status Change",
/* 81 */ "Thermal Trip Point Change",
/* 82 */ "Thermal Device List Change",
- /* 83 */ "Thermal Relationship Change"
+ /* 83 */ "Thermal Relationship Change",
+ /* 84 */ "Reserved"
};

const char *acpi_ut_get_notify_name(u32 notify_value, acpi_object_type type)
{

- /* 00 - 0D are common to all object types */
+ /* 00 - 0D are "common to all object types" (from ACPI Spec) */

- if (notify_value <= ACPI_NOTIFY_MAX) {
+ if (notify_value <= ACPI_GENERIC_NOTIFY_MAX) {
return (acpi_gbl_generic_notify[notify_value]);
}

- /* 0D - 7F are reserved */
+ /* 0E - 7F are reserved */

if (notify_value <= ACPI_MAX_SYS_NOTIFY) {
return ("Reserved");
}

- /* 80 - 83 are per-object-type */
+ /* 80 - 84 are per-object-type */

- if (notify_value <= 0x83) {
+ if (notify_value <= ACPI_SPECIFIC_NOTIFY_MAX) {
switch (type) {
case ACPI_TYPE_ANY:
case ACPI_TYPE_DEVICE:
diff --git a/include/acpi/actbl1.h b/include/acpi/actbl1.h
index 912dff9..796d6ba 100644
--- a/include/acpi/actbl1.h
+++ b/include/acpi/actbl1.h
@@ -236,7 +236,8 @@ enum acpi_einj_actions {
ACPI_EINJ_CHECK_BUSY_STATUS = 6,
ACPI_EINJ_GET_COMMAND_STATUS = 7,
ACPI_EINJ_SET_ERROR_TYPE_WITH_ADDRESS = 8,
- ACPI_EINJ_ACTION_RESERVED = 9, /* 9 and greater are reserved */
+ ACPI_EINJ_GET_EXECUTE_TIMINGS = 9,
+ ACPI_EINJ_ACTION_RESERVED = 10, /* 10 and greater are reserved */
ACPI_EINJ_TRIGGER_ERROR = 0xFF /* Except for this value */
};

@@ -348,7 +349,8 @@ enum acpi_erst_actions {
ACPI_ERST_GET_ERROR_RANGE = 13,
ACPI_ERST_GET_ERROR_LENGTH = 14,
ACPI_ERST_GET_ERROR_ATTRIBUTES = 15,
- ACPI_ERST_ACTION_RESERVED = 16 /* 16 and greater are reserved */
+ ACPI_ERST_EXECUTE_TIMINGS = 16,
+ ACPI_ERST_ACTION_RESERVED = 17 /* 17 and greater are reserved */
};

/* Values for Instruction field above */
diff --git a/include/acpi/actypes.h b/include/acpi/actypes.h
index db46546..140886e 100644
--- a/include/acpi/actypes.h
+++ b/include/acpi/actypes.h
@@ -630,7 +630,8 @@ typedef u64 acpi_integer;
#define ACPI_NOTIFY_SHUTDOWN_REQUEST (u8) 0x0C
#define ACPI_NOTIFY_AFFINITY_UPDATE (u8) 0x0D

-#define ACPI_NOTIFY_MAX 0x0D
+#define ACPI_GENERIC_NOTIFY_MAX 0x0D
+#define ACPI_SPECIFIC_NOTIFY_MAX 0x84

/*
* Types associated with ACPI names and objects. The first group of
--
1.7.10

2016-03-24 01:40:04

by Zheng, Lv

[permalink] [raw]
Subject: [PATCH 12/30] ACPICA: Intepreter: Add object extensions to Concatenate operand

From: Bob Moore <[email protected]>

ACPICA commit 60d9cfd403a9824199b971597c930f6f563e5c71

Allows all object types to be used with Concatenate. Objects
other than Int/Str/Buf are convert to a string that contains
the type of the object. Improves the utility of the Printf
and Fprintf macros.

Adds a new file, exconcat.c

Link: https://github.com/acpica/acpica/commit/60d9cfd4
Signed-off-by: Bob Moore <[email protected]>
Signed-off-by: Lv Zheng <[email protected]>
---
drivers/acpi/acpica/Makefile | 1 +
drivers/acpi/acpica/exconcat.c | 439 ++++++++++++++++++++++++++++++++++++++++
drivers/acpi/acpica/exmisc.c | 290 --------------------------
3 files changed, 440 insertions(+), 290 deletions(-)
create mode 100644 drivers/acpi/acpica/exconcat.c

diff --git a/drivers/acpi/acpica/Makefile b/drivers/acpi/acpica/Makefile
index f682374..188597f 100644
--- a/drivers/acpi/acpica/Makefile
+++ b/drivers/acpi/acpica/Makefile
@@ -43,6 +43,7 @@ acpi-y += \
evxfregn.o

acpi-y += \
+ exconcat.o \
exconfig.o \
exconvrt.o \
excreate.o \
diff --git a/drivers/acpi/acpica/exconcat.c b/drivers/acpi/acpica/exconcat.c
new file mode 100644
index 0000000..553e014
--- /dev/null
+++ b/drivers/acpi/acpica/exconcat.c
@@ -0,0 +1,439 @@
+/******************************************************************************
+ *
+ * Module Name: exconcat - Concatenate-type AML operators
+ *
+ *****************************************************************************/
+
+/*
+ * Copyright (C) 2000 - 2016, Intel Corp.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions, and the following disclaimer,
+ * without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ * substantially similar to the "NO WARRANTY" disclaimer below
+ * ("Disclaimer") and any redistribution must be conditioned upon
+ * including a substantially similar Disclaimer requirement for further
+ * binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ * of any contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
+ *
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#include <acpi/acpi.h>
+#include "accommon.h"
+#include "acinterp.h"
+#include "amlresrc.h"
+
+#define _COMPONENT ACPI_EXECUTER
+ACPI_MODULE_NAME("exconcat")
+
+/* Local Prototypes */
+static acpi_status
+acpi_ex_convert_to_object_type_string(union acpi_operand_object *obj_desc,
+ union acpi_operand_object **result_desc);
+
+/*******************************************************************************
+ *
+ * FUNCTION: acpi_ex_do_concatenate
+ *
+ * PARAMETERS: operand0 - First source object
+ * operand1 - Second source object
+ * actual_return_desc - Where to place the return object
+ * walk_state - Current walk state
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Concatenate two objects with the ACPI-defined conversion
+ * rules as necessary.
+ * NOTE:
+ * Per the ACPI spec (up to 6.1), Concatenate only supports Integer,
+ * String, and Buffer objects. However, we support all objects here
+ * as an extension. This improves the usefulness of both Concatenate
+ * and the Printf/Fprintf macros. The extension returns a string
+ * describing the object type for the other objects.
+ * 02/2016.
+ *
+ ******************************************************************************/
+
+acpi_status
+acpi_ex_do_concatenate(union acpi_operand_object *operand0,
+ union acpi_operand_object *operand1,
+ union acpi_operand_object **actual_return_desc,
+ struct acpi_walk_state *walk_state)
+{
+ union acpi_operand_object *local_operand0 = operand0;
+ union acpi_operand_object *local_operand1 = operand1;
+ union acpi_operand_object *temp_operand1 = NULL;
+ union acpi_operand_object *return_desc;
+ char *buffer;
+ acpi_object_type operand0_type;
+ acpi_object_type operand1_type;
+ acpi_status status;
+
+ ACPI_FUNCTION_TRACE(ex_do_concatenate);
+
+ /* Operand 0 preprocessing */
+
+ switch (operand0->common.type) {
+ case ACPI_TYPE_INTEGER:
+ case ACPI_TYPE_STRING:
+ case ACPI_TYPE_BUFFER:
+
+ operand0_type = operand0->common.type;
+ break;
+
+ default:
+
+ /* For all other types, get the "object type" string */
+
+ status =
+ acpi_ex_convert_to_object_type_string(operand0,
+ &local_operand0);
+ if (ACPI_FAILURE(status)) {
+ goto cleanup;
+ }
+
+ operand0_type = ACPI_TYPE_STRING;
+ break;
+ }
+
+ /* Operand 1 preprocessing */
+
+ switch (operand1->common.type) {
+ case ACPI_TYPE_INTEGER:
+ case ACPI_TYPE_STRING:
+ case ACPI_TYPE_BUFFER:
+
+ operand1_type = operand1->common.type;
+ break;
+
+ default:
+
+ /* For all other types, get the "object type" string */
+
+ status =
+ acpi_ex_convert_to_object_type_string(operand1,
+ &local_operand1);
+ if (ACPI_FAILURE(status)) {
+ goto cleanup;
+ }
+
+ operand1_type = ACPI_TYPE_STRING;
+ break;
+ }
+
+ /*
+ * Convert the second operand if necessary. The first operand (0)
+ * determines the type of the second operand (1) (See the Data Types
+ * section of the ACPI specification). Both object types are
+ * guaranteed to be either Integer/String/Buffer by the operand
+ * resolution mechanism.
+ */
+ switch (operand0_type) {
+ case ACPI_TYPE_INTEGER:
+
+ status =
+ acpi_ex_convert_to_integer(local_operand1, &temp_operand1,
+ 16);
+ break;
+
+ case ACPI_TYPE_BUFFER:
+
+ status =
+ acpi_ex_convert_to_buffer(local_operand1, &temp_operand1);
+ break;
+
+ case ACPI_TYPE_STRING:
+
+ switch (operand1_type) {
+ case ACPI_TYPE_INTEGER:
+ case ACPI_TYPE_STRING:
+ case ACPI_TYPE_BUFFER:
+
+ /* Other types have already been converted to string */
+
+ status =
+ acpi_ex_convert_to_string(local_operand1,
+ &temp_operand1,
+ ACPI_IMPLICIT_CONVERT_HEX);
+ break;
+
+ default:
+
+ status = AE_OK;
+ break;
+ }
+ break;
+
+ default:
+
+ ACPI_ERROR((AE_INFO, "Invalid object type: 0x%X",
+ operand0->common.type));
+ status = AE_AML_INTERNAL;
+ }
+
+ if (ACPI_FAILURE(status)) {
+ goto cleanup;
+ }
+
+ /* Take care with any newly created operand objects */
+
+ if ((local_operand1 != operand1) && (local_operand1 != temp_operand1)) {
+ acpi_ut_remove_reference(local_operand1);
+ }
+
+ local_operand1 = temp_operand1;
+
+ /*
+ * Both operands are now known to be the same object type
+ * (Both are Integer, String, or Buffer), and we can now perform
+ * the concatenation.
+ *
+ * There are three cases to handle, as per the ACPI spec:
+ *
+ * 1) Two Integers concatenated to produce a new Buffer
+ * 2) Two Strings concatenated to produce a new String
+ * 3) Two Buffers concatenated to produce a new Buffer
+ */
+ switch (operand0_type) {
+ case ACPI_TYPE_INTEGER:
+
+ /* Result of two Integers is a Buffer */
+ /* Need enough buffer space for two integers */
+
+ return_desc = acpi_ut_create_buffer_object((acpi_size)
+ ACPI_MUL_2
+ (acpi_gbl_integer_byte_width));
+ if (!return_desc) {
+ status = AE_NO_MEMORY;
+ goto cleanup;
+ }
+
+ buffer = (char *)return_desc->buffer.pointer;
+
+ /* Copy the first integer, LSB first */
+
+ memcpy(buffer, &operand0->integer.value,
+ acpi_gbl_integer_byte_width);
+
+ /* Copy the second integer (LSB first) after the first */
+
+ memcpy(buffer + acpi_gbl_integer_byte_width,
+ &local_operand1->integer.value,
+ acpi_gbl_integer_byte_width);
+ break;
+
+ case ACPI_TYPE_STRING:
+
+ /* Result of two Strings is a String */
+
+ return_desc = acpi_ut_create_string_object(((acpi_size)
+ local_operand0->
+ string.length +
+ local_operand1->
+ string.length));
+ if (!return_desc) {
+ status = AE_NO_MEMORY;
+ goto cleanup;
+ }
+
+ buffer = return_desc->string.pointer;
+
+ /* Concatenate the strings */
+
+ strcpy(buffer, local_operand0->string.pointer);
+ strcat(buffer, local_operand1->string.pointer);
+ break;
+
+ case ACPI_TYPE_BUFFER:
+
+ /* Result of two Buffers is a Buffer */
+
+ return_desc = acpi_ut_create_buffer_object(((acpi_size)
+ operand0->buffer.
+ length +
+ local_operand1->
+ buffer.length));
+ if (!return_desc) {
+ status = AE_NO_MEMORY;
+ goto cleanup;
+ }
+
+ buffer = (char *)return_desc->buffer.pointer;
+
+ /* Concatenate the buffers */
+
+ memcpy(buffer, operand0->buffer.pointer,
+ operand0->buffer.length);
+ memcpy(buffer + operand0->buffer.length,
+ local_operand1->buffer.pointer,
+ local_operand1->buffer.length);
+ break;
+
+ default:
+
+ /* Invalid object type, should not happen here */
+
+ ACPI_ERROR((AE_INFO, "Invalid object type: 0x%X",
+ operand0->common.type));
+ status = AE_AML_INTERNAL;
+ goto cleanup;
+ }
+
+ *actual_return_desc = return_desc;
+
+cleanup:
+ if (local_operand0 != operand0) {
+ acpi_ut_remove_reference(local_operand0);
+ }
+
+ if (local_operand1 != operand1) {
+ acpi_ut_remove_reference(local_operand1);
+ }
+
+ return_ACPI_STATUS(status);
+}
+
+/*******************************************************************************
+ *
+ * FUNCTION: acpi_ex_convert_to_object_type_string
+ *
+ * PARAMETERS: obj_desc - Object to be converted
+ * return_desc - Where to place the return object
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Convert an object of arbitrary type to a string object that
+ * contains the namestring for the object. Used for the
+ * concatenate operator.
+ *
+ ******************************************************************************/
+
+static acpi_status
+acpi_ex_convert_to_object_type_string(union acpi_operand_object *obj_desc,
+ union acpi_operand_object **result_desc)
+{
+ union acpi_operand_object *return_desc;
+ const char *type_string;
+
+ type_string = acpi_ut_get_type_name(obj_desc->common.type);
+
+ return_desc = acpi_ut_create_string_object(((acpi_size) strlen(type_string) + 9)); /* 9 For "[ Object]" */
+ if (!return_desc) {
+ return (AE_NO_MEMORY);
+ }
+
+ strcpy(return_desc->string.pointer, "[");
+ strcat(return_desc->string.pointer, type_string);
+ strcat(return_desc->string.pointer, " Object]");
+
+ *result_desc = return_desc;
+ return (AE_OK);
+}
+
+/*******************************************************************************
+ *
+ * FUNCTION: acpi_ex_concat_template
+ *
+ * PARAMETERS: operand0 - First source object
+ * operand1 - Second source object
+ * actual_return_desc - Where to place the return object
+ * walk_state - Current walk state
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Concatenate two resource templates
+ *
+ ******************************************************************************/
+
+acpi_status
+acpi_ex_concat_template(union acpi_operand_object *operand0,
+ union acpi_operand_object *operand1,
+ union acpi_operand_object **actual_return_desc,
+ struct acpi_walk_state * walk_state)
+{
+ acpi_status status;
+ union acpi_operand_object *return_desc;
+ u8 *new_buf;
+ u8 *end_tag;
+ acpi_size length0;
+ acpi_size length1;
+ acpi_size new_length;
+
+ ACPI_FUNCTION_TRACE(ex_concat_template);
+
+ /*
+ * Find the end_tag descriptor in each resource template.
+ * Note1: returned pointers point TO the end_tag, not past it.
+ * Note2: zero-length buffers are allowed; treated like one end_tag
+ */
+
+ /* Get the length of the first resource template */
+
+ status = acpi_ut_get_resource_end_tag(operand0, &end_tag);
+ if (ACPI_FAILURE(status)) {
+ return_ACPI_STATUS(status);
+ }
+
+ length0 = ACPI_PTR_DIFF(end_tag, operand0->buffer.pointer);
+
+ /* Get the length of the second resource template */
+
+ status = acpi_ut_get_resource_end_tag(operand1, &end_tag);
+ if (ACPI_FAILURE(status)) {
+ return_ACPI_STATUS(status);
+ }
+
+ length1 = ACPI_PTR_DIFF(end_tag, operand1->buffer.pointer);
+
+ /* Combine both lengths, minimum size will be 2 for end_tag */
+
+ new_length = length0 + length1 + sizeof(struct aml_resource_end_tag);
+
+ /* Create a new buffer object for the result (with one end_tag) */
+
+ return_desc = acpi_ut_create_buffer_object(new_length);
+ if (!return_desc) {
+ return_ACPI_STATUS(AE_NO_MEMORY);
+ }
+
+ /*
+ * Copy the templates to the new buffer, 0 first, then 1 follows. One
+ * end_tag descriptor is copied from Operand1.
+ */
+ new_buf = return_desc->buffer.pointer;
+ 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" */
+
+ new_buf[new_length - 1] = 0;
+ new_buf[new_length - 2] = ACPI_RESOURCE_NAME_END_TAG | 1;
+
+ /* Return the completed resource template */
+
+ *actual_return_desc = return_desc;
+ return_ACPI_STATUS(AE_OK);
+}
diff --git a/drivers/acpi/acpica/exmisc.c b/drivers/acpi/acpica/exmisc.c
index db30ae4..4f7e667 100644
--- a/drivers/acpi/acpica/exmisc.c
+++ b/drivers/acpi/acpica/exmisc.c
@@ -45,7 +45,6 @@
#include "accommon.h"
#include "acinterp.h"
#include "amlcode.h"
-#include "amlresrc.h"

#define _COMPONENT ACPI_EXECUTER
ACPI_MODULE_NAME("exmisc")
@@ -140,295 +139,6 @@ acpi_ex_get_object_reference(union acpi_operand_object *obj_desc,

/*******************************************************************************
*
- * FUNCTION: acpi_ex_concat_template
- *
- * PARAMETERS: operand0 - First source object
- * operand1 - Second source object
- * actual_return_desc - Where to place the return object
- * walk_state - Current walk state
- *
- * RETURN: Status
- *
- * DESCRIPTION: Concatenate two resource templates
- *
- ******************************************************************************/
-
-acpi_status
-acpi_ex_concat_template(union acpi_operand_object *operand0,
- union acpi_operand_object *operand1,
- union acpi_operand_object **actual_return_desc,
- struct acpi_walk_state *walk_state)
-{
- acpi_status status;
- union acpi_operand_object *return_desc;
- u8 *new_buf;
- u8 *end_tag;
- acpi_size length0;
- acpi_size length1;
- acpi_size new_length;
-
- ACPI_FUNCTION_TRACE(ex_concat_template);
-
- /*
- * Find the end_tag descriptor in each resource template.
- * Note1: returned pointers point TO the end_tag, not past it.
- * Note2: zero-length buffers are allowed; treated like one end_tag
- */
-
- /* Get the length of the first resource template */
-
- status = acpi_ut_get_resource_end_tag(operand0, &end_tag);
- if (ACPI_FAILURE(status)) {
- return_ACPI_STATUS(status);
- }
-
- length0 = ACPI_PTR_DIFF(end_tag, operand0->buffer.pointer);
-
- /* Get the length of the second resource template */
-
- status = acpi_ut_get_resource_end_tag(operand1, &end_tag);
- if (ACPI_FAILURE(status)) {
- return_ACPI_STATUS(status);
- }
-
- length1 = ACPI_PTR_DIFF(end_tag, operand1->buffer.pointer);
-
- /* Combine both lengths, minimum size will be 2 for end_tag */
-
- new_length = length0 + length1 + sizeof(struct aml_resource_end_tag);
-
- /* Create a new buffer object for the result (with one end_tag) */
-
- return_desc = acpi_ut_create_buffer_object(new_length);
- if (!return_desc) {
- return_ACPI_STATUS(AE_NO_MEMORY);
- }
-
- /*
- * Copy the templates to the new buffer, 0 first, then 1 follows. One
- * end_tag descriptor is copied from Operand1.
- */
- new_buf = return_desc->buffer.pointer;
- 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" */
-
- new_buf[new_length - 1] = 0;
- new_buf[new_length - 2] = ACPI_RESOURCE_NAME_END_TAG | 1;
-
- /* Return the completed resource template */
-
- *actual_return_desc = return_desc;
- return_ACPI_STATUS(AE_OK);
-}
-
-/*******************************************************************************
- *
- * FUNCTION: acpi_ex_do_concatenate
- *
- * PARAMETERS: operand0 - First source object
- * operand1 - Second source object
- * actual_return_desc - Where to place the return object
- * walk_state - Current walk state
- *
- * RETURN: Status
- *
- * DESCRIPTION: Concatenate two objects OF THE SAME TYPE.
- *
- ******************************************************************************/
-
-acpi_status
-acpi_ex_do_concatenate(union acpi_operand_object *operand0,
- union acpi_operand_object *operand1,
- union acpi_operand_object **actual_return_desc,
- struct acpi_walk_state *walk_state)
-{
- union acpi_operand_object *local_operand1 = operand1;
- union acpi_operand_object *return_desc;
- char *new_buf;
- const char *type_string;
- acpi_status status;
-
- ACPI_FUNCTION_TRACE(ex_do_concatenate);
-
- /*
- * Convert the second operand if necessary. The first operand
- * determines the type of the second operand, (See the Data Types
- * section of the ACPI specification.) Both object types are
- * guaranteed to be either Integer/String/Buffer by the operand
- * resolution mechanism.
- */
- switch (operand0->common.type) {
- case ACPI_TYPE_INTEGER:
-
- status =
- acpi_ex_convert_to_integer(operand1, &local_operand1, 16);
- break;
-
- case ACPI_TYPE_STRING:
- /*
- * Per the ACPI spec, Concatenate only supports int/str/buf.
- * However, we support all objects here as an extension.
- * This improves the usefulness of the Printf() macro.
- * 12/2015.
- */
- switch (operand1->common.type) {
- case ACPI_TYPE_INTEGER:
- case ACPI_TYPE_STRING:
- case ACPI_TYPE_BUFFER:
-
- status =
- acpi_ex_convert_to_string(operand1, &local_operand1,
- ACPI_IMPLICIT_CONVERT_HEX);
- break;
-
- default:
- /*
- * Just emit a string containing the object type.
- */
- type_string =
- acpi_ut_get_type_name(operand1->common.type);
-
- local_operand1 = acpi_ut_create_string_object(((acpi_size) strlen(type_string) + 9)); /* 9 For "[Object]" */
- if (!local_operand1) {
- status = AE_NO_MEMORY;
- goto cleanup;
- }
-
- strcpy(local_operand1->string.pointer, "[");
- strcat(local_operand1->string.pointer, type_string);
- strcat(local_operand1->string.pointer, " Object]");
- status = AE_OK;
- break;
- }
- break;
-
- case ACPI_TYPE_BUFFER:
-
- status = acpi_ex_convert_to_buffer(operand1, &local_operand1);
- break;
-
- default:
-
- ACPI_ERROR((AE_INFO, "Invalid object type: 0x%X",
- operand0->common.type));
- status = AE_AML_INTERNAL;
- }
-
- if (ACPI_FAILURE(status)) {
- goto cleanup;
- }
-
- /*
- * Both operands are now known to be the same object type
- * (Both are Integer, String, or Buffer), and we can now perform the
- * concatenation.
- */
-
- /*
- * There are three cases to handle:
- *
- * 1) Two Integers concatenated to produce a new Buffer
- * 2) Two Strings concatenated to produce a new String
- * 3) Two Buffers concatenated to produce a new Buffer
- */
- switch (operand0->common.type) {
- case ACPI_TYPE_INTEGER:
-
- /* Result of two Integers is a Buffer */
- /* Need enough buffer space for two integers */
-
- return_desc = acpi_ut_create_buffer_object((acpi_size)
- ACPI_MUL_2
- (acpi_gbl_integer_byte_width));
- if (!return_desc) {
- status = AE_NO_MEMORY;
- goto cleanup;
- }
-
- new_buf = (char *)return_desc->buffer.pointer;
-
- /* Copy the first integer, LSB first */
-
- memcpy(new_buf, &operand0->integer.value,
- acpi_gbl_integer_byte_width);
-
- /* Copy the second integer (LSB first) after the first */
-
- memcpy(new_buf + acpi_gbl_integer_byte_width,
- &local_operand1->integer.value,
- acpi_gbl_integer_byte_width);
- break;
-
- case ACPI_TYPE_STRING:
-
- /* Result of two Strings is a String */
-
- return_desc = acpi_ut_create_string_object(((acpi_size)
- operand0->string.
- length +
- local_operand1->
- string.length));
- if (!return_desc) {
- status = AE_NO_MEMORY;
- goto cleanup;
- }
-
- new_buf = return_desc->string.pointer;
-
- /* Concatenate the strings */
-
- strcpy(new_buf, operand0->string.pointer);
- strcat(new_buf, local_operand1->string.pointer);
- break;
-
- case ACPI_TYPE_BUFFER:
-
- /* Result of two Buffers is a Buffer */
-
- return_desc = acpi_ut_create_buffer_object(((acpi_size)
- operand0->buffer.
- length +
- local_operand1->
- buffer.length));
- if (!return_desc) {
- status = AE_NO_MEMORY;
- goto cleanup;
- }
-
- new_buf = (char *)return_desc->buffer.pointer;
-
- /* Concatenate the buffers */
-
- 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:
-
- /* Invalid object type, should not happen here */
-
- ACPI_ERROR((AE_INFO, "Invalid object type: 0x%X",
- operand0->common.type));
- status = AE_AML_INTERNAL;
- goto cleanup;
- }
-
- *actual_return_desc = return_desc;
-
-cleanup:
- if (local_operand1 != operand1) {
- acpi_ut_remove_reference(local_operand1);
- }
- return_ACPI_STATUS(status);
-}
-
-/*******************************************************************************
- *
* FUNCTION: acpi_ex_do_math_op
*
* PARAMETERS: opcode - AML opcode
--
1.7.10

2016-03-24 01:40:11

by Zheng, Lv

[permalink] [raw]
Subject: [PATCH 13/30] ACPICA: Interpreter: Update some function headers, no functional change

From: Bob Moore <[email protected]>

ACPICA commit e068948f49eb61a78c211028976a174604c5644a

Fix some issues in the exutils.c file.

Link: https://github.com/acpica/acpica/commit/e068948f
Signed-off-by: Bob Moore <[email protected]>
Signed-off-by: Lv Zheng <[email protected]>
---
drivers/acpi/acpica/exutils.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/acpi/acpica/exutils.c b/drivers/acpi/acpica/exutils.c
index 4d44bc1..425f133 100644
--- a/drivers/acpi/acpica/exutils.c
+++ b/drivers/acpi/acpica/exutils.c
@@ -301,8 +301,8 @@ static u32 acpi_ex_digits_needed(u64 value, u32 base)
*
* FUNCTION: acpi_ex_eisa_id_to_string
*
- * PARAMETERS: compressed_id - EISAID to be converted
- * out_string - Where to put the converted string (8 bytes)
+ * PARAMETERS: out_string - Where to put the converted string (8 bytes)
+ * compressed_id - EISAID to be converted
*
* RETURN: None
*
@@ -354,7 +354,7 @@ void acpi_ex_eisa_id_to_string(char *out_string, u64 compressed_id)
* possible 64-bit integer.
* value - Value to be converted
*
- * RETURN: None, string
+ * RETURN: Converted string in out_string
*
* DESCRIPTION: Convert a 64-bit integer to decimal string representation.
* Assumes string buffer is large enough to hold the string. The
@@ -384,9 +384,9 @@ 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)
+ * class_code - PCI class code to be converted (3 bytes)
*
- * RETURN: None
+ * RETURN: Converted string in out_string
*
* DESCRIPTION: Convert 3-bytes PCI class code to string representation.
* Return buffer must be large enough to hold the string. The
@@ -417,7 +417,7 @@ void acpi_ex_pci_cls_to_string(char *out_string, u8 class_code[3])
*
* PARAMETERS: space_id - ID to be validated
*
- * RETURN: TRUE if valid/supported ID.
+ * RETURN: TRUE if space_id is a valid/supported ID.
*
* DESCRIPTION: Validate an operation region space_ID.
*
--
1.7.10

2016-03-24 01:40:20

by Zheng, Lv

[permalink] [raw]
Subject: [PATCH 15/30] ACPICA: Cleanup some invocation indentations, no functional change

From: Bob Moore <[email protected]>

ACPICA commit 9ed98dc36645aaeba11967722951156650d94f47

For consistency, cleanup function invocations.

Link: https://github.com/acpica/acpica/commit/9ed98dc3
Signed-off-by: Bob Moore <[email protected]>
Signed-off-by: Lv Zheng <[email protected]>
---
drivers/acpi/acpica/nsprepkg.c | 6 ++++++
1 file changed, 6 insertions(+)

diff --git a/drivers/acpi/acpica/nsprepkg.c b/drivers/acpi/acpica/nsprepkg.c
index 9047f28..fde5a09 100644
--- a/drivers/acpi/acpica/nsprepkg.c
+++ b/drivers/acpi/acpica/nsprepkg.c
@@ -179,6 +179,7 @@ acpi_ns_check_package(struct acpi_evaluate_info *info,
if (ACPI_FAILURE(status)) {
return (status);
}
+
elements++;
}
break;
@@ -225,6 +226,7 @@ acpi_ns_check_package(struct acpi_evaluate_info *info,
return (status);
}
}
+
elements++;
}
break;
@@ -569,11 +571,13 @@ acpi_ns_check_package_list(struct acpi_evaluate_info *info,
if (sub_package->package.count < expected_count) {
goto package_too_small;
}
+
if (sub_package->package.count <
package->ret_info.count1) {
expected_count = package->ret_info.count1;
goto package_too_small;
}
+
if (expected_count == 0) {
/*
* Either the num_entries element was originally zero or it was
@@ -661,6 +665,7 @@ acpi_ns_check_package_elements(struct acpi_evaluate_info *info,
if (ACPI_FAILURE(status)) {
return (status);
}
+
this_element++;
}

@@ -671,6 +676,7 @@ acpi_ns_check_package_elements(struct acpi_evaluate_info *info,
if (ACPI_FAILURE(status)) {
return (status);
}
+
this_element++;
}

--
1.7.10

2016-03-24 01:40:24

by Zheng, Lv

[permalink] [raw]
Subject: [PATCH 16/30] ACPICA: Headers: Update generation of the ACPICA library

From: Bob Moore <[email protected]>

ACPICA commit 0af0f9092dcc3db6c05875eae68965fda333ad7f

For windows only, ensure that debug output is disabled for
the "release" (non-debug) case.

Link: https://github.com/acpica/acpica/commit/0af0f909
Signed-off-by: Bob Moore <[email protected]>
Signed-off-by: Lv Zheng <[email protected]>
---
include/acpi/platform/acenv.h | 41 +++++++++++++++++++++--------------------
1 file changed, 21 insertions(+), 20 deletions(-)

diff --git a/include/acpi/platform/acenv.h b/include/acpi/platform/acenv.h
index 7c0595b..72f85b4 100644
--- a/include/acpi/platform/acenv.h
+++ b/include/acpi/platform/acenv.h
@@ -66,17 +66,28 @@
*
*****************************************************************************/

+/* Common application configuration. All single threaded except for acpi_exec. */
+
+#if (defined ACPI_ASL_COMPILER) || \
+ (defined ACPI_BIN_APP) || \
+ (defined ACPI_DUMP_APP) || \
+ (defined ACPI_HELP_APP) || \
+ (defined ACPI_NAMES_APP) || \
+ (defined ACPI_SRC_APP) || \
+ (defined ACPI_XTRACT_APP) || \
+ (defined ACPI_EXAMPLE_APP)
+#define ACPI_APPLICATION
+#define ACPI_SINGLE_THREADED
+#endif
+
/* iASL configuration */

#ifdef ACPI_ASL_COMPILER
-#define ACPI_APPLICATION
#define ACPI_DEBUG_OUTPUT
#define ACPI_CONSTANT_EVAL_ONLY
#define ACPI_LARGE_NAMESPACE_NODE
#define ACPI_DATA_TABLE_DISASSEMBLY
-#define ACPI_SINGLE_THREADED
#define ACPI_32BIT_PHYSICAL_ADDRESS
-
#define ACPI_DISASSEMBLER 1
#endif

@@ -89,21 +100,6 @@
#define ACPI_DBG_TRACK_ALLOCATIONS
#endif

-/*
- * acpi_bin/acpi_dump/acpi_help/acpi_names/acpi_src/acpi_xtract/Example
- * configuration. All single threaded.
- */
-#if (defined ACPI_BIN_APP) || \
- (defined ACPI_DUMP_APP) || \
- (defined ACPI_HELP_APP) || \
- (defined ACPI_NAMES_APP) || \
- (defined ACPI_SRC_APP) || \
- (defined ACPI_XTRACT_APP) || \
- (defined ACPI_EXAMPLE_APP)
-#define ACPI_APPLICATION
-#define ACPI_SINGLE_THREADED
-#endif
-
/* acpi_help configuration. Error messages disabled. */

#ifdef ACPI_HELP_APP
@@ -138,11 +134,16 @@
#define ACPI_REDUCED_HARDWARE 1
#endif

-/* Linkable ACPICA library */
+/* Linkable ACPICA library. Two versions, one with full debug. */

#ifdef ACPI_LIBRARY
#define ACPI_USE_LOCAL_CACHE
-#define ACPI_FULL_DEBUG
+#define ACPI_DEBUGGER 1
+#define ACPI_DISASSEMBLER 1
+
+#ifdef _DEBUG
+#define ACPI_DEBUG_OUTPUT
+#endif
#endif

/* Common for all ACPICA applications */
--
1.7.10

2016-03-24 01:40:33

by Zheng, Lv

[permalink] [raw]
Subject: [PATCH 17/30] ACPICA: Add support for QNX 6.6 platform

From: Will Miles <[email protected]>

ACPICA commit 37a1dec2391272251e59948c16c60713183ae78f

Link: https://github.com/acpica/acpica/commit/37a1dec2
Signed-off-by: Will Miles <[email protected]>
Signed-off-by: Bob Moore <[email protected]>
Signed-off-by: Lv Zheng <[email protected]>
---
include/acpi/platform/acenv.h | 3 +++
tools/power/acpi/os_specific/service_layers/osunixmap.c | 2 +-
2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/include/acpi/platform/acenv.h b/include/acpi/platform/acenv.h
index 72f85b4..86b5a84 100644
--- a/include/acpi/platform/acenv.h
+++ b/include/acpi/platform/acenv.h
@@ -219,6 +219,9 @@
#elif defined(__HAIKU__)
#include "achaiku.h"

+#elif defined(__QNX__)
+#include "acqnx.h"
+
#else

/* Unknown environment */
diff --git a/tools/power/acpi/os_specific/service_layers/osunixmap.c b/tools/power/acpi/os_specific/service_layers/osunixmap.c
index 3818fd0..cbfbce1 100644
--- a/tools/power/acpi/os_specific/service_layers/osunixmap.c
+++ b/tools/power/acpi/os_specific/service_layers/osunixmap.c
@@ -54,7 +54,7 @@ ACPI_MODULE_NAME("osunixmap")
#ifndef O_BINARY
#define O_BINARY 0
#endif
-#if defined(_dragon_fly) || defined(_free_BSD)
+#if defined(_dragon_fly) || defined(_free_BSD) || defined(_QNX)
#define MMAP_FLAGS MAP_SHARED
#else
#define MMAP_FLAGS MAP_PRIVATE
--
1.7.10

2016-03-24 01:40:39

by Zheng, Lv

[permalink] [raw]
Subject: [PATCH 18/30] ACPICA: Utilities: Update for strtoul64 merger

From: Bob Moore <[email protected]>

ACPICA commit 795e136d2ac77c1c8b091fba019b5fe36a44a323

Fixes a problem with the merger of the two internal versions
of this function. Make the maximum integer width (32-bit or
64-bit) a parameter to the function so that it no longer
exclusively uses the integer width specified in the DSDT/SSDT.
ACPICA BZ 1260

Link: https://github.com/acpica/acpica/commit/795e136d
Signed-off-by: Bob Moore <[email protected]>
Signed-off-by: Lv Zheng <[email protected]>
---
drivers/acpi/acpica/acutils.h | 9 +++-
drivers/acpi/acpica/dbconvert.c | 4 +-
drivers/acpi/acpica/exconvrt.c | 4 +-
drivers/acpi/acpica/nsconvert.c | 3 +-
drivers/acpi/acpica/utnonansi.c | 67 +++++++++++++++++-------------
tools/power/acpi/tools/acpidump/apdump.c | 3 +-
tools/power/acpi/tools/acpidump/apmain.c | 3 +-
7 files changed, 57 insertions(+), 36 deletions(-)

diff --git a/drivers/acpi/acpica/acutils.h b/drivers/acpi/acpica/acutils.h
index e43ab6f..7422ff7 100644
--- a/drivers/acpi/acpica/acutils.h
+++ b/drivers/acpi/acpica/acutils.h
@@ -175,7 +175,14 @@ void acpi_ut_strlwr(char *src_string);

int acpi_ut_stricmp(char *string1, char *string2);

-acpi_status acpi_ut_strtoul64(char *string, u32 base, u64 *ret_integer);
+acpi_status
+acpi_ut_strtoul64(char *string,
+ u32 base, u32 max_integer_byte_width, u64 *ret_integer);
+
+/* Values for max_integer_byte_width above */
+
+#define ACPI_MAX32_BYTE_WIDTH 4
+#define ACPI_MAX64_BYTE_WIDTH 8

/*
* utglobal - Global data structures and procedures
diff --git a/drivers/acpi/acpica/dbconvert.c b/drivers/acpi/acpica/dbconvert.c
index 68f4e0f4..c79c5fb 100644
--- a/drivers/acpi/acpica/dbconvert.c
+++ b/drivers/acpi/acpica/dbconvert.c
@@ -277,7 +277,9 @@ acpi_db_convert_to_object(acpi_object_type type,
default:

object->type = ACPI_TYPE_INTEGER;
- status = acpi_ut_strtoul64(string, 16, &object->integer.value);
+ status =
+ acpi_ut_strtoul64(string, 16, acpi_gbl_integer_byte_width,
+ &object->integer.value);
break;
}

diff --git a/drivers/acpi/acpica/exconvrt.c b/drivers/acpi/acpica/exconvrt.c
index 0b9f2c1..d0d16da 100644
--- a/drivers/acpi/acpica/exconvrt.c
+++ b/drivers/acpi/acpica/exconvrt.c
@@ -124,7 +124,9 @@ acpi_ex_convert_to_integer(union acpi_operand_object *obj_desc,
* of ACPI 3.0) is that the to_integer() operator allows both decimal
* and hexadecimal strings (hex prefixed with "0x").
*/
- status = acpi_ut_strtoul64((char *)pointer, flags, &result);
+ status = acpi_ut_strtoul64((char *)pointer, flags,
+ acpi_gbl_integer_byte_width,
+ &result);
if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status);
}
diff --git a/drivers/acpi/acpica/nsconvert.c b/drivers/acpi/acpica/nsconvert.c
index 878e8fb..256f56c 100644
--- a/drivers/acpi/acpica/nsconvert.c
+++ b/drivers/acpi/acpica/nsconvert.c
@@ -79,7 +79,8 @@ acpi_ns_convert_to_integer(union acpi_operand_object *original_object,
/* String-to-Integer conversion */

status = acpi_ut_strtoul64(original_object->string.pointer,
- ACPI_ANY_BASE, &value);
+ ACPI_ANY_BASE,
+ acpi_gbl_integer_byte_width, &value);
if (ACPI_FAILURE(status)) {
return (status);
}
diff --git a/drivers/acpi/acpica/utnonansi.c b/drivers/acpi/acpica/utnonansi.c
index d5c3adf..3465fe2 100644
--- a/drivers/acpi/acpica/utnonansi.c
+++ b/drivers/acpi/acpica/utnonansi.c
@@ -205,37 +205,41 @@ acpi_ut_safe_strncat(char *dest,
*
* FUNCTION: acpi_ut_strtoul64
*
- * PARAMETERS: string - Null terminated string
- * base - Radix of the string: 16 or ACPI_ANY_BASE;
- * ACPI_ANY_BASE means 'in behalf of to_integer'
- * ret_integer - Where the converted integer is returned
+ * PARAMETERS: string - Null terminated string
+ * base - Radix of the string: 16 or 10 or
+ * ACPI_ANY_BASE
+ * max_integer_byte_width - Maximum allowable integer,in bytes:
+ * 4 or 8 (32 or 64 bits)
+ * ret_integer - Where the converted integer is
+ * returned
*
* RETURN: Status and Converted value
*
* DESCRIPTION: Convert a string into an unsigned value. Performs either a
- * 32-bit or 64-bit conversion, depending on the current mode
- * of the interpreter.
+ * 32-bit or 64-bit conversion, depending on the input integer
+ * size (often the current mode of the interpreter).
*
- * NOTES: acpi_gbl_integer_byte_width should be set to the proper width.
+ * NOTES: Negative numbers are not supported, as they are not supported
+ * by ACPI.
+ *
+ * acpi_gbl_integer_byte_width should be set to the proper width.
* For the core ACPICA code, this width depends on the DSDT
- * version. For iASL, the default byte width is always 8.
+ * version. For iASL, the default byte width is always 8 for the
+ * parser, but error checking is performed later to flag cases
+ * where a 64-bit constant is defined in a 32-bit DSDT/SSDT.
*
* Does not support Octal strings, not needed at this time.
*
- * There is an earlier version of the function after this one,
- * below. It is slightly different than this one, and the two
- * may eventually may need to be merged. (01/2016).
- *
******************************************************************************/

-acpi_status acpi_ut_strtoul64(char *string, u32 base, u64 *ret_integer)
+acpi_status
+acpi_ut_strtoul64(char *string,
+ u32 base, u32 max_integer_byte_width, u64 *ret_integer)
{
u32 this_digit = 0;
u64 return_value = 0;
u64 quotient;
u64 dividend;
- u32 to_integer_op = (base == ACPI_ANY_BASE);
- u32 mode32 = (acpi_gbl_integer_byte_width == 4);
u8 valid_digits = 0;
u8 sign_of0x = 0;
u8 term = 0;
@@ -244,6 +248,7 @@ acpi_status acpi_ut_strtoul64(char *string, u32 base, u64 *ret_integer)

switch (base) {
case ACPI_ANY_BASE:
+ case 10:
case 16:

break;
@@ -265,9 +270,9 @@ acpi_status acpi_ut_strtoul64(char *string, u32 base, u64 *ret_integer)
string++;
}

- if (to_integer_op) {
+ if (base == ACPI_ANY_BASE) {
/*
- * Base equal to ACPI_ANY_BASE means 'ToInteger operation case'.
+ * Base equal to ACPI_ANY_BASE means 'Either decimal or hex'.
* We need to determine if it is decimal or hexadecimal.
*/
if ((*string == '0') && (tolower((int)*(string + 1)) == 'x')) {
@@ -284,7 +289,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((int)*string) || *string == '\t') {
- if (to_integer_op) {
+ if (base == ACPI_ANY_BASE) {
goto error_exit;
} else {
goto all_done;
@@ -292,10 +297,11 @@ acpi_status acpi_ut_strtoul64(char *string, u32 base, u64 *ret_integer)
}

/*
- * Perform a 32-bit or 64-bit conversion, depending upon the current
- * execution mode of the interpreter
+ * Perform a 32-bit or 64-bit conversion, depending upon the input
+ * byte width
*/
- dividend = (mode32) ? ACPI_UINT32_MAX : ACPI_UINT64_MAX;
+ dividend = (max_integer_byte_width <= ACPI_MAX32_BYTE_WIDTH) ?
+ ACPI_UINT32_MAX : ACPI_UINT64_MAX;

/* Main loop: convert the string to a 32- or 64-bit integer */

@@ -323,7 +329,7 @@ acpi_status acpi_ut_strtoul64(char *string, u32 base, u64 *ret_integer)
}

if (term) {
- if (to_integer_op) {
+ if (base == ACPI_ANY_BASE) {
goto error_exit;
} else {
break;
@@ -338,12 +344,13 @@ acpi_status acpi_ut_strtoul64(char *string, u32 base, u64 *ret_integer)

valid_digits++;

- if (sign_of0x
- && ((valid_digits > 16)
- || ((valid_digits > 8) && mode32))) {
+ if (sign_of0x && ((valid_digits > 16) ||
+ ((valid_digits > 8)
+ && (max_integer_byte_width <=
+ ACPI_MAX32_BYTE_WIDTH)))) {
/*
* This is to_integer operation case.
- * No any restrictions for string-to-integer conversion,
+ * No restrictions for string-to-integer conversion,
* see ACPI spec.
*/
goto error_exit;
@@ -355,7 +362,7 @@ acpi_status acpi_ut_strtoul64(char *string, u32 base, u64 *ret_integer)
&quotient, NULL);

if (return_value > quotient) {
- if (to_integer_op) {
+ if (base == ACPI_ANY_BASE) {
goto error_exit;
} else {
break;
@@ -378,7 +385,8 @@ all_done:
return_ACPI_STATUS(AE_OK);

error_exit:
- /* Base was set/validated above */
+
+ /* Base was set/validated above (10 or 16) */

if (base == 10) {
return_ACPI_STATUS(AE_BAD_DECIMAL_CONSTANT);
@@ -388,8 +396,7 @@ error_exit:
}

#ifdef _OBSOLETE_FUNCTIONS
-/* TBD: use version in ACPICA main code base? */
-/* DONE: 01/2016 */
+/* Removed: 01/2016 */

/*******************************************************************************
*
diff --git a/tools/power/acpi/tools/acpidump/apdump.c b/tools/power/acpi/tools/acpidump/apdump.c
index da44458..9c2db0e 100644
--- a/tools/power/acpi/tools/acpidump/apdump.c
+++ b/tools/power/acpi/tools/acpidump/apdump.c
@@ -286,7 +286,8 @@ int ap_dump_table_by_address(char *ascii_address)

/* Convert argument to an integer physical address */

- status = acpi_ut_strtoul64(ascii_address, 0, &long_address);
+ status = acpi_ut_strtoul64(ascii_address, ACPI_ANY_BASE,
+ ACPI_MAX64_BYTE_WIDTH, &long_address);
if (ACPI_FAILURE(status)) {
acpi_log_error("%s: Could not convert to a physical address\n",
ascii_address);
diff --git a/tools/power/acpi/tools/acpidump/apmain.c b/tools/power/acpi/tools/acpidump/apmain.c
index c3c0915..7692e6b 100644
--- a/tools/power/acpi/tools/acpidump/apmain.c
+++ b/tools/power/acpi/tools/acpidump/apmain.c
@@ -209,7 +209,8 @@ static int ap_do_options(int argc, char **argv)
case 'r': /* Dump tables from specified RSDP */

status =
- acpi_ut_strtoul64(acpi_gbl_optarg, 0,
+ acpi_ut_strtoul64(acpi_gbl_optarg, ACPI_ANY_BASE,
+ ACPI_MAX64_BYTE_WIDTH,
&gbl_rsdp_base);
if (ACPI_FAILURE(status)) {
acpi_log_error
--
1.7.10

2016-03-24 01:40:49

by Zheng, Lv

[permalink] [raw]
Subject: [PATCH 19/30] ACPICA: All: const keyword changes across the ACPICA source

From: Bob Moore <[email protected]>

ACPICA commit a240cbb93647bddf525b3daf6e9d31b8b9bca34e

Integrated most changes proposed by net_BSD.
>From joerg@net_BSD.org (Joerg Sonnenberger)
ACPICA BZ 732.

Link: https://github.com/acpica/acpica/commit/a240cbb9
Link: https://bugs.acpica.org/show_bug.cgi?id=732
Signed-off-by: Bob Moore <[email protected]>
Signed-off-by: Lv Zheng <[email protected]>
---
drivers/acpi/acpica/acdebug.h | 4 ++--
drivers/acpi/acpica/acglobal.h | 2 ++
drivers/acpi/acpica/acinterp.h | 2 +-
drivers/acpi/acpica/acnamesp.h | 5 ++--
drivers/acpi/acpica/acparser.h | 2 +-
drivers/acpi/acpica/acresrc.h | 4 ++--
drivers/acpi/acpica/acstruct.h | 2 +-
drivers/acpi/acpica/acutils.h | 14 ++++++-----
drivers/acpi/acpica/dbinput.c | 13 ++++++-----
drivers/acpi/acpica/dbutils.c | 9 ++++----
drivers/acpi/acpica/evregion.c | 3 ++-
drivers/acpi/acpica/exdump.c | 15 ++++++------
drivers/acpi/acpica/hwxface.c | 4 +---
drivers/acpi/acpica/nsaccess.c | 7 +++---
drivers/acpi/acpica/nsdump.c | 9 ++++++--
drivers/acpi/acpica/psopinfo.c | 2 +-
drivers/acpi/acpica/rsdump.c | 50 +++++++++++++++++-----------------------
drivers/acpi/acpica/rsutils.c | 2 +-
drivers/acpi/acpica/tbfadt.c | 8 +++----
drivers/acpi/acpica/utdebug.c | 47 ++++++++++++++++++-------------------
drivers/acpi/acpica/uteval.c | 4 ++--
drivers/acpi/acpica/utglobal.c | 5 ++++
drivers/acpi/acpica/utmisc.c | 2 +-
drivers/acpi/acpica/utprint.c | 5 ----
drivers/acpi/acpica/uttrack.c | 2 +-
include/acpi/actypes.h | 4 ++--
26 files changed, 113 insertions(+), 113 deletions(-)

diff --git a/drivers/acpi/acpica/acdebug.h b/drivers/acpi/acpica/acdebug.h
index 993af9e..9e2e080 100644
--- a/drivers/acpi/acpica/acdebug.h
+++ b/drivers/acpi/acpica/acdebug.h
@@ -53,7 +53,7 @@
#define ACPI_DEBUG_BUFFER_SIZE 0x4000 /* 16K buffer for return objects */

struct acpi_db_command_info {
- char *name; /* Command Name */
+ const char *name; /* Command Name */
u8 min_args; /* Minimum arguments required */
};

@@ -64,7 +64,7 @@ struct acpi_db_command_help {
};

struct acpi_db_argument_info {
- char *name; /* Argument Name */
+ const char *name; /* Argument Name */
};

struct acpi_db_execute_walk {
diff --git a/drivers/acpi/acpica/acglobal.h b/drivers/acpi/acpica/acglobal.h
index 54b42a5..fded776 100644
--- a/drivers/acpi/acpica/acglobal.h
+++ b/drivers/acpi/acpica/acglobal.h
@@ -187,6 +187,8 @@ extern const char *acpi_gbl_sleep_state_names[ACPI_S_STATE_COUNT];
extern const char *acpi_gbl_lowest_dstate_names[ACPI_NUM_sx_w_METHODS];
extern const char *acpi_gbl_highest_dstate_names[ACPI_NUM_sx_d_METHODS];
extern const char *acpi_gbl_region_types[ACPI_NUM_PREDEFINED_REGIONS];
+extern const char acpi_gbl_lower_hex_digits[];
+extern const char acpi_gbl_upper_hex_digits[];
extern const struct acpi_opcode_info acpi_gbl_aml_op_info[AML_NUM_OPCODES];

#ifdef ACPI_DBG_TRACK_ALLOCATIONS
diff --git a/drivers/acpi/acpica/acinterp.h b/drivers/acpi/acpica/acinterp.h
index bae1a35..8b09d28 100644
--- a/drivers/acpi/acpica/acinterp.h
+++ b/drivers/acpi/acpica/acinterp.h
@@ -67,7 +67,7 @@
typedef const struct acpi_exdump_info {
u8 opcode;
u8 offset;
- char *name;
+ const char *name;

} acpi_exdump_info;

diff --git a/drivers/acpi/acpica/acnamesp.h b/drivers/acpi/acpica/acnamesp.h
index 022d69c..f33a4ba 100644
--- a/drivers/acpi/acpica/acnamesp.h
+++ b/drivers/acpi/acpica/acnamesp.h
@@ -206,9 +206,10 @@ void acpi_ns_dump_tables(acpi_handle search_base, u32 max_depth);
void acpi_ns_dump_entry(acpi_handle handle, u32 debug_level);

void
-acpi_ns_dump_pathname(acpi_handle handle, char *msg, u32 level, u32 component);
+acpi_ns_dump_pathname(acpi_handle handle,
+ const char *msg, u32 level, u32 component);

-void acpi_ns_print_pathname(u32 num_segments, char *pathname);
+void acpi_ns_print_pathname(u32 num_segments, const char *pathname);

acpi_status
acpi_ns_dump_one_object(acpi_handle obj_handle,
diff --git a/drivers/acpi/acpica/acparser.h b/drivers/acpi/acpica/acparser.h
index 7da639d..fc30577 100644
--- a/drivers/acpi/acpica/acparser.h
+++ b/drivers/acpi/acpica/acparser.h
@@ -139,7 +139,7 @@ acpi_ps_complete_final_op(struct acpi_walk_state *walk_state,
*/
const struct acpi_opcode_info *acpi_ps_get_opcode_info(u16 opcode);

-char *acpi_ps_get_opcode_name(u16 opcode);
+const char *acpi_ps_get_opcode_name(u16 opcode);

u8 acpi_ps_get_argument_count(u32 op_type);

diff --git a/drivers/acpi/acpica/acresrc.h b/drivers/acpi/acpica/acresrc.h
index 5dd58be..83e9a29 100644
--- a/drivers/acpi/acpica/acresrc.h
+++ b/drivers/acpi/acpica/acresrc.h
@@ -124,7 +124,7 @@ typedef enum {
typedef const struct acpi_rsdump_info {
u8 opcode;
u8 offset;
- char *name;
+ const char *name;
const char **pointer;

} acpi_rsdump_info;
@@ -209,7 +209,7 @@ acpi_rs_get_prs_method_data(struct acpi_namespace_node *node,

acpi_status
acpi_rs_get_method_data(acpi_handle handle,
- char *path, struct acpi_buffer *ret_buffer);
+ const char *path, struct acpi_buffer *ret_buffer);

acpi_status
acpi_rs_set_srs_method_data(struct acpi_namespace_node *node,
diff --git a/drivers/acpi/acpica/acstruct.h b/drivers/acpi/acpica/acstruct.h
index b3b386e..6235642 100644
--- a/drivers/acpi/acpica/acstruct.h
+++ b/drivers/acpi/acpica/acstruct.h
@@ -184,7 +184,7 @@ struct acpi_evaluate_info {
/* The first 3 elements are passed by the caller to acpi_ns_evaluate */

struct acpi_namespace_node *prefix_node; /* Input: starting node */
- char *relative_pathname; /* Input: path relative to prefix_node */
+ const char *relative_pathname; /* Input: path relative to prefix_node */
union acpi_operand_object **parameters; /* Input: argument list */

struct acpi_namespace_node *node; /* Resolved node (prefix_node:relative_pathname) */
diff --git a/drivers/acpi/acpica/acutils.h b/drivers/acpi/acpica/acutils.h
index 7422ff7..4ff971c 100644
--- a/drivers/acpi/acpica/acutils.h
+++ b/drivers/acpi/acpica/acutils.h
@@ -273,7 +273,8 @@ acpi_ut_trace(u32 line_number,
void
acpi_ut_trace_ptr(u32 line_number,
const char *function_name,
- const char *module_name, u32 component_id, void *pointer);
+ const char *module_name,
+ u32 component_id, const void *pointer);

void
acpi_ut_trace_u32(u32 line_number,
@@ -283,7 +284,8 @@ acpi_ut_trace_u32(u32 line_number,
void
acpi_ut_trace_str(u32 line_number,
const char *function_name,
- const char *module_name, u32 component_id, char *string);
+ const char *module_name,
+ u32 component_id, const char *string);

void
acpi_ut_exit(u32 line_number,
@@ -342,12 +344,12 @@ void acpi_ut_delete_internal_object_list(union acpi_operand_object **obj_list);
*/
acpi_status
acpi_ut_evaluate_object(struct acpi_namespace_node *prefix_node,
- char *path,
+ const char *path,
u32 expected_return_btypes,
union acpi_operand_object **return_desc);

acpi_status
-acpi_ut_evaluate_numeric_object(char *object_name,
+acpi_ut_evaluate_numeric_object(const char *object_name,
struct acpi_namespace_node *device_node,
u64 *value);

@@ -533,7 +535,7 @@ void acpi_ut_set_integer_width(u8 revision);
void
acpi_ut_display_init_pathname(u8 type,
struct acpi_namespace_node *obj_handle,
- char *path);
+ const char *path);
#endif

/*
@@ -635,7 +637,7 @@ void acpi_ut_dump_allocation_info(void);
void acpi_ut_dump_allocations(u32 component, const char *module);

acpi_status
-acpi_ut_create_list(char *list_name,
+acpi_ut_create_list(const char *list_name,
u16 object_size, struct acpi_memory_list **return_cache);

#endif /* ACPI_DBG_TRACK_ALLOCATIONS */
diff --git a/drivers/acpi/acpica/dbinput.c b/drivers/acpi/acpica/dbinput.c
index 417c02a..f53cb30 100644
--- a/drivers/acpi/acpica/dbinput.c
+++ b/drivers/acpi/acpica/dbinput.c
@@ -57,12 +57,12 @@ static u32 acpi_db_get_line(char *input_buffer);

static u32 acpi_db_match_command(char *user_command);

-static void acpi_db_display_command_info(char *command, u8 display_all);
+static void acpi_db_display_command_info(const char *command, u8 display_all);

static void acpi_db_display_help(char *command);

static u8
-acpi_db_match_command_help(char *command,
+acpi_db_match_command_help(const char *command,
const struct acpi_db_command_help *help);

/*
@@ -348,7 +348,7 @@ static const struct acpi_db_command_help acpi_gbl_db_command_help[] = {
******************************************************************************/

static u8
-acpi_db_match_command_help(char *command,
+acpi_db_match_command_help(const char *command,
const struct acpi_db_command_help *help)
{
char *invocation = help->invocation;
@@ -402,7 +402,7 @@ acpi_db_match_command_help(char *command,
*
******************************************************************************/

-static void acpi_db_display_command_info(char *command, u8 display_all)
+static void acpi_db_display_command_info(const char *command, u8 display_all)
{
const struct acpi_db_command_help *next;
u8 matched;
@@ -656,8 +656,9 @@ static u32 acpi_db_match_command(char *user_command)
}

for (i = CMD_FIRST_VALID; acpi_gbl_db_commands[i].name; i++) {
- if (strstr(acpi_gbl_db_commands[i].name, user_command) ==
- acpi_gbl_db_commands[i].name) {
+ if (strstr
+ (ACPI_CAST_PTR(char, acpi_gbl_db_commands[i].name),
+ user_command) == acpi_gbl_db_commands[i].name) {
return (i);
}
}
diff --git a/drivers/acpi/acpica/dbutils.c b/drivers/acpi/acpica/dbutils.c
index b37a2c7..ae80106 100644
--- a/drivers/acpi/acpica/dbutils.c
+++ b/drivers/acpi/acpica/dbutils.c
@@ -56,8 +56,6 @@ acpi_status acpi_db_second_pass_parse(union acpi_parse_object *root);
void acpi_db_dump_buffer(u32 address);
#endif

-static char *gbl_hex_to_ascii = "0123456789ABCDEF";
-
/*******************************************************************************
*
* FUNCTION: acpi_db_match_argument
@@ -82,8 +80,9 @@ acpi_db_match_argument(char *user_argument,
}

for (i = 0; arguments[i].name; i++) {
- if (strstr(arguments[i].name, user_argument) ==
- arguments[i].name) {
+ if (strstr(ACPI_CAST_PTR(char, arguments[i].name),
+ ACPI_CAST_PTR(char,
+ user_argument)) == arguments[i].name) {
return (i);
}
}
@@ -339,7 +338,7 @@ void acpi_db_uint32_to_hex_string(u32 value, char *buffer)
buffer[8] = '\0';

for (i = 7; i >= 0; i--) {
- buffer[i] = gbl_hex_to_ascii[value & 0x0F];
+ buffer[i] = acpi_gbl_upper_hex_digits[value & 0x0F];
value = value >> 4;
}
}
diff --git a/drivers/acpi/acpica/evregion.c b/drivers/acpi/acpica/evregion.c
index 63924d1..17d61c6 100644
--- a/drivers/acpi/acpica/evregion.c
+++ b/drivers/acpi/acpica/evregion.c
@@ -538,7 +538,8 @@ acpi_ev_attach_region(union acpi_operand_object *handler_obj,

void acpi_ev_associate_reg_method(union acpi_operand_object *region_obj)
{
- acpi_name *reg_name_ptr = (acpi_name *) METHOD_NAME__REG;
+ const acpi_name *reg_name_ptr =
+ ACPI_CAST_PTR(acpi_name, METHOD_NAME__REG);
struct acpi_namespace_node *method_node;
struct acpi_namespace_node *node;
union acpi_operand_object *region_obj2;
diff --git a/drivers/acpi/acpica/exdump.c b/drivers/acpi/acpica/exdump.c
index ee30974..fce6b2e 100644
--- a/drivers/acpi/acpica/exdump.c
+++ b/drivers/acpi/acpica/exdump.c
@@ -55,9 +55,9 @@ ACPI_MODULE_NAME("exdump")
*/
#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
/* Local prototypes */
-static void acpi_ex_out_string(char *title, char *value);
+static void acpi_ex_out_string(const char *title, const char *value);

-static void acpi_ex_out_pointer(char *title, void *value);
+static void acpi_ex_out_pointer(const char *title, const void *value);

static void
acpi_ex_dump_object(union acpi_operand_object *obj_desc,
@@ -365,8 +365,7 @@ acpi_ex_dump_object(union acpi_operand_object *obj_desc,
struct acpi_exdump_info *info)
{
u8 *target;
- char *name;
- const char *reference_name;
+ const char *name;
u8 count;
union acpi_operand_object *start;
union acpi_operand_object *data = NULL;
@@ -459,9 +458,9 @@ acpi_ex_dump_object(union acpi_operand_object *obj_desc,

case ACPI_EXD_REFERENCE:

- reference_name = acpi_ut_get_reference_name(obj_desc);
acpi_ex_out_string("Class Name",
- ACPI_CAST_PTR(char, reference_name));
+ acpi_ut_get_reference_name
+ (obj_desc));
acpi_ex_dump_reference_obj(obj_desc);
break;

@@ -934,12 +933,12 @@ acpi_ex_dump_operands(union acpi_operand_object **operands,
*
******************************************************************************/

-static void acpi_ex_out_string(char *title, char *value)
+static void acpi_ex_out_string(const char *title, const char *value)
{
acpi_os_printf("%20s : %s\n", title, value);
}

-static void acpi_ex_out_pointer(char *title, void *value)
+static void acpi_ex_out_pointer(const char *title, const void *value)
{
acpi_os_printf("%20s : %p\n", title, value);
}
diff --git a/drivers/acpi/acpica/hwxface.c b/drivers/acpi/acpica/hwxface.c
index a01ddb3..7caaaf3 100644
--- a/drivers/acpi/acpica/hwxface.c
+++ b/drivers/acpi/acpica/hwxface.c
@@ -504,9 +504,7 @@ acpi_get_sleep_type_data(u8 sleep_state, u8 *sleep_type_a, u8 *sleep_type_b)
* Evaluate the \_Sx namespace object containing the register values
* for this state
*/
- info->relative_pathname = ACPI_CAST_PTR(char,
- acpi_gbl_sleep_state_names
- [sleep_state]);
+ info->relative_pathname = acpi_gbl_sleep_state_names[sleep_state];

status = acpi_ns_evaluate(info);
if (ACPI_FAILURE(status)) {
diff --git a/drivers/acpi/acpica/nsaccess.c b/drivers/acpi/acpica/nsaccess.c
index 697af81..426a630 100644
--- a/drivers/acpi/acpica/nsaccess.c
+++ b/drivers/acpi/acpica/nsaccess.c
@@ -107,9 +107,10 @@ acpi_status acpi_ns_root_initialize(void)
continue;
}

- status = acpi_ns_lookup(NULL, init_val->name, init_val->type,
- ACPI_IMODE_LOAD_PASS2,
- ACPI_NS_NO_UPSEARCH, NULL, &new_node);
+ status =
+ acpi_ns_lookup(NULL, (char *)init_val->name, init_val->type,
+ ACPI_IMODE_LOAD_PASS2, ACPI_NS_NO_UPSEARCH,
+ NULL, &new_node);
if (ACPI_FAILURE(status)) {
ACPI_EXCEPTION((AE_INFO, status,
"Could not create predefined name %s",
diff --git a/drivers/acpi/acpica/nsdump.c b/drivers/acpi/acpica/nsdump.c
index af236e3..ce1f860 100644
--- a/drivers/acpi/acpica/nsdump.c
+++ b/drivers/acpi/acpica/nsdump.c
@@ -81,7 +81,7 @@ acpi_ns_get_max_depth(acpi_handle obj_handle,
*
******************************************************************************/

-void acpi_ns_print_pathname(u32 num_segments, char *pathname)
+void acpi_ns_print_pathname(u32 num_segments, const char *pathname)
{
u32 i;

@@ -114,6 +114,9 @@ void acpi_ns_print_pathname(u32 num_segments, char *pathname)
acpi_os_printf("]\n");
}

+#ifdef ACPI_OBSOLETE_FUNCTIONS
+/* Not used at this time, perhaps later */
+
/*******************************************************************************
*
* FUNCTION: acpi_ns_dump_pathname
@@ -131,7 +134,8 @@ void acpi_ns_print_pathname(u32 num_segments, char *pathname)
******************************************************************************/

void
-acpi_ns_dump_pathname(acpi_handle handle, char *msg, u32 level, u32 component)
+acpi_ns_dump_pathname(acpi_handle handle,
+ const char *msg, u32 level, u32 component)
{

ACPI_FUNCTION_TRACE(ns_dump_pathname);
@@ -148,6 +152,7 @@ acpi_ns_dump_pathname(acpi_handle handle, char *msg, u32 level, u32 component)
acpi_os_printf("\n");
return_VOID;
}
+#endif

/*******************************************************************************
*
diff --git a/drivers/acpi/acpica/psopinfo.c b/drivers/acpi/acpica/psopinfo.c
index cfd17a4..177b05b 100644
--- a/drivers/acpi/acpica/psopinfo.c
+++ b/drivers/acpi/acpica/psopinfo.c
@@ -158,7 +158,7 @@ const struct acpi_opcode_info *acpi_ps_get_opcode_info(u16 opcode)
*
******************************************************************************/

-char *acpi_ps_get_opcode_name(u16 opcode)
+const char *acpi_ps_get_opcode_name(u16 opcode)
{
#if defined(ACPI_DISASSEMBLER) || defined (ACPI_DEBUG_OUTPUT)

diff --git a/drivers/acpi/acpica/rsdump.c b/drivers/acpi/acpica/rsdump.c
index 23a17c8..5ffdb56 100644
--- a/drivers/acpi/acpica/rsdump.c
+++ b/drivers/acpi/acpica/rsdump.c
@@ -52,17 +52,17 @@ ACPI_MODULE_NAME("rsdump")
* All functions in this module are used by the AML Debugger only
*/
/* Local prototypes */
-static void acpi_rs_out_string(char *title, char *value);
+static void acpi_rs_out_string(const char *title, const char *value);

-static void acpi_rs_out_integer8(char *title, u8 value);
+static void acpi_rs_out_integer8(const char *title, u8 value);

-static void acpi_rs_out_integer16(char *title, u16 value);
+static void acpi_rs_out_integer16(const char *title, u16 value);

-static void acpi_rs_out_integer32(char *title, u32 value);
+static void acpi_rs_out_integer32(const char *title, u32 value);

-static void acpi_rs_out_integer64(char *title, u64 value);
+static void acpi_rs_out_integer64(const char *title, u64 value);

-static void acpi_rs_out_title(char *title);
+static void acpi_rs_out_title(const char *title);

static void acpi_rs_dump_byte_list(u16 length, u8 *data);

@@ -208,7 +208,7 @@ acpi_rs_dump_descriptor(void *resource, struct acpi_rsdump_info *table)
{
u8 *target = NULL;
u8 *previous_target;
- char *name;
+ const char *name;
u8 count;

/* First table entry must contain the table length (# of table entries) */
@@ -248,10 +248,8 @@ acpi_rs_dump_descriptor(void *resource, struct acpi_rsdump_info *table)
case ACPI_RSD_UINT8:

if (table->pointer) {
- acpi_rs_out_string(name, ACPI_CAST_PTR(char,
- table->
- pointer
- [*target]));
+ acpi_rs_out_string(name,
+ table->pointer[*target]);
} else {
acpi_rs_out_integer8(name, ACPI_GET8(target));
}
@@ -276,26 +274,20 @@ acpi_rs_dump_descriptor(void *resource, struct acpi_rsdump_info *table)

case ACPI_RSD_1BITFLAG:

- acpi_rs_out_string(name, ACPI_CAST_PTR(char,
- table->
- pointer[*target &
- 0x01]));
+ acpi_rs_out_string(name,
+ table->pointer[*target & 0x01]);
break;

case ACPI_RSD_2BITFLAG:

- acpi_rs_out_string(name, ACPI_CAST_PTR(char,
- table->
- pointer[*target &
- 0x03]));
+ acpi_rs_out_string(name,
+ table->pointer[*target & 0x03]);
break;

case ACPI_RSD_3BITFLAG:

- acpi_rs_out_string(name, ACPI_CAST_PTR(char,
- table->
- pointer[*target &
- 0x07]));
+ acpi_rs_out_string(name,
+ table->pointer[*target & 0x07]);
break;

case ACPI_RSD_SHORTLIST:
@@ -481,7 +473,7 @@ static void acpi_rs_dump_address_common(union acpi_resource_data *resource)
*
******************************************************************************/

-static void acpi_rs_out_string(char *title, char *value)
+static void acpi_rs_out_string(const char *title, const char *value)
{

acpi_os_printf("%27s : %s", title, value);
@@ -491,30 +483,30 @@ static void acpi_rs_out_string(char *title, char *value)
acpi_os_printf("\n");
}

-static void acpi_rs_out_integer8(char *title, u8 value)
+static void acpi_rs_out_integer8(const char *title, u8 value)
{
acpi_os_printf("%27s : %2.2X\n", title, value);
}

-static void acpi_rs_out_integer16(char *title, u16 value)
+static void acpi_rs_out_integer16(const char *title, u16 value)
{

acpi_os_printf("%27s : %4.4X\n", title, value);
}

-static void acpi_rs_out_integer32(char *title, u32 value)
+static void acpi_rs_out_integer32(const char *title, u32 value)
{

acpi_os_printf("%27s : %8.8X\n", title, value);
}

-static void acpi_rs_out_integer64(char *title, u64 value)
+static void acpi_rs_out_integer64(const char *title, u64 value)
{

acpi_os_printf("%27s : %8.8X%8.8X\n", title, ACPI_FORMAT_UINT64(value));
}

-static void acpi_rs_out_title(char *title)
+static void acpi_rs_out_title(const char *title)
{

acpi_os_printf("%27s : ", title);
diff --git a/drivers/acpi/acpica/rsutils.c b/drivers/acpi/acpica/rsutils.c
index cf06e49..e0d6023 100644
--- a/drivers/acpi/acpica/rsutils.c
+++ b/drivers/acpi/acpica/rsutils.c
@@ -671,7 +671,7 @@ acpi_rs_get_aei_method_data(struct acpi_namespace_node *node,

acpi_status
acpi_rs_get_method_data(acpi_handle handle,
- char *path, struct acpi_buffer *ret_buffer)
+ const char *path, struct acpi_buffer *ret_buffer)
{
union acpi_operand_object *obj_desc;
acpi_status status;
diff --git a/drivers/acpi/acpica/tbfadt.c b/drivers/acpi/acpica/tbfadt.c
index f63f3fd..635d951 100644
--- a/drivers/acpi/acpica/tbfadt.c
+++ b/drivers/acpi/acpica/tbfadt.c
@@ -53,7 +53,7 @@ static void
acpi_tb_init_generic_address(struct acpi_generic_address *generic_address,
u8 space_id,
u8 byte_width,
- u64 address, char *register_name, u8 flags);
+ u64 address, const char *register_name, u8 flags);

static void acpi_tb_convert_fadt(void);

@@ -65,7 +65,7 @@ acpi_tb_select_address(char *register_name, u32 address32, u64 address64);
/* Table for conversion of FADT to common internal format and FADT validation */

typedef struct acpi_fadt_info {
- char *name;
+ const char *name;
u16 address64;
u16 address32;
u16 length;
@@ -192,7 +192,7 @@ static void
acpi_tb_init_generic_address(struct acpi_generic_address *generic_address,
u8 space_id,
u8 byte_width,
- u64 address, char *register_name, u8 flags)
+ u64 address, const char *register_name, u8 flags)
{
u8 bit_width;

@@ -468,7 +468,7 @@ void acpi_tb_create_local_fadt(struct acpi_table_header *table, u32 length)

static void acpi_tb_convert_fadt(void)
{
- char *name;
+ const char *name;
struct acpi_generic_address *address64;
u32 address32;
u8 length;
diff --git a/drivers/acpi/acpica/utdebug.c b/drivers/acpi/acpica/utdebug.c
index 1cfc5f6..5744222 100644
--- a/drivers/acpi/acpica/utdebug.c
+++ b/drivers/acpi/acpica/utdebug.c
@@ -51,13 +51,9 @@
ACPI_MODULE_NAME("utdebug")

#ifdef ACPI_DEBUG_OUTPUT
-static acpi_thread_id acpi_gbl_prev_thread_id = (acpi_thread_id) 0xFFFFFFFF;
-static char *acpi_gbl_fn_entry_str = "----Entry";
-static char *acpi_gbl_fn_exit_str = "----Exit-";
-
-/* Local prototypes */
-
-static const char *acpi_ut_trim_function_name(const char *function_name);
+static acpi_thread_id acpi_gbl_previous_thread_id = (acpi_thread_id) 0xFFFFFFFF;
+static const char *acpi_gbl_function_entry_prefix = "----Entry";
+static const char *acpi_gbl_function_exit_prefix = "----Exit-";

/*******************************************************************************
*
@@ -178,14 +174,14 @@ acpi_debug_print(u32 requested_debug_level,
* Thread tracking and context switch notification
*/
thread_id = acpi_os_get_thread_id();
- if (thread_id != acpi_gbl_prev_thread_id) {
+ if (thread_id != acpi_gbl_previous_thread_id) {
if (ACPI_LV_THREADS & acpi_dbg_level) {
acpi_os_printf
("\n**** Context Switch from TID %u to TID %u ****\n\n",
- (u32)acpi_gbl_prev_thread_id, (u32)thread_id);
+ (u32)acpi_gbl_previous_thread_id, (u32)thread_id);
}

- acpi_gbl_prev_thread_id = thread_id;
+ acpi_gbl_previous_thread_id = thread_id;
acpi_gbl_nesting_level = 0;
}

@@ -287,7 +283,8 @@ acpi_ut_trace(u32 line_number,
if (ACPI_IS_DEBUG_ENABLED(ACPI_LV_FUNCTIONS, component_id)) {
acpi_debug_print(ACPI_LV_FUNCTIONS,
line_number, function_name, module_name,
- component_id, "%s\n", acpi_gbl_fn_entry_str);
+ component_id, "%s\n",
+ acpi_gbl_function_entry_prefix);
}
}

@@ -312,7 +309,8 @@ ACPI_EXPORT_SYMBOL(acpi_ut_trace)
void
acpi_ut_trace_ptr(u32 line_number,
const char *function_name,
- const char *module_name, u32 component_id, void *pointer)
+ const char *module_name,
+ u32 component_id, const void *pointer)
{

acpi_gbl_nesting_level++;
@@ -323,8 +321,8 @@ acpi_ut_trace_ptr(u32 line_number,
if (ACPI_IS_DEBUG_ENABLED(ACPI_LV_FUNCTIONS, component_id)) {
acpi_debug_print(ACPI_LV_FUNCTIONS,
line_number, function_name, module_name,
- component_id, "%s %p\n", acpi_gbl_fn_entry_str,
- pointer);
+ component_id, "%s %p\n",
+ acpi_gbl_function_entry_prefix, pointer);
}
}

@@ -348,7 +346,7 @@ acpi_ut_trace_ptr(u32 line_number,
void
acpi_ut_trace_str(u32 line_number,
const char *function_name,
- const char *module_name, u32 component_id, char *string)
+ const char *module_name, u32 component_id, const char *string)
{

acpi_gbl_nesting_level++;
@@ -359,8 +357,8 @@ acpi_ut_trace_str(u32 line_number,
if (ACPI_IS_DEBUG_ENABLED(ACPI_LV_FUNCTIONS, component_id)) {
acpi_debug_print(ACPI_LV_FUNCTIONS,
line_number, function_name, module_name,
- component_id, "%s %s\n", acpi_gbl_fn_entry_str,
- string);
+ component_id, "%s %s\n",
+ acpi_gbl_function_entry_prefix, string);
}
}

@@ -396,7 +394,7 @@ acpi_ut_trace_u32(u32 line_number,
acpi_debug_print(ACPI_LV_FUNCTIONS,
line_number, function_name, module_name,
component_id, "%s %08X\n",
- acpi_gbl_fn_entry_str, integer);
+ acpi_gbl_function_entry_prefix, integer);
}
}

@@ -427,7 +425,8 @@ acpi_ut_exit(u32 line_number,
if (ACPI_IS_DEBUG_ENABLED(ACPI_LV_FUNCTIONS, component_id)) {
acpi_debug_print(ACPI_LV_FUNCTIONS,
line_number, function_name, module_name,
- component_id, "%s\n", acpi_gbl_fn_exit_str);
+ component_id, "%s\n",
+ acpi_gbl_function_exit_prefix);
}

if (acpi_gbl_nesting_level) {
@@ -467,14 +466,14 @@ acpi_ut_status_exit(u32 line_number,
acpi_debug_print(ACPI_LV_FUNCTIONS,
line_number, function_name,
module_name, component_id, "%s %s\n",
- acpi_gbl_fn_exit_str,
+ acpi_gbl_function_exit_prefix,
acpi_format_exception(status));
} else {
acpi_debug_print(ACPI_LV_FUNCTIONS,
line_number, function_name,
module_name, component_id,
"%s ****Exception****: %s\n",
- acpi_gbl_fn_exit_str,
+ acpi_gbl_function_exit_prefix,
acpi_format_exception(status));
}
}
@@ -514,7 +513,7 @@ acpi_ut_value_exit(u32 line_number,
acpi_debug_print(ACPI_LV_FUNCTIONS,
line_number, function_name, module_name,
component_id, "%s %8.8X%8.8X\n",
- acpi_gbl_fn_exit_str,
+ acpi_gbl_function_exit_prefix,
ACPI_FORMAT_UINT64(value));
}

@@ -552,8 +551,8 @@ acpi_ut_ptr_exit(u32 line_number,
if (ACPI_IS_DEBUG_ENABLED(ACPI_LV_FUNCTIONS, component_id)) {
acpi_debug_print(ACPI_LV_FUNCTIONS,
line_number, function_name, module_name,
- component_id, "%s %p\n", acpi_gbl_fn_exit_str,
- ptr);
+ component_id, "%s %p\n",
+ acpi_gbl_function_exit_prefix, ptr);
}

if (acpi_gbl_nesting_level) {
diff --git a/drivers/acpi/acpica/uteval.c b/drivers/acpi/acpica/uteval.c
index 17b9f3e..7bad13f 100644
--- a/drivers/acpi/acpica/uteval.c
+++ b/drivers/acpi/acpica/uteval.c
@@ -69,7 +69,7 @@ ACPI_MODULE_NAME("uteval")

acpi_status
acpi_ut_evaluate_object(struct acpi_namespace_node *prefix_node,
- char *path,
+ const char *path,
u32 expected_return_btypes,
union acpi_operand_object **return_desc)
{
@@ -204,7 +204,7 @@ cleanup:
******************************************************************************/

acpi_status
-acpi_ut_evaluate_numeric_object(char *object_name,
+acpi_ut_evaluate_numeric_object(const char *object_name,
struct acpi_namespace_node *device_node,
u64 *value)
{
diff --git a/drivers/acpi/acpica/utglobal.c b/drivers/acpi/acpica/utglobal.c
index d45899c..dd3fd7f 100644
--- a/drivers/acpi/acpica/utglobal.c
+++ b/drivers/acpi/acpica/utglobal.c
@@ -80,6 +80,11 @@ const char *acpi_gbl_highest_dstate_names[ACPI_NUM_sx_d_METHODS] = {
"_S4D"
};

+/* Hex-to-ascii */
+
+const char acpi_gbl_lower_hex_digits[] = "0123456789abcdef";
+const char acpi_gbl_upper_hex_digits[] = "0123456789ABCDEF";
+
/*******************************************************************************
*
* Namespace globals
diff --git a/drivers/acpi/acpica/utmisc.c b/drivers/acpi/acpica/utmisc.c
index d938c27..389de3b 100644
--- a/drivers/acpi/acpica/utmisc.c
+++ b/drivers/acpi/acpica/utmisc.c
@@ -361,7 +361,7 @@ acpi_ut_walk_package_tree(union acpi_operand_object *source_object,
void
acpi_ut_display_init_pathname(u8 type,
struct acpi_namespace_node *obj_handle,
- char *path)
+ const char *path)
{
acpi_status status;
struct acpi_buffer buffer;
diff --git a/drivers/acpi/acpica/utprint.c b/drivers/acpi/acpica/utprint.c
index 8c218ad..208d71a 100644
--- a/drivers/acpi/acpica/utprint.c
+++ b/drivers/acpi/acpica/utprint.c
@@ -67,11 +67,6 @@ static char *acpi_ut_format_number(char *string,

static char *acpi_ut_put_number(char *string, u64 number, u8 base, u8 upper);

-/* Module globals */
-
-static const char acpi_gbl_lower_hex_digits[] = "0123456789abcdef";
-static const char acpi_gbl_upper_hex_digits[] = "0123456789ABCDEF";
-
/*******************************************************************************
*
* FUNCTION: acpi_ut_bound_string_length
diff --git a/drivers/acpi/acpica/uttrack.c b/drivers/acpi/acpica/uttrack.c
index 60c406a..0df07df 100644
--- a/drivers/acpi/acpica/uttrack.c
+++ b/drivers/acpi/acpica/uttrack.c
@@ -90,7 +90,7 @@ acpi_ut_remove_allocation(struct acpi_debug_mem_block *address,
******************************************************************************/

acpi_status
-acpi_ut_create_list(char *list_name,
+acpi_ut_create_list(const char *list_name,
u16 object_size, struct acpi_memory_list **return_cache)
{
struct acpi_memory_list *cache;
diff --git a/include/acpi/actypes.h b/include/acpi/actypes.h
index 140886e..b9a8b72 100644
--- a/include/acpi/actypes.h
+++ b/include/acpi/actypes.h
@@ -995,7 +995,7 @@ struct acpi_buffer {
* Predefined Namespace items
*/
struct acpi_predefined_names {
- char *name;
+ const char *name;
u8 type;
char *val;
};
@@ -1228,7 +1228,7 @@ struct acpi_mem_space_context {
* struct acpi_memory_list is used only if the ACPICA local cache is enabled
*/
struct acpi_memory_list {
- char *list_name;
+ const char *list_name;
void *list_head;
u16 object_size;
u16 max_depth;
--
1.7.10

2016-03-24 01:40:54

by Zheng, Lv

[permalink] [raw]
Subject: [PATCH 20/30] ACPICA: iASL/Disassembler: Improve handling of unresolved methods

From: Bob Moore <[email protected]>

ACPICA commit 16cd0872a070c8d3b16b8b13c1fc90a443a6b6fe

If the definition of a control method cannot be found (probably it
is in another module/SSDT), the disassembler must try to guess
at the number of arguments to that method. This change improves
the guessing heuristic.

Link: https://github.com/acpica/acpica/commit/16cd0872
Signed-off-by: Bob Moore <[email protected]>
Signed-off-by: Lv Zheng <[email protected]>
---
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 9562a10..083b16a 100644
--- a/drivers/acpi/acpica/aclocal.h
+++ b/drivers/acpi/acpica/aclocal.h
@@ -1096,6 +1096,7 @@ struct acpi_external_list {
#define ACPI_EXT_ORIGIN_FROM_FILE 0x02 /* External came from a file */
#define ACPI_EXT_INTERNAL_PATH_ALLOCATED 0x04 /* Deallocate internal path on completion */
#define ACPI_EXT_EXTERNAL_EMITTED 0x08 /* External() statement has been emitted */
+#define ACPI_EXT_ORIGIN_FROM_OPCODE 0x10 /* External came from a External() opcode */

struct acpi_external_file {
char *path;
--
1.7.10

2016-03-24 01:41:08

by Zheng, Lv

[permalink] [raw]
Subject: [PATCH 22/30] Utilities: Fix missing parentheses in ACPI_GET_BITS()/ACPI_SET_BITS()

Some compilers require parentheses to be enforced in the macro definition,
so that the macro caller side can be simpler.

This patch fixes this kind of macro issue in
ACPI_SET_BITS()/ACPI_GET_BITS(). Lv Zheng.

Link: https://bugs.acpica.org/show_bug.cgi?id=1268
Signed-off-by: Lv Zheng <[email protected]>
---
drivers/acpi/acpica/acmacros.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/acpi/acpica/acmacros.h b/drivers/acpi/acpica/acmacros.h
index b461f55..73f6653 100644
--- a/drivers/acpi/acpica/acmacros.h
+++ b/drivers/acpi/acpica/acmacros.h
@@ -287,10 +287,10 @@
/* Generic bitfield macros and masks */

#define ACPI_GET_BITS(source_ptr, position, mask) \
- ((*source_ptr >> position) & mask)
+ ((*(source_ptr) >> (position)) & (mask))

#define ACPI_SET_BITS(target_ptr, position, mask, value) \
- (*target_ptr |= ((value & mask) << position))
+ (*(target_ptr) |= (((value) & (mask)) << (position)))

#define ACPI_1BIT_MASK 0x00000001
#define ACPI_2BIT_MASK 0x00000003
--
1.7.10

2016-03-24 01:41:03

by Zheng, Lv

[permalink] [raw]
Subject: [PATCH 21/30] ACPICA: Utilities: Add ACPI_IS_POWER_OF_TWO()

ACPICA commit cbcb77565c5032dd48e19b3a8a8b8704c5f29faf

This patch adds a macro ACPI_IS_POWER_OF_TWO, which can be used to
detect if a number is a power of two. Lv Zheng.

Link: https://github.com/acpica/acpica/commit/cbcb7756
Signed-off-by: Lv Zheng <[email protected]>
Signed-off-by: Bob Moore <[email protected]>
---
drivers/acpi/acpica/acmacros.h | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/drivers/acpi/acpica/acmacros.h b/drivers/acpi/acpica/acmacros.h
index 411c18b..b461f55 100644
--- a/drivers/acpi/acpica/acmacros.h
+++ b/drivers/acpi/acpica/acmacros.h
@@ -260,6 +260,10 @@

#define ACPI_IS_MISALIGNED(value) (((acpi_size) value) & (sizeof(acpi_size)-1))

+/* Generic (power-of-two) rounding */
+
+#define ACPI_IS_POWER_OF_TWO(a) (((a) & ((a) - 1)) == 0)
+
/*
* Bitmask creation
* Bit positions start at zero.
--
1.7.10

2016-03-24 01:41:15

by Zheng, Lv

[permalink] [raw]
Subject: [PATCH 23/30] ACPICA: Hardware: Enhance acpi_hw_validate_register() with access_width/bit_offset awareness

ACPICA commit 997a90f810a4cb78604ef2e187611a181b498286

This patch enhances acpi_hw_validate_register() to sanitize register
accesses with awareness of access_width and bit_offset. Lv Zheng.

Link: https://github.com/acpica/acpica/commit/997a90f8
Link: https://bugs.acpica.org/show_bug.cgi?id=1240
Signed-off-by: Lv Zheng <[email protected]>
Signed-off-by: Bob Moore <[email protected]>
---
drivers/acpi/acpica/hwregs.c | 25 +++++++++++++++----------
1 file changed, 15 insertions(+), 10 deletions(-)

diff --git a/drivers/acpi/acpica/hwregs.c b/drivers/acpi/acpica/hwregs.c
index 93f8831..bc3f60a 100644
--- a/drivers/acpi/acpica/hwregs.c
+++ b/drivers/acpi/acpica/hwregs.c
@@ -83,6 +83,8 @@ acpi_status
acpi_hw_validate_register(struct acpi_generic_address *reg,
u8 max_bit_width, u64 *address)
{
+ u8 bit_width;
+ u8 access_width;

/* Must have a valid pointer to a GAS structure */

@@ -109,23 +111,26 @@ acpi_hw_validate_register(struct acpi_generic_address *reg,
return (AE_SUPPORT);
}

- /* Validate the bit_width */
+ /* Validate the access_width */

- if ((reg->bit_width != 8) &&
- (reg->bit_width != 16) &&
- (reg->bit_width != 32) && (reg->bit_width != max_bit_width)) {
+ if (reg->access_width > 4) {
ACPI_ERROR((AE_INFO,
- "Unsupported register bit width: 0x%X",
- reg->bit_width));
+ "Unsupported register access width: 0x%X",
+ reg->access_width));
return (AE_SUPPORT);
}

- /* Validate the bit_offset. Just a warning for now. */
+ /* Validate the bit_width, convert access_width into number of bits */

- if (reg->bit_offset != 0) {
+ access_width = reg->access_width ? reg->access_width : 1;
+ access_width = 1 << (access_width + 2);
+ bit_width =
+ ACPI_ROUND_UP(reg->bit_offset + reg->bit_width, access_width);
+ if (max_bit_width < bit_width) {
ACPI_WARNING((AE_INFO,
- "Unsupported register bit offset: 0x%X",
- reg->bit_offset));
+ "Requested bit width 0x%X is smaller than register bit width 0x%X",
+ max_bit_width, bit_width));
+ return (AE_SUPPORT);
}

return (AE_OK);
--
1.7.10

2016-03-24 01:41:26

by Zheng, Lv

[permalink] [raw]
Subject: [PATCH 24/30] ACPICA: Hardware: Add access_width/bit_offset support in acpi_hw_read()

ACPICA commit 96ece052d4d073aae4f935f0ff0746646aea1174
ACPICA commit 3d8583a054e410f2ea4d73b48986facad9cfc0d4

This patch adds access_width/bit_offset support in acpi_hw_read().
This also enables GAS definition where bit_width is not a power of
two. Lv Zheng.

Link: https://github.com/acpica/acpica/commit/96ece052
Link: https://github.com/acpica/acpica/commit/3d8583a0
Link: https://bugs.acpica.org/show_bug.cgi?id=1240
Signed-off-by: Lv Zheng <[email protected]>
Signed-off-by: Bob Moore <[email protected]>
---
drivers/acpi/acpica/hwregs.c | 66 +++++++++++++++++++++++++++++++++---------
1 file changed, 53 insertions(+), 13 deletions(-)

diff --git a/drivers/acpi/acpica/hwregs.c b/drivers/acpi/acpica/hwregs.c
index bc3f60a..12fed0c 100644
--- a/drivers/acpi/acpica/hwregs.c
+++ b/drivers/acpi/acpica/hwregs.c
@@ -150,17 +150,19 @@ acpi_hw_validate_register(struct acpi_generic_address *reg,
* 64-bit values is not needed.
*
* LIMITATIONS: <These limitations also apply to acpi_hw_write>
- * bit_width must be exactly 8, 16, or 32.
* space_ID must be system_memory or system_IO.
- * bit_offset and access_width are currently ignored, as there has
- * not been a need to implement these.
*
******************************************************************************/

acpi_status acpi_hw_read(u32 *value, struct acpi_generic_address * reg)
{
u64 address;
+ u8 access_width;
+ u32 bit_width;
+ u8 bit_offset;
u64 value64;
+ u32 value32;
+ u8 index;
acpi_status status;

ACPI_FUNCTION_NAME(hw_read);
@@ -172,28 +174,66 @@ acpi_status acpi_hw_read(u32 *value, struct acpi_generic_address * reg)
return (status);
}

- /* Initialize entire 32-bit return value to zero */
-
+ /*
+ * Initialize entire 32-bit return value to zero, convert access_width
+ * into number of bits based
+ */
*value = 0;
+ access_width = reg->access_width ? reg->access_width : 1;
+ access_width = 1 << (access_width + 2);
+ bit_width = reg->bit_offset + reg->bit_width;
+ bit_offset = reg->bit_offset;

/*
* Two address spaces supported: Memory or IO. PCI_Config is
* not supported here because the GAS structure is insufficient
*/
- if (reg->space_id == ACPI_ADR_SPACE_SYSTEM_MEMORY) {
- status = acpi_os_read_memory((acpi_physical_address)
- address, &value64, reg->bit_width);
+ index = 0;
+ while (bit_width) {
+ if (bit_offset > access_width) {
+ value32 = 0;
+ bit_offset -= access_width;
+ } else {
+ if (reg->space_id == ACPI_ADR_SPACE_SYSTEM_MEMORY) {
+ status =
+ acpi_os_read_memory((acpi_physical_address)
+ address +
+ index *
+ ACPI_DIV_8
+ (access_width),
+ &value64, access_width);
+ value32 = (u32)value64;
+ } else { /* ACPI_ADR_SPACE_SYSTEM_IO, validated earlier */
+
+ status = acpi_hw_read_port((acpi_io_address)
+ address +
+ index *
+ ACPI_DIV_8
+ (access_width),
+ &value32,
+ access_width);
+ }
+
+ if (bit_offset) {
+ value32 &= ACPI_MASK_BITS_BELOW(bit_offset);
+ bit_offset = 0;
+ }
+ if (bit_width < access_width) {
+ value32 &= ACPI_MASK_BITS_ABOVE(bit_width);
+ }
+ }

- *value = (u32)value64;
- } else { /* ACPI_ADR_SPACE_SYSTEM_IO, validated earlier */
+ ACPI_SET_BITS(value, index * access_width,
+ (1 << access_width) - 1, value32);

- status = acpi_hw_read_port((acpi_io_address)
- address, value, reg->bit_width);
+ bit_width -=
+ bit_width > access_width ? access_width : bit_width;
+ index++;
}

ACPI_DEBUG_PRINT((ACPI_DB_IO,
"Read: %8.8X width %2d from %8.8X%8.8X (%s)\n",
- *value, reg->bit_width, ACPI_FORMAT_UINT64(address),
+ *value, access_width, ACPI_FORMAT_UINT64(address),
acpi_ut_get_region_name(reg->space_id)));

return (status);
--
1.7.10

2016-03-24 01:41:32

by Zheng, Lv

[permalink] [raw]
Subject: [PATCH 25/30] ACPICA: Hardware: Add access_width/bit_offset support for acpi_hw_write()

ACPICA commit 48eea5e7993ccb7189bd63cd726e02adafee6057

This patch adds access_width/bit_offset support in acpi_hw_write().
Lv Zheng.

Link: https://github.com/acpica/acpica/commit/48eea5e7
Link: https://bugs.acpica.org/show_bug.cgi?id=1240
Signed-off-by: Lv Zheng <[email protected]>
Signed-off-by: Bob Moore <[email protected]>
---
drivers/acpi/acpica/hwregs.c | 124 +++++++++++++++++++++++++++++++++++++++---
1 file changed, 115 insertions(+), 9 deletions(-)

diff --git a/drivers/acpi/acpica/hwregs.c b/drivers/acpi/acpica/hwregs.c
index 12fed0c..29ca75d 100644
--- a/drivers/acpi/acpica/hwregs.c
+++ b/drivers/acpi/acpica/hwregs.c
@@ -257,6 +257,12 @@ acpi_status acpi_hw_read(u32 *value, struct acpi_generic_address * reg)
acpi_status acpi_hw_write(u32 value, struct acpi_generic_address *reg)
{
u64 address;
+ u8 access_width;
+ u32 bit_width;
+ u8 bit_offset;
+ u64 value64;
+ u32 new_value32, old_value32;
+ u8 index;
acpi_status status;

ACPI_FUNCTION_NAME(hw_write);
@@ -268,23 +274,123 @@ acpi_status acpi_hw_write(u32 value, struct acpi_generic_address *reg)
return (status);
}

+ /* Convert access_width into number of bits based */
+
+ access_width = reg->access_width ? reg->access_width : 1;
+ access_width = 1 << (access_width + 2);
+ bit_width = reg->bit_offset + reg->bit_width;
+ bit_offset = reg->bit_offset;
+
/*
* Two address spaces supported: Memory or IO. PCI_Config is
* not supported here because the GAS structure is insufficient
*/
- if (reg->space_id == ACPI_ADR_SPACE_SYSTEM_MEMORY) {
- status = acpi_os_write_memory((acpi_physical_address)
- address, (u64)value,
- reg->bit_width);
- } else { /* ACPI_ADR_SPACE_SYSTEM_IO, validated earlier */
-
- status = acpi_hw_write_port((acpi_io_address)
- address, value, reg->bit_width);
+ index = 0;
+ while (bit_width) {
+ new_value32 = ACPI_GET_BITS(&value, index * access_width,
+ (1 << access_width) - 1);
+
+ if (bit_offset > access_width) {
+ bit_offset -= access_width;
+ } else {
+ if (bit_offset) {
+ new_value32 &= ACPI_MASK_BITS_BELOW(bit_offset);
+ }
+
+ if (bit_width < access_width) {
+ new_value32 &= ACPI_MASK_BITS_ABOVE(bit_width);
+ }
+
+ if (reg->space_id == ACPI_ADR_SPACE_SYSTEM_MEMORY) {
+ if (bit_offset || bit_width < access_width) {
+ /*
+ * Read old values in order not to modify the bits that
+ * are beyond the register bit_width/bit_offset setting.
+ */
+ status =
+ acpi_os_read_memory((acpi_physical_address)
+ address +
+ index *
+ ACPI_DIV_8
+ (access_width),
+ &value64,
+ access_width);
+ old_value32 = (u32)value64;
+
+ if (bit_offset) {
+ old_value32 &=
+ ACPI_MASK_BITS_ABOVE
+ (bit_offset + 1);
+ bit_offset = 0;
+ }
+
+ if (bit_width < access_width) {
+ old_value32 &=
+ ACPI_MASK_BITS_BELOW
+ (bit_width - 1);
+ }
+
+ new_value32 |= old_value32;
+ }
+
+ value64 = (u64)new_value32;
+ status =
+ acpi_os_write_memory((acpi_physical_address)
+ address +
+ index *
+ ACPI_DIV_8
+ (access_width),
+ value64, access_width);
+ } else { /* ACPI_ADR_SPACE_SYSTEM_IO, validated earlier */
+
+ if (bit_offset || bit_width < access_width) {
+ /*
+ * Read old values in order not to modify the bits that
+ * are beyond the register bit_width/bit_offset setting.
+ */
+ status =
+ acpi_hw_read_port((acpi_io_address)
+ address +
+ index *
+ ACPI_DIV_8
+ (access_width),
+ &old_value32,
+ access_width);
+
+ if (bit_offset) {
+ old_value32 &=
+ ACPI_MASK_BITS_ABOVE
+ (bit_offset + 1);
+ bit_offset = 0;
+ }
+
+ if (bit_width < access_width) {
+ old_value32 &=
+ ACPI_MASK_BITS_BELOW
+ (bit_width - 1);
+ }
+
+ new_value32 |= old_value32;
+ }
+
+ status = acpi_hw_write_port((acpi_io_address)
+ address +
+ index *
+ ACPI_DIV_8
+ (access_width),
+ new_value32,
+ access_width);
+ }
+ }
+
+ bit_width -=
+ bit_width > access_width ? access_width : bit_width;
+ index++;
}

ACPI_DEBUG_PRINT((ACPI_DB_IO,
"Wrote: %8.8X width %2d to %8.8X%8.8X (%s)\n",
- value, reg->bit_width, ACPI_FORMAT_UINT64(address),
+ value, access_width, ACPI_FORMAT_UINT64(address),
acpi_ut_get_region_name(reg->space_id)));

return (status);
--
1.7.10

2016-03-24 01:41:37

by Zheng, Lv

[permalink] [raw]
Subject: [PATCH 26/30] ACPICA: Interpreter: Fix wrong conditions for acpi_ev_install_region_handlers() invocation

ACPICA commit 9a6ecc9ec9ee067cad51eec539230bf494421d76

Since AE_ALREADY_EXISTS has already been converted to AE_OK in
acpi_ev_install_region_handlers(), this patch simplies a return value
check. Lv Zheng.

Link: https://github.com/acpica/acpica/commit/9a6ecc9e
Signed-off-by: Lv Zheng <[email protected]>
---
drivers/acpi/acpica/tbxfload.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/acpi/acpica/tbxfload.c b/drivers/acpi/acpica/tbxfload.c
index 3151968..ac71abc 100644
--- a/drivers/acpi/acpica/tbxfload.c
+++ b/drivers/acpi/acpica/tbxfload.c
@@ -82,7 +82,7 @@ acpi_status __init acpi_load_tables(void)
* their customized default region handlers.
*/
status = acpi_ev_install_region_handlers();
- if (ACPI_FAILURE(status) && status != AE_ALREADY_EXISTS) {
+ if (ACPI_FAILURE(status)) {
ACPI_EXCEPTION((AE_INFO, status,
"During Region initialization"));
return_ACPI_STATUS(status);
--
1.7.10

2016-03-24 01:41:45

by Zheng, Lv

[permalink] [raw]
Subject: [PATCH 27/30] ACPICA: Tables: Fix wrong MLC condition for dynamic table loading

ACPICA commit 5798cd6171ea38bcf4594d0ccc78870784776ba5

The patch corrects wrong condition before group MLC is disabled.

Link: https://github.com/acpica/acpica/commit/5798cd61
Link: https://bugs.acpica.org/show_bug.cgi?id=1262
Signed-off-by: Lv Zheng <[email protected]>
Signed-off-by: Bob Moore <[email protected]>
---
drivers/acpi/acpica/exconfig.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/acpi/acpica/exconfig.c b/drivers/acpi/acpica/exconfig.c
index f741613..a1d177d 100644
--- a/drivers/acpi/acpica/exconfig.c
+++ b/drivers/acpi/acpica/exconfig.c
@@ -118,7 +118,9 @@ acpi_ex_add_table(u32 table_index,
/* Execute any module-level code that was found in the table */

acpi_ex_exit_interpreter();
- acpi_ns_exec_module_code_list();
+ if (acpi_gbl_group_module_level_code) {
+ acpi_ns_exec_module_code_list();
+ }
acpi_ex_enter_interpreter();

/*
--
1.7.10

2016-03-24 01:41:53

by Zheng, Lv

[permalink] [raw]
Subject: [PATCH 28/30] ACPICA: Events: Fix an issue that _REG association can happen before namespace is initialized

ACPICA commit c508f8592efaa0d8197f26d7fee6382c5ac8e383

Current code flow cannot ensure _REG association can happen after the
namespace is initialized, so we move _REG association to where _REG was
about to run to fix this issue.

This issue is detected when acpi_ev_initialize_region() is invoked during
the table loading. And this is one of the most important the root cause why
ACPICA table loading is split into 2 load passes. Lv Zheng.

Link: https://github.com/acpica/acpica/commit/c508f859
Link: https://bugs.acpica.org/show_bug.cgi?id=1252
Signed-off-by: Lv Zheng <[email protected]>
Signed-off-by: Bob Moore <[email protected]>
---
drivers/acpi/acpica/acevents.h | 2 --
drivers/acpi/acpica/evregion.c | 71 ++++++++++++++--------------------------
drivers/acpi/acpica/evrgnini.c | 1 -
3 files changed, 24 insertions(+), 50 deletions(-)

diff --git a/drivers/acpi/acpica/acevents.h b/drivers/acpi/acpica/acevents.h
index 010cf81..17f2217 100644
--- a/drivers/acpi/acpica/acevents.h
+++ b/drivers/acpi/acpica/acevents.h
@@ -198,8 +198,6 @@ void
acpi_ev_detach_region(union acpi_operand_object *region_obj,
u8 acpi_ns_is_locked);

-void acpi_ev_associate_reg_method(union acpi_operand_object *region_obj);
-
void
acpi_ev_execute_reg_methods(struct acpi_namespace_node *node,
acpi_adr_space_type space_id, u32 function);
diff --git a/drivers/acpi/acpica/evregion.c b/drivers/acpi/acpica/evregion.c
index 17d61c6..4c6f795 100644
--- a/drivers/acpi/acpica/evregion.c
+++ b/drivers/acpi/acpica/evregion.c
@@ -526,82 +526,59 @@ acpi_ev_attach_region(union acpi_operand_object *handler_obj,

/*******************************************************************************
*
- * FUNCTION: acpi_ev_associate_reg_method
+ * FUNCTION: acpi_ev_execute_reg_method
*
* PARAMETERS: region_obj - Region object
+ * function - Passed to _REG: On (1) or Off (0)
*
* RETURN: Status
*
- * DESCRIPTION: Find and associate _REG method to a region
+ * DESCRIPTION: Execute _REG method for a region
*
******************************************************************************/

-void acpi_ev_associate_reg_method(union acpi_operand_object *region_obj)
+acpi_status
+acpi_ev_execute_reg_method(union acpi_operand_object *region_obj, u32 function)
{
+ struct acpi_evaluate_info *info;
+ union acpi_operand_object *args[3];
+ union acpi_operand_object *region_obj2;
const acpi_name *reg_name_ptr =
ACPI_CAST_PTR(acpi_name, METHOD_NAME__REG);
struct acpi_namespace_node *method_node;
struct acpi_namespace_node *node;
- union acpi_operand_object *region_obj2;
acpi_status status;

- ACPI_FUNCTION_TRACE(ev_associate_reg_method);
+ ACPI_FUNCTION_TRACE(ev_execute_reg_method);
+
+ if (!acpi_gbl_namespace_initialized ||
+ region_obj->region.handler == NULL) {
+ return_ACPI_STATUS(AE_OK);
+ }

region_obj2 = acpi_ns_get_secondary_object(region_obj);
if (!region_obj2) {
- return_VOID;
+ return_ACPI_STATUS(AE_NOT_EXIST);
}

+ /*
+ * Find any "_REG" method associated with this region definition.
+ * The method should always be updated as this function may be
+ * invoked after a namespace change.
+ */
node = region_obj->region.node->parent;
-
- /* Find any "_REG" method associated with this region definition */
-
status =
acpi_ns_search_one_scope(*reg_name_ptr, node, ACPI_TYPE_METHOD,
&method_node);
if (ACPI_SUCCESS(status)) {
/*
- * The _REG method is optional and there can be only one per region
- * definition. This will be executed when the handler is attached
- * or removed
+ * The _REG method is optional and there can be only one per
+ * region definition. This will be executed when the handler is
+ * attached or removed.
*/
region_obj2->extra.method_REG = method_node;
}
-
- return_VOID;
-}
-
-/*******************************************************************************
- *
- * FUNCTION: acpi_ev_execute_reg_method
- *
- * PARAMETERS: region_obj - Region object
- * function - Passed to _REG: On (1) or Off (0)
- *
- * RETURN: Status
- *
- * DESCRIPTION: Execute _REG method for a region
- *
- ******************************************************************************/
-
-acpi_status
-acpi_ev_execute_reg_method(union acpi_operand_object *region_obj, u32 function)
-{
- struct acpi_evaluate_info *info;
- union acpi_operand_object *args[3];
- union acpi_operand_object *region_obj2;
- acpi_status status;
-
- ACPI_FUNCTION_TRACE(ev_execute_reg_method);
-
- region_obj2 = acpi_ns_get_secondary_object(region_obj);
- if (!region_obj2) {
- return_ACPI_STATUS(AE_NOT_EXIST);
- }
-
- if (region_obj2->extra.method_REG == NULL ||
- region_obj->region.handler == NULL ||
- !acpi_gbl_namespace_initialized) {
+ if (region_obj2->extra.method_REG == NULL) {
return_ACPI_STATUS(AE_OK);
}

diff --git a/drivers/acpi/acpica/evrgnini.c b/drivers/acpi/acpica/evrgnini.c
index fda869c..6972ab4 100644
--- a/drivers/acpi/acpica/evrgnini.c
+++ b/drivers/acpi/acpica/evrgnini.c
@@ -518,7 +518,6 @@ acpi_ev_initialize_region(union acpi_operand_object *region_obj,
return_ACPI_STATUS(AE_OK);
}

- acpi_ev_associate_reg_method(region_obj);
region_obj->common.flags |= AOPOBJ_OBJECT_INITIALIZED;

node = region_obj->region.node->parent;
--
1.7.10

2016-03-24 01:42:09

by Zheng, Lv

[permalink] [raw]
Subject: [PATCH 30/30] ACPICA: Update version to 20160318

From: Bob Moore <[email protected]>

ACPICA commit e714615fda31cce3df9cfd95ee03c1f2c74b2b5e

Version 20160318.

Link: https://github.com/acpica/acpica/commit/e714615f
Signed-off-by: Bob Moore <[email protected]>
Signed-off-by: Lv Zheng <[email protected]>
---
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 1755697..83583a2 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 0x20160108
+#define ACPI_CA_VERSION 0x20160318

#include <acpi/acconfig.h>
#include <acpi/actypes.h>
--
1.7.10

2016-03-24 01:42:06

by Zheng, Lv

[permalink] [raw]
Subject: [PATCH 29/30] ACPICA: Namespace: Reorder \_SB._INI to make sure it is evaluated before _REG evaluations

ACPICA commit f005ee6b90d152c1f499efcca6b771a93903cb55

This patch splits \_SB._INI evaluation from device initialization code, so
that it can be performed before PCI_Config _REG evaluations. This is
required for the device enumeration process. Some named objects are
initialized in \_SB._INI and PCI_Config _REG evaluations may use
uninitialized named objects because of the order issue.

This must be fixed before fixing ECDT order issue. There are existing
tables allowing ECDT EC to be used for the entire device enumeration
process, but the enabling of ECDT EC is done in \_SB._INI. Thus \_SB._INI
must be the first control method evaluated in the device enumeration
process. Normally, the order should be automatically ensured by the device
enumeration process itself (for example, PCI_Config _REGs are evaluated by
the PCI bus driver when the driver is probed by the enumeration process),
but since the process is split on Linux (partially done in Linux, partially
done in ACPICA), we need to ensure this with special logics in order to be
regression safe. Lv Zheng.

Link: https://github.com/acpica/acpica/commit/f005ee6b
Signed-off-by: Lv Zheng <[email protected]>
Signed-off-by: Bob Moore <[email protected]>
---
drivers/acpi/acpica/nsinit.c | 75 ++++++++++++++++++++++++++++++------------
1 file changed, 54 insertions(+), 21 deletions(-)

diff --git a/drivers/acpi/acpica/nsinit.c b/drivers/acpi/acpica/nsinit.c
index 2de8adb..36643a8 100644
--- a/drivers/acpi/acpica/nsinit.c
+++ b/drivers/acpi/acpica/nsinit.c
@@ -140,6 +140,7 @@ acpi_status acpi_ns_initialize_devices(u32 flags)
{
acpi_status status = AE_OK;
struct acpi_device_walk_info info;
+ acpi_handle handle;

ACPI_FUNCTION_TRACE(ns_initialize_devices);

@@ -190,6 +191,27 @@ acpi_status acpi_ns_initialize_devices(u32 flags)
if (ACPI_SUCCESS(status)) {
info.num_INI++;
}
+
+ /*
+ * Execute \_SB._INI.
+ * There appears to be a strict order requirement for \_SB._INI,
+ * which should be evaluated before any _REG evaluations.
+ */
+ status = acpi_get_handle(NULL, "\\_SB", &handle);
+ if (ACPI_SUCCESS(status)) {
+ memset(info.evaluate_info, 0,
+ sizeof(struct acpi_evaluate_info));
+ info.evaluate_info->prefix_node = handle;
+ info.evaluate_info->relative_pathname =
+ METHOD_NAME__INI;
+ info.evaluate_info->parameters = NULL;
+ info.evaluate_info->flags = ACPI_IGNORE_RETURN_VALUE;
+
+ status = acpi_ns_evaluate(info.evaluate_info);
+ if (ACPI_SUCCESS(status)) {
+ info.num_INI++;
+ }
+ }
}

/*
@@ -198,6 +220,12 @@ acpi_status acpi_ns_initialize_devices(u32 flags)
* Note: Any objects accessed by the _REG methods will be automatically
* initialized, even if they contain executable AML (see the call to
* acpi_ns_initialize_objects below).
+ *
+ * Note: According to the ACPI specification, we actually needn't execute
+ * _REG for system_memory/system_io operation regions, but for PCI_Config
+ * operation regions, it is required to evaluate _REG for those on a PCI
+ * root bus that doesn't contain _BBN object. So this code is kept here
+ * in order not to break things.
*/
if (!(flags & ACPI_NO_ADDRESS_SPACE_INIT)) {
ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
@@ -592,32 +620,37 @@ acpi_ns_init_one_device(acpi_handle obj_handle,
* Note: We know there is an _INI within this subtree, but it may not be
* under this particular device, it may be lower in the branch.
*/
- ACPI_DEBUG_EXEC(acpi_ut_display_init_pathname
- (ACPI_TYPE_METHOD, device_node, METHOD_NAME__INI));
-
- memset(info, 0, sizeof(struct acpi_evaluate_info));
- info->prefix_node = device_node;
- info->relative_pathname = METHOD_NAME__INI;
- info->parameters = NULL;
- info->flags = ACPI_IGNORE_RETURN_VALUE;
-
- status = acpi_ns_evaluate(info);
- if (ACPI_SUCCESS(status)) {
- walk_info->num_INI++;
- }
+ if (!ACPI_COMPARE_NAME(device_node->name.ascii, "_SB_") ||
+ device_node->parent != acpi_gbl_root_node) {
+ ACPI_DEBUG_EXEC(acpi_ut_display_init_pathname
+ (ACPI_TYPE_METHOD, device_node,
+ METHOD_NAME__INI));
+
+ memset(info, 0, sizeof(struct acpi_evaluate_info));
+ info->prefix_node = device_node;
+ info->relative_pathname = METHOD_NAME__INI;
+ info->parameters = NULL;
+ info->flags = ACPI_IGNORE_RETURN_VALUE;
+
+ status = acpi_ns_evaluate(info);
+ if (ACPI_SUCCESS(status)) {
+ walk_info->num_INI++;
+ }
#ifdef ACPI_DEBUG_OUTPUT
- else if (status != AE_NOT_FOUND) {
+ else if (status != AE_NOT_FOUND) {

- /* Ignore error and move on to next device */
+ /* Ignore error and move on to next device */

- char *scope_name =
- acpi_ns_get_normalized_pathname(device_node, TRUE);
+ char *scope_name =
+ acpi_ns_get_normalized_pathname(device_node, TRUE);

- ACPI_EXCEPTION((AE_INFO, status, "during %s._INI execution",
- scope_name));
- ACPI_FREE(scope_name);
- }
+ ACPI_EXCEPTION((AE_INFO, status,
+ "during %s._INI execution",
+ scope_name));
+ ACPI_FREE(scope_name);
+ }
#endif
+ }

/* Ignore errors from above */

--
1.7.10

2016-03-24 01:44:37

by Zheng, Lv

[permalink] [raw]
Subject: [PATCH 14/30] ACPICA: iASL: Cleanup/optimization for ToPLD macro support

From: Bob Moore <[email protected]>

ACPICA commit 0e6125401cf38427d5376f4bafbfb3d5a40f8467

Use local variables for access to string/value Op fields.
Move duplicate PLD string tables to a single common table.

Link: https://github.com/acpica/acpica/commit/0e612540
Signed-off-by: Bob Moore <[email protected]>
Signed-off-by: Lv Zheng <[email protected]>
---
drivers/acpi/acpica/acglobal.h | 9 +++++++++
drivers/acpi/acpica/utglobal.c | 43 ++++++++++++++++++++++++++++++++++++++++
2 files changed, 52 insertions(+)

diff --git a/drivers/acpi/acpica/acglobal.h b/drivers/acpi/acpica/acglobal.h
index 51b073b..54b42a5 100644
--- a/drivers/acpi/acpica/acglobal.h
+++ b/drivers/acpi/acpica/acglobal.h
@@ -361,6 +361,15 @@ ACPI_GLOBAL(u32, acpi_gbl_num_objects);

#endif /* ACPI_DEBUGGER */

+#if defined (ACPI_DISASSEMBLER) || defined (ACPI_ASL_COMPILER)
+
+ACPI_GLOBAL(const char, *acpi_gbl_pld_panel_list[]);
+ACPI_GLOBAL(const char, *acpi_gbl_pld_vertical_position_list[]);
+ACPI_GLOBAL(const char, *acpi_gbl_pld_horizontal_position_list[]);
+ACPI_GLOBAL(const char, *acpi_gbl_pld_shape_list[]);
+
+#endif
+
/*****************************************************************************
*
* Application globals
diff --git a/drivers/acpi/acpica/utglobal.c b/drivers/acpi/acpica/utglobal.c
index 48fffcf..d45899c 100644
--- a/drivers/acpi/acpica/utglobal.c
+++ b/drivers/acpi/acpica/utglobal.c
@@ -221,6 +221,49 @@ struct acpi_fixed_event_info acpi_gbl_fixed_event_info[ACPI_NUM_FIXED_EVENTS] =
};
#endif /* !ACPI_REDUCED_HARDWARE */

+#if defined (ACPI_DISASSEMBLER) || defined (ACPI_ASL_COMPILER)
+
+/* to_pld macro: compile/disassemble strings */
+
+const char *acpi_gbl_pld_panel_list[] = {
+ "TOP",
+ "BOTTOM",
+ "LEFT",
+ "RIGHT",
+ "FRONT",
+ "BACK",
+ "UNKNOWN",
+ NULL
+};
+
+const char *acpi_gbl_pld_vertical_position_list[] = {
+ "UPPER",
+ "CENTER",
+ "LOWER",
+ NULL
+};
+
+const char *acpi_gbl_pld_horizontal_position_list[] = {
+ "LEFT",
+ "CENTER",
+ "RIGHT",
+ NULL
+};
+
+const char *acpi_gbl_pld_shape_list[] = {
+ "ROUND",
+ "OVAL",
+ "SQUARE",
+ "VERTICALRECTANGLE",
+ "HORIZONTALRECTANGLE",
+ "VERTICALTRAPEZOID",
+ "HORIZONTALTRAPEZOID",
+ "UNKNOWN",
+ "CHAMFERED",
+ NULL
+};
+#endif
+
/* Public globals */

ACPI_EXPORT_SYMBOL(acpi_gbl_FADT)
--
1.7.10

2016-03-24 01:39:14

by Zheng, Lv

[permalink] [raw]
Subject: [PATCH 06/30] ACPICA: IORT: Add in support for the SMMUv3 subtable

From: Al Stone <[email protected]>

ACPICA commit 9f7c3e148f440049615e2791d73b292f65692d7e

The most recent version of the IORT specification adds in a definition
for a subtable to describe SMMUv3 devices; there is already a subtable
for SMMUv1/v2 devices.

Add in the definition of the subtable, add in the code to compile it,
and add in a template for it.

Link: https://github.com/acpica/acpica/commit/9f7c3e14
Signed-off-by: Al Stone <[email protected]>
Signed-off-by: Bob Moore <[email protected]>
Signed-off-by: Lv Zheng <[email protected]>
---
include/acpi/actbl2.h | 22 ++++++++++++++++++++--
1 file changed, 20 insertions(+), 2 deletions(-)

diff --git a/include/acpi/actbl2.h b/include/acpi/actbl2.h
index e9d3cc1..d6bd377 100644
--- a/include/acpi/actbl2.h
+++ b/include/acpi/actbl2.h
@@ -660,7 +660,7 @@ struct acpi_ibft_target {
* IORT - IO Remapping Table
*
* Conforms to "IO Remapping Table System Software on ARM Platforms",
- * Document number: ARM DEN 0049A, 2015
+ * Document number: ARM DEN 0049B, October 2015
*
******************************************************************************/

@@ -690,7 +690,8 @@ enum acpi_iort_node_type {
ACPI_IORT_NODE_ITS_GROUP = 0x00,
ACPI_IORT_NODE_NAMED_COMPONENT = 0x01,
ACPI_IORT_NODE_PCI_ROOT_COMPLEX = 0x02,
- ACPI_IORT_NODE_SMMU = 0x03
+ ACPI_IORT_NODE_SMMU = 0x03,
+ ACPI_IORT_NODE_SMMU_V3 = 0x04
};

struct acpi_iort_id_mapping {
@@ -780,6 +781,23 @@ struct acpi_iort_smmu {
#define ACPI_IORT_SMMU_DVM_SUPPORTED (1)
#define ACPI_IORT_SMMU_COHERENT_WALK (1<<1)

+struct acpi_iort_smmu_v3 {
+ u64 base_address; /* SMMUv3 base address */
+ u32 flags;
+ u32 reserved;
+ u64 vatos_address;
+ u32 model; /* O: generic SMMUv3 */
+ u32 event_gsiv;
+ u32 pri_gsiv;
+ u32 gerr_gsiv;
+ u32 sync_gsiv;
+};
+
+/* Masks for Flags field above */
+
+#define ACPI_IORT_SMMU_V3_COHACC_OVERRIDE (1)
+#define ACPI_IORT_SMMU_V3_HTTU_OVERRIDE (1<<1)
+
/*******************************************************************************
*
* IVRS - I/O Virtualization Reporting Structure
--
1.7.10

2016-03-24 01:46:14

by Joe Perches

[permalink] [raw]
Subject: Re: [PATCH 01/30] ACPICA: Linuxize: reduce divergences for 20160212 release

On Thu, 2016-03-24 at 09:38 +0800, Lv Zheng wrote:
> The patch reduces source code differences between the Linux kernel and the
> ACPICA upstream so that the linuxized ACPICA 20160212 release can be
> applied with reduced human intervention.

In the very first patch fragment:

> diff --git a/drivers/acpi/acpica/hwregs.c b/drivers/acpi/acpica/hwregs.c
[]
> @@ -152,7 +152,7 @@ acpi_hw_validate_register(struct acpi_generic_address *reg,
>   *
>   ******************************************************************************/
>  
> -acpi_status acpi_hw_read(u32 *value, struct acpi_generic_address *reg)
> +acpi_status acpi_hw_read(u32 *value, struct acpi_generic_address * reg)

The second argument * style appears the opposite of normal style
and a different style than the first argument * style.

> diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c
[]
> @@ -582,7 +582,7 @@ static char acpi_os_name[ACPI_MAX_OVERRIDE_LEN];
>  
>  acpi_status
>  acpi_os_predefined_override(const struct acpi_predefined_names *init_val,
> -     char **new_val)
> +     acpi_string *new_val)

And here:

acpi_string pointer style 1:

> diff --git a/include/acpi/acpiosxf.h b/include/acpi/acpiosxf.h
[]
> @@ -96,7 +96,7 @@ acpi_physical_address acpi_os_get_root_pointer(void);
>  #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_predefined_override
>  acpi_status
>  acpi_os_predefined_override(const struct acpi_predefined_names *init_val,
> -     char **new_val);
> +     acpi_string * new_val);

acpi_string pointer style 2:

There are varying styles for acpi_string *

So far, this just looks sloppy.
Should the rest be reviewed?

2016-03-24 06:19:50

by Zheng, Lv

[permalink] [raw]
Subject: RE: [PATCH 01/30] ACPICA: Linuxize: reduce divergences for 20160212 release

Hi,

First, thanks for the revew.

> From: Joe Perches [mailto:[email protected]]
> Subject: Re: [PATCH 01/30] ACPICA: Linuxize: reduce divergences for 20160212
> release
>
> On Thu, 2016-03-24 at 09:38 +0800, Lv Zheng wrote:
> > The patch reduces source code differences between the Linux kernel and the
> > ACPICA upstream so that the linuxized ACPICA 20160212 release can be
> > applied with reduced human intervention.
>
> In the very first patch fragment:
>
> > diff --git a/drivers/acpi/acpica/hwregs.c b/drivers/acpi/acpica/hwregs.c
> []
> > @@ -152,7 +152,7 @@ acpi_hw_validate_register(struct
> acpi_generic_address *reg,
> >   *
> >   **************************************************************
> ****************/
> >
> > -acpi_status acpi_hw_read(u32 *value, struct acpi_generic_address *reg)
> > +acpi_status acpi_hw_read(u32 *value, struct acpi_generic_address * reg)
>
> The second argument * style appears the opposite of normal style
> and a different style than the first argument * style.
[Lv Zheng]
The file is drivers/acpi/acpica/hwregs.c, which is coming from ACPICA upstream.
So this is a result of "ACPICA release".
In other words, this is a result of a "process".
In order to fix this, things need to be done in "ACPICA release scripts".
Which should be done in https://github.com/acpica/acpica/blob/master/generate/linux/libacpica.sh.
Otherwise, "ACPICA release" process will require human intervention.

So please leave this patch fragment as is.
It will be automatically fixed if the "ACPICA release" process is fixed.
And if you don't leave this fragment as is, the "ACPICA release" process will get hurt.

>
> > diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c
> []
> > @@ -582,7 +582,7 @@ static char
> acpi_os_name[ACPI_MAX_OVERRIDE_LEN];
> >
> >  acpi_status
> >  acpi_os_predefined_override(const struct acpi_predefined_names *init_val,
> > -     char **new_val)
> > +     acpi_string *new_val)
>
> And here:
>
> acpi_string pointer style 1:
[Lv Zheng]
This file drivers/acpi/osl.c is not in the ACPICA upstream.
It is Linux specific, so we use Linux coding style.
Thus this is a result of a "human".

>
> > diff --git a/include/acpi/acpiosxf.h b/include/acpi/acpiosxf.h
> []
> > @@ -96,7 +96,7 @@ acpi_physical_address acpi_os_get_root_pointer(void);
> >  #ifndef ACPI_USE_ALTERNATE_PROTOTYPE_acpi_os_predefined_override
> >  acpi_status
> >  acpi_os_predefined_override(const struct acpi_predefined_names *init_val,
> > -     char **new_val);
> > +     acpi_string * new_val);
>
> acpi_string pointer style 2:
>
> There are varying styles for acpi_string *
[Lv Zheng]
This is ACPICA upstream file modification.
Also a result of a "process".

>
> So far, this just looks sloppy.
[Lv Zheng]
As I said, please ignore "process" issues.
I need them to be wrong in order not to modify every "process" generated patches manually.
You can find many such kind of indent issues in drivers/acpi/acpica, include/acpi, tools/power/acpi.
They are there for good reasons.
I'll cleanup such issues from "ACPICA release" process.

> Should the rest be reviewed?

[Lv Zheng]
Yes, please.

Thanks and best regards
-Lv

2016-03-24 06:35:53

by Brown, Len

[permalink] [raw]
Subject: RE: [PATCH 01/30] ACPICA: Linuxize: reduce divergences for 20160212 release

> > >
> > > -acpi_status acpi_hw_read(u32 *value, struct acpi_generic_address
> *reg)
> > > +acpi_status acpi_hw_read(u32 *value, struct acpi_generic_address *
> reg)
> >
> > The second argument * style appears the opposite of normal style
> > and a different style than the first argument * style.
> [Lv Zheng]
> The file is drivers/acpi/acpica/hwregs.c, which is coming from ACPICA
> upstream.
> So this is a result of "ACPICA release".
> In other words, this is a result of a "process".
> In order to fix this, things need to be done in "ACPICA release scripts".
> Which should be done in
> https://github.com/acpica/acpica/blob/master/generate/linux/libacpica.sh.
> Otherwise, "ACPICA release" process will require human intervention.
>
> So please leave this patch fragment as is.
> It will be automatically fixed if the "ACPICA release" process is fixed.
> And if you don't leave this fragment as is, the "ACPICA release" process
> will get hurt.

I disagree.

The patch should be correct when it hits the Linux kernel tree.

If the process is broken, then fix the process and re-send
a fixed patch. Linux doesn't care if the process is a program
that runs with the click of a button, or the result of 1000
engineering laboring day and night. Only the result matters,
the result should be correct, and this patch is not correct.

-Len


2016-03-24 06:53:57

by Zheng, Lv

[permalink] [raw]
Subject: RE: [PATCH 01/30] ACPICA: Linuxize: reduce divergences for 20160212 release

Hi,

> From: Brown, Len
> Subject: RE: [PATCH 01/30] ACPICA: Linuxize: reduce divergences for 20160212
> release
>
> > > >
> > > > -acpi_status acpi_hw_read(u32 *value, struct acpi_generic_address
> > *reg)
> > > > +acpi_status acpi_hw_read(u32 *value, struct acpi_generic_address *
> > reg)
> > >
> > > The second argument * style appears the opposite of normal style
> > > and a different style than the first argument * style.
> > [Lv Zheng]
> > The file is drivers/acpi/acpica/hwregs.c, which is coming from ACPICA
> > upstream.
> > So this is a result of "ACPICA release".
> > In other words, this is a result of a "process".
> > In order to fix this, things need to be done in "ACPICA release scripts".
> > Which should be done in
> > https://github.com/acpica/acpica/blob/master/generate/linux/libacpica.sh.
> > Otherwise, "ACPICA release" process will require human intervention.
> >
> > So please leave this patch fragment as is.
> > It will be automatically fixed if the "ACPICA release" process is fixed.
> > And if you don't leave this fragment as is, the "ACPICA release" process
> > will get hurt.
>
> I disagree.
>
> The patch should be correct when it hits the Linux kernel tree.
[Lv Zheng]
This has already been an agreement between Linux and ACPICA.
We have 1 such kind of patch in each release cycle merged.

>
> If the process is broken, then fix the process and re-send
> a fixed patch. Linux doesn't care if the process is a program
> that runs with the click of a button, or the result of 1000
> engineering laboring day and night. Only the result matters,
> the result should be correct, and this patch is not correct.
[Lv Zheng]
If we forced the rule you mentioned, then every release cycle would be blocked by strange reasons.
It's worse than letting this pass.
Normally, ACPICA release happens before the indent issue is identified.
So the patch to fix the indent issue will be merged in ACPICA upstream after the release cycle.
Then if we let the machine do this automatically, the fix will appear after the release cycle.

Moreover, sometimes, such indent issue is not in the process itself.
Though we use indent -linux, but indent doesn't work as our expectation to generate a patch that can pass checkpatch.pl.
What should we do then?
We are developing Linux kernel, not developing indent.
So sometimes, such kind of issue is inevitable as long as we use "indent".
It's useless to waste time working on correcting this.
Which means humans are hired to do machine's job...

Thanks and best regards
-Lv

2016-03-24 11:00:40

by Joe Perches

[permalink] [raw]
Subject: Re: [PATCH 01/30] ACPICA: Linuxize: reduce divergences for 20160212 release

On Thu, 2016-03-24 at 06:19 +0000, Zheng, Lv wrote:
> From: Joe Perches [mailto:[email protected]]
> > Subject: Re: [PATCH 01/30] ACPICA: Linuxize: reduce divergences for 20160212
> > release
> >
> > On Thu, 2016-03-24 at 09:38 +0800, Lv Zheng wrote:
> > >
> > > The patch reduces source code differences between the Linux kernel and the
> > > ACPICA upstream so that the linuxized ACPICA 20160212 release can be
> > > applied with reduced human intervention.
> > In the very first patch fragment:
> > > diff --git a/drivers/acpi/acpica/hwregs.c b/drivers/acpi/acpica/hwregs.c
> > []
> > > @@ -152,7 +152,7 @@ acpi_hw_validate_register(struct
> > acpi_generic_address *reg,
[]
> > > -acpi_status acpi_hw_read(u32 *value, struct acpi_generic_address *reg)
> > > +acpi_status acpi_hw_read(u32 *value, struct acpi_generic_address * reg)
> > The second argument * style appears the opposite of normal style
> > and a different style than the first argument * style.
> [Lv Zheng] 
> The file is drivers/acpi/acpica/hwregs.c, which is coming from ACPICA upstream.
> So this is a result of "ACPICA release".
> In other words, this is a result of a "process".
> In order to fix this, things need to be done in "ACPICA release scripts".
> Which should be done in https://github.com/acpica/acpica/blob/master/generate/linux/libacpica.sh.
> Otherwise, "ACPICA release" process will require human intervention.
>
> So please leave this patch fragment as is.
> It will be automatically fixed if the "ACPICA release" process is fixed.
> And if you don't leave this fragment as is, the "ACPICA release" process will get hurt.
[]
> please ignore "process" issues.
> I need them to be wrong in order not to modify every "process" generated patches manually.

So why not fix the process script first?

Maybe add something like:

$ grep -E "^typedef\s+\w+\s*\*?\s*acpi_\w+" include/acpi/actypes.h | \
grep -Eoh "\bacpi_\w+"

to the acpi_types variable in the lindent_single function

> You can find many such kind of indent issues in drivers/acpi/acpica, include/acpi, tools/power/acpi.
> They are there for good reasons.
> I'll cleanup such issues from "ACPICA release" process.

Any idea when?

2016-03-24 13:09:06

by Rafael J. Wysocki

[permalink] [raw]
Subject: Re: [PATCH 00/30] ACPICA: 20160318 Release

On Thu, Mar 24, 2016 at 2:38 AM, Lv Zheng <[email protected]> wrote:
> The 20160318 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 + allyes
> 2. i386 + allno
> 3. i386 + default + ACPI_DEBUGGER=y
> 4. i386 + default + ACPI_DEBUGGER=n + ACPI_DEBUG=y
> 5. i386 + default + ACPI_DEBUG=n + ACPI=y
> 6. i386 + default + ACPI=n
> 7. x86_64 + allyes
> 8. x86_64 + allno
> 9. x86_64 + default + ACPI_DEBUGGER=y
> 10.x86_64 + default + ACPI_DEBUGGER=n + ACPI_DEBUG=y
> 11.x86_64 + default + ACPI_DEBUG=n + ACPI=y
> 12.x86_64 + default + ACPI=n
> Boot tests are performed as follows:
> 1. i386 + default + ACPI_DEBUGGER=y
> 2. x86_64 + default + ACPI_DEBUGGER=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 "drivers/platform" drivers
> All other drivers that link the APIs provided by ACPICA subsystem
>
> The divergences checking result:
> Before applying (20160212 Release):
> 506 lines
> After applying (20160318 Release):
> 494 lines
>
> Al Stone (1):
> ACPICA: IORT: Add in support for the SMMUv3 subtable
>
> Aleksey Makarov (1):
> ACPICA: Headers: Add new constants for the DBG2 ACPI table
>
> Bob Moore (16):
> ACPICA: Headers: Minor update for SPCR ACPI table
> ACPICA: ACPI 6.1: Updates for the HEST ACPI table
> ACPICA: ACPI 6.1: Update NFIT table for additional new fields
> ACPICA: Headers: Update DMAR table for October 2014 I/O spec
> ACPICA: Tables: Update FADT handling
> ACPICA: ACPI 6.1: Add full support for this version of ACPI spec
> ACPICA: iASL/Headers: Fix incorrect definition of FPDT table
> ACPICA: Intepreter: Add object extensions to Concatenate operand
> ACPICA: Interpreter: Update some function headers, no functional
> change
> ACPICA: iASL: Cleanup/optimization for ToPLD macro support
> ACPICA: Cleanup some invocation indentations, no functional change
> ACPICA: Headers: Update generation of the ACPICA library
> ACPICA: Utilities: Update for strtoul64 merger
> ACPICA: All: const keyword changes across the ACPICA source
> ACPICA: iASL/Disassembler: Improve handling of unresolved methods
> ACPICA: Update version to 20160318
>
> Lv Zheng (11):
> ACPICA: Linuxize: reduce divergences for 20160212 release
> ACPICA: Linuxize: Remove useless platform headers
> ACPICA: Utilities: Add ACPI_IS_POWER_OF_TWO()
> Utilities: Fix missing parentheses in ACPI_GET_BITS()/ACPI_SET_BITS()
> ACPICA: Hardware: Enhance acpi_hw_validate_register() with
> access_width/bit_offset awareness
> ACPICA: Hardware: Add access_width/bit_offset support in
> acpi_hw_read()
> ACPICA: Hardware: Add access_width/bit_offset support for
> acpi_hw_write()
> ACPICA: Interpreter: Fix wrong conditions for
> acpi_ev_install_region_handlers() invocation
> ACPICA: Tables: Fix wrong MLC condition for dynamic table loading
> ACPICA: Events: Fix an issue that _REG association can happen before
> namespace is initialized
> ACPICA: Namespace: Reorder \_SB._INI to make sure it is evaluated
> before _REG evaluations
>
> Will Miles (1):
> ACPICA: Add support for QNX 6.6 platform

This is too late to go in during the current merge window, but I'll
queue it up and send a separate pull request for 4.6 with it next
week.

I'll fix up the whitespace breakage in the first patch (it is easy
enough to fix up manually), but as Len said, please fix the process to
avoid such things in the future.

Thanks,
Rafael

2016-03-28 03:03:19

by Zheng, Lv

[permalink] [raw]
Subject: RE: [PATCH 01/30] ACPICA: Linuxize: reduce divergences for 20160212 release

Hi,

> From: [email protected] [mailto:linux-acpi-
> Subject: Re: [PATCH 01/30] ACPICA: Linuxize: reduce divergences for 20160212
> release
>
> On Thu, 2016-03-24 at 06:19 +0000, Zheng, Lv wrote:
> > From: Joe Perches [mailto:[email protected]]
> > > Subject: Re: [PATCH 01/30] ACPICA: Linuxize: reduce divergences for
> 20160212
> > > release
> > >
> > > On Thu, 2016-03-24 at 09:38 +0800, Lv Zheng wrote:
> > > >
> > > > The patch reduces source code differences between the Linux kernel and
> the
> > > > ACPICA upstream so that the linuxized ACPICA 20160212 release can be
> > > > applied with reduced human intervention.
> > > In the very first patch fragment:
> > > > diff --git a/drivers/acpi/acpica/hwregs.c b/drivers/acpi/acpica/hwregs.c
> > > []
> > > > @@ -152,7 +152,7 @@ acpi_hw_validate_register(struct
> > > acpi_generic_address *reg,
> []
> > > > -acpi_status acpi_hw_read(u32 *value, struct acpi_generic_address *reg)
> > > > +acpi_status acpi_hw_read(u32 *value, struct acpi_generic_address * reg)
> > > The second argument * style appears the opposite of normal style
> > > and a different style than the first argument * style.
> > [Lv Zheng]
> > The file is drivers/acpi/acpica/hwregs.c, which is coming from ACPICA
> upstream.
> > So this is a result of "ACPICA release".
> > In other words, this is a result of a "process".
> > In order to fix this, things need to be done in "ACPICA release scripts".
> > Which should be done in
> https://github.com/acpica/acpica/blob/master/generate/linux/libacpica.sh.
> > Otherwise, "ACPICA release" process will require human intervention.
> >
> > So please leave this patch fragment as is.
> > It will be automatically fixed if the "ACPICA release" process is fixed.
> > And if you don't leave this fragment as is, the "ACPICA release" process will
> get hurt.
> []
> > please ignore "process" issues.
> > I need them to be wrong in order not to modify every "process" generated
> patches manually.
>
> So why not fix the process script first?
>
> Maybe add something like:
>
> $ grep -E "^typedef\s+\w+\s*\*?\s*acpi_\w+" include/acpi/actypes.h | \
> grep -Eoh "\bacpi_\w+"
>
> to the acpi_types variable in the lindent_single function
[Lv Zheng]
I don't think this can work given:
1. we are not only dealing with typedefs, but structs, struct xxx will be converted into types during the release process.
2. we have only upper cased type names in ACPICA upstream, but have the lower cased type names in Linux, and this doesn't solve that.
So I guess you didn't test your idea.

You need to pull ACPICA repo and do the followings to confirm if this is working:
A. generate the diff
# git clone <acpica repo>
# git commit your change
# ./generate/linux/gen-patch.pl HEAD
You can confirm how big a change will be resulted by your idea.
And you can confirm if the change can really solve this issue.

B. apply the diff
Then you can try to apply the linuxized patch to the linux repo to see how many jobs are still needed.
Then you should be able to determine if this is worthy to happen during a release cycle...

That's why I agree we need to solve this, but don't agree to solve this during a release cycle.

Thanks
-Lv

>
> > You can find many such kind of indent issues in drivers/acpi/acpica,
> include/acpi, tools/power/acpi.
> > They are there for good reasons.
> > I'll cleanup such issues from "ACPICA release" process.
>
> Any idea when?
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html

2016-03-28 03:03:33

by Zheng, Lv

[permalink] [raw]
Subject: RE: [PATCH 00/30] ACPICA: 20160318 Release

Hi,

> From: [email protected] [mailto:[email protected]] On Behalf Of
> Rafael J. Wysocki
> Subject: Re: [PATCH 00/30] ACPICA: 20160318 Release
>
> On Thu, Mar 24, 2016 at 2:38 AM, Lv Zheng <[email protected]> wrote:
> > The 20160318 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 + allyes
> > 2. i386 + allno
> > 3. i386 + default + ACPI_DEBUGGER=y
> > 4. i386 + default + ACPI_DEBUGGER=n + ACPI_DEBUG=y
> > 5. i386 + default + ACPI_DEBUG=n + ACPI=y
> > 6. i386 + default + ACPI=n
> > 7. x86_64 + allyes
> > 8. x86_64 + allno
> > 9. x86_64 + default + ACPI_DEBUGGER=y
> > 10.x86_64 + default + ACPI_DEBUGGER=n + ACPI_DEBUG=y
> > 11.x86_64 + default + ACPI_DEBUG=n + ACPI=y
> > 12.x86_64 + default + ACPI=n
> > Boot tests are performed as follows:
> > 1. i386 + default + ACPI_DEBUGGER=y
> > 2. x86_64 + default + ACPI_DEBUGGER=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 "drivers/platform" drivers
> > All other drivers that link the APIs provided by ACPICA subsystem
> >
> > The divergences checking result:
> > Before applying (20160212 Release):
> > 506 lines
> > After applying (20160318 Release):
> > 494 lines
> >
> > Al Stone (1):
> > ACPICA: IORT: Add in support for the SMMUv3 subtable
> >
> > Aleksey Makarov (1):
> > ACPICA: Headers: Add new constants for the DBG2 ACPI table
> >
> > Bob Moore (16):
> > ACPICA: Headers: Minor update for SPCR ACPI table
> > ACPICA: ACPI 6.1: Updates for the HEST ACPI table
> > ACPICA: ACPI 6.1: Update NFIT table for additional new fields
> > ACPICA: Headers: Update DMAR table for October 2014 I/O spec
> > ACPICA: Tables: Update FADT handling
> > ACPICA: ACPI 6.1: Add full support for this version of ACPI spec
> > ACPICA: iASL/Headers: Fix incorrect definition of FPDT table
> > ACPICA: Intepreter: Add object extensions to Concatenate operand
> > ACPICA: Interpreter: Update some function headers, no functional
> > change
> > ACPICA: iASL: Cleanup/optimization for ToPLD macro support
> > ACPICA: Cleanup some invocation indentations, no functional change
> > ACPICA: Headers: Update generation of the ACPICA library
> > ACPICA: Utilities: Update for strtoul64 merger
> > ACPICA: All: const keyword changes across the ACPICA source
> > ACPICA: iASL/Disassembler: Improve handling of unresolved methods
> > ACPICA: Update version to 20160318
> >
> > Lv Zheng (11):
> > ACPICA: Linuxize: reduce divergences for 20160212 release
> > ACPICA: Linuxize: Remove useless platform headers
> > ACPICA: Utilities: Add ACPI_IS_POWER_OF_TWO()
> > Utilities: Fix missing parentheses in ACPI_GET_BITS()/ACPI_SET_BITS()
> > ACPICA: Hardware: Enhance acpi_hw_validate_register() with
> > access_width/bit_offset awareness
> > ACPICA: Hardware: Add access_width/bit_offset support in
> > acpi_hw_read()
> > ACPICA: Hardware: Add access_width/bit_offset support for
> > acpi_hw_write()
> > ACPICA: Interpreter: Fix wrong conditions for
> > acpi_ev_install_region_handlers() invocation
> > ACPICA: Tables: Fix wrong MLC condition for dynamic table loading
> > ACPICA: Events: Fix an issue that _REG association can happen before
> > namespace is initialized
> > ACPICA: Namespace: Reorder \_SB._INI to make sure it is evaluated
> > before _REG evaluations
> >
> > Will Miles (1):
> > ACPICA: Add support for QNX 6.6 platform
>
> This is too late to go in during the current merge window, but I'll
> queue it up and send a separate pull request for 4.6 with it next
> week.
>
> I'll fix up the whitespace breakage in the first patch (it is easy
> enough to fix up manually), but as Len said, please fix the process to
> avoid such things in the future.
[Lv Zheng]
OK, I'll try to solve this as early as possible from ACPICA upstream.

Thanks and best regards
-Lv

2016-03-28 03:15:59

by Joe Perches

[permalink] [raw]
Subject: Re: [PATCH 01/30] ACPICA: Linuxize: reduce divergences for 20160212 release

On Mon, 2016-03-28 at 03:02 +0000, Zheng, Lv wrote:
> Hi,

Hello.

> > So why not fix the process script first?
> > Maybe add something like:
> > $ grep -E "^typedef\s+\w+\s*\*?\s*acpi_\w+" include/acpi/actypes.h | \
> > ? grep -Eoh "\bacpi_\w+"
> >
> > to the acpi_types variable in the lindent_single function
> [Lv Zheng]?
> I don't think this can work given:
> 1. we are not only dealing with typedefs, but structs, struct xxx will be converted into types during the release process.
> 2. we have only upper cased type names in ACPICA upstream, but have the lower cased type names in Linux, and this doesn't solve that.
> So I guess you didn't test your idea.

Good guess.

The "maybe add something like" should give you a clue.

> You need to pull ACPICA repo and do the followings to confirm if this is working:

No, I disagree. ?_I_ don't need to. ?You need to.

You shouldn't have a process that generates defective patches
and then sends them to the list.

cheers, Joe

2016-03-29 05:37:23

by Zheng, Lv

[permalink] [raw]
Subject: RE: [PATCH 01/30] ACPICA: Linuxize: reduce divergences for 20160212 release

Hi,

> From: Joe Perches [mailto:[email protected]]
> Subject: Re: [PATCH 01/30] ACPICA: Linuxize: reduce divergences for 20160212
> release
>
> On Mon, 2016-03-28 at 03:02 +0000, Zheng, Lv wrote:
> > Hi,
>
> Hello.
>
> > > So why not fix the process script first?
> > > Maybe add something like:
> > > $ grep -E "^typedef\s+\w+\s*\*?\s*acpi_\w+" include/acpi/actypes.h | \
> > > ? grep -Eoh "\bacpi_\w+"
> > >
> > > to the acpi_types variable in the lindent_single function
> > [Lv Zheng]
> > I don't think this can work given:
> > 1. we are not only dealing with typedefs, but structs, struct xxx will be
> converted into types during the release process.
> > 2. we have only upper cased type names in ACPICA upstream, but have the
> lower cased type names in Linux, and this doesn't solve that.
> > So I guess you didn't test your idea.
>
> Good guess.
>
> The "maybe add something like" should give you a clue.
>
> > You need to pull ACPICA repo and do the followings to confirm if this is
> working:
>
> No, I disagree. ?_I_ don't need to. ?You need to.
[Lv Zheng]
Then you don't have to provide the solution as you are not the one executing the process.
I can fix it myself:
https://github.com/acpica/acpica/pull/129
It would be merged by the ACPICA upstream in the near future.

I'll show you the difficulties of "process" later.

>
> You shouldn't have a process that generates defective patches
> and then sends them to the list.
[Lv Zheng]
You are not the one executing this process, so you don't know what's happening here.

Actually the Linux repo should be synced to the state of the ACPICA repo.
The defective patch is used for "syncing repo state", not for "fixing indentation problem" or something else.
So if we merged a "process fixing commit" into ACPICA upstream, you'll still have to see such kind of defective patches before this commit because of the state synchronization requirement.

There have already been many such indentation conflicts between Linux and ACPICA.
My current rule on the existing unsynced Linux side code conflict is based on the "syncing repo state" purpose:
I'll ignore them as long as no new linuxized ACPICA commits complain merge conflicts.
But if I saw merge conflict to a new linuxized commit, I'll revert the Linux side code to the __wrong__ but synced state in a separate patch.
That's why you can see this commit.

As a conclusion, the defective patch is because of the purpose - syncing repo state.
Then why do I use a separate patch?

The separated defective patch is the only patch we need to maintain manually, and all other linuxized ACPICA results needn't be maintained manually.
So you can imagine that we can do the recursive development/testing in the ACPICA upstream again and again.
And the linuxizing result should always require no human intervention as long as they can appear after the defective patch.

I have several situations for you to know my work flow.
1. ACPICA release
If this is not separated, then I should merge part of the defective patch into the new linuxized ACPICA commit that generates the merge conflict.
This is a kind of so called "human intervention".
Then if a bug was found after the release testing work (may take several days) was done, I would have to linuxize the whole series again after fixing the bug from the ACPICA upstream.
This results in a redo of the "human intervention". And this kind of "human intervention" may spread to all commits after the fixed one.
Furthermore, the "human intervention" could happen again and again during the recursive release testing process.

There are similar cases:
2. Fast path ACPICA commits
We have something that can't be confirmed from ACPICA development environment, and they need to go Linux repo first.
Such kind of patch series also contain such a separated defective patch.
If this is not separated, then since the series need to be rebased again and again during the development process (because of bug fixing or Linux upstream sync).
Then the "human intervention" need to be performed again and again.

3. The "process fixing commit"
If this problem is fixed, I need the Linux side correction to happen only when this commit is about to enter linux repo.
Otherwise, all commits between the merge point of this commit and the current repo head need "human interventions".
Sometimes, these commits need to be linuxized and posted on the Bugzilla/community to have users to test them.
As the working kernel of the reporters or the developers are different, the "human interventions" have to be performed again and again for them.
And there will be many different versions of such kind of linuxized ACPICA patch series.
It's not convenient for everyone.

So you can sense, the workload of the "human intervention" depends on the following 2 facts:
1. How worse the "unsynced state" is in the current Linux repo, and this also depends on how big the linuxized "process fixing commit" will be.
2. The merge timing of the "process fixing commit" where the state should be synced and the merge timing of other unsynced commits that could happen before this synced point.

I cannot control the merge timing of the "process fixing commit" and the merge timing of other unsynced commits.
So I have to control the "unsynced state" otherwise my bandwidth will be easily filled up by the "human intervention" due to the uncontrollable "merge timings".
You can easily imagine that my every work minutes will be filled up with the "human intervention" if I cannot control the "unsynced state".
This is a kind of job for a machine, while you are forcing me to be a machine by simply saying: it's my business, not yours...
Is that worthy? Should I allocate more bandwidth to work on real issues rather than doing the "human intervention" with such a heavy load?

The above is a justification for why I was thinking I had already obtained the agreement or the forgiveness from Linux upstream to generate such kind of defective patch to make my life easier.

Thanks and best regards
-Lv

2016-03-29 05:56:45

by Joe Perches

[permalink] [raw]
Subject: Re: [PATCH 01/30] ACPICA: Linuxize: reduce divergences for 20160212 release

On Tue, 2016-03-29 at 05:37 +0000, Zheng, Lv wrote:
> Hi,

Hi again.
> > No, I disagree. ?_I_ don't need to. ?You need to.
> [Lv Zheng]?
> Then you don't have to provide the solution as you are not the one executing the process.
> I can fix it myself:
> https://github.com/acpica/acpica/pull/129?
> It would be merged by the ACPICA upstream in the near future.

Excellent, thank you.

For this:?https://github.com/acpica/acpica/pull/129/commits/b2294cae776f5a66a7697414b21949d307e6856f

Maybe you could use \w+ instead of?[_a-zA-Z0-9]+

> I'll show you the difficulties of "process" later.

ok, appreciate your time.

> > You shouldn't have a process that generates defective patches
> > and then sends them to the list.
> [Lv Zheng]?
> You are not the one executing this process, so you don't know what's happening here.

True.

> Actually the Linux repo should be synced to the state of the ACPICA repo.

That's more doubtful, but then again I don't maintain
ACPICA and you do.

cheers, Joe

2016-03-29 08:14:28

by Zheng, Lv

[permalink] [raw]
Subject: RE: [PATCH 24/30] ACPICA: Hardware: Add access_width/bit_offset support in acpi_hw_read()

Hi, Rafael

PATCH 24 and 25 are reported to have issues around mask generation:
https://bugs.acpica.org/show_bug.cgi?id=1270
Please drop them.
I'll re-send the 2 patches after the fix solution is determined.
Thanks in advance.

Best regards
-Lv

> From: Zheng, Lv
> Subject: [PATCH 24/30] ACPICA: Hardware: Add access_width/bit_offset
> support in acpi_hw_read()
>
> ACPICA commit 96ece052d4d073aae4f935f0ff0746646aea1174
> ACPICA commit 3d8583a054e410f2ea4d73b48986facad9cfc0d4
>
> This patch adds access_width/bit_offset support in acpi_hw_read().
> This also enables GAS definition where bit_width is not a power of
> two. Lv Zheng.
>
> Link: https://github.com/acpica/acpica/commit/96ece052
> Link: https://github.com/acpica/acpica/commit/3d8583a0
> Link: https://bugs.acpica.org/show_bug.cgi?id=1240
> Signed-off-by: Lv Zheng <[email protected]>
> Signed-off-by: Bob Moore <[email protected]>
> ---
> drivers/acpi/acpica/hwregs.c | 66 +++++++++++++++++++++++++++++++++---
> ------
> 1 file changed, 53 insertions(+), 13 deletions(-)
>
> diff --git a/drivers/acpi/acpica/hwregs.c b/drivers/acpi/acpica/hwregs.c
> index bc3f60a..12fed0c 100644
> --- a/drivers/acpi/acpica/hwregs.c
> +++ b/drivers/acpi/acpica/hwregs.c
> @@ -150,17 +150,19 @@ acpi_hw_validate_register(struct
> acpi_generic_address *reg,
> * 64-bit values is not needed.
> *
> * LIMITATIONS: <These limitations also apply to acpi_hw_write>
> - * bit_width must be exactly 8, 16, or 32.
> * space_ID must be system_memory or system_IO.
> - * bit_offset and access_width are currently ignored, as there has
> - * not been a need to implement these.
> *
>
> ****************************************************************
> **************/
>
> acpi_status acpi_hw_read(u32 *value, struct acpi_generic_address * reg)
> {
> u64 address;
> + u8 access_width;
> + u32 bit_width;
> + u8 bit_offset;
> u64 value64;
> + u32 value32;
> + u8 index;
> acpi_status status;
>
> ACPI_FUNCTION_NAME(hw_read);
> @@ -172,28 +174,66 @@ acpi_status acpi_hw_read(u32 *value, struct
> acpi_generic_address * reg)
> return (status);
> }
>
> - /* Initialize entire 32-bit return value to zero */
> -
> + /*
> + * Initialize entire 32-bit return value to zero, convert access_width
> + * into number of bits based
> + */
> *value = 0;
> + access_width = reg->access_width ? reg->access_width : 1;
> + access_width = 1 << (access_width + 2);
> + bit_width = reg->bit_offset + reg->bit_width;
> + bit_offset = reg->bit_offset;
>
> /*
> * Two address spaces supported: Memory or IO. PCI_Config is
> * not supported here because the GAS structure is insufficient
> */
> - if (reg->space_id == ACPI_ADR_SPACE_SYSTEM_MEMORY) {
> - status = acpi_os_read_memory((acpi_physical_address)
> - address, &value64, reg->bit_width);
> + index = 0;
> + while (bit_width) {
> + if (bit_offset > access_width) {
> + value32 = 0;
> + bit_offset -= access_width;
> + } else {
> + if (reg->space_id ==
> ACPI_ADR_SPACE_SYSTEM_MEMORY) {
> + status =
> +
> acpi_os_read_memory((acpi_physical_address)
> + address +
> + index *
> + ACPI_DIV_8
> + (access_width),
> + &value64,
> access_width);
> + value32 = (u32)value64;
> + } else { /* ACPI_ADR_SPACE_SYSTEM_IO, validated
> earlier */
> +
> + status = acpi_hw_read_port((acpi_io_address)
> + address +
> + index *
> + ACPI_DIV_8
> + (access_width),
> + &value32,
> + access_width);
> + }
> +
> + if (bit_offset) {
> + value32 &=
> ACPI_MASK_BITS_BELOW(bit_offset);
> + bit_offset = 0;
> + }
> + if (bit_width < access_width) {
> + value32 &=
> ACPI_MASK_BITS_ABOVE(bit_width);
> + }
> + }
>
> - *value = (u32)value64;
> - } else { /* ACPI_ADR_SPACE_SYSTEM_IO, validated earlier */
> + ACPI_SET_BITS(value, index * access_width,
> + (1 << access_width) - 1, value32);
>
> - status = acpi_hw_read_port((acpi_io_address)
> - address, value, reg->bit_width);
> + bit_width -=
> + bit_width > access_width ? access_width : bit_width;
> + index++;
> }
>
> ACPI_DEBUG_PRINT((ACPI_DB_IO,
> "Read: %8.8X width %2d from %8.8X%8.8X (%s)\n",
> - *value, reg->bit_width,
> ACPI_FORMAT_UINT64(address),
> + *value, access_width,
> ACPI_FORMAT_UINT64(address),
> acpi_ut_get_region_name(reg->space_id)));
>
> return (status);
> --
> 1.7.10