Print this page
update to acpica-unix2-20131115
acpica-unix2-20130823
PANKOVs restructure
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/uts/intel/io/acpica/resources/rsutils.c
+++ new/usr/src/common/acpica/components/resources/rsutils.c
1 1 /*******************************************************************************
2 2 *
3 3 * Module Name: rsutils - Utilities for the resource manager
4 4 *
5 5 ******************************************************************************/
6 6
7 7 /*
8 - * Copyright (C) 2000 - 2011, Intel Corp.
8 + * Copyright (C) 2000 - 2013, Intel Corp.
9 9 * All rights reserved.
10 10 *
11 11 * Redistribution and use in source and binary forms, with or without
12 12 * modification, are permitted provided that the following conditions
13 13 * are met:
14 14 * 1. Redistributions of source code must retain the above copyright
15 15 * notice, this list of conditions, and the following disclaimer,
16 16 * without modification.
17 17 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18 18 * substantially similar to the "NO WARRANTY" disclaimer below
19 19 * ("Disclaimer") and any redistribution must be conditioned upon
20 20 * including a substantially similar Disclaimer requirement for further
21 21 * binary redistribution.
22 22 * 3. Neither the names of the above-listed copyright holders nor the names
23 23 * of any contributors may be used to endorse or promote products derived
24 24 * from this software without specific prior written permission.
25 25 *
26 26 * Alternatively, this software may be distributed under the terms of the
27 27 * GNU General Public License ("GPL") version 2 as published by the Free
28 28 * Software Foundation.
29 29 *
30 30 * NO WARRANTY
31 31 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32 32 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33 33 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
34 34 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35 35 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36 36 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37 37 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38 38 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39 39 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40 40 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41 41 * POSSIBILITY OF SUCH DAMAGES.
42 42 */
43 43
44 44
45 45 #define __RSUTILS_C__
46 46
47 47 #include "acpi.h"
48 48 #include "accommon.h"
49 49 #include "acnamesp.h"
50 50 #include "acresrc.h"
51 51
52 52
53 53 #define _COMPONENT ACPI_RESOURCES
54 54 ACPI_MODULE_NAME ("rsutils")
55 55
56 56
57 57 /*******************************************************************************
58 58 *
59 59 * FUNCTION: AcpiRsDecodeBitmask
60 60 *
61 61 * PARAMETERS: Mask - Bitmask to decode
62 62 * List - Where the converted list is returned
63 63 *
64 64 * RETURN: Count of bits set (length of list)
65 65 *
66 66 * DESCRIPTION: Convert a bit mask into a list of values
67 67 *
68 68 ******************************************************************************/
69 69
70 70 UINT8
71 71 AcpiRsDecodeBitmask (
72 72 UINT16 Mask,
73 73 UINT8 *List)
74 74 {
75 75 UINT8 i;
76 76 UINT8 BitCount;
77 77
78 78
79 79 ACPI_FUNCTION_ENTRY ();
80 80
81 81
82 82 /* Decode the mask bits */
83 83
84 84 for (i = 0, BitCount = 0; Mask; i++)
85 85 {
86 86 if (Mask & 0x0001)
87 87 {
88 88 List[BitCount] = i;
89 89 BitCount++;
90 90 }
91 91
92 92 Mask >>= 1;
93 93 }
94 94
95 95 return (BitCount);
96 96 }
97 97
98 98
99 99 /*******************************************************************************
100 100 *
101 101 * FUNCTION: AcpiRsEncodeBitmask
102 102 *
103 103 * PARAMETERS: List - List of values to encode
104 104 * Count - Length of list
105 105 *
106 106 * RETURN: Encoded bitmask
107 107 *
108 108 * DESCRIPTION: Convert a list of values to an encoded bitmask
109 109 *
110 110 ******************************************************************************/
111 111
112 112 UINT16
113 113 AcpiRsEncodeBitmask (
114 114 UINT8 *List,
115 115 UINT8 Count)
116 116 {
117 117 UINT32 i;
118 118 UINT16 Mask;
119 119
120 120
121 121 ACPI_FUNCTION_ENTRY ();
122 122
123 123
124 124 /* Encode the list into a single bitmask */
125 125
126 126 for (i = 0, Mask = 0; i < Count; i++)
127 127 {
128 128 Mask |= (0x1 << List[i]);
129 129 }
130 130
131 131 return (Mask);
132 132 }
133 133
134 134
135 135 /*******************************************************************************
136 136 *
137 137 * FUNCTION: AcpiRsMoveData
138 138 *
139 139 * PARAMETERS: Destination - Pointer to the destination descriptor
140 140 * Source - Pointer to the source descriptor
141 141 * ItemCount - How many items to move
142 142 * MoveType - Byte width
143 143 *
144 144 * RETURN: None
145 145 *
146 146 * DESCRIPTION: Move multiple data items from one descriptor to another. Handles
147 147 * alignment issues and endian issues if necessary, as configured
148 148 * via the ACPI_MOVE_* macros. (This is why a memcpy is not used)
149 149 *
150 150 ******************************************************************************/
151 151
152 152 void
153 153 AcpiRsMoveData (
154 154 void *Destination,
155 155 void *Source,
156 156 UINT16 ItemCount,
157 157 UINT8 MoveType)
158 158 {
159 159 UINT32 i;
160 160
161 161
162 162 ACPI_FUNCTION_ENTRY ();
163 163
164 164
165 165 /* One move per item */
↓ open down ↓ |
147 lines elided |
↑ open up ↑ |
166 166
167 167 for (i = 0; i < ItemCount; i++)
168 168 {
169 169 switch (MoveType)
170 170 {
171 171 /*
172 172 * For the 8-bit case, we can perform the move all at once
173 173 * since there are no alignment or endian issues
174 174 */
175 175 case ACPI_RSC_MOVE8:
176 + case ACPI_RSC_MOVE_GPIO_RES:
177 + case ACPI_RSC_MOVE_SERIAL_VEN:
178 + case ACPI_RSC_MOVE_SERIAL_RES:
179 +
176 180 ACPI_MEMCPY (Destination, Source, ItemCount);
177 181 return;
178 182
179 183 /*
180 184 * 16-, 32-, and 64-bit cases must use the move macros that perform
181 - * endian conversion and/or accomodate hardware that cannot perform
185 + * endian conversion and/or accommodate hardware that cannot perform
182 186 * misaligned memory transfers
183 187 */
184 188 case ACPI_RSC_MOVE16:
189 + case ACPI_RSC_MOVE_GPIO_PIN:
190 +
185 191 ACPI_MOVE_16_TO_16 (&ACPI_CAST_PTR (UINT16, Destination)[i],
186 192 &ACPI_CAST_PTR (UINT16, Source)[i]);
187 193 break;
188 194
189 195 case ACPI_RSC_MOVE32:
196 +
190 197 ACPI_MOVE_32_TO_32 (&ACPI_CAST_PTR (UINT32, Destination)[i],
191 198 &ACPI_CAST_PTR (UINT32, Source)[i]);
192 199 break;
193 200
194 201 case ACPI_RSC_MOVE64:
202 +
195 203 ACPI_MOVE_64_TO_64 (&ACPI_CAST_PTR (UINT64, Destination)[i],
196 204 &ACPI_CAST_PTR (UINT64, Source)[i]);
197 205 break;
198 206
199 207 default:
208 +
200 209 return;
201 210 }
202 211 }
203 212 }
204 213
205 214
206 215 /*******************************************************************************
207 216 *
208 217 * FUNCTION: AcpiRsSetResourceLength
209 218 *
210 219 * PARAMETERS: TotalLength - Length of the AML descriptor, including
211 220 * the header and length fields.
212 221 * Aml - Pointer to the raw AML descriptor
213 222 *
214 223 * RETURN: None
215 224 *
216 225 * DESCRIPTION: Set the ResourceLength field of an AML
217 226 * resource descriptor, both Large and Small descriptors are
218 227 * supported automatically. Note: Descriptor Type field must
219 228 * be valid.
220 229 *
221 230 ******************************************************************************/
222 231
223 232 void
224 233 AcpiRsSetResourceLength (
225 234 ACPI_RSDESC_SIZE TotalLength,
226 235 AML_RESOURCE *Aml)
227 236 {
228 237 ACPI_RS_LENGTH ResourceLength;
229 238
230 239
231 240 ACPI_FUNCTION_ENTRY ();
232 241
233 242
234 243 /* Length is the total descriptor length minus the header length */
235 244
236 245 ResourceLength = (ACPI_RS_LENGTH)
237 246 (TotalLength - AcpiUtGetResourceHeaderLength (Aml));
238 247
239 248 /* Length is stored differently for large and small descriptors */
240 249
241 250 if (Aml->SmallHeader.DescriptorType & ACPI_RESOURCE_NAME_LARGE)
242 251 {
243 252 /* Large descriptor -- bytes 1-2 contain the 16-bit length */
244 253
245 254 ACPI_MOVE_16_TO_16 (&Aml->LargeHeader.ResourceLength, &ResourceLength);
246 255 }
247 256 else
248 257 {
249 258 /* Small descriptor -- bits 2:0 of byte 0 contain the length */
250 259
251 260 Aml->SmallHeader.DescriptorType = (UINT8)
252 261
253 262 /* Clear any existing length, preserving descriptor type bits */
254 263
255 264 ((Aml->SmallHeader.DescriptorType & ~ACPI_RESOURCE_NAME_SMALL_LENGTH_MASK)
256 265
257 266 | ResourceLength);
258 267 }
259 268 }
260 269
261 270
262 271 /*******************************************************************************
263 272 *
264 273 * FUNCTION: AcpiRsSetResourceHeader
265 274 *
266 275 * PARAMETERS: DescriptorType - Byte to be inserted as the type
267 276 * TotalLength - Length of the AML descriptor, including
268 277 * the header and length fields.
269 278 * Aml - Pointer to the raw AML descriptor
270 279 *
271 280 * RETURN: None
272 281 *
273 282 * DESCRIPTION: Set the DescriptorType and ResourceLength fields of an AML
274 283 * resource descriptor, both Large and Small descriptors are
275 284 * supported automatically
276 285 *
277 286 ******************************************************************************/
278 287
279 288 void
280 289 AcpiRsSetResourceHeader (
281 290 UINT8 DescriptorType,
282 291 ACPI_RSDESC_SIZE TotalLength,
283 292 AML_RESOURCE *Aml)
284 293 {
285 294 ACPI_FUNCTION_ENTRY ();
286 295
287 296
288 297 /* Set the Resource Type */
289 298
290 299 Aml->SmallHeader.DescriptorType = DescriptorType;
291 300
292 301 /* Set the Resource Length */
293 302
294 303 AcpiRsSetResourceLength (TotalLength, Aml);
295 304 }
296 305
297 306
298 307 /*******************************************************************************
299 308 *
300 309 * FUNCTION: AcpiRsStrcpy
301 310 *
302 311 * PARAMETERS: Destination - Pointer to the destination string
303 312 * Source - Pointer to the source string
304 313 *
305 314 * RETURN: String length, including NULL terminator
306 315 *
307 316 * DESCRIPTION: Local string copy that returns the string length, saving a
308 317 * strcpy followed by a strlen.
309 318 *
310 319 ******************************************************************************/
311 320
312 321 static UINT16
313 322 AcpiRsStrcpy (
314 323 char *Destination,
315 324 char *Source)
316 325 {
317 326 UINT16 i;
318 327
319 328
320 329 ACPI_FUNCTION_ENTRY ();
321 330
322 331
323 332 for (i = 0; Source[i]; i++)
324 333 {
325 334 Destination[i] = Source[i];
326 335 }
327 336
328 337 Destination[i] = 0;
329 338
330 339 /* Return string length including the NULL terminator */
331 340
332 341 return ((UINT16) (i + 1));
333 342 }
334 343
335 344
336 345 /*******************************************************************************
337 346 *
338 347 * FUNCTION: AcpiRsGetResourceSource
339 348 *
340 349 * PARAMETERS: ResourceLength - Length field of the descriptor
341 350 * MinimumLength - Minimum length of the descriptor (minus
342 351 * any optional fields)
343 352 * ResourceSource - Where the ResourceSource is returned
344 353 * Aml - Pointer to the raw AML descriptor
345 354 * StringPtr - (optional) where to store the actual
346 355 * ResourceSource string
347 356 *
348 357 * RETURN: Length of the string plus NULL terminator, rounded up to native
349 358 * word boundary
350 359 *
351 360 * DESCRIPTION: Copy the optional ResourceSource data from a raw AML descriptor
352 361 * to an internal resource descriptor
353 362 *
354 363 ******************************************************************************/
355 364
356 365 ACPI_RS_LENGTH
357 366 AcpiRsGetResourceSource (
358 367 ACPI_RS_LENGTH ResourceLength,
359 368 ACPI_RS_LENGTH MinimumLength,
360 369 ACPI_RESOURCE_SOURCE *ResourceSource,
361 370 AML_RESOURCE *Aml,
362 371 char *StringPtr)
363 372 {
364 373 ACPI_RSDESC_SIZE TotalLength;
365 374 UINT8 *AmlResourceSource;
366 375
367 376
368 377 ACPI_FUNCTION_ENTRY ();
369 378
370 379
371 380 TotalLength = ResourceLength + sizeof (AML_RESOURCE_LARGE_HEADER);
372 381 AmlResourceSource = ACPI_ADD_PTR (UINT8, Aml, MinimumLength);
373 382
374 383 /*
375 384 * ResourceSource is present if the length of the descriptor is longer than
376 385 * the minimum length.
377 386 *
378 387 * Note: Some resource descriptors will have an additional null, so
379 388 * we add 1 to the minimum length.
380 389 */
381 390 if (TotalLength > (ACPI_RSDESC_SIZE) (MinimumLength + 1))
382 391 {
383 392 /* Get the ResourceSourceIndex */
384 393
385 394 ResourceSource->Index = AmlResourceSource[0];
386 395
387 396 ResourceSource->StringPtr = StringPtr;
388 397 if (!StringPtr)
389 398 {
390 399 /*
391 400 * String destination pointer is not specified; Set the String
392 401 * pointer to the end of the current ResourceSource structure.
393 402 */
394 403 ResourceSource->StringPtr = ACPI_ADD_PTR (char, ResourceSource,
395 404 sizeof (ACPI_RESOURCE_SOURCE));
396 405 }
397 406
398 407 /*
399 408 * In order for the Resource length to be a multiple of the native
400 409 * word, calculate the length of the string (+1 for NULL terminator)
401 410 * and expand to the next word multiple.
402 411 *
403 412 * Zero the entire area of the buffer.
404 413 */
405 414 TotalLength = (UINT32) ACPI_STRLEN (
406 415 ACPI_CAST_PTR (char, &AmlResourceSource[1])) + 1;
407 416 TotalLength = (UINT32) ACPI_ROUND_UP_TO_NATIVE_WORD (TotalLength);
408 417
409 418 ACPI_MEMSET (ResourceSource->StringPtr, 0, TotalLength);
410 419
411 420 /* Copy the ResourceSource string to the destination */
412 421
413 422 ResourceSource->StringLength = AcpiRsStrcpy (ResourceSource->StringPtr,
414 423 ACPI_CAST_PTR (char, &AmlResourceSource[1]));
415 424
416 425 return ((ACPI_RS_LENGTH) TotalLength);
417 426 }
418 427
419 428 /* ResourceSource is not present */
420 429
421 430 ResourceSource->Index = 0;
422 431 ResourceSource->StringLength = 0;
423 432 ResourceSource->StringPtr = NULL;
424 433 return (0);
425 434 }
426 435
427 436
428 437 /*******************************************************************************
429 438 *
430 439 * FUNCTION: AcpiRsSetResourceSource
431 440 *
432 441 * PARAMETERS: Aml - Pointer to the raw AML descriptor
433 442 * MinimumLength - Minimum length of the descriptor (minus
434 443 * any optional fields)
435 444 * ResourceSource - Internal ResourceSource
436 445
437 446 *
438 447 * RETURN: Total length of the AML descriptor
439 448 *
440 449 * DESCRIPTION: Convert an optional ResourceSource from internal format to a
441 450 * raw AML resource descriptor
442 451 *
443 452 ******************************************************************************/
444 453
445 454 ACPI_RSDESC_SIZE
446 455 AcpiRsSetResourceSource (
447 456 AML_RESOURCE *Aml,
448 457 ACPI_RS_LENGTH MinimumLength,
449 458 ACPI_RESOURCE_SOURCE *ResourceSource)
450 459 {
451 460 UINT8 *AmlResourceSource;
452 461 ACPI_RSDESC_SIZE DescriptorLength;
453 462
454 463
455 464 ACPI_FUNCTION_ENTRY ();
456 465
457 466
458 467 DescriptorLength = MinimumLength;
459 468
460 469 /* Non-zero string length indicates presence of a ResourceSource */
461 470
462 471 if (ResourceSource->StringLength)
463 472 {
464 473 /* Point to the end of the AML descriptor */
465 474
466 475 AmlResourceSource = ACPI_ADD_PTR (UINT8, Aml, MinimumLength);
467 476
468 477 /* Copy the ResourceSourceIndex */
469 478
470 479 AmlResourceSource[0] = (UINT8) ResourceSource->Index;
471 480
472 481 /* Copy the ResourceSource string */
473 482
474 483 ACPI_STRCPY (ACPI_CAST_PTR (char, &AmlResourceSource[1]),
475 484 ResourceSource->StringPtr);
476 485
477 486 /*
478 487 * Add the length of the string (+ 1 for null terminator) to the
479 488 * final descriptor length
480 489 */
481 490 DescriptorLength += ((ACPI_RSDESC_SIZE) ResourceSource->StringLength + 1);
482 491 }
483 492
484 493 /* Return the new total length of the AML descriptor */
485 494
486 495 return (DescriptorLength);
487 496 }
488 497
489 498
490 499 /*******************************************************************************
491 500 *
492 501 * FUNCTION: AcpiRsGetPrtMethodData
493 502 *
494 503 * PARAMETERS: Node - Device node
495 504 * RetBuffer - Pointer to a buffer structure for the
496 505 * results
497 506 *
498 507 * RETURN: Status
499 508 *
500 509 * DESCRIPTION: This function is called to get the _PRT value of an object
501 510 * contained in an object specified by the handle passed in
502 511 *
503 512 * If the function fails an appropriate status will be returned
504 513 * and the contents of the callers buffer is undefined.
505 514 *
506 515 ******************************************************************************/
507 516
508 517 ACPI_STATUS
509 518 AcpiRsGetPrtMethodData (
510 519 ACPI_NAMESPACE_NODE *Node,
511 520 ACPI_BUFFER *RetBuffer)
512 521 {
513 522 ACPI_OPERAND_OBJECT *ObjDesc;
514 523 ACPI_STATUS Status;
515 524
516 525
517 526 ACPI_FUNCTION_TRACE (RsGetPrtMethodData);
518 527
519 528
520 529 /* Parameters guaranteed valid by caller */
521 530
522 531 /* Execute the method, no parameters */
523 532
524 533 Status = AcpiUtEvaluateObject (Node, METHOD_NAME__PRT,
525 534 ACPI_BTYPE_PACKAGE, &ObjDesc);
526 535 if (ACPI_FAILURE (Status))
527 536 {
528 537 return_ACPI_STATUS (Status);
529 538 }
530 539
531 540 /*
532 541 * Create a resource linked list from the byte stream buffer that comes
533 542 * back from the _CRS method execution.
534 543 */
535 544 Status = AcpiRsCreatePciRoutingTable (ObjDesc, RetBuffer);
536 545
537 546 /* On exit, we must delete the object returned by EvaluateObject */
538 547
539 548 AcpiUtRemoveReference (ObjDesc);
540 549 return_ACPI_STATUS (Status);
541 550 }
542 551
543 552
544 553 /*******************************************************************************
545 554 *
546 555 * FUNCTION: AcpiRsGetCrsMethodData
547 556 *
548 557 * PARAMETERS: Node - Device node
549 558 * RetBuffer - Pointer to a buffer structure for the
550 559 * results
551 560 *
552 561 * RETURN: Status
553 562 *
554 563 * DESCRIPTION: This function is called to get the _CRS value of an object
555 564 * contained in an object specified by the handle passed in
556 565 *
557 566 * If the function fails an appropriate status will be returned
558 567 * and the contents of the callers buffer is undefined.
559 568 *
560 569 ******************************************************************************/
561 570
562 571 ACPI_STATUS
563 572 AcpiRsGetCrsMethodData (
564 573 ACPI_NAMESPACE_NODE *Node,
565 574 ACPI_BUFFER *RetBuffer)
566 575 {
567 576 ACPI_OPERAND_OBJECT *ObjDesc;
568 577 ACPI_STATUS Status;
569 578
570 579
571 580 ACPI_FUNCTION_TRACE (RsGetCrsMethodData);
572 581
573 582
574 583 /* Parameters guaranteed valid by caller */
575 584
576 585 /* Execute the method, no parameters */
577 586
578 587 Status = AcpiUtEvaluateObject (Node, METHOD_NAME__CRS,
579 588 ACPI_BTYPE_BUFFER, &ObjDesc);
580 589 if (ACPI_FAILURE (Status))
581 590 {
582 591 return_ACPI_STATUS (Status);
583 592 }
584 593
585 594 /*
586 595 * Make the call to create a resource linked list from the
587 596 * byte stream buffer that comes back from the _CRS method
588 597 * execution.
589 598 */
590 599 Status = AcpiRsCreateResourceList (ObjDesc, RetBuffer);
591 600
592 601 /* On exit, we must delete the object returned by evaluateObject */
593 602
594 603 AcpiUtRemoveReference (ObjDesc);
595 604 return_ACPI_STATUS (Status);
596 605 }
597 606
598 607
599 608 /*******************************************************************************
600 609 *
601 610 * FUNCTION: AcpiRsGetPrsMethodData
602 611 *
603 612 * PARAMETERS: Node - Device node
604 613 * RetBuffer - Pointer to a buffer structure for the
605 614 * results
606 615 *
607 616 * RETURN: Status
608 617 *
609 618 * DESCRIPTION: This function is called to get the _PRS value of an object
610 619 * contained in an object specified by the handle passed in
611 620 *
612 621 * If the function fails an appropriate status will be returned
613 622 * and the contents of the callers buffer is undefined.
614 623 *
615 624 ******************************************************************************/
616 625
617 626 ACPI_STATUS
618 627 AcpiRsGetPrsMethodData (
619 628 ACPI_NAMESPACE_NODE *Node,
620 629 ACPI_BUFFER *RetBuffer)
621 630 {
622 631 ACPI_OPERAND_OBJECT *ObjDesc;
623 632 ACPI_STATUS Status;
624 633
625 634
626 635 ACPI_FUNCTION_TRACE (RsGetPrsMethodData);
627 636
628 637
629 638 /* Parameters guaranteed valid by caller */
630 639
631 640 /* Execute the method, no parameters */
632 641
633 642 Status = AcpiUtEvaluateObject (Node, METHOD_NAME__PRS,
634 643 ACPI_BTYPE_BUFFER, &ObjDesc);
635 644 if (ACPI_FAILURE (Status))
636 645 {
637 646 return_ACPI_STATUS (Status);
638 647 }
639 648
640 649 /*
641 650 * Make the call to create a resource linked list from the
642 651 * byte stream buffer that comes back from the _CRS method
643 652 * execution.
644 653 */
645 654 Status = AcpiRsCreateResourceList (ObjDesc, RetBuffer);
↓ open down ↓ |
436 lines elided |
↑ open up ↑ |
646 655
647 656 /* On exit, we must delete the object returned by evaluateObject */
648 657
649 658 AcpiUtRemoveReference (ObjDesc);
650 659 return_ACPI_STATUS (Status);
651 660 }
652 661
653 662
654 663 /*******************************************************************************
655 664 *
665 + * FUNCTION: AcpiRsGetAeiMethodData
666 + *
667 + * PARAMETERS: Node - Device node
668 + * RetBuffer - Pointer to a buffer structure for the
669 + * results
670 + *
671 + * RETURN: Status
672 + *
673 + * DESCRIPTION: This function is called to get the _AEI value of an object
674 + * contained in an object specified by the handle passed in
675 + *
676 + * If the function fails an appropriate status will be returned
677 + * and the contents of the callers buffer is undefined.
678 + *
679 + ******************************************************************************/
680 +
681 +ACPI_STATUS
682 +AcpiRsGetAeiMethodData (
683 + ACPI_NAMESPACE_NODE *Node,
684 + ACPI_BUFFER *RetBuffer)
685 +{
686 + ACPI_OPERAND_OBJECT *ObjDesc;
687 + ACPI_STATUS Status;
688 +
689 +
690 + ACPI_FUNCTION_TRACE (RsGetAeiMethodData);
691 +
692 +
693 + /* Parameters guaranteed valid by caller */
694 +
695 + /* Execute the method, no parameters */
696 +
697 + Status = AcpiUtEvaluateObject (Node, METHOD_NAME__AEI,
698 + ACPI_BTYPE_BUFFER, &ObjDesc);
699 + if (ACPI_FAILURE (Status))
700 + {
701 + return_ACPI_STATUS (Status);
702 + }
703 +
704 + /*
705 + * Make the call to create a resource linked list from the
706 + * byte stream buffer that comes back from the _CRS method
707 + * execution.
708 + */
709 + Status = AcpiRsCreateResourceList (ObjDesc, RetBuffer);
710 +
711 + /* On exit, we must delete the object returned by evaluateObject */
712 +
713 + AcpiUtRemoveReference (ObjDesc);
714 + return_ACPI_STATUS (Status);
715 +}
716 +
717 +
718 +/*******************************************************************************
719 + *
656 720 * FUNCTION: AcpiRsGetMethodData
657 721 *
658 722 * PARAMETERS: Handle - Handle to the containing object
659 723 * Path - Path to method, relative to Handle
660 724 * RetBuffer - Pointer to a buffer structure for the
661 725 * results
662 726 *
663 727 * RETURN: Status
664 728 *
665 729 * DESCRIPTION: This function is called to get the _CRS or _PRS value of an
666 730 * object contained in an object specified by the handle passed in
667 731 *
668 732 * If the function fails an appropriate status will be returned
669 733 * and the contents of the callers buffer is undefined.
670 734 *
671 735 ******************************************************************************/
672 736
673 737 ACPI_STATUS
674 738 AcpiRsGetMethodData (
675 739 ACPI_HANDLE Handle,
676 740 char *Path,
677 741 ACPI_BUFFER *RetBuffer)
678 742 {
679 743 ACPI_OPERAND_OBJECT *ObjDesc;
↓ open down ↓ |
14 lines elided |
↑ open up ↑ |
680 744 ACPI_STATUS Status;
681 745
682 746
683 747 ACPI_FUNCTION_TRACE (RsGetMethodData);
684 748
685 749
686 750 /* Parameters guaranteed valid by caller */
687 751
688 752 /* Execute the method, no parameters */
689 753
690 - Status = AcpiUtEvaluateObject (Handle, Path, ACPI_BTYPE_BUFFER, &ObjDesc);
754 + Status = AcpiUtEvaluateObject (ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, Handle),
755 + Path, ACPI_BTYPE_BUFFER, &ObjDesc);
691 756 if (ACPI_FAILURE (Status))
692 757 {
693 758 return_ACPI_STATUS (Status);
694 759 }
695 760
696 761 /*
697 762 * Make the call to create a resource linked list from the
698 763 * byte stream buffer that comes back from the method
699 764 * execution.
700 765 */
701 766 Status = AcpiRsCreateResourceList (ObjDesc, RetBuffer);
702 767
703 768 /* On exit, we must delete the object returned by EvaluateObject */
704 769
705 770 AcpiUtRemoveReference (ObjDesc);
706 771 return_ACPI_STATUS (Status);
707 772 }
708 773
709 774
710 775 /*******************************************************************************
711 776 *
712 777 * FUNCTION: AcpiRsSetSrsMethodData
713 778 *
714 779 * PARAMETERS: Node - Device node
715 780 * InBuffer - Pointer to a buffer structure of the
716 781 * parameter
717 782 *
718 783 * RETURN: Status
719 784 *
720 785 * DESCRIPTION: This function is called to set the _SRS of an object contained
721 786 * in an object specified by the handle passed in
722 787 *
723 788 * If the function fails an appropriate status will be returned
724 789 * and the contents of the callers buffer is undefined.
725 790 *
726 791 * Note: Parameters guaranteed valid by caller
727 792 *
728 793 ******************************************************************************/
729 794
730 795 ACPI_STATUS
731 796 AcpiRsSetSrsMethodData (
732 797 ACPI_NAMESPACE_NODE *Node,
733 798 ACPI_BUFFER *InBuffer)
734 799 {
735 800 ACPI_EVALUATE_INFO *Info;
736 801 ACPI_OPERAND_OBJECT *Args[2];
737 802 ACPI_STATUS Status;
738 803 ACPI_BUFFER Buffer;
739 804
740 805
741 806 ACPI_FUNCTION_TRACE (RsSetSrsMethodData);
742 807
↓ open down ↓ |
42 lines elided |
↑ open up ↑ |
743 808
744 809 /* Allocate and initialize the evaluation information block */
745 810
746 811 Info = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_EVALUATE_INFO));
747 812 if (!Info)
748 813 {
749 814 return_ACPI_STATUS (AE_NO_MEMORY);
750 815 }
751 816
752 817 Info->PrefixNode = Node;
753 - Info->Pathname = METHOD_NAME__SRS;
818 + Info->RelativePathname = METHOD_NAME__SRS;
754 819 Info->Parameters = Args;
755 820 Info->Flags = ACPI_IGNORE_RETURN_VALUE;
756 821
757 822 /*
758 823 * The InBuffer parameter will point to a linked list of
759 824 * resource parameters. It needs to be formatted into a
760 825 * byte stream to be sent in as an input parameter to _SRS
761 826 *
762 827 * Convert the linked list into a byte stream
763 828 */
764 829 Buffer.Length = ACPI_ALLOCATE_LOCAL_BUFFER;
765 - Status = AcpiRsCreateAmlResources (InBuffer->Pointer, &Buffer);
830 + Status = AcpiRsCreateAmlResources (InBuffer, &Buffer);
766 831 if (ACPI_FAILURE (Status))
767 832 {
768 833 goto Cleanup;
769 834 }
770 835
771 836 /* Create and initialize the method parameter object */
772 837
773 838 Args[0] = AcpiUtCreateInternalObject (ACPI_TYPE_BUFFER);
774 839 if (!Args[0])
775 840 {
776 841 /*
777 842 * Must free the buffer allocated above (otherwise it is freed
778 843 * later)
779 844 */
780 845 ACPI_FREE (Buffer.Pointer);
781 846 Status = AE_NO_MEMORY;
782 847 goto Cleanup;
783 848 }
784 849
785 850 Args[0]->Buffer.Length = (UINT32) Buffer.Length;
786 851 Args[0]->Buffer.Pointer = Buffer.Pointer;
787 852 Args[0]->Common.Flags = AOPOBJ_DATA_VALID;
788 853 Args[1] = NULL;
789 854
790 855 /* Execute the method, no return value is expected */
791 856
↓ open down ↓ |
16 lines elided |
↑ open up ↑ |
792 857 Status = AcpiNsEvaluate (Info);
793 858
794 859 /* Clean up and return the status from AcpiNsEvaluate */
795 860
796 861 AcpiUtRemoveReference (Args[0]);
797 862
798 863 Cleanup:
799 864 ACPI_FREE (Info);
800 865 return_ACPI_STATUS (Status);
801 866 }
802 -
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX