aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/executer/exfield.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/acpi/executer/exfield.c')
-rw-r--r--drivers/acpi/executer/exfield.c25
1 files changed, 16 insertions, 9 deletions
diff --git a/drivers/acpi/executer/exfield.c b/drivers/acpi/executer/exfield.c
index be7f2124fa02..22c8fa480f60 100644
--- a/drivers/acpi/executer/exfield.c
+++ b/drivers/acpi/executer/exfield.c
@@ -120,8 +120,8 @@ acpi_ex_read_data_from_field (
120 * Note: Smbus protocol value is passed in upper 16-bits of Function 120 * Note: Smbus protocol value is passed in upper 16-bits of Function
121 */ 121 */
122 status = acpi_ex_access_region (obj_desc, 0, 122 status = acpi_ex_access_region (obj_desc, 0,
123 ACPI_CAST_PTR (acpi_integer, buffer_desc->buffer.pointer), 123 ACPI_CAST_PTR (acpi_integer, buffer_desc->buffer.pointer),
124 ACPI_READ | (obj_desc->field.attribute << 16)); 124 ACPI_READ | (obj_desc->field.attribute << 16));
125 acpi_ex_release_global_lock (locked); 125 acpi_ex_release_global_lock (locked);
126 goto exit; 126 goto exit;
127 } 127 }
@@ -196,6 +196,7 @@ exit:
196 * 196 *
197 * PARAMETERS: source_desc - Contains data to write 197 * PARAMETERS: source_desc - Contains data to write
198 * obj_desc - The named field 198 * obj_desc - The named field
199 * result_desc - Where the return value is returned, if any
199 * 200 *
200 * RETURN: Status 201 * RETURN: Status
201 * 202 *
@@ -250,12 +251,15 @@ acpi_ex_write_data_to_field (
250 if (ACPI_GET_OBJECT_TYPE (source_desc) != ACPI_TYPE_BUFFER) { 251 if (ACPI_GET_OBJECT_TYPE (source_desc) != ACPI_TYPE_BUFFER) {
251 ACPI_REPORT_ERROR (("SMBus write requires Buffer, found type %s\n", 252 ACPI_REPORT_ERROR (("SMBus write requires Buffer, found type %s\n",
252 acpi_ut_get_object_type_name (source_desc))); 253 acpi_ut_get_object_type_name (source_desc)));
254
253 return_ACPI_STATUS (AE_AML_OPERAND_TYPE); 255 return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
254 } 256 }
255 257
256 if (source_desc->buffer.length < ACPI_SMBUS_BUFFER_SIZE) { 258 if (source_desc->buffer.length < ACPI_SMBUS_BUFFER_SIZE) {
257 ACPI_REPORT_ERROR (("SMBus write requires Buffer of length %X, found length %X\n", 259 ACPI_REPORT_ERROR ((
260 "SMBus write requires Buffer of length %X, found length %X\n",
258 ACPI_SMBUS_BUFFER_SIZE, source_desc->buffer.length)); 261 ACPI_SMBUS_BUFFER_SIZE, source_desc->buffer.length));
262
259 return_ACPI_STATUS (AE_AML_BUFFER_LIMIT); 263 return_ACPI_STATUS (AE_AML_BUFFER_LIMIT);
260 } 264 }
261 265
@@ -265,14 +269,16 @@ acpi_ex_write_data_to_field (
265 } 269 }
266 270
267 buffer = buffer_desc->buffer.pointer; 271 buffer = buffer_desc->buffer.pointer;
268 ACPI_MEMCPY (buffer, source_desc->buffer.pointer, ACPI_SMBUS_BUFFER_SIZE); 272 ACPI_MEMCPY (buffer, source_desc->buffer.pointer,
273 ACPI_SMBUS_BUFFER_SIZE);
269 274
270 /* Lock entire transaction if requested */ 275 /* Lock entire transaction if requested */
271 276
272 locked = acpi_ex_acquire_global_lock (obj_desc->common_field.field_flags); 277 locked = acpi_ex_acquire_global_lock (obj_desc->common_field.field_flags);
273 278
274 /* 279 /*
275 * Perform the write (returns status and perhaps data in the same buffer) 280 * Perform the write (returns status and perhaps data in the
281 * same buffer)
276 * Note: SMBus protocol type is passed in upper 16-bits of Function. 282 * Note: SMBus protocol type is passed in upper 16-bits of Function.
277 */ 283 */
278 status = acpi_ex_access_region (obj_desc, 0, 284 status = acpi_ex_access_region (obj_desc, 0,
@@ -284,9 +290,8 @@ acpi_ex_write_data_to_field (
284 return_ACPI_STATUS (status); 290 return_ACPI_STATUS (status);
285 } 291 }
286 292
287 /* 293 /* Get a pointer to the data to be written */
288 * Get a pointer to the data to be written 294
289 */
290 switch (ACPI_GET_OBJECT_TYPE (source_desc)) { 295 switch (ACPI_GET_OBJECT_TYPE (source_desc)) {
291 case ACPI_TYPE_INTEGER: 296 case ACPI_TYPE_INTEGER:
292 buffer = &source_desc->integer.value; 297 buffer = &source_desc->integer.value;
@@ -314,7 +319,8 @@ acpi_ex_write_data_to_field (
314 * the ACPI specification. 319 * the ACPI specification.
315 */ 320 */
316 new_buffer = NULL; 321 new_buffer = NULL;
317 required_length = ACPI_ROUND_BITS_UP_TO_BYTES (obj_desc->common_field.bit_length); 322 required_length = ACPI_ROUND_BITS_UP_TO_BYTES (
323 obj_desc->common_field.bit_length);
318 324
319 if (length < required_length) { 325 if (length < required_length) {
320 /* We need to create a new buffer */ 326 /* We need to create a new buffer */
@@ -338,6 +344,7 @@ acpi_ex_write_data_to_field (
338 "field_write [FROM]: Obj %p (%s:%X), Buf %p, byte_len %X\n", 344 "field_write [FROM]: Obj %p (%s:%X), Buf %p, byte_len %X\n",
339 source_desc, acpi_ut_get_type_name (ACPI_GET_OBJECT_TYPE (source_desc)), 345 source_desc, acpi_ut_get_type_name (ACPI_GET_OBJECT_TYPE (source_desc)),
340 ACPI_GET_OBJECT_TYPE (source_desc), buffer, length)); 346 ACPI_GET_OBJECT_TYPE (source_desc), buffer, length));
347
341 ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, 348 ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
342 "field_write [TO]: Obj %p (%s:%X), bit_len %X, bit_off %X, byte_off %X\n", 349 "field_write [TO]: Obj %p (%s:%X), bit_len %X, bit_off %X, byte_off %X\n",
343 obj_desc, acpi_ut_get_type_name (ACPI_GET_OBJECT_TYPE (obj_desc)), 350 obj_desc, acpi_ut_get_type_name (ACPI_GET_OBJECT_TYPE (obj_desc)),