All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] ACPICA: Preparations of acpidump release automation.
@ 2014-02-11  2:51 ` Lv Zheng
  0 siblings, 0 replies; 10+ messages in thread
From: Lv Zheng @ 2014-02-11  2:51 UTC (permalink / raw)
  To: Rafael J. Wysocki, Len Brown; +Cc: Lv Zheng, Lv Zheng, linux-kernel, linux-acpi

This series includes required changes for acpidump release automation.

Since these commits actually are no-op for ACPICA and there are side
effects for Linux kernel after applying the linuxized ones, it is better to
post them in Linux community rather than in ACPICA community for review and
back port them to ACPICA upstream after merging them first into Linux.

Lv Zheng (2):
  ACPICA: acpidump: Add sparse declarators support.
  ACPICA: acpidump: Remove translation protection on integer types.

 include/acpi/actypes.h          |   64 +++++++++++++++++++--------------------
 include/acpi/platform/aclinux.h |   12 ++++++++
 2 files changed, 44 insertions(+), 32 deletions(-)

-- 
1.7.10


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

* [PATCH 0/2] ACPICA: Preparations of acpidump release automation.
@ 2014-02-11  2:51 ` Lv Zheng
  0 siblings, 0 replies; 10+ messages in thread
From: Lv Zheng @ 2014-02-11  2:51 UTC (permalink / raw)
  To: Rafael J. Wysocki, Len Brown; +Cc: Lv Zheng, Lv Zheng, linux-kernel, linux-acpi

This series includes required changes for acpidump release automation.

Since these commits actually are no-op for ACPICA and there are side
effects for Linux kernel after applying the linuxized ones, it is better to
post them in Linux community rather than in ACPICA community for review and
back port them to ACPICA upstream after merging them first into Linux.

Lv Zheng (2):
  ACPICA: acpidump: Add sparse declarators support.
  ACPICA: acpidump: Remove translation protection on integer types.

 include/acpi/actypes.h          |   64 +++++++++++++++++++--------------------
 include/acpi/platform/aclinux.h |   12 ++++++++
 2 files changed, 44 insertions(+), 32 deletions(-)

-- 
1.7.10


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

* [PATCH 1/2] ACPICA: acpidump: Add sparse declarators support.
  2014-02-11  2:51 ` Lv Zheng
@ 2014-02-11  2:51   ` Lv Zheng
  -1 siblings, 0 replies; 10+ messages in thread
From: Lv Zheng @ 2014-02-11  2:51 UTC (permalink / raw)
  To: Rafael J. Wysocki, Len Brown; +Cc: Lv Zheng, Lv Zheng, linux-kernel, linux-acpi

Linux kernel build is not affected by this commit.

Linux kernel resident ACPICA headers include some sparse declarators for
kernel static checkers.  This patch adds code to disable them for non
__KERNEL__ defined code so that it is possible for the ACPICA user space
tool's source files to be built with Linux kernel ACPICA header files
included.  Lv Zheng.

Signed-off-by: Lv Zheng <lv.zheng@intel.com>
---
 include/acpi/platform/aclinux.h |   10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/include/acpi/platform/aclinux.h b/include/acpi/platform/aclinux.h
index 30c9a7c..f41f59b 100644
--- a/include/acpi/platform/aclinux.h
+++ b/include/acpi/platform/aclinux.h
@@ -89,6 +89,16 @@
 #include <ctype.h>
 #include <unistd.h>
 
+/* Disable kernel specific declarators */
+
+#ifndef __init
+#define __init
+#endif
+
+#ifndef __iomem
+#define __iomem
+#endif
+
 /* Host-dependent types and defines for user-space ACPICA */
 
 #define ACPI_FLUSH_CPU_CACHE()
-- 
1.7.10


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

* [PATCH 1/2] ACPICA: acpidump: Add sparse declarators support.
@ 2014-02-11  2:51   ` Lv Zheng
  0 siblings, 0 replies; 10+ messages in thread
From: Lv Zheng @ 2014-02-11  2:51 UTC (permalink / raw)
  To: Rafael J. Wysocki, Len Brown; +Cc: Lv Zheng, Lv Zheng, linux-kernel, linux-acpi

Linux kernel build is not affected by this commit.

Linux kernel resident ACPICA headers include some sparse declarators for
kernel static checkers.  This patch adds code to disable them for non
__KERNEL__ defined code so that it is possible for the ACPICA user space
tool's source files to be built with Linux kernel ACPICA header files
included.  Lv Zheng.

Signed-off-by: Lv Zheng <lv.zheng@intel.com>
---
 include/acpi/platform/aclinux.h |   10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/include/acpi/platform/aclinux.h b/include/acpi/platform/aclinux.h
index 30c9a7c..f41f59b 100644
--- a/include/acpi/platform/aclinux.h
+++ b/include/acpi/platform/aclinux.h
@@ -89,6 +89,16 @@
 #include <ctype.h>
 #include <unistd.h>
 
+/* Disable kernel specific declarators */
+
+#ifndef __init
+#define __init
+#endif
+
+#ifndef __iomem
+#define __iomem
+#endif
+
 /* Host-dependent types and defines for user-space ACPICA */
 
 #define ACPI_FLUSH_CPU_CACHE()
-- 
1.7.10


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

* [PATCH 2/2] ACPICA: acpidump: Remove translation protection on integer types.
  2014-02-11  2:51 ` Lv Zheng
@ 2014-02-11  2:51   ` Lv Zheng
  -1 siblings, 0 replies; 10+ messages in thread
From: Lv Zheng @ 2014-02-11  2:51 UTC (permalink / raw)
  To: Rafael J. Wysocki, Len Brown
  Cc: Lv Zheng, Lv Zheng, linux-kernel, linux-acpi, Tony Luck, Fenghua Yu

Remove translation protection for applications as Linux tools folder will
start to use such types.

In Linux kernel source tree, after removing this translation protection,
the u8/u16/u32/u64/s32/s64 typedefs are exposed for both __KERNEL__ builds
and !__KERNEL__ builds (tools/power/acpi) and the original definitions of
ACPI_UINT8/16/32/64_MAX are changed.

For !__KERNEL__ builds, this kind of defintions should already been tested
by the distribution vendors that are distributing binary ACPICA package and
we've achieved the successful built/run test result in the kernel source
tree.

For __KERNEL__ builds, there are 2 things affected:
1. u8/u16/u32/u64/s32/s64 type definitions:
   Since Linux has already type defined u8/u16/u32/u64/s32/s64 in
   include/uapi/asm-generic/int-ll64.h for __KERNEL__.  In order not to
   introduce build regressions where the 2 typedefs are differed,
   ACPI_USE_SYSTEM_INTTYPES is introduced to mask out ACPICA's typedefs.
   It must be defined for Linux __KERNEL__ builds.
2. ACPI_UINT8/16/32/64_MAX definitions:
   Before applying this change:
     ACPI_UINT8_MAX: sizeof (UINT8)
      UINT8: unsigned char
     ACPI_UINT16_MAX: sizeof (UINT16)
      UINT16: unsigned short
     ACPI_UINT32_MAX: sizeof (UINT32)
      INT32: int
      UINT32: unsigned int
     ACPI_UINT64_MAX: sizeof (UINT64)
      INT64: COMPILER_DEPENDENT_INT64
       COMPILER_DEPENDENT_INT64: signed long (IA64) or
                                 signed long long (IA32)
      UINT64: COMPILER_DEPENDENT_UINT64
       COMPILER_DEPENDENT_UINT64: unsigned long (IA64) or
                                  unsigned long long (IA32)
   After applying this change:
     ACPI_UINT8_MAX: sizeof (u8)
      u8: unsigned char
      UINT8: (removed from actypes.h)
     ACPI_UINT16_MAX: sizeof (u16)
      u16: unsigned short
      UINT16: (removed from actypes.h)
     ACPI_UINT32_MAX: sizeof (u32)
      INT32/UINT32: (removed from actypes.h)
      s32: signed int
      u32: unsigned int
     ACPI_UINT64_MAX: sizeof (u64)
      INT64/UINT64: (removed from actypes.h)
      u64: unsigned long long
      s64: signed long long
      COMPILER_DEPENDENT_INT64: signed long (IA64) (not used any more)
                                signed long long (IA32) (not used any more)
      COMPILER_DEPENDENT_UINT64: unsigned long (IA64) (not used any more)
                                 unsigned long long (IA32) (not used any more)
   All definitions are equal except ACPI_UINT64_MAX for CONFIG_IA64.  It
   is changed from sizeof(unsigned long) to sizeof(unsigned long long).
   By investigation, 64bit Linux kernel build is LP64 compliant, i.e.,
   sizeof(long) and (pointer) are 64.  As sizeof(unsigned long) equals to
   sizeof(unsigned long long) on IA64 platform where CONFIG_64BIT cannot be
   disabled, this change actually will not affect the value of
   ACPI_UINT64_MAX on IA64 platforms.

This patch is generated as linuxized acpidump is failed to be compiled due
to lacking in u8/u16/u32/u64/s32/s64 definitions.  Lv Zheng.

Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Cc: Tony Luck <tony.luck@intel.com>
Cc: Fenghua Yu <fenghua.yu@intel.com>
---
 include/acpi/actypes.h          |   64 +++++++++++++++++++--------------------
 include/acpi/platform/aclinux.h |    2 ++
 2 files changed, 34 insertions(+), 32 deletions(-)

diff --git a/include/acpi/actypes.h b/include/acpi/actypes.h
index 68a3ada..86e9f13 100644
--- a/include/acpi/actypes.h
+++ b/include/acpi/actypes.h
@@ -55,18 +55,16 @@
 #error ACPI_MACHINE_WIDTH not defined
 #endif
 
-/*! [Begin] no source code translation */
-
 /*
  * Data type ranges
  * Note: These macros are designed to be compiler independent as well as
  * working around problems that some 32-bit compilers have with 64-bit
  * constants.
  */
-#define ACPI_UINT8_MAX                  (UINT8) (~((UINT8)  0))	/* 0xFF               */
-#define ACPI_UINT16_MAX                 (UINT16)(~((UINT16) 0))	/* 0xFFFF             */
-#define ACPI_UINT32_MAX                 (UINT32)(~((UINT32) 0))	/* 0xFFFFFFFF         */
-#define ACPI_UINT64_MAX                 (UINT64)(~((UINT64) 0))	/* 0xFFFFFFFFFFFFFFFF */
+#define ACPI_UINT8_MAX                  (u8) (~((u8)  0))	/* 0xFF               */
+#define ACPI_UINT16_MAX                 (u16)(~((u16) 0))	/* 0xFFFF             */
+#define ACPI_UINT32_MAX                 (u32)(~((u32) 0))	/* 0xFFFFFFFF         */
+#define ACPI_UINT64_MAX                 (u64)(~((u64) 0))	/* 0xFFFFFFFFFFFFFFFF */
 #define ACPI_ASCII_MAX                  0x7F
 
 /*
@@ -77,18 +75,18 @@
  *
  * 1) The following types are of fixed size for all targets (16/32/64):
  *
- * BOOLEAN      Logical boolean
+ * u8           Logical boolean
  *
- * UINT8        8-bit  (1 byte) unsigned value
- * UINT16       16-bit (2 byte) unsigned value
- * UINT32       32-bit (4 byte) unsigned value
- * UINT64       64-bit (8 byte) unsigned value
+ * u8           8-bit  (1 byte) unsigned value
+ * u16          16-bit (2 byte) unsigned value
+ * u32          32-bit (4 byte) unsigned value
+ * u64          64-bit (8 byte) unsigned value
  *
- * INT16        16-bit (2 byte) signed value
- * INT32        32-bit (4 byte) signed value
- * INT64        64-bit (8 byte) signed value
+ * s16          16-bit (2 byte) signed value
+ * s32          32-bit (4 byte) signed value
+ * s64          64-bit (8 byte) signed value
  *
- * COMPILER_DEPENDENT_UINT64/INT64 - These types are defined in the
+ * COMPILER_DEPENDENT_UINT64/s64 - These types are defined in the
  * compiler-dependent header(s) and were introduced because there is no common
  * 64-bit integer type across the various compilation models, as shown in
  * the table below.
@@ -110,11 +108,11 @@
  * usually used for memory allocation, efficient loop counters, and array
  * indexes. The types are similar to the size_t type in the C library and are
  * required because there is no C type that consistently represents the native
- * data width. ACPI_SIZE is needed because there is no guarantee that a
+ * data width. acpi_size is needed because there is no guarantee that a
  * kernel-level C library is present.
  *
- * ACPI_SIZE        16/32/64-bit unsigned value
- * ACPI_NATIVE_INT  16/32/64-bit signed value
+ * acpi_size        16/32/64-bit unsigned value
+ * acpi_native_int  16/32/64-bit signed value
  */
 
 /*******************************************************************************
@@ -123,13 +121,15 @@
  *
  ******************************************************************************/
 
-typedef unsigned char BOOLEAN;
-typedef unsigned char UINT8;
-typedef unsigned short UINT16;
-typedef COMPILER_DEPENDENT_UINT64 UINT64;
-typedef COMPILER_DEPENDENT_INT64 INT64;
+#ifndef ACPI_USE_SYSTEM_INTTYPES
+
+typedef unsigned char u8;
+typedef unsigned char u8;
+typedef unsigned short u16;
+typedef COMPILER_DEPENDENT_UINT64 u64;
+typedef COMPILER_DEPENDENT_INT64 s64;
 
-/*! [End] no source code translation !*/
+#endif				/* ACPI_USE_SYSTEM_INTTYPES */
 
 /*
  * Value returned by acpi_os_get_thread_id. There is no standard "thread_id"
@@ -149,12 +149,12 @@ typedef COMPILER_DEPENDENT_INT64 INT64;
 
 #if ACPI_MACHINE_WIDTH == 64
 
-/*! [Begin] no source code translation (keep the typedefs as-is) */
+#ifndef ACPI_USE_SYSTEM_INTTYPES
 
-typedef unsigned int UINT32;
-typedef int INT32;
+typedef unsigned int u32;
+typedef int s32;
 
-/*! [End] no source code translation !*/
+#endif				/* ACPI_USE_SYSTEM_INTTYPES */
 
 typedef s64 acpi_native_int;
 
@@ -188,12 +188,12 @@ typedef u64 acpi_physical_address;
 
 #elif ACPI_MACHINE_WIDTH == 32
 
-/*! [Begin] no source code translation (keep the typedefs as-is) */
+#ifndef ACPI_USE_SYSTEM_INTTYPES
 
-typedef unsigned int UINT32;
-typedef int INT32;
+typedef unsigned int u32;
+typedef int s32;
 
-/*! [End] no source code translation !*/
+#endif				/* ACPI_USE_SYSTEM_INTTYPES */
 
 typedef s32 acpi_native_int;
 
diff --git a/include/acpi/platform/aclinux.h b/include/acpi/platform/aclinux.h
index f41f59b..a24c8f0 100644
--- a/include/acpi/platform/aclinux.h
+++ b/include/acpi/platform/aclinux.h
@@ -58,6 +58,8 @@
 #define ACPI_REDUCED_HARDWARE 1
 #endif
 
+#define ACPI_USE_SYSTEM_INTTYPES
+
 #include <linux/string.h>
 #include <linux/kernel.h>
 #include <linux/ctype.h>
-- 
1.7.10


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

* [PATCH 2/2] ACPICA: acpidump: Remove translation protection on integer types.
@ 2014-02-11  2:51   ` Lv Zheng
  0 siblings, 0 replies; 10+ messages in thread
From: Lv Zheng @ 2014-02-11  2:51 UTC (permalink / raw)
  To: Rafael J. Wysocki, Len Brown
  Cc: Lv Zheng, Lv Zheng, linux-kernel, linux-acpi, Tony Luck, Fenghua Yu

Remove translation protection for applications as Linux tools folder will
start to use such types.

In Linux kernel source tree, after removing this translation protection,
the u8/u16/u32/u64/s32/s64 typedefs are exposed for both __KERNEL__ builds
and !__KERNEL__ builds (tools/power/acpi) and the original definitions of
ACPI_UINT8/16/32/64_MAX are changed.

For !__KERNEL__ builds, this kind of defintions should already been tested
by the distribution vendors that are distributing binary ACPICA package and
we've achieved the successful built/run test result in the kernel source
tree.

For __KERNEL__ builds, there are 2 things affected:
1. u8/u16/u32/u64/s32/s64 type definitions:
   Since Linux has already type defined u8/u16/u32/u64/s32/s64 in
   include/uapi/asm-generic/int-ll64.h for __KERNEL__.  In order not to
   introduce build regressions where the 2 typedefs are differed,
   ACPI_USE_SYSTEM_INTTYPES is introduced to mask out ACPICA's typedefs.
   It must be defined for Linux __KERNEL__ builds.
2. ACPI_UINT8/16/32/64_MAX definitions:
   Before applying this change:
     ACPI_UINT8_MAX: sizeof (UINT8)
      UINT8: unsigned char
     ACPI_UINT16_MAX: sizeof (UINT16)
      UINT16: unsigned short
     ACPI_UINT32_MAX: sizeof (UINT32)
      INT32: int
      UINT32: unsigned int
     ACPI_UINT64_MAX: sizeof (UINT64)
      INT64: COMPILER_DEPENDENT_INT64
       COMPILER_DEPENDENT_INT64: signed long (IA64) or
                                 signed long long (IA32)
      UINT64: COMPILER_DEPENDENT_UINT64
       COMPILER_DEPENDENT_UINT64: unsigned long (IA64) or
                                  unsigned long long (IA32)
   After applying this change:
     ACPI_UINT8_MAX: sizeof (u8)
      u8: unsigned char
      UINT8: (removed from actypes.h)
     ACPI_UINT16_MAX: sizeof (u16)
      u16: unsigned short
      UINT16: (removed from actypes.h)
     ACPI_UINT32_MAX: sizeof (u32)
      INT32/UINT32: (removed from actypes.h)
      s32: signed int
      u32: unsigned int
     ACPI_UINT64_MAX: sizeof (u64)
      INT64/UINT64: (removed from actypes.h)
      u64: unsigned long long
      s64: signed long long
      COMPILER_DEPENDENT_INT64: signed long (IA64) (not used any more)
                                signed long long (IA32) (not used any more)
      COMPILER_DEPENDENT_UINT64: unsigned long (IA64) (not used any more)
                                 unsigned long long (IA32) (not used any more)
   All definitions are equal except ACPI_UINT64_MAX for CONFIG_IA64.  It
   is changed from sizeof(unsigned long) to sizeof(unsigned long long).
   By investigation, 64bit Linux kernel build is LP64 compliant, i.e.,
   sizeof(long) and (pointer) are 64.  As sizeof(unsigned long) equals to
   sizeof(unsigned long long) on IA64 platform where CONFIG_64BIT cannot be
   disabled, this change actually will not affect the value of
   ACPI_UINT64_MAX on IA64 platforms.

This patch is generated as linuxized acpidump is failed to be compiled due
to lacking in u8/u16/u32/u64/s32/s64 definitions.  Lv Zheng.

Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Cc: Tony Luck <tony.luck@intel.com>
Cc: Fenghua Yu <fenghua.yu@intel.com>
---
 include/acpi/actypes.h          |   64 +++++++++++++++++++--------------------
 include/acpi/platform/aclinux.h |    2 ++
 2 files changed, 34 insertions(+), 32 deletions(-)

diff --git a/include/acpi/actypes.h b/include/acpi/actypes.h
index 68a3ada..86e9f13 100644
--- a/include/acpi/actypes.h
+++ b/include/acpi/actypes.h
@@ -55,18 +55,16 @@
 #error ACPI_MACHINE_WIDTH not defined
 #endif
 
-/*! [Begin] no source code translation */
-
 /*
  * Data type ranges
  * Note: These macros are designed to be compiler independent as well as
  * working around problems that some 32-bit compilers have with 64-bit
  * constants.
  */
-#define ACPI_UINT8_MAX                  (UINT8) (~((UINT8)  0))	/* 0xFF               */
-#define ACPI_UINT16_MAX                 (UINT16)(~((UINT16) 0))	/* 0xFFFF             */
-#define ACPI_UINT32_MAX                 (UINT32)(~((UINT32) 0))	/* 0xFFFFFFFF         */
-#define ACPI_UINT64_MAX                 (UINT64)(~((UINT64) 0))	/* 0xFFFFFFFFFFFFFFFF */
+#define ACPI_UINT8_MAX                  (u8) (~((u8)  0))	/* 0xFF               */
+#define ACPI_UINT16_MAX                 (u16)(~((u16) 0))	/* 0xFFFF             */
+#define ACPI_UINT32_MAX                 (u32)(~((u32) 0))	/* 0xFFFFFFFF         */
+#define ACPI_UINT64_MAX                 (u64)(~((u64) 0))	/* 0xFFFFFFFFFFFFFFFF */
 #define ACPI_ASCII_MAX                  0x7F
 
 /*
@@ -77,18 +75,18 @@
  *
  * 1) The following types are of fixed size for all targets (16/32/64):
  *
- * BOOLEAN      Logical boolean
+ * u8           Logical boolean
  *
- * UINT8        8-bit  (1 byte) unsigned value
- * UINT16       16-bit (2 byte) unsigned value
- * UINT32       32-bit (4 byte) unsigned value
- * UINT64       64-bit (8 byte) unsigned value
+ * u8           8-bit  (1 byte) unsigned value
+ * u16          16-bit (2 byte) unsigned value
+ * u32          32-bit (4 byte) unsigned value
+ * u64          64-bit (8 byte) unsigned value
  *
- * INT16        16-bit (2 byte) signed value
- * INT32        32-bit (4 byte) signed value
- * INT64        64-bit (8 byte) signed value
+ * s16          16-bit (2 byte) signed value
+ * s32          32-bit (4 byte) signed value
+ * s64          64-bit (8 byte) signed value
  *
- * COMPILER_DEPENDENT_UINT64/INT64 - These types are defined in the
+ * COMPILER_DEPENDENT_UINT64/s64 - These types are defined in the
  * compiler-dependent header(s) and were introduced because there is no common
  * 64-bit integer type across the various compilation models, as shown in
  * the table below.
@@ -110,11 +108,11 @@
  * usually used for memory allocation, efficient loop counters, and array
  * indexes. The types are similar to the size_t type in the C library and are
  * required because there is no C type that consistently represents the native
- * data width. ACPI_SIZE is needed because there is no guarantee that a
+ * data width. acpi_size is needed because there is no guarantee that a
  * kernel-level C library is present.
  *
- * ACPI_SIZE        16/32/64-bit unsigned value
- * ACPI_NATIVE_INT  16/32/64-bit signed value
+ * acpi_size        16/32/64-bit unsigned value
+ * acpi_native_int  16/32/64-bit signed value
  */
 
 /*******************************************************************************
@@ -123,13 +121,15 @@
  *
  ******************************************************************************/
 
-typedef unsigned char BOOLEAN;
-typedef unsigned char UINT8;
-typedef unsigned short UINT16;
-typedef COMPILER_DEPENDENT_UINT64 UINT64;
-typedef COMPILER_DEPENDENT_INT64 INT64;
+#ifndef ACPI_USE_SYSTEM_INTTYPES
+
+typedef unsigned char u8;
+typedef unsigned char u8;
+typedef unsigned short u16;
+typedef COMPILER_DEPENDENT_UINT64 u64;
+typedef COMPILER_DEPENDENT_INT64 s64;
 
-/*! [End] no source code translation !*/
+#endif				/* ACPI_USE_SYSTEM_INTTYPES */
 
 /*
  * Value returned by acpi_os_get_thread_id. There is no standard "thread_id"
@@ -149,12 +149,12 @@ typedef COMPILER_DEPENDENT_INT64 INT64;
 
 #if ACPI_MACHINE_WIDTH == 64
 
-/*! [Begin] no source code translation (keep the typedefs as-is) */
+#ifndef ACPI_USE_SYSTEM_INTTYPES
 
-typedef unsigned int UINT32;
-typedef int INT32;
+typedef unsigned int u32;
+typedef int s32;
 
-/*! [End] no source code translation !*/
+#endif				/* ACPI_USE_SYSTEM_INTTYPES */
 
 typedef s64 acpi_native_int;
 
@@ -188,12 +188,12 @@ typedef u64 acpi_physical_address;
 
 #elif ACPI_MACHINE_WIDTH == 32
 
-/*! [Begin] no source code translation (keep the typedefs as-is) */
+#ifndef ACPI_USE_SYSTEM_INTTYPES
 
-typedef unsigned int UINT32;
-typedef int INT32;
+typedef unsigned int u32;
+typedef int s32;
 
-/*! [End] no source code translation !*/
+#endif				/* ACPI_USE_SYSTEM_INTTYPES */
 
 typedef s32 acpi_native_int;
 
diff --git a/include/acpi/platform/aclinux.h b/include/acpi/platform/aclinux.h
index f41f59b..a24c8f0 100644
--- a/include/acpi/platform/aclinux.h
+++ b/include/acpi/platform/aclinux.h
@@ -58,6 +58,8 @@
 #define ACPI_REDUCED_HARDWARE 1
 #endif
 
+#define ACPI_USE_SYSTEM_INTTYPES
+
 #include <linux/string.h>
 #include <linux/kernel.h>
 #include <linux/ctype.h>
-- 
1.7.10


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

* RE: [PATCH 2/2] ACPICA: acpidump: Remove translation protection on integer types.
  2014-02-11  2:51   ` Lv Zheng
  (?)
@ 2014-02-13  2:44   ` Zheng, Lv
  2014-02-13 23:34     ` Luck, Tony
  -1 siblings, 1 reply; 10+ messages in thread
From: Zheng, Lv @ 2014-02-13  2:44 UTC (permalink / raw)
  To: Wysocki, Rafael J, Brown, Len
  Cc: Lv Zheng, linux-kernel, linux-acpi, Luck, Tony, Yu, Fenghua

Hi, Tony and Fenghua

I need your opinions on this patch?
Will it affect the functionality of IA64 kernel behavior?
Can you help to confirm?

Thanks in advance.

Best regards
-Lv


> -----Original Message-----
> From: Zheng, Lv
> Sent: Tuesday, February 11, 2014 10:52 AM
> To: Wysocki, Rafael J; Brown, Len
> Cc: Zheng, Lv; Lv Zheng; linux-kernel@vger.kernel.org; linux-acpi@vger.kernel.org; Luck, Tony; Yu, Fenghua
> Subject: [PATCH 2/2] ACPICA: acpidump: Remove translation protection on integer types.
> 
> Remove translation protection for applications as Linux tools folder will
> start to use such types.
> 
> In Linux kernel source tree, after removing this translation protection,
> the u8/u16/u32/u64/s32/s64 typedefs are exposed for both __KERNEL__ builds
> and !__KERNEL__ builds (tools/power/acpi) and the original definitions of
> ACPI_UINT8/16/32/64_MAX are changed.
> 
> For !__KERNEL__ builds, this kind of defintions should already been tested
> by the distribution vendors that are distributing binary ACPICA package and
> we've achieved the successful built/run test result in the kernel source
> tree.
> 
> For __KERNEL__ builds, there are 2 things affected:
> 1. u8/u16/u32/u64/s32/s64 type definitions:
>    Since Linux has already type defined u8/u16/u32/u64/s32/s64 in
>    include/uapi/asm-generic/int-ll64.h for __KERNEL__.  In order not to
>    introduce build regressions where the 2 typedefs are differed,
>    ACPI_USE_SYSTEM_INTTYPES is introduced to mask out ACPICA's typedefs.
>    It must be defined for Linux __KERNEL__ builds.
> 2. ACPI_UINT8/16/32/64_MAX definitions:
>    Before applying this change:
>      ACPI_UINT8_MAX: sizeof (UINT8)
>       UINT8: unsigned char
>      ACPI_UINT16_MAX: sizeof (UINT16)
>       UINT16: unsigned short
>      ACPI_UINT32_MAX: sizeof (UINT32)
>       INT32: int
>       UINT32: unsigned int
>      ACPI_UINT64_MAX: sizeof (UINT64)
>       INT64: COMPILER_DEPENDENT_INT64
>        COMPILER_DEPENDENT_INT64: signed long (IA64) or
>                                  signed long long (IA32)
>       UINT64: COMPILER_DEPENDENT_UINT64
>        COMPILER_DEPENDENT_UINT64: unsigned long (IA64) or
>                                   unsigned long long (IA32)
>    After applying this change:
>      ACPI_UINT8_MAX: sizeof (u8)
>       u8: unsigned char
>       UINT8: (removed from actypes.h)
>      ACPI_UINT16_MAX: sizeof (u16)
>       u16: unsigned short
>       UINT16: (removed from actypes.h)
>      ACPI_UINT32_MAX: sizeof (u32)
>       INT32/UINT32: (removed from actypes.h)
>       s32: signed int
>       u32: unsigned int
>      ACPI_UINT64_MAX: sizeof (u64)
>       INT64/UINT64: (removed from actypes.h)
>       u64: unsigned long long
>       s64: signed long long
>       COMPILER_DEPENDENT_INT64: signed long (IA64) (not used any more)
>                                 signed long long (IA32) (not used any more)
>       COMPILER_DEPENDENT_UINT64: unsigned long (IA64) (not used any more)
>                                  unsigned long long (IA32) (not used any more)
>    All definitions are equal except ACPI_UINT64_MAX for CONFIG_IA64.  It
>    is changed from sizeof(unsigned long) to sizeof(unsigned long long).
>    By investigation, 64bit Linux kernel build is LP64 compliant, i.e.,
>    sizeof(long) and (pointer) are 64.  As sizeof(unsigned long) equals to
>    sizeof(unsigned long long) on IA64 platform where CONFIG_64BIT cannot be
>    disabled, this change actually will not affect the value of
>    ACPI_UINT64_MAX on IA64 platforms.
> 
> This patch is generated as linuxized acpidump is failed to be compiled due
> to lacking in u8/u16/u32/u64/s32/s64 definitions.  Lv Zheng.
> 
> Signed-off-by: Lv Zheng <lv.zheng@intel.com>
> Cc: Tony Luck <tony.luck@intel.com>
> Cc: Fenghua Yu <fenghua.yu@intel.com>
> ---
>  include/acpi/actypes.h          |   64 +++++++++++++++++++--------------------
>  include/acpi/platform/aclinux.h |    2 ++
>  2 files changed, 34 insertions(+), 32 deletions(-)
> 
> diff --git a/include/acpi/actypes.h b/include/acpi/actypes.h
> index 68a3ada..86e9f13 100644
> --- a/include/acpi/actypes.h
> +++ b/include/acpi/actypes.h
> @@ -55,18 +55,16 @@
>  #error ACPI_MACHINE_WIDTH not defined
>  #endif
> 
> -/*! [Begin] no source code translation */
> -
>  /*
>   * Data type ranges
>   * Note: These macros are designed to be compiler independent as well as
>   * working around problems that some 32-bit compilers have with 64-bit
>   * constants.
>   */
> -#define ACPI_UINT8_MAX                  (UINT8) (~((UINT8)  0))	/* 0xFF               */
> -#define ACPI_UINT16_MAX                 (UINT16)(~((UINT16) 0))	/* 0xFFFF             */
> -#define ACPI_UINT32_MAX                 (UINT32)(~((UINT32) 0))	/* 0xFFFFFFFF         */
> -#define ACPI_UINT64_MAX                 (UINT64)(~((UINT64) 0))	/* 0xFFFFFFFFFFFFFFFF */
> +#define ACPI_UINT8_MAX                  (u8) (~((u8)  0))	/* 0xFF               */
> +#define ACPI_UINT16_MAX                 (u16)(~((u16) 0))	/* 0xFFFF             */
> +#define ACPI_UINT32_MAX                 (u32)(~((u32) 0))	/* 0xFFFFFFFF         */
> +#define ACPI_UINT64_MAX                 (u64)(~((u64) 0))	/* 0xFFFFFFFFFFFFFFFF */
>  #define ACPI_ASCII_MAX                  0x7F
> 
>  /*
> @@ -77,18 +75,18 @@
>   *
>   * 1) The following types are of fixed size for all targets (16/32/64):
>   *
> - * BOOLEAN      Logical boolean
> + * u8           Logical boolean
>   *
> - * UINT8        8-bit  (1 byte) unsigned value
> - * UINT16       16-bit (2 byte) unsigned value
> - * UINT32       32-bit (4 byte) unsigned value
> - * UINT64       64-bit (8 byte) unsigned value
> + * u8           8-bit  (1 byte) unsigned value
> + * u16          16-bit (2 byte) unsigned value
> + * u32          32-bit (4 byte) unsigned value
> + * u64          64-bit (8 byte) unsigned value
>   *
> - * INT16        16-bit (2 byte) signed value
> - * INT32        32-bit (4 byte) signed value
> - * INT64        64-bit (8 byte) signed value
> + * s16          16-bit (2 byte) signed value
> + * s32          32-bit (4 byte) signed value
> + * s64          64-bit (8 byte) signed value
>   *
> - * COMPILER_DEPENDENT_UINT64/INT64 - These types are defined in the
> + * COMPILER_DEPENDENT_UINT64/s64 - These types are defined in the
>   * compiler-dependent header(s) and were introduced because there is no common
>   * 64-bit integer type across the various compilation models, as shown in
>   * the table below.
> @@ -110,11 +108,11 @@
>   * usually used for memory allocation, efficient loop counters, and array
>   * indexes. The types are similar to the size_t type in the C library and are
>   * required because there is no C type that consistently represents the native
> - * data width. ACPI_SIZE is needed because there is no guarantee that a
> + * data width. acpi_size is needed because there is no guarantee that a
>   * kernel-level C library is present.
>   *
> - * ACPI_SIZE        16/32/64-bit unsigned value
> - * ACPI_NATIVE_INT  16/32/64-bit signed value
> + * acpi_size        16/32/64-bit unsigned value
> + * acpi_native_int  16/32/64-bit signed value
>   */
> 
>  /*******************************************************************************
> @@ -123,13 +121,15 @@
>   *
>   ******************************************************************************/
> 
> -typedef unsigned char BOOLEAN;
> -typedef unsigned char UINT8;
> -typedef unsigned short UINT16;
> -typedef COMPILER_DEPENDENT_UINT64 UINT64;
> -typedef COMPILER_DEPENDENT_INT64 INT64;
> +#ifndef ACPI_USE_SYSTEM_INTTYPES
> +
> +typedef unsigned char u8;
> +typedef unsigned char u8;
> +typedef unsigned short u16;
> +typedef COMPILER_DEPENDENT_UINT64 u64;
> +typedef COMPILER_DEPENDENT_INT64 s64;
> 
> -/*! [End] no source code translation !*/
> +#endif				/* ACPI_USE_SYSTEM_INTTYPES */
> 
>  /*
>   * Value returned by acpi_os_get_thread_id. There is no standard "thread_id"
> @@ -149,12 +149,12 @@ typedef COMPILER_DEPENDENT_INT64 INT64;
> 
>  #if ACPI_MACHINE_WIDTH == 64
> 
> -/*! [Begin] no source code translation (keep the typedefs as-is) */
> +#ifndef ACPI_USE_SYSTEM_INTTYPES
> 
> -typedef unsigned int UINT32;
> -typedef int INT32;
> +typedef unsigned int u32;
> +typedef int s32;
> 
> -/*! [End] no source code translation !*/
> +#endif				/* ACPI_USE_SYSTEM_INTTYPES */
> 
>  typedef s64 acpi_native_int;
> 
> @@ -188,12 +188,12 @@ typedef u64 acpi_physical_address;
> 
>  #elif ACPI_MACHINE_WIDTH == 32
> 
> -/*! [Begin] no source code translation (keep the typedefs as-is) */
> +#ifndef ACPI_USE_SYSTEM_INTTYPES
> 
> -typedef unsigned int UINT32;
> -typedef int INT32;
> +typedef unsigned int u32;
> +typedef int s32;
> 
> -/*! [End] no source code translation !*/
> +#endif				/* ACPI_USE_SYSTEM_INTTYPES */
> 
>  typedef s32 acpi_native_int;
> 
> diff --git a/include/acpi/platform/aclinux.h b/include/acpi/platform/aclinux.h
> index f41f59b..a24c8f0 100644
> --- a/include/acpi/platform/aclinux.h
> +++ b/include/acpi/platform/aclinux.h
> @@ -58,6 +58,8 @@
>  #define ACPI_REDUCED_HARDWARE 1
>  #endif
> 
> +#define ACPI_USE_SYSTEM_INTTYPES
> +
>  #include <linux/string.h>
>  #include <linux/kernel.h>
>  #include <linux/ctype.h>
> --
> 1.7.10

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

* RE: [PATCH 2/2] ACPICA: acpidump: Remove translation protection on integer types.
  2014-02-13  2:44   ` Zheng, Lv
@ 2014-02-13 23:34     ` Luck, Tony
  2014-02-13 23:55       ` Rafael J. Wysocki
  2014-02-18  0:57       ` Zheng, Lv
  0 siblings, 2 replies; 10+ messages in thread
From: Luck, Tony @ 2014-02-13 23:34 UTC (permalink / raw)
  To: Zheng, Lv, Wysocki, Rafael J, Brown, Len
  Cc: Lv Zheng, linux-kernel, linux-acpi, Yu, Fenghua

>    All definitions are equal except ACPI_UINT64_MAX for CONFIG_IA64.  It
>    is changed from sizeof(unsigned long) to sizeof(unsigned long long).
>    By investigation, 64bit Linux kernel build is LP64 compliant, i.e.,
>    sizeof(long) and (pointer) are 64.  As sizeof(unsigned long) equals to
>    sizeof(unsigned long long) on IA64 platform where CONFIG_64BIT cannot be
>    disabled, this change actually will not affect the value of
>    ACPI_UINT64_MAX on IA64 platforms.

This all looks correct to me - it really shouldn't make any difference
to ia64 whether we use "long" or "long long" ... both are 8-byte entities.
The compiler would complain in some places if you mixed & matched
incorrectly (e.g. printk("val = %ld\n", val); will give a warning if val has
been switched from "long" to "long long" and the format would need
to change to "%lld").  But it looks like nothing like that happens as a
result of this patch. All my ia64 configs build with no new warnings.

Boots OK too.

-Tony

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

* Re: [PATCH 2/2] ACPICA: acpidump: Remove translation protection on integer types.
  2014-02-13 23:34     ` Luck, Tony
@ 2014-02-13 23:55       ` Rafael J. Wysocki
  2014-02-18  0:57       ` Zheng, Lv
  1 sibling, 0 replies; 10+ messages in thread
From: Rafael J. Wysocki @ 2014-02-13 23:55 UTC (permalink / raw)
  To: Luck, Tony
  Cc: Zheng, Lv, Wysocki, Rafael J, Brown, Len, Lv Zheng, linux-kernel,
	linux-acpi, Yu, Fenghua

On Thursday, February 13, 2014 11:34:45 PM Luck, Tony wrote:
> >    All definitions are equal except ACPI_UINT64_MAX for CONFIG_IA64.  It
> >    is changed from sizeof(unsigned long) to sizeof(unsigned long long).
> >    By investigation, 64bit Linux kernel build is LP64 compliant, i.e.,
> >    sizeof(long) and (pointer) are 64.  As sizeof(unsigned long) equals to
> >    sizeof(unsigned long long) on IA64 platform where CONFIG_64BIT cannot be
> >    disabled, this change actually will not affect the value of
> >    ACPI_UINT64_MAX on IA64 platforms.
> 
> This all looks correct to me - it really shouldn't make any difference
> to ia64 whether we use "long" or "long long" ... both are 8-byte entities.
> The compiler would complain in some places if you mixed & matched
> incorrectly (e.g. printk("val = %ld\n", val); will give a warning if val has
> been switched from "long" to "long long" and the format would need
> to change to "%lld").  But it looks like nothing like that happens as a
> result of this patch. All my ia64 configs build with no new warnings.
> 
> Boots OK too.

Great, thanks for the confirmation!

I'm going to queue this up for 3.15.

Rafael


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

* RE: [PATCH 2/2] ACPICA: acpidump: Remove translation protection on integer types.
  2014-02-13 23:34     ` Luck, Tony
  2014-02-13 23:55       ` Rafael J. Wysocki
@ 2014-02-18  0:57       ` Zheng, Lv
  1 sibling, 0 replies; 10+ messages in thread
From: Zheng, Lv @ 2014-02-18  0:57 UTC (permalink / raw)
  To: Luck, Tony, Wysocki, Rafael J, Brown, Len
  Cc: Lv Zheng, linux-kernel, linux-acpi, Yu, Fenghua

Hi, Tony

> From: Luck, Tony
> Sent: Friday, February 14, 2014 7:35 AM
> 
> >    All definitions are equal except ACPI_UINT64_MAX for CONFIG_IA64.  It
> >    is changed from sizeof(unsigned long) to sizeof(unsigned long long).
> >    By investigation, 64bit Linux kernel build is LP64 compliant, i.e.,
> >    sizeof(long) and (pointer) are 64.  As sizeof(unsigned long) equals to
> >    sizeof(unsigned long long) on IA64 platform where CONFIG_64BIT cannot be
> >    disabled, this change actually will not affect the value of
> >    ACPI_UINT64_MAX on IA64 platforms.
> 
> This all looks correct to me - it really shouldn't make any difference
> to ia64 whether we use "long" or "long long" ... both are 8-byte entities.
> The compiler would complain in some places if you mixed & matched
> incorrectly (e.g. printk("val = %ld\n", val); will give a warning if val has
> been switched from "long" to "long long" and the format would need
> to change to "%lld").  But it looks like nothing like that happens as a
> result of this patch. All my ia64 configs build with no new warnings.
> 
> Boots OK too.

It looked scary to me that without applying this patch, Linux ACPICA was using the u64 defined by Linux but defining ACPI_UINT64_MAX to the value that could be different from sizeof(u64).
This patch can make them converged.  I was worrying about the regressions that could be triggered by this fix if there was something already dependent on this divergence.
Great to hear that there is no such dependency. :-)

Thanks and best regards
-Lv
 
> 
> -Tony

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

end of thread, other threads:[~2014-02-18  0:57 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-02-11  2:51 [PATCH 0/2] ACPICA: Preparations of acpidump release automation Lv Zheng
2014-02-11  2:51 ` Lv Zheng
2014-02-11  2:51 ` [PATCH 1/2] ACPICA: acpidump: Add sparse declarators support Lv Zheng
2014-02-11  2:51   ` Lv Zheng
2014-02-11  2:51 ` [PATCH 2/2] ACPICA: acpidump: Remove translation protection on integer types Lv Zheng
2014-02-11  2:51   ` Lv Zheng
2014-02-13  2:44   ` Zheng, Lv
2014-02-13 23:34     ` Luck, Tony
2014-02-13 23:55       ` Rafael J. Wysocki
2014-02-18  0:57       ` Zheng, Lv

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.