aboutsummaryrefslogtreecommitdiffstats
path: root/include/acpi/acmacros.h
diff options
context:
space:
mode:
authorBob Moore <robert.moore@intel.com>2008-04-10 11:06:42 -0400
committerLen Brown <len.brown@intel.com>2008-04-22 14:29:31 -0400
commit7823665eccdc7e230d0a904c6ec01d5c70ee099b (patch)
treeac080e907e5bbae717d7ddac1c41d8eb262fa680 /include/acpi/acmacros.h
parentb1dd9096fef08642eb509fbf2a40b3c7734dce1c (diff)
ACPICA: Fix for ACPI_HIDWORD macro
Fixed a regression introduced in version 20071114. The ACPI_HIDWORD macro was inadvertently changed to return a 16-bit value instead of a 32-bit value, truncating the upper Dword of a 64-bit value. This macro is only used to display debug output, so no incorrect calculations were made. Signed-off-by: Bob Moore <robert.moore@intel.com> Signed-off-by: Alexey Starikovskiy <astarikovskiy@suse.de> Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'include/acpi/acmacros.h')
-rw-r--r--include/acpi/acmacros.h69
1 files changed, 35 insertions, 34 deletions
diff --git a/include/acpi/acmacros.h b/include/acpi/acmacros.h
index dc6a037311db..1f0fdbf6e09f 100644
--- a/include/acpi/acmacros.h
+++ b/include/acpi/acmacros.h
@@ -62,30 +62,6 @@
62#define ACPI_ARRAY_LENGTH(x) (sizeof(x) / sizeof((x)[0])) 62#define ACPI_ARRAY_LENGTH(x) (sizeof(x) / sizeof((x)[0]))
63 63
64/* 64/*
65 * Full 64-bit integer must be available on both 32-bit and 64-bit platforms
66 */
67#define ACPI_LODWORD(l) ((u32)(u64)(l))
68#define ACPI_HIDWORD(l) ((u16)((((u64)(l)) >> 32) & 0xFFFFFFFF))
69
70#if 0
71#define ACPI_HIDWORD(l) ((u32)(((*(struct uint64_struct *)(void *)(&l))).hi))
72#endif
73
74/*
75 * printf() format helpers
76 */
77
78/* Split 64-bit integer into two 32-bit values. Use with %8.8_x%8.8_x */
79
80#define ACPI_FORMAT_UINT64(i) ACPI_HIDWORD(i),ACPI_LODWORD(i)
81
82#if ACPI_MACHINE_WIDTH == 64
83#define ACPI_FORMAT_NATIVE_UINT(i) ACPI_FORMAT_UINT64(i)
84#else
85#define ACPI_FORMAT_NATIVE_UINT(i) 0, (i)
86#endif
87
88/*
89 * Extract data using a pointer. Any more than a byte and we 65 * Extract data using a pointer. Any more than a byte and we
90 * get into potential aligment issues -- see the STORE macros below. 66 * get into potential aligment issues -- see the STORE macros below.
91 * Use with care. 67 * Use with care.
@@ -122,6 +98,31 @@
122#endif 98#endif
123 99
124/* 100/*
101 * Full 64-bit integer must be available on both 32-bit and 64-bit platforms
102 */
103struct acpi_integer_overlay {
104 u32 lo_dword;
105 u32 hi_dword;
106};
107
108#define ACPI_LODWORD(integer) (ACPI_CAST_PTR (struct acpi_integer_overlay, &integer)->lo_dword)
109#define ACPI_HIDWORD(integer) (ACPI_CAST_PTR (struct acpi_integer_overlay, &integer)->hi_dword)
110
111/*
112 * printf() format helpers
113 */
114
115/* Split 64-bit integer into two 32-bit values. Use with %8.8_x%8.8_x */
116
117#define ACPI_FORMAT_UINT64(i) ACPI_HIDWORD(i),ACPI_LODWORD(i)
118
119#if ACPI_MACHINE_WIDTH == 64
120#define ACPI_FORMAT_NATIVE_UINT(i) ACPI_FORMAT_UINT64(i)
121#else
122#define ACPI_FORMAT_NATIVE_UINT(i) 0, (i)
123#endif
124
125/*
125 * Macros for moving data around to/from buffers that are possibly unaligned. 126 * Macros for moving data around to/from buffers that are possibly unaligned.
126 * If the hardware supports the transfer of unaligned data, just do the store. 127 * If the hardware supports the transfer of unaligned data, just do the store.
127 * Otherwise, we have to move one byte at a time. 128 * Otherwise, we have to move one byte at a time.
@@ -137,29 +138,29 @@
137 138
138/* These macros reverse the bytes during the move, converting little-endian to big endian */ 139/* These macros reverse the bytes during the move, converting little-endian to big endian */
139 140
140 /* Big Endian <== Little Endian */ 141 /* Big Endian <== Little Endian */
141 /* Hi...Lo Lo...Hi */ 142 /* Hi...Lo Lo...Hi */
142/* 16-bit source, 16/32/64 destination */ 143/* 16-bit source, 16/32/64 destination */
143 144
144#define ACPI_MOVE_16_TO_16(d,s) {(( u8 *)(void *)(d))[0] = ((u8 *)(void *)(s))[1];\ 145#define ACPI_MOVE_16_TO_16(d,s) {(( u8 *)(void *)(d))[0] = ((u8 *)(void *)(s))[1];\
145 (( u8 *)(void *)(d))[1] = ((u8 *)(void *)(s))[0];} 146 (( u8 *)(void *)(d))[1] = ((u8 *)(void *)(s))[0];}
146 147
147#define ACPI_MOVE_16_TO_32(d,s) {(*(u32 *)(void *)(d))=0;\ 148#define ACPI_MOVE_16_TO_32(d,s) {(*(u32 *)(void *)(d))=0;\
148 ((u8 *)(void *)(d))[2] = ((u8 *)(void *)(s))[1];\ 149 ((u8 *)(void *)(d))[2] = ((u8 *)(void *)(s))[1];\
149 ((u8 *)(void *)(d))[3] = ((u8 *)(void *)(s))[0];} 150 ((u8 *)(void *)(d))[3] = ((u8 *)(void *)(s))[0];}
150 151
151#define ACPI_MOVE_16_TO_64(d,s) {(*(u64 *)(void *)(d))=0;\ 152#define ACPI_MOVE_16_TO_64(d,s) {(*(u64 *)(void *)(d))=0;\
152 ((u8 *)(void *)(d))[6] = ((u8 *)(void *)(s))[1];\ 153 ((u8 *)(void *)(d))[6] = ((u8 *)(void *)(s))[1];\
153 ((u8 *)(void *)(d))[7] = ((u8 *)(void *)(s))[0];} 154 ((u8 *)(void *)(d))[7] = ((u8 *)(void *)(s))[0];}
154 155
155/* 32-bit source, 16/32/64 destination */ 156/* 32-bit source, 16/32/64 destination */
156 157
157#define ACPI_MOVE_32_TO_16(d,s) ACPI_MOVE_16_TO_16(d,s) /* Truncate to 16 */ 158#define ACPI_MOVE_32_TO_16(d,s) ACPI_MOVE_16_TO_16(d,s) /* Truncate to 16 */
158 159
159#define ACPI_MOVE_32_TO_32(d,s) {(( u8 *)(void *)(d))[0] = ((u8 *)(void *)(s))[3];\ 160#define ACPI_MOVE_32_TO_32(d,s) {(( u8 *)(void *)(d))[0] = ((u8 *)(void *)(s))[3];\
160 (( u8 *)(void *)(d))[1] = ((u8 *)(void *)(s))[2];\ 161 (( u8 *)(void *)(d))[1] = ((u8 *)(void *)(s))[2];\
161 (( u8 *)(void *)(d))[2] = ((u8 *)(void *)(s))[1];\ 162 (( u8 *)(void *)(d))[2] = ((u8 *)(void *)(s))[1];\
162 (( u8 *)(void *)(d))[3] = ((u8 *)(void *)(s))[0];} 163 (( u8 *)(void *)(d))[3] = ((u8 *)(void *)(s))[0];}
163 164
164#define ACPI_MOVE_32_TO_64(d,s) {(*(u64 *)(void *)(d))=0;\ 165#define ACPI_MOVE_32_TO_64(d,s) {(*(u64 *)(void *)(d))=0;\
165 ((u8 *)(void *)(d))[4] = ((u8 *)(void *)(s))[3];\ 166 ((u8 *)(void *)(d))[4] = ((u8 *)(void *)(s))[3];\