Print this page
update to acpica-unix2-20140114
acpica-unix2-20130823
PANKOVs restructure
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/uts/intel/io/acpica/events/evrgnini.c
+++ new/usr/src/common/acpica/components/events/evrgnini.c
1 1 /******************************************************************************
2 2 *
3 3 * Module Name: evrgnini- ACPI AddressSpace (OpRegion) init
4 4 *
5 5 *****************************************************************************/
6 6
7 7 /*
8 - * Copyright (C) 2000 - 2011, Intel Corp.
8 + * Copyright (C) 2000 - 2014, 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 __EVRGNINI_C__
46 46
47 47 #include "acpi.h"
48 48 #include "accommon.h"
49 49 #include "acevents.h"
50 50 #include "acnamesp.h"
51 51
52 52 #define _COMPONENT ACPI_EVENTS
53 53 ACPI_MODULE_NAME ("evrgnini")
54 54
55 55 /* Local prototypes */
56 56
57 57 static BOOLEAN
58 58 AcpiEvIsPciRootBridge (
59 59 ACPI_NAMESPACE_NODE *Node);
60 60
61 61
62 62 /*******************************************************************************
63 63 *
64 64 * FUNCTION: AcpiEvSystemMemoryRegionSetup
65 65 *
66 66 * PARAMETERS: Handle - Region we are interested in
67 67 * Function - Start or stop
68 68 * HandlerContext - Address space handler context
69 69 * RegionContext - Region specific context
70 70 *
71 71 * RETURN: Status
72 72 *
73 73 * DESCRIPTION: Setup a SystemMemory operation region
74 74 *
75 75 ******************************************************************************/
76 76
77 77 ACPI_STATUS
78 78 AcpiEvSystemMemoryRegionSetup (
79 79 ACPI_HANDLE Handle,
80 80 UINT32 Function,
81 81 void *HandlerContext,
82 82 void **RegionContext)
83 83 {
84 84 ACPI_OPERAND_OBJECT *RegionDesc = (ACPI_OPERAND_OBJECT *) Handle;
85 85 ACPI_MEM_SPACE_CONTEXT *LocalRegionContext;
86 86
87 87
88 88 ACPI_FUNCTION_TRACE (EvSystemMemoryRegionSetup);
89 89
90 90
91 91 if (Function == ACPI_REGION_DEACTIVATE)
92 92 {
93 93 if (*RegionContext)
94 94 {
95 95 LocalRegionContext = (ACPI_MEM_SPACE_CONTEXT *) *RegionContext;
96 96
97 97 /* Delete a cached mapping if present */
98 98
99 99 if (LocalRegionContext->MappedLength)
100 100 {
101 101 AcpiOsUnmapMemory (LocalRegionContext->MappedLogicalAddress,
102 102 LocalRegionContext->MappedLength);
103 103 }
104 104 ACPI_FREE (LocalRegionContext);
105 105 *RegionContext = NULL;
106 106 }
107 107 return_ACPI_STATUS (AE_OK);
108 108 }
109 109
110 110 /* Create a new context */
111 111
112 112 LocalRegionContext = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_MEM_SPACE_CONTEXT));
113 113 if (!(LocalRegionContext))
114 114 {
115 115 return_ACPI_STATUS (AE_NO_MEMORY);
116 116 }
117 117
118 118 /* Save the region length and address for use in the handler */
119 119
120 120 LocalRegionContext->Length = RegionDesc->Region.Length;
121 121 LocalRegionContext->Address = RegionDesc->Region.Address;
122 122
123 123 *RegionContext = LocalRegionContext;
124 124 return_ACPI_STATUS (AE_OK);
125 125 }
126 126
127 127
128 128 /*******************************************************************************
129 129 *
130 130 * FUNCTION: AcpiEvIoSpaceRegionSetup
131 131 *
132 132 * PARAMETERS: Handle - Region we are interested in
133 133 * Function - Start or stop
134 134 * HandlerContext - Address space handler context
135 135 * RegionContext - Region specific context
136 136 *
137 137 * RETURN: Status
138 138 *
139 139 * DESCRIPTION: Setup a IO operation region
140 140 *
141 141 ******************************************************************************/
142 142
143 143 ACPI_STATUS
144 144 AcpiEvIoSpaceRegionSetup (
145 145 ACPI_HANDLE Handle,
146 146 UINT32 Function,
147 147 void *HandlerContext,
148 148 void **RegionContext)
149 149 {
150 150 ACPI_FUNCTION_TRACE (EvIoSpaceRegionSetup);
151 151
152 152
153 153 if (Function == ACPI_REGION_DEACTIVATE)
154 154 {
155 155 *RegionContext = NULL;
156 156 }
157 157 else
158 158 {
159 159 *RegionContext = HandlerContext;
160 160 }
161 161
162 162 return_ACPI_STATUS (AE_OK);
163 163 }
164 164
165 165
166 166 /*******************************************************************************
167 167 *
168 168 * FUNCTION: AcpiEvPciConfigRegionSetup
169 169 *
170 170 * PARAMETERS: Handle - Region we are interested in
171 171 * Function - Start or stop
172 172 * HandlerContext - Address space handler context
173 173 * RegionContext - Region specific context
174 174 *
175 175 * RETURN: Status
176 176 *
177 177 * DESCRIPTION: Setup a PCI_Config operation region
178 178 *
179 179 * MUTEX: Assumes namespace is not locked
180 180 *
181 181 ******************************************************************************/
182 182
183 183 ACPI_STATUS
184 184 AcpiEvPciConfigRegionSetup (
185 185 ACPI_HANDLE Handle,
186 186 UINT32 Function,
187 187 void *HandlerContext,
188 188 void **RegionContext)
189 189 {
190 190 ACPI_STATUS Status = AE_OK;
191 191 UINT64 PciValue;
192 192 ACPI_PCI_ID *PciId = *RegionContext;
193 193 ACPI_OPERAND_OBJECT *HandlerObj;
194 194 ACPI_NAMESPACE_NODE *ParentNode;
195 195 ACPI_NAMESPACE_NODE *PciRootNode;
196 196 ACPI_NAMESPACE_NODE *PciDeviceNode;
197 197 ACPI_OPERAND_OBJECT *RegionObj = (ACPI_OPERAND_OBJECT *) Handle;
198 198
199 199
200 200 ACPI_FUNCTION_TRACE (EvPciConfigRegionSetup);
201 201
202 202
203 203 HandlerObj = RegionObj->Region.Handler;
204 204 if (!HandlerObj)
205 205 {
206 206 /*
207 207 * No installed handler. This shouldn't happen because the dispatch
208 208 * routine checks before we get here, but we check again just in case.
209 209 */
210 210 ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION,
211 211 "Attempting to init a region %p, with no handler\n", RegionObj));
212 212 return_ACPI_STATUS (AE_NOT_EXIST);
213 213 }
214 214
215 215 *RegionContext = NULL;
216 216 if (Function == ACPI_REGION_DEACTIVATE)
217 217 {
218 218 if (PciId)
219 219 {
220 220 ACPI_FREE (PciId);
221 221 }
222 222 return_ACPI_STATUS (Status);
223 223 }
224 224
225 225 ParentNode = RegionObj->Region.Node->Parent;
226 226
227 227 /*
228 228 * Get the _SEG and _BBN values from the device upon which the handler
229 229 * is installed.
230 230 *
231 231 * We need to get the _SEG and _BBN objects relative to the PCI BUS device.
232 232 * This is the device the handler has been registered to handle.
233 233 */
234 234
235 235 /*
236 236 * If the AddressSpace.Node is still pointing to the root, we need
237 237 * to scan upward for a PCI Root bridge and re-associate the OpRegion
238 238 * handlers with that device.
239 239 */
240 240 if (HandlerObj->AddressSpace.Node == AcpiGbl_RootNode)
241 241 {
242 242 /* Start search from the parent object */
243 243
244 244 PciRootNode = ParentNode;
245 245 while (PciRootNode != AcpiGbl_RootNode)
246 246 {
247 247 /* Get the _HID/_CID in order to detect a RootBridge */
248 248
249 249 if (AcpiEvIsPciRootBridge (PciRootNode))
250 250 {
251 251 /* Install a handler for this PCI root bridge */
252 252
253 253 Status = AcpiInstallAddressSpaceHandler (
254 254 (ACPI_HANDLE) PciRootNode,
255 255 ACPI_ADR_SPACE_PCI_CONFIG,
256 256 ACPI_DEFAULT_HANDLER, NULL, NULL);
257 257 if (ACPI_FAILURE (Status))
258 258 {
259 259 if (Status == AE_SAME_HANDLER)
260 260 {
261 261 /*
262 262 * It is OK if the handler is already installed on the
263 263 * root bridge. Still need to return a context object
264 264 * for the new PCI_Config operation region, however.
265 265 */
266 266 Status = AE_OK;
267 267 }
268 268 else
269 269 {
270 270 ACPI_EXCEPTION ((AE_INFO, Status,
271 271 "Could not install PciConfig handler "
272 272 "for Root Bridge %4.4s",
273 273 AcpiUtGetNodeName (PciRootNode)));
274 274 }
275 275 }
276 276 break;
277 277 }
278 278
279 279 PciRootNode = PciRootNode->Parent;
280 280 }
281 281
282 282 /* PCI root bridge not found, use namespace root node */
283 283 }
284 284 else
285 285 {
286 286 PciRootNode = HandlerObj->AddressSpace.Node;
287 287 }
288 288
289 289 /*
290 290 * If this region is now initialized, we are done.
291 291 * (InstallAddressSpaceHandler could have initialized it)
292 292 */
293 293 if (RegionObj->Region.Flags & AOPOBJ_SETUP_COMPLETE)
294 294 {
295 295 return_ACPI_STATUS (AE_OK);
296 296 }
297 297
298 298 /* Region is still not initialized. Create a new context */
299 299
300 300 PciId = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_PCI_ID));
301 301 if (!PciId)
302 302 {
303 303 return_ACPI_STATUS (AE_NO_MEMORY);
304 304 }
305 305
306 306 /*
307 307 * For PCI_Config space access, we need the segment, bus, device and
308 308 * function numbers. Acquire them here.
309 309 *
310 310 * Find the parent device object. (This allows the operation region to be
311 311 * within a subscope under the device, such as a control method.)
312 312 */
313 313 PciDeviceNode = RegionObj->Region.Node;
314 314 while (PciDeviceNode && (PciDeviceNode->Type != ACPI_TYPE_DEVICE))
315 315 {
316 316 PciDeviceNode = PciDeviceNode->Parent;
317 317 }
318 318
319 319 if (!PciDeviceNode)
320 320 {
321 321 ACPI_FREE (PciId);
322 322 return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
323 323 }
324 324
325 325 /*
326 326 * Get the PCI device and function numbers from the _ADR object
327 327 * contained in the parent's scope.
328 328 */
329 329 Status = AcpiUtEvaluateNumericObject (METHOD_NAME__ADR,
330 330 PciDeviceNode, &PciValue);
331 331
332 332 /*
333 333 * The default is zero, and since the allocation above zeroed the data,
334 334 * just do nothing on failure.
335 335 */
336 336 if (ACPI_SUCCESS (Status))
337 337 {
338 338 PciId->Device = ACPI_HIWORD (ACPI_LODWORD (PciValue));
339 339 PciId->Function = ACPI_LOWORD (ACPI_LODWORD (PciValue));
340 340 }
341 341
342 342 /* The PCI segment number comes from the _SEG method */
343 343
344 344 Status = AcpiUtEvaluateNumericObject (METHOD_NAME__SEG,
345 345 PciRootNode, &PciValue);
346 346 if (ACPI_SUCCESS (Status))
347 347 {
348 348 PciId->Segment = ACPI_LOWORD (PciValue);
349 349 }
350 350
351 351 /* The PCI bus number comes from the _BBN method */
352 352
353 353 Status = AcpiUtEvaluateNumericObject (METHOD_NAME__BBN,
354 354 PciRootNode, &PciValue);
355 355 if (ACPI_SUCCESS (Status))
356 356 {
357 357 PciId->Bus = ACPI_LOWORD (PciValue);
358 358 }
359 359
360 360 /* Complete/update the PCI ID for this device */
361 361
362 362 Status = AcpiHwDerivePciId (PciId, PciRootNode, RegionObj->Region.Node);
363 363 if (ACPI_FAILURE (Status))
364 364 {
365 365 ACPI_FREE (PciId);
366 366 return_ACPI_STATUS (Status);
367 367 }
368 368
369 369 *RegionContext = PciId;
370 370 return_ACPI_STATUS (AE_OK);
371 371 }
372 372
373 373
374 374 /*******************************************************************************
375 375 *
376 376 * FUNCTION: AcpiEvIsPciRootBridge
377 377 *
378 378 * PARAMETERS: Node - Device node being examined
379 379 *
380 380 * RETURN: TRUE if device is a PCI/PCI-Express Root Bridge
381 381 *
↓ open down ↓ |
363 lines elided |
↑ open up ↑ |
382 382 * DESCRIPTION: Determine if the input device represents a PCI Root Bridge by
383 383 * examining the _HID and _CID for the device.
384 384 *
385 385 ******************************************************************************/
386 386
387 387 static BOOLEAN
388 388 AcpiEvIsPciRootBridge (
389 389 ACPI_NAMESPACE_NODE *Node)
390 390 {
391 391 ACPI_STATUS Status;
392 - ACPI_DEVICE_ID *Hid;
393 - ACPI_DEVICE_ID_LIST *Cid;
392 + ACPI_PNP_DEVICE_ID *Hid;
393 + ACPI_PNP_DEVICE_ID_LIST *Cid;
394 394 UINT32 i;
395 395 BOOLEAN Match;
396 396
397 397
398 398 /* Get the _HID and check for a PCI Root Bridge */
399 399
400 400 Status = AcpiUtExecute_HID (Node, &Hid);
401 401 if (ACPI_FAILURE (Status))
402 402 {
403 403 return (FALSE);
404 404 }
405 405
406 406 Match = AcpiUtIsPciRootBridge (Hid->String);
407 407 ACPI_FREE (Hid);
408 408
409 409 if (Match)
410 410 {
411 411 return (TRUE);
412 412 }
413 413
414 414 /* The _HID did not match. Get the _CID and check for a PCI Root Bridge */
415 415
416 416 Status = AcpiUtExecute_CID (Node, &Cid);
417 417 if (ACPI_FAILURE (Status))
418 418 {
419 419 return (FALSE);
420 420 }
421 421
422 422 /* Check all _CIDs in the returned list */
423 423
424 424 for (i = 0; i < Cid->Count; i++)
425 425 {
426 426 if (AcpiUtIsPciRootBridge (Cid->Ids[i].String))
427 427 {
428 428 ACPI_FREE (Cid);
429 429 return (TRUE);
430 430 }
431 431 }
432 432
433 433 ACPI_FREE (Cid);
434 434 return (FALSE);
435 435 }
436 436
437 437
438 438 /*******************************************************************************
439 439 *
440 440 * FUNCTION: AcpiEvPciBarRegionSetup
441 441 *
442 442 * PARAMETERS: Handle - Region we are interested in
443 443 * Function - Start or stop
444 444 * HandlerContext - Address space handler context
445 445 * RegionContext - Region specific context
446 446 *
447 447 * RETURN: Status
448 448 *
449 449 * DESCRIPTION: Setup a PciBAR operation region
450 450 *
451 451 * MUTEX: Assumes namespace is not locked
452 452 *
453 453 ******************************************************************************/
454 454
455 455 ACPI_STATUS
456 456 AcpiEvPciBarRegionSetup (
457 457 ACPI_HANDLE Handle,
458 458 UINT32 Function,
459 459 void *HandlerContext,
460 460 void **RegionContext)
461 461 {
462 462 ACPI_FUNCTION_TRACE (EvPciBarRegionSetup);
463 463
464 464
465 465 return_ACPI_STATUS (AE_OK);
466 466 }
467 467
468 468
469 469 /*******************************************************************************
470 470 *
471 471 * FUNCTION: AcpiEvCmosRegionSetup
472 472 *
473 473 * PARAMETERS: Handle - Region we are interested in
474 474 * Function - Start or stop
475 475 * HandlerContext - Address space handler context
476 476 * RegionContext - Region specific context
477 477 *
478 478 * RETURN: Status
479 479 *
480 480 * DESCRIPTION: Setup a CMOS operation region
481 481 *
482 482 * MUTEX: Assumes namespace is not locked
483 483 *
484 484 ******************************************************************************/
485 485
486 486 ACPI_STATUS
487 487 AcpiEvCmosRegionSetup (
488 488 ACPI_HANDLE Handle,
489 489 UINT32 Function,
490 490 void *HandlerContext,
491 491 void **RegionContext)
492 492 {
493 493 ACPI_FUNCTION_TRACE (EvCmosRegionSetup);
494 494
495 495
496 496 return_ACPI_STATUS (AE_OK);
497 497 }
498 498
499 499
500 500 /*******************************************************************************
501 501 *
502 502 * FUNCTION: AcpiEvDefaultRegionSetup
503 503 *
504 504 * PARAMETERS: Handle - Region we are interested in
505 505 * Function - Start or stop
506 506 * HandlerContext - Address space handler context
507 507 * RegionContext - Region specific context
508 508 *
509 509 * RETURN: Status
510 510 *
511 511 * DESCRIPTION: Default region initialization
512 512 *
513 513 ******************************************************************************/
514 514
515 515 ACPI_STATUS
516 516 AcpiEvDefaultRegionSetup (
517 517 ACPI_HANDLE Handle,
518 518 UINT32 Function,
519 519 void *HandlerContext,
520 520 void **RegionContext)
521 521 {
522 522 ACPI_FUNCTION_TRACE (EvDefaultRegionSetup);
523 523
524 524
525 525 if (Function == ACPI_REGION_DEACTIVATE)
526 526 {
527 527 *RegionContext = NULL;
528 528 }
529 529 else
530 530 {
531 531 *RegionContext = HandlerContext;
532 532 }
533 533
534 534 return_ACPI_STATUS (AE_OK);
535 535 }
536 536
537 537
538 538 /*******************************************************************************
539 539 *
540 540 * FUNCTION: AcpiEvInitializeRegion
541 541 *
542 542 * PARAMETERS: RegionObj - Region we are initializing
543 543 * AcpiNsLocked - Is namespace locked?
544 544 *
545 545 * RETURN: Status
546 546 *
547 547 * DESCRIPTION: Initializes the region, finds any _REG methods and saves them
548 548 * for execution at a later time
549 549 *
550 550 * Get the appropriate address space handler for a newly
551 551 * created region.
552 552 *
553 553 * This also performs address space specific initialization. For
554 554 * example, PCI regions must have an _ADR object that contains
555 555 * a PCI address in the scope of the definition. This address is
556 556 * required to perform an access to PCI config space.
557 557 *
558 558 * MUTEX: Interpreter should be unlocked, because we may run the _REG
559 559 * method for this region.
560 560 *
561 561 ******************************************************************************/
562 562
563 563 ACPI_STATUS
564 564 AcpiEvInitializeRegion (
565 565 ACPI_OPERAND_OBJECT *RegionObj,
566 566 BOOLEAN AcpiNsLocked)
567 567 {
568 568 ACPI_OPERAND_OBJECT *HandlerObj;
569 569 ACPI_OPERAND_OBJECT *ObjDesc;
570 570 ACPI_ADR_SPACE_TYPE SpaceId;
571 571 ACPI_NAMESPACE_NODE *Node;
572 572 ACPI_STATUS Status;
573 573 ACPI_NAMESPACE_NODE *MethodNode;
574 574 ACPI_NAME *RegNamePtr = (ACPI_NAME *) METHOD_NAME__REG;
575 575 ACPI_OPERAND_OBJECT *RegionObj2;
576 576
577 577
578 578 ACPI_FUNCTION_TRACE_U32 (EvInitializeRegion, AcpiNsLocked);
579 579
580 580
581 581 if (!RegionObj)
582 582 {
583 583 return_ACPI_STATUS (AE_BAD_PARAMETER);
584 584 }
585 585
586 586 if (RegionObj->Common.Flags & AOPOBJ_OBJECT_INITIALIZED)
587 587 {
588 588 return_ACPI_STATUS (AE_OK);
589 589 }
590 590
591 591 RegionObj2 = AcpiNsGetSecondaryObject (RegionObj);
592 592 if (!RegionObj2)
593 593 {
594 594 return_ACPI_STATUS (AE_NOT_EXIST);
595 595 }
596 596
597 597 Node = RegionObj->Region.Node->Parent;
598 598 SpaceId = RegionObj->Region.SpaceId;
599 599
600 600 /* Setup defaults */
601 601
602 602 RegionObj->Region.Handler = NULL;
603 603 RegionObj2->Extra.Method_REG = NULL;
604 604 RegionObj->Common.Flags &= ~(AOPOBJ_SETUP_COMPLETE);
605 605 RegionObj->Common.Flags |= AOPOBJ_OBJECT_INITIALIZED;
606 606
607 607 /* Find any "_REG" method associated with this region definition */
608 608
609 609 Status = AcpiNsSearchOneScope (
610 610 *RegNamePtr, Node, ACPI_TYPE_METHOD, &MethodNode);
611 611 if (ACPI_SUCCESS (Status))
612 612 {
613 613 /*
614 614 * The _REG method is optional and there can be only one per region
615 615 * definition. This will be executed when the handler is attached
616 616 * or removed
617 617 */
618 618 RegionObj2->Extra.Method_REG = MethodNode;
619 619 }
620 620
621 621 /*
622 622 * The following loop depends upon the root Node having no parent
623 623 * ie: AcpiGbl_RootNode->ParentEntry being set to NULL
624 624 */
625 625 while (Node)
626 626 {
627 627 /* Check to see if a handler exists */
628 628
629 629 HandlerObj = NULL;
630 630 ObjDesc = AcpiNsGetAttachedObject (Node);
631 631 if (ObjDesc)
632 632 {
633 633 /* Can only be a handler if the object exists */
634 634
635 635 switch (Node->Type)
636 636 {
637 637 case ACPI_TYPE_DEVICE:
638 638
639 639 HandlerObj = ObjDesc->Device.Handler;
640 640 break;
641 641
642 642 case ACPI_TYPE_PROCESSOR:
643 643
644 644 HandlerObj = ObjDesc->Processor.Handler;
645 645 break;
646 646
647 647 case ACPI_TYPE_THERMAL:
648 648
649 649 HandlerObj = ObjDesc->ThermalZone.Handler;
650 650 break;
651 651
652 652 case ACPI_TYPE_METHOD:
653 653 /*
654 654 * If we are executing module level code, the original
655 655 * Node's object was replaced by this Method object and we
656 656 * saved the handler in the method object.
↓ open down ↓ |
253 lines elided |
↑ open up ↑ |
657 657 *
658 658 * See AcpiNsExecModuleCode
659 659 */
660 660 if (ObjDesc->Method.InfoFlags & ACPI_METHOD_MODULE_LEVEL)
661 661 {
662 662 HandlerObj = ObjDesc->Method.Dispatch.Handler;
663 663 }
664 664 break;
665 665
666 666 default:
667 +
667 668 /* Ignore other objects */
669 +
668 670 break;
669 671 }
670 672
671 673 while (HandlerObj)
672 674 {
673 675 /* Is this handler of the correct type? */
674 676
675 677 if (HandlerObj->AddressSpace.SpaceId == SpaceId)
676 678 {
677 679 /* Found correct handler */
678 680
679 681 ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION,
680 682 "Found handler %p for region %p in obj %p\n",
681 683 HandlerObj, RegionObj, ObjDesc));
682 684
683 685 Status = AcpiEvAttachRegion (HandlerObj, RegionObj,
684 686 AcpiNsLocked);
685 687
686 688 /*
687 689 * Tell all users that this region is usable by
688 690 * running the _REG method
689 691 */
690 692 if (AcpiNsLocked)
691 693 {
692 694 Status = AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
693 695 if (ACPI_FAILURE (Status))
694 696 {
695 697 return_ACPI_STATUS (Status);
696 698 }
697 699 }
698 700
699 701 Status = AcpiEvExecuteRegMethod (RegionObj, ACPI_REG_CONNECT);
700 702
701 703 if (AcpiNsLocked)
702 704 {
703 705 Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
704 706 if (ACPI_FAILURE (Status))
705 707 {
706 708 return_ACPI_STATUS (Status);
707 709 }
708 710 }
709 711
710 712 return_ACPI_STATUS (AE_OK);
711 713 }
712 714
713 715 /* Try next handler in the list */
714 716
715 717 HandlerObj = HandlerObj->AddressSpace.Next;
716 718 }
717 719 }
718 720
719 721 /* This node does not have the handler we need; Pop up one level */
720 722
721 723 Node = Node->Parent;
↓ open down ↓ |
44 lines elided |
↑ open up ↑ |
722 724 }
723 725
724 726 /* If we get here, there is no handler for this region */
725 727
726 728 ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION,
727 729 "No handler for RegionType %s(%X) (RegionObj %p)\n",
728 730 AcpiUtGetRegionName (SpaceId), SpaceId, RegionObj));
729 731
730 732 return_ACPI_STATUS (AE_NOT_EXIST);
731 733 }
732 -
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX