aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/executer/exfldio.c
diff options
context:
space:
mode:
authorLen Brown <len.brown@intel.com>2005-08-05 00:44:28 -0400
committerLen Brown <len.brown@intel.com>2005-08-05 00:45:14 -0400
commit4be44fcd3bf648b782f4460fd06dfae6c42ded4b (patch)
tree5b5b7d296ea58786f53b95e5eac9565ff66890b0 /drivers/acpi/executer/exfldio.c
parentc65ade4dc8b486e8c8b9b0a6399789a5428e2039 (diff)
[ACPI] Lindent all ACPI files
Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi/executer/exfldio.c')
-rw-r--r--drivers/acpi/executer/exfldio.c644
1 files changed, 322 insertions, 322 deletions
diff --git a/drivers/acpi/executer/exfldio.c b/drivers/acpi/executer/exfldio.c
index 3c2f89e00f78..ba6e08843c29 100644
--- a/drivers/acpi/executer/exfldio.c
+++ b/drivers/acpi/executer/exfldio.c
@@ -41,36 +41,28 @@
41 * POSSIBILITY OF SUCH DAMAGES. 41 * POSSIBILITY OF SUCH DAMAGES.
42 */ 42 */
43 43
44
45#include <acpi/acpi.h> 44#include <acpi/acpi.h>
46#include <acpi/acinterp.h> 45#include <acpi/acinterp.h>
47#include <acpi/amlcode.h> 46#include <acpi/amlcode.h>
48#include <acpi/acevents.h> 47#include <acpi/acevents.h>
49#include <acpi/acdispat.h> 48#include <acpi/acdispat.h>
50 49
51
52#define _COMPONENT ACPI_EXECUTER 50#define _COMPONENT ACPI_EXECUTER
53 ACPI_MODULE_NAME ("exfldio") 51ACPI_MODULE_NAME("exfldio")
54 52
55/* Local prototypes */ 53/* Local prototypes */
56
57static acpi_status 54static acpi_status
58acpi_ex_field_datum_io ( 55acpi_ex_field_datum_io(union acpi_operand_object *obj_desc,
59 union acpi_operand_object *obj_desc, 56 u32 field_datum_byte_offset,
60 u32 field_datum_byte_offset, 57 acpi_integer * value, u32 read_write);
61 acpi_integer *value,
62 u32 read_write);
63 58
64static u8 59static u8
65acpi_ex_register_overflow ( 60acpi_ex_register_overflow(union acpi_operand_object *obj_desc,
66 union acpi_operand_object *obj_desc, 61 acpi_integer value);
67 acpi_integer value);
68 62
69static acpi_status 63static acpi_status
70acpi_ex_setup_region ( 64acpi_ex_setup_region(union acpi_operand_object *obj_desc,
71 union acpi_operand_object *obj_desc, 65 u32 field_datum_byte_offset);
72 u32 field_datum_byte_offset);
73
74 66
75/******************************************************************************* 67/*******************************************************************************
76 * 68 *
@@ -89,27 +81,25 @@ acpi_ex_setup_region (
89 ******************************************************************************/ 81 ******************************************************************************/
90 82
91static acpi_status 83static acpi_status
92acpi_ex_setup_region ( 84acpi_ex_setup_region(union acpi_operand_object *obj_desc,
93 union acpi_operand_object *obj_desc, 85 u32 field_datum_byte_offset)
94 u32 field_datum_byte_offset)
95{ 86{
96 acpi_status status = AE_OK; 87 acpi_status status = AE_OK;
97 union acpi_operand_object *rgn_desc; 88 union acpi_operand_object *rgn_desc;
98
99
100 ACPI_FUNCTION_TRACE_U32 ("ex_setup_region", field_datum_byte_offset);
101 89
90 ACPI_FUNCTION_TRACE_U32("ex_setup_region", field_datum_byte_offset);
102 91
103 rgn_desc = obj_desc->common_field.region_obj; 92 rgn_desc = obj_desc->common_field.region_obj;
104 93
105 /* We must have a valid region */ 94 /* We must have a valid region */
106 95
107 if (ACPI_GET_OBJECT_TYPE (rgn_desc) != ACPI_TYPE_REGION) { 96 if (ACPI_GET_OBJECT_TYPE(rgn_desc) != ACPI_TYPE_REGION) {
108 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Needed Region, found type %X (%s)\n", 97 ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
109 ACPI_GET_OBJECT_TYPE (rgn_desc), 98 "Needed Region, found type %X (%s)\n",
110 acpi_ut_get_object_type_name (rgn_desc))); 99 ACPI_GET_OBJECT_TYPE(rgn_desc),
100 acpi_ut_get_object_type_name(rgn_desc)));
111 101
112 return_ACPI_STATUS (AE_AML_OPERAND_TYPE); 102 return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
113 } 103 }
114 104
115 /* 105 /*
@@ -117,26 +107,25 @@ acpi_ex_setup_region (
117 * evaluate them now and save the results. 107 * evaluate them now and save the results.
118 */ 108 */
119 if (!(rgn_desc->common.flags & AOPOBJ_DATA_VALID)) { 109 if (!(rgn_desc->common.flags & AOPOBJ_DATA_VALID)) {
120 status = acpi_ds_get_region_arguments (rgn_desc); 110 status = acpi_ds_get_region_arguments(rgn_desc);
121 if (ACPI_FAILURE (status)) { 111 if (ACPI_FAILURE(status)) {
122 return_ACPI_STATUS (status); 112 return_ACPI_STATUS(status);
123 } 113 }
124 } 114 }
125 115
126 if (rgn_desc->region.space_id == ACPI_ADR_SPACE_SMBUS) { 116 if (rgn_desc->region.space_id == ACPI_ADR_SPACE_SMBUS) {
127 /* SMBus has a non-linear address space */ 117 /* SMBus has a non-linear address space */
128 118
129 return_ACPI_STATUS (AE_OK); 119 return_ACPI_STATUS(AE_OK);
130 } 120 }
131
132#ifdef ACPI_UNDER_DEVELOPMENT 121#ifdef ACPI_UNDER_DEVELOPMENT
133 /* 122 /*
134 * If the Field access is any_acc, we can now compute the optimal 123 * If the Field access is any_acc, we can now compute the optimal
135 * access (because we know know the length of the parent region) 124 * access (because we know know the length of the parent region)
136 */ 125 */
137 if (!(obj_desc->common.flags & AOPOBJ_DATA_VALID)) { 126 if (!(obj_desc->common.flags & AOPOBJ_DATA_VALID)) {
138 if (ACPI_FAILURE (status)) { 127 if (ACPI_FAILURE(status)) {
139 return_ACPI_STATUS (status); 128 return_ACPI_STATUS(status);
140 } 129 }
141 } 130 }
142#endif 131#endif
@@ -147,56 +136,64 @@ acpi_ex_setup_region (
147 * (Region length is specified in bytes) 136 * (Region length is specified in bytes)
148 */ 137 */
149 if (rgn_desc->region.length < (obj_desc->common_field.base_byte_offset + 138 if (rgn_desc->region.length < (obj_desc->common_field.base_byte_offset +
150 field_datum_byte_offset + 139 field_datum_byte_offset +
151 obj_desc->common_field.access_byte_width)) { 140 obj_desc->common_field.
141 access_byte_width)) {
152 if (acpi_gbl_enable_interpreter_slack) { 142 if (acpi_gbl_enable_interpreter_slack) {
153 /* 143 /*
154 * Slack mode only: We will go ahead and allow access to this 144 * Slack mode only: We will go ahead and allow access to this
155 * field if it is within the region length rounded up to the next 145 * field if it is within the region length rounded up to the next
156 * access width boundary. 146 * access width boundary.
157 */ 147 */
158 if (ACPI_ROUND_UP (rgn_desc->region.length, 148 if (ACPI_ROUND_UP(rgn_desc->region.length,
159 obj_desc->common_field.access_byte_width) >= 149 obj_desc->common_field.
160 (obj_desc->common_field.base_byte_offset + 150 access_byte_width) >=
161 (acpi_native_uint) obj_desc->common_field.access_byte_width + 151 (obj_desc->common_field.base_byte_offset +
162 field_datum_byte_offset)) { 152 (acpi_native_uint) obj_desc->common_field.
163 return_ACPI_STATUS (AE_OK); 153 access_byte_width + field_datum_byte_offset)) {
154 return_ACPI_STATUS(AE_OK);
164 } 155 }
165 } 156 }
166 157
167 if (rgn_desc->region.length < obj_desc->common_field.access_byte_width) { 158 if (rgn_desc->region.length <
159 obj_desc->common_field.access_byte_width) {
168 /* 160 /*
169 * This is the case where the access_type (acc_word, etc.) is wider 161 * This is the case where the access_type (acc_word, etc.) is wider
170 * than the region itself. For example, a region of length one 162 * than the region itself. For example, a region of length one
171 * byte, and a field with Dword access specified. 163 * byte, and a field with Dword access specified.
172 */ 164 */
173 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, 165 ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
174 "Field [%4.4s] access width (%d bytes) too large for region [%4.4s] (length %X)\n", 166 "Field [%4.4s] access width (%d bytes) too large for region [%4.4s] (length %X)\n",
175 acpi_ut_get_node_name (obj_desc->common_field.node), 167 acpi_ut_get_node_name(obj_desc->
176 obj_desc->common_field.access_byte_width, 168 common_field.
177 acpi_ut_get_node_name (rgn_desc->region.node), 169 node),
178 rgn_desc->region.length)); 170 obj_desc->common_field.
171 access_byte_width,
172 acpi_ut_get_node_name(rgn_desc->
173 region.node),
174 rgn_desc->region.length));
179 } 175 }
180 176
181 /* 177 /*
182 * Offset rounded up to next multiple of field width 178 * Offset rounded up to next multiple of field width
183 * exceeds region length, indicate an error 179 * exceeds region length, indicate an error
184 */ 180 */
185 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, 181 ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
186 "Field [%4.4s] Base+Offset+Width %X+%X+%X is beyond end of region [%4.4s] (length %X)\n", 182 "Field [%4.4s] Base+Offset+Width %X+%X+%X is beyond end of region [%4.4s] (length %X)\n",
187 acpi_ut_get_node_name (obj_desc->common_field.node), 183 acpi_ut_get_node_name(obj_desc->common_field.
188 obj_desc->common_field.base_byte_offset, 184 node),
189 field_datum_byte_offset, obj_desc->common_field.access_byte_width, 185 obj_desc->common_field.base_byte_offset,
190 acpi_ut_get_node_name (rgn_desc->region.node), 186 field_datum_byte_offset,
191 rgn_desc->region.length)); 187 obj_desc->common_field.access_byte_width,
192 188 acpi_ut_get_node_name(rgn_desc->region.node),
193 return_ACPI_STATUS (AE_AML_REGION_LIMIT); 189 rgn_desc->region.length));
190
191 return_ACPI_STATUS(AE_AML_REGION_LIMIT);
194 } 192 }
195 193
196 return_ACPI_STATUS (AE_OK); 194 return_ACPI_STATUS(AE_OK);
197} 195}
198 196
199
200/******************************************************************************* 197/*******************************************************************************
201 * 198 *
202 * FUNCTION: acpi_ex_access_region 199 * FUNCTION: acpi_ex_access_region
@@ -216,27 +213,23 @@ acpi_ex_setup_region (
216 ******************************************************************************/ 213 ******************************************************************************/
217 214
218acpi_status 215acpi_status
219acpi_ex_access_region ( 216acpi_ex_access_region(union acpi_operand_object *obj_desc,
220 union acpi_operand_object *obj_desc, 217 u32 field_datum_byte_offset,
221 u32 field_datum_byte_offset, 218 acpi_integer * value, u32 function)
222 acpi_integer *value,
223 u32 function)
224{ 219{
225 acpi_status status; 220 acpi_status status;
226 union acpi_operand_object *rgn_desc; 221 union acpi_operand_object *rgn_desc;
227 acpi_physical_address address; 222 acpi_physical_address address;
228
229
230 ACPI_FUNCTION_TRACE ("ex_access_region");
231 223
224 ACPI_FUNCTION_TRACE("ex_access_region");
232 225
233 /* 226 /*
234 * Ensure that the region operands are fully evaluated and verify 227 * Ensure that the region operands are fully evaluated and verify
235 * the validity of the request 228 * the validity of the request
236 */ 229 */
237 status = acpi_ex_setup_region (obj_desc, field_datum_byte_offset); 230 status = acpi_ex_setup_region(obj_desc, field_datum_byte_offset);
238 if (ACPI_FAILURE (status)) { 231 if (ACPI_FAILURE(status)) {
239 return_ACPI_STATUS (status); 232 return_ACPI_STATUS(status);
240 } 233 }
241 234
242 /* 235 /*
@@ -248,50 +241,53 @@ acpi_ex_access_region (
248 */ 241 */
249 rgn_desc = obj_desc->common_field.region_obj; 242 rgn_desc = obj_desc->common_field.region_obj;
250 address = rgn_desc->region.address + 243 address = rgn_desc->region.address +
251 obj_desc->common_field.base_byte_offset + 244 obj_desc->common_field.base_byte_offset + field_datum_byte_offset;
252 field_datum_byte_offset;
253 245
254 if ((function & ACPI_IO_MASK) == ACPI_READ) { 246 if ((function & ACPI_IO_MASK) == ACPI_READ) {
255 ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, "[READ]")); 247 ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, "[READ]"));
256 } 248 } else {
257 else { 249 ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, "[WRITE]"));
258 ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, "[WRITE]"));
259 } 250 }
260 251
261 ACPI_DEBUG_PRINT_RAW ((ACPI_DB_BFIELD, 252 ACPI_DEBUG_PRINT_RAW((ACPI_DB_BFIELD,
262 " Region [%s:%X], Width %X, byte_base %X, Offset %X at %8.8X%8.8X\n", 253 " Region [%s:%X], Width %X, byte_base %X, Offset %X at %8.8X%8.8X\n",
263 acpi_ut_get_region_name (rgn_desc->region.space_id), 254 acpi_ut_get_region_name(rgn_desc->region.
264 rgn_desc->region.space_id, 255 space_id),
265 obj_desc->common_field.access_byte_width, 256 rgn_desc->region.space_id,
266 obj_desc->common_field.base_byte_offset, 257 obj_desc->common_field.access_byte_width,
267 field_datum_byte_offset, 258 obj_desc->common_field.base_byte_offset,
268 ACPI_FORMAT_UINT64 (address))); 259 field_datum_byte_offset,
260 ACPI_FORMAT_UINT64(address)));
269 261
270 /* Invoke the appropriate address_space/op_region handler */ 262 /* Invoke the appropriate address_space/op_region handler */
271 263
272 status = acpi_ev_address_space_dispatch (rgn_desc, function, 264 status = acpi_ev_address_space_dispatch(rgn_desc, function,
273 address, 265 address,
274 ACPI_MUL_8 (obj_desc->common_field.access_byte_width), value); 266 ACPI_MUL_8(obj_desc->
267 common_field.
268 access_byte_width),
269 value);
275 270
276 if (ACPI_FAILURE (status)) { 271 if (ACPI_FAILURE(status)) {
277 if (status == AE_NOT_IMPLEMENTED) { 272 if (status == AE_NOT_IMPLEMENTED) {
278 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, 273 ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
279 "Region %s(%X) not implemented\n", 274 "Region %s(%X) not implemented\n",
280 acpi_ut_get_region_name (rgn_desc->region.space_id), 275 acpi_ut_get_region_name(rgn_desc->
281 rgn_desc->region.space_id)); 276 region.
282 } 277 space_id),
283 else if (status == AE_NOT_EXIST) { 278 rgn_desc->region.space_id));
284 ACPI_REPORT_ERROR (( 279 } else if (status == AE_NOT_EXIST) {
285 "Region %s(%X) has no handler\n", 280 ACPI_REPORT_ERROR(("Region %s(%X) has no handler\n",
286 acpi_ut_get_region_name (rgn_desc->region.space_id), 281 acpi_ut_get_region_name(rgn_desc->
287 rgn_desc->region.space_id)); 282 region.
283 space_id),
284 rgn_desc->region.space_id));
288 } 285 }
289 } 286 }
290 287
291 return_ACPI_STATUS (status); 288 return_ACPI_STATUS(status);
292} 289}
293 290
294
295/******************************************************************************* 291/*******************************************************************************
296 * 292 *
297 * FUNCTION: acpi_ex_register_overflow 293 * FUNCTION: acpi_ex_register_overflow
@@ -310,9 +306,8 @@ acpi_ex_access_region (
310 ******************************************************************************/ 306 ******************************************************************************/
311 307
312static u8 308static u8
313acpi_ex_register_overflow ( 309acpi_ex_register_overflow(union acpi_operand_object *obj_desc,
314 union acpi_operand_object *obj_desc, 310 acpi_integer value)
315 acpi_integer value)
316{ 311{
317 312
318 if (obj_desc->common_field.bit_length >= ACPI_INTEGER_BIT_SIZE) { 313 if (obj_desc->common_field.bit_length >= ACPI_INTEGER_BIT_SIZE) {
@@ -336,7 +331,6 @@ acpi_ex_register_overflow (
336 return (FALSE); 331 return (FALSE);
337} 332}
338 333
339
340/******************************************************************************* 334/*******************************************************************************
341 * 335 *
342 * FUNCTION: acpi_ex_field_datum_io 336 * FUNCTION: acpi_ex_field_datum_io
@@ -356,18 +350,14 @@ acpi_ex_register_overflow (
356 ******************************************************************************/ 350 ******************************************************************************/
357 351
358static acpi_status 352static acpi_status
359acpi_ex_field_datum_io ( 353acpi_ex_field_datum_io(union acpi_operand_object *obj_desc,
360 union acpi_operand_object *obj_desc, 354 u32 field_datum_byte_offset,
361 u32 field_datum_byte_offset, 355 acpi_integer * value, u32 read_write)
362 acpi_integer *value,
363 u32 read_write)
364{ 356{
365 acpi_status status; 357 acpi_status status;
366 acpi_integer local_value; 358 acpi_integer local_value;
367
368
369 ACPI_FUNCTION_TRACE_U32 ("ex_field_datum_io", field_datum_byte_offset);
370 359
360 ACPI_FUNCTION_TRACE_U32("ex_field_datum_io", field_datum_byte_offset);
371 361
372 if (read_write == ACPI_READ) { 362 if (read_write == ACPI_READ) {
373 if (!value) { 363 if (!value) {
@@ -392,16 +382,16 @@ acpi_ex_field_datum_io (
392 * index_field - Write to an Index Register, then read/write from/to a 382 * index_field - Write to an Index Register, then read/write from/to a
393 * Data Register 383 * Data Register
394 */ 384 */
395 switch (ACPI_GET_OBJECT_TYPE (obj_desc)) { 385 switch (ACPI_GET_OBJECT_TYPE(obj_desc)) {
396 case ACPI_TYPE_BUFFER_FIELD: 386 case ACPI_TYPE_BUFFER_FIELD:
397 /* 387 /*
398 * If the buffer_field arguments have not been previously evaluated, 388 * If the buffer_field arguments have not been previously evaluated,
399 * evaluate them now and save the results. 389 * evaluate them now and save the results.
400 */ 390 */
401 if (!(obj_desc->common.flags & AOPOBJ_DATA_VALID)) { 391 if (!(obj_desc->common.flags & AOPOBJ_DATA_VALID)) {
402 status = acpi_ds_get_buffer_field_arguments (obj_desc); 392 status = acpi_ds_get_buffer_field_arguments(obj_desc);
403 if (ACPI_FAILURE (status)) { 393 if (ACPI_FAILURE(status)) {
404 return_ACPI_STATUS (status); 394 return_ACPI_STATUS(status);
405 } 395 }
406 } 396 }
407 397
@@ -410,47 +400,50 @@ acpi_ex_field_datum_io (
410 * Copy the data from the source buffer. 400 * Copy the data from the source buffer.
411 * Length is the field width in bytes. 401 * Length is the field width in bytes.
412 */ 402 */
413 ACPI_MEMCPY (value, 403 ACPI_MEMCPY(value,
414 (obj_desc->buffer_field.buffer_obj)->buffer.pointer + 404 (obj_desc->buffer_field.buffer_obj)->buffer.
415 obj_desc->buffer_field.base_byte_offset + 405 pointer +
416 field_datum_byte_offset, 406 obj_desc->buffer_field.base_byte_offset +
417 obj_desc->common_field.access_byte_width); 407 field_datum_byte_offset,
418 } 408 obj_desc->common_field.access_byte_width);
419 else { 409 } else {
420 /* 410 /*
421 * Copy the data to the target buffer. 411 * Copy the data to the target buffer.
422 * Length is the field width in bytes. 412 * Length is the field width in bytes.
423 */ 413 */
424 ACPI_MEMCPY ((obj_desc->buffer_field.buffer_obj)->buffer.pointer + 414 ACPI_MEMCPY((obj_desc->buffer_field.buffer_obj)->buffer.
425 obj_desc->buffer_field.base_byte_offset + 415 pointer +
426 field_datum_byte_offset, 416 obj_desc->buffer_field.base_byte_offset +
427 value, obj_desc->common_field.access_byte_width); 417 field_datum_byte_offset, value,
418 obj_desc->common_field.access_byte_width);
428 } 419 }
429 420
430 status = AE_OK; 421 status = AE_OK;
431 break; 422 break;
432 423
433
434 case ACPI_TYPE_LOCAL_BANK_FIELD: 424 case ACPI_TYPE_LOCAL_BANK_FIELD:
435 425
436 /* 426 /*
437 * Ensure that the bank_value is not beyond the capacity of 427 * Ensure that the bank_value is not beyond the capacity of
438 * the register 428 * the register
439 */ 429 */
440 if (acpi_ex_register_overflow (obj_desc->bank_field.bank_obj, 430 if (acpi_ex_register_overflow(obj_desc->bank_field.bank_obj,
441 (acpi_integer) obj_desc->bank_field.value)) { 431 (acpi_integer) obj_desc->
442 return_ACPI_STATUS (AE_AML_REGISTER_LIMIT); 432 bank_field.value)) {
433 return_ACPI_STATUS(AE_AML_REGISTER_LIMIT);
443 } 434 }
444 435
445 /* 436 /*
446 * For bank_fields, we must write the bank_value to the bank_register 437 * For bank_fields, we must write the bank_value to the bank_register
447 * (itself a region_field) before we can access the data. 438 * (itself a region_field) before we can access the data.
448 */ 439 */
449 status = acpi_ex_insert_into_field (obj_desc->bank_field.bank_obj, 440 status =
450 &obj_desc->bank_field.value, 441 acpi_ex_insert_into_field(obj_desc->bank_field.bank_obj,
451 sizeof (obj_desc->bank_field.value)); 442 &obj_desc->bank_field.value,
452 if (ACPI_FAILURE (status)) { 443 sizeof(obj_desc->bank_field.
453 return_ACPI_STATUS (status); 444 value));
445 if (ACPI_FAILURE(status)) {
446 return_ACPI_STATUS(status);
454 } 447 }
455 448
456 /* 449 /*
@@ -460,90 +453,92 @@ acpi_ex_field_datum_io (
460 453
461 /*lint -fallthrough */ 454 /*lint -fallthrough */
462 455
463
464 case ACPI_TYPE_LOCAL_REGION_FIELD: 456 case ACPI_TYPE_LOCAL_REGION_FIELD:
465 /* 457 /*
466 * For simple region_fields, we just directly access the owning 458 * For simple region_fields, we just directly access the owning
467 * Operation Region. 459 * Operation Region.
468 */ 460 */
469 status = acpi_ex_access_region (obj_desc, field_datum_byte_offset, value, 461 status =
470 read_write); 462 acpi_ex_access_region(obj_desc, field_datum_byte_offset,
463 value, read_write);
471 break; 464 break;
472 465
473
474 case ACPI_TYPE_LOCAL_INDEX_FIELD: 466 case ACPI_TYPE_LOCAL_INDEX_FIELD:
475 467
476
477 /* 468 /*
478 * Ensure that the index_value is not beyond the capacity of 469 * Ensure that the index_value is not beyond the capacity of
479 * the register 470 * the register
480 */ 471 */
481 if (acpi_ex_register_overflow (obj_desc->index_field.index_obj, 472 if (acpi_ex_register_overflow(obj_desc->index_field.index_obj,
482 (acpi_integer) obj_desc->index_field.value)) { 473 (acpi_integer) obj_desc->
483 return_ACPI_STATUS (AE_AML_REGISTER_LIMIT); 474 index_field.value)) {
475 return_ACPI_STATUS(AE_AML_REGISTER_LIMIT);
484 } 476 }
485 477
486 /* Write the index value to the index_register (itself a region_field) */ 478 /* Write the index value to the index_register (itself a region_field) */
487 479
488 field_datum_byte_offset += obj_desc->index_field.value; 480 field_datum_byte_offset += obj_desc->index_field.value;
489 481
490 ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, 482 ACPI_DEBUG_PRINT((ACPI_DB_BFIELD,
491 "Write to Index Register: Value %8.8X\n", 483 "Write to Index Register: Value %8.8X\n",
492 field_datum_byte_offset)); 484 field_datum_byte_offset));
493 485
494 status = acpi_ex_insert_into_field (obj_desc->index_field.index_obj, 486 status =
495 &field_datum_byte_offset, 487 acpi_ex_insert_into_field(obj_desc->index_field.index_obj,
496 sizeof (field_datum_byte_offset)); 488 &field_datum_byte_offset,
497 if (ACPI_FAILURE (status)) { 489 sizeof(field_datum_byte_offset));
498 return_ACPI_STATUS (status); 490 if (ACPI_FAILURE(status)) {
491 return_ACPI_STATUS(status);
499 } 492 }
500 493
501 ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, 494 ACPI_DEBUG_PRINT((ACPI_DB_BFIELD,
502 "I/O to Data Register: value_ptr %p\n", 495 "I/O to Data Register: value_ptr %p\n",
503 value)); 496 value));
504 497
505 if (read_write == ACPI_READ) { 498 if (read_write == ACPI_READ) {
506 /* Read the datum from the data_register */ 499 /* Read the datum from the data_register */
507 500
508 status = acpi_ex_extract_from_field (obj_desc->index_field.data_obj, 501 status =
509 value, sizeof (acpi_integer)); 502 acpi_ex_extract_from_field(obj_desc->index_field.
510 } 503 data_obj, value,
511 else { 504 sizeof(acpi_integer));
505 } else {
512 /* Write the datum to the data_register */ 506 /* Write the datum to the data_register */
513 507
514 status = acpi_ex_insert_into_field (obj_desc->index_field.data_obj, 508 status =
515 value, sizeof (acpi_integer)); 509 acpi_ex_insert_into_field(obj_desc->index_field.
510 data_obj, value,
511 sizeof(acpi_integer));
516 } 512 }
517 break; 513 break;
518 514
519
520 default: 515 default:
521 516
522 ACPI_REPORT_ERROR (("Wrong object type in field I/O %X\n", 517 ACPI_REPORT_ERROR(("Wrong object type in field I/O %X\n",
523 ACPI_GET_OBJECT_TYPE (obj_desc))); 518 ACPI_GET_OBJECT_TYPE(obj_desc)));
524 status = AE_AML_INTERNAL; 519 status = AE_AML_INTERNAL;
525 break; 520 break;
526 } 521 }
527 522
528 if (ACPI_SUCCESS (status)) { 523 if (ACPI_SUCCESS(status)) {
529 if (read_write == ACPI_READ) { 524 if (read_write == ACPI_READ) {
530 ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, 525 ACPI_DEBUG_PRINT((ACPI_DB_BFIELD,
531 "Value Read %8.8X%8.8X, Width %d\n", 526 "Value Read %8.8X%8.8X, Width %d\n",
532 ACPI_FORMAT_UINT64 (*value), 527 ACPI_FORMAT_UINT64(*value),
533 obj_desc->common_field.access_byte_width)); 528 obj_desc->common_field.
534 } 529 access_byte_width));
535 else { 530 } else {
536 ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, 531 ACPI_DEBUG_PRINT((ACPI_DB_BFIELD,
537 "Value Written %8.8X%8.8X, Width %d\n", 532 "Value Written %8.8X%8.8X, Width %d\n",
538 ACPI_FORMAT_UINT64 (*value), 533 ACPI_FORMAT_UINT64(*value),
539 obj_desc->common_field.access_byte_width)); 534 obj_desc->common_field.
535 access_byte_width));
540 } 536 }
541 } 537 }
542 538
543 return_ACPI_STATUS (status); 539 return_ACPI_STATUS(status);
544} 540}
545 541
546
547/******************************************************************************* 542/*******************************************************************************
548 * 543 *
549 * FUNCTION: acpi_ex_write_with_update_rule 544 * FUNCTION: acpi_ex_write_with_update_rule
@@ -560,19 +555,16 @@ acpi_ex_field_datum_io (
560 ******************************************************************************/ 555 ******************************************************************************/
561 556
562acpi_status 557acpi_status
563acpi_ex_write_with_update_rule ( 558acpi_ex_write_with_update_rule(union acpi_operand_object *obj_desc,
564 union acpi_operand_object *obj_desc, 559 acpi_integer mask,
565 acpi_integer mask, 560 acpi_integer field_value,
566 acpi_integer field_value, 561 u32 field_datum_byte_offset)
567 u32 field_datum_byte_offset)
568{ 562{
569 acpi_status status = AE_OK; 563 acpi_status status = AE_OK;
570 acpi_integer merged_value; 564 acpi_integer merged_value;
571 acpi_integer current_value; 565 acpi_integer current_value;
572
573
574 ACPI_FUNCTION_TRACE_U32 ("ex_write_with_update_rule", mask);
575 566
567 ACPI_FUNCTION_TRACE_U32("ex_write_with_update_rule", mask);
576 568
577 /* Start with the new bits */ 569 /* Start with the new bits */
578 570
@@ -583,22 +575,27 @@ acpi_ex_write_with_update_rule (
583 if (mask != ACPI_INTEGER_MAX) { 575 if (mask != ACPI_INTEGER_MAX) {
584 /* Decode the update rule */ 576 /* Decode the update rule */
585 577
586 switch (obj_desc->common_field.field_flags & AML_FIELD_UPDATE_RULE_MASK) { 578 switch (obj_desc->common_field.
579 field_flags & AML_FIELD_UPDATE_RULE_MASK) {
587 case AML_FIELD_UPDATE_PRESERVE: 580 case AML_FIELD_UPDATE_PRESERVE:
588 /* 581 /*
589 * Check if update rule needs to be applied (not if mask is all 582 * Check if update rule needs to be applied (not if mask is all
590 * ones) The left shift drops the bits we want to ignore. 583 * ones) The left shift drops the bits we want to ignore.
591 */ 584 */
592 if ((~mask << (ACPI_MUL_8 (sizeof (mask)) - 585 if ((~mask << (ACPI_MUL_8(sizeof(mask)) -
593 ACPI_MUL_8 (obj_desc->common_field.access_byte_width))) != 0) { 586 ACPI_MUL_8(obj_desc->common_field.
587 access_byte_width))) != 0) {
594 /* 588 /*
595 * Read the current contents of the byte/word/dword containing 589 * Read the current contents of the byte/word/dword containing
596 * the field, and merge with the new field value. 590 * the field, and merge with the new field value.
597 */ 591 */
598 status = acpi_ex_field_datum_io (obj_desc, field_datum_byte_offset, 592 status =
599 &current_value, ACPI_READ); 593 acpi_ex_field_datum_io(obj_desc,
600 if (ACPI_FAILURE (status)) { 594 field_datum_byte_offset,
601 return_ACPI_STATUS (status); 595 &current_value,
596 ACPI_READ);
597 if (ACPI_FAILURE(status)) {
598 return_ACPI_STATUS(status);
602 } 599 }
603 600
604 merged_value |= (current_value & ~mask); 601 merged_value |= (current_value & ~mask);
@@ -621,30 +618,31 @@ acpi_ex_write_with_update_rule (
621 618
622 default: 619 default:
623 620
624 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, 621 ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
625 "write_with_update_rule: Unknown update_rule setting: %X\n", 622 "write_with_update_rule: Unknown update_rule setting: %X\n",
626 (obj_desc->common_field.field_flags & AML_FIELD_UPDATE_RULE_MASK))); 623 (obj_desc->common_field.
627 return_ACPI_STATUS (AE_AML_OPERAND_VALUE); 624 field_flags &
625 AML_FIELD_UPDATE_RULE_MASK)));
626 return_ACPI_STATUS(AE_AML_OPERAND_VALUE);
628 } 627 }
629 } 628 }
630 629
631 ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, 630 ACPI_DEBUG_PRINT((ACPI_DB_BFIELD,
632 "Mask %8.8X%8.8X, datum_offset %X, Width %X, Value %8.8X%8.8X, merged_value %8.8X%8.8X\n", 631 "Mask %8.8X%8.8X, datum_offset %X, Width %X, Value %8.8X%8.8X, merged_value %8.8X%8.8X\n",
633 ACPI_FORMAT_UINT64 (mask), 632 ACPI_FORMAT_UINT64(mask),
634 field_datum_byte_offset, 633 field_datum_byte_offset,
635 obj_desc->common_field.access_byte_width, 634 obj_desc->common_field.access_byte_width,
636 ACPI_FORMAT_UINT64 (field_value), 635 ACPI_FORMAT_UINT64(field_value),
637 ACPI_FORMAT_UINT64 (merged_value))); 636 ACPI_FORMAT_UINT64(merged_value)));
638 637
639 /* Write the merged value */ 638 /* Write the merged value */
640 639
641 status = acpi_ex_field_datum_io (obj_desc, field_datum_byte_offset, 640 status = acpi_ex_field_datum_io(obj_desc, field_datum_byte_offset,
642 &merged_value, ACPI_WRITE); 641 &merged_value, ACPI_WRITE);
643 642
644 return_ACPI_STATUS (status); 643 return_ACPI_STATUS(status);
645} 644}
646 645
647
648/******************************************************************************* 646/*******************************************************************************
649 * 647 *
650 * FUNCTION: acpi_ex_extract_from_field 648 * FUNCTION: acpi_ex_extract_from_field
@@ -660,54 +658,54 @@ acpi_ex_write_with_update_rule (
660 ******************************************************************************/ 658 ******************************************************************************/
661 659
662acpi_status 660acpi_status
663acpi_ex_extract_from_field ( 661acpi_ex_extract_from_field(union acpi_operand_object *obj_desc,
664 union acpi_operand_object *obj_desc, 662 void *buffer, u32 buffer_length)
665 void *buffer,
666 u32 buffer_length)
667{ 663{
668 acpi_status status; 664 acpi_status status;
669 acpi_integer raw_datum; 665 acpi_integer raw_datum;
670 acpi_integer merged_datum; 666 acpi_integer merged_datum;
671 u32 field_offset = 0; 667 u32 field_offset = 0;
672 u32 buffer_offset = 0; 668 u32 buffer_offset = 0;
673 u32 buffer_tail_bits; 669 u32 buffer_tail_bits;
674 u32 datum_count; 670 u32 datum_count;
675 u32 field_datum_count; 671 u32 field_datum_count;
676 u32 i; 672 u32 i;
677 673
678 674 ACPI_FUNCTION_TRACE("ex_extract_from_field");
679 ACPI_FUNCTION_TRACE ("ex_extract_from_field");
680
681 675
682 /* Validate target buffer and clear it */ 676 /* Validate target buffer and clear it */
683 677
684 if (buffer_length < ACPI_ROUND_BITS_UP_TO_BYTES ( 678 if (buffer_length <
685 obj_desc->common_field.bit_length)) { 679 ACPI_ROUND_BITS_UP_TO_BYTES(obj_desc->common_field.bit_length)) {
686 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, 680 ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
687 "Field size %X (bits) is too large for buffer (%X)\n", 681 "Field size %X (bits) is too large for buffer (%X)\n",
688 obj_desc->common_field.bit_length, buffer_length)); 682 obj_desc->common_field.bit_length,
683 buffer_length));
689 684
690 return_ACPI_STATUS (AE_BUFFER_OVERFLOW); 685 return_ACPI_STATUS(AE_BUFFER_OVERFLOW);
691 } 686 }
692 ACPI_MEMSET (buffer, 0, buffer_length); 687 ACPI_MEMSET(buffer, 0, buffer_length);
693 688
694 /* Compute the number of datums (access width data items) */ 689 /* Compute the number of datums (access width data items) */
695 690
696 datum_count = ACPI_ROUND_UP_TO ( 691 datum_count = ACPI_ROUND_UP_TO(obj_desc->common_field.bit_length,
697 obj_desc->common_field.bit_length, 692 obj_desc->common_field.access_bit_width);
698 obj_desc->common_field.access_bit_width); 693 field_datum_count = ACPI_ROUND_UP_TO(obj_desc->common_field.bit_length +
699 field_datum_count = ACPI_ROUND_UP_TO ( 694 obj_desc->common_field.
700 obj_desc->common_field.bit_length + 695 start_field_bit_offset,
701 obj_desc->common_field.start_field_bit_offset, 696 obj_desc->common_field.
702 obj_desc->common_field.access_bit_width); 697 access_bit_width);
703 698
704 /* Priming read from the field */ 699 /* Priming read from the field */
705 700
706 status = acpi_ex_field_datum_io (obj_desc, field_offset, &raw_datum, ACPI_READ); 701 status =
707 if (ACPI_FAILURE (status)) { 702 acpi_ex_field_datum_io(obj_desc, field_offset, &raw_datum,
708 return_ACPI_STATUS (status); 703 ACPI_READ);
704 if (ACPI_FAILURE(status)) {
705 return_ACPI_STATUS(status);
709 } 706 }
710 merged_datum = raw_datum >> obj_desc->common_field.start_field_bit_offset; 707 merged_datum =
708 raw_datum >> obj_desc->common_field.start_field_bit_offset;
711 709
712 /* Read the rest of the field */ 710 /* Read the rest of the field */
713 711
@@ -715,17 +713,17 @@ acpi_ex_extract_from_field (
715 /* Get next input datum from the field */ 713 /* Get next input datum from the field */
716 714
717 field_offset += obj_desc->common_field.access_byte_width; 715 field_offset += obj_desc->common_field.access_byte_width;
718 status = acpi_ex_field_datum_io (obj_desc, field_offset, 716 status = acpi_ex_field_datum_io(obj_desc, field_offset,
719 &raw_datum, ACPI_READ); 717 &raw_datum, ACPI_READ);
720 if (ACPI_FAILURE (status)) { 718 if (ACPI_FAILURE(status)) {
721 return_ACPI_STATUS (status); 719 return_ACPI_STATUS(status);
722 } 720 }
723 721
724 /* Merge with previous datum if necessary */ 722 /* Merge with previous datum if necessary */
725 723
726 merged_datum |= raw_datum << 724 merged_datum |= raw_datum <<
727 (obj_desc->common_field.access_bit_width - 725 (obj_desc->common_field.access_bit_width -
728 obj_desc->common_field.start_field_bit_offset); 726 obj_desc->common_field.start_field_bit_offset);
729 727
730 if (i == datum_count) { 728 if (i == datum_count) {
731 break; 729 break;
@@ -733,32 +731,32 @@ acpi_ex_extract_from_field (
733 731
734 /* Write merged datum to target buffer */ 732 /* Write merged datum to target buffer */
735 733
736 ACPI_MEMCPY (((char *) buffer) + buffer_offset, &merged_datum, 734 ACPI_MEMCPY(((char *)buffer) + buffer_offset, &merged_datum,
737 ACPI_MIN(obj_desc->common_field.access_byte_width, 735 ACPI_MIN(obj_desc->common_field.access_byte_width,
738 buffer_length - buffer_offset)); 736 buffer_length - buffer_offset));
739 737
740 buffer_offset += obj_desc->common_field.access_byte_width; 738 buffer_offset += obj_desc->common_field.access_byte_width;
741 merged_datum = raw_datum >> obj_desc->common_field.start_field_bit_offset; 739 merged_datum =
740 raw_datum >> obj_desc->common_field.start_field_bit_offset;
742 } 741 }
743 742
744 /* Mask off any extra bits in the last datum */ 743 /* Mask off any extra bits in the last datum */
745 744
746 buffer_tail_bits = obj_desc->common_field.bit_length % 745 buffer_tail_bits = obj_desc->common_field.bit_length %
747 obj_desc->common_field.access_bit_width; 746 obj_desc->common_field.access_bit_width;
748 if (buffer_tail_bits) { 747 if (buffer_tail_bits) {
749 merged_datum &= ACPI_MASK_BITS_ABOVE (buffer_tail_bits); 748 merged_datum &= ACPI_MASK_BITS_ABOVE(buffer_tail_bits);
750 } 749 }
751 750
752 /* Write the last datum to the buffer */ 751 /* Write the last datum to the buffer */
753 752
754 ACPI_MEMCPY (((char *) buffer) + buffer_offset, &merged_datum, 753 ACPI_MEMCPY(((char *)buffer) + buffer_offset, &merged_datum,
755 ACPI_MIN(obj_desc->common_field.access_byte_width, 754 ACPI_MIN(obj_desc->common_field.access_byte_width,
756 buffer_length - buffer_offset)); 755 buffer_length - buffer_offset));
757 756
758 return_ACPI_STATUS (AE_OK); 757 return_ACPI_STATUS(AE_OK);
759} 758}
760 759
761
762/******************************************************************************* 760/*******************************************************************************
763 * 761 *
764 * FUNCTION: acpi_ex_insert_into_field 762 * FUNCTION: acpi_ex_insert_into_field
@@ -774,53 +772,54 @@ acpi_ex_extract_from_field (
774 ******************************************************************************/ 772 ******************************************************************************/
775 773
776acpi_status 774acpi_status
777acpi_ex_insert_into_field ( 775acpi_ex_insert_into_field(union acpi_operand_object *obj_desc,
778 union acpi_operand_object *obj_desc, 776 void *buffer, u32 buffer_length)
779 void *buffer,
780 u32 buffer_length)
781{ 777{
782 acpi_status status; 778 acpi_status status;
783 acpi_integer mask; 779 acpi_integer mask;
784 acpi_integer merged_datum; 780 acpi_integer merged_datum;
785 acpi_integer raw_datum = 0; 781 acpi_integer raw_datum = 0;
786 u32 field_offset = 0; 782 u32 field_offset = 0;
787 u32 buffer_offset = 0; 783 u32 buffer_offset = 0;
788 u32 buffer_tail_bits; 784 u32 buffer_tail_bits;
789 u32 datum_count; 785 u32 datum_count;
790 u32 field_datum_count; 786 u32 field_datum_count;
791 u32 i; 787 u32 i;
792 788
793 789 ACPI_FUNCTION_TRACE("ex_insert_into_field");
794 ACPI_FUNCTION_TRACE ("ex_insert_into_field");
795
796 790
797 /* Validate input buffer */ 791 /* Validate input buffer */
798 792
799 if (buffer_length < ACPI_ROUND_BITS_UP_TO_BYTES ( 793 if (buffer_length <
800 obj_desc->common_field.bit_length)) { 794 ACPI_ROUND_BITS_UP_TO_BYTES(obj_desc->common_field.bit_length)) {
801 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, 795 ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
802 "Field size %X (bits) is too large for buffer (%X)\n", 796 "Field size %X (bits) is too large for buffer (%X)\n",
803 obj_desc->common_field.bit_length, buffer_length)); 797 obj_desc->common_field.bit_length,
798 buffer_length));
804 799
805 return_ACPI_STATUS (AE_BUFFER_OVERFLOW); 800 return_ACPI_STATUS(AE_BUFFER_OVERFLOW);
806 } 801 }
807 802
808 /* Compute the number of datums (access width data items) */ 803 /* Compute the number of datums (access width data items) */
809 804
810 mask = ACPI_MASK_BITS_BELOW (obj_desc->common_field.start_field_bit_offset); 805 mask =
811 datum_count = ACPI_ROUND_UP_TO (obj_desc->common_field.bit_length, 806 ACPI_MASK_BITS_BELOW(obj_desc->common_field.start_field_bit_offset);
812 obj_desc->common_field.access_bit_width); 807 datum_count =
813 field_datum_count = ACPI_ROUND_UP_TO (obj_desc->common_field.bit_length + 808 ACPI_ROUND_UP_TO(obj_desc->common_field.bit_length,
814 obj_desc->common_field.start_field_bit_offset, 809 obj_desc->common_field.access_bit_width);
815 obj_desc->common_field.access_bit_width); 810 field_datum_count =
811 ACPI_ROUND_UP_TO(obj_desc->common_field.bit_length +
812 obj_desc->common_field.start_field_bit_offset,
813 obj_desc->common_field.access_bit_width);
816 814
817 /* Get initial Datum from the input buffer */ 815 /* Get initial Datum from the input buffer */
818 816
819 ACPI_MEMCPY (&raw_datum, buffer, 817 ACPI_MEMCPY(&raw_datum, buffer,
820 ACPI_MIN(obj_desc->common_field.access_byte_width, 818 ACPI_MIN(obj_desc->common_field.access_byte_width,
821 buffer_length - buffer_offset)); 819 buffer_length - buffer_offset));
822 820
823 merged_datum = raw_datum << obj_desc->common_field.start_field_bit_offset; 821 merged_datum =
822 raw_datum << obj_desc->common_field.start_field_bit_offset;
824 823
825 /* Write the entire field */ 824 /* Write the entire field */
826 825
@@ -828,18 +827,19 @@ acpi_ex_insert_into_field (
828 /* Write merged datum to the target field */ 827 /* Write merged datum to the target field */
829 828
830 merged_datum &= mask; 829 merged_datum &= mask;
831 status = acpi_ex_write_with_update_rule (obj_desc, mask, 830 status = acpi_ex_write_with_update_rule(obj_desc, mask,
832 merged_datum, field_offset); 831 merged_datum,
833 if (ACPI_FAILURE (status)) { 832 field_offset);
834 return_ACPI_STATUS (status); 833 if (ACPI_FAILURE(status)) {
834 return_ACPI_STATUS(status);
835 } 835 }
836 836
837 /* Start new output datum by merging with previous input datum */ 837 /* Start new output datum by merging with previous input datum */
838 838
839 field_offset += obj_desc->common_field.access_byte_width; 839 field_offset += obj_desc->common_field.access_byte_width;
840 merged_datum = raw_datum >> 840 merged_datum = raw_datum >>
841 (obj_desc->common_field.access_bit_width - 841 (obj_desc->common_field.access_bit_width -
842 obj_desc->common_field.start_field_bit_offset); 842 obj_desc->common_field.start_field_bit_offset);
843 mask = ACPI_INTEGER_MAX; 843 mask = ACPI_INTEGER_MAX;
844 844
845 if (i == datum_count) { 845 if (i == datum_count) {
@@ -849,28 +849,28 @@ acpi_ex_insert_into_field (
849 /* Get the next input datum from the buffer */ 849 /* Get the next input datum from the buffer */
850 850
851 buffer_offset += obj_desc->common_field.access_byte_width; 851 buffer_offset += obj_desc->common_field.access_byte_width;
852 ACPI_MEMCPY (&raw_datum, ((char *) buffer) + buffer_offset, 852 ACPI_MEMCPY(&raw_datum, ((char *)buffer) + buffer_offset,
853 ACPI_MIN(obj_desc->common_field.access_byte_width, 853 ACPI_MIN(obj_desc->common_field.access_byte_width,
854 buffer_length - buffer_offset)); 854 buffer_length - buffer_offset));
855 merged_datum |= raw_datum << obj_desc->common_field.start_field_bit_offset; 855 merged_datum |=
856 raw_datum << obj_desc->common_field.start_field_bit_offset;
856 } 857 }
857 858
858 /* Mask off any extra bits in the last datum */ 859 /* Mask off any extra bits in the last datum */
859 860
860 buffer_tail_bits = (obj_desc->common_field.bit_length + 861 buffer_tail_bits = (obj_desc->common_field.bit_length +
861 obj_desc->common_field.start_field_bit_offset) % 862 obj_desc->common_field.start_field_bit_offset) %
862 obj_desc->common_field.access_bit_width; 863 obj_desc->common_field.access_bit_width;
863 if (buffer_tail_bits) { 864 if (buffer_tail_bits) {
864 mask &= ACPI_MASK_BITS_ABOVE (buffer_tail_bits); 865 mask &= ACPI_MASK_BITS_ABOVE(buffer_tail_bits);
865 } 866 }
866 867
867 /* Write the last datum to the field */ 868 /* Write the last datum to the field */
868 869
869 merged_datum &= mask; 870 merged_datum &= mask;
870 status = acpi_ex_write_with_update_rule (obj_desc, 871 status = acpi_ex_write_with_update_rule(obj_desc,
871 mask, merged_datum, field_offset); 872 mask, merged_datum,
873 field_offset);
872 874
873 return_ACPI_STATUS (status); 875 return_ACPI_STATUS(status);
874} 876}
875
876