Subversion Repositories Kolibri OS

Rev

Rev 1498 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1498 Rev 2216
Line 6... Line 6...
6
 
6
 
7
/******************************************************************************
7
/******************************************************************************
8
 *
8
 *
9
 * 1. Copyright Notice
9
 * 1. Copyright Notice
10
 *
10
 *
11
 * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp.
11
 * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp.
12
 * All rights reserved.
12
 * All rights reserved.
13
 *
13
 *
14
 * 2. License
14
 * 2. License
15
 *
15
 *
Line 465... Line 465...
465
 
465
 
Line 466... Line 466...
466
    /* Initialize the new GPE block */
466
    /* Initialize the new GPE block */
467
 
467
 
-
 
468
    GpeBlock->Node = GpeDevice;
468
    GpeBlock->Node = GpeDevice;
469
    GpeBlock->GpeCount = (UINT16) (RegisterCount * ACPI_GPE_REGISTER_WIDTH);
469
    GpeBlock->GpeCount = (UINT16) (RegisterCount * ACPI_GPE_REGISTER_WIDTH);
470
    GpeBlock->Initialized = FALSE;
Line 470... Line 471...
470
    GpeBlock->RegisterCount = RegisterCount;
471
    GpeBlock->RegisterCount = RegisterCount;
471
    GpeBlock->BlockBaseNumber = GpeBlockBaseNumber;
472
    GpeBlock->BlockBaseNumber = GpeBlockBaseNumber;
Line 491... Line 492...
491
    {
492
    {
492
        ACPI_FREE (GpeBlock);
493
        ACPI_FREE (GpeBlock);
493
        return_ACPI_STATUS (Status);
494
        return_ACPI_STATUS (Status);
494
    }
495
    }
Line -... Line 496...
-
 
496
 
-
 
497
    AcpiGbl_AllGpesInitialized = FALSE;
495
 
498
 
Line 496... Line 499...
496
    /* Find all GPE methods (_Lxx or_Exx) for this block */
499
    /* Find all GPE methods (_Lxx or_Exx) for this block */
497
 
500
 
498
    WalkInfo.GpeBlock = GpeBlock;
-
 
499
    WalkInfo.GpeDevice = GpeDevice;
501
    WalkInfo.GpeBlock = GpeBlock;
Line 500... Line 502...
500
    WalkInfo.EnableThisGpe = FALSE;
502
    WalkInfo.GpeDevice = GpeDevice;
501
    WalkInfo.ExecuteByOwnerId = FALSE;
503
    WalkInfo.ExecuteByOwnerId = FALSE;
502
 
504
 
Line 527... Line 529...
527
 
529
 
528
/*******************************************************************************
530
/*******************************************************************************
529
 *
531
 *
530
 * FUNCTION:    AcpiEvInitializeGpeBlock
532
 * FUNCTION:    AcpiEvInitializeGpeBlock
531
 *
533
 *
532
 * PARAMETERS:  GpeDevice           - Handle to the parent GPE block
-
 
533
 *              GpeBlock            - Gpe Block info
534
 * PARAMETERS:  ACPI_GPE_CALLBACK
534
 *
535
 *
535
 * RETURN:      Status
536
 * RETURN:      Status
536
 *
537
 *
537
 * DESCRIPTION: Initialize and enable a GPE block. First find and run any
-
 
538
 *              _PRT methods associated with the block, then enable the
538
 * DESCRIPTION: Initialize and enable a GPE block. Enable GPEs that have
539
 *              appropriate GPEs.
539
 *              associated methods.
540
 *              Note: Assumes namespace is locked.
540
 *              Note: Assumes namespace is locked.
541
 *
541
 *
Line 542... Line 542...
542
 ******************************************************************************/
542
 ******************************************************************************/
543
 
543
 
544
ACPI_STATUS
544
ACPI_STATUS
545
AcpiEvInitializeGpeBlock (
545
AcpiEvInitializeGpeBlock (
-
 
546
    ACPI_GPE_XRUPT_INFO     *GpeXruptInfo,
546
    ACPI_NAMESPACE_NODE     *GpeDevice,
547
    ACPI_GPE_BLOCK_INFO     *GpeBlock,
547
    ACPI_GPE_BLOCK_INFO     *GpeBlock)
548
    void                    *Ignored)
548
{
549
{
549
    ACPI_STATUS             Status;
-
 
550
    ACPI_GPE_EVENT_INFO     *GpeEventInfo;
-
 
551
    ACPI_GPE_WALK_INFO      WalkInfo;
550
    ACPI_STATUS             Status;
552
    UINT32                  WakeGpeCount;
551
    ACPI_GPE_EVENT_INFO     *GpeEventInfo;
553
    UINT32                  GpeEnabledCount;
-
 
554
    UINT32                  GpeIndex;
552
    UINT32                  GpeEnabledCount;
555
    UINT32                  GpeNumber;
553
    UINT32                  GpeIndex;
Line 556... Line 554...
556
    UINT32                  i;
554
    UINT32                  i;
Line 557... Line -...
557
    UINT32                  j;
-
 
558
 
-
 
559
 
-
 
560
    ACPI_FUNCTION_TRACE (EvInitializeGpeBlock);
-
 
561
 
-
 
562
 
-
 
563
    /* Ignore a null GPE block (e.g., if no GPE block 1 exists) */
-
 
564
 
555
    UINT32                  j;
565
    if (!GpeBlock)
556
 
566
    {
557
 
567
        return_ACPI_STATUS (AE_OK);
558
    ACPI_FUNCTION_TRACE (EvInitializeGpeBlock);
568
    }
559
 
569
 
-
 
570
    /*
-
 
571
     * Runtime option: Should wake GPEs be enabled at runtime?  The default
-
 
572
     * is no, they should only be enabled just as the machine goes to sleep.
-
 
573
     */
-
 
574
    if (AcpiGbl_LeaveWakeGpesDisabled)
-
 
575
    {
-
 
576
        /*
-
 
577
         * Differentiate runtime vs wake GPEs, via the _PRW control methods.
-
 
578
         * Each GPE that has one or more _PRWs that reference it is by
-
 
579
         * definition a wake GPE and will not be enabled while the machine
-
 
580
         * is running.
-
 
581
         */
-
 
582
        WalkInfo.GpeBlock = GpeBlock;
-
 
583
        WalkInfo.GpeDevice = GpeDevice;
-
 
584
        WalkInfo.ExecuteByOwnerId = FALSE;
560
 
585
 
561
    /*
586
        Status = AcpiNsWalkNamespace (ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT,
-
 
587
                    ACPI_UINT32_MAX, ACPI_NS_WALK_UNLOCK,
562
     * Ignore a null GPE block (e.g., if no GPE block 1 exists), and
Line 588... Line 563...
588
                    AcpiEvMatchPrwAndGpe, NULL, &WalkInfo, NULL);
563
     * any GPE blocks that have been initialized already.
589
        if (ACPI_FAILURE (Status))
564
     */
590
        {
565
    if (!GpeBlock || GpeBlock->Initialized)
591
            ACPI_EXCEPTION ((AE_INFO, Status, "While executing _PRW methods"));
566
    {
592
        }
567
        return_ACPI_STATUS (AE_OK);
593
    }
-
 
594
 
568
    }
Line 595... Line -...
595
    /*
-
 
596
     * Enable all GPEs that have a corresponding method and are not
-
 
597
     * capable of generating wakeups. Any other GPEs within this block
-
 
598
     * must be enabled via the AcpiEnableGpe interface.
-
 
599
     */
-
 
600
    WakeGpeCount = 0;
569
 
601
    GpeEnabledCount = 0;
570
    /*
602
 
571
     * Enable all GPEs that have a corresponding method and have the
603
    if (GpeDevice == AcpiGbl_FadtGpeDevice)
572
     * ACPI_GPE_CAN_WAKE flag unset. Any other GPEs within this block
604
    {
573
     * must be enabled via the acpi_enable_gpe() interface.
Line 605... Line 574...
605
        GpeDevice = NULL;
574
     */
606
    }
575
    GpeEnabledCount = 0;
Line 607... Line -...
607
 
-
 
608
    for (i = 0; i < GpeBlock->RegisterCount; i++)
-
 
609
    {
-
 
610
        for (j = 0; j < ACPI_GPE_REGISTER_WIDTH; j++)
576
 
611
        {
577
    for (i = 0; i < GpeBlock->RegisterCount; i++)
612
            /* Get the info block for this particular GPE */
578
    {
613
 
579
        for (j = 0; j < ACPI_GPE_REGISTER_WIDTH; j++)
614
            GpeIndex = (i * ACPI_GPE_REGISTER_WIDTH) + j;
580
        {
615
            GpeEventInfo = &GpeBlock->EventInfo[GpeIndex];
-
 
616
 
-
 
617
            /* Ignore GPEs that can wake the system */
-
 
618
 
581
            /* Get the info block for this particular GPE */
619
            if (GpeEventInfo->Flags & ACPI_GPE_CAN_WAKE)
-
 
620
            {
582
 
621
                WakeGpeCount++;
583
            GpeIndex = (i * ACPI_GPE_REGISTER_WIDTH) + j;
622
                if (AcpiGbl_LeaveWakeGpesDisabled)
584
            GpeEventInfo = &GpeBlock->EventInfo[GpeIndex];
623
                {
585
 
Line 624... Line -...
624
                    continue;
-
 
625
                }
-
 
626
            }
-
 
627
 
586
            /*
628
            /* Ignore GPEs that have no corresponding _Lxx/_Exx method */
-
 
629
 
587
             * Ignore GPEs that have no corresponding _Lxx/_Exx method
630
            if (!(GpeEventInfo->Flags & ACPI_GPE_DISPATCH_METHOD))
588
             * and GPEs that are used to wake the system
631
            {
589
             */
632
                continue;
590
            if (((GpeEventInfo->Flags & ACPI_GPE_DISPATCH_MASK) == ACPI_GPE_DISPATCH_NONE) ||
-
 
591
                ((GpeEventInfo->Flags & ACPI_GPE_DISPATCH_MASK) == ACPI_GPE_DISPATCH_HANDLER) ||
633
            }
592
                (GpeEventInfo->Flags & ACPI_GPE_CAN_WAKE))
634
 
593
            {
Line 635... Line 594...
635
            /* Enable this GPE */
594
                continue;
636
 
595
            }
637
            GpeNumber = GpeIndex + GpeBlock->BlockBaseNumber;
596
 
Line 638... Line 597...
638
            Status = AcpiEnableGpe (GpeDevice, GpeNumber,
597
            Status = AcpiEvAddGpeReference (GpeEventInfo);
639
                        ACPI_GPE_TYPE_RUNTIME);
598
            if (ACPI_FAILURE (Status))
640
            if (ACPI_FAILURE (Status))
599
            {
641
            {
-
 
642
                ACPI_EXCEPTION ((AE_INFO, Status,
600
                ACPI_EXCEPTION ((AE_INFO, Status,
643
                    "Could not enable GPE 0x%02X", GpeNumber));
601
                    "Could not enable GPE 0x%02X",
Line -... Line 602...
-
 
602
                    GpeIndex + GpeBlock->BlockBaseNumber));
644
                continue;
603
                continue;
645
            }
604
            }