ACPICA: Headers: Deploy #pragma pack (push) and (pop).
authorBob Moore <robert.moore@intel.com>
Wed, 26 Feb 2014 02:28:32 +0000 (10:28 +0800)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Wed, 26 Feb 2014 23:45:59 +0000 (00:45 +0100)
Use push and pop to both guarantee that the correct alignment is used,
and to restore the alignment to whatever it was before the header
was included.

It is reported that the #pragma pack(push/pop) directives are not supported
by the specific GCCs, but this patch still doesn't affect kernel build
as there are already #pragma pack([1]) directives used in the old ACPICA
headers, which means there shouldn't be GCCs that are currently used to
compile the ACPI kernels do not support #pragma pack() directives.

References: https://bugs.acpica.org/show_bug.cgi?id=1058
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
30 files changed:
drivers/acpi/acpica/acdebug.h
drivers/acpi/acpica/acdispat.h
drivers/acpi/acpica/acevents.h
drivers/acpi/acpica/acglobal.h
drivers/acpi/acpica/achware.h
drivers/acpi/acpica/acinterp.h
drivers/acpi/acpica/aclocal.h
drivers/acpi/acpica/acmacros.h
drivers/acpi/acpica/acnamesp.h
drivers/acpi/acpica/acobject.h
drivers/acpi/acpica/acparser.h
drivers/acpi/acpica/acpredef.h
drivers/acpi/acpica/acresrc.h
drivers/acpi/acpica/acstruct.h
drivers/acpi/acpica/actables.h
drivers/acpi/acpica/acutils.h
drivers/acpi/acpica/amlcode.h
drivers/acpi/acpica/amlresrc.h
include/acpi/acbuffer.h
include/acpi/acconfig.h
include/acpi/acexcep.h
include/acpi/acoutput.h
include/acpi/acpiosxf.h
include/acpi/acpixf.h
include/acpi/acrestyp.h
include/acpi/actbl.h
include/acpi/actbl1.h
include/acpi/actbl2.h
include/acpi/actbl3.h
include/acpi/actypes.h

index 68a91eb0fa483f24b55218770c4bed079873d3e6..e9ab514a96c87f887d4387b8087a769ab40e392a 100644 (file)
@@ -44,6 +44,8 @@
 #ifndef __ACDEBUG_H__
 #define __ACDEBUG_H__
 
+#pragma pack(push)             /* Set default struct packing */
+
 #define ACPI_DEBUG_BUFFER_SIZE  0x4000 /* 16K buffer for return objects */
 
 struct acpi_db_command_info {
@@ -282,4 +284,6 @@ struct acpi_namespace_node *acpi_db_local_ns_lookup(char *name);
 
 void acpi_db_uint32_to_hex_string(u32 value, char *buffer);
 
+#pragma pack(pop)              /* Restore original struct packing */
+
 #endif                         /* __ACDEBUG_H__ */
index 5b472c43c31da376e14e039f4583521e68b184da..53b6dd679ffa5db8ab51a0646ebc3044918da60b 100644 (file)
@@ -44,6 +44,8 @@
 #ifndef _ACDISPAT_H_
 #define _ACDISPAT_H_
 
+#pragma pack(push)             /* Set default struct packing */
+
 #define NAMEOF_LOCAL_NTE    "__L0"
 #define NAMEOF_ARG_NTE      "__A0"
 
@@ -351,4 +353,6 @@ acpi_status
 acpi_ds_result_push(union acpi_operand_object *object,
                    struct acpi_walk_state *walk_state);
 
+#pragma pack(pop)              /* Restore original struct packing */
+
 #endif                         /* _ACDISPAT_H_ */
index 68ec61fff1886872da7143ec804013ab5b504656..75f25eda3a6ad5fb0278944cd7d9057be17640e2 100644 (file)
@@ -44,6 +44,8 @@
 #ifndef __ACEVENTS_H__
 #define __ACEVENTS_H__
 
+#pragma pack(push)             /* Set default struct packing */
+
 /*
  * evevent
  */
@@ -251,4 +253,5 @@ u32 acpi_ev_install_sci_handler(void);
 acpi_status acpi_ev_remove_all_sci_handlers(void);
 
 ACPI_HW_DEPENDENT_RETURN_VOID(void acpi_ev_terminate(void))
+#pragma pack(pop)              /* Restore original struct packing */
 #endif                         /* __ACEVENTS_H__  */
index b88771b1377964f570d32be9e7593a2aa068d554..203b2dc5ea28d4fa41d84742222bc758111b437e 100644 (file)
@@ -44,6 +44,8 @@
 #ifndef __ACGLOBAL_H__
 #define __ACGLOBAL_H__
 
+#pragma pack(push)             /* Set default struct packing */
+
 /*
  * Ensure that the globals are actually defined and initialized only once.
  *
@@ -520,4 +522,6 @@ ACPI_FILE ACPI_INIT_GLOBAL(acpi_gbl_debug_file, NULL);
 
 extern const struct ah_predefined_name asl_predefined_info[];
 
+#pragma pack(pop)              /* Restore original struct packing */
+
 #endif                         /* __ACGLOBAL_H__ */
index 2ad2351a983321e31c1a4aa6983dfd0dfe419c09..4a0e634578812d033a576bcab9a834edf85ee42b 100644 (file)
@@ -44,6 +44,8 @@
 #ifndef __ACHWARE_H__
 #define __ACHWARE_H__
 
+#pragma pack(push)             /* Set default struct packing */
+
 /* Values for the _SST predefined method */
 
 #define ACPI_SST_INDICATOR_OFF  0
@@ -147,4 +149,6 @@ acpi_status
 acpi_hw_derive_pci_id(struct acpi_pci_id *pci_id,
                      acpi_handle root_pci_device, acpi_handle pci_region);
 
+#pragma pack(pop)              /* Restore original struct packing */
+
 #endif                         /* __ACHWARE_H__ */
index 948a6800ab093d11fd992df760cdb2654709d5ca..277f4d03c0801576a516e3f22cf19cdf8e6345fd 100644 (file)
@@ -44,6 +44,8 @@
 #ifndef __ACINTERP_H__
 #define __ACINTERP_H__
 
+#pragma pack(push)             /* Set default struct packing */
+
 #define ACPI_WALK_OPERANDS          (&(walk_state->operands [walk_state->num_operands -1]))
 
 /* Macros for tables used for debug output */
@@ -531,4 +533,6 @@ acpi_ex_data_table_space_handler(u32 function,
                                 u64 *value,
                                 void *handler_context, void *region_context);
 
+#pragma pack(pop)              /* Restore original struct packing */
+
 #endif                         /* __INTERP_H__ */
index 52a21dafb54039ca3c3d62bb22328acfb7a3321a..fee53b50399b10c9c6a315def3c542d4bbba2137 100644 (file)
@@ -44,6 +44,8 @@
 #ifndef __ACLOCAL_H__
 #define __ACLOCAL_H__
 
+#pragma pack(push)             /* Set default struct packing */
+
 /* acpisrc:struct_defs -- for acpisrc conversion */
 
 #define ACPI_SERIALIZED                 0xFF
@@ -1147,4 +1149,6 @@ struct ah_predefined_name {
 #endif
 };
 
+#pragma pack(pop)              /* Restore original struct packing */
+
 #endif                         /* __ACLOCAL_H__ */
index 4bceb11c7380d118020b512a93a267c4c6b3114a..9b0ce226bf5d43563212398184e8751161bdc2bb 100644 (file)
@@ -44,6 +44,8 @@
 #ifndef __ACMACROS_H__
 #define __ACMACROS_H__
 
+#pragma pack(push)             /* Set default struct packing */
+
 /*
  * Extract data using a pointer. Any more than a byte and we
  * get into potential aligment issues -- see the STORE macros below.
 
 #define ACPI_IS_OCTAL_DIGIT(d)              (((char)(d) >= '0') && ((char)(d) <= '7'))
 
+#pragma pack(pop)              /* Restore original struct packing */
+
 #endif                         /* ACMACROS_H */
index ee1c040f321c621bc33ed8dd66c2c9426e6f3801..751083dd779365fde686f316da318f3e6cfcb1a2 100644 (file)
@@ -44,6 +44,8 @@
 #ifndef __ACNAMESP_H__
 #define __ACNAMESP_H__
 
+#pragma pack(push)             /* Set default struct packing */
+
 /* To search the entire name space, pass this as search_base */
 
 #define ACPI_NS_ALL                 ((acpi_handle)0)
@@ -404,4 +406,6 @@ struct acpi_namespace_node *acpi_ns_validate_handle(acpi_handle handle);
 
 void acpi_ns_terminate(void);
 
+#pragma pack(pop)              /* Restore original struct packing */
+
 #endif                         /* __ACNAMESP_H__ */
index 1a4d61805ebc64a83bc9242414536f7fecfb25cf..7ce7e9f1a040171a2d10f48209c572a0becff923 100644 (file)
@@ -44,6 +44,8 @@
 #ifndef _ACOBJECT_H
 #define _ACOBJECT_H
 
+#pragma pack(push)             /* Set default struct packing */
+
 /* acpisrc:struct_defs -- for acpisrc conversion */
 
 /*
@@ -456,6 +458,6 @@ union acpi_descriptor {
        union acpi_parse_object op;
 };
 
-#pragma pack()
+#pragma pack(pop)              /* Restore original struct packing */
 
 #endif                         /* _ACOBJECT_H */
index 6168b85463edc1b0b68b5405a8e64ed449b2bdd8..3d828be9dc20196407f72d4053bc38483f610b23 100644 (file)
@@ -44,6 +44,8 @@
 #ifndef __ACPARSER_H__
 #define __ACPARSER_H__
 
+#pragma pack(push)             /* Set default struct packing */
+
 #define OP_HAS_RETURN_VALUE             1
 
 /* Variable number of arguments. This field must be 32 bits */
@@ -251,4 +253,6 @@ acpi_ps_sprint_op(char *buffer_start,
 
 void acpi_ps_show(union acpi_parse_object *op);
 
+#pragma pack(pop)              /* Restore original struct packing */
+
 #endif                         /* __ACPARSER_H__ */
index 9c73d6c5ead2684166d655f0e973857ede4edd53..01b9eaaa982db38e0aea18e2bf6634abf7c421a4 100644 (file)
@@ -44,6 +44,8 @@
 #ifndef __ACPREDEF_H__
 #define __ACPREDEF_H__
 
+#pragma pack(push)             /* Set default struct packing */
+
 /******************************************************************************
  *
  * Return Package types
@@ -1080,4 +1082,6 @@ static const union acpi_predefined_info acpi_gbl_scope_names[] = {
 extern const union acpi_predefined_info acpi_gbl_resource_names[];
 #endif
 
+#pragma pack(pop)              /* Restore original struct packing */
+
 #endif
index 4b008e8884a111326fe17f5a1f5ee2adc028f8f6..be16da2d9f3d45fe8d9b2808453234ca4d212cd5 100644 (file)
@@ -48,6 +48,8 @@
 
 #include "amlresrc.h"
 
+#pragma pack(push)             /* Set default struct packing */
+
 /*
  * If possible, pack the following structures to byte alignment, since we
  * don't care about performance for debug output. Two cases where we cannot
@@ -378,4 +380,6 @@ extern struct acpi_rsdump_info acpi_rs_dump_uart_serial_bus[];
 extern struct acpi_rsdump_info acpi_rs_dump_general_flags[];
 #endif
 
+#pragma pack(pop)              /* Restore original struct packing */
+
 #endif                         /* __ACRESRC_H__ */
index 5d2989a1b68c965a8649243b20837dd5104f74a5..5a3fa0ddc1bcb59bceded918d223384018205a7c 100644 (file)
@@ -44,6 +44,8 @@
 #ifndef __ACSTRUCT_H__
 #define __ACSTRUCT_H__
 
+#pragma pack(push)             /* Set default struct packing */
+
 /* acpisrc:struct_defs -- for acpisrc conversion */
 
 /*****************************************************************************
@@ -241,4 +243,6 @@ struct acpi_walk_info {
 
 #define ACPI_DISPLAY_SHORT          (u8) 2
 
+#pragma pack(pop)              /* Restore original struct packing */
+
 #endif
index 5fa4b202769790e81a9ff39964957fc5860cb844..9b0f9846e0147943603db3e3f6bc62ab1c336a70 100644 (file)
@@ -44,6 +44,8 @@
 #ifndef __ACTABLES_H__
 #define __ACTABLES_H__
 
+#pragma pack(push)             /* Set default struct packing */
+
 acpi_status acpi_allocate_root_table(u32 initial_table_count);
 
 /*
@@ -129,4 +131,6 @@ acpi_tb_install_table(acpi_physical_address address,
 
 acpi_status acpi_tb_parse_root_table(acpi_physical_address rsdp_address);
 
+#pragma pack(pop)              /* Restore original struct packing */
+
 #endif                         /* __ACTABLES_H__ */
index ceeec0b7ccb1764b1e8bc1bd4b7e91ef1f7b372c..df970ffb735647c774648792337a11ec7e6a785f 100644 (file)
@@ -44,6 +44,8 @@
 #ifndef _ACUTILS_H
 #define _ACUTILS_H
 
+#pragma pack(push)             /* Set default struct packing */
+
 extern const u8 acpi_gbl_resource_aml_sizes[];
 extern const u8 acpi_gbl_resource_aml_serial_bus_sizes[];
 
@@ -737,4 +739,6 @@ acpi_ut_method_error(const char *module_name,
                     struct acpi_namespace_node *node,
                     const char *path, acpi_status lookup_status);
 
+#pragma pack(pop)              /* Restore original struct packing */
+
 #endif                         /* _ACUTILS_H */
index 5908ccec6aea8b5858338cf5b2a7de95bdbb118d..2db27109d70e4ad21877e4d8eae82a055dddd17d 100644 (file)
@@ -46,6 +46,8 @@
 #ifndef __AMLCODE_H__
 #define __AMLCODE_H__
 
+#pragma pack(push)             /* Set default struct packing */
+
 /* primary opcodes */
 
 #define AML_NULL_CHAR               (u16) 0x00
@@ -484,4 +486,6 @@ typedef enum {
 #define AML_METHOD_SERIALIZED       0x08
 #define AML_METHOD_SYNC_LEVEL       0xF0
 
+#pragma pack(pop)              /* Restore original struct packing */
+
 #endif                         /* __AMLCODE_H__ */
index f3f834408441c34e40ab88127bb83d30c2e2aa0c..334fbeee80d2d4d7148fda2fa48b145c93c68100 100644 (file)
@@ -46,6 +46,8 @@
 #ifndef __AMLRESRC_H
 #define __AMLRESRC_H
 
+#pragma pack(push)             /* Set default struct packing */
+
 /*
  * Resource descriptor tags, as defined in the ACPI specification.
  * Used to symbolically reference fields within a descriptor.
@@ -449,4 +451,6 @@ union aml_resource {
        u8 byte_item;
 };
 
+#pragma pack(pop)              /* Restore original struct packing */
+
 #endif
index 88cb477524a60913201cae59c42935e789906065..960c76fb69a1dcd746fd3b410b8441c973494759 100644 (file)
@@ -44,6 +44,8 @@
 #ifndef __ACBUFFER_H__
 #define __ACBUFFER_H__
 
+#pragma pack(push)             /* Set default struct packing */
+
 /*
  * Contains buffer structures for these predefined names:
  * _FDE, _GRT, _GTM, _PLD, _SRT
@@ -232,4 +234,6 @@ struct acpi_pld_info {
 #define ACPI_PLD_GET_HORIZ_OFFSET(dword)        ACPI_GET_BITS (dword, 16, ACPI_16BIT_MASK)
 #define ACPI_PLD_SET_HORIZ_OFFSET(dword,value)  ACPI_SET_BITS (dword, 16, ACPI_16BIT_MASK, value)      /* Offset 128+16=144, Len 16 */
 
+#pragma pack(pop)              /* Restore original struct packing */
+
 #endif                         /* ACBUFFER_H */
index 932a60d6ed8283de2e5c893d9aad53626dabbbbe..d8a0ba8f88a53f170b15d48ac375480275327ed3 100644 (file)
@@ -44,6 +44,8 @@
 #ifndef _ACCONFIG_H
 #define _ACCONFIG_H
 
+#pragma pack(push)             /* Set default struct packing */
+
 /******************************************************************************
  *
  * Configuration options
 #define ACPI_DEBUGGER_COMMAND_PROMPT    '-'
 #define ACPI_DEBUGGER_EXECUTE_PROMPT    '%'
 
+#pragma pack(pop)              /* Restore original struct packing */
+
 #endif                         /* _ACCONFIG_H */
index 8b06e4c1dd5d1873b08c3490b8d80a40283b4e87..f0bcb96b1598a3973854503826a02a537114fa3d 100644 (file)
@@ -44,6 +44,8 @@
 #ifndef __ACEXCEP_H__
 #define __ACEXCEP_H__
 
+#pragma pack(push)             /* Set default struct packing */
+
 /* This module contains all possible exception codes for acpi_status */
 
 /*
@@ -377,4 +379,6 @@ static const struct acpi_exception_info acpi_gbl_exception_names_ctrl[] = {
 
 #endif                         /* EXCEPTION_TABLE */
 
+#pragma pack(pop)              /* Restore original struct packing */
+
 #endif                         /* __ACEXCEP_H__ */
index 1baae6edda8925d5205f3151c72c19cb31391e43..247636fb51a593193386f53861b1e4280716948f 100644 (file)
@@ -44,6 +44,8 @@
 #ifndef __ACOUTPUT_H__
 #define __ACOUTPUT_H__
 
+#pragma pack(push)             /* Set default struct packing */
+
 /*
  * Debug levels and component IDs. These are used to control the
  * granularity of the output of the ACPI_DEBUG_PRINT macro -- on a
 
 #endif                         /* ACPI_DEBUG_OUTPUT */
 
+#pragma pack(pop)              /* Restore original struct packing */
+
 #endif                         /* __ACOUTPUT_H__ */
index f6f5f8af211245571f2c2bd38415afe7e988eb94..a4a2cd39aea972654275c308bd6de34eba16f3a8 100644 (file)
@@ -49,6 +49,8 @@
 #include <acpi/platform/acenv.h>
 #include <acpi/actypes.h>
 
+#pragma pack(push)             /* Set default struct packing */
+
 /* Types for acpi_os_execute */
 
 typedef enum {
@@ -399,4 +401,6 @@ char *acpi_os_get_next_filename(void *dir_handle);
 void acpi_os_close_directory(void *dir_handle);
 #endif
 
+#pragma pack(pop)              /* Restore original struct packing */
+
 #endif                         /* __ACPIOSXF_H__ */
index 51cdf1bbb8629a7c459deb89717a90f3dd38d87f..efa767ffe904a57a5a5855d9e726a83851871ed1 100644 (file)
@@ -55,6 +55,8 @@
 
 extern u8 acpi_gbl_permanent_mmap;
 
+#pragma pack(push)             /* Set default struct packing */
+
 /*
  * Globals that are publically available
  */
@@ -580,4 +582,6 @@ acpi_debug_print_raw(u32 requested_debug_level,
                     u32 component_id, const char *format, ...);
 #endif
 
+#pragma pack(pop)              /* Restore original struct packing */
+
 #endif                         /* __ACXFACE_H__ */
index eb760ca0b2e05884745e02e09aec222744829c25..3c83a79c583fb9010cb88ef438633f78b8d12b5d 100644 (file)
@@ -44,6 +44,8 @@
 #ifndef __ACRESTYP_H__
 #define __ACRESTYP_H__
 
+#pragma pack(push)             /* Set default struct packing */
+
 /*
  * Definitions for Resource Attributes
  */
@@ -610,4 +612,6 @@ struct acpi_pci_routing_table {
        char source[4];         /* pad to 64 bits so sizeof() works in all cases */
 };
 
+#pragma pack(pop)              /* Restore original struct packing */
+
 #endif                         /* __ACRESTYP_H__ */
index 3b30e36b53b509d92fc5c00f88bb7c07c5a4f3cc..b32a33f1c2df8ad077c6c34f643a0f2eeb7e7aec 100644 (file)
@@ -44,6 +44,8 @@
 #ifndef __ACTBL_H__
 #define __ACTBL_H__
 
+#pragma pack(push)             /* Set default struct packing */
+
 /*******************************************************************************
  *
  * Fundamental ACPI tables
@@ -404,4 +406,6 @@ struct acpi_table_desc {
 #define ACPI_FADT_V3_SIZE       (u32) (ACPI_FADT_OFFSET (sleep_control))
 #define ACPI_FADT_V5_SIZE       (u32) (sizeof (struct acpi_table_fadt))
 
+#pragma pack(pop)              /* Restore original struct packing */
+
 #endif                         /* __ACTBL_H__ */
index 212c65de75df9899a19e05c6c609be3d7d10a309..b7f0b0c6ff6607323c96aec748b36a7379ca43fe 100644 (file)
@@ -44,6 +44,8 @@
 #ifndef __ACTBL1_H__
 #define __ACTBL1_H__
 
+#pragma pack(push)             /* Set default struct packing */
+
 /*******************************************************************************
  *
  * Additional ACPI Tables (1)
@@ -972,8 +974,6 @@ struct acpi_srat_x2apic_cpu_affinity {
 
 #define ACPI_SRAT_CPU_ENABLED       (1)        /* 00: Use affinity structure */
 
-/* Reset to default packing */
-
-#pragma pack()
+#pragma pack(pop)              /* Restore original struct packing */
 
 #endif                         /* __ACTBL1_H__ */
index f3372441e3a5269d8f9d593a5917df9e5ce04368..89a26135745bb29c3533004834ef5811087bd7a1 100644 (file)
@@ -44,6 +44,8 @@
 #ifndef __ACTBL2_H__
 #define __ACTBL2_H__
 
+#pragma pack(push)             /* Set default struct packing */
+
 /*******************************************************************************
  *
  * Additional ACPI Tables (2)
@@ -1229,8 +1231,6 @@ struct acpi_table_wdrt {
        u8 units;
 };
 
-/* Reset to default packing */
-
-#pragma pack()
+#pragma pack(pop)              /* Restore original struct packing */
 
 #endif                         /* __ACTBL2_H__ */
index c2295cc4a5c07596fe14558647b3398e2346aca5..85ebeea02b818a4050620271295a3732d0c6a757 100644 (file)
@@ -44,6 +44,8 @@
 #ifndef __ACTBL3_H__
 #define __ACTBL3_H__
 
+#pragma pack(push)             /* Set default struct packing */
+
 /*******************************************************************************
  *
  * Additional ACPI Tables (3)
@@ -622,8 +624,6 @@ struct acpi_tpm2_control {
        u64 response_address;
 };
 
-/* Reset to default packing */
-
-#pragma pack()
+#pragma pack(pop)              /* Restore original struct packing */
 
 #endif                         /* __ACTBL3_H__ */
index e76356574374d449fb4ea86305d3d030b2eb2484..c28573da1662c9e872d8bf66bb55e498a8de3dc1 100644 (file)
@@ -44,6 +44,8 @@
 #ifndef __ACTYPES_H__
 #define __ACTYPES_H__
 
+#pragma pack(push)             /* Set default struct packing */
+
 /* acpisrc:struct_defs -- for acpisrc conversion */
 
 /*
@@ -1223,4 +1225,6 @@ struct acpi_memory_list {
 #define ACPI_OSI_WIN_7                  0x0B
 #define ACPI_OSI_WIN_8                  0x0C
 
+#pragma pack(pop)              /* Restore original struct packing */
+
 #endif                         /* __ACTYPES_H__ */
This page took 0.044222 seconds and 5 git commands to generate.