aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/resources/rsmisc.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/acpi/resources/rsmisc.c')
-rw-r--r--drivers/acpi/resources/rsmisc.c160
1 files changed, 66 insertions, 94 deletions
diff --git a/drivers/acpi/resources/rsmisc.c b/drivers/acpi/resources/rsmisc.c
index d16be44b5df7..a1f1741f0d83 100644
--- a/drivers/acpi/resources/rsmisc.c
+++ b/drivers/acpi/resources/rsmisc.c
@@ -84,24 +84,20 @@ acpi_rs_end_tag_resource (
84 ACPI_FUNCTION_TRACE ("rs_end_tag_resource"); 84 ACPI_FUNCTION_TRACE ("rs_end_tag_resource");
85 85
86 86
87 /* 87 /* The number of bytes consumed is static */
88 * The number of bytes consumed is static 88
89 */
90 *bytes_consumed = 2; 89 *bytes_consumed = 2;
91 90
92 /* 91 /* Fill out the structure */
93 * Fill out the structure 92
94 */
95 output_struct->id = ACPI_RSTYPE_END_TAG; 93 output_struct->id = ACPI_RSTYPE_END_TAG;
96 94
97 /* 95 /* Set the Length parameter */
98 * Set the Length parameter 96
99 */
100 output_struct->length = 0; 97 output_struct->length = 0;
101 98
102 /* 99 /* Return the final size of the structure */
103 * Return the final size of the structure 100
104 */
105 *structure_size = struct_size; 101 *structure_size = struct_size;
106 return_ACPI_STATUS (AE_OK); 102 return_ACPI_STATUS (AE_OK);
107} 103}
@@ -136,9 +132,8 @@ acpi_rs_end_tag_stream (
136 ACPI_FUNCTION_TRACE ("rs_end_tag_stream"); 132 ACPI_FUNCTION_TRACE ("rs_end_tag_stream");
137 133
138 134
139 /* 135 /* The descriptor field is static */
140 * The descriptor field is static 136
141 */
142 *buffer = 0x79; 137 *buffer = 0x79;
143 buffer += 1; 138 buffer += 1;
144 139
@@ -151,9 +146,8 @@ acpi_rs_end_tag_stream (
151 *buffer = temp8; 146 *buffer = temp8;
152 buffer += 1; 147 buffer += 1;
153 148
154 /* 149 /* Return the number of bytes consumed in this operation */
155 * Return the number of bytes consumed in this operation 150
156 */
157 *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer); 151 *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer);
158 return_ACPI_STATUS (AE_OK); 152 return_ACPI_STATUS (AE_OK);
159} 153}
@@ -192,21 +186,20 @@ acpi_rs_vendor_resource (
192 u16 temp16 = 0; 186 u16 temp16 = 0;
193 u8 temp8 = 0; 187 u8 temp8 = 0;
194 u8 index; 188 u8 index;
195 acpi_size struct_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_vendor); 189 acpi_size struct_size = ACPI_SIZEOF_RESOURCE (
190 struct acpi_resource_vendor);
196 191
197 192
198 ACPI_FUNCTION_TRACE ("rs_vendor_resource"); 193 ACPI_FUNCTION_TRACE ("rs_vendor_resource");
199 194
200 195
201 /* 196 /* Dereference the Descriptor to find if this is a large or small item. */
202 * Dereference the Descriptor to find if this is a large or small item. 197
203 */
204 temp8 = *buffer; 198 temp8 = *buffer;
205 199
206 if (temp8 & 0x80) { 200 if (temp8 & 0x80) {
207 /* 201 /* Large Item, point to the length field */
208 * Large Item, point to the length field 202
209 */
210 buffer += 1; 203 buffer += 1;
211 204
212 /* Dereference */ 205 /* Dereference */
@@ -222,9 +215,8 @@ acpi_rs_vendor_resource (
222 buffer += 2; 215 buffer += 2;
223 } 216 }
224 else { 217 else {
225 /* 218 /* Small Item, dereference the size */
226 * Small Item, dereference the size 219
227 */
228 temp16 = (u8)(*buffer & 0x07); 220 temp16 = (u8)(*buffer & 0x07);
229 221
230 /* Calculate bytes consumed */ 222 /* Calculate bytes consumed */
@@ -251,14 +243,12 @@ acpi_rs_vendor_resource (
251 */ 243 */
252 struct_size += ACPI_ROUND_UP_to_32_bITS (temp16); 244 struct_size += ACPI_ROUND_UP_to_32_bITS (temp16);
253 245
254 /* 246 /* Set the Length parameter */
255 * Set the Length parameter 247
256 */
257 output_struct->length = (u32) struct_size; 248 output_struct->length = (u32) struct_size;
258 249
259 /* 250 /* Return the final size of the structure */
260 * Return the final size of the structure 251
261 */
262 *structure_size = struct_size; 252 *structure_size = struct_size;
263 return_ACPI_STATUS (AE_OK); 253 return_ACPI_STATUS (AE_OK);
264} 254}
@@ -295,13 +285,11 @@ acpi_rs_vendor_stream (
295 ACPI_FUNCTION_TRACE ("rs_vendor_stream"); 285 ACPI_FUNCTION_TRACE ("rs_vendor_stream");
296 286
297 287
298 /* 288 /* Dereference the length to find if this is a large or small item. */
299 * Dereference the length to find if this is a large or small item. 289
300 */
301 if(linked_list->data.vendor_specific.length > 7) { 290 if(linked_list->data.vendor_specific.length > 7) {
302 /* 291 /* Large Item, Set the descriptor field and length bytes */
303 * Large Item, Set the descriptor field and length bytes 292
304 */
305 *buffer = 0x84; 293 *buffer = 0x84;
306 buffer += 1; 294 buffer += 1;
307 295
@@ -311,9 +299,8 @@ acpi_rs_vendor_stream (
311 buffer += 2; 299 buffer += 2;
312 } 300 }
313 else { 301 else {
314 /* 302 /* Small Item, Set the descriptor field */
315 * Small Item, Set the descriptor field 303
316 */
317 temp8 = 0x70; 304 temp8 = 0x70;
318 temp8 |= (u8) linked_list->data.vendor_specific.length; 305 temp8 |= (u8) linked_list->data.vendor_specific.length;
319 306
@@ -321,9 +308,8 @@ acpi_rs_vendor_stream (
321 buffer += 1; 308 buffer += 1;
322 } 309 }
323 310
324 /* 311 /* Loop through all of the Vendor Specific fields */
325 * Loop through all of the Vendor Specific fields 312
326 */
327 for (index = 0; index < linked_list->data.vendor_specific.length; index++) { 313 for (index = 0; index < linked_list->data.vendor_specific.length; index++) {
328 temp8 = linked_list->data.vendor_specific.reserved[index]; 314 temp8 = linked_list->data.vendor_specific.reserved[index];
329 315
@@ -331,9 +317,8 @@ acpi_rs_vendor_stream (
331 buffer += 1; 317 buffer += 1;
332 } 318 }
333 319
334 /* 320 /* Return the number of bytes consumed in this operation */
335 * Return the number of bytes consumed in this operation 321
336 */
337 *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer); 322 *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer);
338 return_ACPI_STATUS (AE_OK); 323 return_ACPI_STATUS (AE_OK);
339} 324}
@@ -370,40 +355,37 @@ acpi_rs_start_depend_fns_resource (
370 u8 *buffer = byte_stream_buffer; 355 u8 *buffer = byte_stream_buffer;
371 struct acpi_resource *output_struct = (void *) *output_buffer; 356 struct acpi_resource *output_struct = (void *) *output_buffer;
372 u8 temp8 = 0; 357 u8 temp8 = 0;
373 acpi_size struct_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_start_dpf); 358 acpi_size struct_size = ACPI_SIZEOF_RESOURCE (
359 struct acpi_resource_start_dpf);
374 360
375 361
376 ACPI_FUNCTION_TRACE ("rs_start_depend_fns_resource"); 362 ACPI_FUNCTION_TRACE ("rs_start_depend_fns_resource");
377 363
378 364
379 /* 365 /* The number of bytes consumed are found in the descriptor (Bits:0-1) */
380 * The number of bytes consumed are contained in the descriptor (Bits:0-1) 366
381 */
382 temp8 = *buffer; 367 temp8 = *buffer;
383 368
384 *bytes_consumed = (temp8 & 0x01) + 1; 369 *bytes_consumed = (temp8 & 0x01) + 1;
385 370
386 output_struct->id = ACPI_RSTYPE_START_DPF; 371 output_struct->id = ACPI_RSTYPE_START_DPF;
387 372
388 /* 373 /* Point to Byte 1 if it is used */
389 * Point to Byte 1 if it is used 374
390 */
391 if (2 == *bytes_consumed) { 375 if (2 == *bytes_consumed) {
392 buffer += 1; 376 buffer += 1;
393 temp8 = *buffer; 377 temp8 = *buffer;
394 378
395 /* 379 /* Check Compatibility priority */
396 * Check Compatibility priority 380
397 */
398 output_struct->data.start_dpf.compatibility_priority = temp8 & 0x03; 381 output_struct->data.start_dpf.compatibility_priority = temp8 & 0x03;
399 382
400 if (3 == output_struct->data.start_dpf.compatibility_priority) { 383 if (3 == output_struct->data.start_dpf.compatibility_priority) {
401 return_ACPI_STATUS (AE_AML_BAD_RESOURCE_VALUE); 384 return_ACPI_STATUS (AE_AML_BAD_RESOURCE_VALUE);
402 } 385 }
403 386
404 /* 387 /* Check Performance/Robustness preference */
405 * Check Performance/Robustness preference 388
406 */
407 output_struct->data.start_dpf.performance_robustness = (temp8 >> 2) & 0x03; 389 output_struct->data.start_dpf.performance_robustness = (temp8 >> 2) & 0x03;
408 390
409 if (3 == output_struct->data.start_dpf.performance_robustness) { 391 if (3 == output_struct->data.start_dpf.performance_robustness) {
@@ -412,20 +394,18 @@ acpi_rs_start_depend_fns_resource (
412 } 394 }
413 else { 395 else {
414 output_struct->data.start_dpf.compatibility_priority = 396 output_struct->data.start_dpf.compatibility_priority =
415 ACPI_ACCEPTABLE_CONFIGURATION; 397 ACPI_ACCEPTABLE_CONFIGURATION;
416 398
417 output_struct->data.start_dpf.performance_robustness = 399 output_struct->data.start_dpf.performance_robustness =
418 ACPI_ACCEPTABLE_CONFIGURATION; 400 ACPI_ACCEPTABLE_CONFIGURATION;
419 } 401 }
420 402
421 /* 403 /* Set the Length parameter */
422 * Set the Length parameter 404
423 */
424 output_struct->length = (u32) struct_size; 405 output_struct->length = (u32) struct_size;
425 406
426 /* 407 /* Return the final size of the structure */
427 * Return the final size of the structure 408
428 */
429 *structure_size = struct_size; 409 *structure_size = struct_size;
430 return_ACPI_STATUS (AE_OK); 410 return_ACPI_STATUS (AE_OK);
431} 411}
@@ -466,24 +446,20 @@ acpi_rs_end_depend_fns_resource (
466 ACPI_FUNCTION_TRACE ("rs_end_depend_fns_resource"); 446 ACPI_FUNCTION_TRACE ("rs_end_depend_fns_resource");
467 447
468 448
469 /* 449 /* The number of bytes consumed is static */
470 * The number of bytes consumed is static 450
471 */
472 *bytes_consumed = 1; 451 *bytes_consumed = 1;
473 452
474 /* 453 /* Fill out the structure */
475 * Fill out the structure 454
476 */
477 output_struct->id = ACPI_RSTYPE_END_DPF; 455 output_struct->id = ACPI_RSTYPE_END_DPF;
478 456
479 /* 457 /* Set the Length parameter */
480 * Set the Length parameter 458
481 */
482 output_struct->length = (u32) struct_size; 459 output_struct->length = (u32) struct_size;
483 460
484 /* 461 /* Return the final size of the structure */
485 * Return the final size of the structure 462
486 */
487 *structure_size = struct_size; 463 *structure_size = struct_size;
488 return_ACPI_STATUS (AE_OK); 464 return_ACPI_STATUS (AE_OK);
489} 465}
@@ -533,9 +509,8 @@ acpi_rs_start_depend_fns_stream (
533 *buffer = 0x31; 509 *buffer = 0x31;
534 buffer += 1; 510 buffer += 1;
535 511
536 /* 512 /* Set the Priority Byte Definition */
537 * Set the Priority Byte Definition 513
538 */
539 temp8 = 0; 514 temp8 = 0;
540 temp8 = (u8) ((linked_list->data.start_dpf.performance_robustness & 515 temp8 = (u8) ((linked_list->data.start_dpf.performance_robustness &
541 0x03) << 2); 516 0x03) << 2);
@@ -546,9 +521,8 @@ acpi_rs_start_depend_fns_stream (
546 521
547 buffer += 1; 522 buffer += 1;
548 523
549 /* 524 /* Return the number of bytes consumed in this operation */
550 * Return the number of bytes consumed in this operation 525
551 */
552 *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer); 526 *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer);
553 return_ACPI_STATUS (AE_OK); 527 return_ACPI_STATUS (AE_OK);
554} 528}
@@ -582,15 +556,13 @@ acpi_rs_end_depend_fns_stream (
582 ACPI_FUNCTION_TRACE ("rs_end_depend_fns_stream"); 556 ACPI_FUNCTION_TRACE ("rs_end_depend_fns_stream");
583 557
584 558
585 /* 559 /* The descriptor field is static */
586 * The descriptor field is static 560
587 */
588 *buffer = 0x38; 561 *buffer = 0x38;
589 buffer += 1; 562 buffer += 1;
590 563
591 /* 564 /* Return the number of bytes consumed in this operation */
592 * Return the number of bytes consumed in this operation 565
593 */
594 *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer); 566 *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer);
595 return_ACPI_STATUS (AE_OK); 567 return_ACPI_STATUS (AE_OK);
596} 568}