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.c230
1 files changed, 94 insertions, 136 deletions
diff --git a/drivers/acpi/resources/rsmisc.c b/drivers/acpi/resources/rsmisc.c
index a1f1741f0d8..7a8a34e757f 100644
--- a/drivers/acpi/resources/rsmisc.c
+++ b/drivers/acpi/resources/rsmisc.c
@@ -41,13 +41,11 @@
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/acresrc.h> 45#include <acpi/acresrc.h>
47 46
48#define _COMPONENT ACPI_RESOURCES 47#define _COMPONENT ACPI_RESOURCES
49 ACPI_MODULE_NAME ("rsmisc") 48ACPI_MODULE_NAME("rsmisc")
50
51 49
52/******************************************************************************* 50/*******************************************************************************
53 * 51 *
@@ -69,20 +67,15 @@
69 * number of bytes consumed from the byte stream. 67 * number of bytes consumed from the byte stream.
70 * 68 *
71 ******************************************************************************/ 69 ******************************************************************************/
72
73acpi_status 70acpi_status
74acpi_rs_end_tag_resource ( 71acpi_rs_end_tag_resource(u8 * byte_stream_buffer,
75 u8 *byte_stream_buffer, 72 acpi_size * bytes_consumed,
76 acpi_size *bytes_consumed, 73 u8 ** output_buffer, acpi_size * structure_size)
77 u8 **output_buffer,
78 acpi_size *structure_size)
79{ 74{
80 struct acpi_resource *output_struct = (void *) *output_buffer; 75 struct acpi_resource *output_struct = (void *)*output_buffer;
81 acpi_size struct_size = ACPI_RESOURCE_LENGTH; 76 acpi_size struct_size = ACPI_RESOURCE_LENGTH;
82
83
84 ACPI_FUNCTION_TRACE ("rs_end_tag_resource");
85 77
78 ACPI_FUNCTION_TRACE("rs_end_tag_resource");
86 79
87 /* The number of bytes consumed is static */ 80 /* The number of bytes consumed is static */
88 81
@@ -99,10 +92,9 @@ acpi_rs_end_tag_resource (
99 /* Return the final size of the structure */ 92 /* Return the final size of the structure */
100 93
101 *structure_size = struct_size; 94 *structure_size = struct_size;
102 return_ACPI_STATUS (AE_OK); 95 return_ACPI_STATUS(AE_OK);
103} 96}
104 97
105
106/******************************************************************************* 98/*******************************************************************************
107 * 99 *
108 * FUNCTION: acpi_rs_end_tag_stream 100 * FUNCTION: acpi_rs_end_tag_stream
@@ -120,17 +112,13 @@ acpi_rs_end_tag_resource (
120 ******************************************************************************/ 112 ******************************************************************************/
121 113
122acpi_status 114acpi_status
123acpi_rs_end_tag_stream ( 115acpi_rs_end_tag_stream(struct acpi_resource *linked_list,
124 struct acpi_resource *linked_list, 116 u8 ** output_buffer, acpi_size * bytes_consumed)
125 u8 **output_buffer,
126 acpi_size *bytes_consumed)
127{ 117{
128 u8 *buffer = *output_buffer; 118 u8 *buffer = *output_buffer;
129 u8 temp8 = 0; 119 u8 temp8 = 0;
130
131
132 ACPI_FUNCTION_TRACE ("rs_end_tag_stream");
133 120
121 ACPI_FUNCTION_TRACE("rs_end_tag_stream");
134 122
135 /* The descriptor field is static */ 123 /* The descriptor field is static */
136 124
@@ -148,11 +136,10 @@ acpi_rs_end_tag_stream (
148 136
149 /* Return the number of bytes consumed in this operation */ 137 /* Return the number of bytes consumed in this operation */
150 138
151 *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer); 139 *bytes_consumed = ACPI_PTR_DIFF(buffer, *output_buffer);
152 return_ACPI_STATUS (AE_OK); 140 return_ACPI_STATUS(AE_OK);
153} 141}
154 142
155
156/******************************************************************************* 143/*******************************************************************************
157 * 144 *
158 * FUNCTION: acpi_rs_vendor_resource 145 * FUNCTION: acpi_rs_vendor_resource
@@ -175,23 +162,19 @@ acpi_rs_end_tag_stream (
175 ******************************************************************************/ 162 ******************************************************************************/
176 163
177acpi_status 164acpi_status
178acpi_rs_vendor_resource ( 165acpi_rs_vendor_resource(u8 * byte_stream_buffer,
179 u8 *byte_stream_buffer, 166 acpi_size * bytes_consumed,
180 acpi_size *bytes_consumed, 167 u8 ** output_buffer, acpi_size * structure_size)
181 u8 **output_buffer,
182 acpi_size *structure_size)
183{ 168{
184 u8 *buffer = byte_stream_buffer; 169 u8 *buffer = byte_stream_buffer;
185 struct acpi_resource *output_struct = (void *) *output_buffer; 170 struct acpi_resource *output_struct = (void *)*output_buffer;
186 u16 temp16 = 0; 171 u16 temp16 = 0;
187 u8 temp8 = 0; 172 u8 temp8 = 0;
188 u8 index; 173 u8 index;
189 acpi_size struct_size = ACPI_SIZEOF_RESOURCE ( 174 acpi_size struct_size =
190 struct acpi_resource_vendor); 175 ACPI_SIZEOF_RESOURCE(struct acpi_resource_vendor);
191
192
193 ACPI_FUNCTION_TRACE ("rs_vendor_resource");
194 176
177 ACPI_FUNCTION_TRACE("rs_vendor_resource");
195 178
196 /* Dereference the Descriptor to find if this is a large or small item. */ 179 /* Dereference the Descriptor to find if this is a large or small item. */
197 180
@@ -204,7 +187,7 @@ acpi_rs_vendor_resource (
204 187
205 /* Dereference */ 188 /* Dereference */
206 189
207 ACPI_MOVE_16_TO_16 (&temp16, buffer); 190 ACPI_MOVE_16_TO_16(&temp16, buffer);
208 191
209 /* Calculate bytes consumed */ 192 /* Calculate bytes consumed */
210 193
@@ -213,11 +196,10 @@ acpi_rs_vendor_resource (
213 /* Point to the first vendor byte */ 196 /* Point to the first vendor byte */
214 197
215 buffer += 2; 198 buffer += 2;
216 } 199 } else {
217 else {
218 /* Small Item, dereference the size */ 200 /* Small Item, dereference the size */
219 201
220 temp16 = (u8)(*buffer & 0x07); 202 temp16 = (u8) (*buffer & 0x07);
221 203
222 /* Calculate bytes consumed */ 204 /* Calculate bytes consumed */
223 205
@@ -241,7 +223,7 @@ acpi_rs_vendor_resource (
241 * calculate the length of the vendor string and expand the 223 * calculate the length of the vendor string and expand the
242 * struct_size to the next 32-bit boundary. 224 * struct_size to the next 32-bit boundary.
243 */ 225 */
244 struct_size += ACPI_ROUND_UP_to_32_bITS (temp16); 226 struct_size += ACPI_ROUND_UP_to_32_bITS(temp16);
245 227
246 /* Set the Length parameter */ 228 /* Set the Length parameter */
247 229
@@ -250,10 +232,9 @@ acpi_rs_vendor_resource (
250 /* Return the final size of the structure */ 232 /* Return the final size of the structure */
251 233
252 *structure_size = struct_size; 234 *structure_size = struct_size;
253 return_ACPI_STATUS (AE_OK); 235 return_ACPI_STATUS(AE_OK);
254} 236}
255 237
256
257/******************************************************************************* 238/*******************************************************************************
258 * 239 *
259 * FUNCTION: acpi_rs_vendor_stream 240 * FUNCTION: acpi_rs_vendor_stream
@@ -271,23 +252,19 @@ acpi_rs_vendor_resource (
271 ******************************************************************************/ 252 ******************************************************************************/
272 253
273acpi_status 254acpi_status
274acpi_rs_vendor_stream ( 255acpi_rs_vendor_stream(struct acpi_resource *linked_list,
275 struct acpi_resource *linked_list, 256 u8 ** output_buffer, acpi_size * bytes_consumed)
276 u8 **output_buffer,
277 acpi_size *bytes_consumed)
278{ 257{
279 u8 *buffer = *output_buffer; 258 u8 *buffer = *output_buffer;
280 u16 temp16 = 0; 259 u16 temp16 = 0;
281 u8 temp8 = 0; 260 u8 temp8 = 0;
282 u8 index; 261 u8 index;
283
284
285 ACPI_FUNCTION_TRACE ("rs_vendor_stream");
286 262
263 ACPI_FUNCTION_TRACE("rs_vendor_stream");
287 264
288 /* Dereference the length to find if this is a large or small item. */ 265 /* Dereference the length to find if this is a large or small item. */
289 266
290 if(linked_list->data.vendor_specific.length > 7) { 267 if (linked_list->data.vendor_specific.length > 7) {
291 /* Large Item, Set the descriptor field and length bytes */ 268 /* Large Item, Set the descriptor field and length bytes */
292 269
293 *buffer = 0x84; 270 *buffer = 0x84;
@@ -295,10 +272,9 @@ acpi_rs_vendor_stream (
295 272
296 temp16 = (u16) linked_list->data.vendor_specific.length; 273 temp16 = (u16) linked_list->data.vendor_specific.length;
297 274
298 ACPI_MOVE_16_TO_16 (buffer, &temp16); 275 ACPI_MOVE_16_TO_16(buffer, &temp16);
299 buffer += 2; 276 buffer += 2;
300 } 277 } else {
301 else {
302 /* Small Item, Set the descriptor field */ 278 /* Small Item, Set the descriptor field */
303 279
304 temp8 = 0x70; 280 temp8 = 0x70;
@@ -310,7 +286,8 @@ acpi_rs_vendor_stream (
310 286
311 /* Loop through all of the Vendor Specific fields */ 287 /* Loop through all of the Vendor Specific fields */
312 288
313 for (index = 0; index < linked_list->data.vendor_specific.length; index++) { 289 for (index = 0; index < linked_list->data.vendor_specific.length;
290 index++) {
314 temp8 = linked_list->data.vendor_specific.reserved[index]; 291 temp8 = linked_list->data.vendor_specific.reserved[index];
315 292
316 *buffer = temp8; 293 *buffer = temp8;
@@ -319,11 +296,10 @@ acpi_rs_vendor_stream (
319 296
320 /* Return the number of bytes consumed in this operation */ 297 /* Return the number of bytes consumed in this operation */
321 298
322 *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer); 299 *bytes_consumed = ACPI_PTR_DIFF(buffer, *output_buffer);
323 return_ACPI_STATUS (AE_OK); 300 return_ACPI_STATUS(AE_OK);
324} 301}
325 302
326
327/******************************************************************************* 303/*******************************************************************************
328 * 304 *
329 * FUNCTION: acpi_rs_start_depend_fns_resource 305 * FUNCTION: acpi_rs_start_depend_fns_resource
@@ -346,21 +322,18 @@ acpi_rs_vendor_stream (
346 ******************************************************************************/ 322 ******************************************************************************/
347 323
348acpi_status 324acpi_status
349acpi_rs_start_depend_fns_resource ( 325acpi_rs_start_depend_fns_resource(u8 * byte_stream_buffer,
350 u8 *byte_stream_buffer, 326 acpi_size * bytes_consumed,
351 acpi_size *bytes_consumed, 327 u8 ** output_buffer,
352 u8 **output_buffer, 328 acpi_size * structure_size)
353 acpi_size *structure_size)
354{ 329{
355 u8 *buffer = byte_stream_buffer; 330 u8 *buffer = byte_stream_buffer;
356 struct acpi_resource *output_struct = (void *) *output_buffer; 331 struct acpi_resource *output_struct = (void *)*output_buffer;
357 u8 temp8 = 0; 332 u8 temp8 = 0;
358 acpi_size struct_size = ACPI_SIZEOF_RESOURCE ( 333 acpi_size struct_size =
359 struct acpi_resource_start_dpf); 334 ACPI_SIZEOF_RESOURCE(struct acpi_resource_start_dpf);
360
361
362 ACPI_FUNCTION_TRACE ("rs_start_depend_fns_resource");
363 335
336 ACPI_FUNCTION_TRACE("rs_start_depend_fns_resource");
364 337
365 /* The number of bytes consumed are found in the descriptor (Bits:0-1) */ 338 /* The number of bytes consumed are found in the descriptor (Bits:0-1) */
366 339
@@ -378,26 +351,27 @@ acpi_rs_start_depend_fns_resource (
378 351
379 /* Check Compatibility priority */ 352 /* Check Compatibility priority */
380 353
381 output_struct->data.start_dpf.compatibility_priority = temp8 & 0x03; 354 output_struct->data.start_dpf.compatibility_priority =
355 temp8 & 0x03;
382 356
383 if (3 == output_struct->data.start_dpf.compatibility_priority) { 357 if (3 == output_struct->data.start_dpf.compatibility_priority) {
384 return_ACPI_STATUS (AE_AML_BAD_RESOURCE_VALUE); 358 return_ACPI_STATUS(AE_AML_BAD_RESOURCE_VALUE);
385 } 359 }
386 360
387 /* Check Performance/Robustness preference */ 361 /* Check Performance/Robustness preference */
388 362
389 output_struct->data.start_dpf.performance_robustness = (temp8 >> 2) & 0x03; 363 output_struct->data.start_dpf.performance_robustness =
364 (temp8 >> 2) & 0x03;
390 365
391 if (3 == output_struct->data.start_dpf.performance_robustness) { 366 if (3 == output_struct->data.start_dpf.performance_robustness) {
392 return_ACPI_STATUS (AE_AML_BAD_RESOURCE_VALUE); 367 return_ACPI_STATUS(AE_AML_BAD_RESOURCE_VALUE);
393 } 368 }
394 } 369 } else {
395 else {
396 output_struct->data.start_dpf.compatibility_priority = 370 output_struct->data.start_dpf.compatibility_priority =
397 ACPI_ACCEPTABLE_CONFIGURATION; 371 ACPI_ACCEPTABLE_CONFIGURATION;
398 372
399 output_struct->data.start_dpf.performance_robustness = 373 output_struct->data.start_dpf.performance_robustness =
400 ACPI_ACCEPTABLE_CONFIGURATION; 374 ACPI_ACCEPTABLE_CONFIGURATION;
401 } 375 }
402 376
403 /* Set the Length parameter */ 377 /* Set the Length parameter */
@@ -407,10 +381,9 @@ acpi_rs_start_depend_fns_resource (
407 /* Return the final size of the structure */ 381 /* Return the final size of the structure */
408 382
409 *structure_size = struct_size; 383 *structure_size = struct_size;
410 return_ACPI_STATUS (AE_OK); 384 return_ACPI_STATUS(AE_OK);
411} 385}
412 386
413
414/******************************************************************************* 387/*******************************************************************************
415 * 388 *
416 * FUNCTION: acpi_rs_end_depend_fns_resource 389 * FUNCTION: acpi_rs_end_depend_fns_resource
@@ -433,18 +406,14 @@ acpi_rs_start_depend_fns_resource (
433 ******************************************************************************/ 406 ******************************************************************************/
434 407
435acpi_status 408acpi_status
436acpi_rs_end_depend_fns_resource ( 409acpi_rs_end_depend_fns_resource(u8 * byte_stream_buffer,
437 u8 *byte_stream_buffer, 410 acpi_size * bytes_consumed,
438 acpi_size *bytes_consumed, 411 u8 ** output_buffer, acpi_size * structure_size)
439 u8 **output_buffer,
440 acpi_size *structure_size)
441{ 412{
442 struct acpi_resource *output_struct = (void *) *output_buffer; 413 struct acpi_resource *output_struct = (void *)*output_buffer;
443 acpi_size struct_size = ACPI_RESOURCE_LENGTH; 414 acpi_size struct_size = ACPI_RESOURCE_LENGTH;
444
445
446 ACPI_FUNCTION_TRACE ("rs_end_depend_fns_resource");
447 415
416 ACPI_FUNCTION_TRACE("rs_end_depend_fns_resource");
448 417
449 /* The number of bytes consumed is static */ 418 /* The number of bytes consumed is static */
450 419
@@ -461,10 +430,9 @@ acpi_rs_end_depend_fns_resource (
461 /* Return the final size of the structure */ 430 /* Return the final size of the structure */
462 431
463 *structure_size = struct_size; 432 *structure_size = struct_size;
464 return_ACPI_STATUS (AE_OK); 433 return_ACPI_STATUS(AE_OK);
465} 434}
466 435
467
468/******************************************************************************* 436/*******************************************************************************
469 * 437 *
470 * FUNCTION: acpi_rs_start_depend_fns_stream 438 * FUNCTION: acpi_rs_start_depend_fns_stream
@@ -483,39 +451,35 @@ acpi_rs_end_depend_fns_resource (
483 ******************************************************************************/ 451 ******************************************************************************/
484 452
485acpi_status 453acpi_status
486acpi_rs_start_depend_fns_stream ( 454acpi_rs_start_depend_fns_stream(struct acpi_resource *linked_list,
487 struct acpi_resource *linked_list, 455 u8 ** output_buffer, acpi_size * bytes_consumed)
488 u8 **output_buffer,
489 acpi_size *bytes_consumed)
490{ 456{
491 u8 *buffer = *output_buffer; 457 u8 *buffer = *output_buffer;
492 u8 temp8 = 0; 458 u8 temp8 = 0;
493
494
495 ACPI_FUNCTION_TRACE ("rs_start_depend_fns_stream");
496 459
460 ACPI_FUNCTION_TRACE("rs_start_depend_fns_stream");
497 461
498 /* 462 /*
499 * The descriptor field is set based upon whether a byte is needed 463 * The descriptor field is set based upon whether a byte is needed
500 * to contain Priority data. 464 * to contain Priority data.
501 */ 465 */
502 if (ACPI_ACCEPTABLE_CONFIGURATION == 466 if (ACPI_ACCEPTABLE_CONFIGURATION ==
503 linked_list->data.start_dpf.compatibility_priority && 467 linked_list->data.start_dpf.compatibility_priority &&
504 ACPI_ACCEPTABLE_CONFIGURATION == 468 ACPI_ACCEPTABLE_CONFIGURATION ==
505 linked_list->data.start_dpf.performance_robustness) { 469 linked_list->data.start_dpf.performance_robustness) {
506 *buffer = 0x30; 470 *buffer = 0x30;
507 } 471 } else {
508 else {
509 *buffer = 0x31; 472 *buffer = 0x31;
510 buffer += 1; 473 buffer += 1;
511 474
512 /* Set the Priority Byte Definition */ 475 /* Set the Priority Byte Definition */
513 476
514 temp8 = 0; 477 temp8 = 0;
515 temp8 = (u8) ((linked_list->data.start_dpf.performance_robustness & 478 temp8 =
516 0x03) << 2); 479 (u8) ((linked_list->data.start_dpf.
517 temp8 |= (linked_list->data.start_dpf.compatibility_priority & 480 performance_robustness & 0x03) << 2);
518 0x03); 481 temp8 |=
482 (linked_list->data.start_dpf.compatibility_priority & 0x03);
519 *buffer = temp8; 483 *buffer = temp8;
520 } 484 }
521 485
@@ -523,11 +487,10 @@ acpi_rs_start_depend_fns_stream (
523 487
524 /* Return the number of bytes consumed in this operation */ 488 /* Return the number of bytes consumed in this operation */
525 489
526 *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer); 490 *bytes_consumed = ACPI_PTR_DIFF(buffer, *output_buffer);
527 return_ACPI_STATUS (AE_OK); 491 return_ACPI_STATUS(AE_OK);
528} 492}
529 493
530
531/******************************************************************************* 494/*******************************************************************************
532 * 495 *
533 * FUNCTION: acpi_rs_end_depend_fns_stream 496 * FUNCTION: acpi_rs_end_depend_fns_stream
@@ -545,16 +508,12 @@ acpi_rs_start_depend_fns_stream (
545 ******************************************************************************/ 508 ******************************************************************************/
546 509
547acpi_status 510acpi_status
548acpi_rs_end_depend_fns_stream ( 511acpi_rs_end_depend_fns_stream(struct acpi_resource *linked_list,
549 struct acpi_resource *linked_list, 512 u8 ** output_buffer, acpi_size * bytes_consumed)
550 u8 **output_buffer,
551 acpi_size *bytes_consumed)
552{ 513{
553 u8 *buffer = *output_buffer; 514 u8 *buffer = *output_buffer;
554
555
556 ACPI_FUNCTION_TRACE ("rs_end_depend_fns_stream");
557 515
516 ACPI_FUNCTION_TRACE("rs_end_depend_fns_stream");
558 517
559 /* The descriptor field is static */ 518 /* The descriptor field is static */
560 519
@@ -563,7 +522,6 @@ acpi_rs_end_depend_fns_stream (
563 522
564 /* Return the number of bytes consumed in this operation */ 523 /* Return the number of bytes consumed in this operation */
565 524
566 *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer); 525 *bytes_consumed = ACPI_PTR_DIFF(buffer, *output_buffer);
567 return_ACPI_STATUS (AE_OK); 526 return_ACPI_STATUS(AE_OK);
568} 527}
569