1 /******************************************************************************
2 *
3 * Module Name: evrgnini- ACPI AddressSpace (OpRegion) init
4 *
5 *****************************************************************************/
6
7 /*
8 * Copyright (C) 2000 - 2011, Intel Corp.
9 * All rights reserved.
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions, and the following disclaimer,
16 * without modification.
17 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18 * substantially similar to the "NO WARRANTY" disclaimer below
19 * ("Disclaimer") and any redistribution must be conditioned upon
20 * including a substantially similar Disclaimer requirement for further
21 * binary redistribution.
22 * 3. Neither the names of the above-listed copyright holders nor the names
23 * of any contributors may be used to endorse or promote products derived
24 * from this software without specific prior written permission.
25 *
26 * Alternatively, this software may be distributed under the terms of the
27 * GNU General Public License ("GPL") version 2 as published by the Free
28 * Software Foundation.
372
373
374 /*******************************************************************************
375 *
376 * FUNCTION: AcpiEvIsPciRootBridge
377 *
378 * PARAMETERS: Node - Device node being examined
379 *
380 * RETURN: TRUE if device is a PCI/PCI-Express Root Bridge
381 *
382 * DESCRIPTION: Determine if the input device represents a PCI Root Bridge by
383 * examining the _HID and _CID for the device.
384 *
385 ******************************************************************************/
386
387 static BOOLEAN
388 AcpiEvIsPciRootBridge (
389 ACPI_NAMESPACE_NODE *Node)
390 {
391 ACPI_STATUS Status;
392 ACPI_DEVICE_ID *Hid;
393 ACPI_DEVICE_ID_LIST *Cid;
394 UINT32 i;
395 BOOLEAN Match;
396
397
398 /* Get the _HID and check for a PCI Root Bridge */
399
400 Status = AcpiUtExecute_HID (Node, &Hid);
401 if (ACPI_FAILURE (Status))
402 {
403 return (FALSE);
404 }
405
406 Match = AcpiUtIsPciRootBridge (Hid->String);
407 ACPI_FREE (Hid);
408
409 if (Match)
410 {
411 return (TRUE);
412 }
413
647 case ACPI_TYPE_THERMAL:
648
649 HandlerObj = ObjDesc->ThermalZone.Handler;
650 break;
651
652 case ACPI_TYPE_METHOD:
653 /*
654 * If we are executing module level code, the original
655 * Node's object was replaced by this Method object and we
656 * saved the handler in the method object.
657 *
658 * See AcpiNsExecModuleCode
659 */
660 if (ObjDesc->Method.InfoFlags & ACPI_METHOD_MODULE_LEVEL)
661 {
662 HandlerObj = ObjDesc->Method.Dispatch.Handler;
663 }
664 break;
665
666 default:
667 /* Ignore other objects */
668 break;
669 }
670
671 while (HandlerObj)
672 {
673 /* Is this handler of the correct type? */
674
675 if (HandlerObj->AddressSpace.SpaceId == SpaceId)
676 {
677 /* Found correct handler */
678
679 ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION,
680 "Found handler %p for region %p in obj %p\n",
681 HandlerObj, RegionObj, ObjDesc));
682
683 Status = AcpiEvAttachRegion (HandlerObj, RegionObj,
684 AcpiNsLocked);
685
686 /*
687 * Tell all users that this region is usable by
712
713 /* Try next handler in the list */
714
715 HandlerObj = HandlerObj->AddressSpace.Next;
716 }
717 }
718
719 /* This node does not have the handler we need; Pop up one level */
720
721 Node = Node->Parent;
722 }
723
724 /* If we get here, there is no handler for this region */
725
726 ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION,
727 "No handler for RegionType %s(%X) (RegionObj %p)\n",
728 AcpiUtGetRegionName (SpaceId), SpaceId, RegionObj));
729
730 return_ACPI_STATUS (AE_NOT_EXIST);
731 }
732
|
1 /******************************************************************************
2 *
3 * Module Name: evrgnini- ACPI AddressSpace (OpRegion) init
4 *
5 *****************************************************************************/
6
7 /*
8 * Copyright (C) 2000 - 2013, Intel Corp.
9 * All rights reserved.
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions, and the following disclaimer,
16 * without modification.
17 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18 * substantially similar to the "NO WARRANTY" disclaimer below
19 * ("Disclaimer") and any redistribution must be conditioned upon
20 * including a substantially similar Disclaimer requirement for further
21 * binary redistribution.
22 * 3. Neither the names of the above-listed copyright holders nor the names
23 * of any contributors may be used to endorse or promote products derived
24 * from this software without specific prior written permission.
25 *
26 * Alternatively, this software may be distributed under the terms of the
27 * GNU General Public License ("GPL") version 2 as published by the Free
28 * Software Foundation.
372
373
374 /*******************************************************************************
375 *
376 * FUNCTION: AcpiEvIsPciRootBridge
377 *
378 * PARAMETERS: Node - Device node being examined
379 *
380 * RETURN: TRUE if device is a PCI/PCI-Express Root Bridge
381 *
382 * DESCRIPTION: Determine if the input device represents a PCI Root Bridge by
383 * examining the _HID and _CID for the device.
384 *
385 ******************************************************************************/
386
387 static BOOLEAN
388 AcpiEvIsPciRootBridge (
389 ACPI_NAMESPACE_NODE *Node)
390 {
391 ACPI_STATUS Status;
392 ACPI_PNP_DEVICE_ID *Hid;
393 ACPI_PNP_DEVICE_ID_LIST *Cid;
394 UINT32 i;
395 BOOLEAN Match;
396
397
398 /* Get the _HID and check for a PCI Root Bridge */
399
400 Status = AcpiUtExecute_HID (Node, &Hid);
401 if (ACPI_FAILURE (Status))
402 {
403 return (FALSE);
404 }
405
406 Match = AcpiUtIsPciRootBridge (Hid->String);
407 ACPI_FREE (Hid);
408
409 if (Match)
410 {
411 return (TRUE);
412 }
413
647 case ACPI_TYPE_THERMAL:
648
649 HandlerObj = ObjDesc->ThermalZone.Handler;
650 break;
651
652 case ACPI_TYPE_METHOD:
653 /*
654 * If we are executing module level code, the original
655 * Node's object was replaced by this Method object and we
656 * saved the handler in the method object.
657 *
658 * See AcpiNsExecModuleCode
659 */
660 if (ObjDesc->Method.InfoFlags & ACPI_METHOD_MODULE_LEVEL)
661 {
662 HandlerObj = ObjDesc->Method.Dispatch.Handler;
663 }
664 break;
665
666 default:
667
668 /* Ignore other objects */
669
670 break;
671 }
672
673 while (HandlerObj)
674 {
675 /* Is this handler of the correct type? */
676
677 if (HandlerObj->AddressSpace.SpaceId == SpaceId)
678 {
679 /* Found correct handler */
680
681 ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION,
682 "Found handler %p for region %p in obj %p\n",
683 HandlerObj, RegionObj, ObjDesc));
684
685 Status = AcpiEvAttachRegion (HandlerObj, RegionObj,
686 AcpiNsLocked);
687
688 /*
689 * Tell all users that this region is usable by
714
715 /* Try next handler in the list */
716
717 HandlerObj = HandlerObj->AddressSpace.Next;
718 }
719 }
720
721 /* This node does not have the handler we need; Pop up one level */
722
723 Node = Node->Parent;
724 }
725
726 /* If we get here, there is no handler for this region */
727
728 ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION,
729 "No handler for RegionType %s(%X) (RegionObj %p)\n",
730 AcpiUtGetRegionName (SpaceId), SpaceId, RegionObj));
731
732 return_ACPI_STATUS (AE_NOT_EXIST);
733 }
|