aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/executer/exprep.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/acpi/executer/exprep.c')
-rw-r--r--drivers/acpi/executer/exprep.c381
1 files changed, 185 insertions, 196 deletions
diff --git a/drivers/acpi/executer/exprep.c b/drivers/acpi/executer/exprep.c
index c9e3c68b5549..7476c363e407 100644
--- a/drivers/acpi/executer/exprep.c
+++ b/drivers/acpi/executer/exprep.c
@@ -42,32 +42,24 @@
42 * POSSIBILITY OF SUCH DAMAGES. 42 * POSSIBILITY OF SUCH DAMAGES.
43 */ 43 */
44 44
45
46#include <acpi/acpi.h> 45#include <acpi/acpi.h>
47#include <acpi/acinterp.h> 46#include <acpi/acinterp.h>
48#include <acpi/amlcode.h> 47#include <acpi/amlcode.h>
49#include <acpi/acnamesp.h> 48#include <acpi/acnamesp.h>
50 49
51
52#define _COMPONENT ACPI_EXECUTER 50#define _COMPONENT ACPI_EXECUTER
53 ACPI_MODULE_NAME ("exprep") 51ACPI_MODULE_NAME("exprep")
54 52
55/* Local prototypes */ 53/* Local prototypes */
56
57static u32 54static u32
58acpi_ex_decode_field_access ( 55acpi_ex_decode_field_access(union acpi_operand_object *obj_desc,
59 union acpi_operand_object *obj_desc, 56 u8 field_flags, u32 * return_byte_alignment);
60 u8 field_flags,
61 u32 *return_byte_alignment);
62
63 57
64#ifdef ACPI_UNDER_DEVELOPMENT 58#ifdef ACPI_UNDER_DEVELOPMENT
65 59
66static u32 60static u32
67acpi_ex_generate_access ( 61acpi_ex_generate_access(u32 field_bit_offset,
68 u32 field_bit_offset, 62 u32 field_bit_length, u32 region_length);
69 u32 field_bit_length,
70 u32 region_length);
71 63
72/******************************************************************************* 64/*******************************************************************************
73 * 65 *
@@ -92,39 +84,36 @@ acpi_ex_generate_access (
92 ******************************************************************************/ 84 ******************************************************************************/
93 85
94static u32 86static u32
95acpi_ex_generate_access ( 87acpi_ex_generate_access(u32 field_bit_offset,
96 u32 field_bit_offset, 88 u32 field_bit_length, u32 region_length)
97 u32 field_bit_length,
98 u32 region_length)
99{ 89{
100 u32 field_byte_length; 90 u32 field_byte_length;
101 u32 field_byte_offset; 91 u32 field_byte_offset;
102 u32 field_byte_end_offset; 92 u32 field_byte_end_offset;
103 u32 access_byte_width; 93 u32 access_byte_width;
104 u32 field_start_offset; 94 u32 field_start_offset;
105 u32 field_end_offset; 95 u32 field_end_offset;
106 u32 minimum_access_width = 0xFFFFFFFF; 96 u32 minimum_access_width = 0xFFFFFFFF;
107 u32 minimum_accesses = 0xFFFFFFFF; 97 u32 minimum_accesses = 0xFFFFFFFF;
108 u32 accesses; 98 u32 accesses;
109 99
110 100 ACPI_FUNCTION_TRACE("ex_generate_access");
111 ACPI_FUNCTION_TRACE ("ex_generate_access");
112
113 101
114 /* Round Field start offset and length to "minimal" byte boundaries */ 102 /* Round Field start offset and length to "minimal" byte boundaries */
115 103
116 field_byte_offset = ACPI_DIV_8 (ACPI_ROUND_DOWN (field_bit_offset, 8)); 104 field_byte_offset = ACPI_DIV_8(ACPI_ROUND_DOWN(field_bit_offset, 8));
117 field_byte_end_offset = ACPI_DIV_8 (ACPI_ROUND_UP (field_bit_length + 105 field_byte_end_offset = ACPI_DIV_8(ACPI_ROUND_UP(field_bit_length +
118 field_bit_offset, 8)); 106 field_bit_offset, 8));
119 field_byte_length = field_byte_end_offset - field_byte_offset; 107 field_byte_length = field_byte_end_offset - field_byte_offset;
120 108
121 ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, 109 ACPI_DEBUG_PRINT((ACPI_DB_BFIELD,
122 "Bit length %d, Bit offset %d\n", 110 "Bit length %d, Bit offset %d\n",
123 field_bit_length, field_bit_offset)); 111 field_bit_length, field_bit_offset));
124 112
125 ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, 113 ACPI_DEBUG_PRINT((ACPI_DB_BFIELD,
126 "Byte Length %d, Byte Offset %d, End Offset %d\n", 114 "Byte Length %d, Byte Offset %d, End Offset %d\n",
127 field_byte_length, field_byte_offset, field_byte_end_offset)); 115 field_byte_length, field_byte_offset,
116 field_byte_end_offset));
128 117
129 /* 118 /*
130 * Iterative search for the maximum access width that is both aligned 119 * Iterative search for the maximum access width that is both aligned
@@ -132,7 +121,8 @@ acpi_ex_generate_access (
132 * 121 *
133 * Start at byte_acc and work upwards to qword_acc max. (1,2,4,8 bytes) 122 * Start at byte_acc and work upwards to qword_acc max. (1,2,4,8 bytes)
134 */ 123 */
135 for (access_byte_width = 1; access_byte_width <= 8; access_byte_width <<= 1) { 124 for (access_byte_width = 1; access_byte_width <= 8;
125 access_byte_width <<= 1) {
136 /* 126 /*
137 * 1) Round end offset up to next access boundary and make sure that 127 * 1) Round end offset up to next access boundary and make sure that
138 * this does not go beyond the end of the parent region. 128 * this does not go beyond the end of the parent region.
@@ -140,31 +130,37 @@ acpi_ex_generate_access (
140 * are done. (This does not optimize for the perfectly aligned 130 * are done. (This does not optimize for the perfectly aligned
141 * case yet). 131 * case yet).
142 */ 132 */
143 if (ACPI_ROUND_UP (field_byte_end_offset, access_byte_width) <= region_length) { 133 if (ACPI_ROUND_UP(field_byte_end_offset, access_byte_width) <=
134 region_length) {
144 field_start_offset = 135 field_start_offset =
145 ACPI_ROUND_DOWN (field_byte_offset, access_byte_width) / 136 ACPI_ROUND_DOWN(field_byte_offset,
146 access_byte_width; 137 access_byte_width) /
138 access_byte_width;
147 139
148 field_end_offset = 140 field_end_offset =
149 ACPI_ROUND_UP ((field_byte_length + field_byte_offset), 141 ACPI_ROUND_UP((field_byte_length +
150 access_byte_width) / access_byte_width; 142 field_byte_offset),
143 access_byte_width) /
144 access_byte_width;
151 145
152 accesses = field_end_offset - field_start_offset; 146 accesses = field_end_offset - field_start_offset;
153 147
154 ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, 148 ACPI_DEBUG_PRINT((ACPI_DB_BFIELD,
155 "access_width %d end is within region\n", access_byte_width)); 149 "access_width %d end is within region\n",
150 access_byte_width));
156 151
157 ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, 152 ACPI_DEBUG_PRINT((ACPI_DB_BFIELD,
158 "Field Start %d, Field End %d -- requires %d accesses\n", 153 "Field Start %d, Field End %d -- requires %d accesses\n",
159 field_start_offset, field_end_offset, accesses)); 154 field_start_offset, field_end_offset,
155 accesses));
160 156
161 /* Single access is optimal */ 157 /* Single access is optimal */
162 158
163 if (accesses <= 1) { 159 if (accesses <= 1) {
164 ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, 160 ACPI_DEBUG_PRINT((ACPI_DB_BFIELD,
165 "Entire field can be accessed with one operation of size %d\n", 161 "Entire field can be accessed with one operation of size %d\n",
166 access_byte_width)); 162 access_byte_width));
167 return_VALUE (access_byte_width); 163 return_VALUE(access_byte_width);
168 } 164 }
169 165
170 /* 166 /*
@@ -172,30 +168,30 @@ acpi_ex_generate_access (
172 * try the next wider access on next iteration 168 * try the next wider access on next iteration
173 */ 169 */
174 if (accesses < minimum_accesses) { 170 if (accesses < minimum_accesses) {
175 minimum_accesses = accesses; 171 minimum_accesses = accesses;
176 minimum_access_width = access_byte_width; 172 minimum_access_width = access_byte_width;
177 } 173 }
178 } 174 } else {
179 else { 175 ACPI_DEBUG_PRINT((ACPI_DB_BFIELD,
180 ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, 176 "access_width %d end is NOT within region\n",
181 "access_width %d end is NOT within region\n", access_byte_width)); 177 access_byte_width));
182 if (access_byte_width == 1) { 178 if (access_byte_width == 1) {
183 ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, 179 ACPI_DEBUG_PRINT((ACPI_DB_BFIELD,
184 "Field goes beyond end-of-region!\n")); 180 "Field goes beyond end-of-region!\n"));
185 181
186 /* Field does not fit in the region at all */ 182 /* Field does not fit in the region at all */
187 183
188 return_VALUE (0); 184 return_VALUE(0);
189 } 185 }
190 186
191 /* 187 /*
192 * This width goes beyond the end-of-region, back off to 188 * This width goes beyond the end-of-region, back off to
193 * previous access 189 * previous access
194 */ 190 */
195 ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, 191 ACPI_DEBUG_PRINT((ACPI_DB_BFIELD,
196 "Backing off to previous optimal access width of %d\n", 192 "Backing off to previous optimal access width of %d\n",
197 minimum_access_width)); 193 minimum_access_width));
198 return_VALUE (minimum_access_width); 194 return_VALUE(minimum_access_width);
199 } 195 }
200 } 196 }
201 197
@@ -203,12 +199,11 @@ acpi_ex_generate_access (
203 * Could not read/write field with one operation, 199 * Could not read/write field with one operation,
204 * just use max access width 200 * just use max access width
205 */ 201 */
206 ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, 202 ACPI_DEBUG_PRINT((ACPI_DB_BFIELD,
207 "Cannot access field in one operation, using width 8\n")); 203 "Cannot access field in one operation, using width 8\n"));
208 return_VALUE (8); 204 return_VALUE(8);
209} 205}
210#endif /* ACPI_UNDER_DEVELOPMENT */ 206#endif /* ACPI_UNDER_DEVELOPMENT */
211
212 207
213/******************************************************************************* 208/*******************************************************************************
214 * 209 *
@@ -226,18 +221,14 @@ acpi_ex_generate_access (
226 ******************************************************************************/ 221 ******************************************************************************/
227 222
228static u32 223static u32
229acpi_ex_decode_field_access ( 224acpi_ex_decode_field_access(union acpi_operand_object *obj_desc,
230 union acpi_operand_object *obj_desc, 225 u8 field_flags, u32 * return_byte_alignment)
231 u8 field_flags,
232 u32 *return_byte_alignment)
233{ 226{
234 u32 access; 227 u32 access;
235 u32 byte_alignment; 228 u32 byte_alignment;
236 u32 bit_length; 229 u32 bit_length;
237
238
239 ACPI_FUNCTION_TRACE ("ex_decode_field_access");
240 230
231 ACPI_FUNCTION_TRACE("ex_decode_field_access");
241 232
242 access = (field_flags & AML_FIELD_ACCESS_TYPE_MASK); 233 access = (field_flags & AML_FIELD_ACCESS_TYPE_MASK);
243 234
@@ -246,9 +237,12 @@ acpi_ex_decode_field_access (
246 237
247#ifdef ACPI_UNDER_DEVELOPMENT 238#ifdef ACPI_UNDER_DEVELOPMENT
248 byte_alignment = 239 byte_alignment =
249 acpi_ex_generate_access (obj_desc->common_field.start_field_bit_offset, 240 acpi_ex_generate_access(obj_desc->common_field.
250 obj_desc->common_field.bit_length, 241 start_field_bit_offset,
251 0xFFFFFFFF /* Temp until we pass region_length as parameter */); 242 obj_desc->common_field.bit_length,
243 0xFFFFFFFF
244 /* Temp until we pass region_length as parameter */
245 );
252 bit_length = byte_alignment * 8; 246 bit_length = byte_alignment * 8;
253#endif 247#endif
254 248
@@ -257,36 +251,35 @@ acpi_ex_decode_field_access (
257 break; 251 break;
258 252
259 case AML_FIELD_ACCESS_BYTE: 253 case AML_FIELD_ACCESS_BYTE:
260 case AML_FIELD_ACCESS_BUFFER: /* ACPI 2.0 (SMBus Buffer) */ 254 case AML_FIELD_ACCESS_BUFFER: /* ACPI 2.0 (SMBus Buffer) */
261 byte_alignment = 1; 255 byte_alignment = 1;
262 bit_length = 8; 256 bit_length = 8;
263 break; 257 break;
264 258
265 case AML_FIELD_ACCESS_WORD: 259 case AML_FIELD_ACCESS_WORD:
266 byte_alignment = 2; 260 byte_alignment = 2;
267 bit_length = 16; 261 bit_length = 16;
268 break; 262 break;
269 263
270 case AML_FIELD_ACCESS_DWORD: 264 case AML_FIELD_ACCESS_DWORD:
271 byte_alignment = 4; 265 byte_alignment = 4;
272 bit_length = 32; 266 bit_length = 32;
273 break; 267 break;
274 268
275 case AML_FIELD_ACCESS_QWORD: /* ACPI 2.0 */ 269 case AML_FIELD_ACCESS_QWORD: /* ACPI 2.0 */
276 byte_alignment = 8; 270 byte_alignment = 8;
277 bit_length = 64; 271 bit_length = 64;
278 break; 272 break;
279 273
280 default: 274 default:
281 /* Invalid field access type */ 275 /* Invalid field access type */
282 276
283 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, 277 ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
284 "Unknown field access type %X\n", 278 "Unknown field access type %X\n", access));
285 access)); 279 return_VALUE(0);
286 return_VALUE (0);
287 } 280 }
288 281
289 if (ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_BUFFER_FIELD) { 282 if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_BUFFER_FIELD) {
290 /* 283 /*
291 * buffer_field access can be on any byte boundary, so the 284 * buffer_field access can be on any byte boundary, so the
292 * byte_alignment is always 1 byte -- regardless of any byte_alignment 285 * byte_alignment is always 1 byte -- regardless of any byte_alignment
@@ -296,10 +289,9 @@ acpi_ex_decode_field_access (
296 } 289 }
297 290
298 *return_byte_alignment = byte_alignment; 291 *return_byte_alignment = byte_alignment;
299 return_VALUE (bit_length); 292 return_VALUE(bit_length);
300} 293}
301 294
302
303/******************************************************************************* 295/*******************************************************************************
304 * 296 *
305 * FUNCTION: acpi_ex_prep_common_field_object 297 * FUNCTION: acpi_ex_prep_common_field_object
@@ -322,20 +314,16 @@ acpi_ex_decode_field_access (
322 ******************************************************************************/ 314 ******************************************************************************/
323 315
324acpi_status 316acpi_status
325acpi_ex_prep_common_field_object ( 317acpi_ex_prep_common_field_object(union acpi_operand_object *obj_desc,
326 union acpi_operand_object *obj_desc, 318 u8 field_flags,
327 u8 field_flags, 319 u8 field_attribute,
328 u8 field_attribute, 320 u32 field_bit_position, u32 field_bit_length)
329 u32 field_bit_position,
330 u32 field_bit_length)
331{ 321{
332 u32 access_bit_width; 322 u32 access_bit_width;
333 u32 byte_alignment; 323 u32 byte_alignment;
334 u32 nearest_byte_address; 324 u32 nearest_byte_address;
335
336
337 ACPI_FUNCTION_TRACE ("ex_prep_common_field_object");
338 325
326 ACPI_FUNCTION_TRACE("ex_prep_common_field_object");
339 327
340 /* 328 /*
341 * Note: the structure being initialized is the 329 * Note: the structure being initialized is the
@@ -361,16 +349,16 @@ acpi_ex_prep_common_field_object (
361 * For all other access types (Byte, Word, Dword, Qword), the Bitwidth is 349 * For all other access types (Byte, Word, Dword, Qword), the Bitwidth is
362 * the same (equivalent) as the byte_alignment. 350 * the same (equivalent) as the byte_alignment.
363 */ 351 */
364 access_bit_width = acpi_ex_decode_field_access (obj_desc, field_flags, 352 access_bit_width = acpi_ex_decode_field_access(obj_desc, field_flags,
365 &byte_alignment); 353 &byte_alignment);
366 if (!access_bit_width) { 354 if (!access_bit_width) {
367 return_ACPI_STATUS (AE_AML_OPERAND_VALUE); 355 return_ACPI_STATUS(AE_AML_OPERAND_VALUE);
368 } 356 }
369 357
370 /* Setup width (access granularity) fields */ 358 /* Setup width (access granularity) fields */
371 359
372 obj_desc->common_field.access_byte_width = (u8) 360 obj_desc->common_field.access_byte_width = (u8)
373 ACPI_DIV_8 (access_bit_width); /* 1, 2, 4, 8 */ 361 ACPI_DIV_8(access_bit_width); /* 1, 2, 4, 8 */
374 362
375 obj_desc->common_field.access_bit_width = (u8) access_bit_width; 363 obj_desc->common_field.access_bit_width = (u8) access_bit_width;
376 364
@@ -385,30 +373,30 @@ acpi_ex_prep_common_field_object (
385 * region or buffer. 373 * region or buffer.
386 */ 374 */
387 nearest_byte_address = 375 nearest_byte_address =
388 ACPI_ROUND_BITS_DOWN_TO_BYTES (field_bit_position); 376 ACPI_ROUND_BITS_DOWN_TO_BYTES(field_bit_position);
389 obj_desc->common_field.base_byte_offset = (u32) 377 obj_desc->common_field.base_byte_offset = (u32)
390 ACPI_ROUND_DOWN (nearest_byte_address, byte_alignment); 378 ACPI_ROUND_DOWN(nearest_byte_address, byte_alignment);
391 379
392 /* 380 /*
393 * start_field_bit_offset is the offset of the first bit of the field within 381 * start_field_bit_offset is the offset of the first bit of the field within
394 * a field datum. 382 * a field datum.
395 */ 383 */
396 obj_desc->common_field.start_field_bit_offset = (u8) 384 obj_desc->common_field.start_field_bit_offset = (u8)
397 (field_bit_position - ACPI_MUL_8 (obj_desc->common_field.base_byte_offset)); 385 (field_bit_position -
386 ACPI_MUL_8(obj_desc->common_field.base_byte_offset));
398 387
399 /* 388 /*
400 * Does the entire field fit within a single field access element? (datum) 389 * Does the entire field fit within a single field access element? (datum)
401 * (i.e., without crossing a datum boundary) 390 * (i.e., without crossing a datum boundary)
402 */ 391 */
403 if ((obj_desc->common_field.start_field_bit_offset + field_bit_length) <= 392 if ((obj_desc->common_field.start_field_bit_offset +
404 (u16) access_bit_width) { 393 field_bit_length) <= (u16) access_bit_width) {
405 obj_desc->common.flags |= AOPOBJ_SINGLE_DATUM; 394 obj_desc->common.flags |= AOPOBJ_SINGLE_DATUM;
406 } 395 }
407 396
408 return_ACPI_STATUS (AE_OK); 397 return_ACPI_STATUS(AE_OK);
409} 398}
410 399
411
412/******************************************************************************* 400/*******************************************************************************
413 * 401 *
414 * FUNCTION: acpi_ex_prep_field_value 402 * FUNCTION: acpi_ex_prep_field_value
@@ -422,51 +410,49 @@ acpi_ex_prep_common_field_object (
422 * 410 *
423 ******************************************************************************/ 411 ******************************************************************************/
424 412
425acpi_status 413acpi_status acpi_ex_prep_field_value(struct acpi_create_field_info *info)
426acpi_ex_prep_field_value (
427 struct acpi_create_field_info *info)
428{ 414{
429 union acpi_operand_object *obj_desc; 415 union acpi_operand_object *obj_desc;
430 u32 type; 416 u32 type;
431 acpi_status status; 417 acpi_status status;
432
433
434 ACPI_FUNCTION_TRACE ("ex_prep_field_value");
435 418
419 ACPI_FUNCTION_TRACE("ex_prep_field_value");
436 420
437 /* Parameter validation */ 421 /* Parameter validation */
438 422
439 if (info->field_type != ACPI_TYPE_LOCAL_INDEX_FIELD) { 423 if (info->field_type != ACPI_TYPE_LOCAL_INDEX_FIELD) {
440 if (!info->region_node) { 424 if (!info->region_node) {
441 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Null region_node\n")); 425 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Null region_node\n"));
442 return_ACPI_STATUS (AE_AML_NO_OPERAND); 426 return_ACPI_STATUS(AE_AML_NO_OPERAND);
443 } 427 }
444 428
445 type = acpi_ns_get_type (info->region_node); 429 type = acpi_ns_get_type(info->region_node);
446 if (type != ACPI_TYPE_REGION) { 430 if (type != ACPI_TYPE_REGION) {
447 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, 431 ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
448 "Needed Region, found type %X (%s)\n", 432 "Needed Region, found type %X (%s)\n",
449 type, acpi_ut_get_type_name (type))); 433 type, acpi_ut_get_type_name(type)));
450 434
451 return_ACPI_STATUS (AE_AML_OPERAND_TYPE); 435 return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
452 } 436 }
453 } 437 }
454 438
455 /* Allocate a new field object */ 439 /* Allocate a new field object */
456 440
457 obj_desc = acpi_ut_create_internal_object (info->field_type); 441 obj_desc = acpi_ut_create_internal_object(info->field_type);
458 if (!obj_desc) { 442 if (!obj_desc) {
459 return_ACPI_STATUS (AE_NO_MEMORY); 443 return_ACPI_STATUS(AE_NO_MEMORY);
460 } 444 }
461 445
462 /* Initialize areas of the object that are common to all fields */ 446 /* Initialize areas of the object that are common to all fields */
463 447
464 obj_desc->common_field.node = info->field_node; 448 obj_desc->common_field.node = info->field_node;
465 status = acpi_ex_prep_common_field_object (obj_desc, info->field_flags, 449 status = acpi_ex_prep_common_field_object(obj_desc, info->field_flags,
466 info->attribute, info->field_bit_position, info->field_bit_length); 450 info->attribute,
467 if (ACPI_FAILURE (status)) { 451 info->field_bit_position,
468 acpi_ut_delete_object_desc (obj_desc); 452 info->field_bit_length);
469 return_ACPI_STATUS (status); 453 if (ACPI_FAILURE(status)) {
454 acpi_ut_delete_object_desc(obj_desc);
455 return_ACPI_STATUS(status);
470 } 456 }
471 457
472 /* Initialize areas of the object that are specific to the field type */ 458 /* Initialize areas of the object that are specific to the field type */
@@ -474,71 +460,73 @@ acpi_ex_prep_field_value (
474 switch (info->field_type) { 460 switch (info->field_type) {
475 case ACPI_TYPE_LOCAL_REGION_FIELD: 461 case ACPI_TYPE_LOCAL_REGION_FIELD:
476 462
477 obj_desc->field.region_obj = acpi_ns_get_attached_object (info->region_node); 463 obj_desc->field.region_obj =
464 acpi_ns_get_attached_object(info->region_node);
478 465
479 /* An additional reference for the container */ 466 /* An additional reference for the container */
480 467
481 acpi_ut_add_reference (obj_desc->field.region_obj); 468 acpi_ut_add_reference(obj_desc->field.region_obj);
482 469
483 ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, 470 ACPI_DEBUG_PRINT((ACPI_DB_BFIELD,
484 "region_field: bit_off %X, Off %X, Gran %X, Region %p\n", 471 "region_field: bit_off %X, Off %X, Gran %X, Region %p\n",
485 obj_desc->field.start_field_bit_offset, obj_desc->field.base_byte_offset, 472 obj_desc->field.start_field_bit_offset,
486 obj_desc->field.access_byte_width, obj_desc->field.region_obj)); 473 obj_desc->field.base_byte_offset,
474 obj_desc->field.access_byte_width,
475 obj_desc->field.region_obj));
487 break; 476 break;
488 477
489
490 case ACPI_TYPE_LOCAL_BANK_FIELD: 478 case ACPI_TYPE_LOCAL_BANK_FIELD:
491 479
492 obj_desc->bank_field.value = info->bank_value; 480 obj_desc->bank_field.value = info->bank_value;
493 obj_desc->bank_field.region_obj = acpi_ns_get_attached_object ( 481 obj_desc->bank_field.region_obj =
494 info->region_node); 482 acpi_ns_get_attached_object(info->region_node);
495 obj_desc->bank_field.bank_obj = acpi_ns_get_attached_object ( 483 obj_desc->bank_field.bank_obj =
496 info->register_node); 484 acpi_ns_get_attached_object(info->register_node);
497 485
498 /* An additional reference for the attached objects */ 486 /* An additional reference for the attached objects */
499 487
500 acpi_ut_add_reference (obj_desc->bank_field.region_obj); 488 acpi_ut_add_reference(obj_desc->bank_field.region_obj);
501 acpi_ut_add_reference (obj_desc->bank_field.bank_obj); 489 acpi_ut_add_reference(obj_desc->bank_field.bank_obj);
502 490
503 ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, 491 ACPI_DEBUG_PRINT((ACPI_DB_BFIELD,
504 "Bank Field: bit_off %X, Off %X, Gran %X, Region %p, bank_reg %p\n", 492 "Bank Field: bit_off %X, Off %X, Gran %X, Region %p, bank_reg %p\n",
505 obj_desc->bank_field.start_field_bit_offset, 493 obj_desc->bank_field.start_field_bit_offset,
506 obj_desc->bank_field.base_byte_offset, 494 obj_desc->bank_field.base_byte_offset,
507 obj_desc->field.access_byte_width, 495 obj_desc->field.access_byte_width,
508 obj_desc->bank_field.region_obj, 496 obj_desc->bank_field.region_obj,
509 obj_desc->bank_field.bank_obj)); 497 obj_desc->bank_field.bank_obj));
510 break; 498 break;
511 499
512
513 case ACPI_TYPE_LOCAL_INDEX_FIELD: 500 case ACPI_TYPE_LOCAL_INDEX_FIELD:
514 501
515 obj_desc->index_field.index_obj = acpi_ns_get_attached_object ( 502 obj_desc->index_field.index_obj =
516 info->register_node); 503 acpi_ns_get_attached_object(info->register_node);
517 obj_desc->index_field.data_obj = acpi_ns_get_attached_object ( 504 obj_desc->index_field.data_obj =
518 info->data_register_node); 505 acpi_ns_get_attached_object(info->data_register_node);
519 obj_desc->index_field.value = (u32) 506 obj_desc->index_field.value = (u32)
520 (info->field_bit_position / ACPI_MUL_8 ( 507 (info->field_bit_position /
521 obj_desc->field.access_byte_width)); 508 ACPI_MUL_8(obj_desc->field.access_byte_width));
522 509
523 if (!obj_desc->index_field.data_obj || !obj_desc->index_field.index_obj) { 510 if (!obj_desc->index_field.data_obj
524 ACPI_REPORT_ERROR (("Null Index Object during field prep\n")); 511 || !obj_desc->index_field.index_obj) {
525 acpi_ut_delete_object_desc (obj_desc); 512 ACPI_REPORT_ERROR(("Null Index Object during field prep\n"));
526 return_ACPI_STATUS (AE_AML_INTERNAL); 513 acpi_ut_delete_object_desc(obj_desc);
514 return_ACPI_STATUS(AE_AML_INTERNAL);
527 } 515 }
528 516
529 /* An additional reference for the attached objects */ 517 /* An additional reference for the attached objects */
530 518
531 acpi_ut_add_reference (obj_desc->index_field.data_obj); 519 acpi_ut_add_reference(obj_desc->index_field.data_obj);
532 acpi_ut_add_reference (obj_desc->index_field.index_obj); 520 acpi_ut_add_reference(obj_desc->index_field.index_obj);
533 521
534 ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, 522 ACPI_DEBUG_PRINT((ACPI_DB_BFIELD,
535 "index_field: bit_off %X, Off %X, Value %X, Gran %X, Index %p, Data %p\n", 523 "index_field: bit_off %X, Off %X, Value %X, Gran %X, Index %p, Data %p\n",
536 obj_desc->index_field.start_field_bit_offset, 524 obj_desc->index_field.start_field_bit_offset,
537 obj_desc->index_field.base_byte_offset, 525 obj_desc->index_field.base_byte_offset,
538 obj_desc->index_field.value, 526 obj_desc->index_field.value,
539 obj_desc->field.access_byte_width, 527 obj_desc->field.access_byte_width,
540 obj_desc->index_field.index_obj, 528 obj_desc->index_field.index_obj,
541 obj_desc->index_field.data_obj)); 529 obj_desc->index_field.data_obj));
542 break; 530 break;
543 531
544 default: 532 default:
@@ -550,15 +538,16 @@ acpi_ex_prep_field_value (
550 * Store the constructed descriptor (obj_desc) into the parent Node, 538 * Store the constructed descriptor (obj_desc) into the parent Node,
551 * preserving the current type of that named_obj. 539 * preserving the current type of that named_obj.
552 */ 540 */
553 status = acpi_ns_attach_object (info->field_node, obj_desc, 541 status = acpi_ns_attach_object(info->field_node, obj_desc,
554 acpi_ns_get_type (info->field_node)); 542 acpi_ns_get_type(info->field_node));
555 543
556 ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, "Set named_obj %p [%4.4s], obj_desc %p\n", 544 ACPI_DEBUG_PRINT((ACPI_DB_BFIELD,
557 info->field_node, acpi_ut_get_node_name (info->field_node), obj_desc)); 545 "Set named_obj %p [%4.4s], obj_desc %p\n",
546 info->field_node,
547 acpi_ut_get_node_name(info->field_node), obj_desc));
558 548
559 /* Remove local reference to the object */ 549 /* Remove local reference to the object */
560 550
561 acpi_ut_remove_reference (obj_desc); 551 acpi_ut_remove_reference(obj_desc);
562 return_ACPI_STATUS (status); 552 return_ACPI_STATUS(status);
563} 553}
564