aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/acpica
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/acpi/acpica')
-rw-r--r--drivers/acpi/acpica/hwregs.c8
-rw-r--r--drivers/acpi/acpica/hwxface.c44
2 files changed, 17 insertions, 35 deletions
diff --git a/drivers/acpi/acpica/hwregs.c b/drivers/acpi/acpica/hwregs.c
index 17a78e5ef175..6b6c83b87b52 100644
--- a/drivers/acpi/acpica/hwregs.c
+++ b/drivers/acpi/acpica/hwregs.c
@@ -157,6 +157,7 @@ acpi_hw_validate_register(struct acpi_generic_address *reg,
157acpi_status acpi_hw_read(u32 *value, struct acpi_generic_address *reg) 157acpi_status acpi_hw_read(u32 *value, struct acpi_generic_address *reg)
158{ 158{
159 u64 address; 159 u64 address;
160 u64 value64;
160 acpi_status status; 161 acpi_status status;
161 162
162 ACPI_FUNCTION_NAME(hw_read); 163 ACPI_FUNCTION_NAME(hw_read);
@@ -178,7 +179,9 @@ acpi_status acpi_hw_read(u32 *value, struct acpi_generic_address *reg)
178 */ 179 */
179 if (reg->space_id == ACPI_ADR_SPACE_SYSTEM_MEMORY) { 180 if (reg->space_id == ACPI_ADR_SPACE_SYSTEM_MEMORY) {
180 status = acpi_os_read_memory((acpi_physical_address) 181 status = acpi_os_read_memory((acpi_physical_address)
181 address, value, reg->bit_width); 182 address, &value64, reg->bit_width);
183
184 *value = (u32)value64;
182 } else { /* ACPI_ADR_SPACE_SYSTEM_IO, validated earlier */ 185 } else { /* ACPI_ADR_SPACE_SYSTEM_IO, validated earlier */
183 186
184 status = acpi_hw_read_port((acpi_io_address) 187 status = acpi_hw_read_port((acpi_io_address)
@@ -228,7 +231,8 @@ acpi_status acpi_hw_write(u32 value, struct acpi_generic_address *reg)
228 */ 231 */
229 if (reg->space_id == ACPI_ADR_SPACE_SYSTEM_MEMORY) { 232 if (reg->space_id == ACPI_ADR_SPACE_SYSTEM_MEMORY) {
230 status = acpi_os_write_memory((acpi_physical_address) 233 status = acpi_os_write_memory((acpi_physical_address)
231 address, value, reg->bit_width); 234 address, (u64)value,
235 reg->bit_width);
232 } else { /* ACPI_ADR_SPACE_SYSTEM_IO, validated earlier */ 236 } else { /* ACPI_ADR_SPACE_SYSTEM_IO, validated earlier */
233 237
234 status = acpi_hw_write_port((acpi_io_address) 238 status = acpi_hw_write_port((acpi_io_address)
diff --git a/drivers/acpi/acpica/hwxface.c b/drivers/acpi/acpica/hwxface.c
index bb8dba612212..a716fede4f25 100644
--- a/drivers/acpi/acpica/hwxface.c
+++ b/drivers/acpi/acpica/hwxface.c
@@ -138,11 +138,6 @@ acpi_status acpi_read(u64 *return_value, struct acpi_generic_address *reg)
138 return (status); 138 return (status);
139 } 139 }
140 140
141 width = reg->bit_width;
142 if (width == 64) {
143 width = 32; /* Break into two 32-bit transfers */
144 }
145
146 /* Initialize entire 64-bit return value to zero */ 141 /* Initialize entire 64-bit return value to zero */
147 142
148 *return_value = 0; 143 *return_value = 0;
@@ -154,24 +149,17 @@ acpi_status acpi_read(u64 *return_value, struct acpi_generic_address *reg)
154 */ 149 */
155 if (reg->space_id == ACPI_ADR_SPACE_SYSTEM_MEMORY) { 150 if (reg->space_id == ACPI_ADR_SPACE_SYSTEM_MEMORY) {
156 status = acpi_os_read_memory((acpi_physical_address) 151 status = acpi_os_read_memory((acpi_physical_address)
157 address, &value, width); 152 address, return_value,
153 reg->bit_width);
158 if (ACPI_FAILURE(status)) { 154 if (ACPI_FAILURE(status)) {
159 return (status); 155 return (status);
160 } 156 }
161 *return_value = value; 157 } else { /* ACPI_ADR_SPACE_SYSTEM_IO, validated earlier */
162
163 if (reg->bit_width == 64) {
164
165 /* Read the top 32 bits */
166 158
167 status = acpi_os_read_memory((acpi_physical_address) 159 width = reg->bit_width;
168 (address + 4), &value, 32); 160 if (width == 64) {
169 if (ACPI_FAILURE(status)) { 161 width = 32; /* Break into two 32-bit transfers */
170 return (status);
171 }
172 *return_value |= ((u64)value << 32);
173 } 162 }
174 } else { /* ACPI_ADR_SPACE_SYSTEM_IO, validated earlier */
175 163
176 status = acpi_hw_read_port((acpi_io_address) 164 status = acpi_hw_read_port((acpi_io_address)
177 address, &value, width); 165 address, &value, width);
@@ -231,32 +219,22 @@ acpi_status acpi_write(u64 value, struct acpi_generic_address *reg)
231 return (status); 219 return (status);
232 } 220 }
233 221
234 width = reg->bit_width;
235 if (width == 64) {
236 width = 32; /* Break into two 32-bit transfers */
237 }
238
239 /* 222 /*
240 * Two address spaces supported: Memory or IO. PCI_Config is 223 * Two address spaces supported: Memory or IO. PCI_Config is
241 * not supported here because the GAS structure is insufficient 224 * not supported here because the GAS structure is insufficient
242 */ 225 */
243 if (reg->space_id == ACPI_ADR_SPACE_SYSTEM_MEMORY) { 226 if (reg->space_id == ACPI_ADR_SPACE_SYSTEM_MEMORY) {
244 status = acpi_os_write_memory((acpi_physical_address) 227 status = acpi_os_write_memory((acpi_physical_address)
245 address, ACPI_LODWORD(value), 228 address, value, reg->bit_width);
246 width);
247 if (ACPI_FAILURE(status)) { 229 if (ACPI_FAILURE(status)) {
248 return (status); 230 return (status);
249 } 231 }
232 } else { /* ACPI_ADR_SPACE_SYSTEM_IO, validated earlier */
250 233
251 if (reg->bit_width == 64) { 234 width = reg->bit_width;
252 status = acpi_os_write_memory((acpi_physical_address) 235 if (width == 64) {
253 (address + 4), 236 width = 32; /* Break into two 32-bit transfers */
254 ACPI_HIDWORD(value), 32);
255 if (ACPI_FAILURE(status)) {
256 return (status);
257 }
258 } 237 }
259 } else { /* ACPI_ADR_SPACE_SYSTEM_IO, validated earlier */
260 238
261 status = acpi_hw_write_port((acpi_io_address) 239 status = acpi_hw_write_port((acpi_io_address)
262 address, ACPI_LODWORD(value), 240 address, ACPI_LODWORD(value),